pintura-umd.js 451 KB

123456789
  1. /*!
  2. * Pintura Image Editor 8.13.1
  3. * (c) 2018-2021 PQINA Inc. - All Rights Reserved
  4. * License: https://pqina.nl/pintura/license/
  5. */
  6. /* eslint-disable */
  7. !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).pintura={})}(this,(function(e){"use strict";const t={65505:"exif",65504:"jfif",65498:"sos"};var o=e=>{if(65496!==e.getUint16(0))return;const o=Object.keys(t).map((e=>parseInt(e,10))),i=e.byteLength;let n,r=2,a=void 0;for(;r<i&&255===e.getUint8(r);){if(n=e.getUint16(r),o.includes(n)){const o=t[n];a||(a={}),a[o]||(a[o]={offset:r,size:e.getUint16(r+2)})}if(65498===n)break;r+=2+e.getUint16(r+2)}return a};var i=(e,t,i)=>{if(!e)return;const n=new DataView(e),r=o(n);if(!r||!r.exif)return;const a=((e,t)=>{if(65505!==e.getUint16(t))return;const o=e.getUint16(t+2);if(t+=4,1165519206!==e.getUint32(t))return;t+=6;let i=e.getUint16(t);if(18761!==i&&19789!==i)return;const n=18761===i;if(t+=2,42!==e.getUint16(t,n))return;t+=e.getUint32(t+2,n);const r=i=>{let r=[],a=t,s=t+o-16;for(;a<s;a+=12){let t=a;e.getUint16(t,n)===i&&r.push(t)}return r};return{read:t=>{const o=r(t);if(o.length)return e.getUint16(o[0]+8,n)},write:(t,o)=>{const i=r(t);return!!i.length&&(i.forEach((t=>e.setUint16(t+8,o,n))),!0)}}})(n,r.exif.offset);return a?void 0===i?a.read(t):a.write(t,i):void 0};const n="__pqina_webapi__";var r=e=>window[n]?window[n][e]:window[e],a=(...e)=>{};const s={ArrayBuffer:"readAsArrayBuffer"};var l=async(e,t=[0,e.size],o)=>await((e,t=a,o={})=>new Promise(((i,n)=>{const{dataFormat:a=s.ArrayBuffer}=o,l=new(r("FileReader"));l.onload=()=>i(l.result),l.onerror=n,l.onprogress=t,l[a](e)})))(e.slice(...t),o),c=async(e,t)=>{const o=await l(e,[0,65536],t);return i(o,274)||1};let d=null;var u=()=>(null===d&&(d="undefined"!=typeof window&&void 0!==window.document),d);let h=null;var p=()=>new Promise((e=>{if(null===h){const t="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=";let o=u()?new Image:{};return o.onload=()=>{h=1===o.naturalWidth,o=void 0,e(h)},void(o.src=t)}return e(h)})),m=e=>e.getContext("2d").getImageData(0,0,e.width,e.height),g=(e,t,o=[])=>{const i=document.createElement(e),n=Object.getOwnPropertyDescriptors(i.__proto__);for(const e in t)"style"===e?i.style.cssText=t[e]:n[e]&&n[e].set||/textContent|innerHTML/.test(e)||"function"==typeof t[e]?i[e]=t[e]:i.setAttribute(e,t[e]);return o.forEach((e=>i.appendChild(e))),i};const f={1:()=>[1,0,0,1,0,0],2:e=>[-1,0,0,1,e,0],3:(e,t)=>[-1,0,0,-1,e,t],4:(e,t)=>[1,0,0,-1,0,t],5:()=>[0,1,1,0,0,0],6:(e,t)=>[0,1,-1,0,t,0],7:(e,t)=>[0,-1,-1,0,t,e],8:e=>[0,-1,1,0,0,e]};var $=e=>{e.width=1,e.height=1;const t=e.getContext("2d");t&&t.clearRect(0,0,1,1)},y=e=>"data"in e,b=async(e,t=1)=>{const[o,i]=await p()||t<5?[e.width,e.height]:[e.height,e.width],n=g("canvas",{width:o,height:i}),r=n.getContext("2d");if(y(e)&&!await p()&&t>1){const t=g("canvas",{width:e.width,height:e.height});t.getContext("2d").putImageData(e,0,0),e=t}return!await p()&&t>1&&r.transform.apply(r,((e,t,o=-1)=>(-1===o&&(o=1),f[o](e,t)))(e.width,e.height,t)),y(e)?r.putImageData(e,0,0):r.drawImage(e,0,0),e instanceof HTMLCanvasElement&&$(e),n},x=async(e,t=1)=>1===t||await p()?e:m(await b(e,t)),v=e=>"object"==typeof e;const w=e=>v(e)?S(e):e,S=e=>{let t;return Array.isArray(e)?(t=[],e.forEach(((e,o)=>{t[o]=w(e)}))):(t={},Object.keys(e).forEach((o=>{const i=e[o];t[o]=w(i)}))),t};var k=e=>"string"==typeof e,C=(e,t)=>new Promise(((o,i)=>{const n=()=>o(((e,t)=>{let o=e.naturalWidth,i=e.naturalHeight;const n=o*i;if(t&&n>t){const e=Math.sqrt(t)/Math.sqrt(n);o=Math.floor(o*e),i=Math.floor(i*e)}const r=g("canvas");return r.width=o,r.height=i,r.getContext("2d").drawImage(e,0,0,o,i),r})(e,t));e.complete&&e.width?n():(e.onload=n,e.onerror=i)})),M=()=>"createImageBitmap"in window,T=e=>/svg/.test(e.type),R=()=>Math.random().toString(36).substr(2,9);const P=new Map;var A=(e,t,o)=>new Promise(((i,n)=>{let r=e.toString(),a=P.get(r);if(!a){const t=(e=>`function () {self.onmessage = function (message) {(${e.toString()}).apply(null, message.data.content.concat([function (err, response) {\n response = response || {};\n const transfer = 'data' in response ? [response.data.buffer] : 'width' in response ? [response] : [];\n return self.postMessage({ id: message.data.id, content: response, error: err }, transfer);\n}]))}}`)(e),o=URL.createObjectURL((e=>new Blob(["(","function"==typeof e?e.toString():e,")()"],{type:"application/javascript"}))(t)),i=new Map,n=new Worker(o);a={url:o,worker:n,messages:i,terminate:()=>{a.worker.terminate(),URL.revokeObjectURL(o)}},n.onmessage=function(e){const{id:t,content:o,error:n}=e.data;if(!i.has(t))return;const r=i.get(t);i.delete(t),null!=n?r.reject(n):r.resolve(o)},P.set(r,a)}const s=R();a.messages.set(s,{resolve:i,reject:n}),a.worker.postMessage({id:s,content:t},o)})),I=async(e,t)=>{let o;if(M()&&!T(e)&&"OffscreenCanvas"in window)try{o=await A(((e,t,o)=>{createImageBitmap(e).then((e=>{let i=e.width,n=e.height;const r=i*n;if(t&&r>t){const e=Math.sqrt(t)/Math.sqrt(r);i=Math.floor(i*e),n=Math.floor(n*e)}const a=new OffscreenCanvas(i,n),s=a.getContext("2d");s.drawImage(e,0,0,i,n);const l=s.getImageData(0,0,a.width,a.height);o(null,l)})).catch((e=>{o(e)}))}),[e,t])}catch(e){}if(!o||!o.width){const i=await(async(e,t)=>{const o=g("img",{src:URL.createObjectURL(e)}),i=await C(o,t);return URL.revokeObjectURL(o.src),i})(e,t);o=m(i),$(i)}return o},E=(e,t,o)=>new Promise(((i,n)=>{try{e.toBlob((e=>{i(e)}),t,o)}catch(e){n(e)}})),L=async(e,t,o)=>{const i=await b(e),n=await E(i,t,o);return $(i),n},F=e=>(e.match(/\/([a-z]+)/)||[])[1],B=e=>e.substr(0,e.lastIndexOf("."))||e;const z=/avif|bmp|gif|jpg|jpeg|jpe|jif|jfif|png|svg|tiff|webp/;var D=e=>{return e&&(t=(o=e,o.split(".").pop()).toLowerCase(),z.test(t)?"image/"+(/jfif|jif|jpe|jpg/.test(t)?"jpeg":"svg"===t?"svg+xml":t):"");var t,o},O=(e,t,o)=>{const i=(new Date).getTime(),n=e.type.length&&!/null|text/.test(e.type),a=n?e.type:o,s=((e,t)=>{const o=D(e);if(o===t)return e;const i=F(t)||o;return`${B(e)}.${i}`})(t,a);try{return new(r("File"))([e],s,{lastModified:i,type:n?e.type:a})}catch(t){const o=n?e.slice():e.slice(0,e.size,a);return o.lastModified=i,o.name=s,o}},_=(e,t)=>e/t,W=e=>e;const V=Math.PI,N=Math.PI/2,H=N/2;var U=e=>{const t=Math.abs(e)%Math.PI;return t>H&&t<Math.PI-H};const j=(e,t,o)=>o+(e-o)*t,X=e=>({x:e.x+.5*e.width,y:e.y+.5*e.height,rx:.5*e.width,ry:.5*e.height}),Y=()=>G(0,0),G=(e,t)=>({x:e,y:t}),q=e=>G(e.pageX,e.pageY),K=e=>G(e.x,e.y),Z=e=>(e.x=-e.x,e.y=-e.y,e),J=(e,t,o=Y())=>{const i=Math.cos(t),n=Math.sin(t),r=e.x-o.x,a=e.y-o.y;return e.x=o.x+i*r-n*a,e.y=o.y+n*r+i*a,e},Q=e=>Math.sqrt(e.x*e.x+e.y*e.y),ee=e=>{const t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?Y():(e.x/=t,e.y/=t,e)},te=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),oe=(e,t)=>e.x===t.x&&e.y===t.y,ie=(e,t)=>(e.x=t(e.x),e.y=t(e.y),e),ne=(e,t)=>(e.x+=t.x,e.y+=t.y,e),re=(e,t)=>(e.x-=t.x,e.y-=t.y,e),ae=(e,t)=>(e.x*=t,e.y*=t,e),se=(e,t)=>e.x*t.x+e.y*t.y,le=(e,t=Y())=>{const o=e.x-t.x,i=e.y-t.y;return o*o+i*i},ce=(e,t=Y())=>Math.sqrt(le(e,t)),de=e=>{let t=0,o=0;return e.forEach((e=>{t+=e.x,o+=e.y})),G(t/e.length,o/e.length)},ue=(e,t,o,i,n)=>(e.forEach((e=>{e.x=t?i-(e.x-i):e.x,e.y=o?n-(e.y-n):e.y})),e),he=(e,t,o,i)=>{const n=Math.sin(t),r=Math.cos(t);return e.forEach((e=>{e.x-=o,e.y-=i;const t=e.x*r-e.y*n,a=e.x*n+e.y*r;e.x=o+t,e.y=i+a})),e},pe=(e,t)=>({width:e,height:t}),me=e=>pe(e.width,e.height),ge=e=>pe(e.width,e.height),fe=e=>pe(e.width,e.height),$e=e=>pe(e[0],e[1]),ye=e=>{return/img/i.test(e.nodeName)?pe((t=e).naturalWidth,t.naturalHeight):ge(e);var t},be=(e,t)=>pe(e,t),xe=(e,t,o=W)=>o(e.width)===o(t.width)&&o(e.height)===o(t.height),ve=(e,t)=>(e.width*=t,e.height*=t,e),we=e=>G(.5*e.width,.5*e.height),Se=(e,t)=>{const o=Math.abs(t),i=Math.cos(o),n=Math.sin(o),r=i*e.width+n*e.height,a=n*e.width+i*e.height;return e.width=r,e.height=a,e},ke=(e,t)=>e.width>=t.width&&e.height>=t.height,Ce=(e,t)=>(e.width=t(e.width),e.height=t(e.height),e),Me=(e,t)=>({start:e,end:t}),Te=e=>Me(K(e.start),K(e.end)),Re=(e,t)=>{if(0===t)return e;const o=G(e.start.x-e.end.x,e.start.y-e.end.y),i=ee(o),n=ae(i,t);return e.start.x+=n.x,e.start.y+=n.y,e.end.x-=n.x,e.end.y-=n.y,e},Pe=[G(-1,-1),G(-1,1),G(1,1),G(1,-1)],Ae=(e,t,o,i)=>({x:e,y:t,width:o,height:i}),Ie=e=>Ae(e.x,e.y,e.width,e.height),Ee=()=>Ae(0,0,0,0),Le=e=>Ae(0,0,e.width,e.height),Fe=e=>Ae(e.x||0,e.y||0,e.width||0,e.height||0),Be=(...e)=>{const t=Array.isArray(e[0])?e[0]:e;let o=t[0].x,i=t[0].x,n=t[0].y,r=t[0].y;return t.forEach((e=>{o=Math.min(o,e.x),i=Math.max(i,e.x),n=Math.min(n,e.y),r=Math.max(r,e.y)})),Ae(o,n,i-o,r-n)},ze=e=>Oe(e.x-e.rx,e.y-e.ry,2*e.rx,2*e.ry),De=(e,t)=>Ae(e.x-.5*t.width,e.y-.5*t.height,t.width,t.height),Oe=(e,t,o,i)=>Ae(e,t,o,i),_e=e=>G(e.x+.5*e.width,e.y+.5*e.height),We=(e,t)=>(e.x+=t.x,e.y+=t.y,e),Ve=(e,t,o)=>(o=o||_e(e),e.x=t*(e.x-o.x)+o.x,e.y=t*(e.y-o.y)+o.y,e.width=t*e.width,e.height=t*e.height,e),Ne=(e,t)=>(e.x*=t,e.y*=t,e.width*=t,e.height*=t,e),He=(e,t)=>(e.x/=t,e.y/=t,e.width/=t,e.height/=t,e),Ue=(e,t,o=W)=>o(e.x)===o(t.x)&&o(e.y)===o(t.y)&&o(e.width)===o(t.width)&&o(e.height)===o(t.height),je=e=>_(e.width,e.height),Xe=(e,t,o,i,n)=>(e.x=t,e.y=o,e.width=i,e.height=n,e),Ye=(e,t)=>(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e),Ge=(e,t,o)=>(o||(o=_e(e)),et(e).map((e=>J(e,t,o)))),qe=(e,t)=>Ae(.5*e.width-.5*t.width,.5*e.height-.5*t.height,t.width,t.height),Ke=(e,t)=>!(t.x<e.x)&&(!(t.y<e.y)&&(!(t.x>e.x+e.width)&&!(t.y>e.y+e.height))),Ze=(e,t,o=Y())=>{if(0===e.width||0===e.height)return Ee();const i=je(e);t||(t=i);let n=e.width,r=e.height;return t>i?n=r*t:r=n/t,Ae(o.x+.5*(e.width-n),o.y+.5*(e.height-r),n,r)},Je=(e,t=je(e),o=Y())=>{if(0===e.width||0===e.height)return Ee();let i=e.width,n=i/t;return n>e.height&&(n=e.height,i=n*t),Ae(o.x+.5*(e.width-i),o.y+.5*(e.height-n),i,n)},Qe=e=>[Math.min(e.y,e.y+e.height),Math.max(e.x,e.x+e.width),Math.max(e.y,e.y+e.height),Math.min(e.x,e.x+e.width)],et=e=>[G(e.x,e.y),G(e.x+e.width,e.y),G(e.x+e.width,e.y+e.height),G(e.x,e.y+e.height)],tt=(e,t)=>{if(e)return e.x=t(e.x),e.y=t(e.y),e.width=t(e.width),e.height=t(e.height),e},ot=(e,t,o=_e(e))=>et(e).map(((e,i)=>{const n=Pe[i];return G(j(e.x,1+n.x*t.x,o.x),j(e.y,1+n.y*t.y,o.y))})),it=e=>(e.x=0,e.y=0,e),nt=e=>{const t=e[0],o=e[e.length-1];e=oe(t,o)?e:[...e,t];let i,n,r,a=0,s=0,l=0,c=0,d=t.x,u=t.y;const h=e.length;for(;s<h;s++)i=e[s],n=e[s+1>h-1?0:s+1],r=(i.y-u)*(n.x-d)-(n.y-u)*(i.x-d),a+=r,l+=(i.x+n.x-2*d)*r,c+=(i.y+n.y-2*u)*r;return r=3*a,G(d+l/r,u+c/r)},rt=(e,t)=>at(e.start,e.end,t.start,t.end),at=(e,t,o,i)=>{const n=(i.y-o.y)*(t.x-e.x)-(i.x-o.x)*(t.y-e.y);if(0===n)return;const r=((i.x-o.x)*(e.y-o.y)-(i.y-o.y)*(e.x-o.x))/n,a=((t.x-e.x)*(e.y-o.y)-(t.y-e.y)*(e.x-o.x))/n;return r<0||r>1||a<0||a>1?void 0:G(e.x+r*(t.x-e.x),e.y+r*(t.y-e.y))},st=(e,t)=>{let o,i,n,r,a,s,l,c,d,u;const h=t.length;for(o=0;o<h;o++)if(i=t[o],n=t[o+1>h-1?0:o+1],r=i.x-e.x,a=i.y-e.y,s=n.x-e.x,l=n.y-e.y,c=r-s,d=a-l,u=c*a-d*r,u<-1e-5)return!1;return!0},lt=e=>{const t=[];for(let o=0;o<e.length;o++){let i=o+1;i===e.length&&(i=0),t.push(Me(K(e[o]),K(e[i])))}return t},ct=(e,t,o,i=0,n=!1,r=!1,a=12)=>{const s=[];for(let i=0;i<a;i++)s.push(G(e.x+t*Math.cos(i*(2*Math.PI)/a),e.y+o*Math.sin(i*(2*Math.PI)/a)));return(n||r)&&ue(s,n,r,e.x,e.y),i&&he(s,i,e.x,e.y),s};var dt=(e,t)=>{const o=Le(e),i=_e(o),n=Ge(o,t,i);return it(Be(n))},ut=(e,t)=>e instanceof HTMLElement&&(!t||new RegExp(`^${t}$`,"i").test(e.nodeName)),ht=e=>e instanceof File,pt=e=>e.split("/").pop().split(/\?|\#/).shift();let mt=null;var gt=()=>(null===mt&&(mt=mt=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),mt),ft=e=>new Promise(((t,o)=>{let i=!1;!e.parentNode&&gt()&&(i=!0,e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0;width:0;height:0;",document.body.appendChild(e));const n=()=>{const o=e.naturalWidth,n=e.naturalHeight;o&&n&&(i&&e.parentNode.removeChild(e),clearInterval(r),t({width:o,height:n}))};e.onerror=e=>{clearInterval(r),o(e)};const r=setInterval(n,1);n()})),$t=async e=>{let t,o=e;o.src||(o=new Image,o.src=k(e)?e:URL.createObjectURL(e));try{t=await ft(o)}finally{ht(e)&&URL.revokeObjectURL(o.src)}return t};var yt=async e=>{try{const t=await $t(e),o=await(e=>new Promise(((t,o)=>{if(e.complete)return t(e);e.onload=()=>t(e),e.onerror=o})))(e),i=document.createElement("canvas");i.width=t.width,i.height=t.height;i.getContext("2d").drawImage(o,0,0);const n=await E(i);return O(n,pt(o.src))}catch(e){throw e}},bt=(e=0,t=!0)=>new(r("ProgressEvent"))("progress",{loaded:100*e,total:100,lengthComputable:t}),xt=e=>/^image/.test(e.type),vt=(e,t,o=(e=>e))=>e.getAllResponseHeaders().indexOf(t)>=0?o(e.getResponseHeader(t)):void 0,wt=e=>{if(!e)return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map((e=>e.trim().replace(/^["']|[;"']{0,2}$/g,""))).filter((e=>e.length));return t.length?decodeURI(t[t.length-1]):null};const St="URL_REQUEST";class kt extends Error{constructor(e,t,o){super(e),this.name="EditorError",this.code=t,this.metadata=o}}var Ct=(e,t)=>/^data:/.test(e)?(async(e,t="data-uri",o=a)=>{o(bt(0));const i=await fetch(e);o(bt(.33));const n=await i.blob();let r;xt(n)||(r="image/"+(e.includes(",/9j/")?"jpeg":"png")),o(bt(.66));const s=O(n,t,r);return o(bt(1)),s})(e,void 0,t):((e,t)=>new Promise(((o,i)=>{const n=()=>i(new kt("Error fetching image",St,r)),r=new XMLHttpRequest;r.onprogress=t,r.onerror=n,r.onload=()=>{if(!r.response||r.status>=300||r.status<200)return n();const t=vt(r,"Content-Type"),i=vt(r,"Content-Disposition",wt)||pt(e);o(O(r.response,i,t||D(i)))},r.open("GET",e),r.responseType="blob",r.send()})))(e,t),Mt=async(e,t)=>{if(ht(e)||(o=e)instanceof Blob&&!(o instanceof File))return e;if(k(e))return await Ct(e,t);if(ut(e,"canvas"))return await(async(e,t,o)=>{const i=await E(e,t,o);return O(i,"canvas")})(e);if(ut(e,"img"))return await yt(e);throw new kt("Invalid image source","invalid-image-source");var o};let Tt=null;var Rt=()=>(null===Tt&&(Tt=u()&&/^mac/i.test(navigator.platform)),Tt),Pt=e=>u()?RegExp(e).test(window.navigator.userAgent):void 0;let At=null;var It=()=>(null===At&&(At=u()&&(Pt(/iPhone|iPad|iPod/)||Rt()&&navigator.maxTouchPoints>=1)),At),Et=async(e,t=1)=>await p()||It()||t<5?e:be(e.height,e.width),Lt=e=>/jpeg/.test(e.type),Ft=e=>{return"object"!=typeof(t=e)||t.constructor!=Object?e:JSON.stringify(e);var t},Bt=(e,t=0,o)=>(0===t||(e.translate(o.x,o.y),e.rotate(t),e.translate(-o.x,-o.y)),e),zt=async(e,t={})=>{const{flipX:o,flipY:i,rotation:n,crop:r}=t,a=ge(e),s=o||i,l=!!n,c=r&&(r.x||r.y||r.width||r.height),d=c&&Ue(r,Le(a)),u=c&&!d;if(!s&&!l&&!u)return e;let h,p=g("canvas",{width:e.width,height:e.height});if(p.getContext("2d").putImageData(e,0,0),s){const e=g("canvas",{width:p.width,height:p.height}).getContext("2d");((e,t,o)=>{e.scale(t,o)})(e,o?-1:1,i?-1:1),e.drawImage(p,o?-p.width:0,i?-p.height:0),e.restore(),$(p),p=e.canvas}if(l){const e=Ce(fe(Be(Ge(Fe(p),n))),Math.floor),t=g("canvas",{width:r.width,height:r.height}).getContext("2d");((e,t,o)=>{e.translate(t,o)})(t,-r.x,-r.y),Bt(t,n,we(e)),t.drawImage(p,.5*(e.width-p.width),.5*(e.height-p.height)),t.restore(),$(p),p=t.canvas}else if(u){return h=p.getContext("2d").getImageData(r.x,r.y,r.width,r.height),$(p),h}return h=p.getContext("2d").getImageData(0,0,p.width,p.height),$(p),h},Dt=(e,t)=>{const{imageData:o,width:i,height:n}=e,r=o.width,a=o.height,s=Math.round(i),l=Math.round(n),c=o.data,d=new Uint8ClampedArray(s*l*4),u=r/s,h=a/l,p=Math.ceil(.5*u),m=Math.ceil(.5*h);for(let e=0;e<l;e++)for(let t=0;t<s;t++){const o=4*(t+e*s);let i=0,n=0,a=0,l=0,g=0,f=0,$=0;const y=(e+.5)*h;for(let o=Math.floor(e*h);o<(e+1)*h;o++){const e=Math.abs(y-(o+.5))/m,s=(t+.5)*u,d=e*e;for(let e=Math.floor(t*u);e<(t+1)*u;e++){let t=Math.abs(s-(e+.5))/p;const u=Math.sqrt(d+t*t);if(u>=-1&&u<=1&&(i=2*u*u*u-3*u*u+1,i>0)){t=4*(e+o*r);const s=c[t+3];$+=i*s,a+=i,s<255&&(i=i*s/250),l+=i*c[t],g+=i*c[t+1],f+=i*c[t+2],n+=i}}}d[o]=l/n,d[o+1]=g/n,d[o+2]=f/n,d[o+3]=$/a}t(null,{data:d,width:s,height:l})},Ot=e=>{if(e instanceof ImageData)return e;let t;try{t=new ImageData(e.width,e.height)}catch(o){t=g("canvas").getContext("2d").createImageData(e.width,e.height)}return t.data.set(e.data),t},_t=async(e,t={})=>{const{width:o,height:i,fit:n,upscale:r}=t;if(!o&&!i)return e;let a=o,s=i;if(o?i||(s=o):a=i,"force"!==n){let t=a/e.width,o=s/e.height,i=1;if("cover"===n?i=Math.max(t,o):"contain"===n&&(i=Math.min(t,o)),i>1&&!1===r)return e;a=Math.round(e.width*i),s=Math.round(e.height*i)}return e.width===a&&e.height===s?e:(e=await A(Dt,[{imageData:e,width:a,height:s}],[e.data.buffer]),Ot(e))},Wt=(e,t)=>{const{imageData:o,matrix:i}=e;if(!i)return t(null,o);const n=new Uint8ClampedArray(o.width*o.height*4),r=o.data,a=r.length,s=i[0],l=i[1],c=i[2],d=i[3],u=i[4],h=i[5],p=i[6],m=i[7],g=i[8],f=i[9],$=i[10],y=i[11],b=i[12],x=i[13],v=i[14],w=i[15],S=i[16],k=i[17],C=i[18],M=i[19];let T=0,R=0,P=0,A=0,I=0,E=0,L=0,F=0,B=0,z=0,D=0,O=0;for(;T<a;T+=4)R=r[T]/255,P=r[T+1]/255,A=r[T+2]/255,I=r[T+3]/255,E=R*s+P*l+A*c+I*d+u,L=R*h+P*p+A*m+I*g+f,F=R*$+P*y+A*b+I*x+v,B=R*w+P*S+A*k+I*C+M,z=Math.max(0,E*B)+(1-B),D=Math.max(0,L*B)+(1-B),O=Math.max(0,F*B)+(1-B),n[T]=255*Math.max(0,Math.min(1,z)),n[T+1]=255*Math.max(0,Math.min(1,D)),n[T+2]=255*Math.max(0,Math.min(1,O)),n[T+3]=255*I;t(null,{data:n,width:o.width,height:o.height})},Vt=(e,t)=>{const{imageData:o,matrix:i}=e;if(!i)return t(null,o);let n=i.reduce(((e,t)=>e+t));n=n<=0?1:n;const r=o.width,a=o.height,s=o.data;let l=0,c=0,d=0;const u=Math.round(Math.sqrt(i.length)),h=Math.floor(u/2);let p=0,m=0,g=0,f=0,$=0,y=0,b=0,x=0,v=0,w=0;const S=new Uint8ClampedArray(r*a*4);for(d=0;d<a;d++)for(c=0;c<r;c++){for(p=0,m=0,g=0,f=0,y=0;y<u;y++)for($=0;$<u;$++)b=d+y-h,x=c+$-h,b<0&&(b=a-1),b>=a&&(b=0),x<0&&(x=r-1),x>=r&&(x=0),v=4*(b*r+x),w=i[y*u+$],p+=s[v]*w,m+=s[v+1]*w,g+=s[v+2]*w,f+=s[v+3]*w;S[l]=p/n,S[l+1]=m/n,S[l+2]=g/n,S[l+3]=f/n,l+=4}t(null,{data:S,width:r,height:a})},Nt=(e,t)=>{let{imageData:o,strength:i}=e;if(!i)return t(null,o);const n=new Uint8ClampedArray(o.width*o.height*4),r=o.width,a=o.height,s=o.data,l=(e,t)=>(c=e-w,d=t-S,Math.sqrt(c*c+d*d));let c,d,u,h,p,m,g,f,$,y,b,x=0,v=0,w=.5*r,S=.5*a,k=l(0,0);for(i>0?(u=0,h=0,p=0):(i=Math.abs(i),u=1,h=1,p=1),v=0;v<a;v++)for(x=0;x<r;x++)C=4*(x+v*r),M=s,T=n,R=l(x,v)*i/k,m=M[C]/255,g=M[C+1]/255,f=M[C+2]/255,$=M[C+3]/255,y=1-R,b=y*$+R,T[C]=(y*$*m+R*u)/b*255,T[C+1]=(y*$*g+R*h)/b*255,T[C+2]=(y*$*f+R*p)/b*255,T[C+3]=255*b;var C,M,T,R;t(null,{data:n,width:o.width,height:o.height})},Ht=(e,t)=>{const{imageData:o,level:i,monochrome:n=!1}=e;if(!i)return t(null,o);const r=new Uint8ClampedArray(o.width*o.height*4),a=o.data,s=a.length;let l,c,d,u=0;const h=()=>255*(2*Math.random()-1)*i,p=n?()=>{const e=h();return[e,e,e]}:()=>[h(),h(),h()];for(;u<s;u+=4)[l,c,d]=p(),r[u]=a[u]+l,r[u+1]=a[u+1]+c,r[u+2]=a[u+2]+d,r[u+3]=a[u+3];t(null,{data:r,width:o.width,height:o.height})},Ut=(e,t)=>{const{imageData:o,level:i}=e;if(!i)return t(null,o);const n=new Uint8ClampedArray(o.width*o.height*4),r=o.data,a=r.length;let s,l,c,d=0;for(;d<a;d+=4)s=r[d]/255,l=r[d+1]/255,c=r[d+2]/255,n[d]=255*Math.pow(s,i),n[d+1]=255*Math.pow(l,i),n[d+2]=255*Math.pow(c,i),n[d+3]=r[d+3];t(null,{data:n,width:o.width,height:o.height})},jt=async(e,t={})=>{const{colorMatrix:o,convolutionMatrix:i,gamma:n,noise:r,vignette:a}=t,s=[];if(i&&s.push([Vt,{matrix:i.clarity}]),n>0&&s.push([Ut,{level:1/n}]),o&&!(e=>{const t=e.length;let o,i=t>=20?6:t>=16?5:3;for(let n=0;n<t;n++){if(o=e[n],1===o&&n%i!=0)return!1;if(0!==o&&1!==o)return!1}return!0})(o)&&s.push([Wt,{matrix:o}]),(r>0||r<0)&&s.push([Ht,{level:r}]),(a>0||a<0)&&s.push([Nt,{strength:a}]),!s.length)return e;const l=(e,t)=>`(err, imageData) => {\n (${e[t][0].toString()})(Object.assign({ imageData: imageData }, filterInstructions[${t}]), \n ${e[t+1]?l(e,t+1):"done"})\n }`,c=`function (options, done) {\n const filterInstructions = options.filterInstructions;\n const imageData = options.imageData;\n (${l(s,0)})(null, imageData)\n }`;return e=await A(c,[{imageData:e,filterInstructions:s.map((e=>e[1]))}],[e.data.buffer]),Ot(e)},Xt=e=>"number"==typeof e,Yt=e=>k(e)&&null!==e.match(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g),Gt=(e,t)=>e.hasOwnProperty(t),qt=e=>"function"==typeof e,Kt=e=>Array.isArray(e);let Zt=64,Jt=102,Qt=112,eo=!1;var to=(e,t)=>(!eo&&u()&&(/^win/i.test(navigator.platform)&&(Jt=103),(It()||Rt())&&(Zt=63.5,Jt=110,Qt=123),eo=!0),`<svg${t?` aria-label="${t}"`:""} width="128" height="128" viewBox="0 0 128 128" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg"><text x="${Zt}" y="${Jt}" alignment-baseline="text-top" dominant-baseline="text-top" text-anchor="middle" font-size="${Qt}px">${e}</text></svg>`),oo=e=>e instanceof Blob,io=(e,t)=>e/t*100+"%",no=e=>`rgba(${Math.round(255*e[0])}, ${Math.round(255*e[1])}, ${Math.round(255*e[2])}, ${Xt(e[3])?e[3]:1})`;const ro=20;let ao=void 0;const so=(e=1,t=1)=>{const o=g("canvas").getContext("2d");return o.canvas.width=e,o.canvas.height=t,o},lo=(e,t)=>{const{fontSize:o=16,fontFamily:i="sans-serif",fontWeight:n="normal",fontVariant:r="normal",fontStyle:a="normal",textAlign:s="left",color:l="#000"}=t;e.font=`${a} ${r} ${n} ${o}px ${i}`,e.textBaseline="top",e.textAlign=s,e.fillStyle=Array.isArray(l)?no(l):l},co=(e,t)=>qt(t)?t(e):t,uo=(e,t,o)=>{const i=e.textAlign;e.textAlign="left";const n=t.split("\n"),r=n.reduce(((t,o)=>{const i=(n=e.measureText(o),Math.abs(n.actualBoundingBoxLeft)+Math.abs(n.actualBoundingBoxRight));var n;return i>t&&(t=i),t}),1);e.textAlign=i;const a=o*n.length;return be(Math.ceil(r),Math.ceil(a))},ho=new Map,po=(e,t)=>{const o=(e=>{const t=so();return lo(t,e),t})(t);t.width&&(e=mo(o,e,t.width));const i=((e,{fontSize:t,fontFamily:o,lineHeight:i,fontWeight:n,fontStyle:r,fontVariant:a})=>`${[e,t,n,r,a,o].join("_")}_${qt(i)?i(t):i}`)(e,t);let n=ho.get(i);return n||(n=uo(o,e,co(t.fontSize,t.lineHeight)),ho.set(i,n)),{...n}},mo=(e,t,o)=>{if(0===t.length)return"";const i=[];let n,r="",a=0;const s=t.split("\n\n"),l=()=>{r.length&&(i[a]||(i[a]=[]),i[a].push(r),r="")},c=t=>{const i=r+t;n=e.measureText(i).width,n<o?r=i:(r.length?(l(),r=t):(r=i,l()),a++)},d=t=>{const i=r.length?r+" "+t:t;n=e.measureText(i).width,n<o?r=i:r.length?(l(),a++,d(t)):t.split("").forEach(c)};return s.forEach((e=>{e.split("\n").forEach((e=>{e.split(" ").forEach(d),r.length&&l(),a++})),a++})),i.map((e=>e.join(" "))).join("\n")},go=(e,t="",o={})=>{if(0===t.length)return e;const{x:i=0,y:n=0,lineWidth:r=0,textAlign:a,fontSize:s,lineHeight:l}=o,c=ne((e=>{if(!ao){const e=32,t=so(e,e);lo(t,{fontSize:100,color:"#fff"}),t.fillText("F",0,0);const o=t.getImageData(0,0,e,e).data;let i=0,n=4,r=o.length,a=r-4*e;for(i=a;i<r&&!o[i];i+=n);const s=(i-a)/n;for(a=4*(e-1),n=4*e,i=a;i<r&&!o[i];i+=n);ao=G(s,(i-a)/n),$(t.canvas)}return G(-ao.x*e*.01,-ao.y*e*.01)})(s),G(s/12,s/3.75)),d=i+c.x,u=n+c.y,h=qt(l)?l(s):l;let p="right"===a?r:"center"===a?.5*r:0;return t.split("\n").forEach(((t,o)=>{e.fillText(t,d+p,u+o*h)})),e};var fo=(e,t=12)=>parseFloat(e.toFixed(t));const $o=e=>{const t={...e};return S(t)},yo=(e,t={})=>{const o=je(e);let i,n;const r=t.width||t.rx,a=t.height||t.ry;if(r&&a)return me(t);if(r||a){i=parseFloat(r||Number.MAX_SAFE_INTEGER),n=parseFloat(a||Number.MAX_SAFE_INTEGER);const e=Math.min(i,n);k(r)||k(a)?(i=e+"%",n=e*o+"%"):(i=e,n=e)}else{const e=10;i=e+"%",n=e*o+"%"}return{[(t.width?"width":t.rx?"rx":void 0)||"width"]:i,[(t.width?"height":t.rx?"ry":void 0)||"height"]:n}},bo=(e,t={})=>{return{width:void 0,height:void 0,...t,aspectRatio:1,backgroundImage:(o=to(e),"data:image/svg+xml,"+o.replace("<","%3C").replace(">","%3E"))};var o},xo=(e,t={})=>({backgroundColor:[0,0,0,0],...Ro(t)?{}:{width:void 0,height:void 0,aspectRatio:void 0},...t,backgroundImage:k(e)?e:oo(e)?URL.createObjectURL(e):e}),vo=(e,t)=>{let o;if(k(e)||oo(e)){const i={...yo(t),backgroundSize:"contain"};o=Yt(e)?bo(e,i):xo(e,i)}else if(e.src){const i=yo(t,e.shape||e),n={...e.shape,...i};if(e.width&&e.height&&!Gt(n,"aspectRatio")){const e=hi(i,"width",t),o=hi(i,"height",t);n.aspectRatio=_(e,o)}n.backgroundSize||e.shape||e.width&&e.height||(n.backgroundSize="contain"),o=Yt(e.src)?bo(e.src,n):xo(e.src,n)}else e.shape&&(o=$o(e.shape));return Gt(o,"backgroundImage")&&(Gt(o,"backgroundColor")||(o.backgroundColor=[0,0,0,0]),Gt(o,"disableStyle")||(o.disableStyle=["backgroundColor","strokeColor","strokeWidth"]),Gt(o,"disableFlip")||(o.disableFlip=!0)),t?di(o,t):o},wo=e=>G(e.x1,e.y1),So=e=>G(e.x2,e.y2),ko=e=>Gt(e,"text"),Co=e=>ko(e)&&!(Oo(e)||Gt(e,"width")),Mo=e=>ko(e)&&(Oo(e)||Gt(e,"width")),To=e=>!ko(e)&&_o(e),Ro=e=>Gt(e,"rx"),Po=e=>Gt(e,"x1")&&!Ao(e),Ao=e=>Gt(e,"x3"),Io=e=>Gt(e,"points"),Eo=e=>ko(e)&&e.isEditing,Lo=e=>!Gt(e,"opacity")||e.opacity>0,Fo=e=>e.isSelected,Bo=e=>e._isDraft,zo=e=>Gt(e,"width")&&Gt(e,"height"),Do=e=>{const t=Gt(e,"right"),o=Gt(e,"bottom");return t||o},Oo=e=>(Gt(e,"x")||Gt(e,"left"))&&Gt(e,"right")||(Gt(e,"y")||Gt(e,"top"))&&Gt(e,"bottom"),_o=e=>zo(e)||Oo(e),Wo=e=>(e._isDraft=!0,e),Vo=(e,t)=>!0!==e.disableStyle&&(!Kt(e.disableStyle)||!t||!e.disableStyle.includes(t)),No=e=>!0!==e.disableSelect&&!Ao(e),Ho=e=>!0!==e.disableRemove,Uo=e=>!e.disableFlip&&(!Bo(e)&&!Do(e)&&(e=>Gt(e,"backgroundImage")||Gt(e,"text"))(e)),jo=(e,t)=>!!ko(e)&&(!0!==e.disableInput&&(qt(e.disableInput)?e.disableInput(null!=t?t:e.text):t||!0)),Xo=(e,t)=>!0!==e.disableTextLayout&&(!Kt(e.disableTextLayout)||!t||!e.disableTextLayout.includes(t)),Yo=e=>!0!==e.disableManipulate&&!Bo(e)&&!Do(e),Go=e=>Yo(e)&&!0!==e.disableMove,qo=e=>(delete e.left,delete e.right,delete e.top,delete e.bottom,e),Ko=e=>(delete e.rotation,e),Zo=e=>(e.strokeWidth=e.strokeWidth||1,e.strokeColor=e.strokeColor||[0,0,0],e),Jo=e=>(e.backgroundColor=e.backgroundColor?e.backgroundColor:e.strokeWidth||e.backgroundImage?void 0:[0,0,0],e),Qo=e=>1.2*e,ei=e=>(delete e.textAlign,qo(e)),ti=e=>(e.textAlign=e.textAlign||"left",e),oi=e=>((e=>{k(e.id)||(e.id=R()),Gt(e,"rotation")||(e.rotation=0),Gt(e,"opacity")||(e.opacity=1),Gt(e,"disableErase")||(e.disableErase=!0)})(e),ko(e)?(e=>{e.fontSize=e.fontSize||16,e.fontFamily=e.fontFamily||"sans-serif",e.fontWeight=e.fontWeight||"normal",e.fontStyle=e.fontStyle||"normal",e.fontVariant=e.fontVariant||"normal",e.lineHeight=Xt(e.lineHeight)?e.lineHeight:Qo,e.color=e.color||[0,0,0],Co(e)?ei(e):ti(e)})(e):To(e)?(e=>{e.cornerRadius=e.cornerRadius||0,e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],Jo(e)})(e):Io(e)?(e=>{Zo(e),Ko(e),qo(e)})(e):Po(e)?(e=>{Zo(e),e.lineStart=e.lineStart||void 0,e.lineEnd=e.lineEnd||void 0,Ko(e),qo(e)})(e):Ro(e)?(e=>{e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],Jo(e)})(e):Ao(e)&&(e=>{e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],Jo(e),qo(e)})(e),e),ii=e=>ko(e)?"text":To(e)?"rectangle":Io(e)?"path":Po(e)?"line":Ro(e)?"ellipse":Ao(e)?"triangle":void 0,ni=(e,t)=>parseFloat(e)/100*t,ri=new RegExp(/^x|left|^width|rx|fontSize|cornerRadius|strokeWidth/,"i"),ai=new RegExp(/^y|top|^height|ry/,"i"),si=new RegExp(/right/,"i"),li=new RegExp(/bottom/,"i"),ci=(e,t)=>Object.entries(e).map((([o,i])=>{e[o]=((e,t,{width:o,height:i})=>{if(Array.isArray(t))return t.map((e=>(v(e)&&ci(e,{width:o,height:i}),e)));if("string"!=typeof t)return t;if(!t.endsWith("%"))return t;const n=parseFloat(t)/100;return ri.test(e)?fo(o*n,6):ai.test(e)?fo(i*n,6):si.test(e)?fo(o-o*n,6):li.test(e)?fo(i-i*n,6):t})(o,i,t)})),di=(e,t)=>(ci(e,t),$i(e,t),e),ui=(e,t)=>{let o;return/^x|width|rx|fontSize|strokeWidth|cornerRadius/.test(e)?o=t.width:/^y|height|ry/.test(e)&&(o=t.height),o},hi=(e,t,o)=>k(e[t])?ni(e[t],ui(t,o)):e[t],pi=(e,t,o)=>t.reduce(((t,i)=>{const n=hi(e,i,o);return t[i]=n,t}),{}),mi=(e,t,o)=>(Object.keys(t).forEach((i=>((e,t,o,i)=>{if(!k(e[t]))return e[t]=o,e;const n=ui(t,i);return e[t]=void 0===n?o:io(o,n),e})(e,i,t[i],o))),e),gi=(e,t)=>{const o=e.filter((e=>e.x<0||e.y<0||e.x1<0||e.y1<0)).reduce(((e,t)=>{const[o,i,n,r]=(e=>{const t=Ee(),o=e.strokeWidth||0;if(To(e))t.x=e.x-.5*o,t.y=e.y-.5*o,t.width=e.width+o,t.height=e.height+o;else if(Po(e)){const{x1:i,y1:n,x2:r,y2:a}=e,s=Math.abs(Math.min(i,r)),l=Math.abs(Math.max(i,r)),c=Math.abs(Math.min(n,a)),d=Math.abs(Math.min(n,a));t.x=s+.5*o,t.y=l+.5*o,t.width=l-s+o,t.height=d-c+o}else Ro(e)&&(t.x=e.x-e.rx+.5*o,t.y=e.y-e.ry+.5*o,t.width=2*e.rx+o,t.height=2*e.ry+o);return t&&Gt(e,"rotation")&&Ge(t,e.rotation),Qe(t)})(t);return e.top=Math.min(o,e.top),e.left=Math.min(r,e.left),e.bottom=Math.max(n,e.bottom),e.right=Math.max(i,e.right),e}),{top:0,right:0,bottom:0,left:0});return o.right>0&&(o.right-=t.width),o.bottom>0&&(o.bottom-=t.height),o},fi=(e,t,o)=>{const i=$o(e);return di(i,t),o(i)},$i=(e,t)=>{if(Gt(e,"left")&&(e.x=e.left),Gt(e,"right")){const o=t.width-e.right;Gt(e,"left")?(e.x=e.left,e.width=Math.max(0,o-e.left)):Gt(e,"width")&&(e.x=o-e.width)}if(Gt(e,"top")&&(e.y=e.top),Gt(e,"bottom")){const o=t.height-e.bottom;Gt(e,"top")?(e.y=e.top,e.height=Math.max(0,o-e.top)):Gt(e,"height")&&(e.y=o-e.height)}return e},yi=(e,t,o)=>(Io(e)&&e.points.filter((e=>Xt(e.x))).forEach((e=>{e.x*=o,e.y*=o,e.x+=t.x,e.y+=t.y})),Ao(e)&&Xt(e.x1)&&(e.x1*=o,e.y1*=o,e.x2*=o,e.y2*=o,e.x3*=o,e.y3*=o,e.x1+=t.x,e.y1+=t.y,e.x2+=t.x,e.y2+=t.y,e.x3+=t.x,e.y3+=t.y),Po(e)&&Xt(e.x1)&&(e.x1*=o,e.y1*=o,e.x2*=o,e.y2*=o,e.x1+=t.x,e.y1+=t.y,e.x2+=t.x,e.y2+=t.y),Xt(e.x)&&Xt(e.y)&&(e.x*=o,e.y*=o,e.x+=t.x,e.y+=t.y),Xt(e.width)&&Xt(e.height)&&(e.width*=o,e.height*=o),Xt(e.rx)&&Xt(e.ry)&&(e.rx*=o,e.ry*=o),(e=>Xt(e.strokeWidth)&&e.strokeWidth>0)(e)&&(e.strokeWidth*=o),ko(e)&&Xt(e.fontSize)&&(e.fontSize*=o,Xt(e.width)&&!Xt(e.width)&&(e.width*=o)),Gt(e,"cornerRadius")&&Xt(e.cornerRadius)&&(e.cornerRadius*=o),e);var bi=e=>/canvas/i.test(e.nodeName),xi=(e,t)=>new Promise(((o,i)=>{let n=e,r=!1;const a=()=>{r||(r=!0,qt(t)&&Promise.resolve().then((()=>t(be(n.naturalWidth,n.naturalHeight)))))};if(n.src||(n=new Image,k(e)&&new URL(e,location.href).origin!==location.origin&&(n.crossOrigin="anonymous"),n.src=k(e)?e:URL.createObjectURL(e)),n.complete)return a(),o(n);qt(t)&&ft(n).then(a).catch(i),n.onload=()=>{a(),o(n)},n.onerror=i})),vi=()=>{let e=[];return{sub:(t,o)=>(e.push({event:t,callback:o}),()=>e=e.filter((e=>e.event!==t||e.callback!==o))),pub:(t,o)=>{e.filter((e=>e.event===t)).forEach((e=>e.callback(o)))}}};const wi=new Map([]),Si=(e,t={})=>new Promise(((o,i)=>{const{onMetadata:n=a,onLoad:r=o,onError:s=i,onComplete:l=a}=t;let c=wi.get(e);if(c||(c={loading:!1,complete:!1,error:!1,image:void 0,size:void 0,bus:vi()},wi.set(e,c)),c.bus.sub("meta",n),c.bus.sub("load",r),c.bus.sub("error",s),c.bus.sub("complete",l),bi(e)){const t=e,o=t.cloneNode();c.complete=!0,c.image=o,c.size=ye(t)}if(c.complete)return c.bus.pub("meta",{size:c.size}),c.error?c.bus.pub("error",c.error):c.bus.pub("load",c.image),c.bus.pub("complete"),void(c.bus=vi());c.loading||(c.loading=!0,xi(e,(e=>{c.size=e,c.bus.pub("meta",{size:e})})).then((e=>{c.image=e,c.bus.pub("load",e)})).catch((e=>{c.error=e,c.bus.pub("error",e)})).finally((()=>{c.complete=!0,c.loading=!1,c.bus.pub("complete"),c.bus=vi()})))})),ki=(e,t,o,i)=>e.drawImage(t,o.x,o.x,o.width,o.height,i.x,i.y,i.width,i.height);var Ci=async(e,t,o,i,n=ki)=>{e.save(),e.clip(),await n(e,t,o,i),e.restore()};const Mi=(e,t,o)=>{let i=Oe(0,0,o.width,o.height);const n=Ie(e);if("contain"===t){const t=Je(e,je(i));n.width=t.width,n.height=t.height,n.x+=t.x,n.y+=t.y}else"cover"===t&&(i=Je(Oe(0,0,i.width,i.height),je(n)));return{srcRect:i,destRect:n}},Ti=(e,t)=>(t.cornerRadius>0?((e,t,o,i,n,r)=>{i<2*r&&(r=i/2),n<2*r&&(r=n/2),e.beginPath(),e.moveTo(t+r,o),e.arcTo(t+i,o,t+i,o+n,r),e.arcTo(t+i,o+n,t,o+n,r),e.arcTo(t,o+n,t,o,r),e.arcTo(t,o,t+i,o,r),e.closePath()})(e,t.x,t.y,t.width,t.height,t.cornerRadius):e.rect(t.x,t.y,t.width,t.height),e),Ri=(e,t)=>(t.backgroundColor&&e.fill(),e),Pi=(e,t)=>(t.strokeWidth&&e.stroke(),e);var Ai=async(e,t,o={})=>new Promise((async(i,n)=>{const{drawImage:r}=o;if(e.lineWidth=t.strokeWidth?t.strokeWidth:1,e.strokeStyle=t.strokeColor?no(t.strokeColor):"none",e.fillStyle=t.backgroundColor?no(t.backgroundColor):"none",e.globalAlpha=t.opacity,t.backgroundImage){let o;try{o=bi(t.backgroundImage)?t.backgroundImage:await Si(t.backgroundImage)}catch(e){n(e)}Ti(e,t),Ri(e,t);const{srcRect:a,destRect:s}=Mi(t,t.backgroundSize,ye(o));await Ci(e,o,a,s,r),Pi(e,t),i([])}else Ti(e,t),Ri(e,t),Pi(e,t),i([])})),Ii=async(e,t,o={})=>new Promise((async(i,n)=>{const{drawImage:r}=o;if(e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?no(t.strokeColor):"none",e.fillStyle=t.backgroundColor?no(t.backgroundColor):"none",e.globalAlpha=t.opacity,e.ellipse(t.x,t.y,t.rx,t.ry,0,0,2*Math.PI),t.backgroundColor&&e.fill(),t.backgroundImage){let o;try{o=await Si(t.backgroundImage)}catch(e){n(e)}const a=Oe(t.x-t.rx,t.y-t.ry,2*t.rx,2*t.ry),{srcRect:s,destRect:l}=Mi(a,t.backgroundSize,ye(o));await Ci(e,o,s,l,r),t.strokeWidth&&e.stroke(),i([])}else t.strokeWidth&&e.stroke(),i([])})),Ei=async(e,t,o)=>{const i=t.width&&t.height?ge(t):po(t.text,t),n={x:t.x,y:t.y,width:t.width||i.width,height:i.height};Ai(e,{...t,...n,options:o}),lo(e,t);let r=0;return"center"==t.textAlign?r=-10:"right"===t.textAlign&&(r=-20),e.rect(t.x+r,t.y,t.width+40,t.height),e.save(),e.clip(),go(e,t.width?mo(e,t.text,t.width):t.text,{x:t.x,y:t.y,fontSize:t.fontSize,textAlign:t.textAlign,lineHeight:t.lineHeight,lineWidth:t.width}),e.restore(),[]},Li=async(e,t)=>new Promise((async o=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?no(t.strokeColor):"none",e.globalAlpha=t.opacity;let i=wo(t),n=So(t);e.moveTo(i.x,i.y),e.lineTo(n.x,n.y),t.strokeWidth&&e.stroke(),o([])})),Fi=async(e,t)=>new Promise(((o,i)=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?no(t.strokeColor):"none",e.fillStyle=t.backgroundColor?no(t.backgroundColor):"none",e.globalAlpha=t.opacity;const{points:n}=t;t.pathClose&&e.beginPath(),e.moveTo(n[0].x,n[0].y);const r=n.length;for(let t=1;t<r;t++)e.lineTo(n[t].x,n[t].y);t.pathClose&&e.closePath(),t.strokeWidth&&e.stroke(),t.backgroundColor&&e.fill(),o([])}));const Bi=async(e,t,o)=>{const i=(e=>{if(To(e))return G(e.x+.5*e.width,e.y+.5*e.height);if(Ro(e))return G(e.x,e.y);if(Mo(e)){const t=e.height||po(e.text,e).height;return G(e.x+.5*e.width,e.y+.5*t)}if(Co(e)){const t=po(e.text,e);return G(e.x+.5*t.width,e.y+.5*t.height)}return Io(e)?de(e.points):Po(e)?de([wo(e),So(e)]):void 0})(t);let n;return Bt(e,t.rotation,i),((e,t,o,i)=>{(t||o)&&(e.translate(i.x,i.y),e.scale(t?-1:1,o?-1:1),e.translate(-i.x,-i.y))})(e,t.flipX,t.flipY,i),To(t)?n=Ai:Ro(t)?n=Ii:Po(t)?n=Li:Io(t)?n=Fi:ko(t)&&(n=Ei),n?[t,...await zi(e,await n(e,t,o),o)]:[]};var zi=async(e,t,o)=>{let i=[];for(const n of t)e.save(),e.beginPath(),i=[...i,...await Bi(e,n,o)],e.restore();return i},Di=async(e,t={})=>{const{shapes:o=[],context:i=e,contextBounds:n=e,transform:r=a,drawImage:s,preprocessShape:l=W}=t;if(!o.length)return e;const c=g("canvas");c.width=n.width,c.height=n.height;const d=c.getContext("2d");d.putImageData(e,n.x||0,n.y||0);const u=o.map($o).map((e=>di(e,{x:0,y:0,width:i.width,height:i.height}))).map(l).flat();r(d),await zi(d,u,{drawImage:s});const h=d.getImageData(0,0,c.width,c.height);return $(c),h},Oi=async(e,t={})=>{const{backgroundColor:o}=t;if(!o||o&&0===o[3])return e;let i,n=g("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");return r.putImageData(e,0,0),r.globalCompositeOperation="destination-over",r.fillStyle=no(o),r.fillRect(0,0,n.width,n.height),i=r.getImageData(0,0,n.width,n.height),$(n),i},_i=e=>e.length?e.reduce(((e,t)=>((e,t)=>{const o=new Array(20);return o[0]=e[0]*t[0]+e[1]*t[5]+e[2]*t[10]+e[3]*t[15],o[1]=e[0]*t[1]+e[1]*t[6]+e[2]*t[11]+e[3]*t[16],o[2]=e[0]*t[2]+e[1]*t[7]+e[2]*t[12]+e[3]*t[17],o[3]=e[0]*t[3]+e[1]*t[8]+e[2]*t[13]+e[3]*t[18],o[4]=e[0]*t[4]+e[1]*t[9]+e[2]*t[14]+e[3]*t[19]+e[4],o[5]=e[5]*t[0]+e[6]*t[5]+e[7]*t[10]+e[8]*t[15],o[6]=e[5]*t[1]+e[6]*t[6]+e[7]*t[11]+e[8]*t[16],o[7]=e[5]*t[2]+e[6]*t[7]+e[7]*t[12]+e[8]*t[17],o[8]=e[5]*t[3]+e[6]*t[8]+e[7]*t[13]+e[8]*t[18],o[9]=e[5]*t[4]+e[6]*t[9]+e[7]*t[14]+e[8]*t[19]+e[9],o[10]=e[10]*t[0]+e[11]*t[5]+e[12]*t[10]+e[13]*t[15],o[11]=e[10]*t[1]+e[11]*t[6]+e[12]*t[11]+e[13]*t[16],o[12]=e[10]*t[2]+e[11]*t[7]+e[12]*t[12]+e[13]*t[17],o[13]=e[10]*t[3]+e[11]*t[8]+e[12]*t[13]+e[13]*t[18],o[14]=e[10]*t[4]+e[11]*t[9]+e[12]*t[14]+e[13]*t[19]+e[14],o[15]=e[15]*t[0]+e[16]*t[5]+e[17]*t[10]+e[18]*t[15],o[16]=e[15]*t[1]+e[16]*t[6]+e[17]*t[11]+e[18]*t[16],o[17]=e[15]*t[2]+e[16]*t[7]+e[17]*t[12]+e[18]*t[17],o[18]=e[15]*t[3]+e[16]*t[8]+e[17]*t[13]+e[18]*t[18],o[19]=e[15]*t[4]+e[16]*t[9]+e[17]*t[14]+e[18]*t[19]+e[19],o})([...e],t)),e.shift()):[],Wi=(e,t)=>{const o=e.width*e.height,i=t.reduce(((e,t)=>(t.width>e.width&&t.height>e.height&&(e.width=t.width,e.height=t.height),e)),{width:0,height:0}),n=i.width*i.height;return((e,t=2)=>Math.round(e*t)/t)(Math.max(.5,.5+(1-n/o)/2),5)};function Vi(){}const Ni=e=>e;function Hi(e,t){for(const o in t)e[o]=t[o];return e}function Ui(e){return e()}function ji(){return Object.create(null)}function Xi(e){e.forEach(Ui)}function Yi(e){return"function"==typeof e}function Gi(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function qi(e,...t){if(null==e)return Vi;const o=e.subscribe(...t);return o.unsubscribe?()=>o.unsubscribe():o}function Ki(e){let t;return qi(e,(e=>t=e))(),t}function Zi(e,t,o){e.$$.on_destroy.push(qi(t,o))}function Ji(e,t,o,i){if(e){const n=Qi(e,t,o,i);return e[0](n)}}function Qi(e,t,o,i){return e[1]&&i?Hi(o.ctx.slice(),e[1](i(t))):o.ctx}function en(e,t,o,i,n,r,a){const s=function(e,t,o,i){if(e[2]&&i){const n=e[2](i(o));if(void 0===t.dirty)return n;if("object"==typeof n){const e=[],o=Math.max(t.dirty.length,n.length);for(let i=0;i<o;i+=1)e[i]=t.dirty[i]|n[i];return e}return t.dirty|n}return t.dirty}(t,i,n,r);if(s){const n=Qi(t,o,i,a);e.p(n,s)}}function tn(e){const t={};for(const o in e)"$"!==o[0]&&(t[o]=e[o]);return t}function on(e,t){const o={};t=new Set(t);for(const i in e)t.has(i)||"$"===i[0]||(o[i]=e[i]);return o}function nn(e,t,o=t){return e.set(o),t}function rn(e){return e&&Yi(e.destroy)?e.destroy:Vi}const an="undefined"!=typeof window;let sn=an?()=>window.performance.now():()=>Date.now(),ln=an?e=>requestAnimationFrame(e):Vi;const cn=new Set;function dn(e){cn.forEach((t=>{t.c(e)||(cn.delete(t),t.f())})),0!==cn.size&&ln(dn)}function un(e){let t;return 0===cn.size&&ln(dn),{promise:new Promise((o=>{cn.add(t={c:e,f:o})})),abort(){cn.delete(t)}}}function hn(e,t){e.appendChild(t)}function pn(e,t,o){e.insertBefore(t,o||null)}function mn(e){e.parentNode.removeChild(e)}function gn(e){return document.createElement(e)}function fn(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function $n(e){return document.createTextNode(e)}function yn(){return $n(" ")}function bn(){return $n("")}function xn(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function vn(e){return function(t){return t.preventDefault(),e.call(this,t)}}function wn(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function Sn(e,t,o){null==o?e.removeAttribute(t):e.getAttribute(t)!==o&&e.setAttribute(t,o)}function kn(e,t){const o=Object.getOwnPropertyDescriptors(e.__proto__);for(const i in t)null==t[i]?e.removeAttribute(i):"style"===i?e.style.cssText=t[i]:"__value"===i?e.value=e[i]=t[i]:o[i]&&o[i].set?e[i]=t[i]:Sn(e,i,t[i])}function Cn(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function Mn(e,t){e.value=null==t?"":t}function Tn(e,t){const o=document.createEvent("CustomEvent");return o.initCustomEvent(e,!1,!1,t),o}class Rn{constructor(e=null){this.a=e,this.e=this.n=null}m(e,t,o=null){this.e||(this.e=gn(t.nodeName),this.t=t,this.h(e)),this.i(o)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)pn(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(mn)}}const Pn=new Set;let An,In=0;function En(e,t,o,i,n,r,a,s=0){const l=16.666/i;let c="{\n";for(let e=0;e<=1;e+=l){const i=t+(o-t)*r(e);c+=100*e+`%{${a(i,1-i)}}\n`}const d=c+`100% {${a(o,1-o)}}\n}`,u=`__svelte_${function(e){let t=5381,o=e.length;for(;o--;)t=(t<<5)-t^e.charCodeAt(o);return t>>>0}(d)}_${s}`,h=e.ownerDocument;Pn.add(h);const p=h.__svelte_stylesheet||(h.__svelte_stylesheet=h.head.appendChild(gn("style")).sheet),m=h.__svelte_rules||(h.__svelte_rules={});m[u]||(m[u]=!0,p.insertRule(`@keyframes ${u} ${d}`,p.cssRules.length));const g=e.style.animation||"";return e.style.animation=`${g?g+", ":""}${u} ${i}ms linear ${n}ms 1 both`,In+=1,u}function Ln(e,t){const o=(e.style.animation||"").split(", "),i=o.filter(t?e=>e.indexOf(t)<0:e=>-1===e.indexOf("__svelte")),n=o.length-i.length;n&&(e.style.animation=i.join(", "),In-=n,In||ln((()=>{In||(Pn.forEach((e=>{const t=e.__svelte_stylesheet;let o=t.cssRules.length;for(;o--;)t.deleteRule(o);e.__svelte_rules={}})),Pn.clear())})))}function Fn(e){An=e}function Bn(){if(!An)throw new Error("Function called outside component initialization");return An}function zn(e){Bn().$$.on_mount.push(e)}function Dn(e){Bn().$$.after_update.push(e)}function On(e){Bn().$$.on_destroy.push(e)}function _n(){const e=Bn();return(t,o)=>{const i=e.$$.callbacks[t];if(i){const n=Tn(t,o);i.slice().forEach((t=>{t.call(e,n)}))}}}function Wn(e,t){Bn().$$.context.set(e,t)}function Vn(e){return Bn().$$.context.get(e)}function Nn(e,t){const o=e.$$.callbacks[t.type];o&&o.slice().forEach((e=>e(t)))}const Hn=[],Un=[],jn=[],Xn=[],Yn=Promise.resolve();let Gn=!1;function qn(e){jn.push(e)}function Kn(e){Xn.push(e)}let Zn=!1;const Jn=new Set;function Qn(){if(!Zn){Zn=!0;do{for(let e=0;e<Hn.length;e+=1){const t=Hn[e];Fn(t),er(t.$$)}for(Fn(null),Hn.length=0;Un.length;)Un.pop()();for(let e=0;e<jn.length;e+=1){const t=jn[e];Jn.has(t)||(Jn.add(t),t())}jn.length=0}while(Hn.length);for(;Xn.length;)Xn.pop()();Gn=!1,Zn=!1,Jn.clear()}}function er(e){if(null!==e.fragment){e.update(),Xi(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(qn)}}let tr;function or(e,t,o){e.dispatchEvent(Tn(`${t?"intro":"outro"}${o}`))}const ir=new Set;let nr;function rr(){nr={r:0,c:[],p:nr}}function ar(){nr.r||Xi(nr.c),nr=nr.p}function sr(e,t){e&&e.i&&(ir.delete(e),e.i(t))}function lr(e,t,o,i){if(e&&e.o){if(ir.has(e))return;ir.add(e),nr.c.push((()=>{ir.delete(e),i&&(o&&e.d(1),i())})),e.o(t)}}const cr={duration:0};function dr(e,t,o,i){let n=t(e,o),r=i?0:1,a=null,s=null,l=null;function c(){l&&Ln(e,l)}function d(e,t){const o=e.b-r;return t*=Math.abs(o),{a:r,b:e.b,d:o,duration:t,start:e.start,end:e.start+t,group:e.group}}function u(t){const{delay:o=0,duration:i=300,easing:u=Ni,tick:h=Vi,css:p}=n||cr,m={start:sn()+o,b:t};t||(m.group=nr,nr.r+=1),a||s?s=m:(p&&(c(),l=En(e,r,t,i,o,u,p)),t&&h(0,1),a=d(m,i),qn((()=>or(e,t,"start"))),un((t=>{if(s&&t>s.start&&(a=d(s,i),s=null,or(e,a.b,"start"),p&&(c(),l=En(e,r,a.b,a.duration,0,u,n.css))),a)if(t>=a.end)h(r=a.b,1-r),or(e,a.b,"end"),s||(a.b?c():--a.group.r||Xi(a.group.c)),a=null;else if(t>=a.start){const e=t-a.start;r=a.a+a.d*u(e/a.duration),h(r,1-r)}return!(!a&&!s)})))}return{run(e){Yi(n)?(tr||(tr=Promise.resolve(),tr.then((()=>{tr=null}))),tr).then((()=>{n=n(),u(e)})):u(e)},end(){c(),a=s=null}}}const ur="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function hr(e,t){e.d(1),t.delete(e.key)}function pr(e,t){lr(e,1,1,(()=>{t.delete(e.key)}))}function mr(e,t,o,i,n,r,a,s,l,c,d,u){let h=e.length,p=r.length,m=h;const g={};for(;m--;)g[e[m].key]=m;const f=[],$=new Map,y=new Map;for(m=p;m--;){const e=u(n,r,m),s=o(e);let l=a.get(s);l?i&&l.p(e,t):(l=c(s,e),l.c()),$.set(s,f[m]=l),s in g&&y.set(s,Math.abs(m-g[s]))}const b=new Set,x=new Set;function v(e){sr(e,1),e.m(s,d),a.set(e.key,e),d=e.first,p--}for(;h&&p;){const t=f[p-1],o=e[h-1],i=t.key,n=o.key;t===o?(d=t.first,h--,p--):$.has(n)?!a.has(i)||b.has(i)?v(t):x.has(n)?h--:y.get(i)>y.get(n)?(x.add(i),v(t)):(b.add(n),h--):(l(o,a),h--)}for(;h--;){const t=e[h];$.has(t.key)||l(t,a)}for(;p;)v(f[p-1]);return f}function gr(e,t){const o={},i={},n={$$scope:1};let r=e.length;for(;r--;){const a=e[r],s=t[r];if(s){for(const e in a)e in s||(i[e]=1);for(const e in s)n[e]||(o[e]=s[e],n[e]=1);e[r]=s}else for(const e in a)n[e]=1}for(const e in i)e in o||(o[e]=void 0);return o}function fr(e){return"object"==typeof e&&null!==e?e:{}}function $r(e,t,o){const i=e.$$.props[t];void 0!==i&&(e.$$.bound[i]=o,o(e.$$.ctx[i]))}function yr(e){e&&e.c()}function br(e,t,o,i){const{fragment:n,on_mount:r,on_destroy:a,after_update:s}=e.$$;n&&n.m(t,o),i||qn((()=>{const t=r.map(Ui).filter(Yi);a?a.push(...t):Xi(t),e.$$.on_mount=[]})),s.forEach(qn)}function xr(e,t){const o=e.$$;null!==o.fragment&&(Xi(o.on_destroy),o.fragment&&o.fragment.d(t),o.on_destroy=o.fragment=null,o.ctx=[])}function vr(e,t){-1===e.$$.dirty[0]&&(Hn.push(e),Gn||(Gn=!0,Yn.then(Qn)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function wr(e,t,o,i,n,r,a=[-1]){const s=An;Fn(e);const l=e.$$={fragment:null,ctx:null,props:r,update:Vi,not_equal:n,bound:ji(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s?s.$$.context:t.context||[]),callbacks:ji(),dirty:a,skip_bound:!1};let c=!1;if(l.ctx=o?o(e,t.props||{},((t,o,...i)=>{const r=i.length?i[0]:o;return l.ctx&&n(l.ctx[t],l.ctx[t]=r)&&(!l.skip_bound&&l.bound[t]&&l.bound[t](r),c&&vr(e,t)),o})):[],l.update(),c=!0,Xi(l.before_update),l.fragment=!!i&&i(l.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);l.fragment&&l.fragment.l(e),e.forEach(mn)}else l.fragment&&l.fragment.c();t.intro&&sr(e.$$.fragment),br(e,t.target,t.anchor,t.customElement),Qn()}Fn(s)}class Sr{$destroy(){xr(this,1),this.$destroy=Vi}$on(e,t){const o=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return o.push(t),()=>{const e=o.indexOf(t);-1!==e&&o.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const kr=[];function Cr(e,t){return{subscribe:Mr(e,t).subscribe}}function Mr(e,t=Vi){let o;const i=[];function n(t){if(Gi(e,t)&&(e=t,o)){const t=!kr.length;for(let t=0;t<i.length;t+=1){const o=i[t];o[1](),kr.push(o,e)}if(t){for(let e=0;e<kr.length;e+=2)kr[e][0](kr[e+1]);kr.length=0}}}return{set:n,update:function(t){n(t(e))},subscribe:function(r,a=Vi){const s=[r,a];return i.push(s),1===i.length&&(o=t(n)||Vi),r(e),()=>{const e=i.indexOf(s);-1!==e&&i.splice(e,1),0===i.length&&(o(),o=null)}}}}function Tr(e,t,o){const i=!Array.isArray(e),n=i?[e]:e,r=t.length<2;return Cr(o,(e=>{let o=!1;const a=[];let s=0,l=Vi;const c=()=>{if(s)return;l();const o=t(i?a[0]:a,e);r?e(o):l=Yi(o)?o:Vi},d=n.map(((e,t)=>qi(e,(e=>{a[t]=e,s&=~(1<<t),o&&c()}),(()=>{s|=1<<t}))));return o=!0,c(),function(){Xi(d),l()}}))}var Rr=e=>e.reduce(((e,t)=>Object.assign(e,t)),{});const Pr=e=>({updateValue:e}),Ar=e=>({defaultValue:e}),Ir=e=>({store:(t,o)=>Tr(...e(o))}),Er=e=>({store:(t,o)=>{const[i,n,r=(()=>!1)]=e(o);let a,s=!0;return Tr(i,((e,t)=>{n(e,(e=>{!s&&r(a,e)||(a=e,s=!1,t(e))}))}))}}),Lr=e=>({store:(t,o)=>{const[i,n={},r]=e(o);let a=[],s={};const l=e=>i(e,s),c=e=>{(a.length||e.length)&&(a=e,d())},d=()=>{const e=a.map(l);r&&e.sort(r),a=[...e],h(e)};Object.entries(n).map((([e,t])=>t.subscribe((t=>{s[e]=t,t&&d()}))));const{subscribe:u,set:h}=Mr(t||[]);return{set:c,update:e=>c(e(a)),subscribe:u}}});var Fr=e=>{const t={},o={};return e.forEach((([e,...i])=>{const n=Rr(i),r=t[e]=((e,t,o)=>{const{store:i=(e=>Mr(e)),defaultValue:n=a,updateValue:r}=o,s=i(n(),t,e),{subscribe:l,update:c=a}=s;let d;const u=e=>{let t=!0;d&&d(),d=l((o=>{if(t)return t=!1;e(o),d(),d=void 0}))},h=r?r(e):W;return s.set=e=>c((t=>h(e,t,u))),s.defaultValue=n,s})(o,t,n),s={get:()=>Ki(r),set:r.set};Object.defineProperty(o,e,s)})),{stores:t,accessors:o}},Br=[["src"],["imageReader"],["imageWriter"],["shapePreprocessor"],["imageScrambler"],["images",Ar((()=>[]))]],zr=e=>e.charAt(0).toUpperCase()+e.slice(1),Dr=(e,t)=>{Object.keys(t).forEach((o=>{const i=qt(t[o])?{value:t[o],writable:!1}:t[o];Object.defineProperty(e,o,i)}))};const Or=1e4;var _r=(e,t)=>{const o=lt(t),i=Y();et(e).forEach((e=>{ne(e,i),st(e,t)||o.forEach((t=>{const o=Math.atan2(t.start.y-t.end.y,t.start.x-t.end.x),n=Math.sin(Math.PI-o)*Or,r=Math.cos(Math.PI-o)*Or,a=G(e.x+n,e.y+r),s=Re(Te(t),Or),l=rt(Me(e,a),s);l&&ne(i,re(K(l),e))}))}));const n=Ie(e);ne(n,i);return!!et(n).every((e=>st(e,t)))&&(Ye(e,n),!0)},Wr=(e,t)=>{const o=et(e),i=lt(t).map((e=>Re(e,5))),n=_e(e),r=[];o.forEach((e=>{const t=((e,t)=>{if(0===t)return e;const o=G(e.start.x-e.end.x,e.start.y-e.end.y),i=ee(o),n=ae(i,t);return e.end.x+=n.x,e.end.y+=n.y,e})(Me(K(n),K(e)),1e6);let o=!1;i.map(Te).forEach((e=>{const i=rt(t,e);i&&!o&&(r.push(i),o=!0)}))}));const a=ce(r[0],r[2])<ce(r[1],r[3])?[r[0],r[2]]:[r[1],r[3]],s=Be(a);return s.width<e.width&&(Ye(e,s),!0)},Vr=(e,t,o={x:0,y:0})=>{const i=Le(e),n=_e(i),r=ot(i,o,n).map((e=>J(e,t,n))),a=Be(r);return r.map((e=>re(e,a)))},Nr=(e,t=0,o=je(e))=>{let i,n;if(0!==t){const r=Math.atan2(1,o),a=Math.sign(t)*t,s=a%Math.PI,l=a%N;let c,d;d=s>H&&s<N+H?l>H?a:N-l:l>H?N-l:a,c=Math.min(Math.abs(e.height/Math.sin(r+d)),Math.abs(e.width/Math.cos(r-d))),i=Math.cos(r)*c,n=i/o}else i=e.width,n=i/o,n>e.height&&(n=e.height,i=n*o);return be(i,n)},Hr=(e,t,o,i,n,r,a,s)=>{const l=me(a),c=me(s),d=fo(Math.max(t.width/c.width,t.height/c.height)),u=fo(Math.min(t.width/l.width,t.height/l.height)),h=Ie(t);if(u<1||d>1){const o=_e(e),i=_e(t),n=u<1?u:d,r=(i.x+o.x)/2,a=(i.y+o.y)/2,s=h.width/n,l=h.height/n;Xe(h,r-.5*s,a-.5*l,s,l)}return r?(((e,t,o=0,i=Y(),n)=>{if(Xt(o)&&0!==o||i.x||i.y){const n=je(e),r=Vr(t,o,i),a=Nr(t,o,n);if(!(e.width<a.width&&e.height<a.height)){const t=.5*e.width-.5*a.width,o=.5*e.height-.5*a.height;e.width>a.width&&(e.width=a.width,e.x+=t),e.height>a.height&&(e.height=a.height,e.y+=o)}_r(e,r),Wr(e,r)&&_r(e,r)}else{let o=je(e);e.width=Math.min(e.width,t.width),e.height=Math.min(e.height,t.height),e.x=Math.max(e.x,0),e.x+e.width>t.width&&(e.x-=e.x+e.width-t.width),e.y=Math.max(e.y,0),e.y+e.height>t.height&&(e.y-=e.y+e.height-t.height);const i=_e(e),r=Je(e,o);r.width=Math.max(n.width,r.width),r.height=Math.max(n.height,r.height),r.x=i.x-.5*r.width,r.y=i.y-.5*r.height,Ye(e,r)}})(h,o,i,n,l),{crop:h}):{crop:h}},Ur=(e,t,o)=>{const i=Le(e),n=_e(i),r=Ge(i,o,n),a=_e(it(Be(r))),s=_e(t),l=J(s,-o,a),c=re(l,a),d=ie(ne(n,c),fo);return Oe(d.x-.5*t.width,d.y-.5*t.height,t.width,t.height)},jr=(e,t,o)=>Math.max(t,Math.min(e,o));const Xr=["cropLimitToImage","cropMinSize","cropMaxSize","cropAspectRatio","flipX","flipY","rotation","crop","colorMatrix","convolutionMatrix","gamma","vignette","redaction","annotation","decoration","frame","backgroundColor","targetSize","metadata"],Yr=e=>Kt(e)?e.map(Yr):v(e)?{...e}:e,Gr=e=>e.map((e=>Object.entries(e).reduce(((e,[t,o])=>(t.startsWith("_")||(e[t]=o),e)),{})));var qr=(e,t)=>{if(e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(e[o]!==t[o])return!1;return!0};const Kr=-H,Zr=H,Jr=(e,t,o)=>{const i=ie(_e(e),(e=>fo(e,8))),n=Le(t),r=_e(n),a=Ge(n,o,r),s=ie(we(Be(a)),(e=>fo(e,8))),l=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y);return l<1&&c<1},Qr=(e,t,o,i,n)=>{if(!n)return[Kr,Zr];const r=Math.max(o.width/i.width,o.height/i.height),a=be(i.width*r,i.height*r),s=(l=a,Math.sqrt(l.width*l.width+l.height*l.height));var l;if(s<Math.min(e.width,e.height))return[Kr,Zr];const c=t?e.height:e.width,d=t?e.width:e.height,u=Math.acos(a.height/s),h=u-Math.acos(d/s),p=Math.asin(c/s)-u;if(Number.isNaN(h)&&Number.isNaN(p))return[Kr,Zr];const m=Number.isNaN(h)?p:Number.isNaN(p)?h:Math.min(h,p);return[Math.max(-m,Kr),Math.min(m,Zr)]},ea=(e,t)=>{const{context:o,props:i}=t;return e._isFormatted||((e=oi(e))._isFormatted=!0,Object.assign(e,i)),e._isDraft||!Oo(e)||e._context&&Ue(o,e._context)||((e=$i(e,o))._context={...o}),e};var ta=[["file"],["size"],["loadState"],["processState"],["aspectRatio",Ir((({size:e})=>[e,e=>e?je(e):void 0]))],["perspectiveX",Ar((()=>0))],["perspectiveY",Ar((()=>0))],["perspective",Ir((({perspectiveX:e,perspectiveY:t})=>[[e,t],([e,t])=>({x:e,y:t})]))],["rotation",Ar((()=>0)),Pr((e=>(t,o,i)=>{if(t===o)return t;const{loadState:n,size:r,rotationRange:a,cropMinSize:s,cropMaxSize:l,crop:c,perspective:d,cropLimitToImage:u,cropOrigin:h}=e;if(!c||!n||!n.beforeComplete)return t;const p=((e,t,o)=>{const i=Nr(t,o,je(e));return xe(Ce(i,Math.round),Ce(me(e),Math.round))})(c,r,o),m=Jr(c,r,o),g=((e,t,o,i,n,r,a,s,l,c)=>{const d=me(l),u=me(c);a&&(u.width=Math.min(c.width,n.width),u.height=Math.min(c.height,n.height));let h=!1;const p=(t,o)=>{const l=Ur(n,i,t),c=Le(n),m=_e(c),g=ot(c,r,m),f=re(K(m),nt(g)),$=J(_e(l),o,m),y=re(K(m),$);g.forEach((e=>J(e,o,m)));const b=Be(g),x=nt(g),v=ne(re(re(x,y),b),f),w=Oe(v.x-.5*l.width,v.y-.5*l.height,l.width,l.height);if(s&&Ve(w,s.width/w.width),a){const e=Vr(n,o,r);Wr(w,e)}const S=fo(Math.min(w.width/d.width,w.height/d.height),8),k=fo(Math.max(w.width/u.width,w.height/u.height),8);return(S<1||k>1)&&fo(Math.abs(o-t))===fo(Math.PI/2)&&!h?(h=!0,p(e,e+Math.sign(o-t)*Math.PI)):{rotation:o,crop:tt(w,(e=>fo(e,8)))}},m=Math.sign(t)*Math.round(Math.abs(t)/N)*N,g=jr(t,m+o[0],m+o[1]);return p(e,g)})(o,t,a,c,r,d,u,h,s,l);if(p&&m){const e=Nr(r,t,je(g.crop));g.crop.x+=.5*g.crop.width,g.crop.y+=.5*g.crop.height,g.crop.x-=.5*e.width,g.crop.y-=.5*e.height,g.crop.width=e.width,g.crop.height=e.height}return i((()=>{e.crop=tt(g.crop,(e=>fo(e,8)))})),g.rotation}))],["flipX",Ar((()=>!1))],["flipY",Ar((()=>!1))],["flip",Ir((({flipX:e,flipY:t})=>[[e,t],([e,t])=>({x:e,y:t})]))],["isRotatedSideways",Er((({rotation:e})=>[[e],([e],t)=>t(U(e)),(e,t)=>e!==t]))],["crop",Pr((e=>(t,o=t)=>{const{loadState:i,size:n,cropMinSize:r,cropMaxSize:a,cropLimitToImage:s,cropAspectRatio:l,rotation:c,perspective:d}=e;if(!t&&!o||!i||!i.beforeComplete)return t;t||(t=Le(Nr(n,c,l||je(n))));const u=Hr(o,t,n,c,d,s,r,a);return tt(u.crop,(e=>fo(e,8)))}))],["cropAspectRatio",Pr((e=>(t,o)=>{const{loadState:i,crop:n,size:r,rotation:a,cropLimitToImage:s}=e,l=(e=>{if(e){if(/:/.test(e)){const[t,o]=e.split(":");return t/o}return parseFloat(e)}})(t);if(!l)return;if(!n||!i||!i.beforeComplete)return l;const c=o?Math.abs(t-o):1;if(Jr(n,r,a)&&s&&c>=.1){const o=((e,t)=>{const o=e.width,i=e.height;return U(t)&&(e.width=i,e.height=o),e})(me(r),a);e.crop=tt(Je(Le(o),t),fo)}else{const t={width:n.height*l,height:n.height},o=.5*(n.width-t.width),i=.5*(n.height-t.height);e.crop=tt(Oe(n.x+o,n.y+i,t.width,t.height),fo)}return l}))],["cropOrigin"],["cropMinSize",Ar((()=>({width:1,height:1})))],["cropMaxSize",Ar((()=>({width:32768,height:32768})))],["cropLimitToImage",Ar((()=>!0)),Pr((e=>(t,o,i)=>{const{crop:n}=e;return n?(!o&&t&&i((()=>e.crop=Ie(e.crop))),t):t}))],["cropSize",Er((({crop:e})=>[[e],([e],t)=>{e&&t(be(e.width,e.height))},(e,t)=>xe(e,t)]))],["cropRectAspectRatio",Ir((({cropSize:e})=>[[e],([e],t)=>{e&&t(fo(je(e),5))}]))],["cropRange",Er((({size:e,rotation:t,cropRectAspectRatio:o,cropMinSize:i,cropMaxSize:n,cropLimitToImage:r})=>[[e,t,o,i,n,r],([e,t,o,i,n,r],a)=>{if(!e)return;a(((e,t,o,i,n,r)=>{const a=me(i),s=me(n);return r?[a,Ce(Nr(e,t,o),Math.round)]:[a,s]})(e,t,o,i,n,r))},(e,t)=>qr(e,t)]))],["rotationRange",Er((({size:e,isRotatedSideways:t,cropMinSize:o,cropSize:i,cropLimitToImage:n})=>[[e,t,o,i,n],([e,t,o,i,n],r)=>{if(!e||!i)return;r(Qr(e,t,o,i,n))},(e,t)=>qr(e,t)]))],["backgroundColor",Pr((()=>e=>((e=[0,0,0,0],t=1)=>4===e.length?e:[...e,t])(e)))],["targetSize"],["colorMatrix"],["convolutionMatrix"],["gamma"],["noise"],["vignette"],["redaction",Lr((({size:e})=>[ea,{context:e}]))],["annotation",Lr((({size:e})=>[ea,{context:e}]))],["decoration",Lr((({crop:e})=>[ea,{context:e}]))],["frame",Pr((()=>e=>{if(!e)return;const t={frameStyle:void 0,x:0,y:0,width:"100%",height:"100%",disableStyle:["backgroundColor","strokeColor","strokeWidth"]};return k(e)?t.frameStyle=e:Object.assign(t,e),t}))],["metadata"],["state",(e=>({store:e}))(((e,t,o)=>{const i=Xr.map((e=>t[e])),{subscribe:n}=Tr(i,((e,t)=>{const o=Xr.reduce(((t,o,i)=>(t[o]=Yr(e[i]),t)),{});o.crop&&tt(o.crop,Math.round),o.redaction=o.redaction&&Gr(o.redaction),o.annotation=o.annotation&&Gr(o.annotation),o.decoration=o.decoration&&Gr(o.decoration),t(o)})),r=e=>{e&&(o.cropOrigin=void 0,Xr.filter((t=>Gt(e,t))).forEach((t=>{o[t]=Yr(e[t])})))};return{set:r,update:e=>r(e(null)),subscribe:n}}))]],oa=async(e,t,o={},i)=>{const{ontaskstart:n,ontaskprogress:r,ontaskend:a,token:s}=i;let l=!1;s.cancel=()=>{l=!0};for(const[i,s]of t.entries()){if(l)return;const[t,c]=s;n(i,c);try{e=await t(e,{...o},(e=>r(i,c,e)))}catch(e){throw l=!0,e}a(i,c)}return e};const ia=["loadstart","loadabort","loaderror","loadprogress","load","processstart","processabort","processerror","processprogress","process"],na=["flip","cropOrigin","isRotatedSideways","perspective","perspectiveX","perspectiveY","cropRange"],ra=["images"],aa=ta.map((([e])=>e)).filter((e=>!na.includes(e))),sa=e=>"image"+zr(e),la=e=>Gt(e,"crop");var ca=()=>{const{stores:e,accessors:t}=Fr(Br),{sub:o,pub:i}=vi(),n=()=>t.images?t.images[0]:{};let r={};aa.forEach((e=>{Object.defineProperty(t,sa(e),{get:()=>{const t=n();if(t)return t.accessors[e]},set:t=>{r[sa(e)]=t;const o=n();o&&(o.accessors[e]=t)}})}));const s=()=>t.images&&t.images[0],l=e.src.subscribe((e=>{if(!e)return t.images=[];t.imageReader&&(t.images.length&&(r={}),d(e))})),c=e.imageReader.subscribe((e=>{e&&(t.images.length||t.src&&d(t.src))})),d=e=>{Promise.resolve().then((()=>h(e,r))).catch((()=>{}))};let u;const h=(e,o={})=>new Promise(((n,l)=>{let c=s();const d=!(!1===o.cropLimitToImage||!1===o.imageCropLimitToImage),h=o.cropMinSize||o.imageCropMinSize,p=d?h:c&&c.accessors.cropMinSize;c&&m(),c=(({minSize:e={width:1,height:1}}={})=>{const{stores:t,accessors:o}=Fr(ta),{pub:i,sub:n}=vi(),r=(e,t)=>{const n=()=>o[e]||{},r=t=>o[e]={...n(),...t,timeStamp:Date.now()},a=()=>n().error,s=e=>{a()||(r({error:e}),i(t+"error",{...n()}))};return{start(){i(t+"start")},onabort(){r({abort:!0}),i(t+"abort",{...n()})},ontaskstart(e,o){a()||(r({index:e,task:o,taskProgress:void 0,taskLengthComputable:void 0}),i(t+"taskstart",{...n()}))},ontaskprogress(e,o,s){a()||(r({index:e,task:o,taskProgress:s.loaded/s.total,taskLengthComputable:s.lengthComputable}),i(t+"taskprogress",{...n()}),i(t+"progress",{...n()}))},ontaskend(e,o){a()||(r({index:e,task:o}),i(t+"taskend",{...n()}))},ontaskerror(e){s(e)},error(e){s(e)},beforeComplete(e){a()||(r({beforeComplete:!0}),i("before"+t,e))},complete(e){a()||(r({complete:!0}),i(t,e))}}};return Dr(o,{read:(t,{reader:i})=>{if(!i)return;Object.assign(o,{file:void 0,size:void 0,loadState:void 0});let n={cancel:a},s=!1;const l=r("loadState","load"),c={token:n,...l},d={src:t,size:void 0,dest:void 0},u={};return Promise.resolve().then((async()=>{try{if(l.start(),s)return l.onabort();const t=await oa(d,i,u,c);if(s)return l.onabort();const{size:r,dest:a}=t||{};if(!r||!r.width||!r.height)throw new kt("Image size missing","IMAGE_SIZE_MISSING",t);if(r.width<e.width||r.height<e.height)throw new kt("Image too small","IMAGE_TOO_SMALL",{...t,minWidth:e.width,minHeight:e.height});Object.assign(o,{size:r,file:a}),l.beforeComplete(t),l.complete(t)}catch(e){l.error(e)}finally{n=void 0}})),()=>{s=!0,n&&n.cancel(),l.onabort()}},write:(e,t)=>{if(!o.loadState.complete)return;o.processState=void 0;const i=r("processState","process"),n={src:o.file,imageState:o.state,dest:void 0};if(!e)return i.start(),void i.complete(n);let s={cancel:a},l=!1;const c=t,d={token:s,...i};return Promise.resolve().then((async()=>{try{if(i.start(),l)return i.onabort();const t=await oa(n,e,c,d);i.complete(t)}catch(e){i.error(e)}finally{s=void 0}})),()=>{l=!0,s&&s.cancel()}},on:n}),{accessors:o,stores:t}})({minSize:p}),ia.map((e=>{return c.accessors.on(e,(t=e,e=>i(t,e)));var t}));const g=()=>{r={},f.forEach((e=>e()))},f=[];f.push(c.accessors.on("loaderror",(e=>{g(),l(e)}))),f.push(c.accessors.on("loadabort",(()=>{g(),l({name:"AbortError"})}))),f.push(c.accessors.on("load",(e=>{u=void 0,g(),n(e)}))),f.push(c.accessors.on("beforeload",(()=>((e,o)=>{if(la(o))return void(t.imageState=o);if(!o.imageCrop){const t=e.accessors.size,i=o.imageRotation||0,n=Le(Se(me(t),i)),r=o.imageCropAspectRatio||(o.imageCropLimitToImage?je(t):je(n)),a=Je(n,r);o.imageCropLimitToImage||(a.x=(t.width-a.width)/2,a.y=(t.height-a.height)/2),o.imageCrop=a}["imageCropLimitToImage","imageCrop","imageCropAspectRatio","imageRotation"].filter((e=>Gt(o,e))).forEach((e=>{t[e]=o[e],delete o[e]}));const{imageCropLimitToImage:i,imageCrop:n,imageCropAspectRatio:r,imageRotation:a,...s}=o;Object.assign(t,s)})(c,o)))),t.images=[c],o.imageReader&&(t.imageReader=o.imageReader),o.imageWriter&&(t.imageWriter=o.imageWriter),u=c.accessors.read(e,{reader:t.imageReader})}));let p;const m=()=>{const e=s();e&&(u&&u(),e.accessors.loadState=void 0,t.images=[])};return Object.defineProperty(t,"stores",{get:()=>e}),Dr(t,{on:o,loadImage:h,abortLoadImage:()=>{u&&u(),t.images=[]},editImage:(e,o)=>new Promise(((i,n)=>{h(e,o).then((()=>{const{images:e}=t,o=e[0],r=()=>{a(),s()},a=o.accessors.on("processerror",(e=>{r(),n(e)})),s=o.accessors.on("process",(e=>{r(),i(e)}))})).catch(n)})),removeImage:m,processImage:(e,o)=>new Promise((async(i,n)=>{(e=>k(e)||oo(e)||ut(e))(e)?await h(e,o):e&&(la(e)?t.imageState=e:Object.assign(t,e));const r=s();if(!r)return n("no image");const a=()=>{p=void 0,l.forEach((e=>e()))},l=[];l.push(r.accessors.on("processerror",(e=>{a(),n(e)}))),l.push(r.accessors.on("processabort",(()=>{a(),n({name:"AbortError"})}))),l.push(r.accessors.on("process",(e=>{a(),i(e)}))),p=r.accessors.write(t.imageWriter,{shapePreprocessor:t.shapePreprocessor||W,imageScrambler:t.imageScrambler})})),abortProcessImage:()=>{const e=s();e&&(p&&p(),e.accessors.processState=void 0)},destroy:()=>{l(),c()}}),t};const da=(e,t)=>{const{processImage:o}=ca();return o(e,t)};var ua=()=>{if(!gt())return 1/0;const e=/15_/.test(navigator.userAgent);return It()?e?14745600:16777216:e?16777216:1/0};const ha=async(e,t,o,i)=>{const{dest:n}=await da(t,{imageReader:_a(),imageWriter:Wa({format:"canvas",targetSize:{...i,upscale:!0}}),imageCrop:o});e.drawImage(n,i.x,i.y,i.width,i.height),$(n)},pa=(e,t=((...e)=>e),o)=>async(i,n,r)=>{r(bt(0,!1));let a=!1;const s=await e(...t(i,n,(e=>{a=!0,r(e)})));return o&&o(i,s),a||r(bt(1,!1)),i},ma=({srcProp:e="src",destProp:t="dest"}={})=>[pa(Mt,((t,o,i)=>[t[e],i]),((e,o)=>e[t]=o)),"any-to-file"],ga=({srcProp:e="src",destProp:t="size"}={})=>[pa($t,((t,o)=>[t[e]]),((e,o)=>e[t]=o)),"read-image-size"],fa=({srcSize:e="size",srcOrientation:t="orientation",destSize:o="size"}={})=>[pa(Et,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"image-size-match-orientation"],$a=({srcProp:e="src",destProp:t="head"}={})=>[pa(((e,t)=>Lt(e)?l(e,t):void 0),(t=>[t[e],[0,131072],onprogress]),((e,o)=>e[t]=o)),"read-image-head"],ya=({srcProp:e="head",destProp:t="orientation"}={})=>[pa(i,(t=>[t[e],274]),((e,o=1)=>e[t]=o)),"read-exif-orientation-tag"],ba=({srcProp:e="head"}={})=>[pa(i,(t=>[t[e],274,1])),"clear-exif-orientation-tag"],xa=({srcImageSize:e="size",srcCanvasSize:t="imageData",srcImageState:o="imageState",destImageSize:i="size",destScalar:n="scalar"}={})=>[pa(((e,t,o)=>{const i=Math.min(t.width/e.width,t.height/e.height);if(1!==i){const{crop:e,annotation:t,decoration:n}=o,r=Y();e&&(o.crop=Ve(e,i,r));const a=Y();o.annotation=t.map((e=>yi(e,a,i))),o.decoration=n.map((e=>yi(e,a,i)))}return[i,ge(t)]}),(i=>[i[e],i[t],i[o]]),((e,[t,o])=>{e[n]=t,e[i]=o})),"calculate-canvas-scalar"],va=({srcProp:e="src",destProp:t="imageData",canvasMemoryLimit:o})=>[pa(I,(t=>[t[e],o]),((e,o)=>e[t]=o)),"blob-to-image-data"],wa=({srcImageData:e="imageData",srcOrientation:t="orientation"}={})=>[pa(x,(o=>[o[e],o[t]]),((e,t)=>e.imageData=t)),"image-data-match-orientation"],Sa=({srcImageData:e="imageData",srcImageState:t="imageState"}={})=>[pa(Oi,(o=>[o[e],{backgroundColor:o[t].backgroundColor}]),((e,t)=>e.imageData=t)),"image-data-fill"],ka=({srcImageData:e="imageData",srcImageState:t="imageState"}={})=>[pa(zt,(o=>[o[e],{crop:o[t].crop,rotation:o[t].rotation,flipX:o[t].flipX,flipY:o[t].flipY}]),((e,t)=>e.imageData=t)),"image-data-crop"],Ca=({resize:e={width:void 0,height:void 0,fit:void 0,upscale:void 0},srcProp:t="imageData",srcImageState:o="imageState",destImageScaledSize:i="imageScaledSize"})=>[pa(_t,(i=>{return[i[t],{width:Math.min(e.width||Number.MAX_SAFE_INTEGER,i[o].targetSize&&i[o].targetSize.width||Number.MAX_SAFE_INTEGER),height:Math.min(e.height||Number.MAX_SAFE_INTEGER,i[o].targetSize&&i[o].targetSize.height||Number.MAX_SAFE_INTEGER),fit:e.fit||"contain",upscale:(n=i[o],!!(n.targetSize&&n.targetSize.width||n.targetSize&&n.targetSize.height)||(e.upscale||!1))}];var n}),((e,t)=>{xe(e.imageData,t)||(e[i]=ge(t)),e.imageData=t})),"image-data-resize"],Ma=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData"}={})=>[pa(jt,(o=>{const{colorMatrix:i}=o[t],n=i&&Object.keys(i).map((e=>i[e])).filter(Boolean);return[o[e],{colorMatrix:n&&_i(n),convolutionMatrix:o[t].convolutionMatrix,gamma:o[t].gamma,noise:o[t].noise,vignette:o[t].vignette}]}),((e,t)=>e[o]=t)),"image-data-filter"],Ta=(e,{srcSize:t,srcImageState:o,destImageScaledSize:i})=>n=>{const r=e[t],{crop:a=Le(r),rotation:s=0,flipX:l,flipY:c}=e[o],d=dt(r,s),u=d.width,h=d.height,p=e[i],m=p?Math.min(p.width/a.width,p.height/a.height):1,g=.5*r.width-.5*u,f=.5*r.height-.5*h,$=we(r);n.scale(m,m),n.translate(-g,-f),n.translate(-a.x,-a.y),n.translate($.x,$.y),n.rotate(s),n.translate(-$.x,-$.y),n.scale(l?-1:1,c?-1:1),n.translate(l?-r.width:0,c?-r.height:0),n.rect(0,0,r.width,r.height),n.clip()},Ra=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destScalar:i="scalar"}={})=>[pa((async(e,t,o,i,n)=>{if(!t)return e;let r;try{const n={dataSizeScalar:Wi(e,i)};o&&o[3]>0&&(n.backgroundColor=[...o]),r=await t(e,n)}catch(e){}const a=g("canvas");a.width=e.width,a.height=e.height;const s=a.getContext("2d");s.putImageData(e,0,0);const l=new Path2D;i.forEach((e=>{const t=Oe(e.x,e.y,e.width,e.height);Ne(t,n);const o=Ge(Ie(t),e.rotation),i=new Path2D;o.forEach(((e,t)=>{if(0===t)return i.moveTo(e.x,e.y);i.lineTo(e.x,e.y)})),l.addPath(i)})),s.clip(l,"nonzero"),s.imageSmoothingEnabled=!1,s.drawImage(r,0,0,a.width,a.height),$(r);const c=s.getImageData(0,0,a.width,a.height);return $(a),c}),((o,{imageScrambler:n})=>[o[e],n,o[t].backgroundColor,o[t].redaction,o[i]]),((e,t)=>e[o]=t)),"image-data-annotate"],Pa=({srcImageData:e="imageData",srcSize:t="size",srcImageState:o="imageState",destImageData:i="imageData",destImageScaledSize:n="imageScaledSize"}={})=>[pa(Di,((i,{shapePreprocessor:r})=>[i[e],{shapes:i[o].annotation,context:i[t],transform:Ta(i,{srcSize:t,srcImageState:o,destImageScaledSize:n}),drawImage:ha,preprocessShape:e=>r(e,{isPreview:!1})}]),((e,t)=>e[i]=t)),"image-data-annotate"],Aa=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize"}={})=>[pa(Di,((o,{shapePreprocessor:n})=>[o[e],{shapes:o[t].decoration,context:o[t].crop,transform:e=>{const{crop:t}=o.imageState,n=o[i],r=n?Math.min(n.width/t.width,n.height/t.height):1;e.scale(r,r)},drawImage:ha,preprocessShape:e=>n(e,{isPreview:!1})}]),((e,t)=>e[o]=t)),"image-data-decorate"],Ia=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize"}={})=>[pa(Di,((o,{shapePreprocessor:n})=>{const r=o[t].frame;if(!r)return[o[e]];const a={...o[t].crop},s=gi(fi(r,a,n),a);a.x=Math.abs(s.left),a.y=Math.abs(s.top),a.width+=Math.abs(s.left)+Math.abs(s.right),a.height+=Math.abs(s.top)+Math.abs(s.bottom);const{crop:l}=o.imageState,c=o[i],d=c?Math.min(c.width/l.width,c.height/l.height):1;return Ne(a,d),a.x=Math.floor(a.x),a.y=Math.floor(a.y),a.width=Math.floor(a.width),a.height=Math.floor(a.height),[o[e],{shapes:[r],contextBounds:a,transform:e=>{e.translate(a.x,a.y)},drawImage:ha,preprocessShape:e=>n(e,{isPreview:!1})}]}),((e,t)=>e[o]=t)),"image-data-frame"],Ea=({mimeType:e,quality:t,srcImageData:o="imageData",srcFile:i="src",destBlob:n="blob"}={})=>[pa(L,(n=>[n[o],e||D(n[i].name)||n[i].type,t]),((e,t)=>e[n]=t)),"image-data-to-blob"],La=({srcImageData:e="imageData",srcOrientation:t="orientation",destCanvas:o="dest"}={})=>[pa(b,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"image-data-to-canvas"],Fa=async(e,t)=>{if(!Lt(e)||!t)return e;const i=new DataView(t),n=o(i);if(!n||!n.exif)return e;const{exif:r}=n;return((e,t,o=[0,e.size])=>t?new Blob([t,e.slice(...o)],{type:e.type}):e)(e,t.slice(0,r.offset+r.size+2),[20])},Ba=(e="blob",t="head",o="blob")=>[pa(Fa,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"blob-write-image-head"],za=({renameFile:e,srcBlob:t="blob",srcFile:o="src",destFile:i="dest",defaultFilename:n}={})=>[pa(O,(i=>[i[t],e?e(i[o]):i[o].name||`${n}.${F(i[t].type)}`]),((e,t)=>e[i]=t)),"blob-to-file"],Da=({url:e="./",dataset:t=(e=>[["dest",e.dest,e.dest.name],["imageState",e.imageState]]),destStore:o="store"})=>[pa((async(t,o)=>await((e,t,o)=>new Promise(((i,n)=>{const{token:r={},beforeSend:s=a,onprogress:l=a}=o;r.cancel=()=>c.abort();const c=new XMLHttpRequest;c.upload.onprogress=l,c.onload=()=>c.status>=200&&c.status<300?i(c):n(c),c.onerror=()=>n(c),c.ontimeout=()=>n(c),c.open("POST",encodeURI(e)),s(c),c.send(t.reduce(((e,t)=>(e.append(...t.map(Ft)),e)),new FormData))})))(e,t,{onprogress:o})),((e,o,i)=>[t(e),i]),((e,t)=>e[o]=t)),"store"],Oa=e=>[pa((t=>e&&e.length?(Object.keys(t).forEach((o=>{e.includes(o)||delete t[o]})),t):t)),"prop-filter"],_a=(e={})=>{const{orientImage:t=!0,outputProps:o=["src","dest","size"],preprocessImageFile:i}=e;return[ma(),i&&[pa(i,((e,t,o)=>[e.dest,t,o]),((e,t)=>e.dest=t)),"preprocess-image-file"],ga({srcProp:"dest"}),t&&$a({srcProp:"dest"}),t&&ya(),t&&fa(),Oa(o)].filter(Boolean)},Wa=(e={})=>{const{canvasMemoryLimit:t=ua(),orientImage:o=!0,copyImageHead:i=!0,mimeType:n,quality:r,renameFile:a,targetSize:s,store:l,format:c="file",outputProps:d=["src","dest","imageState","store"],preprocessImageSource:u,preprocessImageState:h,postprocessImageData:p,postprocessImageBlob:m}=e;return[u&&[pa(u,((e,t,o)=>[e.src,t,o]),((e,t)=>e.src=t)),"preprocess-image-source"],(o||i)&&$a(),o&&ya(),ga(),h&&[pa(h,((e,t,o)=>[e.imageState,t,o]),((e,t)=>e.imageState=t)),"preprocess-image-state"],va({canvasMemoryLimit:t}),o&&fa(),o&&wa(),xa(),Ra(),ka(),Ca({resize:s}),Ma(),Sa(),Pa(),Aa(),Ia(),p&&[pa(p,((e,t,o)=>[e.imageData,t,o]),((e,t)=>e.imageData=t)),"postprocess-image-data"],"file"===c?Ea({mimeType:n,quality:r}):"canvas"===c?La():[e=>(e.dest=e.imageData,e)],"file"===c&&o&&ba(),"file"===c&&i&&Ba(),m&&[pa(m,(({blob:e,imageData:t,src:o},i,n)=>[{blob:e,imageData:t,src:o},i,n]),((e,t)=>e.blob=t)),"postprocess-image-file"],"file"===c&&za({defaultFilename:"image",renameFile:a}),"file"===c?l&&(k(l)?Da({url:l}):qt(l)?[l,"store"]:Da(l)):qt(l)&&[l,"store"],Oa(d)].filter(Boolean)};var Va=(e,t)=>{const{imageData:o,amount:i=1}=e,n=Math.round(2*Math.max(1,i)),r=Math.round(.5*n),a=o.width,s=o.height,l=new Uint8ClampedArray(a*s*4),c=o.data;let d,u,h,p,m,g=0,f=0,$=0;const y=a*s*4-4;for(h=0;h<s;h++)for(d=crypto.getRandomValues(new Uint8ClampedArray(s)),u=0;u<a;u++)p=d[h]/255,f=0,$=0,p<.5&&(f=4*(-r+Math.round(Math.random()*n))),p>.5&&($=(-r+Math.round(Math.random()*n))*(4*a)),m=Math.min(Math.max(0,g+f+$),y),l[g]=c[m],l[g+1]=c[m+1],l[g+2]=c[m+2],l[g+3]=c[m+3],g+=4;t(null,{data:l,width:o.width,height:o.height})};const Na=[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625];var Ha=e=>{const t=Object.getOwnPropertyDescriptors(e.prototype);return Object.keys(t).filter((e=>!!t[e].get))};function Ua(e){return Math.sqrt(1- --e*e)}function ja(e){return"[object Date]"===Object.prototype.toString.call(e)}function Xa(e,t){if(e===t||e!=e)return()=>e;const o=typeof e;if(o!==typeof t||Array.isArray(e)!==Array.isArray(t))throw new Error("Cannot interpolate values of different type");if(Array.isArray(e)){const o=t.map(((t,o)=>Xa(e[o],t)));return e=>o.map((t=>t(e)))}if("object"===o){if(!e||!t)throw new Error("Object cannot be null");if(ja(e)&&ja(t)){e=e.getTime();const o=(t=t.getTime())-e;return t=>new Date(e+t*o)}const o=Object.keys(t),i={};return o.forEach((o=>{i[o]=Xa(e[o],t[o])})),e=>{const t={};return o.forEach((o=>{t[o]=i[o](e)})),t}}if("number"===o){const o=t-e;return t=>e+t*o}throw new Error(`Cannot interpolate ${o} values`)}function Ya(e,t={}){const o=Mr(e);let i,n=e;function r(r,a){if(null==e)return o.set(e=r),Promise.resolve();n=r;let s=i,l=!1,{delay:c=0,duration:d=400,easing:u=Ni,interpolate:h=Xa}=Hi(Hi({},t),a);if(0===d)return s&&(s.abort(),s=null),o.set(e=n),Promise.resolve();const p=sn()+c;let m;return i=un((t=>{if(t<p)return!0;l||(m=h(e,r),"function"==typeof d&&(d=d(e,r)),l=!0),s&&(s.abort(),s=null);const i=t-p;return i>d?(o.set(e=r),!1):(o.set(e=m(u(i/d))),!0)})),i.promise}return{set:r,update:(t,o)=>r(t(n,e),o),subscribe:o.subscribe}}function Ga(e,t,o,i){if("number"==typeof o){const n=i-o,r=(o-t)/(e.dt||1/60),a=(r+(e.opts.stiffness*n-e.opts.damping*r)*e.inv_mass)*e.dt;return Math.abs(a)<e.opts.precision&&Math.abs(n)<e.opts.precision?i:(e.settled=!1,o+a)}if(Kt(o))return o.map(((n,r)=>Ga(e,t[r],o[r],i[r])));if("object"==typeof o){const n={};for(const r in o)n[r]=Ga(e,t[r],o[r],i[r]);return n}throw new Error(`Cannot spring ${typeof o} values`)}function qa(e,t={}){const o=Mr(e),{stiffness:i=.15,damping:n=.8,precision:r=.01}=t;let a,s,l,c=e,d=e,u=1,h=0,p=!1;function m(t,i={}){d=t;const n=l={};if(null==e||i.hard||g.stiffness>=1&&g.damping>=1)return p=!0,a=null,c=t,o.set(e=d),Promise.resolve();if(i.soft){const e=!0===i.soft?.5:+i.soft;h=1/(60*e),u=0}if(!s){a=null,p=!1;const t={inv_mass:void 0,opts:g,settled:!0,dt:void 0};s=un((i=>{if(null===a&&(a=i),p)return p=!1,s=null,!1;u=Math.min(u+h,1),t.inv_mass=u,t.opts=g,t.settled=!0,t.dt=60*(i-a)/1e3;const n=Ga(t,c,e,d);return a=i,c=e,o.set(e=n),t.settled&&(s=null),!t.settled}))}return new Promise((e=>{s.promise.then((()=>{n===l&&e()}))}))}const g={set:m,update:(t,o)=>m(t(d,e),o),subscribe:o.subscribe,stiffness:i,damping:n,precision:r};return g}var Ka=Cr(!1,(e=>{const t=window.matchMedia("(prefers-reduced-motion:reduce)");e(t.matches),t.onchange=()=>e(t.matches)}));const Za=Ee(),Ja=(e,t,o,i,n)=>{e.rect||(e.rect=Ee());const r=e.rect;Xe(Za,t,o,i,n),Ue(r,Za)||(Ye(r,Za),e.dispatchEvent(new CustomEvent("measure",{detail:r})))},Qa=Math.round,es=e=>{const t=e.getBoundingClientRect();Ja(e,Qa(t.x),Qa(t.y),Qa(t.width),Qa(t.height))},ts=e=>Ja(e,e.offsetLeft,e.offsetTop,e.offsetWidth,e.offsetHeight),os=[];let is,ns=null;function rs(){os.length?(os.forEach((e=>e.measure(e))),ns=requestAnimationFrame(rs)):ns=null}var as=(e,t={})=>{const{observePosition:o=!1,observeViewRect:i=!1,once:n=!1,disabled:r=!1}=t;if(!r)return!("ResizeObserver"in window)||o||i?(e.measure=i?es:ts,os.push(e),ns||(ns=requestAnimationFrame(rs)),e.measure(e),{destroy(){const t=os.indexOf(e);os.splice(t,1)}}):(is||(is=new ResizeObserver((e=>{e.forEach((e=>ts(e.target)))}))),is.observe(e),ts(e),n&&is.unobserve(e),{destroy(){n||is.unobserve(e)}})},ss=e=>{let t=!1;const o={pointerdown:()=>{t=!1},keydown:()=>{t=!0},keyup:()=>{t=!1},focus:e=>{t&&(e.target.dataset.focusVisible="")},blur:e=>{delete e.target.dataset.focusVisible}};return Object.keys(o).forEach((t=>e.addEventListener(t,o[t],!0))),{destroy(){Object.keys(o).forEach((t=>e.removeEventListener(t,o[t],!0)))}}};const ls=async e=>new Promise((t=>{if("file"===e.kind)return t(e.getAsFile());e.getAsString(t)}));var cs=(e,t={})=>{const o=e=>{e.preventDefault()},i=async o=>{o.preventDefault(),o.stopPropagation();try{const i=await(e=>new Promise(((t,o)=>{const{items:i}=e.dataTransfer;if(!i)return t([]);Promise.all(Array.from(i).map(ls)).then((e=>{t(e.filter((e=>oo(e)&&xt(e)||/^http/.test(e))))})).catch(o)})))(o);e.dispatchEvent(new CustomEvent("dropfiles",{detail:{event:o,resources:i},...t}))}catch(e){}};return e.addEventListener("drop",i),e.addEventListener("dragover",o),{destroy(){e.removeEventListener("drop",i),e.removeEventListener("dragover",o)}}};let ds=null;var us=()=>{if(null===ds)if("WebGL2RenderingContext"in window){let e;try{e=g("canvas"),ds=!!e.getContext("webgl2")}catch(e){ds=!1}e&&$(e)}else ds=!1;return ds},hs=(e,t)=>us()?e.getContext("webgl2",t):e.getContext("webgl",t)||e.getContext("experimental-webgl",t);let ps=null;var ms=()=>{if(null===ps)if(u()){const e=g("canvas");ps=!hs(e,{failIfMajorPerformanceCaveat:!0}),$(e)}else ps=!1;return ps},gs=e=>0==(e&e-1),fs=(e,t={},o="",i="")=>Object.keys(t).filter((e=>!v(t[e]))).reduce(((e,n)=>e.replace(new RegExp(o+n+i),t[n])),e);const $s={head:"#version 300 es\n\nin vec4 aPosition;uniform mat4 uMatrix;",text:"\nin vec2 aTexCoord;out vec2 vTexCoord;",matrix:"\ngl_Position=uMatrix*vec4(aPosition.x,aPosition.y,0,1);"},ys={head:"#version 300 es\nprecision highp float;\n\nout vec4 fragColor;",mask:"\nuniform float uMaskFeather[8];uniform float uMaskBounds[4];uniform float uMaskOpacity;float mask(float x,float y,float bounds[4],float opacity){return 1.0-(1.0-(smoothstep(bounds[3],bounds[3]+1.0,x)*(1.0-smoothstep(bounds[1]-1.0,bounds[1],x))*(1.0-step(bounds[0],y))*step(bounds[2],y)))*(1.0-opacity);}",init:"\nfloat a=1.0;vec4 fillColor=uColor;vec4 textureColor=texture(uTexture,vTexCoord);textureColor*=(1.0-step(1.0,vTexCoord.y))*step(0.0,vTexCoord.y)*(1.0-step(1.0,vTexCoord.x))*step(0.0,vTexCoord.x);",colorize:"\nif(uTextureColor.a!=0.0&&textureColor.a>0.0){vec3 colorFlattened=textureColor.rgb/textureColor.a;if(colorFlattened.r>.999999&&colorFlattened.g==0.0&&colorFlattened.b>.999999){textureColor.rgb=uTextureColor.rgb*textureColor.a;}textureColor*=uTextureColor.a;}",maskapply:"\nfloat m=mask(gl_FragCoord.x,gl_FragCoord.y,uMaskBounds,uMaskOpacity);",maskfeatherapply:"\nfloat leftFeatherOpacity=step(uMaskFeather[1],gl_FragCoord.x)*uMaskFeather[0]+((1.0-uMaskFeather[0])*smoothstep(uMaskFeather[1],uMaskFeather[3],gl_FragCoord.x));float rightFeatherOpacity=(1.0-step(uMaskFeather[7],gl_FragCoord.x))*uMaskFeather[4]+((1.0-uMaskFeather[4])*smoothstep(uMaskFeather[7],uMaskFeather[5],gl_FragCoord.x));a*=leftFeatherOpacity*rightFeatherOpacity;",edgeaa:"\nvec2 scaledPoint=vec2(vRectCoord.x*uSize.x,vRectCoord.y*uSize.y);a*=smoothstep(0.0,1.0,uSize.x-scaledPoint.x);a*=smoothstep(0.0,1.0,uSize.y-scaledPoint.y);a*=smoothstep(0.0,1.0,scaledPoint.x);a*=smoothstep(0.0,1.0,scaledPoint.y);",cornerradius:"\nvec2 s=(uSize-2.0)*.5;vec2 r=(vRectCoord*uSize);vec2 p=r-(uSize*.5);float cornerRadius=uCornerRadius[0];bool left=r.x<s.x;bool top=r.y<s.x;if(!left&&top){cornerRadius=uCornerRadius[1];}if(!left&&!top){cornerRadius=uCornerRadius[3];}if(left&&!top){cornerRadius=uCornerRadius[2];}a*=1.0-clamp(length(max(abs(p)-(s-cornerRadius),0.0))-cornerRadius,0.0,1.0);",fragcolor:"\nif(m<=0.0)discard;fillColor.a*=a;fillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);textureColor*=uTextureOpacity;textureColor.a*=a;textureColor.rgb*=m*a;textureColor.rgb+=(1.0-m)*(uCanvasColor.rgb*textureColor.a);fragColor=textureColor+(fillColor*(1.0-textureColor.a));"},bs=(e,t,o)=>{const i=e.createShader(o),n=((e,t,o)=>(t=fs(t,o===e.VERTEX_SHADER?$s:ys,"##").trim(),us()?t:(t=(t=t.replace(/#version.+/gm,"").trim()).replace(/^\/\/\#/gm,"#"),o===e.VERTEX_SHADER&&(t=t.replace(/in /gm,"attribute ").replace(/out /g,"varying ")),o===e.FRAGMENT_SHADER&&(t=t.replace(/in /gm,"varying ").replace(/out.*?;/gm,"").replace(/texture\(/g,"texture2D(").replace(/fragColor/g,"gl_FragColor")),""+t)))(e,t,o);return e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)||console.error(e.getShaderInfoLog(i)),i},xs=(e,t,o,i,n)=>{const r=e.createProgram();e.attachShader(r,bs(e,t,e.VERTEX_SHADER)),e.attachShader(r,bs(e,o,e.FRAGMENT_SHADER)),e.linkProgram(r);const a={};return i.forEach((t=>{a[t]=e.getAttribLocation(r,t)})),n.forEach((t=>{a[t]=e.getUniformLocation(r,t)})),{program:r,locations:a}},vs=e=>!!us()||gs(e.width)&&gs(e.height),ws=(e,t,o,i)=>(e.bindTexture(e.TEXTURE_2D,t),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,o),((e,t,o)=>{e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,vs(t)?e.LINEAR_MIPMAP_LINEAR:e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o.filter),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),vs(t)&&e.generateMipmap(e.TEXTURE_2D)})(e,o,i),e.bindTexture(e.TEXTURE_2D,null),t),Ss=(e,t=1)=>e?[e[0],e[1],e[2],Xt(e[3])?t*e[3]:t]:[0,0,0,0],ks=()=>{const e=new Float32Array(16);return e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},Cs=(e,t,o,i,n,r,a)=>{const s=1/(t-o),l=1/(i-n),c=1/(r-a);e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+o)*s,e[13]=(n+i)*l,e[14]=(a+r)*c,e[15]=1},Ms=(e,t,o,i)=>{e[12]=e[0]*t+e[4]*o+e[8]*i+e[12],e[13]=e[1]*t+e[5]*o+e[9]*i+e[13],e[14]=e[2]*t+e[6]*o+e[10]*i+e[14],e[15]=e[3]*t+e[7]*o+e[11]*i+e[15]};var Ts=e=>e*Math.PI/180;const Rs=(e,t,o,i,n)=>{const r=ee(G(i.x-o.x,i.y-o.y)),a=ee(G(n.x-i.x,n.y-i.y)),s=ee(G(r.x+a.x,r.y+a.y)),l=G(-s.y,s.x),c=G(-r.y,r.x),d=Math.min(1/se(l,c),5);e[t]=i.x,e[t+1]=i.y,e[t+2]=l.x*d,e[t+3]=l.y*d,e[t+4]=-1,e[t+5]=i.x,e[t+6]=i.y,e[t+7]=l.x*d,e[t+8]=l.y*d,e[t+9]=1},Ps=e=>{const t=new Float32Array(8);return t[0]=e[3].x,t[1]=e[3].y,t[2]=e[0].x,t[3]=e[0].y,t[4]=e[2].x,t[5]=e[2].y,t[6]=e[1].x,t[7]=e[1].y,t},As=(e,t=0,o,i)=>{const n=et(e),r=e.x+.5*e.width,a=e.y+.5*e.height;return(o||i)&&ue(n,o,i,r,a),0!==t&&he(n,t,r,a),n},Is=(e,t,o,i,n)=>{const r=Math.min(20,Math.max(4,Math.round(i/2)));let a=0,s=0,l=0,c=0,d=0;for(;d<r;d++)a=d/r,s=n*N+a*N,l=i*Math.cos(s),c=i*Math.sin(s),e.push(G(t+l,o+c))};let Es=null;var Ls=()=>{if(null!==Es)return Es;const e=g("canvas"),t=hs(e);return Es=t?t.getParameter(t.MAX_TEXTURE_SIZE):void 0,$(e),Es};const Fs=new Float32Array([0,1,0,0,1,1,1,0]),Bs=[0,0,0,0,1,0,0,0,0],zs=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Ds=[0,0,0,0],Os=[0,0,0,0],_s=(e,t,o,i,n)=>{if(!o||!i)return Fs;const r=i.x/o.width,a=i.y/o.height;let s=e/o.width/n,l=t/o.height/n;s-=r,l-=a;return new Float32Array([-r,l,-r,-a,s,l,s,-a])};var Ws=e=>{const t={width:0,height:0},o={width:0,height:0},i=Ls()||1024;let n,r;const a=ks(),s=ks();let l,c,d,u,h,p,m,g,f,y=0,b=0,x=0;const v=new Map([]),w=Ts(30),S=Math.tan(w/2),k=hs(e,{antialias:!1,alpha:!1,premultipliedAlpha:!0});if(!k)return;k.getExtension("OES_standard_derivatives"),k.disable(k.DEPTH_TEST),k.enable(k.BLEND),k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);const C=k.createTexture();k.bindTexture(k.TEXTURE_2D,C),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,1,1,0,k.RGBA,k.UNSIGNED_BYTE,new Uint8Array(Ds)),v.set(0,C);const M=k.createTexture();v.set(2,M);const T=k.createFramebuffer(),R=k.createTexture();v.set(1,R);const P=k.createFramebuffer();k.colorMask(!0,!0,!0,!0),k.clearColor(0,0,0,0),k.clear(k.COLOR_BUFFER_BIT);const A=xs(k,"\n##head\n##text\nvoid main(){vTexCoord=aTexCoord;gl_Position=uMatrix*aPosition;}","\n##head\nin vec2 vTexCoord;uniform sampler2D uTexture;uniform sampler2D uTextureMarkup;uniform sampler2D uTextureBlend;uniform vec2 uTextureSize;uniform float uOpacity;uniform vec4 uFillColor;uniform vec4 uOverlayColor;uniform mat4 uColorMatrix;uniform vec4 uColorOffset;uniform float uClarityKernel[9];uniform float uClarityKernelWeight;uniform float uColorGamma;uniform float uColorVignette;uniform float uMaskClip;uniform float uMaskOpacity;uniform float uMaskBounds[4];uniform float uMaskCornerRadius[4];uniform float uMaskFeather[8];vec4 applyGamma(vec4 c,float g){c.r=pow(c.r,g);c.g=pow(c.g,g);c.b=pow(c.b,g);return c;}vec4 applyColorMatrix(vec4 c,mat4 m,vec4 o){vec4 cM=(c*m)+o;cM*=cM.a;return cM;}vec4 applyConvolutionMatrix(vec4 c,float k0,float k1,float k2,float k3,float k4,float k5,float k6,float k7,float k8,float w){vec2 pixel=vec2(1)/uTextureSize;vec4 colorSum=texture(uTexture,vTexCoord-pixel)*k0+texture(uTexture,vTexCoord+pixel*vec2(0.0,-1.0))*k1+texture(uTexture,vTexCoord+pixel*vec2(1.0,-1.0))*k2+texture(uTexture,vTexCoord+pixel*vec2(-1.0,0.0))*k3+texture(uTexture,vTexCoord)*k4+texture(uTexture,vTexCoord+pixel*vec2(1.0,0.0))*k5+texture(uTexture,vTexCoord+pixel*vec2(-1.0,1.0))*k6+texture(uTexture,vTexCoord+pixel*vec2(0.0,1.0))*k7+texture(uTexture,vTexCoord+pixel)*k8;vec4 color=vec4((colorSum/w).rgb,c.a);color.rgb=clamp(color.rgb,0.0,1.0);return color;}vec4 applyVignette(vec4 c,vec2 pos,vec2 center,float v){float d=distance(pos,center)/length(center);float f=1.0-(d*abs(v));if(v>0.0){c.rgb*=f;}else if(v<0.0){c.rgb+=(1.0-f)*(1.0-c.rgb);}return c;}vec4 blendPremultipliedAlpha(vec4 back,vec4 front){return front+(back*(1.0-front.a));}void main(){float x=gl_FragCoord.x;float y=gl_FragCoord.y;float a=1.0;float maskTop=uMaskBounds[0];float maskRight=uMaskBounds[1];float maskBottom=uMaskBounds[2];float maskLeft=uMaskBounds[3];float leftFeatherOpacity=step(uMaskFeather[1],x)*uMaskFeather[0]+((1.0-uMaskFeather[0])*smoothstep(uMaskFeather[1],uMaskFeather[3],x));float rightFeatherOpacity=(1.0-step(uMaskFeather[7],x))*uMaskFeather[4]+((1.0-uMaskFeather[4])*smoothstep(uMaskFeather[7],uMaskFeather[5],x));a*=leftFeatherOpacity*rightFeatherOpacity;float overlayColorAlpha=(smoothstep(maskLeft,maskLeft+1.0,x)*(1.0-smoothstep(maskRight-1.0,maskRight,x))*(1.0-step(maskTop,y))*step(maskBottom,y));if(uOverlayColor.a==0.0){a*=overlayColorAlpha;}vec2 offset=vec2(maskLeft,maskBottom);vec2 size=vec2(maskRight-maskLeft,maskTop-maskBottom)*.5;vec2 center=offset.xy+size.xy;int pixelX=int(step(center.x,x));int pixelY=int(step(y,center.y));float cornerRadius=0.0;if(pixelX==0&&pixelY==0)cornerRadius=uMaskCornerRadius[0];if(pixelX==1&&pixelY==0)cornerRadius=uMaskCornerRadius[1];if(pixelX==0&&pixelY==1)cornerRadius=uMaskCornerRadius[2];if(pixelX==1&&pixelY==1)cornerRadius=uMaskCornerRadius[3];float cornerOffset=sign(cornerRadius)*length(max(abs(gl_FragCoord.xy-size-offset)-size+cornerRadius,0.0))-cornerRadius;float cornerOpacity=1.0-smoothstep(0.0,1.0,cornerOffset);a*=cornerOpacity;vec2 scaledPoint=vec2(vTexCoord.x*uTextureSize.x,vTexCoord.y*uTextureSize.y);a*=smoothstep(0.0,1.0,uTextureSize.x-scaledPoint.x);a*=smoothstep(0.0,1.0,uTextureSize.y-scaledPoint.y);a*=smoothstep(0.0,1.0,scaledPoint.x);a*=smoothstep(0.0,1.0,scaledPoint.y);vec4 color=texture(uTexture,vTexCoord);color=blendPremultipliedAlpha(color,texture(uTextureBlend,vTexCoord));if(uClarityKernelWeight!=-1.0){color=applyConvolutionMatrix(color,uClarityKernel[0],uClarityKernel[1],uClarityKernel[2],uClarityKernel[3],uClarityKernel[4],uClarityKernel[5],uClarityKernel[6],uClarityKernel[7],uClarityKernel[8],uClarityKernelWeight);}color=applyGamma(color,uColorGamma);color=applyColorMatrix(color,uColorMatrix,uColorOffset);color=blendPremultipliedAlpha(uFillColor,color);color*=a;if(uColorVignette!=0.0){vec2 pos=gl_FragCoord.xy-offset;color=applyVignette(color,pos,center-offset,uColorVignette);}color=blendPremultipliedAlpha(color,texture(uTextureMarkup,vTexCoord));vec4 overlayColor=uOverlayColor*(1.0-overlayColorAlpha);overlayColor.rgb*=overlayColor.a;color=blendPremultipliedAlpha(color,overlayColor);if(uOverlayColor.a>0.0&&color.a<1.0&&uFillColor.a>0.0){color=blendPremultipliedAlpha(uFillColor,overlayColor);}color*=uOpacity;fragColor=color;}",["aPosition","aTexCoord"],["uMatrix","uTexture","uTextureBlend","uTextureMarkup","uTextureSize","uColorGamma","uColorVignette","uColorOffset","uColorMatrix","uClarityKernel","uClarityKernelWeight","uOpacity","uMaskOpacity","uMaskBounds","uMaskCornerRadius","uMaskFeather","uFillColor","uOverlayColor"]),I=k.createBuffer(),E=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,E),k.bufferData(k.ARRAY_BUFFER,Fs,k.STATIC_DRAW);const L=xs(k,"#version 300 es\n\nin vec4 aPosition;in vec2 aNormal;in float aMiter;out vec2 vNormal;out float vMiter;out float vWidth;uniform float uWidth;uniform mat4 uMatrix;void main(){vMiter=aMiter;vNormal=aNormal;vWidth=(uWidth*.5)+1.0;gl_Position=uMatrix*vec4(aPosition.x+(aNormal.x*vWidth*aMiter),aPosition.y+(aNormal.y*vWidth*aMiter),0,1);}","\n##head\n##mask\nin vec2 vNormal;in float vMiter;in float vWidth;uniform float uWidth;uniform vec4 uColor;uniform vec4 uCanvasColor;void main(){vec4 fillColor=uColor;float m=mask(gl_FragCoord.x,gl_FragCoord.y,uMaskBounds,uMaskOpacity);if(m<=0.0)discard;fillColor.a*=clamp(smoothstep(vWidth-.5,vWidth-1.0,abs(vMiter)*vWidth),0.0,1.0);fillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);fragColor=fillColor;}",["aPosition","aNormal","aMiter"],["uColor","uCanvasColor","uMatrix","uWidth","uMaskBounds","uMaskOpacity"]),F=k.createBuffer(),B=(e,t,o,i=!1)=>{const{program:n,locations:r}=L;k.useProgram(n),k.enableVertexAttribArray(r.aPosition),k.enableVertexAttribArray(r.aNormal),k.enableVertexAttribArray(r.aMiter);const a=((e,t)=>{let o,i,n,r=0;const a=e.length,s=new Float32Array(10*(t?a+1:a)),l=e[0],c=e[a-1];for(r=0;r<a;r++)o=e[r-1],i=e[r],n=e[r+1],o||(o=t?c:G(i.x+(i.x-n.x),i.y+(i.y-n.y))),n||(n=t?l:G(i.x+(i.x-o.x),i.y+(i.y-o.y))),Rs(s,10*r,o,i,n);return t&&Rs(s,10*a,c,l,e[1]),s})(e,i),s=5*Float32Array.BYTES_PER_ELEMENT,c=2*Float32Array.BYTES_PER_ELEMENT,d=4*Float32Array.BYTES_PER_ELEMENT;k.uniform1f(r.uWidth,t),k.uniform4fv(r.uColor,o),k.uniformMatrix4fv(r.uMatrix,!1,l),k.uniform4f(r.uCanvasColor,y,b,x,1),k.uniform1fv(r.uMaskBounds,m),k.uniform1f(r.uMaskOpacity,p),k.bindBuffer(k.ARRAY_BUFFER,F),k.bufferData(k.ARRAY_BUFFER,a,k.STATIC_DRAW),k.vertexAttribPointer(r.aPosition,2,k.FLOAT,!1,s,0),k.vertexAttribPointer(r.aNormal,2,k.FLOAT,!1,s,c),k.vertexAttribPointer(r.aMiter,1,k.FLOAT,!1,s,d),k.drawArrays(k.TRIANGLE_STRIP,0,a.length/5),k.disableVertexAttribArray(r.aPosition),k.disableVertexAttribArray(r.aNormal),k.disableVertexAttribArray(r.aMiter)},z=xs(k,"\n##head\nvoid main(){\n##matrix\n}","\n##head\n##mask\nuniform vec4 uColor;uniform vec4 uCanvasColor;void main(){vec4 fillColor=uColor;\n##maskapply\nfillColor.rgb*=fillColor.a;fillColor.rgb*=m;fillColor.rgb+=(1.0-m)*(uCanvasColor.rgb*fillColor.a);fragColor=fillColor;}",["aPosition"],["uColor","uCanvasColor","uMatrix","uMaskBounds","uMaskOpacity"]),D=k.createBuffer(),O=xs(k,"\n##head\n##text\nin vec2 aRectCoord;out vec2 vRectCoord;void main(){vTexCoord=aTexCoord;vRectCoord=aRectCoord;\n##matrix\n}","\n##head\n##mask\nin vec2 vTexCoord;in vec2 vRectCoord;uniform sampler2D uTexture;uniform vec4 uTextureColor;uniform float uTextureOpacity;uniform vec4 uColor;uniform float uCornerRadius[4];uniform vec2 uSize;uniform vec2 uPosition;uniform vec4 uCanvasColor;uniform int uInverted;void main(){\n##init\n##colorize\n##edgeaa\n##cornerradius\n##maskfeatherapply\nif(uInverted==1)a=1.0-a;\n##maskapply\n##fragcolor\n}",["aPosition","aTexCoord","aRectCoord"],["uTexture","uColor","uMatrix","uCanvasColor","uTextureColor","uTextureOpacity","uPosition","uSize","uMaskBounds","uMaskOpacity","uMaskFeather","uCornerRadius","uInverted"]),W=k.createBuffer(),V=k.createBuffer(),N=k.createBuffer(),H=xs(k,"\n##head\n##text\nout vec2 vTexCoordDouble;void main(){vTexCoordDouble=vec2(aTexCoord.x*2.0-1.0,aTexCoord.y*2.0-1.0);vTexCoord=aTexCoord;\n##matrix\n}","\n##head\n##mask\nin vec2 vTexCoord;in vec2 vTexCoordDouble;uniform sampler2D uTexture;uniform float uTextureOpacity;uniform vec2 uRadius;uniform vec4 uColor;uniform int uInverted;uniform vec4 uCanvasColor;void main(){\n##init\nfloat ar=uRadius.x/uRadius.y;vec2 rAA=vec2(uRadius.x-1.0,uRadius.y-(1.0/ar));vec2 scaledPointSq=vec2((vTexCoordDouble.x*uRadius.x)*(vTexCoordDouble.x*uRadius.x),(vTexCoordDouble.y*uRadius.y)*(vTexCoordDouble.y*uRadius.y));float p=(scaledPointSq.x/(uRadius.x*uRadius.x))+(scaledPointSq.y/(uRadius.y*uRadius.y));float pAA=(scaledPointSq.x/(rAA.x*rAA.x))+(scaledPointSq.y/(rAA.y*rAA.y));a=smoothstep(1.0,p/pAA,p);if(uInverted==1)a=1.0-a;\n##maskapply\n##fragcolor\n}",["aPosition","aTexCoord"],["uTexture","uTextureOpacity","uColor","uCanvasColor","uMatrix","uRadius","uInverted","uMaskBounds","uMaskOpacity"]),U=k.createBuffer(),j=k.createBuffer(),X=new Map,Y={2:{width:0,height:0},1:{width:0,height:0}},q=(e,o,n)=>{const a=Math.min(i/n.width,i/n.height,1),c=Math.floor(a*n.width),d=Math.floor(a*n.height);xe(n,Y[e])?k.bindFramebuffer(k.FRAMEBUFFER,o):(k.bindTexture(k.TEXTURE_2D,v.get(e)),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,c,d,0,k.RGBA,k.UNSIGNED_BYTE,null),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.LINEAR),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.bindFramebuffer(k.FRAMEBUFFER,o),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,v.get(e),0),Y[e]=n);const u=n.width*r,h=n.height*r;var p,m;Cs(s,0,u,h,0,-1,1),Ms(s,0,h,0),m=1,(p=s)[0]=p[0]*m,p[1]=p[1]*m,p[2]=p[2]*m,p[3]=p[3]*m,((e,t)=>{e[4]=e[4]*t,e[5]=e[5]*t,e[6]=e[6]*t,e[7]=e[7]*t})(s,-1),l=s,k.viewport(0,0,c,d),k.colorMask(!0,!0,!0,!0),k.clearColor(0,0,0,0),k.clear(k.COLOR_BUFFER_BIT),f=[1,0,1,0,1,Math.max(t.width,n.width),1,Math.max(t.width,n.width)]};return{drawPath:(e,t,o,i,n)=>{e.length<2||B(e.map((e=>({x:e.x*r,y:e.y*r}))),t*r,Ss(o,n),i)},drawTriangle:(e,t=0,o=!1,i=!1,n,a)=>{if(!n)return;const s=e.map((e=>({x:e.x*r,y:e.y*r}))),c=nt(s);(o||i)&&ue(s,o,i,c.x,c.y),he(s,t,c.x,c.y);((e,t)=>{const{program:o,locations:i}=z;k.useProgram(o),k.enableVertexAttribArray(i.aPosition),k.uniform4fv(i.uColor,t),k.uniformMatrix4fv(i.uMatrix,!1,l),k.uniform1fv(i.uMaskBounds,m),k.uniform1f(i.uMaskOpacity,p),k.uniform4f(i.uCanvasColor,y,b,x,1),k.bindBuffer(k.ARRAY_BUFFER,D),k.bufferData(k.ARRAY_BUFFER,e,k.STATIC_DRAW),k.vertexAttribPointer(i.aPosition,2,k.FLOAT,!1,0,0),k.drawArrays(k.TRIANGLE_STRIP,0,e.length/2),k.disableVertexAttribArray(i.aPosition)})((e=>{const t=new Float32Array(6);return t[0]=e[0].x,t[1]=e[0].y,t[2]=e[1].x,t[3]=e[1].y,t[4]=e[2].x,t[5]=e[2].y,t})(s),Ss(n,a))},drawRect:(e,t=0,o=!1,i=!1,n,a,s,c,d,u,h,g,$,v,w,S)=>{const M=Ne(Ie(e),r),T=n.map((t=>((e,t)=>Math.floor(jr(e,0,Math.min(.5*(t.width-1),.5*(t.height-1)))))(t||0,e))).map((e=>e*r));if(a||s){const e=Ie(M);e.x-=.5,e.y-=.5,e.width+=1,e.height+=1;const n=As(e,t,o,i),h=Ps(n);let g;w&&(g=Ss(w),0===g[3]&&(g[3]=.001)),((e,t,o,i,n,a=C,s=1,c=Ds,d=Fs,u=f,h)=>{const{program:g,locations:$}=O;k.useProgram(g),k.enableVertexAttribArray($.aPosition),k.enableVertexAttribArray($.aTexCoord),k.enableVertexAttribArray($.aRectCoord),k.uniform4fv($.uColor,n),k.uniform2fv($.uSize,[t,o]),k.uniform2fv($.uPosition,[e[2],e[3]]),k.uniform1i($.uInverted,h?1:0),k.uniform1fv($.uCornerRadius,i),k.uniform4f($.uCanvasColor,y,b,x,1),k.uniform1fv($.uMaskFeather,u.map(((e,t)=>t%2==0?e:e*r))),k.uniform1fv($.uMaskBounds,m),k.uniform1f($.uMaskOpacity,p),k.uniformMatrix4fv($.uMatrix,!1,l),k.uniform1i($.uTexture,4),k.uniform4fv($.uTextureColor,c),k.uniform1f($.uTextureOpacity,s),k.activeTexture(k.TEXTURE0+4),k.bindTexture(k.TEXTURE_2D,a),k.bindBuffer(k.ARRAY_BUFFER,V),k.bufferData(k.ARRAY_BUFFER,d,k.STATIC_DRAW),k.vertexAttribPointer($.aTexCoord,2,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,N),k.bufferData(k.ARRAY_BUFFER,Fs,k.STATIC_DRAW),k.vertexAttribPointer($.aRectCoord,2,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,W),k.bufferData(k.ARRAY_BUFFER,e,k.STATIC_DRAW),k.vertexAttribPointer($.aPosition,2,k.FLOAT,!1,0,0),k.drawArrays(k.TRIANGLE_STRIP,0,e.length/2),k.disableVertexAttribArray($.aPosition),k.disableVertexAttribArray($.aTexCoord),k.disableVertexAttribArray($.aRectCoord)})(h,e.width,e.height,T,Ss(a,$),s,$,g,u?new Float32Array(u):_s(e.width,e.height,c,d,r),v,S)}h&&(h=Math.min(h,M.width,M.height),B(((e,t,o,i,n,r,a,s)=>{const l=[];if(r.every((e=>0===e)))l.push(G(e,t),G(e+o,t),G(e+o,t+i),G(e,t+i));else{const[n,a,s,c]=r,d=e,u=e+o,h=t,p=t+i;l.push(G(d+n,h)),Is(l,u-a,h+a,a,-1),l.push(G(u,h+a)),Is(l,u-c,p-c,c,0),l.push(G(u-c,p)),Is(l,d+s,p-s,s,1),l.push(G(d,p-s)),Is(l,d+n,h+n,n,2)}return(a||s)&&ue(l,a,s,e+.5*o,t+.5*i),n&&he(l,n,e+.5*o,t+.5*i),l})(M.x,M.y,M.width,M.height,t,T,o,i),h*r,Ss(g,$),!0))},drawEllipse:(e,t,o,i,n,a,s,c,d,u,h,g,f,$,v)=>{const w=Ne(Oe(e.x-t,e.y-o,2*t,2*o),r);if(s||c){const e=Ie(w);e.x-=.5,e.y-=.5,e.width+=1,e.height+=1;const t=As(e,i,n,a);((e,t,o,i,n=C,r=Fs,a=1,s=!1)=>{const{program:c,locations:d}=H;k.useProgram(c),k.enableVertexAttribArray(d.aPosition),k.enableVertexAttribArray(d.aTexCoord),k.uniformMatrix4fv(d.uMatrix,!1,l),k.uniform2fv(d.uRadius,[.5*t,.5*o]),k.uniform1i(d.uInverted,s?1:0),k.uniform4fv(d.uColor,i),k.uniform4f(d.uCanvasColor,y,b,x,1),k.uniform1fv(d.uMaskBounds,m),k.uniform1f(d.uMaskOpacity,p),k.uniform1i(d.uTexture,4),k.uniform1f(d.uTextureOpacity,a),k.activeTexture(k.TEXTURE0+4),k.bindTexture(k.TEXTURE_2D,n),k.bindBuffer(k.ARRAY_BUFFER,j),k.bufferData(k.ARRAY_BUFFER,r,k.STATIC_DRAW),k.vertexAttribPointer(d.aTexCoord,2,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,U),k.bufferData(k.ARRAY_BUFFER,e,k.STATIC_DRAW),k.vertexAttribPointer(d.aPosition,2,k.FLOAT,!1,0,0),k.drawArrays(k.TRIANGLE_STRIP,0,e.length/2),k.disableVertexAttribArray(d.aPosition),k.disableVertexAttribArray(d.aTexCoord)})(Ps(t),e.width,e.height,Ss(s,$),c,h?new Float32Array(h):_s(e.width,e.height,d,u,r),$,v)}g&&B(((e,t,o,i,n,r,a)=>{const s=.5*Math.abs(o),l=.5*Math.abs(i),c=Math.abs(o)+Math.abs(i),d=Math.max(20,Math.round(c/6));return ct(G(e+s,t+l),s,l,n,r,a,d)})(w.x,w.y,w.width,w.height,i,n,a),g*r,Ss(f,$),!0)},drawImage:(e,o,i,a,s,l,c,d,u,h,f=zs,$=1,y,b=1,x=0,C=g,M=Os,T=Ds,R=Ds,P=!1,L=!1)=>{const F=o.width*r,B=o.height*r,z=-.5*F,D=.5*B,O=.5*F,_=-.5*B,W=new Float32Array([z,_,0,z,D,0,O,_,0,O,D,0]);k.bindBuffer(k.ARRAY_BUFFER,I),k.bufferData(k.ARRAY_BUFFER,W,k.STATIC_DRAW);const V=o.height/2/S*(t.height/o.height)*-1;s*=r,l*=r,i*=r,a*=r;const{program:N,locations:H}=A,U=ks();var j,X;((e,t,o,i,n)=>{const r=1/Math.tan(t/2),a=1/(i-n);e[0]=r/o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(n+i)*a,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*n*i*a,e[15]=0})(U,w,n,1,2*-V),Ms(U,s,-l,V),Ms(U,i,-a,0),((e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[0],r=e[1],a=e[2],s=e[3],l=e[4],c=e[5],d=e[6],u=e[7];e[0]=n*i+l*o,e[1]=r*i+c*o,e[2]=a*i+d*o,e[3]=s*i+u*o,e[4]=l*i-n*o,e[5]=c*i-r*o,e[6]=d*i-a*o,e[7]=u*i-s*o})(U,-u),X=h,(j=U)[0]=j[0]*X,j[1]=j[1]*X,j[2]=j[2]*X,j[3]=j[3]*X,j[4]=j[4]*X,j[5]=j[5]*X,j[6]=j[6]*X,j[7]=j[7]*X,j[8]=j[8]*X,j[9]=j[9]*X,j[10]=j[10]*X,j[11]=j[11]*X,Ms(U,-i,a,0),((e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[0],r=e[1],a=e[2],s=e[3],l=e[8],c=e[9],d=e[10],u=e[11];e[0]=n*i-l*o,e[1]=r*i-c*o,e[2]=a*i-d*o,e[3]=s*i-u*o,e[8]=n*o+l*i,e[9]=r*o+c*i,e[10]=a*o+d*i,e[11]=s*o+u*i})(U,d),((e,t)=>{const o=Math.sin(t),i=Math.cos(t),n=e[4],r=e[5],a=e[6],s=e[7],l=e[8],c=e[9],d=e[10],u=e[11];e[4]=n*i+l*o,e[5]=r*i+c*o,e[6]=a*i+d*o,e[7]=s*i+u*o,e[8]=l*i-n*o,e[9]=c*i-r*o,e[10]=d*i-a*o,e[11]=u*i-s*o})(U,c),k.useProgram(N),k.enableVertexAttribArray(H.aPosition),k.enableVertexAttribArray(H.aTexCoord),k.uniform1i(H.uTexture,3),k.uniform2f(H.uTextureSize,o.width,o.height),k.activeTexture(k.TEXTURE0+3),k.bindTexture(k.TEXTURE_2D,e);const Y=L?1:0,G=v.get(Y);k.uniform1i(H.uTextureBlend,Y),k.activeTexture(k.TEXTURE0+Y),k.bindTexture(k.TEXTURE_2D,G);const q=P?2:0,K=v.get(q);let Z;k.uniform1i(H.uTextureMarkup,q),k.activeTexture(k.TEXTURE0+q),k.bindTexture(k.TEXTURE_2D,K),k.bindBuffer(k.ARRAY_BUFFER,I),k.vertexAttribPointer(H.aPosition,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,E),k.vertexAttribPointer(H.aTexCoord,2,k.FLOAT,!1,0,0),k.uniformMatrix4fv(H.uMatrix,!1,U),k.uniform4fv(H.uOverlayColor,R),k.uniform4fv(H.uFillColor,T),!y||qr(y,Bs)?(y=Bs,Z=-1):(Z=y.reduce(((e,t)=>e+t),0),Z=Z<=0?1:Z),k.uniform1fv(H.uClarityKernel,y),k.uniform1f(H.uClarityKernelWeight,Z),k.uniform1f(H.uColorGamma,1/b),k.uniform1f(H.uColorVignette,x),k.uniform4f(H.uColorOffset,f[4],f[9],f[14],f[19]),k.uniformMatrix4fv(H.uColorMatrix,!1,[f[0],f[1],f[2],f[3],f[5],f[6],f[7],f[8],f[10],f[11],f[12],f[13],f[15],f[16],f[17],f[18]]),k.uniform1f(H.uOpacity,$),k.uniform1f(H.uMaskOpacity,p),k.uniform1fv(H.uMaskBounds,m),k.uniform1fv(H.uMaskCornerRadius,M.map((e=>e*r))),k.uniform1fv(H.uMaskFeather,C.map(((e,t)=>t%2==0?e:e*r))),k.drawArrays(k.TRIANGLE_STRIP,0,4),k.disableVertexAttribArray(H.aPosition),k.disableVertexAttribArray(H.aTexCoord)},textureFilterNearest:k.NEAREST,textureFilterLinear:k.LINEAR,textureCreate:()=>k.createTexture(),textureUpdate:(e,t,o)=>(X.set(e,t),ws(k,e,t,o)),textureSize:e=>ge(X.get(e)),textureDelete:e=>{const t=X.get(e);t instanceof HTMLCanvasElement&&!t.dataset.retain&&$(t),X.delete(e),k.deleteTexture(e)},setCanvasColor(e){y=e[0],b=e[1],x=e[2]},drawToCanvas(){k.bindFramebuffer(k.FRAMEBUFFER,null),l=a,k.viewport(0,0,k.drawingBufferWidth,k.drawingBufferHeight),k.colorMask(!0,!0,!0,!1),k.clearColor(y,b,x,1),k.clear(k.COLOR_BUFFER_BIT),f=[1,0,1,0,1,t.width,1,t.width]},drawToImageBlendBuffer(e){q(1,P,e)},drawToImageOverlayBuffer(e){q(2,T,e)},enableMask(e,o){const i=e.x*r,n=e.y*r,a=e.width*r,s=e.height*r;h=i,d=h+a,c=t.height-n,u=t.height-(n+s),p=1-o,m=[c,d,u,h]},disableMask(){h=0,d=t.width,c=t.height,u=0,p=1,m=[c,d,u,h]},resize:(i,s,l)=>{r=l,o.width=i,o.height=s,t.width=i*r,t.height=s*r,n=_(t.width,t.height),e.width=t.width,e.height=t.height,Cs(a,0,t.width,t.height,0,-1,1),g=[1,0,1,0,1,o.width,1,o.width]},release(){e.width=1,e.height=1}}};function Vs(e){let t,o,i,n;return{c(){t=gn("div"),o=gn("canvas"),Sn(t,"class","PinturaCanvas")},m(r,a){pn(r,t,a),hn(t,o),e[24](o),i||(n=[xn(o,"measure",e[25]),rn(as.call(null,o))],i=!0)},p:Vi,i:Vi,o:Vi,d(o){o&&mn(t),e[24](null),i=!1,Xi(n)}}}function Ns(e,t,o){let i,n,r,s,l,c,d;const u=(e,t)=>{const[o,i,n]=e,[r,a,s,l]=t;return[r*l+o*(1-l),a*l+i*(1-l),s*l+n*(1-l),1]},h=_n();let p,{animate:m}=t,{maskRect:g}=t,{maskOpacity:f=1}=t,{maskFrameOpacity:b=.95}=t,{pixelRatio:x=1}=t,{backgroundColor:v}=t,{willRender:w=W}=t,{loadImageData:S=W}=t,{images:C=[]}=t,{interfaceImages:M=[]}=t,T=null,R=null,P=null;const A=(e,t)=>e.set(t,{hard:!m}),I={precision:1e-4*.01},E=Ya(void 0,{duration:250});Zi(e,E,(e=>o(20,r=e)));const L=qa(1,I);Zi(e,L,(e=>o(21,s=e)));const F=qa(1,I);Zi(e,F,(e=>o(30,d=e)));const B=Mr();Zi(e,B,(e=>o(28,l=e)));const z=Mr();Zi(e,z,(e=>o(29,c=e)));const D=so(),O=new Map([]),V=(e,t)=>{if(!O.has(e)){O.set(e,e);const o="pixelated"===t?T.textureFilterNearest:T.textureFilterLinear;if(!k(e)&&("close"in e||y(e)||bi(e))){const t=T.textureCreate();T.textureUpdate(t,e,{filter:o}),O.set(e,t)}else S(e).then((t=>{const i=T.textureCreate();T.textureUpdate(i,t,{filter:o}),O.set(e,i),requestAnimationFrame(n)})).catch((e=>{console.error(e)}))}return O.get(e)},N=e=>{let{text:t,textAlign:o,fontFamily:i,fontSize:n,fontWeight:r,fontVariant:a,fontStyle:s,lineHeight:l,width:c}=e;lo(D,{fontSize:n,fontFamily:i,fontWeight:r,fontVariant:a,fontStyle:s,textAlign:o});const d=c?mo(D,t,c):t,u=(({text:e,textAlign:t,fontSize:o,fontFamily:i,lineHeight:n,fontWeight:r,fontStyle:a,fontVariant:s})=>`${[e,t,o,r,a,s,i].join("_")}_${qt(n)?n(o):n}`)({...e,text:d});if(!O.has(u)){const e=so();lo(e,{fontSize:n,fontFamily:i,fontWeight:r,fontVariant:a,fontStyle:s,textAlign:o}),((e,t,o)=>{const{width:i,height:n}=uo(e,t,co(o.fontSize,o.lineHeight));e.canvas.width=Math.ceil(i),e.canvas.height=Math.ceil(n)})(e,d,{fontSize:n,fontFamily:i,fontWeight:r,fontVariant:a,fontStyle:s,textAlign:o,lineHeight:l});const t=e.canvas.width;e.canvas.width+=ro,lo(e,{fontSize:n,fontFamily:i,fontWeight:r,fontVariant:a,fontStyle:s,textAlign:o,color:[1,0,1]}),go(e,d,{fontSize:n,textAlign:o,lineHeight:l,lineWidth:t}),O.set(u,T.textureUpdate(T.textureCreate(),e.canvas,{filter:T.textureFilterLinear}))}return O.get(u)},H=({data:e,size:t,origin:o,translation:i,rotation:n,scale:a,colorMatrix:s,opacity:l,convolutionMatrix:c,gamma:d,vignette:h,maskFeather:p,maskCornerRadius:m,backgroundColor:g,overlayColor:f,enableShapes:$,enableBlend:y})=>{g&&g[3]<1&&g[3]>0&&(g=u(r,g));const b=V(e);return T.drawImage(b,t,o.x,o.y,i.x,i.y,n.x,n.y,n.z,a,s,jr(l,0,1),c,d,h,p,m,g,f,$,y),b},U=([e,t,o,i])=>[i.x,i.y,e.x,e.y,o.x,o.y,t.x,t.y],j=(e=[])=>e.map((e=>{let t=!e._isLoading&&(e=>{let t;if(e.backgroundImage)t=V(e.backgroundImage,e.backgroundImageRendering);else if(k(e.text)){if(e.width&&e.width<1||e.height&&e.height<1)return;t=N(e)}return t})(e),o=(e=>e instanceof WebGLTexture)(t)?t:void 0;if(Kt(e.points))3===e.points.length&&e.backgroundColor?T.drawTriangle(e.points,e.rotation,e.flipX,e.flipY,e.backgroundColor,e.strokeWidth,e.strokeColor,e.opacity):T.drawPath(e.points,e.strokeWidth,e.strokeColor,e.pathClose,e.opacity);else if(Xt(e.rx)&&Xt(e.ry)){let t,i;T.drawEllipse(e,e.rx,e.ry,e.rotation,e.flipX,e.flipY,e.backgroundColor,o,t,i,e.backgroundCorners&&U(e.backgroundCorners),e.strokeWidth,e.strokeColor,e.opacity,e.inverted)}else if(k(e.text)&&o||e.width){const t=o&&T.textureSize(o);let i,n,r,a=void 0,s=[e.cornerRadius,e.cornerRadius,e.cornerRadius,e.cornerRadius];if(i=e.width?e:{x:e.x,y:e.y,...t},t){if(e.backgroundImage&&e.backgroundSize){const o=_(t.width,t.height);if("contain"===e.backgroundSize){const t=Je(e,o,i);n=fe(t),r=G(.5*(e.width-n.width),.5*(e.height-n.height))}else if("cover"===e.backgroundSize){const t=Ze(e,o,i);n=fe(t),r=G(t.x,t.y),r=G(.5*(e.width-n.width),.5*(e.height-n.height))}else n=e.backgroundSize,r=e.backgroundPosition}else e.text&&e.width?(n=t,r=G(0,0),e.height||(e.height=t.height),e.x-=ro,e.width+=40,"left"===e.textAlign&&(r.x=ro),"center"===e.textAlign&&(r.x=10+.5*(e.width-t.width)),"right"===e.textAlign&&(r.x=e.width-t.width)):e.text&&(r=G(0,0),n={width:i.width,height:i.height},i.width-=ro);e.text&&(a=e.color)}T.drawRect(i,e.rotation,e.flipX,e.flipY,s,e.backgroundColor,o,n,r,e.backgroundCorners&&U(e.backgroundCorners),e.strokeWidth,e.strokeColor,e.opacity,void 0,a,e.inverted)}return t})).filter(Boolean),X=[],Y=()=>{X.length=0;const e=C[0],{blendShapes:t,annotationShapes:o,interfaceShapes:i,decorationShapes:n,frameShapes:a}=w({opacity:e.opacity,rotation:e.rotation,scale:e.scale,images:C,size:be(R,P),backgroundColor:[...r]}),h=[...r],p=l,m=jr(s,0,1),g=c,f=e.size,$=e.backgroundColor,y=t.length>0,b=o.length>0,x=$[3]>0;if(m<1&&x){const e=h[0],t=h[1],o=h[2],i=1-m,n=$[0]*i,r=$[1]*i,a=$[2]*i,s=1-i;h[0]=n+e*s,h[1]=r+t*s,h[2]=a+o*s,h[3]=1}if(T.setCanvasColor(h),y&&(T.disableMask(),T.drawToImageBlendBuffer(f),X.push(...j(t))),b&&(T.disableMask(),T.drawToImageOverlayBuffer(f),X.push(...j(o))),T.drawToCanvas(),T.enableMask(p,m),x&&T.drawRect(p,0,!1,!1,[0,0,0,0],u(r,$)),X.push(...[...C].reverse().map((e=>H({...e,enableShapes:b,enableBlend:y,mask:p,maskOpacity:m,overlayColor:g})))),T.enableMask(p,1),X.push(...j(n)),a.length){const e=a.filter((e=>!e.expandsCanvas)),t=a.filter((e=>e.expandsCanvas));e.length&&X.push(...j(e)),t.length&&(T.enableMask({x:p.x+.5,y:p.y+.5,width:p.width-1,height:p.height-1},d),X.push(...j(t)))}T.disableMask(),X.push(...j(i)),M.forEach((e=>{T.enableMask(e.mask,e.maskOpacity),e.backgroundColor&&T.drawRect(e.mask,0,!1,!1,e.maskCornerRadius,e.backgroundColor,void 0,void 0,void 0,void 0,void 0,e.opacity,e.maskFeather),H({...e,translation:{x:e.translation.x+e.offset.x-.5*R,y:e.translation.y+e.offset.y-.5*P}})})),T.disableMask(),(e=>{O.forEach(((t,o)=>{e.find((e=>e===t))||(O.delete(o),T.textureDelete(t))}))})(X)};let q=Date.now();const K=()=>{const e=Date.now();e-q<48||(q=e,Y())};Dn((()=>n())),zn((()=>o(19,T=Ws(p)))),On((()=>{T&&(T.release(),$(D.canvas))}));return e.$$set=e=>{"animate"in e&&o(9,m=e.animate),"maskRect"in e&&o(10,g=e.maskRect),"maskOpacity"in e&&o(11,f=e.maskOpacity),"maskFrameOpacity"in e&&o(12,b=e.maskFrameOpacity),"pixelRatio"in e&&o(13,x=e.pixelRatio),"backgroundColor"in e&&o(14,v=e.backgroundColor),"willRender"in e&&o(15,w=e.willRender),"loadImageData"in e&&o(16,S=e.loadImageData),"images"in e&&o(17,C=e.images),"interfaceImages"in e&&o(18,M=e.interfaceImages)},e.$$.update=()=>{16384&e.$$.dirty[0]&&v&&A(E,v),2048&e.$$.dirty[0]&&A(L,Xt(f)?f:1),4096&e.$$.dirty[0]&&A(F,Xt(b)?b:1),1024&e.$$.dirty[0]&&g&&B.set(g),3145728&e.$$.dirty[0]&&r&&z.set([r[0],r[1],r[2],jr(s,0,1)]),655363&e.$$.dirty[0]&&o(23,i=!!(T&&R&&P&&C.length)),532483&e.$$.dirty[0]&&R&&P&&T&&T.resize(R,P,x),8388608&e.$$.dirty[0]&&o(22,n=i?ms()?K:Y:a),12582912&e.$$.dirty[0]&&i&&n&&n()},[R,P,p,h,E,L,F,B,z,m,g,f,b,x,v,w,S,C,M,T,r,s,n,i,function(e){Un[e?"unshift":"push"]((()=>{p=e,o(2,p)}))},e=>{o(0,R=e.detail.width),o(1,P=e.detail.height),h("measure",{width:R,height:P})}]}class Hs extends Sr{constructor(e){super(),wr(this,e,Ns,Vs,Gi,{animate:9,maskRect:10,maskOpacity:11,maskFrameOpacity:12,pixelRatio:13,backgroundColor:14,willRender:15,loadImageData:16,images:17,interfaceImages:18},[-1,-1])}}var Us=(e,t=Boolean,o=" ")=>e.filter(t).join(o);function js(e,t,o){const i=e.slice();return i[17]=t[o],i}const Xs=e=>({tab:4&e}),Ys=e=>({tab:e[17]});function Gs(e){let t,o,i,n=[],r=new Map,a=e[2];const s=e=>e[17].id;for(let t=0;t<a.length;t+=1){let o=js(e,a,t),i=s(o);r.set(i,n[t]=qs(i,o))}return{c(){t=gn("ul");for(let e=0;e<n.length;e+=1)n[e].c();Sn(t,"class",o=Us(["PinturaTabList",e[0]])),Sn(t,"role","tablist"),Sn(t,"data-layout",e[1])},m(o,r){pn(o,t,r);for(let e=0;e<n.length;e+=1)n[e].m(t,null);e[14](t),i=!0},p(e,l){1124&l&&(a=e[2],rr(),n=mr(n,l,s,1,e,a,r,t,pr,qs,null,js),ar()),(!i||1&l&&o!==(o=Us(["PinturaTabList",e[0]])))&&Sn(t,"class",o),(!i||2&l)&&Sn(t,"data-layout",e[1])},i(e){if(!i){for(let e=0;e<a.length;e+=1)sr(n[e]);i=!0}},o(e){for(let e=0;e<n.length;e+=1)lr(n[e]);i=!1},d(o){o&&mn(t);for(let e=0;e<n.length;e+=1)n[e].d();e[14](null)}}}function qs(e,t){let o,i,n,r,a,s,l,c,d,u;const h=t[11].default,p=Ji(h,t,t[10],Ys);function m(...e){return t[12](t[17],...e)}function g(...e){return t[13](t[17],...e)}return{key:e,first:null,c(){o=gn("li"),i=gn("button"),p&&p.c(),r=yn(),i.disabled=n=t[17].disabled,Sn(o,"role","tab"),Sn(o,"aria-controls",a=t[17].href.substr(1)),Sn(o,"id",s=t[17].tabId),Sn(o,"aria-selected",l=t[17].selected),this.first=o},m(e,t){pn(e,o,t),hn(o,i),p&&p.m(i,null),hn(o,r),c=!0,d||(u=[xn(i,"keydown",m),xn(i,"click",g)],d=!0)},p(e,r){t=e,p&&p.p&&1028&r&&en(p,h,t,t[10],r,Xs,Ys),(!c||4&r&&n!==(n=t[17].disabled))&&(i.disabled=n),(!c||4&r&&a!==(a=t[17].href.substr(1)))&&Sn(o,"aria-controls",a),(!c||4&r&&s!==(s=t[17].tabId))&&Sn(o,"id",s),(!c||4&r&&l!==(l=t[17].selected))&&Sn(o,"aria-selected",l)},i(e){c||(sr(p,e),c=!0)},o(e){lr(p,e),c=!1},d(e){e&&mn(o),p&&p.d(e),d=!1,Xi(u)}}}function Ks(e){let t,o,i=e[4]&&Gs(e);return{c(){i&&i.c(),t=bn()},m(e,n){i&&i.m(e,n),pn(e,t,n),o=!0},p(e,[o]){e[4]?i?(i.p(e,o),16&o&&sr(i,1)):(i=Gs(e),i.c(),sr(i,1),i.m(t.parentNode,t)):i&&(rr(),lr(i,1,1,(()=>{i=null})),ar())},i(e){o||(sr(i),o=!0)},o(e){lr(i),o=!1},d(e){i&&i.d(e),e&&mn(t)}}}function Zs(e,t,o){let i,n,r,{$$slots:a={},$$scope:s}=t,{class:l}=t,{name:c}=t,{selected:d}=t,{tabs:u=[]}=t,{layout:h}=t;const p=_n(),m=e=>{const t=r.querySelectorAll('[role="tab"] button')[e];t&&t.focus()},g=(e,t)=>{e.preventDefault(),e.stopPropagation(),p("select",t)},f=({key:e},t)=>{if(!/arrow/i.test(e))return;const o=u.findIndex((e=>e.id===t));return/right|down/i.test(e)?m(o<u.length-1?o+1:0):/left|up/i.test(e)?m(o>0?o-1:u.length-1):void 0};return e.$$set=e=>{"class"in e&&o(0,l=e.class),"name"in e&&o(7,c=e.name),"selected"in e&&o(8,d=e.selected),"tabs"in e&&o(9,u=e.tabs),"layout"in e&&o(1,h=e.layout),"$$scope"in e&&o(10,s=e.$$scope)},e.$$.update=()=>{896&e.$$.dirty&&o(2,i=u.map((e=>{const t=e.id===d;return{...e,tabId:`tab-${c}-${e.id}`,href:`#panel-${c}-${e.id}`,selected:t}}))),4&e.$$.dirty&&o(4,n=i.length>1)},[l,h,i,r,n,g,f,c,d,u,s,a,(e,t)=>f(t,e.id),(e,t)=>g(t,e.id),function(e){Un[e?"unshift":"push"]((()=>{r=e,o(3,r)}))}]}class Js extends Sr{constructor(e){super(),wr(this,e,Zs,Ks,Gi,{class:0,name:7,selected:8,tabs:9,layout:1})}}const Qs=e=>({panel:16&e}),el=e=>({panel:e[4][0].id,panelIsActive:!0});function tl(e,t,o){const i=e.slice();return i[14]=t[o].id,i[15]=t[o].draw,i[16]=t[o].panelId,i[17]=t[o].tabindex,i[18]=t[o].labelledBy,i[19]=t[o].hidden,i[3]=t[o].visible,i}const ol=e=>({panel:16&e,panelIsActive:16&e}),il=e=>({panel:e[14],panelIsActive:!e[19]});function nl(e){let t,o,i,n,r,a;const s=e[11].default,l=Ji(s,e,e[10],el);return{c(){t=gn("div"),o=gn("div"),l&&l.c(),Sn(o,"class",i=Us([e[1]])),Sn(t,"class",e[0]),Sn(t,"style",e[2])},m(i,s){pn(i,t,s),hn(t,o),l&&l.m(o,null),n=!0,r||(a=[xn(t,"measure",e[13]),rn(as.call(null,t))],r=!0)},p(e,r){l&&l.p&&1040&r&&en(l,s,e,e[10],r,Qs,el),(!n||2&r&&i!==(i=Us([e[1]])))&&Sn(o,"class",i),(!n||1&r)&&Sn(t,"class",e[0]),(!n||4&r)&&Sn(t,"style",e[2])},i(e){n||(sr(l,e),n=!0)},o(e){lr(l,e),n=!1},d(e){e&&mn(t),l&&l.d(e),r=!1,Xi(a)}}}function rl(e){let t,o,i,n,r,a=[],s=new Map,l=e[4];const c=e=>e[14];for(let t=0;t<l.length;t+=1){let o=tl(e,l,t),i=c(o);s.set(i,a[t]=sl(i,o))}return{c(){t=gn("div");for(let e=0;e<a.length;e+=1)a[e].c();Sn(t,"class",o=Us(["PinturaTabPanels",e[0]])),Sn(t,"style",e[2])},m(o,s){pn(o,t,s);for(let e=0;e<a.length;e+=1)a[e].m(t,null);i=!0,n||(r=[xn(t,"measure",e[12]),rn(as.call(null,t,{observePosition:!0}))],n=!0)},p(e,n){1042&n&&(l=e[4],rr(),a=mr(a,n,c,1,e,l,s,t,pr,sl,null,tl),ar()),(!i||1&n&&o!==(o=Us(["PinturaTabPanels",e[0]])))&&Sn(t,"class",o),(!i||4&n)&&Sn(t,"style",e[2])},i(e){if(!i){for(let e=0;e<l.length;e+=1)sr(a[e]);i=!0}},o(e){for(let e=0;e<a.length;e+=1)lr(a[e]);i=!1},d(e){e&&mn(t);for(let e=0;e<a.length;e+=1)a[e].d();n=!1,Xi(r)}}}function al(e){let t;const o=e[11].default,i=Ji(o,e,e[10],il);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,t){i&&i.p&&1040&t&&en(i,o,e,e[10],t,ol,il)},i(e){t||(sr(i,e),t=!0)},o(e){lr(i,e),t=!1},d(e){i&&i.d(e)}}}function sl(e,t){let o,i,n,r,a,s,l,c,d,u=t[15]&&al(t);return{key:e,first:null,c(){o=gn("div"),u&&u.c(),i=yn(),Sn(o,"class",n=Us(["PinturaTabPanel",t[1]])),o.hidden=r=t[19],Sn(o,"id",a=t[16]),Sn(o,"tabindex",s=t[17]),Sn(o,"aria-labelledby",l=t[18]),Sn(o,"data-inert",c=!t[3]),this.first=o},m(e,t){pn(e,o,t),u&&u.m(o,null),hn(o,i),d=!0},p(e,h){(t=e)[15]?u?(u.p(t,h),16&h&&sr(u,1)):(u=al(t),u.c(),sr(u,1),u.m(o,i)):u&&(rr(),lr(u,1,1,(()=>{u=null})),ar()),(!d||2&h&&n!==(n=Us(["PinturaTabPanel",t[1]])))&&Sn(o,"class",n),(!d||16&h&&r!==(r=t[19]))&&(o.hidden=r),(!d||16&h&&a!==(a=t[16]))&&Sn(o,"id",a),(!d||16&h&&s!==(s=t[17]))&&Sn(o,"tabindex",s),(!d||16&h&&l!==(l=t[18]))&&Sn(o,"aria-labelledby",l),(!d||16&h&&c!==(c=!t[3]))&&Sn(o,"data-inert",c)},i(e){d||(sr(u),d=!0)},o(e){lr(u),d=!1},d(e){e&&mn(o),u&&u.d()}}}function ll(e){let t,o,i,n;const r=[rl,nl],a=[];function s(e,t){return e[5]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=bn()},m(e,o){a[t].m(e,o),pn(e,i,o),n=!0},p(e,[n]){let l=t;t=s(e),t===l?a[t].p(e,n):(rr(),lr(a[l],1,1,(()=>{a[l]=null})),ar(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sr(o,1),o.m(i.parentNode,i))},i(e){n||(sr(o),n=!0)},o(e){lr(o),n=!1},d(e){a[t].d(e),e&&mn(i)}}}function cl(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,{class:s}=t,{name:l}=t,{selected:c}=t,{visible:d}=t,{panelClass:u}=t,{panels:h=[]}=t,{style:p}=t;const m={};return e.$$set=e=>{"class"in e&&o(0,s=e.class),"name"in e&&o(6,l=e.name),"selected"in e&&o(7,c=e.selected),"visible"in e&&o(3,d=e.visible),"panelClass"in e&&o(1,u=e.panelClass),"panels"in e&&o(8,h=e.panels),"style"in e&&o(2,p=e.style),"$$scope"in e&&o(10,a=e.$$scope)},e.$$.update=()=>{968&e.$$.dirty&&o(4,i=h.map((e=>{const t=e===c,i=!d||-1!==d.indexOf(e);return t&&o(9,m[e]=!0,m),{id:e,panelId:`panel-${l}-${e}`,labelledBy:`tab-${l}-${e}`,hidden:!t,visible:i,tabindex:t?0:-1,draw:t||m[e]}}))),16&e.$$.dirty&&o(5,n=i.length>1)},[s,u,p,d,i,n,l,c,h,m,a,r,function(t){Nn(e,t)},function(t){Nn(e,t)}]}class dl extends Sr{constructor(e){super(),wr(this,e,cl,ll,Gi,{class:0,name:6,selected:7,visible:3,panelClass:1,panels:8,style:2})}}function ul(e){let t,o,i,n,r;const a=[e[7]];function s(t){e[19](t)}var l=e[11];function c(e){let t={};for(let e=0;e<a.length;e+=1)t=Hi(t,a[e]);return void 0!==e[5]&&(t.name=e[5]),{props:t}}return l&&(o=new l(c(e)),Un.push((()=>$r(o,"name",s))),e[20](o),o.$on("measure",e[21])),{c(){t=gn("div"),o&&yr(o.$$.fragment),Sn(t,"data-util",e[5]),Sn(t,"class",n=Us(["PinturaPanel",e[2]])),Sn(t,"style",e[6])},m(e,i){pn(e,t,i),o&&br(o,t,null),r=!0},p(e,[d]){const u=128&d?gr(a,[fr(e[7])]):{};if(!i&&32&d&&(i=!0,u.name=e[5],Kn((()=>i=!1))),l!==(l=e[11])){if(o){rr();const e=o;lr(e.$$.fragment,1,0,(()=>{xr(e,1)})),ar()}l?(o=new l(c(e)),Un.push((()=>$r(o,"name",s))),e[20](o),o.$on("measure",e[21]),yr(o.$$.fragment),sr(o.$$.fragment,1),br(o,t,null)):o=null}else l&&o.$set(u);(!r||32&d)&&Sn(t,"data-util",e[5]),(!r||4&d&&n!==(n=Us(["PinturaPanel",e[2]])))&&Sn(t,"class",n),(!r||64&d)&&Sn(t,"style",e[6])},i(e){r||(o&&sr(o.$$.fragment,e),r=!0)},o(e){o&&lr(o.$$.fragment,e),r=!1},d(i){i&&mn(t),e[20](null),o&&xr(o)}}}function hl(e,t,o){let i,n,r,a;const s=_n();let l,{isActive:c=!0}=t,{isAnimated:d=!0}=t,{stores:u}=t,{content:h}=t,{component:p}=t,{locale:m}=t,{class:g}=t;const f=qa(0),$=Tr(f,(e=>jr(e,0,1)));Zi(e,$,(e=>o(18,r=e)));let y=!c;const b=Mr(c);Zi(e,b,(e=>o(22,a=e)));const x={isActive:Tr(b,(e=>e)),isActiveFraction:Tr($,(e=>e)),isVisible:Tr($,(e=>e>0))},v=h.view,w=Ha(v),S=Object.keys(h.props||{}).reduce(((e,t)=>w.includes(t)?(e[t]=h.props[t],e):e),{}),k=Object.keys(x).reduce(((e,t)=>w.includes(t)?(e[t]=x[t],e):e),{});let C,M=!1;zn((()=>{o(4,M=!0)}));return e.$$set=e=>{"isActive"in e&&o(1,c=e.isActive),"isAnimated"in e&&o(12,d=e.isAnimated),"stores"in e&&o(13,u=e.stores),"content"in e&&o(14,h=e.content),"component"in e&&o(0,p=e.component),"locale"in e&&o(15,m=e.locale),"class"in e&&o(2,g=e.class)},e.$$.update=()=>{11&e.$$.dirty&&l&&c&&p&&s("measure",l),4098&e.$$.dirty&&f.set(c?1:0,{hard:!d}),393216&e.$$.dirty&&(r<=0&&!y?o(17,y=!0):r>0&&y&&o(17,y=!1)),131088&e.$$.dirty&&M&&s(y?"hide":"show"),262144&e.$$.dirty&&s("fade",r),262144&e.$$.dirty&&o(6,i=r<1?"opacity: "+r:void 0),2&e.$$.dirty&&nn(b,a=c,a),40960&e.$$.dirty&&o(7,n={...S,...k,stores:u,locale:m})},[p,c,g,l,M,C,i,n,s,$,b,v,d,u,h,m,f,y,r,function(e){C=e,o(5,C)},function(e){Un[e?"unshift":"push"]((()=>{p=e,o(0,p)}))},e=>{M&&c&&(o(3,l=e.detail),s("measure",{...l}))}]}class pl extends Sr{constructor(e){super(),wr(this,e,hl,ul,Gi,{isActive:1,isAnimated:12,stores:13,content:14,component:0,locale:15,class:2,opacity:16})}get opacity(){return this.$$.ctx[16]}}function ml(e){let t,o,i;const n=e[5].default,r=Ji(n,e,e[4],null);return{c(){t=fn("svg"),r&&r.c(),Sn(t,"class",e[3]),Sn(t,"style",e[2]),Sn(t,"width",e[0]),Sn(t,"height",e[1]),Sn(t,"viewBox",o="0 0 "+e[0]+"\n "+e[1]),Sn(t,"xmlns","http://www.w3.org/2000/svg"),Sn(t,"aria-hidden","true"),Sn(t,"focusable","false"),Sn(t,"stroke-linecap","round"),Sn(t,"stroke-linejoin","round")},m(e,o){pn(e,t,o),r&&r.m(t,null),i=!0},p(e,[a]){r&&r.p&&16&a&&en(r,n,e,e[4],a,null,null),(!i||8&a)&&Sn(t,"class",e[3]),(!i||4&a)&&Sn(t,"style",e[2]),(!i||1&a)&&Sn(t,"width",e[0]),(!i||2&a)&&Sn(t,"height",e[1]),(!i||3&a&&o!==(o="0 0 "+e[0]+"\n "+e[1]))&&Sn(t,"viewBox",o)},i(e){i||(sr(r,e),i=!0)},o(e){lr(r,e),i=!1},d(e){e&&mn(t),r&&r.d(e)}}}function gl(e,t,o){let{$$slots:i={},$$scope:n}=t,{width:r=24}=t,{height:a=24}=t,{style:s}=t,{class:l}=t;return e.$$set=e=>{"width"in e&&o(0,r=e.width),"height"in e&&o(1,a=e.height),"style"in e&&o(2,s=e.style),"class"in e&&o(3,l=e.class),"$$scope"in e&&o(4,n=e.$$scope)},[r,a,s,l,n,i]}class fl extends Sr{constructor(e){super(),wr(this,e,gl,ml,Gi,{width:0,height:1,style:2,class:3})}}var $l=(e,t)=>t===e.target||t.contains(e.target);function yl(e){let t,o;return t=new fl({props:{class:"PinturaButtonIcon",$$slots:{default:[bl]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};1048578&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function bl(e){let t;return{c(){t=fn("g")},m(o,i){pn(o,t,i),t.innerHTML=e[1]},p(e,o){2&o&&(t.innerHTML=e[1])},d(e){e&&mn(t)}}}function xl(e){let t,o;return{c(){t=gn("span"),o=$n(e[0]),Sn(t,"class",e[11])},m(e,i){pn(e,t,i),hn(t,o)},p(e,i){1&i&&Cn(o,e[0]),2048&i&&Sn(t,"class",e[11])},d(e){e&&mn(t)}}}function vl(e){let t,o,i,n;const r=e[18].default,a=Ji(r,e,e[20],null),s=a||function(e){let t,o,i,n=e[1]&&yl(e),r=e[0]&&xl(e);return{c(){t=gn("span"),n&&n.c(),o=yn(),r&&r.c(),Sn(t,"class",e[9])},m(e,a){pn(e,t,a),n&&n.m(t,null),hn(t,o),r&&r.m(t,null),i=!0},p(e,a){e[1]?n?(n.p(e,a),2&a&&sr(n,1)):(n=yl(e),n.c(),sr(n,1),n.m(t,o)):n&&(rr(),lr(n,1,1,(()=>{n=null})),ar()),e[0]?r?r.p(e,a):(r=xl(e),r.c(),r.m(t,null)):r&&(r.d(1),r=null),(!i||512&a)&&Sn(t,"class",e[9])},i(e){i||(sr(n),i=!0)},o(e){lr(n),i=!1},d(e){e&&mn(t),n&&n.d(),r&&r.d()}}}(e);return{c(){t=gn("button"),s&&s.c(),Sn(t,"type",e[4]),Sn(t,"style",e[2]),t.disabled=e[3],Sn(t,"class",e[10]),Sn(t,"title",e[0])},m(r,a){pn(r,t,a),s&&s.m(t,null),e[19](t),o=!0,i||(n=[xn(t,"keydown",(function(){Yi(e[6])&&e[6].apply(this,arguments)})),xn(t,"click",(function(){Yi(e[5])&&e[5].apply(this,arguments)})),rn(e[7].call(null,t))],i=!0)},p(i,[n]){e=i,a?a.p&&1048576&n&&en(a,r,e,e[20],n,null,null):s&&s.p&&2563&n&&s.p(e,n),(!o||16&n)&&Sn(t,"type",e[4]),(!o||4&n)&&Sn(t,"style",e[2]),(!o||8&n)&&(t.disabled=e[3]),(!o||1024&n)&&Sn(t,"class",e[10]),(!o||1&n)&&Sn(t,"title",e[0])},i(e){o||(sr(s,e),o=!0)},o(e){lr(s,e),o=!1},d(o){o&&mn(t),s&&s.d(o),e[19](null),i=!1,Xi(n)}}}function wl(e,t,o){let i,n,r,a,{$$slots:s={},$$scope:l}=t,{class:c}=t,{label:d}=t,{labelClass:u}=t,{innerClass:h}=t,{hideLabel:p=!1}=t,{icon:m}=t,{style:g}=t,{disabled:f}=t,{type:$="button"}=t,{onclick:y}=t,{onkeydown:b}=t,{action:x=(()=>{})}=t;return e.$$set=e=>{"class"in e&&o(12,c=e.class),"label"in e&&o(0,d=e.label),"labelClass"in e&&o(13,u=e.labelClass),"innerClass"in e&&o(14,h=e.innerClass),"hideLabel"in e&&o(15,p=e.hideLabel),"icon"in e&&o(1,m=e.icon),"style"in e&&o(2,g=e.style),"disabled"in e&&o(3,f=e.disabled),"type"in e&&o(4,$=e.type),"onclick"in e&&o(5,y=e.onclick),"onkeydown"in e&&o(6,b=e.onkeydown),"action"in e&&o(7,x=e.action),"$$scope"in e&&o(20,l=e.$$scope)},e.$$.update=()=>{16384&e.$$.dirty&&o(9,i=Us(["PinturaButtonInner",h])),36864&e.$$.dirty&&o(10,n=Us(["PinturaButton",p&&"PinturaButtonIconOnly",c])),40960&e.$$.dirty&&o(11,r=Us([p?"implicit":"PinturaButtonLabel",u]))},[d,m,g,f,$,y,b,x,a,i,n,r,c,u,h,p,e=>$l(e,a),()=>a,s,function(e){Un[e?"unshift":"push"]((()=>{a=e,o(8,a)}))},l]}class Sl extends Sr{constructor(e){super(),wr(this,e,wl,vl,Gi,{class:12,label:0,labelClass:13,innerClass:14,hideLabel:15,icon:1,style:2,disabled:3,type:4,onclick:5,onkeydown:6,action:7,isEventTarget:16,getElement:17})}get isEventTarget(){return this.$$.ctx[16]}get getElement(){return this.$$.ctx[17]}}var kl=(e,t)=>{const o=e.findIndex(t);if(o>=0)return e.splice(o,1)};var Cl=(e,t={})=>{const{inertia:o=!1,matchTarget:i=!1,pinch:n=!1,getEventPosition:r=(e=>G(e.clientX,e.clientY))}=t;function a(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}function s(){g&&g(),g=void 0}const l=[],c=e=>{e.origin.x=e.position.x,e.origin.y=e.position.y,e.translation.x=0,e.translation.y=0},d=e=>{const t=(e=>l.findIndex((t=>t.event.pointerId===e.pointerId)))(e);if(!(t<0))return l[t]},u=()=>1===l.length,h=()=>2===l.length,p=e=>{const t=de(e.map((e=>e.position)));return{center:t,distance:((e,t)=>e.reduce(((e,o)=>e+ce(t,o.position)),0)/e.length)(e,t),velocity:de(e.map((e=>e.velocity))),translation:de(e.map((e=>e.translation)))}};let m,g,f,$,y,b,x=0,v=void 0;function w(t){h()||(e=>Xt(e.button)&&0!==e.button)(t)||i&&t.target!==e||(s(),(e=>{const t={timeStamp:e.timeStamp,timeStampInitial:e.timeStamp,position:r(e),origin:r(e),velocity:Y(),translation:Y(),interactionState:void 0,event:e};l.push(t),t.interactionState=p(l)})(t),u()?(document.documentElement.addEventListener("pointermove",k),document.documentElement.addEventListener("pointerup",C),document.documentElement.addEventListener("pointercancel",C),b=!1,y=1,$=Y(),f=void 0,a("interactionstart",{origin:K(d(t).origin)})):n&&(b=!0,f=ce(l[0].position,l[1].position),$.x+=l[0].translation.x,$.y+=l[0].translation.y,c(l[0])))}e.addEventListener("pointerdown",w);let S=Date.now();function k(e){e.preventDefault(),(e=>{const t=d(e);if(!t)return;const{timeStamp:o}=e,i=r(e),n=Math.max(1,o-t.timeStamp);t.velocity.x=(i.x-t.position.x)/n,t.velocity.y=(i.y-t.position.y)/n,t.translation.x=i.x-t.origin.x,t.translation.y=i.y-t.origin.y,t.timeStamp=o,t.position.x=i.x,t.position.y=i.y,t.event=e})(e);let t=K(l[0].translation),o=y;if(n&&h()){o*=ce(l[0].position,l[1].position)/f,ne(t,l[1].translation)}t.x+=$.x,t.y+=$.y;const i=Date.now();i-S<16||(S=i,a("interactionupdate",{translation:t,scalar:n?o:void 0}))}function C(e){if(!d(e))return;const t=(e=>{const t=kl(l,(t=>t.event.pointerId===e.pointerId));if(t)return t[0]})(e);if(n&&u()){const e=ce(l[0].position,t.position);y*=e/f,$.x+=l[0].translation.x+t.translation.x,$.y+=l[0].translation.y+t.translation.y,c(l[0])}let i=!1,r=!1;if(!b&&t){const e=performance.now(),o=e-t.timeStampInitial,n=le(t.translation);i=n<64&&o<300,r=!!(v&&i&&e-x<700&&le(v,t.position)<128),i&&(v=K(t.position),x=e)}if(l.length>0)return;document.documentElement.removeEventListener("pointermove",k),document.documentElement.removeEventListener("pointerup",C),document.documentElement.removeEventListener("pointercancel",C);const s=K(t.translation),h=K(t.velocity);let p=!1;a("interactionrelease",{isTap:i,isDoubleTap:r,translation:s,scalar:y,preventInertia:()=>p=!0});const w=ce(h);if(p||!o||w<.25)return T(s,{isTap:i,isDoubleTap:r});m=Ya(K(s),{easing:Ua,duration:80*w}),m.set({x:s.x+50*h.x,y:s.y+50*h.y}).then((()=>{g&&T(Ki(m),{isTap:i,isDoubleTap:r})})),g=m.subscribe(M)}function M(e){e&&a("interactionupdate",{translation:e,scalar:n?y:void 0})}function T(e,t){s(),a("interactionend",{...t,translation:e,scalar:n?y:void 0})}return{destroy(){s(),e.removeEventListener("pointerdown",w)}}},Ml=(e,t={})=>{const{direction:o,shiftMultiplier:i=10,bubbles:n=!1,stopKeydownPropagation:r=!0}=t,a="horizontal"===o,s="vertical"===o,l=t=>{const{key:o}=t,l=t.shiftKey,c=/up|down/i.test(o),d=/left|right/i.test(o);if(!d&&!c)return;if(a&&c)return;if(s&&d)return;const u=l?i:1;r&&t.stopPropagation(),e.dispatchEvent(new CustomEvent("nudge",{bubbles:n,detail:G((/left/i.test(o)?-1:/right/i.test(o)?1:0)*u,(/up/i.test(o)?-1:/down/i.test(o)?1:0)*u)}))};return e.addEventListener("keydown",l),{destroy(){e.removeEventListener("keydown",l)}}};function Tl(e,t){return t*Math.sign(e)*Math.log10(1+Math.abs(e)/t)}const Rl=(e,t,o)=>{if(!t)return Ie(e);const i=e.x+Tl(t.x-e.x,o),n=e.x+e.width+Tl(t.x+t.width-(e.x+e.width),o),r=e.y+Tl(t.y-e.y,o);return{x:i,y:r,width:n-i,height:e.y+e.height+Tl(t.y+t.height-(e.y+e.height),o)-r}};var Pl=(e,t)=>{if(e)return/em/.test(e)?16*parseInt(e,10):/px/.test(e)?parseInt(e,10):void 0},Al=e=>{let t=e.detail||0;const{deltaX:o,deltaY:i,wheelDelta:n,wheelDeltaX:r,wheelDeltaY:a}=e;return Xt(r)&&Math.abs(r)>Math.abs(a)?t=r/-120:Xt(o)&&Math.abs(o)>Math.abs(i)?t=o/20:(n||a)&&(t=(n||a)/-120),t||(t=i/20),t};function Il(e){let t,o,i,n,r,a,s;const l=e[37].default,c=Ji(l,e,e[36],null);return{c(){t=gn("div"),o=gn("div"),c&&c.c(),Sn(o,"style",e[6]),Sn(t,"class",i=Us(["PinturaScrollable",e[0]])),Sn(t,"style",e[4]),Sn(t,"data-direction",e[1]),Sn(t,"data-state",e[5])},m(i,l){pn(i,t,l),hn(t,o),c&&c.m(o,null),e[39](t),r=!0,a||(s=[xn(o,"interactionstart",e[9]),xn(o,"interactionupdate",e[11]),xn(o,"interactionend",e[12]),xn(o,"interactionrelease",e[10]),rn(Cl.call(null,o,{inertia:!0})),xn(o,"measure",e[38]),rn(as.call(null,o)),xn(t,"wheel",e[14],{passive:!1}),xn(t,"scroll",e[16]),xn(t,"focusin",e[15]),xn(t,"nudge",e[17]),xn(t,"measure",e[13]),rn(as.call(null,t,{observePosition:!0})),rn(n=Ml.call(null,t,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1}))],a=!0)},p(e,a){c&&c.p&&32&a[1]&&en(c,l,e,e[36],a,null,null),(!r||64&a[0])&&Sn(o,"style",e[6]),(!r||1&a[0]&&i!==(i=Us(["PinturaScrollable",e[0]])))&&Sn(t,"class",i),(!r||16&a[0])&&Sn(t,"style",e[4]),(!r||2&a[0])&&Sn(t,"data-direction",e[1]),(!r||32&a[0])&&Sn(t,"data-state",e[5]),n&&Yi(n.update)&&2&a[0]&&n.update.call(null,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1})},i(e){r||(sr(c,e),r=!0)},o(e){lr(c,e),r=!1},d(o){o&&mn(t),c&&c.d(o),e[39](null),a=!1,Xi(s)}}}function El(e,t,o){let i,n,r,s,l,c,d,u,h,{$$slots:p={},$$scope:m}=t;const g=_n(),f=Vn("keysPressed");Zi(e,f,(e=>o(46,h=e)));let $,y,b,x,v="idle",w=qa(0);Zi(e,w,(e=>o(34,u=e)));let S,{class:k}=t,{scrollBlockInteractionDist:C=5}=t,{scrollStep:M=10}=t,{scrollFocusMargin:T=64}=t,{scrollDirection:R="x"}=t,{scrollAutoCancel:P=!1}=t,{elasticity:A=0}=t,{onscroll:I=a}=t,{maskFeatherSize:E}=t,{maskFeatherStartOpacity:L}=t,{maskFeatherEndOpacity:F}=t,{scroll:B}=t,z="",D=!0;w.subscribe((e=>{const t=Y();t[R]=e,I(t)}));const O=e=>Math.max(Math.min(0,e),b[i]-y[i]);let _,W,V;const N=(e,t={})=>{const{elastic:i=!1,animate:n=!1}=t;Math.abs(e)>C&&"idle"===v&&!x&&o(28,v="scrolling");const r=O(e),a=i&&A&&!x?r+Tl(e-r,A):r;let s=!0;n?s=!1:D||(s=!x),D=!1,w.set(a,{hard:s}).then((e=>{x&&(D=!0)}))};return e.$$set=e=>{"class"in e&&o(0,k=e.class),"scrollBlockInteractionDist"in e&&o(21,C=e.scrollBlockInteractionDist),"scrollStep"in e&&o(22,M=e.scrollStep),"scrollFocusMargin"in e&&o(23,T=e.scrollFocusMargin),"scrollDirection"in e&&o(1,R=e.scrollDirection),"scrollAutoCancel"in e&&o(24,P=e.scrollAutoCancel),"elasticity"in e&&o(25,A=e.elasticity),"onscroll"in e&&o(26,I=e.onscroll),"maskFeatherSize"in e&&o(20,E=e.maskFeatherSize),"maskFeatherStartOpacity"in e&&o(18,L=e.maskFeatherStartOpacity),"maskFeatherEndOpacity"in e&&o(19,F=e.maskFeatherEndOpacity),"scroll"in e&&o(27,B=e.scroll),"$$scope"in e&&o(36,m=e.$$scope)},e.$$.update=()=>{if(2&e.$$.dirty[0]&&o(30,i="x"===R?"width":"height"),2&e.$$.dirty[0]&&o(31,n=R.toUpperCase()),8&e.$$.dirty[0]&&o(32,r=S&&getComputedStyle(S)),8&e.$$.dirty[0]|2&e.$$.dirty[1]&&o(33,s=r&&Pl(r.getPropertyValue("--scrollable-feather-size"))),1611399172&e.$$.dirty[0]|12&e.$$.dirty[1]&&null!=u&&b&&null!=s&&y){const e=-1*u/s,t=-(b[i]-y[i]-u)/s;o(18,L=jr(1-e,0,1)),o(19,F=jr(1-t,0,1)),o(20,E=s),o(4,z=`--scrollable-feather-start-opacity: ${L};--scrollable-feather-end-opacity: ${F}`)}134217736&e.$$.dirty[0]&&S&&void 0!==B&&(Xt(B)?N(B):N(B.scrollOffset,B)),1610612740&e.$$.dirty[0]&&o(35,l=b&&y?y[i]>b[i]:void 0),268435456&e.$$.dirty[0]|16&e.$$.dirty[1]&&o(5,c=Us([v,l?"overflows":void 0])),25&e.$$.dirty[1]&&o(6,d=l?`transform: translate${n}(${u}px)`:void 0)},[k,R,y,S,z,c,d,f,w,()=>{l&&(W=!1,_=!0,V=G(0,0),x=!1,o(28,v="idle"),$=Ki(w))},({detail:e})=>{l&&(x=!0,o(28,v="idle"))},({detail:e})=>{l&&(W||_&&(_=!1,le(e.translation)<.1)||(!P||"x"!==R||(e=>{const t=ie(G(e.x-V.x,e.y-V.y),Math.abs);V=K(e);const o=le(t),i=t.x-t.y;return!(o>1&&i<-.5)})(e.translation)?N($+e.translation[R],{elastic:!0}):W=!0))},({detail:e})=>{if(!l)return;if(W)return;const t=$+e.translation[R],o=O(t);D=!1,w.set(o).then((e=>{x&&(D=!0)}))},({detail:e})=>{o(29,b=e),g("measure",{x:e.x,y:e.y,width:e.width,height:e.height})},e=>{if(!l)return;e.preventDefault(),e.stopPropagation();const t=Al(e),o=Ki(w);N(o+t*M,{animate:!0})},e=>{if(!l)return;if(!x&&!h.length)return;let t=e.target;e.target.classList.contains("implicit")&&(t=t.parentNode);const o=t["x"===R?"offsetLeft":"offsetTop"],n=o+t["x"===R?"offsetWidth":"offsetHeight"],r=Ki(w),a=T+E;r+o<a?N(-o+a):r+n>b[i]-a&&N(b[i]-n-a,{animate:!0})},()=>{o(3,S["x"===R?"scrollLeft":"scrollTop"]=0,S)},({detail:e})=>{const t=-2*e[R],o=Ki(w);N(o+t*M,{animate:!0})},L,F,E,C,M,T,P,A,I,B,v,b,i,n,r,s,u,l,m,p,e=>o(2,y=e.detail),function(e){Un[e?"unshift":"push"]((()=>{S=e,o(3,S)}))}]}class Ll extends Sr{constructor(e){super(),wr(this,e,El,Il,Gi,{class:0,scrollBlockInteractionDist:21,scrollStep:22,scrollFocusMargin:23,scrollDirection:1,scrollAutoCancel:24,elasticity:25,onscroll:26,maskFeatherSize:20,maskFeatherStartOpacity:18,maskFeatherEndOpacity:19,scroll:27},[-1,-1])}}function Fl(e,{delay:t=0,duration:o=400,easing:i=Ni}={}){const n=+getComputedStyle(e).opacity;return{delay:t,duration:o,easing:i,css:e=>"opacity: "+e*n}}function Bl(e){let t,o,i,n,r,a;return{c(){t=gn("span"),o=$n(e[0]),Sn(t,"class","PinturaStatusMessage")},m(i,s){pn(i,t,s),hn(t,o),n=!0,r||(a=[xn(t,"measure",(function(){Yi(e[1])&&e[1].apply(this,arguments)})),rn(as.call(null,t))],r=!0)},p(t,[i]){e=t,(!n||1&i)&&Cn(o,e[0])},i(e){n||(qn((()=>{i||(i=dr(t,Fl,{},!0)),i.run(1)})),n=!0)},o(e){i||(i=dr(t,Fl,{},!1)),i.run(0),n=!1},d(e){e&&mn(t),e&&i&&i.end(),r=!1,Xi(a)}}}function zl(e,t,o){let{text:i}=t,{onmeasure:n=a}=t;return e.$$set=e=>{"text"in e&&o(0,i=e.text),"onmeasure"in e&&o(1,n=e.onmeasure)},[i,n]}class Dl extends Sr{constructor(e){super(),wr(this,e,zl,Bl,Gi,{text:0,onmeasure:1})}}function Ol(e){let t,o,i,n,r,a,s,l;return{c(){t=gn("span"),o=fn("svg"),i=fn("g"),n=fn("circle"),r=fn("circle"),a=yn(),s=gn("span"),l=$n(e[0]),Sn(n,"class","PinturaProgressIndicatorBar"),Sn(n,"r","8.5"),Sn(n,"cx","10"),Sn(n,"cy","10"),Sn(n,"stroke-linecap","round"),Sn(n,"opacity",".25"),Sn(r,"class","PinturaProgressIndicatorFill"),Sn(r,"r","8.5"),Sn(r,"stroke-dasharray",e[1]),Sn(r,"cx","10"),Sn(r,"cy","10"),Sn(r,"transform","rotate(-90) translate(-20)"),Sn(i,"fill","none"),Sn(i,"stroke","currentColor"),Sn(i,"stroke-width","2.5"),Sn(i,"stroke-linecap","round"),Sn(i,"opacity",e[2]),Sn(o,"width","20"),Sn(o,"height","20"),Sn(o,"viewBox","0 0 20 20"),Sn(o,"xmlns","http://www.w3.org/2000/svg"),Sn(o,"aria-hidden","true"),Sn(o,"focusable","false"),Sn(s,"class","implicit"),Sn(t,"class","PinturaProgressIndicator"),Sn(t,"data-status",e[3])},m(e,c){pn(e,t,c),hn(t,o),hn(o,i),hn(i,n),hn(i,r),hn(t,a),hn(t,s),hn(s,l)},p(e,[o]){2&o&&Sn(r,"stroke-dasharray",e[1]),4&o&&Sn(i,"opacity",e[2]),1&o&&Cn(l,e[0]),8&o&&Sn(t,"data-status",e[3])},i:Vi,o:Vi,d(e){e&&mn(t)}}}function _l(e,t,o){let i,n,r,a,s;const l=_n();let{progress:c}=t,{min:d=0}=t,{max:u=100}=t,{labelBusy:h="Busy"}=t;const p=qa(0,{precision:.01}),m=Tr([p],(e=>jr(e,d,u)));return Zi(e,m,(e=>o(9,s=e))),m.subscribe((e=>{1===c&&Math.round(e)>=100&&l("complete")})),e.$$set=e=>{"progress"in e&&o(5,c=e.progress),"min"in e&&o(6,d=e.min),"max"in e&&o(7,u=e.max),"labelBusy"in e&&o(8,h=e.labelBusy)},e.$$.update=()=>{32&e.$$.dirty&&c&&c!==1/0&&p.set(100*c),800&e.$$.dirty&&o(0,i=c===1/0?h:Math.round(s)+"%"),544&e.$$.dirty&&o(1,n=c===1/0?"26.5 53":s/100*53+" 53"),544&e.$$.dirty&&o(2,r=Math.min(1,c===1/0?1:s/10)),32&e.$$.dirty&&o(3,a=c===1/0?"busy":"loading")},[i,n,r,a,m,c,d,u,h,s]}class Wl extends Sr{constructor(e){super(),wr(this,e,_l,Ol,Gi,{progress:5,min:6,max:7,labelBusy:8})}}function Vl(e){let t,o,i;const n=e[5].default,r=Ji(n,e,e[4],null);return{c(){t=gn("span"),r&&r.c(),Sn(t,"class",o="PinturaStatusAside "+e[0]),Sn(t,"style",e[1])},m(e,o){pn(e,t,o),r&&r.m(t,null),i=!0},p(e,[a]){r&&r.p&&16&a&&en(r,n,e,e[4],a,null,null),(!i||1&a&&o!==(o="PinturaStatusAside "+e[0]))&&Sn(t,"class",o),(!i||2&a)&&Sn(t,"style",e[1])},i(e){i||(sr(r,e),i=!0)},o(e){lr(r,e),i=!1},d(e){e&&mn(t),r&&r.d(e)}}}function Nl(e,t,o){let i,{$$slots:n={},$$scope:r}=t,{offset:a=0}=t,{opacity:s=0}=t,{class:l}=t;return e.$$set=e=>{"offset"in e&&o(2,a=e.offset),"opacity"in e&&o(3,s=e.opacity),"class"in e&&o(0,l=e.class),"$$scope"in e&&o(4,r=e.$$scope)},e.$$.update=()=>{12&e.$$.dirty&&o(1,i=`transform:translateX(${a}px);opacity:${s}`)},[l,i,a,s,r,n]}class Hl extends Sr{constructor(e){super(),wr(this,e,Nl,Vl,Gi,{offset:2,opacity:3,class:0})}}function Ul(e){let t,o,i;const n=e[3].default,r=Ji(n,e,e[2],null);let a=[{for:o="_"},e[1]],s={};for(let e=0;e<a.length;e+=1)s=Hi(s,a[e]);return{c(){t=gn("label"),r&&r.c(),kn(t,s)},m(e,o){pn(e,t,o),r&&r.m(t,null),i=!0},p(e,o){r&&r.p&&4&o&&en(r,n,e,e[2],o,null,null),kn(t,s=gr(a,[{for:"_"},2&o&&e[1]]))},i(e){i||(sr(r,e),i=!0)},o(e){lr(r,e),i=!1},d(e){e&&mn(t),r&&r.d(e)}}}function jl(e){let t,o;const i=e[3].default,n=Ji(i,e,e[2],null);let r=[e[1]],a={};for(let e=0;e<r.length;e+=1)a=Hi(a,r[e]);return{c(){t=gn("div"),n&&n.c(),kn(t,a)},m(e,i){pn(e,t,i),n&&n.m(t,null),o=!0},p(e,o){n&&n.p&&4&o&&en(n,i,e,e[2],o,null,null),kn(t,a=gr(r,[2&o&&e[1]]))},i(e){o||(sr(n,e),o=!0)},o(e){lr(n,e),o=!1},d(e){e&&mn(t),n&&n.d(e)}}}function Xl(e){let t,o;const i=e[3].default,n=Ji(i,e,e[2],null);let r=[e[1]],a={};for(let e=0;e<r.length;e+=1)a=Hi(a,r[e]);return{c(){t=gn("div"),n&&n.c(),kn(t,a)},m(e,i){pn(e,t,i),n&&n.m(t,null),o=!0},p(e,o){n&&n.p&&4&o&&en(n,i,e,e[2],o,null,null),kn(t,a=gr(r,[2&o&&e[1]]))},i(e){o||(sr(n,e),o=!0)},o(e){lr(n,e),o=!1},d(e){e&&mn(t),n&&n.d(e)}}}function Yl(e){let t,o,i,n;const r=[Xl,jl,Ul],a=[];function s(e,t){return"div"===e[0]?0:"span"===e[0]?1:"label"===e[0]?2:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=bn()},m(e,o){~t&&a[t].m(e,o),pn(e,i,o),n=!0},p(e,[n]){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(rr(),lr(a[l],1,1,(()=>{a[l]=null})),ar()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sr(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(sr(o),n=!0)},o(e){lr(o),n=!1},d(e){~t&&a[t].d(e),e&&mn(i)}}}function Gl(e,t,o){let{$$slots:i={},$$scope:n}=t,{name:r="div"}=t,{attributes:a={}}=t;return e.$$set=e=>{"name"in e&&o(0,r=e.name),"attributes"in e&&o(1,a=e.attributes),"$$scope"in e&&o(2,n=e.$$scope)},[r,a,n,i]}class ql extends Sr{constructor(e){super(),wr(this,e,Gl,Yl,Gi,{name:0,attributes:1})}}var Kl=()=>u()&&window.devicePixelRatio||1;let Zl=null;var Jl=e=>(null===Zl&&(Zl=1===Kl()?e=>Math.round(e):e=>e),Zl(e));const Ql=e=>({}),ec=e=>({}),tc=e=>({}),oc=e=>({});function ic(e){let t;const o=e[35].label,i=Ji(o,e,e[39],oc);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,t){i&&i.p&&256&t[1]&&en(i,o,e,e[39],t,tc,oc)},i(e){t||(sr(i,e),t=!0)},o(e){lr(i,e),t=!1},d(e){i&&i.d(e)}}}function nc(e){let t,o,i,n,r,a,s;const l=e[35].details,c=Ji(l,e,e[39],ec);return{c(){t=gn("div"),c&&c.c(),o=yn(),i=gn("span"),Sn(i,"class","PinturaDetailsPanelTip"),Sn(i,"style",e[7]),Sn(t,"class",n=Us(["PinturaDetailsPanel",e[1]])),Sn(t,"tabindex","-1"),Sn(t,"style",e[6])},m(n,l){pn(n,t,l),c&&c.m(t,null),hn(t,o),hn(t,i),e[37](t),r=!0,a||(s=[xn(t,"keydown",e[17]),xn(t,"measure",e[38]),rn(as.call(null,t))],a=!0)},p(e,o){c&&c.p&&256&o[1]&&en(c,l,e,e[39],o,Ql,ec),(!r||128&o[0])&&Sn(i,"style",e[7]),(!r||2&o[0]&&n!==(n=Us(["PinturaDetailsPanel",e[1]])))&&Sn(t,"class",n),(!r||64&o[0])&&Sn(t,"style",e[6])},i(e){r||(sr(c,e),r=!0)},o(e){lr(c,e),r=!1},d(o){o&&mn(t),c&&c.d(o),e[37](null),a=!1,Xi(s)}}}function rc(e){let t,o,i,n,r,a,s,l,c={class:Us(["PinturaDetailsButton",e[0]]),onkeydown:e[16],onclick:e[15],$$slots:{default:[ic]},$$scope:{ctx:e}};o=new Sl({props:c}),e[36](o);let d=e[5]&&nc(e);return{c(){t=yn(),yr(o.$$.fragment),i=yn(),d&&d.c(),n=yn(),r=bn()},m(c,u){pn(c,t,u),br(o,c,u),pn(c,i,u),d&&d.m(c,u),pn(c,n,u),pn(c,r,u),a=!0,s||(l=[xn(document.body,"pointerdown",(function(){Yi(e[8])&&e[8].apply(this,arguments)})),xn(document.body,"pointerup",(function(){Yi(e[9])&&e[9].apply(this,arguments)}))],s=!0)},p(t,i){e=t;const r={};1&i[0]&&(r.class=Us(["PinturaDetailsButton",e[0]])),256&i[1]&&(r.$$scope={dirty:i,ctx:e}),o.$set(r),e[5]?d?(d.p(e,i),32&i[0]&&sr(d,1)):(d=nc(e),d.c(),sr(d,1),d.m(n.parentNode,n)):d&&(rr(),lr(d,1,1,(()=>{d=null})),ar())},i(e){a||(sr(o.$$.fragment,e),sr(d),sr(false),a=!0)},o(e){lr(o.$$.fragment,e),lr(d),lr(false),a=!1},d(a){a&&mn(t),e[36](null),xr(o,a),a&&mn(i),d&&d.d(a),a&&mn(n),a&&mn(r),s=!1,Xi(l)}}}let ac=12;function sc(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,f,$,y,{$$slots:b={},$$scope:x}=t,{buttonClass:v}=t,{panelClass:w}=t,{isActive:S=!1}=t,{onshow:k=(({panel:e})=>e.focus())}=t;const C=Vn("rootPortal");Zi(e,C,(e=>o(34,y=e)));const M=Vn("rootRect");let T,R,P;Zi(e,M,(e=>o(27,g=e)));let A=Y(),I=qa(0);Zi(e,I,(e=>o(29,$=e)));let E=Y();const L=Mr({x:0,y:0});Zi(e,L,(e=>o(28,f=e)));const F=qa(-5,{stiffness:.1,damping:.35,precision:.001});Zi(e,F,(e=>o(26,m=e)));const B=e=>$l(e,y)||R.isEventTarget(e);let z,D,O=!1;On((()=>{y&&z&&!z.parentNode&&y.removeChild(z)}));return e.$$set=e=>{"buttonClass"in e&&o(0,v=e.buttonClass),"panelClass"in e&&o(1,w=e.panelClass),"isActive"in e&&o(18,S=e.isActive),"onshow"in e&&o(19,k=e.onshow),"$$scope"in e&&o(39,x=e.$$scope)},e.$$.update=()=>{if(8&e.$$.dirty[0]&&(i=R&&R.getElement()),8650752&e.$$.dirty[0]&&o(9,p=S?e=>{O&&(o(23,O=!1),B(e)||o(18,S=!1))}:void 0),262144&e.$$.dirty[0]&&I.set(S?1:0),262144&e.$$.dirty[0]&&F.set(S?0:-5),67108864&e.$$.dirty[0]&&o(25,n=1-m/-5),135266308&e.$$.dirty[0]&&g&&T&&P){let e=P.x-g.x+.5*P.width-.5*T.width,t=P.y-g.y+P.height;const i=ac,n=ac,r=g.width-ac,a=g.height-ac,s=e,l=t,c=s+T.width,d=l+T.height;if(s<i&&(o(22,E.x=s-i,E),e=i),c>r&&(o(22,E.x=c-r,E),e=r-T.width),d>a){o(21,A.y=-1,A);n<t-T.height-P.height?(o(22,E.y=0,E),t-=T.height+P.height):(o(22,E.y=t-(d-a),E),t-=d-a)}else o(21,A.y=1,A);nn(L,f=ie(G(e,t),Jl),f)}536870912&e.$$.dirty[0]&&o(5,r=$>0),536870912&e.$$.dirty[0]&&o(30,a=$<1),337641472&e.$$.dirty[0]&&o(31,s=`translateX(${f.x+A.x*ac}px) translateY(${f.y+A.y*ac+A.y*m}px)`),1610612736&e.$$.dirty[0]|1&e.$$.dirty[1]&&o(6,l=a?`opacity: ${$}; pointer-events: ${$<1?"none":"all"}; transform: ${s};`:"transform: "+s),33554432&e.$$.dirty[0]&&o(32,c=.5+.5*n),33554432&e.$$.dirty[0]&&o(33,d=n),274726916&e.$$.dirty[0]|6&e.$$.dirty[1]&&o(7,u=f&&T&&`opacity:${d};transform:scaleX(${c})rotate(45deg);top:${A.y<0?E.y+T.height:0}px;left:${E.x+.5*T.width}px`),262144&e.$$.dirty[0]&&o(8,h=S?e=>{B(e)||o(23,O=!0)}:void 0),48&e.$$.dirty[0]|8&e.$$.dirty[1]&&r&&y&&z&&z.parentNode!==y&&y.appendChild(z),262144&e.$$.dirty[0]&&(S||o(24,D=void 0)),17301552&e.$$.dirty[0]&&r&&z&&k({e:D,panel:z})},[v,w,T,R,z,r,l,u,h,p,C,M,I,L,F,e=>{S||o(20,P=i.getBoundingClientRect()),o(24,D=e),o(18,S=!S)},e=>{/down/i.test(e.key)&&(o(18,S=!0),o(24,D=e))},e=>{/esc/i.test(e.key)&&(o(18,S=!1),i.focus())},S,k,P,A,E,O,D,n,m,g,f,$,a,s,c,d,y,b,function(e){Un[e?"unshift":"push"]((()=>{R=e,o(3,R)}))},function(e){Un[e?"unshift":"push"]((()=>{z=e,o(4,z)}))},e=>o(2,T=ge(e.detail)),x]}class lc extends Sr{constructor(e){super(),wr(this,e,sc,rc,Gi,{buttonClass:0,panelClass:1,isActive:18,onshow:19},[-1,-1])}}function cc(e){let t,o,i,n,r,a,s,l;const c=e[14].default,d=Ji(c,e,e[13],null);return{c(){t=gn("li"),o=gn("input"),i=yn(),n=gn("label"),d&&d.c(),Sn(o,"type","radio"),Sn(o,"class","implicit"),Sn(o,"id",e[6]),Sn(o,"name",e[0]),o.value=e[3],o.disabled=e[5],o.checked=e[4],Sn(n,"for",e[6]),Sn(n,"title",e[2]),Sn(t,"class",r=Us(["PinturaRadioGroupOption",e[1]])),Sn(t,"data-disabled",e[5]),Sn(t,"data-selected",e[4])},m(r,c){pn(r,t,c),hn(t,o),hn(t,i),hn(t,n),d&&d.m(n,null),a=!0,s||(l=[xn(o,"change",wn(e[15])),xn(o,"keydown",e[8]),xn(o,"click",e[9])],s=!0)},p(e,[i]){(!a||64&i)&&Sn(o,"id",e[6]),(!a||1&i)&&Sn(o,"name",e[0]),(!a||8&i)&&(o.value=e[3]),(!a||32&i)&&(o.disabled=e[5]),(!a||16&i)&&(o.checked=e[4]),d&&d.p&&8192&i&&en(d,c,e,e[13],i,null,null),(!a||64&i)&&Sn(n,"for",e[6]),(!a||4&i)&&Sn(n,"title",e[2]),(!a||2&i&&r!==(r=Us(["PinturaRadioGroupOption",e[1]])))&&Sn(t,"class",r),(!a||32&i)&&Sn(t,"data-disabled",e[5]),(!a||16&i)&&Sn(t,"data-selected",e[4])},i(e){a||(sr(d,e),a=!0)},o(e){lr(d,e),a=!1},d(e){e&&mn(t),d&&d.d(e),s=!1,Xi(l)}}}function dc(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,{name:s}=t,{class:l}=t,{label:c}=t,{id:d}=t,{value:u}=t,{checked:h}=t,{onkeydown:p}=t,{onclick:m}=t,{disabled:g=!1}=t;const f=Vn("keysPressed");Zi(e,f,(e=>o(16,n=e)));return e.$$set=e=>{"name"in e&&o(0,s=e.name),"class"in e&&o(1,l=e.class),"label"in e&&o(2,c=e.label),"id"in e&&o(10,d=e.id),"value"in e&&o(3,u=e.value),"checked"in e&&o(4,h=e.checked),"onkeydown"in e&&o(11,p=e.onkeydown),"onclick"in e&&o(12,m=e.onclick),"disabled"in e&&o(5,g=e.disabled),"$$scope"in e&&o(13,a=e.$$scope)},e.$$.update=()=>{1025&e.$$.dirty&&o(6,i=`${s}-${d}`)},[s,l,c,u,h,g,i,f,e=>{p(e)},e=>{n.length||m(e)},d,p,m,a,r,function(t){Nn(e,t)}]}class uc extends Sr{constructor(e){super(),wr(this,e,dc,cc,Gi,{name:0,class:1,label:2,id:10,value:3,checked:4,onkeydown:11,onclick:12,disabled:5})}}var hc=(e=[])=>e.reduce(((e,t)=>(Kt(t)?Kt(t[1]):!!t.options)?e.concat(Kt(t)?t[1]:t.options):(e.push(t),e)),[]);const pc=(e,t,o)=>{let i;return Kt(e)?i={id:t,value:e[0],label:e[1],...e[2]||{}}:(i=e,i.id=null!=i.id?i.id:t),o?o(i):i};var mc=(e,t,o)=>qt(e)?e(t,o):e;const gc=(e,t)=>e.map((([e,o,i])=>{if(Kt(o))return[mc(e,t),gc(o,t)];{const n=[e,mc(o,t)];if(i){let e={...i};i.icon&&(e.icon=mc(i.icon,t)),n.push(e)}return n}}));var fc=(e,t)=>gc(e,t),$c=e=>/enter| /i.test(e);function yc(e,t,o){const i=e.slice();return i[26]=t[o],i}const bc=e=>({option:2048&e}),xc=e=>({option:e[26]});function vc(e,t,o){const i=e.slice();return i[26]=t[o],i}const wc=e=>({option:2048&e}),Sc=e=>({option:e[26]}),kc=e=>({option:2048&e}),Cc=e=>({option:e[26]});function Mc(e){let t,o,i,n,r,a=[],s=new Map,l=e[1]&&Tc(e),c=e[11];const d=e=>e[26].id;for(let t=0;t<c.length;t+=1){let o=yc(e,c,t),i=d(o);s.set(i,a[t]=_c(i,o))}return{c(){t=gn("fieldset"),l&&l.c(),o=yn(),i=gn("ul");for(let e=0;e<a.length;e+=1)a[e].c();Sn(i,"class","PinturaRadioGroupOptions"),Sn(t,"class",n=Us(["PinturaRadioGroup",e[3]])),Sn(t,"data-layout",e[5]),Sn(t,"title",e[7])},m(e,n){pn(e,t,n),l&&l.m(t,null),hn(t,o),hn(t,i);for(let e=0;e<a.length;e+=1)a[e].m(i,null);r=!0},p(e,u){e[1]?l?l.p(e,u):(l=Tc(e),l.c(),l.m(t,o)):l&&(l.d(1),l=null),8420177&u&&(c=e[11],rr(),a=mr(a,u,d,1,e,c,s,i,pr,_c,null,yc),ar()),(!r||8&u&&n!==(n=Us(["PinturaRadioGroup",e[3]])))&&Sn(t,"class",n),(!r||32&u)&&Sn(t,"data-layout",e[5]),(!r||128&u)&&Sn(t,"title",e[7])},i(e){if(!r){for(let e=0;e<c.length;e+=1)sr(a[e]);r=!0}},o(e){for(let e=0;e<a.length;e+=1)lr(a[e]);r=!1},d(e){e&&mn(t),l&&l.d();for(let e=0;e<a.length;e+=1)a[e].d()}}}function Tc(e){let t,o,i;return{c(){t=gn("legend"),o=$n(e[1]),Sn(t,"class",i=e[2]&&"implicit")},m(e,i){pn(e,t,i),hn(t,o)},p(e,n){2&n&&Cn(o,e[1]),4&n&&i!==(i=e[2]&&"implicit")&&Sn(t,"class",i)},d(e){e&&mn(t)}}}function Rc(e){let t,o;return t=new uc({props:{name:e[4],label:e[26].label,id:e[26].id,value:e[26].value,disabled:e[26].disabled,class:e[8],checked:e[12](e[26])===e[0],onkeydown:e[13](e[26]),onclick:e[14](e[26]),$$slots:{default:[Lc]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};16&o&&(i.name=e[4]),2048&o&&(i.label=e[26].label),2048&o&&(i.id=e[26].id),2048&o&&(i.value=e[26].value),2048&o&&(i.disabled=e[26].disabled),256&o&&(i.class=e[8]),2049&o&&(i.checked=e[12](e[26])===e[0]),2048&o&&(i.onkeydown=e[13](e[26])),2048&o&&(i.onclick=e[14](e[26])),8390720&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Pc(e){let t,o,i,n,r,a,s=[],l=new Map;const c=e[22].group,d=Ji(c,e,e[23],Cc),u=d||function(e){let t,o,i=e[26].label+"";return{c(){t=gn("span"),o=$n(i),Sn(t,"class","PinturaRadioGroupOptionGroupLabel")},m(e,i){pn(e,t,i),hn(t,o)},p(e,t){2048&t&&i!==(i=e[26].label+"")&&Cn(o,i)},d(e){e&&mn(t)}}}(e);let h=e[26].options;const p=e=>e[26].id;for(let t=0;t<h.length;t+=1){let o=vc(e,h,t),i=p(o);l.set(i,s[t]=Oc(i,o))}return{c(){t=gn("li"),u&&u.c(),o=yn(),i=gn("ul");for(let e=0;e<s.length;e+=1)s[e].c();n=yn(),Sn(i,"class","PinturaRadioGroupOptions"),Sn(t,"class",r=Us(["PinturaRadioGroupOptionGroup",e[9]]))},m(e,r){pn(e,t,r),u&&u.m(t,null),hn(t,o),hn(t,i);for(let e=0;e<s.length;e+=1)s[e].m(i,null);hn(t,n),a=!0},p(e,o){d?d.p&&8390656&o&&en(d,c,e,e[23],o,kc,Cc):u&&u.p&&2048&o&&u.p(e,o),8419665&o&&(h=e[26].options,rr(),s=mr(s,o,p,1,e,h,l,i,pr,Oc,null,vc),ar()),(!a||512&o&&r!==(r=Us(["PinturaRadioGroupOptionGroup",e[9]])))&&Sn(t,"class",r)},i(e){if(!a){sr(u,e);for(let e=0;e<h.length;e+=1)sr(s[e]);a=!0}},o(e){lr(u,e);for(let e=0;e<s.length;e+=1)lr(s[e]);a=!1},d(e){e&&mn(t),u&&u.d(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function Ac(e){let t,o;return t=new fl({props:{$$slots:{default:[Ic]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};8390656&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Ic(e){let t,o=e[26].icon+"";return{c(){t=fn("g")},m(e,i){pn(e,t,i),t.innerHTML=o},p(e,i){2048&i&&o!==(o=e[26].icon+"")&&(t.innerHTML=o)},d(e){e&&mn(t)}}}function Ec(e){let t,o,i=e[26].label+"";return{c(){t=gn("span"),o=$n(i),Sn(t,"class",e[6])},m(e,i){pn(e,t,i),hn(t,o)},p(e,n){2048&n&&i!==(i=e[26].label+"")&&Cn(o,i),64&n&&Sn(t,"class",e[6])},d(e){e&&mn(t)}}}function Lc(e){let t;const o=e[22].option,i=Ji(o,e,e[23],xc),n=i||function(e){let t,o,i,n=e[26].icon&&Ac(e),r=!e[26].hideLabel&&Ec(e);return{c(){n&&n.c(),t=yn(),r&&r.c(),o=yn()},m(e,a){n&&n.m(e,a),pn(e,t,a),r&&r.m(e,a),pn(e,o,a),i=!0},p(e,i){e[26].icon?n?(n.p(e,i),2048&i&&sr(n,1)):(n=Ac(e),n.c(),sr(n,1),n.m(t.parentNode,t)):n&&(rr(),lr(n,1,1,(()=>{n=null})),ar()),e[26].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=Ec(e),r.c(),r.m(o.parentNode,o))},i(e){i||(sr(n),i=!0)},o(e){lr(n),i=!1},d(e){n&&n.d(e),e&&mn(t),r&&r.d(e),e&&mn(o)}}}(e);return{c(){n&&n.c()},m(e,o){n&&n.m(e,o),t=!0},p(e,t){i?i.p&&8390656&t&&en(i,o,e,e[23],t,bc,xc):n&&n.p&&2112&t&&n.p(e,t)},i(e){t||(sr(n,e),t=!0)},o(e){lr(n,e),t=!1},d(e){n&&n.d(e)}}}function Fc(e){let t,o;return t=new fl({props:{$$slots:{default:[Bc]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};8390656&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Bc(e){let t,o=e[26].icon+"";return{c(){t=fn("g")},m(e,i){pn(e,t,i),t.innerHTML=o},p(e,i){2048&i&&o!==(o=e[26].icon+"")&&(t.innerHTML=o)},d(e){e&&mn(t)}}}function zc(e){let t,o,i=e[26].label+"";return{c(){t=gn("span"),o=$n(i),Sn(t,"class",e[6])},m(e,i){pn(e,t,i),hn(t,o)},p(e,n){2048&n&&i!==(i=e[26].label+"")&&Cn(o,i),64&n&&Sn(t,"class",e[6])},d(e){e&&mn(t)}}}function Dc(e){let t;const o=e[22].option,i=Ji(o,e,e[23],Sc),n=i||function(e){let t,o,i,n=e[26].icon&&Fc(e),r=!e[26].hideLabel&&zc(e);return{c(){n&&n.c(),t=yn(),r&&r.c(),o=yn()},m(e,a){n&&n.m(e,a),pn(e,t,a),r&&r.m(e,a),pn(e,o,a),i=!0},p(e,i){e[26].icon?n?(n.p(e,i),2048&i&&sr(n,1)):(n=Fc(e),n.c(),sr(n,1),n.m(t.parentNode,t)):n&&(rr(),lr(n,1,1,(()=>{n=null})),ar()),e[26].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=zc(e),r.c(),r.m(o.parentNode,o))},i(e){i||(sr(n),i=!0)},o(e){lr(n),i=!1},d(e){n&&n.d(e),e&&mn(t),r&&r.d(e),e&&mn(o)}}}(e);return{c(){n&&n.c()},m(e,o){n&&n.m(e,o),t=!0},p(e,t){i?i.p&&8390656&t&&en(i,o,e,e[23],t,wc,Sc):n&&n.p&&2112&t&&n.p(e,t)},i(e){t||(sr(n,e),t=!0)},o(e){lr(n,e),t=!1},d(e){n&&n.d(e)}}}function Oc(e,t){let o,i,n;return i=new uc({props:{name:t[4],label:t[26].label,id:t[26].id,value:t[26].value,disabled:t[26].disabled,class:t[8],checked:t[12](t[26])===t[0],onkeydown:t[13](t[26]),onclick:t[14](t[26]),$$slots:{default:[Dc]},$$scope:{ctx:t}}}),{key:e,first:null,c(){o=bn(),yr(i.$$.fragment),this.first=o},m(e,t){pn(e,o,t),br(i,e,t),n=!0},p(e,o){t=e;const n={};16&o&&(n.name=t[4]),2048&o&&(n.label=t[26].label),2048&o&&(n.id=t[26].id),2048&o&&(n.value=t[26].value),2048&o&&(n.disabled=t[26].disabled),256&o&&(n.class=t[8]),2049&o&&(n.checked=t[12](t[26])===t[0]),2048&o&&(n.onkeydown=t[13](t[26])),2048&o&&(n.onclick=t[14](t[26])),8390720&o&&(n.$$scope={dirty:o,ctx:t}),i.$set(n)},i(e){n||(sr(i.$$.fragment,e),n=!0)},o(e){lr(i.$$.fragment,e),n=!1},d(e){e&&mn(o),xr(i,e)}}}function _c(e,t){let o,i,n,r,a;const s=[Pc,Rc],l=[];function c(e,t){return e[26].options?0:1}return i=c(t),n=l[i]=s[i](t),{key:e,first:null,c(){o=bn(),n.c(),r=bn(),this.first=o},m(e,t){pn(e,o,t),l[i].m(e,t),pn(e,r,t),a=!0},p(e,o){let a=i;i=c(t=e),i===a?l[i].p(t,o):(rr(),lr(l[a],1,1,(()=>{l[a]=null})),ar(),n=l[i],n?n.p(t,o):(n=l[i]=s[i](t),n.c()),sr(n,1),n.m(r.parentNode,r))},i(e){a||(sr(n),a=!0)},o(e){lr(n),a=!1},d(e){e&&mn(o),l[i].d(e),e&&mn(r)}}}function Wc(e){let t,o,i,n=e[10].length&&Mc(e);return{c(){n&&n.c(),t=yn(),o=bn()},m(e,r){n&&n.m(e,r),pn(e,t,r),pn(e,o,r),i=!0},p(e,[o]){e[10].length?n?(n.p(e,o),1024&o&&sr(n,1)):(n=Mc(e),n.c(),sr(n,1),n.m(t.parentNode,t)):n&&(rr(),lr(n,1,1,(()=>{n=null})),ar())},i(e){i||(sr(n),sr(false),i=!0)},o(e){lr(n),lr(false),i=!1},d(e){n&&n.d(e),e&&mn(t),e&&mn(o)}}}function Vc(e,t,o){let i,n,r,{$$slots:a={},$$scope:s}=t;const l=_n();let{label:c}=t,{hideLabel:d=!0}=t,{class:u}=t,{name:h="radio-group-"+R()}=t,{selectedIndex:p=-1}=t,{options:m=[]}=t,{onchange:g}=t,{layout:f}=t,{optionMapper:$}=t,{optionFilter:y}=t,{value:b}=t,{optionLabelClass:x}=t,{title:v}=t,{locale:w}=t,{optionClass:S}=t,{optionGroupClass:k}=t;const C=e=>r.findIndex((t=>t.id===e.id)),M=(e,t)=>{o(0,p=C(e));const i={index:p,...e};((e,...t)=>{e&&e(...t)})(g,i,t),l("change",i)};return e.$$set=e=>{"label"in e&&o(1,c=e.label),"hideLabel"in e&&o(2,d=e.hideLabel),"class"in e&&o(3,u=e.class),"name"in e&&o(4,h=e.name),"selectedIndex"in e&&o(0,p=e.selectedIndex),"options"in e&&o(15,m=e.options),"onchange"in e&&o(16,g=e.onchange),"layout"in e&&o(5,f=e.layout),"optionMapper"in e&&o(17,$=e.optionMapper),"optionFilter"in e&&o(18,y=e.optionFilter),"value"in e&&o(19,b=e.value),"optionLabelClass"in e&&o(6,x=e.optionLabelClass),"title"in e&&o(7,v=e.title),"locale"in e&&o(20,w=e.locale),"optionClass"in e&&o(8,S=e.optionClass),"optionGroupClass"in e&&o(9,k=e.optionGroupClass),"$$scope"in e&&o(23,s=e.$$scope)},e.$$.update=()=>{1343488&e.$$.dirty&&o(10,i=fc(y?m.filter(y):m,w)),132096&e.$$.dirty&&o(11,n=((e=[],t)=>{let o=0;return e.map((e=>(o++,Kt(e)?Kt(e[1])?{id:o,label:e[0],options:e[1].map((e=>pc(e,++o,t)))}:pc(e,o,t):e.options?{id:e.id||o,label:e.label,options:e.options.map((e=>pc(e,++o,t)))}:pc(e,o,t))))})(i,$)),2048&e.$$.dirty&&o(21,r=hc(n)),2621441&e.$$.dirty&&b&&p<0&&o(0,p=r.findIndex((e=>e.value===b)))},[p,c,d,u,h,f,x,v,S,k,i,n,C,e=>t=>{$c(t.key)&&M(e,t)},e=>t=>{M(e,t)},m,g,$,y,b,w,r,a,s]}class Nc extends Sr{constructor(e){super(),wr(this,e,Vc,Wc,Gi,{label:1,hideLabel:2,class:3,name:4,selectedIndex:0,options:15,onchange:16,layout:5,optionMapper:17,optionFilter:18,value:19,optionLabelClass:6,title:7,locale:20,optionClass:8,optionGroupClass:9})}}function Hc(e){let t,o;return t=new fl({props:{class:"PinturaButtonIcon",$$slots:{default:[Uc]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};536870976&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Uc(e){let t;return{c(){t=fn("g")},m(o,i){pn(o,t,i),t.innerHTML=e[6]},p(e,o){64&o&&(t.innerHTML=e[6])},d(e){e&&mn(t)}}}function jc(e){let t,o,i,n,r,a,s,l,c=(e[2]||e[18])+"",d=e[6]&&Hc(e);return{c(){t=gn("span"),d&&d.c(),o=yn(),i=gn("span"),n=$n(c),Sn(i,"class",r=Us(["PinturaButtonLabel",e[3],e[5]&&"implicit"])),Sn(t,"slot","label"),Sn(t,"title",a=mc(e[1],e[15])),Sn(t,"class",s=Us(["PinturaButtonInner",e[4]]))},m(e,r){pn(e,t,r),d&&d.m(t,null),hn(t,o),hn(t,i),hn(i,n),l=!0},p(e,u){e[6]?d?(d.p(e,u),64&u&&sr(d,1)):(d=Hc(e),d.c(),sr(d,1),d.m(t,o)):d&&(rr(),lr(d,1,1,(()=>{d=null})),ar()),(!l||262148&u)&&c!==(c=(e[2]||e[18])+"")&&Cn(n,c),(!l||40&u&&r!==(r=Us(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&Sn(i,"class",r),(!l||32770&u&&a!==(a=mc(e[1],e[15])))&&Sn(t,"title",a),(!l||16&u&&s!==(s=Us(["PinturaButtonInner",e[4]])))&&Sn(t,"class",s)},i(e){l||(sr(d),l=!0)},o(e){lr(d),l=!1},d(e){e&&mn(t),d&&d.d()}}}function Xc(e){let t,o,i=e[28].label+"";return{c(){t=gn("span"),o=$n(i),Sn(t,"slot","group")},m(e,i){pn(e,t,i),hn(t,o)},p(e,t){268435456&t&&i!==(i=e[28].label+"")&&Cn(o,i)},d(e){e&&mn(t)}}}function Yc(e){let t,o;return t=new fl({props:{style:qt(e[13])?e[13](e[28].value):e[13],$$slots:{default:[Gc]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};268443648&o&&(i.style=qt(e[13])?e[13](e[28].value):e[13]),805306368&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Gc(e){let t,o=e[28].icon+"";return{c(){t=fn("g")},m(e,i){pn(e,t,i),t.innerHTML=o},p(e,i){268435456&i&&o!==(o=e[28].icon+"")&&(t.innerHTML=o)},d(e){e&&mn(t)}}}function qc(e){let t,o,i,n,r,a,s,l=e[28].label+"",c=e[28].icon&&Yc(e);return{c(){t=gn("span"),c&&c.c(),o=yn(),i=gn("span"),n=$n(l),Sn(i,"style",r=qt(e[14])?e[14](e[28].value):e[14]),Sn(i,"class",a=Us(["PinturaDropdownOptionLabel",e[10]])),Sn(t,"slot","option")},m(e,r){pn(e,t,r),c&&c.m(t,null),hn(t,o),hn(t,i),hn(i,n),s=!0},p(e,d){e[28].icon?c?(c.p(e,d),268435456&d&&sr(c,1)):(c=Yc(e),c.c(),sr(c,1),c.m(t,o)):c&&(rr(),lr(c,1,1,(()=>{c=null})),ar()),(!s||268435456&d)&&l!==(l=e[28].label+"")&&Cn(n,l),(!s||268451840&d&&r!==(r=qt(e[14])?e[14](e[28].value):e[14]))&&Sn(i,"style",r),(!s||1024&d&&a!==(a=Us(["PinturaDropdownOptionLabel",e[10]])))&&Sn(i,"class",a)},i(e){s||(sr(c),s=!0)},o(e){lr(c),s=!1},d(e){e&&mn(t),c&&c.d()}}}function Kc(e){let t,o,i,n,r;return o=new Nc({props:{name:e[7],value:e[9],selectedIndex:e[8],optionFilter:e[11],optionMapper:e[12],optionLabelClass:Us(["PinturaDropdownOptionLabel",e[10]]),optionGroupClass:"PinturaDropdownOptionGroup",optionClass:"PinturaDropdownOption",options:e[16],onchange:e[19],$$slots:{option:[qc,({option:e})=>({28:e}),({option:e})=>e?268435456:0],group:[Xc,({option:e})=>({28:e}),({option:e})=>e?268435456:0]},$$scope:{ctx:e}}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"class","PinturaDropdownPanel"),Sn(t,"slot","details")},m(a,s){pn(a,t,s),br(o,t,null),i=!0,n||(r=xn(t,"keydown",e[21]),n=!0)},p(e,t){const i={};128&t&&(i.name=e[7]),512&t&&(i.value=e[9]),256&t&&(i.selectedIndex=e[8]),2048&t&&(i.optionFilter=e[11]),4096&t&&(i.optionMapper=e[12]),1024&t&&(i.optionLabelClass=Us(["PinturaDropdownOptionLabel",e[10]])),65536&t&&(i.options=e[16]),805331968&t&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o),n=!1,r()}}}function Zc(e){let t,o,i;function n(t){e[26](t)}let r={onshow:e[20],buttonClass:Us(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"]),$$slots:{details:[Kc],label:[jc]},$$scope:{ctx:e}};return void 0!==e[17]&&(r.isActive=e[17]),t=new lc({props:r}),Un.push((()=>$r(t,"isActive",n))),{c(){yr(t.$$.fragment)},m(e,o){br(t,e,o),i=!0},p(e,[i]){const n={};33&i&&(n.buttonClass=Us(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"])),537264126&i&&(n.$$scope={dirty:i,ctx:e}),!o&&131072&i&&(o=!0,n.isActive=e[17],Kn((()=>o=!1))),t.$set(n)},i(e){i||(sr(t.$$.fragment,e),i=!0)},o(e){lr(t.$$.fragment,e),i=!1},d(e){xr(t,e)}}}function Jc(e,t,o){let i,n,{class:r}=t,{title:s}=t,{label:l}=t,{labelClass:c}=t,{innerClass:d}=t,{hideLabel:u=!1}=t,{icon:h}=t,{name:p}=t,{options:m=[]}=t,{selectedIndex:g=-1}=t,{value:f}=t,{optionLabelClass:$}=t,{optionFilter:y}=t,{optionMapper:b}=t,{optionIconStyle:x}=t,{optionLabelStyle:v}=t,{locale:w}=t,{onchange:S=a}=t,{onload:k=a}=t,{ondestroy:C=a}=t;let M;return zn((()=>k({options:m}))),On((()=>C({options:m}))),e.$$set=e=>{"class"in e&&o(0,r=e.class),"title"in e&&o(1,s=e.title),"label"in e&&o(2,l=e.label),"labelClass"in e&&o(3,c=e.labelClass),"innerClass"in e&&o(4,d=e.innerClass),"hideLabel"in e&&o(5,u=e.hideLabel),"icon"in e&&o(6,h=e.icon),"name"in e&&o(7,p=e.name),"options"in e&&o(22,m=e.options),"selectedIndex"in e&&o(8,g=e.selectedIndex),"value"in e&&o(9,f=e.value),"optionLabelClass"in e&&o(10,$=e.optionLabelClass),"optionFilter"in e&&o(11,y=e.optionFilter),"optionMapper"in e&&o(12,b=e.optionMapper),"optionIconStyle"in e&&o(13,x=e.optionIconStyle),"optionLabelStyle"in e&&o(14,v=e.optionLabelStyle),"locale"in e&&o(15,w=e.locale),"onchange"in e&&o(23,S=e.onchange),"onload"in e&&o(24,k=e.onload),"ondestroy"in e&&o(25,C=e.ondestroy)},e.$$.update=()=>{4227072&e.$$.dirty&&o(16,i=w?fc(m,w):m),66048&e.$$.dirty&&o(18,n=i.reduce(((e,t)=>{if(e)return e;const o=Array.isArray(t)?t:[t,t],[i,n]=o;return r=i,a=f,(Array.isArray(r)&&Array.isArray(a)?qr(r,a):r===a)?n:void 0;var r,a}),void 0)||(e=>{const t=e.find((e=>void 0===e[0]));if(t)return t[1]})(i))},[r,s,l,c,d,u,h,p,g,f,$,y,b,x,v,w,i,M,n,e=>{o(18,n=e.value),S(e),o(17,M=!1)},({e:e,panel:t})=>{if(e&&e.key&&/up|down/i.test(e.key))return t.querySelector("input:not([disabled])").focus();t.querySelector("fieldset").focus()},e=>{/tab/i.test(e.key)&&e.preventDefault()},m,S,k,C,function(e){M=e,o(17,M)}]}class Qc extends Sr{constructor(e){super(),wr(this,e,Jc,Zc,Gi,{class:0,title:1,label:2,labelClass:3,innerClass:4,hideLabel:5,icon:6,name:7,options:22,selectedIndex:8,value:9,optionLabelClass:10,optionFilter:11,optionMapper:12,optionIconStyle:13,optionLabelStyle:14,locale:15,onchange:23,onload:24,ondestroy:25})}}var ed=(e,t,o)=>(e-t)/(o-t);function td(e){let t;return{c(){t=fn("path"),Sn(t,"d","M8 12 h8 M12 8 v8")},m(e,o){pn(e,t,o)},d(e){e&&mn(t)}}}function od(e){let t;return{c(){t=fn("path"),Sn(t,"d","M9 12 h6")},m(e,o){pn(e,t,o)},d(e){e&&mn(t)}}}function id(e){let t,o,i,n,r,a,s,l,c,d,u,h,p,m,g,f,$,y;return u=new fl({props:{$$slots:{default:[td]},$$scope:{ctx:e}}}),m=new fl({props:{$$slots:{default:[od]},$$scope:{ctx:e}}}),{c(){t=gn("div"),o=gn("div"),i=gn("input"),n=yn(),r=gn("div"),a=yn(),s=gn("div"),l=gn("div"),c=yn(),d=gn("button"),yr(u.$$.fragment),h=yn(),p=gn("button"),yr(m.$$.fragment),Sn(i,"type","range"),Sn(i,"id",e[3]),Sn(i,"min",e[0]),Sn(i,"max",e[1]),Sn(i,"step",e[2]),i.value=e[8],Sn(r,"class","PinturaSliderTrack"),Sn(r,"style",e[4]),Sn(l,"class","PinturaSliderKnob"),Sn(l,"style",e[5]),Sn(s,"class","PinturaSliderKnobController"),Sn(s,"style",e[10]),Sn(o,"class","PinturaSliderControl"),Sn(d,"type","button"),Sn(d,"aria-label","Increase"),Sn(p,"type","button"),Sn(p,"aria-label","Decrease"),Sn(t,"class",g=Us(["PinturaSlider",e[7]])),Sn(t,"data-direction",e[6])},m(g,b){pn(g,t,b),hn(t,o),hn(o,i),e[22](i),hn(o,n),hn(o,r),hn(o,a),hn(o,s),hn(s,l),hn(t,c),hn(t,d),br(u,d,null),hn(t,h),hn(t,p),br(m,p,null),f=!0,$||(y=[xn(i,"pointerdown",e[13]),xn(i,"input",e[11]),xn(i,"nudge",e[12]),rn(Ml.call(null,i)),xn(d,"pointerdown",e[14](1)),xn(p,"pointerdown",e[14](-1))],$=!0)},p(e,o){(!f||8&o[0])&&Sn(i,"id",e[3]),(!f||1&o[0])&&Sn(i,"min",e[0]),(!f||2&o[0])&&Sn(i,"max",e[1]),(!f||4&o[0])&&Sn(i,"step",e[2]),(!f||256&o[0])&&(i.value=e[8]),(!f||16&o[0])&&Sn(r,"style",e[4]),(!f||32&o[0])&&Sn(l,"style",e[5]),(!f||1024&o[0])&&Sn(s,"style",e[10]);const n={};512&o[1]&&(n.$$scope={dirty:o,ctx:e}),u.$set(n);const a={};512&o[1]&&(a.$$scope={dirty:o,ctx:e}),m.$set(a),(!f||128&o[0]&&g!==(g=Us(["PinturaSlider",e[7]])))&&Sn(t,"class",g),(!f||64&o[0])&&Sn(t,"data-direction",e[6])},i(e){f||(sr(u.$$.fragment,e),sr(m.$$.fragment,e),f=!0)},o(e){lr(u.$$.fragment,e),lr(m.$$.fragment,e),f=!1},d(o){o&&mn(t),e[22](null),xr(u),xr(m),$=!1,Xi(y)}}}function nd(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,f,{min:$=0}=t,{max:y=100}=t,{step:b=1}=t,{id:x}=t,{value:v=0}=t,{trackStyle:w}=t,{knobStyle:S}=t,{onchange:k}=t,{direction:C="x"}=t,{getValue:M=W}=t,{setValue:T=W}=t,{class:R}=t;const P=e=>T(((e,t)=>(t=1/t,Math.round(e*t)/t))(jr(e,$,y),b)),A=(e,t)=>{o(15,v=P($+e/t*n)),v!==f&&(f=v,k(v))},I=e=>{const t=e[d]-g;A(m+t,p)},E=e=>{p=void 0,document.documentElement.removeEventListener("pointermove",I),document.documentElement.removeEventListener("pointerup",E),k(v)},L=()=>{o(15,v=P(i+B*b)),k(v)};let F,B=1,z=!1;const D=e=>{clearTimeout(F),z||L(),document.removeEventListener("pointerup",D)};return e.$$set=e=>{"min"in e&&o(0,$=e.min),"max"in e&&o(1,y=e.max),"step"in e&&o(2,b=e.step),"id"in e&&o(3,x=e.id),"value"in e&&o(15,v=e.value),"trackStyle"in e&&o(4,w=e.trackStyle),"knobStyle"in e&&o(5,S=e.knobStyle),"onchange"in e&&o(16,k=e.onchange),"direction"in e&&o(6,C=e.direction),"getValue"in e&&o(17,M=e.getValue),"setValue"in e&&o(18,T=e.setValue),"class"in e&&o(7,R=e.class)},e.$$.update=()=>{163840&e.$$.dirty[0]&&o(8,i=void 0!==v?M(v):0),3&e.$$.dirty[0]&&(n=y-$),259&e.$$.dirty[0]&&o(19,r=100*ed(i,$,y)),64&e.$$.dirty[0]&&o(20,a=C.toUpperCase()),64&e.$$.dirty[0]&&o(21,s="x"===C?"Width":"Height"),2097152&e.$$.dirty[0]&&(l="offset"+s),1048576&e.$$.dirty[0]&&(c="offset"+a),1048576&e.$$.dirty[0]&&(d="page"+a),1572864&e.$$.dirty[0]&&o(10,u=`transform: translate${a}(${r}%)`)},[$,y,b,x,w,S,C,R,i,h,u,e=>{p||(o(15,v=T(parseFloat(e.target.value))),v!==f&&(f=v,k(v)))},e=>{const t=h[l];A(i/n*t+e.detail[C],t)},e=>{e.stopPropagation(),p=h[l],m=e[c],g=e[d],A(m,p),document.documentElement.addEventListener("pointermove",I),document.documentElement.addEventListener("pointerup",E)},e=>t=>{B=e,z=!1,F=setInterval((()=>{z=!0,L()}),100),document.addEventListener("pointercancel",D),document.addEventListener("pointerup",D)},v,k,M,T,r,a,s,function(e){Un[e?"unshift":"push"]((()=>{h=e,o(9,h)}))}]}class rd extends Sr{constructor(e){super(),wr(this,e,nd,id,Gi,{min:0,max:1,step:2,id:3,value:15,trackStyle:4,knobStyle:5,onchange:16,direction:6,getValue:17,setValue:18,class:7},[-1,-1])}}function ad(e){let t,o;return t=new fl({props:{class:"PinturaButtonIcon",$$slots:{default:[sd]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};262148&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function sd(e){let t;return{c(){t=fn("g")},m(o,i){pn(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&mn(t)}}}function ld(e){let t,o,i,n,r,a,s,l,c=e[2]&&ad(e);return{c(){t=gn("span"),c&&c.c(),o=yn(),i=gn("span"),n=$n(e[8]),Sn(i,"class",r=Us(["PinturaButtonLabel",e[3],e[5]&&"implicit"])),Sn(t,"slot","label"),Sn(t,"title",a=mc(e[1],e[6])),Sn(t,"class",s=Us(["PinturaButtonInner",e[4]]))},m(e,r){pn(e,t,r),c&&c.m(t,null),hn(t,o),hn(t,i),hn(i,n),l=!0},p(e,d){e[2]?c?(c.p(e,d),4&d&&sr(c,1)):(c=ad(e),c.c(),sr(c,1),c.m(t,o)):c&&(rr(),lr(c,1,1,(()=>{c=null})),ar()),(!l||256&d)&&Cn(n,e[8]),(!l||40&d&&r!==(r=Us(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&Sn(i,"class",r),(!l||66&d&&a!==(a=mc(e[1],e[6])))&&Sn(t,"title",a),(!l||16&d&&s!==(s=Us(["PinturaButtonInner",e[4]])))&&Sn(t,"class",s)},i(e){l||(sr(c),l=!0)},o(e){lr(c),l=!1},d(e){e&&mn(t),c&&c.d()}}}function cd(e){let t,o,i,n,r;const a=[e[11],{value:e[7]},{onchange:e[10]}];let s={};for(let e=0;e<a.length;e+=1)s=Hi(s,a[e]);return o=new rd({props:s}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"slot","details")},m(a,s){pn(a,t,s),br(o,t,null),i=!0,n||(r=xn(t,"keydown",e[9]),n=!0)},p(e,t){const i=3200&t?gr(a,[2048&t&&fr(e[11]),128&t&&{value:e[7]},1024&t&&{onchange:e[10]}]):{};o.$set(i)},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o),n=!1,r()}}}function dd(e){let t,o;return t=new lc({props:{panelClass:"PinturaSliderPanel",buttonClass:Us(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"]),$$slots:{details:[cd],label:[ld]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,[o]){const i={};33&o&&(i.buttonClass=Us(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"])),264702&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function ud(e,t,o){const i=["class","title","label","icon","labelClass","innerClass","hideLabel","locale","value","onchange"];let n=on(t,i),{class:r}=t,{title:s}=t,{label:l=(e=>Math.round(e))}=t,{icon:c}=t,{labelClass:d}=t,{innerClass:u}=t,{hideLabel:h=!1}=t,{locale:p}=t,{value:m}=t,{onchange:g=a}=t;const{min:f,max:$,getValue:y=W}=n,b=e=>qt(l)?l(y(e),f,$):l;let x=b(m);return e.$$set=e=>{t=Hi(Hi({},t),tn(e)),o(11,n=on(t,i)),"class"in e&&o(0,r=e.class),"title"in e&&o(1,s=e.title),"label"in e&&o(12,l=e.label),"icon"in e&&o(2,c=e.icon),"labelClass"in e&&o(3,d=e.labelClass),"innerClass"in e&&o(4,u=e.innerClass),"hideLabel"in e&&o(5,h=e.hideLabel),"locale"in e&&o(6,p=e.locale),"value"in e&&o(7,m=e.value),"onchange"in e&&o(13,g=e.onchange)},[r,s,c,d,u,h,p,m,x,e=>{/tab/i.test(e.key)&&e.preventDefault()},e=>{o(8,x=b(e)),g(e)},n,l,g]}class hd extends Sr{constructor(e){super(),wr(this,e,ud,dd,Gi,{class:0,title:1,label:12,icon:2,labelClass:3,innerClass:4,hideLabel:5,locale:6,value:7,onchange:13})}}function pd(e,t,o){const i=e.slice();return i[7]=t[o][0],i[8]=t[o][1],i[9]=t[o][2],i[0]=t[o][3],i}function md(e){let t,o,i;const n=[e[9]];var r=e[1][e[7]]||e[7];function a(e){let t={};for(let e=0;e<n.length;e+=1)t=Hi(t,n[e]);return{props:t}}return r&&(t=new r(a())),{c(){t&&yr(t.$$.fragment),o=bn()},m(e,n){t&&br(t,e,n),pn(e,o,n),i=!0},p(e,i){const s=1&i?gr(n,[fr(e[9])]):{};if(r!==(r=e[1][e[7]]||e[7])){if(t){rr();const e=t;lr(e.$$.fragment,1,0,(()=>{xr(e,1)})),ar()}r?(t=new r(a()),yr(t.$$.fragment),sr(t.$$.fragment,1),br(t,o.parentNode,o)):t=null}else r&&t.$set(s)},i(e){i||(t&&sr(t.$$.fragment,e),i=!0)},o(e){t&&lr(t.$$.fragment,e),i=!1},d(e){e&&mn(o),t&&xr(t,e)}}}function gd(e){let t,o;return t=new ql({props:{name:e[7],attributes:e[2](e[9]),$$slots:{default:[bd]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};1&o&&(i.name=e[7]),1&o&&(i.attributes=e[2](e[9])),4097&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function fd(e){let t,o,i=e[9].innerHTML+"";return{c(){o=bn(),t=new Rn(o)},m(e,n){t.m(i,e,n),pn(e,o,n)},p(e,o){1&o&&i!==(i=e[9].innerHTML+"")&&t.p(i)},i:Vi,o:Vi,d(e){e&&mn(o),e&&t.d()}}}function $d(e){let t,o=e[9].textContent+"";return{c(){t=$n(o)},m(e,o){pn(e,t,o)},p(e,i){1&i&&o!==(o=e[9].textContent+"")&&Cn(t,o)},i:Vi,o:Vi,d(e){e&&mn(t)}}}function yd(e){let t,o;return t=new Sd({props:{items:e[0],discardEmptyItems:!0}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};1&o&&(i.items=e[0]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function bd(e){let t,o,i,n;const r=[yd,$d,fd],a=[];function s(e,t){return e[0]&&e[0].length?0:e[9].textContent?1:e[9].innerHTML?2:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=yn()},m(e,o){~t&&a[t].m(e,o),pn(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(rr(),lr(a[l],1,1,(()=>{a[l]=null})),ar()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sr(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(sr(o),n=!0)},o(e){lr(o),n=!1},d(e){~t&&a[t].d(e),e&&mn(i)}}}function xd(e,t){let o,i,n,r,a,s;const l=[gd,md],c=[];function d(e,t){return 1&t&&(i=!e[3](e[7])),i?0:1}return n=d(t,-1),r=c[n]=l[n](t),{key:e,first:null,c(){o=bn(),r.c(),a=bn(),this.first=o},m(e,t){pn(e,o,t),c[n].m(e,t),pn(e,a,t),s=!0},p(e,o){let i=n;n=d(t=e,o),n===i?c[n].p(t,o):(rr(),lr(c[i],1,1,(()=>{c[i]=null})),ar(),r=c[n],r?r.p(t,o):(r=c[n]=l[n](t),r.c()),sr(r,1),r.m(a.parentNode,a))},i(e){s||(sr(r),s=!0)},o(e){lr(r),s=!1},d(e){e&&mn(o),c[n].d(e),e&&mn(a)}}}function vd(e){let t,o,i=[],n=new Map,r=e[0];const a=e=>e[8];for(let t=0;t<r.length;t+=1){let o=pd(e,r,t),s=a(o);n.set(s,i[t]=xd(s,o))}return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=bn()},m(e,n){for(let t=0;t<i.length;t+=1)i[t].m(e,n);pn(e,t,n),o=!0},p(e,[o]){15&o&&(r=e[0],rr(),i=mr(i,o,a,1,e,r,n,t.parentNode,pr,xd,t,pd),ar())},i(e){if(!o){for(let e=0;e<r.length;e+=1)sr(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)lr(i[e]);o=!1},d(e){for(let t=0;t<i.length;t+=1)i[t].d(e);e&&mn(t)}}}function wd(e,t,o){let i,{items:n}=t,{discardEmptyItems:r=!0}=t;const a={Button:Sl,Dropdown:Qc,Slider:hd},s=e=>!k(e)||!!a[e],l=e=>{if(!e)return!1;const[t,,o,i=[]]=e;return!!s(t)||(i.some(l)||o.textContent||o.innerHTML)};return e.$$set=e=>{"items"in e&&o(4,n=e.items),"discardEmptyItems"in e&&o(5,r=e.discardEmptyItems)},e.$$.update=()=>{48&e.$$.dirty&&o(0,i=(n&&r?n.filter(l):n)||[])},[i,a,(e={})=>{const{textContent:t,innerHTML:o,...i}=e;return i},s,n,r]}class Sd extends Sr{constructor(e){super(),wr(this,e,wd,vd,Gi,{items:4,discardEmptyItems:5})}}var kd=(e,t,o,i=(e=>e*e*(3-2*e)))=>i(Math.max(0,Math.min(1,(o-e)/(t-e))));const Cd=["file","size","loadState","processState","cropAspectRatio","cropLimitToImage","crop","cropMinSize","cropMaxSize","cropRange","cropOrigin","cropRectAspectRatio","rotation","rotationRange","targetSize","flipX","flipY","perspectiveX","perspectiveY","perspective","colorMatrix","convolutionMatrix","gamma","vignette","noise","redaction","decoration","annotation","frame","backgroundColor","state"];var Md=(e,t)=>new CustomEvent("ping",{detail:{type:e,data:t},cancelable:!0,bubbles:!0}),Td=(e,t)=>(t?fs(e,t):e).replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase(),Rd=(e,t=W)=>{const{subscribe:o,set:i}=Mr(void 0);return{subscribe:o,unsubscribe:((e,t)=>{const o=matchMedia(e);return o.addListener(t),t(o),{get matches(){return o.matches},destroy:()=>o.removeListener(t)}})(e,(({matches:e})=>i(t(e)))).destroy}},Pd=(e,t,o)=>new Promise(((i,n)=>{(async()=>{const r=await t.read(e),a=e=>I(e,o).then((e=>t.apply(e,r))).then(i).catch(n);if(T(e)||!M()||gt())return a(e);let s;try{s=await A(((e,t)=>createImageBitmap(e).then((e=>t(null,e))).catch(t)),[e])}catch(e){}s&&s.width?await p()?u()&&window.chrome&&r>1?i(await(async e=>m(await b(e)))(s)):i(s):i(t.apply(s,r)):a(e)})()})),Ad=(e,t)=>new Promise((async o=>{if(e.width<t.width&&e.height<t.height)return o(e);const i=Math.min(t.width/e.width,t.height/e.height),n=i*e.width,r=i*e.height,a=g("canvas",{width:n,height:r}),s=a.getContext("2d"),l=y(e)?await b(e):e;s.drawImage(l,0,0,n,r),o(m(a))})),Id=e=>(e=e.trim(),/^rgba/.test(e)?e.substr(5).split(",").map(parseFloat).map(((e,t)=>e/(3===t?1:255))):/^rgb/.test(e)?e.substr(4).split(",").map(parseFloat).map((e=>e/255)):/^#/.test(e)?(e=>{const[,t,o,i]=e.split("");e=4===e.length?`#${t}${t}${o}${o}${i}${i}`:e;const[,n,r,a]=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return[n,r,a].map((e=>parseInt(e,16)/255))})(e):/[0-9]{1,3}\s?,\s?[0-9]{1,3}\s?,\s?[0-9]{1,3}/.test(e)?e.split(",").map((e=>parseInt(e,10))).map((e=>e/255)):void 0);let Ed=null;var Ld=()=>{if(null===Ed){const e=g("canvas");Ed=!!hs(e),$(e)}return Ed};const Fd=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Bd={precision:1e-4},zd={precision:.01*Bd.precision};var Dd=()=>{const e=[],t=[],o=[],i=()=>{t.forEach((e=>e(o)))},n=t=>{t.unsub=t.subscribe((n=>((t,n)=>{const r=e.indexOf(t);r<0||(o[r]=n,i())})(t,n))),i()};return{get length(){return e.length},clear:()=>{e.forEach((e=>e.unsub())),e.length=0,o.length=0},unshift:t=>{e.unshift(t),n(t)},get:t=>e[t],push:t=>{e.push(t),n(t)},remove:t=>{t.unsub();const i=e.indexOf(t);e.splice(i,1),o.splice(i,1)},forEach:t=>e.forEach(t),filter:t=>e.filter(t),subscribe:e=>(t.push(e),()=>{t.splice(t.indexOf(e),1)})}},Od=e=>e[0]<.25&&e[1]<.25&&e[2]<.25;const{window:_d}=ur;function Wd(e){let t,o,i,n=e[25]&&Vd(e),r=e[26]&&Kd(e);return{c(){n&&n.c(),t=yn(),r&&r.c(),o=bn()},m(e,a){n&&n.m(e,a),pn(e,t,a),r&&r.m(e,a),pn(e,o,a),i=!0},p(e,i){e[25]?n?(n.p(e,i),33554432&i[0]&&sr(n,1)):(n=Vd(e),n.c(),sr(n,1),n.m(t.parentNode,t)):n&&(rr(),lr(n,1,1,(()=>{n=null})),ar()),e[26]?r?(r.p(e,i),67108864&i[0]&&sr(r,1)):(r=Kd(e),r.c(),sr(r,1),r.m(o.parentNode,o)):r&&(rr(),lr(r,1,1,(()=>{r=null})),ar())},i(e){i||(sr(n),sr(r),i=!0)},o(e){lr(n),lr(r),i=!1},d(e){n&&n.d(e),e&&mn(t),r&&r.d(e),e&&mn(o)}}}function Vd(e){let t,o,i,n,r,a;const s=[Hd,Nd],l=[];function c(e,t){return e[23]?0:e[13]?1:-1}return~(i=c(e))&&(n=l[i]=s[i](e)),{c(){t=gn("div"),o=gn("p"),n&&n.c(),Sn(o,"style",e[38]),Sn(t,"class","PinturaStatus"),Sn(t,"style",r="opacity: "+e[24])},m(e,n){pn(e,t,n),hn(t,o),~i&&l[i].m(o,null),a=!0},p(e,d){let u=i;i=c(e),i===u?~i&&l[i].p(e,d):(n&&(rr(),lr(l[u],1,1,(()=>{l[u]=null})),ar()),~i?(n=l[i],n?n.p(e,d):(n=l[i]=s[i](e),n.c()),sr(n,1),n.m(o,null)):n=null),(!a||128&d[1])&&Sn(o,"style",e[38]),(!a||16777216&d[0]&&r!==(r="opacity: "+e[24]))&&Sn(t,"style",r)},i(e){a||(sr(n),a=!0)},o(e){lr(n),a=!1},d(e){e&&mn(t),~i&&l[i].d()}}}function Nd(e){let t,o,i,n;t=new Dl({props:{text:e[13].text||"",onmeasure:e[126]}});let r=e[13].aside&&Ud(e);return{c(){yr(t.$$.fragment),o=yn(),r&&r.c(),i=bn()},m(e,a){br(t,e,a),pn(e,o,a),r&&r.m(e,a),pn(e,i,a),n=!0},p(e,o){const n={};8192&o[0]&&(n.text=e[13].text||""),t.$set(n),e[13].aside?r?(r.p(e,o),8192&o[0]&&sr(r,1)):(r=Ud(e),r.c(),sr(r,1),r.m(i.parentNode,i)):r&&(rr(),lr(r,1,1,(()=>{r=null})),ar())},i(e){n||(sr(t.$$.fragment,e),sr(r),n=!0)},o(e){lr(t.$$.fragment,e),lr(r),n=!1},d(e){xr(t,e),e&&mn(o),r&&r.d(e),e&&mn(i)}}}function Hd(e){let t,o,i,n;return t=new Dl({props:{text:e[23],onmeasure:e[126]}}),i=new Hl({props:{class:"PinturaStatusIcon",offset:e[42],opacity:e[43],$$slots:{default:[qd]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment),o=yn(),yr(i.$$.fragment)},m(e,r){br(t,e,r),pn(e,o,r),br(i,e,r),n=!0},p(e,o){const n={};8388608&o[0]&&(n.text=e[23]),t.$set(n);const r={};2048&o[1]&&(r.offset=e[42]),4096&o[1]&&(r.opacity=e[43]),4&o[0]|134217728&o[11]&&(r.$$scope={dirty:o,ctx:e}),i.$set(r)},i(e){n||(sr(t.$$.fragment,e),sr(i.$$.fragment,e),n=!0)},o(e){lr(t.$$.fragment,e),lr(i.$$.fragment,e),n=!1},d(e){xr(t,e),e&&mn(o),xr(i,e)}}}function Ud(e){let t,o;return t=new Hl({props:{class:"PinturaStatusButton",offset:e[42],opacity:e[43],$$slots:{default:[Yd]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};2048&o[1]&&(i.offset=e[42]),4096&o[1]&&(i.opacity=e[43]),8192&o[0]|134217728&o[11]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function jd(e){let t,o;return t=new Wl({props:{progress:e[13].progressIndicator.progress}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};8192&o[0]&&(i.progress=e[13].progressIndicator.progress),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Xd(e){let t,o;const i=[e[13].closeButton,{hideLabel:!0}];let n={};for(let e=0;e<i.length;e+=1)n=Hi(n,i[e]);return t=new Sl({props:n}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const n=8192&o[0]?gr(i,[fr(e[13].closeButton),i[1]]):{};t.$set(n)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Yd(e){let t,o,i,n=e[13].progressIndicator.visible&&jd(e),r=e[13].closeButton&&e[13].text&&Xd(e);return{c(){n&&n.c(),t=yn(),r&&r.c(),o=bn()},m(e,a){n&&n.m(e,a),pn(e,t,a),r&&r.m(e,a),pn(e,o,a),i=!0},p(e,i){e[13].progressIndicator.visible?n?(n.p(e,i),8192&i[0]&&sr(n,1)):(n=jd(e),n.c(),sr(n,1),n.m(t.parentNode,t)):n&&(rr(),lr(n,1,1,(()=>{n=null})),ar()),e[13].closeButton&&e[13].text?r?(r.p(e,i),8192&i[0]&&sr(r,1)):(r=Xd(e),r.c(),sr(r,1),r.m(o.parentNode,o)):r&&(rr(),lr(r,1,1,(()=>{r=null})),ar())},i(e){i||(sr(n),sr(r),i=!0)},o(e){lr(n),lr(r),i=!1},d(e){n&&n.d(e),e&&mn(t),r&&r.d(e),e&&mn(o)}}}function Gd(e){let t,o=e[2].iconSupportError+"";return{c(){t=fn("g")},m(e,i){pn(e,t,i),t.innerHTML=o},p(e,i){4&i[0]&&o!==(o=e[2].iconSupportError+"")&&(t.innerHTML=o)},d(e){e&&mn(t)}}}function qd(e){let t,o;return t=new fl({props:{$$slots:{default:[Gd]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};4&o[0]|134217728&o[11]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Kd(e){let t,o,i,n,r,a,s,l,c,d=e[6]&&Zd(e),u=e[17]&&e[15]&&Jd(e);const h=[iu,ou],p=[];function m(e,t){return e[17]?0:1}return i=m(e),n=p[i]=h[i](e),a=new Hs({props:{animate:e[18],pixelRatio:e[46],backgroundColor:e[47],maskRect:e[37],maskOpacity:e[36]?e[36].maskOpacity:1,maskFrameOpacity:"frame"===e[48]&&e[49]?0:.95,images:e[22],interfaceImages:e[50],loadImageData:e[8],willRender:e[282]}}),{c(){d&&d.c(),t=yn(),u&&u.c(),o=yn(),n.c(),r=yn(),yr(a.$$.fragment),s=yn(),l=gn("div"),Sn(l,"class","PinturaRootPortal")},m(n,h){d&&d.m(n,h),pn(n,t,h),u&&u.m(n,h),pn(n,o,h),p[i].m(n,h),pn(n,r,h),br(a,n,h),pn(n,s,h),pn(n,l,h),e[283](l),c=!0},p(e,s){e[6]?d?(d.p(e,s),64&s[0]&&sr(d,1)):(d=Zd(e),d.c(),sr(d,1),d.m(t.parentNode,t)):d&&(rr(),lr(d,1,1,(()=>{d=null})),ar()),e[17]&&e[15]?u?(u.p(e,s),163840&s[0]&&sr(u,1)):(u=Jd(e),u.c(),sr(u,1),u.m(o.parentNode,o)):u&&(rr(),lr(u,1,1,(()=>{u=null})),ar());let l=i;i=m(e),i===l?p[i].p(e,s):(rr(),lr(p[l],1,1,(()=>{p[l]=null})),ar(),n=p[i],n?n.p(e,s):(n=p[i]=h[i](e),n.c()),sr(n,1),n.m(r.parentNode,r));const c={};262144&s[0]&&(c.animate=e[18]),32768&s[1]&&(c.pixelRatio=e[46]),65536&s[1]&&(c.backgroundColor=e[47]),64&s[1]&&(c.maskRect=e[37]),32&s[1]&&(c.maskOpacity=e[36]?e[36].maskOpacity:1),393216&s[1]&&(c.maskFrameOpacity="frame"===e[48]&&e[49]?0:.95),4194304&s[0]&&(c.images=e[22]),524288&s[1]&&(c.interfaceImages=e[50]),256&s[0]&&(c.loadImageData=e[8]),268435488&s[0]|15728640&s[1]&&(c.willRender=e[282]),a.$set(c)},i(e){c||(sr(d),sr(u),sr(n),sr(a.$$.fragment,e),c=!0)},o(e){lr(d),lr(u),lr(n),lr(a.$$.fragment,e),c=!1},d(n){d&&d.d(n),n&&mn(t),u&&u.d(n),n&&mn(o),p[i].d(n),n&&mn(r),xr(a,n),n&&mn(s),n&&mn(l),e[283](null)}}}function Zd(e){let t,o,i,n,r;return o=new Sd({props:{items:e[39]}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"class","PinturaNav PinturaNavTools")},m(a,s){pn(a,t,s),br(o,t,null),i=!0,n||(r=[xn(t,"measure",e[267]),rn(as.call(null,t))],n=!0)},p(e,t){const i={};256&t[1]&&(i.items=e[39]),o.$set(i)},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o),n=!1,Xi(r)}}}function Jd(e){let t,o,i;return o=new Ll({props:{elasticity:e[4]*cu,scrollDirection:e[34]?"y":"x",$$slots:{default:[tu]},$$scope:{ctx:e}}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"class","PinturaNav PinturaNavMain")},m(e,n){pn(e,t,n),br(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.elasticity=e[4]*cu),8&t[1]&&(i.scrollDirection=e[34]?"y":"x"),1074266112&t[0]|1&t[1]|134217728&t[11]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o)}}}function Qd(e){let t,o=e[367].icon+"";return{c(){t=fn("g")},m(e,i){pn(e,t,i),t.innerHTML=o},p(e,i){67108864&i[11]&&o!==(o=e[367].icon+"")&&(t.innerHTML=o)},d(e){e&&mn(t)}}}function eu(e){let t,o,i,n,r,a=e[367].label+"";return t=new fl({props:{$$slots:{default:[Qd]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment),o=yn(),i=gn("span"),n=$n(a)},m(e,a){br(t,e,a),pn(e,o,a),pn(e,i,a),hn(i,n),r=!0},p(e,o){const i={};201326592&o[11]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i),(!r||67108864&o[11])&&a!==(a=e[367].label+"")&&Cn(n,a)},i(e){r||(sr(t.$$.fragment,e),r=!0)},o(e){lr(t.$$.fragment,e),r=!1},d(e){xr(t,e),e&&mn(o),e&&mn(i)}}}function tu(e){let t,o;const i=[e[30],{tabs:e[31]}];let n={$$slots:{default:[eu,({tab:e})=>({367:e}),({tab:e})=>[0,0,0,0,0,0,0,0,0,0,0,e?67108864:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=Hi(n,i[e]);return t=new Js({props:n}),t.$on("select",e[268]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const n=1073741824&o[0]|1&o[1]?gr(i,[1073741824&o[0]&&fr(e[30]),1&o[1]&&{tabs:e[31]}]):{};201326592&o[11]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function ou(e){let t,o,i;function n(t){e[277](t)}let r={class:"PinturaMain",content:{...e[20].find(e[276]),props:e[7][e[19]]},locale:e[2],isAnimated:e[18],stores:e[115]};return void 0!==e[0][e[19]]&&(r.component=e[0][e[19]]),t=new pl({props:r}),Un.push((()=>$r(t,"component",n))),t.$on("measure",e[278]),t.$on("show",e[279]),t.$on("hide",e[280]),t.$on("fade",e[281]),{c(){yr(t.$$.fragment)},m(e,o){br(t,e,o),i=!0},p(e,i){const n={};1572992&i[0]&&(n.content={...e[20].find(e[276]),props:e[7][e[19]]}),4&i[0]&&(n.locale=e[2]),262144&i[0]&&(n.isAnimated=e[18]),!o&&524289&i[0]&&(o=!0,n.component=e[0][e[19]],Kn((()=>o=!1))),t.$set(n)},i(e){i||(sr(t.$$.fragment,e),i=!0)},o(e){lr(t.$$.fragment,e),i=!1},d(e){xr(t,e)}}}function iu(e){let t,o;const i=[{class:"PinturaMain"},{visible:e[27]},e[30],{panels:e[32]}];let n={$$slots:{default:[nu,({panel:e})=>({366:e}),({panel:e})=>[0,0,0,0,0,0,0,0,0,0,0,e?33554432:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=Hi(n,i[e]);return t=new dl({props:n}),t.$on("measure",e[275]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const n=1207959552&o[0]|2&o[1]?gr(i,[i[0],134217728&o[0]&&{visible:e[27]},1073741824&o[0]&&fr(e[30]),2&o[1]&&{panels:e[32]}]):{};138150021&o[0]|16384&o[1]|167772160&o[11]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function nu(e){let t,o,i;function n(...t){return e[269](e[366],...t)}function r(t){e[270](t,e[366])}let a={content:{...e[20].find(n),props:e[7][e[366]]},locale:e[2],isActive:e[366]===e[19],isAnimated:e[18],stores:e[115]};return void 0!==e[0][e[366]]&&(a.component=e[0][e[366]]),t=new pl({props:a}),Un.push((()=>$r(t,"component",r))),t.$on("measure",e[271]),t.$on("show",(function(){return e[272](e[366])})),t.$on("hide",(function(){return e[273](e[366])})),t.$on("fade",(function(...t){return e[274](e[366],...t)})),{c(){yr(t.$$.fragment)},m(e,o){br(t,e,o),i=!0},p(i,r){e=i;const a={};1048704&r[0]|33554432&r[11]&&(a.content={...e[20].find(n),props:e[7][e[366]]}),4&r[0]&&(a.locale=e[2]),524288&r[0]|33554432&r[11]&&(a.isActive=e[366]===e[19]),262144&r[0]&&(a.isAnimated=e[18]),!o&&1&r[0]|33554432&r[11]&&(o=!0,a.component=e[0][e[366]],Kn((()=>o=!1))),t.$set(a)},i(e){i||(sr(t.$$.fragment,e),i=!0)},o(e){lr(t.$$.fragment,e),i=!1},d(e){xr(t,e)}}}function ru(e){let t,o;return{c(){t=gn("span"),Sn(t,"class","PinturaEditorOverlay"),Sn(t,"style",o="opacity:"+e[55])},m(e,o){pn(e,t,o)},p(e,i){16777216&i[1]&&o!==(o="opacity:"+e[55])&&Sn(t,"style",o)},d(e){e&&mn(t)}}}function au(e){let t,o,i,n,r;qn(e[266]);let a=e[40]&&Wd(e),s=e[55]>0&&ru(e);return{c(){t=gn("div"),a&&a.c(),o=yn(),s&&s.c(),Sn(t,"id",e[3]),Sn(t,"class",e[33]),Sn(t,"data-env",e[35])},m(l,c){pn(l,t,c),a&&a.m(t,null),hn(t,o),s&&s.m(t,null),e[284](t),i=!0,n||(r=[xn(_d,"keydown",e[131]),xn(_d,"keyup",e[132]),xn(_d,"blur",e[133]),xn(_d,"paste",e[136]),xn(_d,"resize",e[266]),xn(t,"ping",(function(){Yi(e[41])&&e[41].apply(this,arguments)})),xn(t,"contextmenu",e[134]),xn(t,"touchstart",e[127],{passive:!1}),xn(t,"touchmove",e[128]),xn(t,"pointermove",e[129]),xn(t,"transitionend",e[116]),xn(t,"dropfiles",e[135]),xn(t,"measure",e[285]),rn(as.call(null,t,{observeViewRect:!0})),rn(ss.call(null,t)),rn(cs.call(null,t))],n=!0)},p(n,r){(e=n)[40]?a?(a.p(e,r),512&r[1]&&sr(a,1)):(a=Wd(e),a.c(),sr(a,1),a.m(t,o)):a&&(rr(),lr(a,1,1,(()=>{a=null})),ar()),e[55]>0?s?s.p(e,r):(s=ru(e),s.c(),s.m(t,null)):s&&(s.d(1),s=null),(!i||8&r[0])&&Sn(t,"id",e[3]),(!i||4&r[1])&&Sn(t,"class",e[33]),(!i||16&r[1])&&Sn(t,"data-env",e[35])},i(e){i||(sr(a),i=!0)},o(e){lr(a),i=!1},d(o){o&&mn(t),a&&a.d(),s&&s.d(),e[284](null),n=!1,Xi(r)}}}const su="stage-overlay",lu=.85,cu=10;function du(e,t,o){let i,n,r,s,l,c,d,u,h,p,f,y,b,x,v,w,S,C,M,T,P,A,I,E,L,F,B,z,D,O,_,V,N,H,U,j,X,Y,q,J,Q,ee,te,oe,ie,ae,se,le,ce,de,ue,he,pe,me,ge,fe,$e,ye,xe,ve,we,Se,ke,Me,Te,Re,Pe,Ae,Fe,Be,ze,De,Xe,Ye,Ke,Ze,Qe,et,ot,nt,rt,at,st,lt,ct,dt,ht,pt,mt,gt,ft,$t,yt,bt,xt,vt,wt,St,kt,Ct,Mt,Tt,Rt,Pt,At,Et,Lt,Ft,Bt,zt,Dt,Ot,_t,Wt,Vt,Nt,Ht,Ut,jt,Yt,Gt,Kt,Zt,Jt,Qt,eo,to,io,no,ro,ao,so,lo,co,uo,ho,po,mo,go,yo,bo,xo,vo,wo,So,Mo=Vi,To=Vi;Zi(e,Ka,(e=>o(206,At=e))),e.$$.on_destroy.push((()=>Mo())),e.$$.on_destroy.push((()=>To()));const Ro=vi(),Io=_n();let{class:Eo}=t,{layout:Fo}=t,{stores:Bo}=t,{locale:zo}=t,{id:Do}=t,{util:Oo}=t,{utils:_o}=t,{animations:Wo="auto"}=t,{disabled:Vo=!1}=t,{status:No}=t,{previewUpscale:Ho=!1}=t,{elasticityMultiplier:Uo=10}=t,{willRevert:jo=(()=>Promise.resolve(!0))}=t,{willProcessImage:Xo=(()=>Promise.resolve(!0))}=t,{willRenderCanvas:Yo=W}=t,{willRenderToolbar:Go=W}=t,{willSetHistoryInitialState:qo=W}=t,{enableButtonExport:Ko=!0}=t,{enableButtonRevert:Zo=!0}=t,{enableNavigateHistory:Jo=!0}=t,{enableToolbar:Qo=!0}=t,{enableUtils:ei=!0}=t,{enableButtonClose:ti=!1}=t,{enableDropImage:oi=!1}=t,{enablePasteImage:ii=!1}=t,{previewImageDataMaxSize:ni}=t,{layoutDirectionPreference:ri="auto"}=t,{layoutHorizontalUtilsPreference:ai="left"}=t,{layoutVerticalUtilsPreference:si="bottom"}=t,{imagePreviewSrc:li}=t,{imageOrienter:ci={read:()=>1,apply:e=>e}}=t,{pluginComponents:ui}=t,{pluginOptions:hi={}}=t;const pi=Ro.sub,mi={};let{root:$i}=t,xi=[];const wi=qa();Zi(e,wi,(e=>o(55,So=e)));const Si=Ls()||1024,ki=be(Si,Si),Ci=ua();let{imageSourceToImageData:Mi=(e=>k(e)?fetch(e).then((e=>{if(200!==e.status)throw`${e.status} (${e.statusText})`;return e.blob()})).then((e=>Pd(e,ci,Ci))).then((e=>Ad(e,r))):ut(e)?new Promise((t=>t(m(e)))):Pd(e,ci,Ci).then((e=>Ad(e,r))))}=t;const Ti=(()=>{let e,t;const o=Cd.reduce(((e,o)=>(e[o]=function(e,t,o){let i=[];return{set:t,update:o,publish:e=>{i.forEach((t=>t(e)))},subscribe:t=>(i.push(t),e(t),()=>{i=i.filter((e=>e!==t))})}}((e=>{if(!t)return e();t.stores[o].subscribe(e)()}),(e=>{t&&t.stores[o].set(e)}),(e=>{t&&t.stores[o].update(e)})),e)),{});return{update:i=>{if(t=i,e&&(e.forEach((e=>e())),e=void 0),!i)return o.file.publish(void 0),void o.loadState.publish(void 0);e=Cd.map((e=>i.stores[e].subscribe((t=>{o[e].publish(t)}))))},stores:o}})(),{file:Ri,size:Pi,loadState:Ai,processState:Ii,cropAspectRatio:Ei,cropLimitToImage:Li,crop:Fi,cropMinSize:Bi,cropMaxSize:zi,cropRange:Di,cropOrigin:Oi,cropRectAspectRatio:Ni,rotation:Hi,rotationRange:Ui,targetSize:ji,flipX:Xi,flipY:Yi,backgroundColor:Gi,colorMatrix:Ji,convolutionMatrix:Qi,gamma:en,vignette:tn,noise:on,decoration:rn,annotation:an,redaction:sn,frame:ln,state:cn}=Ti.stores;Zi(e,Ri,(e=>o(201,Tt=e))),Zi(e,Pi,(e=>o(186,ft=e))),Zi(e,Ai,(e=>o(180,ot=e))),Zi(e,Ii,(e=>o(245,jt=e))),Zi(e,Ei,(e=>o(293,Qe=e))),Zi(e,Fi,(e=>o(181,nt=e))),Zi(e,ji,(e=>o(185,mt=e))),Zi(e,Gi,(e=>o(265,io=e))),Zi(e,rn,(e=>o(52,xo=e))),Zi(e,an,(e=>o(51,bo=e))),Zi(e,sn,(e=>o(262,eo=e))),Zi(e,ln,(e=>o(53,vo=e))),Zi(e,cn,(e=>o(302,Et=e)));const{images:dn,shapePreprocessor:un,imageScrambler:hn}=Bo;Zi(e,dn,(e=>o(177,Ye=e))),Zi(e,un,(e=>o(178,Ke=e))),Zi(e,hn,(e=>o(264,to=e))),cn.subscribe((e=>Ro.pub("update",e)));const pn=Mr();Zi(e,pn,(e=>o(48,mo=e)));const mn=Mr([0,0,0]);Zi(e,mn,(e=>o(47,po=e)));const gn=Mr([1,1,1]);Zi(e,gn,(e=>o(304,no=e)));const fn=qa();Zi(e,fn,(e=>o(305,ro=e)));const $n=Mr();Zi(e,$n,(e=>o(16,Ze=e)));const yn=Mr();Zi(e,yn,(e=>o(179,et=e)));const bn=Mr(Ee());Zi(e,bn,(e=>o(29,Lt=e)));const xn=Mr(Ee());Zi(e,xn,(e=>o(44,co=e)));const vn=Mr();Zi(e,vn,(e=>o(45,uo=e)));const wn=Rd("(pointer: fine)",(e=>e?"pointer-fine":"pointer-coarse"));Zi(e,wn,(e=>o(230,Dt=e)));const Sn=Rd("(hover: hover)",(e=>e?"pointer-hover":"pointer-no-hover"));Zi(e,Sn,(e=>o(231,Ot=e)));const kn=Mr(!1);Zi(e,kn,(e=>o(182,at=e)));const Cn=Cr(void 0,(e=>{const t=qa(0),o=[kn.subscribe((e=>{t.set(e?1:0)})),t.subscribe(e)];return()=>o.forEach((e=>e()))}));Zi(e,Cn,(e=>o(306,ao=e)));const Mn=Mr(Ho);Zi(e,Mn,(e=>o(296,lt=e)));const Tn=Mr();Zi(e,Tn,(e=>o(295,st=e)));const Rn=Mr();Zi(e,Rn,(e=>o(294,rt=e)));const Pn=Cr(void 0,(e=>{const t=qa(void 0,{precision:1e-4}),o=[Fi.subscribe((()=>{if(!nt)return;const e=void 0===rt||at,o=Rl(nt,rt,5*Uo);t.set(o,{hard:e})})),t.subscribe(e)];return()=>o.forEach((e=>e()))})),An=Mr();Zi(e,An,(e=>o(297,ct=e)));const In=Mr();Zi(e,In,(e=>o(301,yt=e)));const En=Mr(void 0);Zi(e,En,(e=>o(298,ht=e)));let Ln={left:0,right:0,top:0,bottom:0};const Fn=Tr([ln,An],(([e,t],o)=>{t||o(Ln);let i=Hn(t,e);fo(Ln.top,4)===fo(i.top,4)&&fo(Ln.bottom,4)===fo(i.bottom,4)&&fo(Ln.right,4)===fo(i.right,4)&&fo(Ln.left,4)===fo(i.left,4)||(Ln=i,o(i))})),Bn=Tr([Fn],(([e],t)=>{t(Object.values(e).some((e=>e>0)))}));let zn={left:0,right:0,top:0,bottom:0};const Dn=Tr([pn,ln,An],(([e,t,o],i)=>{let n;o||i(zn),n="frame"===e?Hn(o,t):{left:0,right:0,top:0,bottom:0},fo(zn.top,4)===fo(n.top,4)&&fo(zn.bottom,4)===fo(n.bottom,4)&&fo(zn.right,4)===fo(n.right,4)&&fo(zn.left,4)===fo(n.left,4)||(zn=n,i(n))})),On=Tr([Dn],(([e],t)=>{t(Object.values(e).some((e=>e>0)))}));Zi(e,On,(e=>o(49,go=e)));const Vn=Tr([vn,bn,xn,Dn],(([e,t,o,n],r)=>{if(!e)return r(void 0);let a=0;1!==v.length||i||(a=o.y+o.height),r(Oe(e.x+t.x+n.top,e.y+t.y+a+n.top,e.width-(n.left+n.right),e.height-(n.top+n.bottom)))}));Zi(e,Vn,(e=>o(184,pt=e)));const Nn=Tr([Vn,Fi],(([e,t],o)=>{if(!e||!t||!(!st&&!rt))return;const i=Math.min(e.width/t.width,e.height/t.height);o(lt?i:Math.min(1,i))}));Zi(e,Nn,(e=>o(299,gt=e)));const Hn=(e,t)=>{if(!t||!e)return{top:0,right:0,bottom:0,left:0};const o=fi(t,e,s),i=gi(o,e);return{top:Math.abs(i.top),right:Math.abs(i.right),bottom:Math.abs(i.bottom),left:Math.abs(i.left)}},jn=Cr(void 0,(e=>{const t=qa(void 0,{precision:1e-4}),o=()=>{if(!ct)return;const e=at||!dt,o=Rl(ct,ht,1*Uo);if(o.width<0&&(o.width=0,o.x=ct.x),o.height<0&&(o.height=0,o.y=ct.y),We(o,pt),nt&&"resize"===M){const e=mt||nt;Ve(o,e.width/ct.width||e.height/ct.height)}t.set(o,{hard:e})},i=[Vn.subscribe(o),An.subscribe(o),ji.subscribe(o),ln.subscribe(o),t.subscribe(e)];return()=>i.forEach((e=>e()))}));let Xn;Zi(e,jn,(e=>o(37,Ht=e)));const Yn=e=>{if(i&&Xn&&Ue(Xn,e))return;Xn=e;const t=nt.width<=e.width&&nt.height<=e.height?qe(e,Ne(Ie(nt),gt||1)):Je(e,je(nt||ft));An.set(t)};let Gn,qn=!1;Nn.subscribe((e=>{!qn&&void 0!==e&&nt&&(Yn(pt),qn=!0)})),Vn.subscribe((e=>{e&&void 0!==gt&&nt&&Yn(e)})),In.subscribe((e=>{if(!e)return Gn=void 0,void nn(Tn,st=void 0,st);Gn=$t;const t=Ie(nt);Tn.set(t)})),An.subscribe((e=>{if(!e||!yt)return;const t=(o=Ie(e),i=yt,o.x-=i.x,o.y-=i.y,o.width-=i.width,o.height-=i.height,o);var o,i;He(t,Gn);const n=((e,t)=>(e.x+=t.x,e.y+=t.y,e.width+=t.width,e.height+=t.height,e))(Ie(st),t);Fi.set(n)})),Fi.subscribe((e=>{if(at||yt||rt)return;if(!e||!ct)return;const t=je(ct),o=je(e);if(fo(t,6)===fo(o,6))return;const i=Math.min(pt.width/nt.width,pt.height/nt.height),n=be(e.width*i,e.height*i),r=.5*(ct.width-n.width),a=.5*(ct.height-n.height),s=Oe(ct.x+r,ct.y+a,n.width,n.height);An.set(s)}));const Kn=Tr([Nn,Fi,An],(([e,t,o],i)=>{if(!e||!t||!o)return;const n=o.width/t.width,r=o.height/t.height;i(Math.max(n,r)/e)})),Zn=Tr([Nn,Kn],(([e,t],o)=>{if(!t)return;o(e*t)}));Zi(e,Zn,(e=>o(300,$t=e)));const Jn=qa(.075,{stiffness:.03,damping:.4,precision:.001}),Qn=Tr([jn,Fn],(([e,t],o)=>{if(!e)return;let{x:i,y:n,width:r,height:a}=e,{left:s,right:l,top:c,bottom:d}=t;if("resize"===M){const e=mt||nt,t=e.width/ct.width||e.height/ct.height;s*=t,l*=t,c*=t,d*=t}o({x:i-s,y:n-l,width:r+s+l,height:a+c+d})}));Zi(e,Qn,(e=>o(189,xt=e)));const er=Tr([fn,Jn,jn,ln,Bn,Fn],(([e,t,o,n,r,a],s)=>{if(!o||i)return s([]);let{x:l,y:c,width:d,height:u}=o;l+=.5,c+=.5,d-=.5,u-=.5;const h=[];if(r){t>.1&&h.push({x:l,y:c,width:d-.5,height:u-.5,strokeWidth:1,strokeColor:e,opacity:t});let{left:o,right:i,top:n,bottom:r}=a;if("resize"===M){const e=mt||nt,t=e.width/ct.width||e.height/ct.height;o*=t,i*=t,n*=t,r*=t}return void s([...h,{x:l-o,y:c-i,width:d+o+i,height:u+n+r,strokeWidth:1,strokeColor:e,opacity:.05}])}const p=Od(e),m=n&&n.frameColor&&Od(n.frameColor);if(p&&m||!p&&!p){const e=p?[1,1,1,.3]:[0,0,0,.075];h.push({x:l,y:c,width:d,height:u,strokeWidth:3.5,strokeColor:e,opacity:t})}s([...h,{x:l,y:c,width:d,height:u,strokeWidth:1,strokeColor:e,opacity:t}])})),tr=Mr([]);Zi(e,tr,(e=>o(200,Mt=e)));const or=Tr([er,tr],(([e,t],o)=>{o([...e,...t])}));Zi(e,or,(e=>o(54,wo=e)));const ir=(e,t,o)=>{const i=g("canvas",{width:Math.max(1,e),height:Math.max(1,t)}).getContext("2d"),n=i.createLinearGradient(0,0,e,t);return[[0,0],[.013,.081],[.049,.155],[.104,.225],[.175,.29],[.259,.353],[.352,.412],[.45,.471],[.55,.529],[.648,.588],[.741,.647],[.825,.71],[.896,.775],[.951,.845],[.987,.919],[1,1]].forEach((([e,t])=>n.addColorStop(t,`rgba(${255*o[0]}, ${255*o[1]}, ${255*o[2]}, ${e})`))),i.fillStyle=n,i.fillRect(0,0,i.canvas.width,i.canvas.height),i.canvas},nr=qa(40);Zi(e,nr,(e=>o(188,bt=e)));const rr=qa(70);Zi(e,rr,(e=>o(191,vt=e)));const ar=qa(0);Zi(e,ar,(e=>o(196,kt=e)));const sr=qa(0);Zi(e,sr,(e=>o(198,Ct=e)));const lr=qa(0);Zi(e,lr,(e=>o(192,wt=e)));const cr=qa(0);let dr,ur;Zi(e,cr,(e=>o(194,St=e))),mn.subscribe((e=>{e&&(o(169,dr=ir(16,0,e)),o(169,dr.dataset.retain=1,dr),o(170,ur=ir(0,16,e)),o(170,ur.dataset.retain=1,ur))}));const hr=Mr(!1);Zi(e,hr,(e=>o(242,Ut=e)));const pr=Mr();Zi(e,pr,(e=>o(203,Pt=e)));let mr;const gr=Tr([hr,pr],(([e,t],i)=>{return e&&t?(mr&&(mr.cancel(),o(171,mr=void 0)),bi(t)?i((e=>{const t=g("canvas",{width:e.width,height:e.height});return t.getContext("2d").drawImage(e,0,0),t})(t)):(o(171,mr={cancel:a}),void(n=t,r=mr,new Promise(((e,t)=>{const o=Hr.length?0:250;let i,a=!1;r.cancel=()=>a=!0;const s=Date.now();Mi(n).then((t=>{const n=Date.now()-s;clearTimeout(i),i=setTimeout((()=>{a||e(t)}),Math.max(0,o-n))})).catch(t)}))).then(i).catch((e=>{nn(Ai,ot.error=e,ot)})).finally((()=>{o(171,mr=void 0)})))):i(void 0);var n,r}));Mo(),Mo=qi(gr,(e=>o(202,Rt=e)));let{imagePreviewCurrent:fr}=t;const $r=Mr({});Zi(e,$r,(e=>o(233,Wt=e)));const yr=Mr([]);Zi(e,yr,(e=>o(50,yo=e)));const br=Tr([Vn,yn,Pi,Pn,An,Zn,Hi,Xi,Yi,ji],(([e,t,o,i,n,r,a,s,l,c],d)=>{if(e){if("resize"===M){const e=c||i;r=e.width/i.width||e.height/i.height}d(((e,t,o,i,n,r,a,s,l,c,d)=>{if(!(e&&t&&o&&i&&r))return;const u=it(Ie(t)),h=_e(u),p=_e(e),m=Le(o),g=_e(m),f=G(a,s),$=Ur(o,i,l),y=_e($),b=re(K(g),y),x=re(K(p),h);b.x+=x.x,b.y+=x.y;const v=Z(K(b));v.x+=x.x,v.y+=x.y;const w=_e(We(Ie(n),e)),S=re(w,p);return ne(b,S),{origin:v,translation:b,rotation:{x:d?Math.PI:0,y:c?Math.PI:0,z:l},perspective:f,scale:r}})(e,t,o,i,n,r,0,0,a,s,l))}}));Zi(e,br,(e=>o(232,_t=e)));const xr=Tr([Ji,Qi,en,tn,on],(([e,t,o,i,n],r)=>{const a=e&&Object.keys(e).map((t=>e[t])).filter(Boolean);r({gamma:o||void 0,vignette:i||void 0,noise:n||void 0,convolutionMatrix:t||void 0,colorMatrix:a&&a.length&&_i(a)})}));let vr,wr;const Sr=(()=>{if(!It())return!1;const e=navigator.userAgent.match(/OS (\d+)_(\d+)_?(\d+)?/i)||[],[,t,o]=e.map((e=>parseInt(e,10)||0));return t>13||13===t&&o>=4})(),kr=Mr({});Zi(e,kr,(e=>o(229,zt=e)));const Rr=Kl(),Pr=Cr(Rr,(e=>{const t=()=>e(Kl()),o=matchMedia(`(resolution: ${Rr}dppx)`);return o.addListener(t),()=>o.removeListener(t)}));Zi(e,Pr,(e=>o(46,ho=e)));const Ar=Mr();Zi(e,Ar,(e=>o(18,dt=e)));const Ir=((e,t)=>{const{sub:o,pub:i}=vi(),n=[],r=Mr(0),a=[],s=()=>a.forEach((e=>e({index:Ki(r),length:n.length}))),l={get index(){return Ki(r)},set index(e){e=Number.isInteger(e)?e:0,e=jr(e,0,n.length-1),r.set(e),t(n[l.index]),s()},get state(){return n[n.length-1]},length:()=>n.length,undo(){const e=l.index--;return i("undo",e),e},redo(){const e=l.index++;return i("redo",l.index),e},revert(){n.length=1,l.index=0,i("revert")},write(o){o&&t({...e(),...o});const i=e(),a=n[n.length-1];JSON.stringify(i)!==JSON.stringify(a)&&(n.length=l.index+1,n.push(i),r.set(n.length-1),s())},set(e={}){n.length=0,l.index=0;const t=Array.isArray(e)?e:[e];n.push(...t),l.index=n.length-1},get:()=>[...n],subscribe:e=>(a.push(e),e({index:l.index,length:n.length}),()=>a.splice(a.indexOf(e),1)),on:o};return l})((()=>Et),(e=>{nn(cn,Et=e,Et),bn.set(Lt)}));To(),To=qi(Ir,(e=>o(208,Ft=e)));const Er=()=>{const e={x:0,y:0,...ft},t=tt(Je(e,Et.cropAspectRatio),(e=>Math.round(e))),o=qo({...Et,rotation:0,crop:t},Et),i=[o];JSON.stringify(o)!==JSON.stringify(Et)&&i.push({...Et}),Ir.set(i)};Ai.subscribe((e=>{e&&e.complete&&Er()}));const Lr=()=>jo().then((e=>e&&Ir.revert())),Fr=Mr(!1);Zi(e,Fr,(e=>o(210,Bt=e)));const Br=()=>{nn(Fr,Bt=!0,Bt),Xo().then((e=>{if(!e)return void nn(Fr,Bt=!1,Bt);let t;t=Qr.subscribe((e=>{1===e&&(t&&t(),Io("processImage"))}))}))};Ii.subscribe((e=>{if(!e)return;nn(Fr,Bt=!0,Bt);const{complete:t,abort:o}=e;(t||o)&&nn(Fr,Bt=!1,Bt)}));const zr={...Bo,imageFile:Ri,imageSize:Pi,imageBackgroundColor:Gi,imageCropAspectRatio:Ei,imageCropMinSize:Bi,imageCropMaxSize:zi,imageCropLimitToImage:Li,imageCropRect:Fi,imageCropRectOrigin:Oi,imageCropRectSnapshot:Tn,imageCropRectAspectRatio:Ni,imageCropRange:Di,imageRotation:Hi,imageRotationRange:Ui,imageFlipX:Xi,imageFlipY:Yi,imageOutputSize:ji,imageColorMatrix:Ji,imageConvolutionMatrix:Qi,imageGamma:en,imageVignette:tn,imageNoise:on,imageDecoration:rn,imageAnnotation:an,imageRedaction:sn,imageFrame:ln,imagePreview:gr,imagePreviewSource:pr,imageTransforms:br,imagePreviewModifiers:$r,history:Ir,animation:Ar,pixelRatio:Pr,elasticityMultiplier:Uo,scrollElasticity:cu,rangeInputElasticity:5,pointerAccuracy:wn,pointerHoverable:Sn,env:kr,rootRect:yn,stageRect:Vn,stageScalar:Nn,framePadded:Bn,utilRect:vn,presentationScalar:Zn,rootBackgroundColor:mn,rootForegroundColor:gn,rootLineColor:fn,imageOutlineOpacity:Jn,imageOverlayMarkup:tr,interfaceImages:yr,isInteracting:kn,isInteractingFraction:Cn,imageCropRectIntent:Rn,imageCropRectPresentation:Pn,imageSelectionRect:An,imageSelectionRectIntent:En,imageSelectionRectPresentation:jn,imageSelectionRectSnapshot:In,imageScalar:Kn};delete zr.image;const Dr="util-"+R();let Or=[],_r=It();const Wr=(e,t)=>{const o=(e=>{const t=ee.getPropertyValue(e);return Id(t)})(e);o&&0!==o[3]&&(o.length=3,t.set(o))},Vr=()=>{Wr("color",gn),Wr("background-color",mn),Wr("outline-color",fn)},Nr=Tr([br,xr,Gi],(([e,t,o])=>e&&{...e,...t,backgroundColor:o}));Zi(e,Nr,(e=>o(235,Vt=e)));const Hr=Dd();Zi(e,Hr,(e=>o(22,Nt=e)));const Xr=()=>{const e=Hr.length?void 0:{resize:1.05},t=((e,t,o={})=>{const{resize:i=1,opacity:n=0}=o,r={opacity:[qa(n,{...Bd,stiffness:.1}),W],resize:[qa(i,{...Bd,stiffness:.1}),W],translation:[qa(void 0,Bd),W],rotation:[qa(void 0,zd),W],origin:[qa(void 0,Bd),W],scale:[qa(void 0,zd),W],gamma:[qa(void 0,zd),e=>e||1],vignette:[qa(void 0,zd),e=>e||0],colorMatrix:[qa([...Fd],Bd),e=>e||[...Fd]],convolutionMatrix:[Mr(void 0),e=>e&&e.clarity||void 0],backgroundColor:[qa(void 0,Bd),W]},a=Object.entries(r).map((([e,t])=>[e,t[0]])),s=a.map((([,e])=>e)),l=Object.entries(r).reduce(((e,[t,o])=>{const[i,n]=o;return e[t]=(e,t)=>i.set(n(e),t),e}),{});let c;const d=Tr(s,(o=>(c=o.reduce(((e,t,o)=>(e[a[o][0]]=t,e)),{}),c.data=e,c.size=t,c.scale*=o[1],c)));return d.get=()=>c,d.set=(e,t)=>{const o={hard:!t};Object.entries(e).forEach((([e,t])=>{l[e]&&l[e](t,o)}))},d})(Rt,ft,e);Hr.unshift(t),Yr(Vt)},Yr=e=>{Hr.forEach(((t,o)=>{const i=0===o?1:0;t.set({...e,opacity:i,resize:1},dt)}))};let Gr;const qr=(e,t)=>di(e,{x:Ht.x/t.scale,y:Ht.y/t.scale,width:Ht.width/t.scale,height:Ht.height/t.scale}),Kr=(e,t)=>(yi(e,Ht,t.scale,t.size),e),Zr=e=>{const t=[];return e.forEach((e=>t.push(Jr(e)))),t.filter(Boolean)},Jr=e=>(Po(e)?e.points=[G(e.x1,e.y1),G(e.x2,e.y2)]:Ao(e)?e.points=[G(e.x1,e.y1),G(e.x2,e.y2),G(e.x3,e.y3)]:(e=>ko(e)&&!e.text.length)(e)?(Co(e)&&(e.width=5,e.height=qt(e.lineHeight)?e.lineHeight(e.fontSize):e.lineHeight),e.strokeWidth=1,e.strokeColor=[1,1,1,.5],e.backgroundColor=[0,0,0,.1]):ko(e)&&(e.fontFamily=e.fontFamily||"sans-serif",e.fontSize=e.fontSize||16),e),Qr=Ya(void 0,{duration:500});let ea;Zi(e,Qr,(e=>o(24,Gt=e)));const ta=Mr(!1);let oa;Zi(e,ta,(e=>o(254,Yt=e)));const ia=qa(void 0,{stiffness:.1,damping:.7,precision:.25});Zi(e,ia,(e=>o(42,so=e)));const na=qa(0,{stiffness:.1,precision:.05});Zi(e,na,(e=>o(43,lo=e)));const ra=qa(0,{stiffness:.02,damping:.5,precision:.25});Zi(e,ra,(e=>o(258,Zt=e)));const aa=qa(void 0,{stiffness:.02,damping:.5,precision:.25});Zi(e,aa,(e=>o(256,Kt=e)));const sa=qa(void 0,{stiffness:.02,damping:.5,precision:.25});let la;Zi(e,sa,(e=>o(259,Jt=e)));const ca=()=>{Io("abortLoadImage")},da=()=>{Io("abortProcessImage"),nn(Fr,Bt=!1,Bt)},ha=e=>e.preventDefault(),pa=Sr?e=>{const t=e.touches?e.touches[0]:e;t.pageX>10&&t.pageX<vr-10||ha(e)}:a,ma=It()?ha:a,ga=It()?ha:a,fa=Mr([]);Zi(e,fa,(e=>o(303,Qt=e))),Wn("keysPressed",fa);const $a=e=>{!e||oo(e)&&!(e=>/^image/.test(e.type)&&!/svg/.test(e.type))(e)||!oo(e)&&!/^http/.test(e)||Io("loadImage",e)};let ya=void 0;let ba=[];const xa=()=>({foregroundColor:[...no],lineColor:[...ro],utilVisibility:{...P},isInteracting:at,isInteractingFraction:ao,rootRect:Ie(et),stageRect:Ie(pt),selectionRect:Ie(Ht)}),va=(e,t,o,i,n,r)=>({blendShapes:t.filter(Lo).map((e=>di(e,ft))),annotationShapes:Zr(o.filter(Lo).map($o).map((e=>di(e,ft))).map(s).flat()),decorationShapes:Zr(i.filter(Lo).map($o).map((t=>qr(t,e))).map(s).flat().map((t=>Kr(t,e)))),interfaceShapes:Zr(n.filter(Lo)),frameShapes:Zr(r.map($o).map((t=>qr(t,e))).map(s).flat().map((t=>Kr(t,e))))});let wa;const Sa=Mr();Wn("rootPortal",Sa),Wn("rootRect",yn);return e.$$set=e=>{"class"in e&&o(141,Eo=e.class),"layout"in e&&o(142,Fo=e.layout),"stores"in e&&o(143,Bo=e.stores),"locale"in e&&o(2,zo=e.locale),"id"in e&&o(3,Do=e.id),"util"in e&&o(144,Oo=e.util),"utils"in e&&o(145,_o=e.utils),"animations"in e&&o(146,Wo=e.animations),"disabled"in e&&o(147,Vo=e.disabled),"status"in e&&o(139,No=e.status),"previewUpscale"in e&&o(148,Ho=e.previewUpscale),"elasticityMultiplier"in e&&o(4,Uo=e.elasticityMultiplier),"willRevert"in e&&o(149,jo=e.willRevert),"willProcessImage"in e&&o(150,Xo=e.willProcessImage),"willRenderCanvas"in e&&o(5,Yo=e.willRenderCanvas),"willRenderToolbar"in e&&o(151,Go=e.willRenderToolbar),"willSetHistoryInitialState"in e&&o(152,qo=e.willSetHistoryInitialState),"enableButtonExport"in e&&o(153,Ko=e.enableButtonExport),"enableButtonRevert"in e&&o(154,Zo=e.enableButtonRevert),"enableNavigateHistory"in e&&o(155,Jo=e.enableNavigateHistory),"enableToolbar"in e&&o(6,Qo=e.enableToolbar),"enableUtils"in e&&o(156,ei=e.enableUtils),"enableButtonClose"in e&&o(157,ti=e.enableButtonClose),"enableDropImage"in e&&o(158,oi=e.enableDropImage),"enablePasteImage"in e&&o(159,ii=e.enablePasteImage),"previewImageDataMaxSize"in e&&o(160,ni=e.previewImageDataMaxSize),"layoutDirectionPreference"in e&&o(161,ri=e.layoutDirectionPreference),"layoutHorizontalUtilsPreference"in e&&o(162,ai=e.layoutHorizontalUtilsPreference),"layoutVerticalUtilsPreference"in e&&o(163,si=e.layoutVerticalUtilsPreference),"imagePreviewSrc"in e&&o(164,li=e.imagePreviewSrc),"imageOrienter"in e&&o(165,ci=e.imageOrienter),"pluginComponents"in e&&o(166,ui=e.pluginComponents),"pluginOptions"in e&&o(7,hi=e.pluginOptions),"root"in e&&o(1,$i=e.root),"imageSourceToImageData"in e&&o(8,Mi=e.imageSourceToImageData),"imagePreviewCurrent"in e&&o(140,fr=e.imagePreviewCurrent)},e.$$.update=()=>{if(262144&e.$$.dirty[4]&&o(176,i="overlay"===Fo),2097154&e.$$.dirty[5]&&o(15,n=ei&&!i),129&e.$$.dirty[0]&&hi&&Object.entries(hi).forEach((([e,t])=>{Object.entries(t).forEach((([t,i])=>{mi[e]&&o(0,mi[e][t]=i,mi)}))})),1&e.$$.dirty[0]|2048&e.$$.dirty[5]){let e=!1;ui.forEach((([t])=>{mi[t]||(o(0,mi[t]={},mi),e=!0)})),e&&o(168,xi=[...ui])}var t,a,m,g;if(8388608&e.$$.dirty[4]&&wi.set(Vo?1:0),32&e.$$.dirty[5]&&(r=ni?(t=ni,a=ki,be(Math.min(t.width,a.width),Math.min(t.height,a.height))):ki),4194304&e.$$.dirty[5]&&Ti.update(Ye[0]),8388608&e.$$.dirty[5]&&(s=Ke?e=>Ke(e,{isPreview:!0}):W),65536&e.$$.dirty[0]&&Ze&&yn.set(Oe(Ze.x,Ze.y,Ze.width,Ze.height)),52428800&e.$$.dirty[5]&&et&&i&&ot&&ot.complete&&(()=>{const e=Qe,t=je(et);e&&e===t||(Ei.set(je(et)),Er())})(),4&e.$$.dirty[0]|2097152&e.$$.dirty[4]|8192&e.$$.dirty[5]&&o(183,v=zo&&xi.length?_o||xi.map((([e])=>e)):[]),268435456&e.$$.dirty[5]&&o(17,L=v.length>1),131072&e.$$.dirty[0]&&(L||bn.set(Ee())),64&e.$$.dirty[0]&&(Qo||xn.set(Ee())),16777216&e.$$.dirty[4]|2097152&e.$$.dirty[5]&&Mn.set(Ho||i),268443648&e.$$.dirty[5]&&o(211,w=xi.filter((([e])=>v.includes(e)))),33554432&e.$$.dirty[6]&&o(212,S=w.length),1048576&e.$$.dirty[4]|268435456&e.$$.dirty[5]|67108864&e.$$.dirty[6]&&o(19,M=Oo&&"string"==typeof Oo&&v.includes(Oo)?Oo:S>0?v[0]:void 0),524288&e.$$.dirty[0]&&M&&Jn.set(.075),524288&e.$$.dirty[0]&&nr.set("resize"===M?40:30),524288&e.$$.dirty[0]&&rr.set("resize"===M?140:70),1140850688&e.$$.dirty[5]&&o(187,l=nt&&((e,t)=>{let{width:o,height:i}=e;const n=je(t);return o&&i?e:(o&&!i&&(i=o/n),i&&!o&&(o=i*n),o||i||(o=t.width,i=t.height),Ce(be(o,i),Math.round))})(mt||{},nt)),536870912&e.$$.dirty[5]|14&e.$$.dirty[6]&&l&&pt&&lr.set(kd(pt.y,pt.y-bt,xt.y)),536870912&e.$$.dirty[5]|14&e.$$.dirty[6]&&l&&pt&&sr.set(kd(pt.x+pt.width,pt.x+pt.width+bt,xt.x+xt.width)),536870912&e.$$.dirty[5]|14&e.$$.dirty[6]&&l&&pt&&cr.set(kd(pt.y+pt.height,pt.y+pt.height+bt,xt.y+xt.height)),536870912&e.$$.dirty[5]|14&e.$$.dirty[6]&&l&&pt&&ar.set(kd(pt.x,pt.x-bt,xt.x)),16809984&e.$$.dirty[5]|96&e.$$.dirty[6]&&o(190,c=et&&{id:su,x:0,y:0,width:et.width,height:vt,rotation:Math.PI,opacity:lu*wt,backgroundImage:ur}),16809984&e.$$.dirty[5]|288&e.$$.dirty[6]&&o(193,d=et&&{id:su,x:0,y:et.height-vt,width:et.width,height:vt,opacity:lu*St,backgroundImage:ur}),16793600&e.$$.dirty[5]|1056&e.$$.dirty[6]&&o(195,u=et&&{id:su,x:0,y:0,height:et.height,width:vt,rotation:Math.PI,opacity:lu*kt,backgroundImage:dr}),16793600&e.$$.dirty[5]|4128&e.$$.dirty[6]&&o(197,h=et&&{id:su,x:et.width-vt,y:0,height:et.height,width:vt,opacity:lu*Ct,backgroundImage:dr}),2704&e.$$.dirty[6]&&o(199,p=[c,h,d,u].filter(Boolean)),24576&e.$$.dirty[6]&&p&&Mt){const e=Mt.filter((e=>e.id!==su));nn(tr,Mt=[...e,...p],Mt)}if(512&e.$$.dirty[5]|32768&e.$$.dirty[6]&&pr.set(li||(Tt||void 0)),2&e.$$.dirty[0]|65536&e.$$.dirty[4]|65536&e.$$.dirty[6]&&(o(140,fr=Rt),Rt&&$i.dispatchEvent(Md("loadpreview",fr))),131072&e.$$.dirty[6]&&Pt&&yr.set([]),134217728&e.$$.dirty[5]&&o(204,f=!at&&!ms()),1048576&e.$$.dirty[6]&&o(205,y=!At),4194304&e.$$.dirty[4]|786432&e.$$.dirty[6]&&nn(Ar,dt="always"===Wo?f:"never"!==Wo&&(f&&y),dt),4194304&e.$$.dirty[6]&&o(207,b=Ft.index>0),4194304&e.$$.dirty[6]&&o(209,x=Ft.index<Ft.length-1),4&e.$$.dirty[0]|268435456&e.$$.dirty[5]|33554432&e.$$.dirty[6]&&o(20,C=v.map((e=>{const t=w.find((([t])=>e===t));if(t)return{id:e,view:t[1],tabIcon:zo[e+"Icon"],tabLabel:zo[e+"Label"]}})).filter(Boolean)||[]),524288&e.$$.dirty[0]&&pn.set(M),524289&e.$$.dirty[0]&&o(213,T=M&&mi[M].tools||[]),3145728&e.$$.dirty[0]&&o(21,P=C.reduce(((e,t)=>(e[t.id]=P&&P[t.id]||0,e)),{})),524288&e.$$.dirty[0]&&o(30,A={name:Dr,selected:M}),1048576&e.$$.dirty[0]&&o(31,I=C.map((e=>({id:e.id,icon:e.tabIcon,label:e.tabLabel})))),1048576&e.$$.dirty[0]&&o(32,E=C.map((e=>e.id))),131072&e.$$.dirty[4]&&o(33,F=Us(["PinturaRoot","PinturaRootComponent",Eo])),16777216&e.$$.dirty[5]&&o(214,B=et&&(et.width>1e3?"wide":et.width<600?"narrow":void 0)),16777216&e.$$.dirty[5]&&o(215,z=et&&(et.width<=320||et.height<=460)),16777216&e.$$.dirty[5]&&o(216,D=et&&(et.height>1e3?"tall":et.height<600?"short":void 0)),2&e.$$.dirty[0]&&o(217,O=$i&&$i.parentNode&&$i.parentNode.classList.contains("PinturaModal")),2048&e.$$.dirty[0]|16777216&e.$$.dirty[5]|1&e.$$.dirty[7]&&o(218,_=O&&et&&vr>et.width),4096&e.$$.dirty[0]|16777216&e.$$.dirty[5]|1&e.$$.dirty[7]&&o(219,V=O&&et&&wr>et.height),6&e.$$.dirty[7]&&o(220,N=_&&V),268435456&e.$$.dirty[6]&&o(221,H="narrow"===B),16777280&e.$$.dirty[5]&&o(222,(m=et,g=ri,U=et?"auto"===g?m.width>m.height?"landscape":"portrait":"horizontal"===g?m.width<500?"portrait":"landscape":"vertical"===g?m.height<400?"landscape":"portrait":void 0:"landscape")),32&e.$$.dirty[7]&&o(34,j="landscape"===U),1073741824&e.$$.dirty[6]|16&e.$$.dirty[7]&&o(223,X=H||"short"===D),2048&e.$$.dirty[0]|16777216&e.$$.dirty[5]&&o(224,Y=_r&&et&&vr===et.width&&!Sr),2097152&e.$$.dirty[5]|1207959552&e.$$.dirty[6]&&o(225,q=T.length&&("short"===D||i)),128&e.$$.dirty[5]&&o(226,J="has-navigation-preference-"+ai),256&e.$$.dirty[5]&&o(227,Q="has-navigation-preference-"+si),2&e.$$.dirty[0]&&o(228,ee=$i&&getComputedStyle($i)),2048&e.$$.dirty[7]&&ee&&Vr(),426048&e.$$.dirty[0]|8650752&e.$$.dirty[4]|1879048192&e.$$.dirty[6]|30447&e.$$.dirty[7]&&kr.set({...zt,layoutMode:Fo,orientation:U,horizontalSpace:B,verticalSpace:D,navigationHorizontalPreference:J,navigationVerticalPreference:Q,isModal:O,isDisabled:Vo,isCentered:N,isCenteredHorizontally:_,isCenteredVertically:V,isAnimated:dt,pointerAccuracy:Dt,pointerHoverable:Ot,isCompact:X,hasSwipeNavigation:Y,hasLimitedSpace:z,hasToolbar:Qo,hasNavigation:L&&n,isIOS:_r}),4096&e.$$.dirty[7]&&o(35,te=Object.entries(zt).map((([e,t])=>/^is|has/.test(e)?t?Td(e):void 0:t)).filter(Boolean).join(" ")),98304&e.$$.dirty[7]&&o(36,oe=_t&&Object.entries(Wt).filter((([,e])=>null!=e)).reduce(((e,[,t])=>e={...e,...t}),{})),33554432&e.$$.dirty[5]&&o(234,le=ot&&"any-to-file"===ot.task),131072&e.$$.dirty[7]&&le&&Hr&&Hr.clear(),262144&e.$$.dirty[7]&&o(236,ie=!!Vt&&!!Vt.translation),131072&e.$$.dirty[5]|65536&e.$$.dirty[6]|524288&e.$$.dirty[7]&&ie&&Rt&&Rt!==Gr&&(o(172,Gr=Rt),Xr()),786432&e.$$.dirty[7]&&ie&&Yr(Vt),4194304&e.$$.dirty[0]&&Nt&&Nt.length>1){let e=[];Hr.forEach(((t,o)=>{0!==o&&t.get().opacity<=0&&e.push(t)})),e.forEach((e=>Hr.remove(e)))}if(4&e.$$.dirty[0]|1048576&e.$$.dirty[7]&&o(23,se=zo&&ae.length&&zo.labelSupportError(ae)),33554432&e.$$.dirty[5]&&o(238,ce=ot&&!!ot.error),33554432&e.$$.dirty[5]&&o(239,de=!ot||!ot.complete&&void 0===ot.task),33554432&e.$$.dirty[5]&&o(240,ue=ot&&(ot.taskLengthComputable?ot.taskProgress:1/0)),131072&e.$$.dirty[7]&&le&&nn(hr,Ut=!1,Ut),33816576&e.$$.dirty[5]&&ot&&ot.complete){const e=500;clearTimeout(ea),o(173,ea=setTimeout((()=>{nn(hr,Ut=!0,Ut)}),e))}if(33554432&e.$$.dirty[5]|39845888&e.$$.dirty[7]&&o(241,he=ot&&!ce&&!de&&!Ut),65536&e.$$.dirty[5]|196608&e.$$.dirty[6]&&o(243,pe=!(!Pt||Rt&&!mr)),16777216&e.$$.dirty[6]|268435456&e.$$.dirty[7]&&o(244,me=Bt||jt&&void 0!==jt.progress&&!jt.complete),33554432&e.$$.dirty[5]|4194304&e.$$.dirty[7]&&o(246,ge=ot&&!(ot.error||de)),4&e.$$.dirty[0]|33554432&e.$$.dirty[5]&&o(247,fe=zo&&(ot?!ot.complete||ot.error?fs(zo.statusLabelLoadImage(ot),ot.error&&ot.error.metadata,"{","}"):zo.statusLabelLoadImage({progress:1/0,task:"blob-to-bitmap"}):zo.statusLabelLoadImage(ot))),4&e.$$.dirty[0]|268435456&e.$$.dirty[7]&&o(248,$e=jt&&zo&&zo.statusLabelProcessImage(jt)),268435456&e.$$.dirty[7]&&o(249,ye=jt&&(jt.taskLengthComputable?jt.taskProgress:1/0)),268435456&e.$$.dirty[7]&&o(250,xe=jt&&!jt.error),268435456&e.$$.dirty[7]&&o(251,ve=jt&&jt.error),4&e.$$.dirty[0]|32768&e.$$.dirty[4]|1843396608&e.$$.dirty[7]|15&e.$$.dirty[8])if(No){let e,t,i,n,r;k(No)&&(e=No),Xt(No)?t=No:Array.isArray(No)&&([e,t,r]=No,!1===t&&(n=!0),Xt(t)&&(i=!0)),o(13,oa=(e||t)&&{text:e,aside:n||i,progressIndicator:{visible:i,progress:t},closeButton:n&&{label:zo.statusLabelButtonClose,icon:zo.statusIconButtonClose,onclick:r||(()=>o(139,No=void 0))}})}else o(13,oa=zo&&de||ce||he||pe?{text:fe,aside:ce||ge,progressIndicator:{visible:ge,progress:ue},closeButton:ce&&{label:zo.statusLabelButtonClose,icon:zo.statusIconButtonClose,onclick:ca}}:zo&&me&&$e?{text:$e,aside:ve||xe,progressIndicator:{visible:xe,progress:ye},closeButton:ve&&{label:zo.statusLabelButtonClose,icon:zo.statusIconButtonClose,onclick:da}}:void 0);if(32768&e.$$.dirty[4]&&o(252,we=void 0!==No),268435457&e.$$.dirty[7]&&O&&jt&&jt.complete&&(ta.set(!0),setTimeout((()=>ta.set(!1)),100)),8388608&e.$$.dirty[0]|224395264&e.$$.dirty[7]|80&e.$$.dirty[8]&&o(253,Se=Yt||se||de||ce||he||pe||me||we),32&e.$$.dirty[8]&&nn(Qr,Gt=Se?1:0,Gt),16777216&e.$$.dirty[0]&&o(25,ke=Gt>0),8192&e.$$.dirty[0]&&o(255,Me=!(!oa||!oa.aside)),33562624&e.$$.dirty[0]|524288&e.$$.dirty[5]|384&e.$$.dirty[8]&&ke&&oa)if(clearTimeout(la),Me){const e=!!oa.error;na.set(1),ia.set(Kt,{hard:e}),o(174,la=setTimeout((()=>{ra.set(16)}),1))}else na.set(0),o(174,la=setTimeout((()=>{ra.set(0)}),1));if(33554432&e.$$.dirty[0]&&(ke||(sa.set(void 0,{hard:!0}),ia.set(void 0,{hard:!0}),ra.set(0,{hard:!0}))),1024&e.$$.dirty[8]&&o(257,Te=.5*Zt),2560&e.$$.dirty[8]&&o(38,Re=`transform: translateX(${Jt-Te}px)`),4&e.$$.dirty[0]|1744830464&e.$$.dirty[4]|5&e.$$.dirty[5]|144703488&e.$$.dirty[6]|4368&e.$$.dirty[7]&&o(39,Pe=zo&&Go([["div","alpha",{class:"PinturaNavGroup"},[["div","alpha-set",{class:"PinturaNavSet"},[ti&&["Button","close",{label:zo.labelClose,icon:zo.iconButtonClose,onclick:()=>Io("close"),hideLabel:!0}],Zo&&["Button","revert",{label:zo.labelButtonRevert,icon:zo.iconButtonRevert,disabled:!b,onclick:Lr,hideLabel:!0}]]]]],["div","beta",{class:"PinturaNavGroup PinturaNavGroupFloat"},[Jo&&["div","history",{class:"PinturaNavSet"},[["Button","undo",{label:zo.labelButtonUndo,icon:zo.iconButtonUndo,disabled:!b,onclick:Ir.undo,hideLabel:!0}],["Button","redo",{label:zo.labelButtonRedo,icon:zo.iconButtonRedo,disabled:!x,onclick:Ir.redo,hideLabel:!0}]]],q&&["div","plugin-tools",{class:"PinturaNavSet"},T.filter(Boolean).map((([e,t,o])=>[e,t,{...o,hideLabel:!0}]))]]],["div","gamma",{class:"PinturaNavGroup"},[Ko&&["Button","export",{label:zo.labelButtonExport,icon:H&&zo.iconButtonExport,class:"PinturaButtonExport",onclick:Br,hideLabel:H}]]]],{...zt})),65536&e.$$.dirty[0]&&o(260,Ae=Ze&&Ze.width>0&&Ze.height>0),4&e.$$.dirty[0]|67108864&e.$$.dirty[6]|4096&e.$$.dirty[8]&&o(40,Fe=Ae&&zo&&S),16384&e.$$.dirty[8]&&o(261,Be=eo&&!!eo.length),1&e.$$.dirty[6]|24576&e.$$.dirty[8]&&o(263,ze=Be&&Wi(ft,eo)),65536&e.$$.dirty[6]|237568&e.$$.dirty[8]&&Be&&((e,t,i,n)=>{if(!t)return;const r={dataSizeScalar:i};n&&n[3]>0&&(r.backgroundColor=[...n]),t(e,r).then((e=>{ya&&$(ya),o(175,ya=e)}))})(Rt,to,ze,io),1048576&e.$$.dirty[5]|1&e.$$.dirty[6]|16384&e.$$.dirty[8]&&eo&&ya&&ft){const{width:e,height:t}=ft;o(28,ba=eo.map((o=>{const i=Oe(o.x,o.y,o.width,o.height),n=Ge(Ie(i),o.rotation).map((o=>G(o.x/e,o.y/t)));return{...o,id:"redaction",flipX:!1,flipY:!1,cornerRadius:0,strokeWidth:0,strokeColor:void 0,backgroundColor:[0,0,0],backgroundImage:ya,backgroundImageRendering:"pixelated",backgroundCorners:n}})))}16384&e.$$.dirty[0]&&wa&&Sa.set(wa),8388608&e.$$.dirty[0]|65536&e.$$.dirty[6]&&o(26,Xe=Rt&&!se),67108866&e.$$.dirty[0]&&Xe&&$i.dispatchEvent(Md("ready"))},o(237,ae=[!Ld()&&"WebGL"].filter(Boolean)),o(41,De=((e,t=!0)=>o=>{"ping"===o.type&&(t&&o.stopPropagation(),e(o.detail.type,o.detail.data))})(Ro.pub)),[mi,$i,zo,Do,Uo,Yo,Qo,hi,Mi,gr,Ir,vr,wr,oa,wa,n,Ze,L,dt,M,C,P,Nt,se,Gt,ke,Xe,Or,ba,Lt,A,I,E,F,j,te,oe,Ht,Re,Pe,Fe,De,so,lo,co,uo,ho,po,mo,go,yo,bo,xo,vo,wo,So,wi,Ri,Pi,Ai,Ii,Ei,Fi,ji,Gi,rn,an,sn,ln,cn,dn,un,hn,pn,mn,gn,fn,$n,yn,bn,xn,vn,wn,Sn,kn,Cn,Mn,Tn,Rn,An,In,En,On,Vn,Nn,jn,Zn,Qn,tr,or,nr,rr,ar,sr,lr,cr,hr,pr,$r,yr,br,kr,Pr,Ar,Fr,zr,({target:e,propertyName:t})=>{e===$i&&/background|outline/.test(t)&&Vr()},Nr,Hr,Qr,ta,ia,na,ra,aa,sa,e=>{const t=!(!oa||!oa.closeButton);aa.set(e.detail.width,{hard:t}),sa.set(Math.round(.5*-e.detail.width),{hard:t})},pa,ma,ga,fa,e=>{const{keyCode:t,metaKey:o,ctrlKey:i,shiftKey:n}=e;if(9===t&&Vo)return void e.preventDefault();if(90===t&&(o||i))return void(n&&o?Ir.redo():Ir.undo());if(89===t&&i)return void Ir.redo();if(229===t)return;const r=new Set([...Qt,t]);fa.set(Array.from(r))},({keyCode:e})=>{fa.set(Qt.filter((t=>t!==e)))},()=>{fa.set([])},e=>{var t;(e=>/textarea/i.test(e.nodeName))(t=e.target)||(e=>/date|email|number|search|text|url/.test(e.type))(t)||e.preventDefault()},e=>{oi&&$a(e.detail.resources[0])},e=>{if(!ii)return;const t=jr((vr-Math.abs(et.x))/et.width,0,1),o=jr((wr-Math.abs(et.y))/et.height,0,1);t<.75&&o<.75||$a((e.clipboardData||window.clipboardData).files[0])},xa,va,No,fr,Eo,Fo,Bo,Oo,_o,Wo,Vo,Ho,jo,Xo,Go,qo,Ko,Zo,Jo,ei,ti,oi,ii,ni,ri,ai,si,li,ci,ui,pi,xi,dr,ur,mr,Gr,ea,la,ya,i,Ye,Ke,et,ot,nt,at,v,pt,mt,ft,l,bt,xt,c,vt,wt,d,St,u,kt,h,Ct,p,Mt,Tt,Rt,Pt,f,y,At,b,Ft,x,Bt,w,S,T,B,z,D,O,_,V,N,H,U,X,Y,q,J,Q,ee,zt,Dt,Ot,_t,Wt,le,Vt,ie,ae,ce,de,ue,he,Ut,pe,me,jt,ge,fe,$e,ye,xe,ve,we,Se,Yt,Me,Kt,Te,Zt,Jt,Ae,Be,eo,ze,to,io,function(){o(11,vr=_d.innerWidth),o(12,wr=_d.innerHeight)},e=>nn(xn,co=e.detail,co),({detail:e})=>o(19,M=e),(e,t)=>t.id===e,function(t,i){e.$$.not_equal(mi[i],t)&&(mi[i]=t,o(0,mi),o(7,hi),o(166,ui))},e=>nn(vn,uo=e.detail,uo),e=>o(27,Or=Or.concat(e)),e=>o(27,Or=Or.filter((t=>t!==e))),(e,{detail:t})=>o(21,P[e]=t,P),e=>nn(bn,Lt=e.detail,Lt),e=>e.id===M,function(t){e.$$.not_equal(mi[M],t)&&(mi[M]=t,o(0,mi),o(7,hi),o(166,ui))},e=>nn(vn,uo=e.detail,uo),()=>o(27,Or=Or.concat(M)),()=>o(27,Or=Or.filter((e=>e!==M))),({detail:e})=>o(21,P[M]=e,P),e=>{const t={...e,...xa()},{annotationShapes:o,decorationShapes:i,interfaceShapes:n,frameShapes:r}=Yo({annotationShapes:bo,decorationShapes:xo,frameShapes:[vo],interfaceShapes:wo},t);return va(t,ba,o,i,n,r)},function(e){Un[e?"unshift":"push"]((()=>{wa=e,o(14,wa)}))},function(e){Un[e?"unshift":"push"]((()=>{$i=e,o(1,$i)}))},e=>nn($n,Ze=e.detail,Ze)]}class uu extends Sr{constructor(e){super(),wr(this,e,du,au,Gi,{class:141,layout:142,stores:143,locale:2,id:3,util:144,utils:145,animations:146,disabled:147,status:139,previewUpscale:148,elasticityMultiplier:4,willRevert:149,willProcessImage:150,willRenderCanvas:5,willRenderToolbar:151,willSetHistoryInitialState:152,enableButtonExport:153,enableButtonRevert:154,enableNavigateHistory:155,enableToolbar:6,enableUtils:156,enableButtonClose:157,enableDropImage:158,enablePasteImage:159,previewImageDataMaxSize:160,layoutDirectionPreference:161,layoutHorizontalUtilsPreference:162,layoutVerticalUtilsPreference:163,imagePreviewSrc:164,imageOrienter:165,pluginComponents:166,pluginOptions:7,sub:167,pluginInterface:0,root:1,imageSourceToImageData:8,imagePreview:9,imagePreviewCurrent:140,history:10},[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}get class(){return this.$$.ctx[141]}set class(e){this.$set({class:e}),Qn()}get layout(){return this.$$.ctx[142]}set layout(e){this.$set({layout:e}),Qn()}get stores(){return this.$$.ctx[143]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[2]}set locale(e){this.$set({locale:e}),Qn()}get id(){return this.$$.ctx[3]}set id(e){this.$set({id:e}),Qn()}get util(){return this.$$.ctx[144]}set util(e){this.$set({util:e}),Qn()}get utils(){return this.$$.ctx[145]}set utils(e){this.$set({utils:e}),Qn()}get animations(){return this.$$.ctx[146]}set animations(e){this.$set({animations:e}),Qn()}get disabled(){return this.$$.ctx[147]}set disabled(e){this.$set({disabled:e}),Qn()}get status(){return this.$$.ctx[139]}set status(e){this.$set({status:e}),Qn()}get previewUpscale(){return this.$$.ctx[148]}set previewUpscale(e){this.$set({previewUpscale:e}),Qn()}get elasticityMultiplier(){return this.$$.ctx[4]}set elasticityMultiplier(e){this.$set({elasticityMultiplier:e}),Qn()}get willRevert(){return this.$$.ctx[149]}set willRevert(e){this.$set({willRevert:e}),Qn()}get willProcessImage(){return this.$$.ctx[150]}set willProcessImage(e){this.$set({willProcessImage:e}),Qn()}get willRenderCanvas(){return this.$$.ctx[5]}set willRenderCanvas(e){this.$set({willRenderCanvas:e}),Qn()}get willRenderToolbar(){return this.$$.ctx[151]}set willRenderToolbar(e){this.$set({willRenderToolbar:e}),Qn()}get willSetHistoryInitialState(){return this.$$.ctx[152]}set willSetHistoryInitialState(e){this.$set({willSetHistoryInitialState:e}),Qn()}get enableButtonExport(){return this.$$.ctx[153]}set enableButtonExport(e){this.$set({enableButtonExport:e}),Qn()}get enableButtonRevert(){return this.$$.ctx[154]}set enableButtonRevert(e){this.$set({enableButtonRevert:e}),Qn()}get enableNavigateHistory(){return this.$$.ctx[155]}set enableNavigateHistory(e){this.$set({enableNavigateHistory:e}),Qn()}get enableToolbar(){return this.$$.ctx[6]}set enableToolbar(e){this.$set({enableToolbar:e}),Qn()}get enableUtils(){return this.$$.ctx[156]}set enableUtils(e){this.$set({enableUtils:e}),Qn()}get enableButtonClose(){return this.$$.ctx[157]}set enableButtonClose(e){this.$set({enableButtonClose:e}),Qn()}get enableDropImage(){return this.$$.ctx[158]}set enableDropImage(e){this.$set({enableDropImage:e}),Qn()}get enablePasteImage(){return this.$$.ctx[159]}set enablePasteImage(e){this.$set({enablePasteImage:e}),Qn()}get previewImageDataMaxSize(){return this.$$.ctx[160]}set previewImageDataMaxSize(e){this.$set({previewImageDataMaxSize:e}),Qn()}get layoutDirectionPreference(){return this.$$.ctx[161]}set layoutDirectionPreference(e){this.$set({layoutDirectionPreference:e}),Qn()}get layoutHorizontalUtilsPreference(){return this.$$.ctx[162]}set layoutHorizontalUtilsPreference(e){this.$set({layoutHorizontalUtilsPreference:e}),Qn()}get layoutVerticalUtilsPreference(){return this.$$.ctx[163]}set layoutVerticalUtilsPreference(e){this.$set({layoutVerticalUtilsPreference:e}),Qn()}get imagePreviewSrc(){return this.$$.ctx[164]}set imagePreviewSrc(e){this.$set({imagePreviewSrc:e}),Qn()}get imageOrienter(){return this.$$.ctx[165]}set imageOrienter(e){this.$set({imageOrienter:e}),Qn()}get pluginComponents(){return this.$$.ctx[166]}set pluginComponents(e){this.$set({pluginComponents:e}),Qn()}get pluginOptions(){return this.$$.ctx[7]}set pluginOptions(e){this.$set({pluginOptions:e}),Qn()}get sub(){return this.$$.ctx[167]}get pluginInterface(){return this.$$.ctx[0]}get root(){return this.$$.ctx[1]}set root(e){this.$set({root:e}),Qn()}get imageSourceToImageData(){return this.$$.ctx[8]}set imageSourceToImageData(e){this.$set({imageSourceToImageData:e}),Qn()}get imagePreview(){return this.$$.ctx[9]}get imagePreviewCurrent(){return this.$$.ctx[140]}set imagePreviewCurrent(e){this.$set({imagePreviewCurrent:e}),Qn()}get history(){return this.$$.ctx[10]}}const hu=["klass","stores","isVisible","isActive","isActiveFraction","locale"],pu=["history","klass","stores","navButtons","pluginComponents","pluginInterface","pluginOptions","sub","imagePreviewSrc","imagePreview","imagePreviewCurrent"];let mu;const gu=new Set([]),fu={},$u=new Map,yu=(...e)=>{e.filter((e=>!!e.util)).forEach((e=>{const[t,o]=e.util;$u.has(t)||($u.set(t,o),Ha(o).filter((e=>!hu.includes(e))).forEach((e=>{gu.add(e),fu[e]?fu[e].push(t):fu[e]=[t]})))}))};var bu=[...ia,"undo","redo","update","revert","destroy","show","hide","close","ready","loadpreview","selectshape","updateshape","addshape","removeshape"];var xu=(e,t,o={})=>{const{prefix:i="pintura:"}=o;return bu.map((o=>e.on(o,(e=>ut(t)?((e,t,o)=>e.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,cancelable:!0})))(t,`${i}${o}`,e):t(o,e)))))};const vu=e=>k(e[0]),wu=e=>!vu(e),Su=e=>e[1],ku=e=>e[3]||[];const Cu=(e,t,o,i=(e=>e))=>{const n=Ru(t,o),r=n.findIndex((e=>Su(e)===t));var a,s,l;a=n,s=i(r),l=e,a.splice(s,0,l)},Mu=(e,t)=>{const o=Ru(e,t);return kl(o,(t=>Su(t)===e)),o},Tu=(e,t)=>vu(t)?Su(t)===e?t:Tu(e,ku(t)):t.find((t=>Tu(e,t))),Ru=(e,t)=>wu(t)?t.find((t=>Su(t)===e))?t:t.find((t=>Ru(e,ku(t)))):Ru(e,ku(t)),Pu={borderColor:"strokeColor",borderWidth:"strokeWidth",lineWidth:"strokeWidth",fontColor:"color",lineColor:"strokeColor",src:"backgroundImage",fit:"backgroundSize"},Au=e=>0===e||"0%"===e||"0px"===e?0:/px$/.test(e)?parseInt(e,10):/\%$/.test(e)?e:e<=1?100*e+"%":void 0,Iu=(e,t)=>{let o,i;return/%$/.test(e)?(o=parseFloat(e),i=parseFloat(t),o+i+"%"):/px$/.test(e)?(o=parseInt(e,10),i=parseInt(t,10),o+i+"px"):void 0},Eu=(e,t)=>{const o=e,i=t,n=1.5707963267948966-t,r=Math.sin(1.5707963267948966),a=Math.sin(i),s=Math.sin(n),l=Math.cos(n),c=o/r;return G(l*(c*a),l*(c*s))},Lu=(e,{flip:t,aspectRatio:o,rotation:i,center:n,zoom:r,scaleToFit:a})=>{const s={},l=!n||n&&.5===n.x&&.5===n.y;t&&t.horizontal&&(s.flipHorizontal=t.horizontal),t&&t.vertical&&(s.flipVertical=t.vertical);const c=((e,t)=>null!=t?1/t:e.width/e.height)(e,o),d=!(!1===a),u=((e,t,o=1)=>{const i=e.height/e.width;let n=t,r=1,a=i;a>n&&(a=n,r=a/i);const s=Math.max(1/r,n/a),l=e.width/(o*s*r);return{width:l,height:l*t}})(e,o,r),h=l?e:((e,t)=>{const o=t.x>.5?1-t.x:t.x,i=t.y>.5?1-t.y:t.y;return be(2*o*e.width,2*i*e.height)})(e,d?n:{x:.5,y:.5}),p=((e,t)=>{let o=e.width,i=o*t;i>e.height&&(i=e.height,o=i/t);const n=.5*(e.width-o),r=.5*(e.height-i);return Oe(n,r,o,i)})(e,o);if((o||!l||r)&&(s.crop=Je(Le(h),c)),"number"==typeof i&&null!==i){null!=i&&(s.rotation=i);const t=((e,t)=>{const o=e.width,i=e.height,n=Eu(o,t),r=Eu(i,t),a=G(e.x+Math.abs(n.x),e.y-Math.abs(n.y)),s=G(e.x+e.width+Math.abs(r.y),e.y+Math.abs(r.x)),l=G(e.x-Math.abs(r.y),e.y+e.height-Math.abs(r.x));return{width:ce(a,s),height:ce(a,l)}})(p,i),o=Math.max(t.width/h.width,t.height/h.height),r=G(n.x*e.width,n.y*e.height),a=dt(e,i),l=we(a),c=G(.5*(a.width-e.width),.5*(a.height-e.height)),d=Ge({x:c.x+r.x-u.width/o*.5,y:c.y+r.y-u.height/o*.5,width:u.width/o,height:u.height/o},i),m=he(d.map(K),i,l.x,l.y),g=_e(Be(m)),f=he(m.map(K),-2*i,g.x,g.y);s.crop=Be(f)}else null!=r&&Ve(s.crop,1/r);return d||(s.cropLimitToImage=!1),s};let Fu=null;var Bu=e=>Math.round(100*e);const zu={base:0,min:-.25,max:.25,getLabel:e=>Bu(e/.25),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.brightness)return e.brightness[4]},setValue:(e,t)=>e.update((e=>({...e,brightness:[1,0,0,0,t,0,1,0,0,t,0,0,1,0,t,0,0,0,1,0]})))},Du={base:1,min:.5,max:1.5,getLabel:e=>Bu(2*(e-.5)-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.contrast)return e.contrast[0]},setValue:(e,t)=>e.update((e=>({...e,contrast:[t,0,0,0,.5*(1-t),0,t,0,0,.5*(1-t),0,0,t,0,.5*(1-t),0,0,0,1,0]})))},Ou={base:1,min:0,max:2,getLabel:e=>Bu(e-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.saturation)return(e.saturation[0]-.213)/.787},setValue:(e,t)=>e.update((e=>({...e,saturation:[.213+.787*t,.715-.715*t,.072-.072*t,0,0,.213-.213*t,.715+.285*t,.072-.072*t,0,0,.213-.213*t,.715-.715*t,.072+.928*t,0,0,0,0,0,1,0]})))},_u={base:1,min:.5,max:1.5,getLabel:e=>Bu(2*(e-.5)-1),getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(e.exposure)return e.exposure[0]},setValue:(e,t)=>e.update((e=>({...e,exposure:[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0]})))},Wu={base:1,min:.15,max:4,getLabel:e=>Bu(e<1?(e-.15)/.85-1:(e-1)/3),getStore:({imageGamma:e})=>e},Vu={base:0,min:-1,max:1,getStore:({imageVignette:e})=>e},Nu={base:0,min:-1,max:1,getStore:({imageConvolutionMatrix:e})=>e,getValue:e=>{if(e.clarity)return 0===e.clarity[0]?e.clarity[1]/-1:e.clarity[1]/-2},setValue:(e,t)=>{e.update((e=>({...e,clarity:t>=0?[0,-1*t,0,-1*t,1+4*t,-1*t,0,-1*t,0]:[-1*t,-2*t,-1*t,-2*t,1+-3*t,-2*t,-1*t,-2*t,-1*t]})))}},Hu={base:0,min:-1,max:1,getStore:({imageColorMatrix:e})=>e,getValue:e=>{if(!e.temperature)return;const t=e.temperature[0];return t>=1?(t-1)/.1:(1-t)/-.15},setValue:(e,t)=>e.update((e=>({...e,temperature:t>0?[1+.1*t,0,0,0,0,0,1,0,0,0,0,0,1+.1*-t,0,0,0,0,0,1,0]:[1+.15*t,0,0,0,0,0,1+.05*t,0,0,0,0,0,1+.15*-t,0,0,0,0,0,1,0]})))};var Uu={finetuneControlConfiguration:{gamma:Wu,brightness:zu,contrast:Du,saturation:Ou,exposure:_u,temperature:Hu,clarity:Nu,vignette:Vu},finetuneOptions:[["brightness",e=>e.finetuneLabelBrightness],["contrast",e=>e.finetuneLabelContrast],["saturation",e=>e.finetuneLabelSaturation],["exposure",e=>e.finetuneLabelExposure],["temperature",e=>e.finetuneLabelTemperature],["gamma",e=>e.finetuneLabelGamma],!ms()&&["clarity",e=>e.finetuneLabelClarity],["vignette",e=>e.finetuneLabelVignette]].filter(Boolean)};const ju=()=>[.75,.25,.25,0,0,.25,.75,.25,0,0,.25,.25,.75,0,0,0,0,0,1,0],Xu=()=>[1.398,-.316,.065,-.273,.201,-.051,1.278,-.08,-.273,.201,-.051,.119,1.151,-.29,.215,0,0,0,1,0],Yu=()=>[1.073,-.015,.092,-.115,-.017,.107,.859,.184,-.115,-.017,.015,.077,1.104,-.115,-.017,0,0,0,1,0],Gu=()=>[1.06,0,0,0,0,0,1.01,0,0,0,0,0,.93,0,0,0,0,0,1,0],qu=()=>[1.1,0,0,0,-.1,0,1.1,0,0,-.1,0,0,1.2,0,-.1,0,0,0,1,0],Ku=()=>[.212,.715,.114,0,0,.212,.715,.114,0,0,.212,.715,.114,0,0,0,0,0,1,0],Zu=()=>[.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,0,0,0,1,0],Ju=()=>[.163,.518,.084,-.01,.208,.163,.529,.082,-.02,.21,.171,.529,.084,0,.214,0,0,0,1,0],Qu=()=>[.338,.991,.117,.093,-.196,.302,1.049,.096,.078,-.196,.286,1.016,.146,.101,-.196,0,0,0,1,0],eh=()=>[.393,.768,.188,0,0,.349,.685,.167,0,0,.272,.533,.13,0,0,0,0,0,1,0],th=()=>[.289,.62,.185,0,.077,.257,.566,.163,0,.115,.2,.43,.128,0,.188,0,0,0,1,0],oh=()=>[.269,.764,.172,.05,.1,.239,.527,.152,0,.176,.186,.4,.119,0,.159,0,0,0,1,0],ih=()=>[.547,.764,.134,0,-.147,.281,.925,.12,0,-.135,.225,.558,.33,0,-.113,0,0,0,1,0];var nh={filterFunctions:{chrome:Xu,fade:Yu,pastel:ju,cold:qu,warm:Gu,monoDefault:Ku,monoWash:Ju,monoNoir:Zu,monoStark:Qu,sepiaDefault:eh,sepiaRust:oh,sepiaBlues:th,sepiaColor:ih},filterOptions:[["Default",[[void 0,e=>e.labelDefault]]],["Classic",[["chrome",e=>e.filterLabelChrome],["fade",e=>e.filterLabelFade],["cold",e=>e.filterLabelCold],["warm",e=>e.filterLabelWarm],["pastel",e=>e.filterLabelPastel]]],["Monochrome",[["monoDefault",e=>e.filterLabelMonoDefault],["monoNoir",e=>e.filterLabelMonoNoir],["monoStark",e=>e.filterLabelMonoStark],["monoWash",e=>e.filterLabelMonoWash]]],["Sepia",[["sepiaDefault",e=>e.filterLabelSepiaDefault],["sepiaRust",e=>e.filterLabelSepiaRust],["sepiaBlues",e=>e.filterLabelSepiaBlues],["sepiaColor",e=>e.filterLabelSepiaColor]]]]};const rh={shape:{frameStyle:"solid",frameSize:"2.5%"},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%"/>'},ah={shape:{frameStyle:"solid",frameSize:"2.5%",frameRound:!0},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%" rx="12%"/>'},sh={shape:{frameStyle:"line",frameInset:"2.5%",frameSize:".3125%",frameRadius:0},thumb:'<div style="top:.5em;left:.5em;right:.5em;bottom:.5em;box-shadow:inset 0 0 0 1px currentColor"></div>'},lh={shape:{frameStyle:"line",frameAmount:2,frameInset:"2.5%",frameSize:".3125%",frameOffset:"1.25%",frameRadius:0},thumb:'<div style="top:.75em;left:.75em;right:.75em;bottom:.75em; outline: 3px double"></div>'},ch={shape:{frameStyle:"edge",frameInset:"2.5%",frameOffset:"5%",frameSize:".3125%"},thumb:'<div style="top:.75em;left:.5em;bottom:.75em;border-left:1px solid"></div><div style="top:.75em;right:.5em;bottom:.75em;border-right:1px solid"></div><div style="top:.5em;left:.75em;right:.75em;border-top:1px solid"></div><div style="bottom:.5em;left:.75em;right:.75em;border-bottom:1px solid"></div>'},dh={shape:{frameStyle:"edge",frameInset:"2.5%",frameSize:".3125%"},thumb:'<div style="top:-.5em;left:.5em;right:.5em;bottom:-.5em; box-shadow: inset 0 0 0 1px currentColor"></div><div style="top:.5em;left:-.5em;right:-.5em;bottom:.5em;box-shadow:inset 0 0 0 1px currentColor"></div>'},uh={shape:{frameStyle:"edge",frameOffset:"1.5%",frameSize:".3125%"},thumb:'<div style="top:.3125em;left:.5em;bottom:.3125em;border-left:1px solid"></div><div style="top:.3125em;right:.5em;bottom:.3125em;border-right:1px solid"></div><div style="top:.5em;left:.3125em;right:.3125em;border-top:1px solid"></div><div style="bottom:.5em;left:.3125em;right:.3125em;border-bottom:1px solid"></div>'},hh={shape:{frameStyle:"hook",frameInset:"2.5%",frameSize:".3125%",frameLength:"5%"},thumb:'<div style="top:.5em;left:.5em;width:.75em;height:.75em; border-left: 1px solid;border-top: 1px solid;"></div><div style="top:.5em;right:.5em;width:.75em;height:.75em; border-right: 1px solid;border-top: 1px solid;"></div><div style="bottom:.5em;left:.5em;width:.75em;height:.75em; border-left: 1px solid;border-bottom: 1px solid;"></div><div style="bottom:.5em;right:.5em;width:.75em;height:.75em; border-right: 1px solid;border-bottom: 1px solid;"></div>'},ph={shape:{frameStyle:"polaroid"},thumb:'<rect stroke-width="20%" x="-5%" y="-5%" width="110%" height="96%"/>'};var mh={frameStyles:{solidSharp:rh,solidRound:ah,lineSingle:sh,lineMultiple:lh,edgeSeparate:ch,edgeCross:dh,edgeOverlap:uh,hook:hh,polaroid:ph},frameOptions:[[void 0,e=>e.labelNone],["solidSharp",e=>e.frameLabelMatSharp],["solidRound",e=>e.frameLabelMatRound],["lineSingle",e=>e.frameLabelLineSingle],["lineMultiple",e=>e.frameLabelLineMultiple],["edgeCross",e=>e.frameLabelEdgeCross],["edgeSeparate",e=>e.frameLabelEdgeSeparate],["edgeOverlap",e=>e.frameLabelEdgeOverlap],["hook",e=>e.frameLabelCornerHooks],["polaroid",e=>e.frameLabelPolaroid]]},gh=(e,t,o)=>{let i,n,r;const a=Math.floor(6*e),s=6*e-a,l=o*(1-t),c=o*(1-s*t),d=o*(1-(1-s)*t);switch(a%6){case 0:i=o,n=d,r=l;break;case 1:i=c,n=o,r=l;break;case 2:i=l,n=o,r=d;break;case 3:i=l,n=c,r=o;break;case 4:i=d,n=l,r=o;break;case 5:i=o,n=l,r=c}return[i,n,r]};function fh(e){let t,o,i;return{c(){t=gn("div"),o=gn("span"),Sn(t,"class","PinturaColorPreview"),Sn(t,"title",e[0]),Sn(t,"style",i="--color:"+e[1])},m(e,i){pn(e,t,i),hn(t,o)},p(e,[o]){1&o&&Sn(t,"title",e[0]),2&o&&i!==(i="--color:"+e[1])&&Sn(t,"style",i)},i:Vi,o:Vi,d(e){e&&mn(t)}}}function $h(e,t,o){let i,{color:n}=t,{title:r}=t;return e.$$set=e=>{"color"in e&&o(2,n=e.color),"title"in e&&o(0,r=e.title)},e.$$.update=()=>{4&e.$$.dirty&&o(1,i=n?no(n):"transparent")},[r,i,n]}class yh extends Sr{constructor(e){super(),wr(this,e,$h,fh,Gi,{color:2,title:0})}}function bh(e){let t,o;return{c(){t=gn("span"),o=$n(e[0])},m(e,i){pn(e,t,i),hn(t,o)},p(e,t){1&t[0]&&Cn(o,e[0])},d(e){e&&mn(t)}}}function xh(e){let t,o,i,n;o=new yh({props:{color:e[4],title:mc(e[8],e[10])}});let r=!e[9]&&bh(e);return{c(){t=gn("span"),yr(o.$$.fragment),i=yn(),r&&r.c(),Sn(t,"slot","label"),Sn(t,"class","PinturaButtonLabel")},m(e,a){pn(e,t,a),br(o,t,null),hn(t,i),r&&r.m(t,null),n=!0},p(e,i){const n={};16&i[0]&&(n.color=e[4]),1280&i[0]&&(n.title=mc(e[8],e[10])),o.$set(n),e[9]?r&&(r.d(1),r=null):r?r.p(e,i):(r=bh(e),r.c(),r.m(t,null))},i(e){n||(sr(o.$$.fragment,e),n=!0)},o(e){lr(o.$$.fragment,e),n=!1},d(e){e&&mn(t),xr(o),r&&r.d()}}}function vh(e){let t,o,i,n,r,a,s,l,c,d,u,h,p;c=new rd({props:{class:"PinturaHuePicker",knobStyle:"background-color:"+e[19],onchange:e[24],value:e[14],min:0,max:1,step:.01}});let m=e[11]&&wh(e);return{c(){t=gn("div"),o=gn("div"),i=gn("div"),n=gn("div"),l=yn(),yr(c.$$.fragment),d=yn(),m&&m.c(),Sn(n,"role","button"),Sn(n,"aria-label","Saturation slider"),Sn(n,"class","PinturaPickerKnob"),Sn(n,"tabindex","0"),Sn(n,"style",r=`background-color:${e[18]};`),Sn(i,"class","PinturaPickerKnobController"),Sn(i,"style",a=`transform:translate(${e[21]}%,${e[22]}%)`),Sn(o,"class","PinturaSaturationPicker"),Sn(o,"style",s="background-color: "+e[19]),Sn(t,"class","PinturaPicker")},m(r,a){pn(r,t,a),hn(t,o),hn(o,i),hn(i,n),e[31](o),hn(t,l),br(c,t,null),hn(t,d),m&&m.m(t,null),u=!0,h||(p=[xn(n,"nudge",e[27]),rn(Ml.call(null,n)),xn(o,"pointerdown",e[26])],h=!0)},p(e,l){(!u||262144&l[0]&&r!==(r=`background-color:${e[18]};`))&&Sn(n,"style",r),(!u||6291456&l[0]&&a!==(a=`transform:translate(${e[21]}%,${e[22]}%)`))&&Sn(i,"style",a),(!u||524288&l[0]&&s!==(s="background-color: "+e[19]))&&Sn(o,"style",s);const d={};524288&l[0]&&(d.knobStyle="background-color:"+e[19]),16384&l[0]&&(d.value=e[14]),c.$set(d),e[11]?m?(m.p(e,l),2048&l[0]&&sr(m,1)):(m=wh(e),m.c(),sr(m,1),m.m(t,null)):m&&(rr(),lr(m,1,1,(()=>{m=null})),ar())},i(e){u||(sr(c.$$.fragment,e),sr(m),u=!0)},o(e){lr(c.$$.fragment,e),lr(m),u=!1},d(o){o&&mn(t),e[31](null),xr(c),m&&m.d(),h=!1,Xi(p)}}}function wh(e){let t,o;return t=new rd({props:{class:"PinturaOpacityPicker",knobStyle:"background-color: "+e[16],trackStyle:`background-image: linear-gradient(to right, ${e[17]}, ${e[18]})`,onchange:e[25],value:e[15],min:0,max:1,step:.01}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};65536&o[0]&&(i.knobStyle="background-color: "+e[16]),393216&o[0]&&(i.trackStyle=`background-image: linear-gradient(to right, ${e[17]}, ${e[18]})`),32768&o[0]&&(i.value=e[15]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Sh(e){let t,o;return t=new Nc({props:{label:"Presets",class:Us(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"]),hideLabel:!1,name:e[1],value:e[4],optionGroupClass:"PinturaDropdownOptionGroup",optionClass:"PinturaDropdownOption",options:e[2].map(e[32]),selectedIndex:e[3],optionMapper:e[7],optionLabelClass:e[6],onchange:e[33],$$slots:{option:[Mh,({option:e})=>({44:e}),({option:e})=>[0,e?8192:0]],group:[kh,({option:e})=>({44:e}),({option:e})=>[0,e?8192:0]]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};512&o[0]&&(i.class=Us(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"])),2&o[0]&&(i.name=e[1]),16&o[0]&&(i.value=e[4]),1028&o[0]&&(i.options=e[2].map(e[32])),8&o[0]&&(i.selectedIndex=e[3]),128&o[0]&&(i.optionMapper=e[7]),64&o[0]&&(i.optionLabelClass=e[6]),512&o[0]|24576&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function kh(e){let t,o,i=e[44].label+"";return{c(){t=gn("span"),o=$n(i),Sn(t,"slot","group")},m(e,i){pn(e,t,i),hn(t,o)},p(e,t){8192&t[1]&&i!==(i=e[44].label+"")&&Cn(o,i)},d(e){e&&mn(t)}}}function Ch(e){let t,o,i=e[44].label+"";return{c(){t=gn("span"),o=$n(i),Sn(t,"class","PinturaButtonLabel")},m(e,i){pn(e,t,i),hn(t,o)},p(e,t){8192&t[1]&&i!==(i=e[44].label+"")&&Cn(o,i)},d(e){e&&mn(t)}}}function Mh(e){let t,o,i,n;o=new yh({props:{title:e[44].label,color:e[44].value}});let r=!e[9]&&Ch(e);return{c(){t=gn("span"),yr(o.$$.fragment),i=yn(),r&&r.c(),Sn(t,"slot","option")},m(e,a){pn(e,t,a),br(o,t,null),hn(t,i),r&&r.m(t,null),n=!0},p(e,i){const n={};8192&i[1]&&(n.title=e[44].label),8192&i[1]&&(n.color=e[44].value),o.$set(n),e[9]?r&&(r.d(1),r=null):r?r.p(e,i):(r=Ch(e),r.c(),r.m(t,null))},i(e){n||(sr(o.$$.fragment,e),n=!0)},o(e){lr(o.$$.fragment,e),n=!1},d(e){e&&mn(t),xr(o),r&&r.d()}}}function Th(e){let t,o,i,n=e[13]&&vh(e),r=e[12]&&Sh(e);return{c(){t=gn("div"),n&&n.c(),o=yn(),r&&r.c(),Sn(t,"slot","details"),Sn(t,"class","PinturaColorPickerPanel")},m(e,a){pn(e,t,a),n&&n.m(t,null),hn(t,o),r&&r.m(t,null),i=!0},p(e,i){e[13]?n?(n.p(e,i),8192&i[0]&&sr(n,1)):(n=vh(e),n.c(),sr(n,1),n.m(t,o)):n&&(rr(),lr(n,1,1,(()=>{n=null})),ar()),e[12]?r?(r.p(e,i),4096&i[0]&&sr(r,1)):(r=Sh(e),r.c(),sr(r,1),r.m(t,null)):r&&(rr(),lr(r,1,1,(()=>{r=null})),ar())},i(e){i||(sr(n),sr(r),i=!0)},o(e){lr(n),lr(r),i=!1},d(e){e&&mn(t),n&&n.d(),r&&r.d()}}}function Rh(e){let t,o;return t=new lc({props:{buttonClass:Us(["PinturaColorPickerButton",e[5]]),$$slots:{details:[Th],label:[xh]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};32&o[0]&&(i.buttonClass=Us(["PinturaColorPickerButton",e[5]])),8388575&o[0]|16384&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Ph(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,{label:m}=t,{name:g}=t,{options:f=[]}=t,{selectedIndex:$=-1}=t,{value:y}=t,{buttonClass:b}=t,{optionLabelClass:x}=t,{optionMapper:v}=t,{onchange:w}=t,{title:S}=t,{hidePresetLabel:k=!0}=t,{locale:C}=t,{enableOpacity:M=!0}=t,{enablePresets:T=!0}=t,{enablePicker:R=!0}=t;const P=(e,t)=>{if(c=[e[0],e[1],e[2]],t){let t=((e,t,o)=>{let i=Math.max(e,t,o),n=i-Math.min(e,t,o),r=n&&(i==e?(t-o)/n:i==t?2+(o-e)/n:4+(e-t)/n);return[60*(r<0?r+6:r)/360,i&&n/i,i]})(...c);o(14,r=t[0]),o(29,a=t[1]),o(30,s=t[2]),o(15,l=Xt(e[3])?e[3]:1)}o(16,d=no(e)),o(17,u=no([...c,0])),o(18,h=no([...c,1])),o(19,p=no(gh(r,1,1)))};y&&P(y,!0);const A=()=>{const e=[...gh(r,a,s),l];P(e),w(e)},I=e=>{const t=3===e.length?[...e,1]:e;P(t,!0),w(t)},E=(e,t)=>{const i=jr(e.x/t.width,0,1),n=jr(e.y/t.height,0,1);var r;r=1-n,o(29,a=i),o(30,s=r),0===l&&o(15,l=1),A()};let L,F,B,z;const D=e=>{const t=re(q(e),z);E(ne(K(B),t),F)},O=e=>{F=void 0,document.documentElement.removeEventListener("pointermove",D),document.documentElement.removeEventListener("pointerup",O)};return e.$$set=e=>{"label"in e&&o(0,m=e.label),"name"in e&&o(1,g=e.name),"options"in e&&o(2,f=e.options),"selectedIndex"in e&&o(3,$=e.selectedIndex),"value"in e&&o(4,y=e.value),"buttonClass"in e&&o(5,b=e.buttonClass),"optionLabelClass"in e&&o(6,x=e.optionLabelClass),"optionMapper"in e&&o(7,v=e.optionMapper),"onchange"in e&&o(28,w=e.onchange),"title"in e&&o(8,S=e.title),"hidePresetLabel"in e&&o(9,k=e.hidePresetLabel),"locale"in e&&o(10,C=e.locale),"enableOpacity"in e&&o(11,M=e.enableOpacity),"enablePresets"in e&&o(12,T=e.enablePresets),"enablePicker"in e&&o(13,R=e.enablePicker)},e.$$.update=()=>{536870912&e.$$.dirty[0]&&o(21,i=100*a),1073741824&e.$$.dirty[0]&&o(22,n=100-100*s)},[m,g,f,$,y,b,x,v,S,k,C,M,T,R,r,l,d,u,h,p,L,i,n,I,e=>{o(14,r=e),0===l&&o(15,l=1),A()},e=>{o(15,l=e),A()},e=>{e.stopPropagation(),F=be(L.offsetWidth,L.offsetHeight),B=(e=>G(e.offsetX,e.offsetY))(e),z=q(e),E(B,F),document.documentElement.addEventListener("pointermove",D),document.documentElement.addEventListener("pointerup",O)},e=>{F=be(L.offsetWidth,L.offsetHeight);const t=i/100*F.width,o=n/100*F.height;E({x:t+e.detail.x,y:o+e.detail.y},F)},w,a,s,function(e){Un[e?"unshift":"push"]((()=>{L=e,o(20,L)}))},([e,t])=>[e,qt(t)?t(C):t],e=>I(e.value)]}class Ah extends Sr{constructor(e){super(),wr(this,e,Ph,Rh,Gi,{label:0,name:1,options:2,selectedIndex:3,value:4,buttonClass:5,optionLabelClass:6,optionMapper:7,onchange:28,title:8,hidePresetLabel:9,locale:10,enableOpacity:11,enablePresets:12,enablePicker:13},[-1,-1])}}var Ih=e=>e.charAt(0).toUpperCase()+e.slice(1);let Eh=null;var Lh=()=>{if(null===Eh)if(u())try{Eh=!1===document.fonts.check("16px TestNonExistingFont")}catch(e){Eh=!1}else Eh=!1;return Eh};const Fh=(e,t)=>o=>o[t?`${t}${Ih(e)}`:e],Bh=e=>[e,""+e],zh=(e,t)=>o=>[e[o],Fh(o,t)],Dh=[1,.2549,.2118],Oh=[1,1,1,0],_h={path:()=>({points:[],disableErase:!1}),eraser:()=>({eraseRadius:0}),line:()=>({x1:0,y1:0,x2:0,y2:0,disableErase:!1}),rectangle:()=>({x:0,y:0,width:0,height:0}),ellipse:()=>({x:0,y:0,rx:0,ry:0}),text:()=>({x:0,y:0,text:"Text"})},Wh=(e,t={},o={position:"relative"})=>{if(!_h[e])return;return[{..._h[e](),...t},o]},Vh=e=>({sharpie:Wh("path",{strokeWidth:"0.5%",strokeColor:[...Dh],disableMove:!0}),eraser:Wh("eraser"),line:Wh("line",{strokeColor:[...Dh],strokeWidth:"0.5%"}),arrow:Wh("line",{lineStart:"none",lineEnd:"arrow-solid",strokeColor:[...Dh],strokeWidth:"0.5%"}),rectangle:Wh("rectangle",{strokeColor:[...Oh],backgroundColor:[...Dh]}),ellipse:Wh("ellipse",{strokeColor:[...Oh],backgroundColor:[...Dh]}),text:Wh("text",{color:[...Dh],fontSize:"2%"}),...e}),Nh=(e,t,o)=>[e,t||Fh(e,"shapeLabelTool"),{icon:Fh(e,"shapeIconTool"),...o}],Hh=(e=["sharpie","eraser","line","arrow","rectangle","ellipse","text","preset"])=>e.map((e=>k(e)?Nh(e):Array.isArray(e)?v(e[1])?Nh(e[0],void 0,e[1]):Nh(e[0],e[1],e[2]):void 0)).filter(Boolean),Uh=()=>({transparent:[1,1,1,0],white:[1,1,1],silver:[.8667,.8667,.8667],gray:[.6667,.6667,.6667],black:[0,0,0],navy:[0,.1216,.2471],blue:[0,.4549,.851],aqua:[.498,.8588,1],teal:[.2235,.8,.8],olive:[.2392,.6,.4392],green:[.1804,.8,.251],yellow:[1,.8627,0],orange:[1,.5216,.1059],red:[1,.2549,.2118],maroon:[.5216,.0784,.2941],fuchsia:[.9412,.0706,.7451],purple:[.6941,.051,.7882]}),jh=()=>({extraSmall:"2%",small:"4%",mediumSmall:"8%",medium:"10%",mediumLarge:"15%",large:"20%",extraLarge:"25%"}),Xh=()=>({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}),Yh=()=>["bar","arrow","arrowSolid","circle","circleSolid","square","squareSolid"],Gh=()=>[["Helvetica, Arial, Verdana, 'Droid Sans', sans-serif","Sans Serif"],["'Arial Black', 'Avenir-Black', 'Arial Bold'","Black"],["'Arial Narrow', 'Futura-CondensedMedium'","Narrow"],["'Trebuchet MS'","Humanist"],["Georgia, 'Avenir-Black', 'Times New Roman', 'Droid Serif', serif","Serif"],["Palatino","Old-Style"],["'Times New Roman', 'TimesNewRomanPSMT'","Transitional"],["Menlo, Monaco, 'Lucida Console', monospace","Monospaced"],["'Courier New', monospace","Slab Serif"]],qh=()=>["left","center","right"],Kh=()=>[["normal","bold"],["italic","normal"],["italic","bold"]],Zh=e=>Object.keys(e).map(zh(e,"shapeTitleColor")),Jh=e=>Object.keys(e).map(zh(e,"labelSize")),Qh=e=>Object.keys(e).map(zh(e,"labelSize")),ep=e=>[...e],tp=e=>e.map((e=>[e,t=>t["shapeLabelFontStyle"+e.filter((e=>"normal"!==e)).map(Ih).join("")]])),op=e=>e.map((e=>[Td(e),t=>t["shapeTitleLineDecoration"+Ih(e)],{icon:t=>t["shapeIconLineDecoration"+Ih(e)]}])),ip=e=>e.map((e=>[e,t=>t["shapeTitleTextAlign"+Ih(e)],{hideLabel:!0,icon:t=>t["shapeIconTextAlign"+Ih(e)]}])),np=(e,t)=>{const{defaultKey:o,defaultOptions:i}=t||{};let n=[];return o&&(n[0]=[void 0,e=>e[o],{...i}]),[...n,...e]},rp=e=>e.split(",").map((e=>e.trim())).some((e=>document.fonts.check("16px "+e))),ap=e=>[Ah,{title:e=>e.labelColor,options:np(e)}],sp=(e={})=>[hd,{...e}],lp=e=>[Qc,{title:e=>e.shapeTitleFontFamily,onload:({options:e=[]})=>{Lh()&&e.map((([e])=>e)).filter(Boolean).filter((e=>!rp(e))).forEach((e=>{const t="PinturaFontTest-"+e.replace(/[^a-zA-Z0-9]+/g,"").toLowerCase();document.getElementById(t)||document.body.appendChild(g("span",{textContent:" ",id:t,style:`font-family:${e};font-size:0;color:transparent;`}))}))},ondestroy:()=>{if(!Lh())return;document.querySelectorAll(".PinturaFontTest").forEach((e=>e.remove()))},optionLabelStyle:e=>"font-family: "+e,options:np(e,{defaultKey:"labelDefault"}),optionFilter:e=>{if(!Lh())return!0;const[t]=e;if(!t)return!0;return rp(t)}}],cp=e=>[Ah,{title:e=>e.shapeTitleBackgroundColor,options:np(e)}],dp=(e,t={})=>[Ah,{title:e=>e.shapeTitleStrokeColor,options:np(e),buttonClass:"PinturaColorPickerButtonStroke",onchange:(e,o)=>{const i=o.strokeWidth;(Xt(i)||k(i)?parseFloat(i):0)>0||(o.strokeWidth=t&&t.defaultStrokeWidth||"0.5%")}}],up=e=>[Qc,{title:e=>e.shapeTitleStrokeWidth,options:t=>Gt(t,"backgroundColor")?np(e,{defaultKey:"shapeLabelStrokeNone"}):np(e)}],hp=(e,t,o)=>[Qc,{title:e=>e[t],options:np(e,{defaultKey:"labelNone",defaultOptions:{icon:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H14"/></g>'}}),optionIconStyle:o}],pp=e=>hp(e,"shapeTitleLineStart","transform: scaleX(-1)"),mp=e=>hp(e,"shapeTitleLineEnd"),gp=e=>[Ah,{title:e=>e.shapeTitleTextColor,options:np(e)}],fp=e=>[Qc,{title:e=>e.shapeTitleFontStyle,optionLabelStyle:e=>e&&`font-style:${e[0]};font-weight:${e[1]}`,options:np(e,{defaultKey:"shapeLabelFontStyleNormal"})}],$p=e=>[Qc,{title:e=>e.shapeTitleFontSize,options:np(e,{defaultKey:"labelDefault"})}],yp=e=>[Nc,{title:e=>e.shapeTitleTextAlign,options:np(e)}],bp=(e={})=>{const{colorOptions:t=Zh(Uh()),strokeWidthOptions:o=Qh(Xh()),lineEndStyleOptions:i=op(Yh()),fontFamilyOptions:n=ep(Gh()),fontStyleOptions:r=tp(Kh()),fontSizeOptions:a=Jh(jh()),textAlignOptions:s=ip(qh())}=e;return{defaultColor:t&&ap(t),defaultNumber:sp(),defaultPercentage:sp({getValue:e=>parseFloat(e),setValue:e=>e+"%",step:.05,label:(e,t,o)=>Math.round(e/o*100)+"%",labelClass:"PinturaPercentageLabel"}),backgroundColor:t&&cp(t),strokeColor:t&&dp(t),strokeWidth:o&&up(o),lineStart:i&&pp(i),lineEnd:i&&mp(i),color:t&&gp(t),fontFamily:n&&lp(n),fontStyle_fontWeight:r&&fp(r),fontSize:a&&$p(a),textAlign:s&&yp(s),frameColor:["defaultColor"],frameSize:["defaultPercentage",{min:.2,max:10,title:e=>e.labelSize}],frameInset:["defaultPercentage",{min:.5,max:10,title:e=>e.labelInset}],frameOffset:["defaultPercentage",{min:.5,max:10,title:e=>e.labelOffset}],frameRadius:["defaultPercentage",{min:.5,max:10,title:e=>e.labelRadius}],frameAmount:["defaultNumber",{min:1,max:5,step:1,title:e=>e.labelAmount}]}};function xp(e){let t,o,i,n;const r=e[3].default,a=Ji(r,e,e[2],null);return{c(){t=gn("div"),a&&a.c(),Sn(t,"class",e[0])},m(r,s){pn(r,t,s),a&&a.m(t,null),o=!0,i||(n=[xn(t,"measure",e[1]),rn(as.call(null,t))],i=!0)},p(e,[i]){a&&a.p&&4&i&&en(a,r,e,e[2],i,null,null),(!o||1&i)&&Sn(t,"class",e[0])},i(e){o||(sr(a,e),o=!0)},o(e){lr(a,e),o=!1},d(e){e&&mn(t),a&&a.d(e),i=!1,Xi(n)}}}function vp(e,t,o){let{$$slots:i={},$$scope:n}=t;const r=_n();let{class:a=null}=t;return e.$$set=e=>{"class"in e&&o(0,a=e.class),"$$scope"in e&&o(2,n=e.$$scope)},[a,({detail:e})=>r("measure",e),n,i]}class wp extends Sr{constructor(e){super(),wr(this,e,vp,xp,Gi,{class:0})}}const Sp=e=>({}),kp=e=>({}),Cp=e=>({}),Mp=e=>({}),Tp=e=>({}),Rp=e=>({});function Pp(e){let t,o;const i=e[4].header,n=Ji(i,e,e[3],Rp);return{c(){t=gn("div"),n&&n.c(),Sn(t,"class","PinturaUtilHeader")},m(e,i){pn(e,t,i),n&&n.m(t,null),o=!0},p(e,t){n&&n.p&&8&t&&en(n,i,e,e[3],t,Tp,Rp)},i(e){o||(sr(n,e),o=!0)},o(e){lr(n,e),o=!1},d(e){e&&mn(t),n&&n.d(e)}}}function Ap(e){let t,o;const i=e[4].footer,n=Ji(i,e,e[3],kp);return{c(){t=gn("div"),n&&n.c(),Sn(t,"class","PinturaUtilFooter")},m(e,i){pn(e,t,i),n&&n.m(t,null),o=!0},p(e,t){n&&n.p&&8&t&&en(n,i,e,e[3],t,Sp,kp)},i(e){o||(sr(n,e),o=!0)},o(e){lr(n,e),o=!1},d(e){e&&mn(t),n&&n.d(e)}}}function Ip(e){let t,o,i,n,r,a,s=e[1]&&Pp(e);const l=e[4].main,c=Ji(l,e,e[3],Mp),d=c||function(e){let t,o;return t=new wp({props:{class:"PinturaStage"}}),t.$on("measure",e[5]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p:Vi,i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}(e);let u=e[2]&&Ap(e);return{c(){s&&s.c(),t=yn(),o=gn("div"),d&&d.c(),i=yn(),u&&u.c(),n=yn(),r=bn(),Sn(o,"class","PinturaUtilMain")},m(l,c){s&&s.m(l,c),pn(l,t,c),pn(l,o,c),d&&d.m(o,null),e[6](o),pn(l,i,c),u&&u.m(l,c),pn(l,n,c),pn(l,r,c),a=!0},p(e,[o]){e[1]?s?(s.p(e,o),2&o&&sr(s,1)):(s=Pp(e),s.c(),sr(s,1),s.m(t.parentNode,t)):s&&(rr(),lr(s,1,1,(()=>{s=null})),ar()),c&&c.p&&8&o&&en(c,l,e,e[3],o,Cp,Mp),e[2]?u?(u.p(e,o),4&o&&sr(u,1)):(u=Ap(e),u.c(),sr(u,1),u.m(n.parentNode,n)):u&&(rr(),lr(u,1,1,(()=>{u=null})),ar())},i(e){a||(sr(s),sr(d,e),sr(u),sr(false),a=!0)},o(e){lr(s),lr(d,e),lr(u),lr(false),a=!1},d(a){s&&s.d(a),a&&mn(t),a&&mn(o),d&&d.d(a),e[6](null),a&&mn(i),u&&u.d(a),a&&mn(n),a&&mn(r)}}}function Ep(e,t,o){let{$$slots:i={},$$scope:n}=t,{hasHeader:r=!!t.$$slots.header}=t,{hasFooter:a=!!t.$$slots.footer}=t,{root:s}=t;return e.$$set=e=>{o(7,t=Hi(Hi({},t),tn(e))),"hasHeader"in e&&o(1,r=e.hasHeader),"hasFooter"in e&&o(2,a=e.hasFooter),"root"in e&&o(0,s=e.root),"$$scope"in e&&o(3,n=e.$$scope)},t=tn(t),[s,r,a,n,i,function(t){Nn(e,t)},function(e){Un[e?"unshift":"push"]((()=>{s=e,o(0,s)}))}]}class Lp extends Sr{constructor(e){super(),wr(this,e,Ep,Ip,Gi,{hasHeader:1,hasFooter:2,root:0})}}function Fp(e){let t,o;return{c(){t=gn("div"),Sn(t,"class","PinturaRangeInputMeter"),Sn(t,"style",o=`transform: translateX(${e[8].x-e[9].x}px) translateY(${e[8].y-e[9].y}px)`)},m(o,i){pn(o,t,i),t.innerHTML=e[6]},p(e,i){64&i[0]&&(t.innerHTML=e[6]),256&i[0]&&o!==(o=`transform: translateX(${e[8].x-e[9].x}px) translateY(${e[8].y-e[9].y}px)`)&&Sn(t,"style",o)},d(e){e&&mn(t)}}}function Bp(e){let t,o,i,n,r,a,s,l,c,d,u,h=e[8]&&Fp(e);return{c(){t=gn("div"),o=gn("span"),i=$n(e[3]),n=yn(),r=gn("button"),a=$n(e[1]),l=yn(),c=gn("div"),h&&h.c(),Sn(o,"class","PinturaRangeInputValue"),Sn(r,"class","PinturaRangeInputReset"),Sn(r,"type","button"),r.disabled=s=e[0]===e[2],Sn(c,"class","PinturaRangeInputInner"),Sn(c,"style",e[7]),Sn(c,"data-value-limited",e[5]),Sn(t,"class","PinturaRangeInput"),Sn(t,"tabindex","0")},m(s,p){pn(s,t,p),hn(t,o),hn(o,i),hn(t,n),hn(t,r),hn(r,a),hn(t,l),hn(t,c),h&&h.m(c,null),d||(u=[xn(r,"click",e[14]),xn(c,"interactionstart",e[10]),xn(c,"interactionupdate",e[12]),xn(c,"interactionend",e[13]),xn(c,"interactionrelease",e[11]),rn(Cl.call(null,c,{inertia:!0})),xn(c,"measure",e[32]),rn(as.call(null,c)),xn(t,"wheel",e[16],{passive:!1}),xn(t,"nudge",e[17]),rn(Ml.call(null,t,{direction:"horizontal"}))],d=!0)},p(e,t){8&t[0]&&Cn(i,e[3]),2&t[0]&&Cn(a,e[1]),5&t[0]&&s!==(s=e[0]===e[2])&&(r.disabled=s),e[8]?h?h.p(e,t):(h=Fp(e),h.c(),h.m(c,null)):h&&(h.d(1),h=null),128&t[0]&&Sn(c,"style",e[7]),32&t[0]&&Sn(c,"data-value-limited",e[5])},i:Vi,o:Vi,d(e){e&&mn(t),h&&h.d(),d=!1,Xi(u)}}}function zp(e,t,o){let i,n,r,s,l,c,d,u,{labelReset:h="Reset"}=t,{direction:p="x"}=t,{min:m=0}=t,{max:g=1}=t,{base:f=m}=t,{value:$=0}=t,{valueLabel:y=0}=t,{valueMin:b}=t,{valueMax:x}=t,{oninputstart:v=a}=t,{oninputmove:w=a}=t,{oninputend:S=a}=t,{elasticity:k=0}=t;const C=(e,t,o)=>Math.ceil((e-o)/t)*t+o;let M,T,R;const P={x:2,y:0},A=(e,t,o)=>`M ${e-o} ${t} a ${o} ${o} 0 1 0 0 -1`;let I,E=void 0,L=!1,F={snap:!1,elastic:!1};const B=(e,t,o)=>{const i=e[p]+t[p],n=jr(i,I[1][p],I[0][p]),r=k?n+Tl(i-n,k):n,a=o.elastic?r:n,s=G(0,0);return s[p]=a,z.set(s,{hard:o.snap}),jr(O(s,p),m,g)},z=qa();Zi(e,z,(e=>o(8,u=e)));const D=(e,t)=>{const o=.5*(M[t]-s[t])-(ed(e,m,g)*s[t]-.5*s[t]);return{x:"x"===t?o:0,y:"y"===t?o:0}},O=(e,t)=>{const o=-(e[t]-.5*M[t])/s[t];return m+o*i};z.subscribe((e=>{e&&E&&w(jr(O(e,p),m,g))}));const _=e=>{const t=[D(null!=b?b:m,p),D(null!=x?x:g,p)],o={x:"x"===p?u.x+e:0,y:"y"===p?u.y+e:0},i=jr(o[p],t[1][p],t[0][p]),n={...u,[p]:i};nn(z,u=n,u);const r=jr(O(n,p),m,g);v(),w(r),S(r)};return e.$$set=e=>{"labelReset"in e&&o(1,h=e.labelReset),"direction"in e&&o(18,p=e.direction),"min"in e&&o(19,m=e.min),"max"in e&&o(20,g=e.max),"base"in e&&o(2,f=e.base),"value"in e&&o(0,$=e.value),"valueLabel"in e&&o(3,y=e.valueLabel),"valueMin"in e&&o(21,b=e.valueMin),"valueMax"in e&&o(22,x=e.valueMax),"oninputstart"in e&&o(23,v=e.oninputstart),"oninputmove"in e&&o(24,w=e.oninputmove),"oninputend"in e&&o(25,S=e.oninputend),"elasticity"in e&&o(26,k=e.elasticity)},e.$$.update=()=>{if(1572864&e.$$.dirty[0]&&o(28,i=g-m),2621440&e.$$.dirty[0]&&o(29,n=null!=b?Math.max(b,m):m),5242880&e.$$.dirty[0]&&o(30,r=null!=x?Math.min(x,g):g),1572868&e.$$.dirty[0]&&o(31,l=ed(f,m,g)),16&e.$$.dirty[0]|1&e.$$.dirty[1]&&M){const e=.5*M.y;let t,i=40*l,n="",r=M.y,a="";for(let o=0;o<=40;o++){const r=P.x+10*o,s=e;n+=A(r,s,o%5==0?2:.75)+" ",t=r+P.x,o===i&&(a=`<path d="M${r} ${s-4} l2 3 l-2 -1 l-2 1 z"/>`)}o(6,T=`<svg width="${t}" height="${r}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${r}" aria-hidden="true" focusable="false">\n ${a}\n <rect rx="4" ry="4" y="${e-4}"" height="8"/>\n <path fill-rule="evenodd" d="${n.trim()}"/></svg>`),o(27,R={x:t-2*P.x,y:r})}134217744&e.$$.dirty[0]&&(s=M&&R),1612185600&e.$$.dirty[0]&&o(5,c=n!==m||r!==g),1610612768&e.$$.dirty[0]&&o(7,d=c?function(e,t){const o=1/40,i=ed(e,m,g),n=ed(t,m,g);return`--range-mask-from:${100*fo(C(i,o,0)-.0125)}%;--range-mask-to:${100*fo(C(n,o,0)-.0125)}%`}(n,r):""),268697617&e.$$.dirty[0]&&i&&M&&M.x&&M.y&&z.set(D($,p))},[$,h,f,y,M,c,T,d,u,P,()=>{L=!1,E=Ki(z),I=[D(null!=b?b:m,p),D(null!=x?x:g,p)],v()},()=>{L=!0},({detail:e})=>{F.snap=!L,F.elastic=!L,B(E,e.translation,F)},({detail:e})=>{F.snap=!1,F.elastic=!1;const t=B(E,e.translation,F);if(E=void 0,I=void 0,Math.abs(t-f)<.01)return S(f);S(t)},()=>{o(0,$=jr(f,n,r)),v(),S($)},z,e=>{e.preventDefault(),e.stopPropagation();const t=8*Al(e);_(t)},({detail:e})=>{_(8*e[p])},p,m,g,b,x,v,w,S,k,R,i,n,r,l,e=>o(4,M=(e=>G(e.width,e.height))(e.detail))]}class Dp extends Sr{constructor(e){super(),wr(this,e,zp,Bp,Gi,{labelReset:1,direction:18,min:19,max:20,base:2,value:0,valueLabel:3,valueMin:21,valueMax:22,oninputstart:23,oninputmove:24,oninputend:25,elasticity:26},[-1,-1])}}function Op(e){let t,o,i,n,r;const a=e[7].default,s=Ji(a,e,e[6],null);return{c(){t=gn("div"),o=gn("div"),s&&s.c(),Sn(o,"class","PinturaToolbarInner"),Sn(t,"class","PinturaToolbar"),Sn(t,"data-layout",e[1]),Sn(t,"data-overflow",e[0])},m(a,l){pn(a,t,l),hn(t,o),s&&s.m(o,null),i=!0,n||(r=[xn(o,"measure",e[3]),rn(as.call(null,o)),xn(t,"measure",e[2]),rn(as.call(null,t))],n=!0)},p(e,[o]){s&&s.p&&64&o&&en(s,a,e,e[6],o,null,null),(!i||2&o)&&Sn(t,"data-layout",e[1]),(!i||1&o)&&Sn(t,"data-overflow",e[0])},i(e){i||(sr(s,e),i=!0)},o(e){lr(s,e),i=!1},d(e){e&&mn(t),s&&s.d(e),n=!1,Xi(r)}}}function _p(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,s=0,l=0,c=0;const d=()=>{o(0,n="compact"===i&&s>c?"overflow":void 0)};return e.$$set=e=>{"$$scope"in e&&o(6,a=e.$$scope)},e.$$.update=()=>{48&e.$$.dirty&&o(1,i=l>c?"compact":"default")},[n,i,({detail:e})=>{const{width:t}=e;o(5,c=t),d()},({detail:e})=>{const{width:t}=e;t>l&&o(4,l=t),s=t,n||d()},l,c,a,r]}class Wp extends Sr{constructor(e){super(),wr(this,e,_p,Op,Gi,{})}}const Vp={Top:"t",Right:"r",Bottom:"b",Left:"l",TopLeft:"tl",TopRight:"tr",BottomRight:"br",BottomLeft:"bl"},{Top:Np,Right:Hp,Bottom:Up,Left:jp,TopLeft:Xp,TopRight:Yp,BottomRight:Gp,BottomLeft:qp}=Vp;var Kp={[Np]:e=>({x:e.x,y:e.y}),[Yp]:e=>({x:e.x+e.width,y:e.y}),[Hp]:e=>({x:e.x+e.width,y:e.y}),[Gp]:e=>({x:e.x+e.width,y:e.y+e.height}),[Up]:e=>({x:e.x,y:e.y+e.height}),[qp]:e=>({x:e.x,y:e.y+e.height}),[jp]:e=>({x:e.x,y:e.y}),[Xp]:e=>({x:e.x,y:e.y})};function Zp(e,t,o){const i=e.slice();return i[12]=t[o].key,i[13]=t[o].translate,i[14]=t[o].scale,i[15]=t[o].type,i[16]=t[o].opacity,i}function Jp(e,t){let o,i,n,r,a,s,l,c;return{key:e,first:null,c(){o=gn("div"),Sn(o,"role","button"),Sn(o,"aria-label",i=`Drag ${t[15]} ${t[12]}`),Sn(o,"tabindex",n="edge"===t[15]?-1:0),Sn(o,"class","PinturaRectManipulator"),Sn(o,"data-direction",r=t[12]),Sn(o,"data-shape",a=""+("edge"===t[15]?"edge":""+t[0])),Sn(o,"style",s=`transform: translate3d(${t[13].x}px, ${t[13].y}px, 0) scale(${t[14].x}, ${t[14].y}); opacity: ${t[16]}`),this.first=o},m(e,i){pn(e,o,i),l||(c=[xn(o,"nudge",(function(){Yi(t[5](t[12]))&&t[5](t[12]).apply(this,arguments)})),rn(Ml.call(null,o)),xn(o,"interactionstart",(function(){Yi(t[4]("resizestart",t[12]))&&t[4]("resizestart",t[12]).apply(this,arguments)})),xn(o,"interactionupdate",(function(){Yi(t[4]("resizemove",t[12]))&&t[4]("resizemove",t[12]).apply(this,arguments)})),xn(o,"interactionend",(function(){Yi(t[4]("resizeend",t[12]))&&t[4]("resizeend",t[12]).apply(this,arguments)})),rn(Cl.call(null,o))],l=!0)},p(e,l){t=e,2&l&&i!==(i=`Drag ${t[15]} ${t[12]}`)&&Sn(o,"aria-label",i),2&l&&n!==(n="edge"===t[15]?-1:0)&&Sn(o,"tabindex",n),2&l&&r!==(r=t[12])&&Sn(o,"data-direction",r),3&l&&a!==(a=""+("edge"===t[15]?"edge":""+t[0]))&&Sn(o,"data-shape",a),2&l&&s!==(s=`transform: translate3d(${t[13].x}px, ${t[13].y}px, 0) scale(${t[14].x}, ${t[14].y}); opacity: ${t[16]}`)&&Sn(o,"style",s)},d(e){e&&mn(o),l=!1,Xi(c)}}}function Qp(e){let t,o=[],i=new Map,n=e[1];const r=e=>e[12];for(let t=0;t<n.length;t+=1){let a=Zp(e,n,t),s=r(a);i.set(s,o[t]=Jp(s,a))}return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=bn()},m(e,i){for(let t=0;t<o.length;t+=1)o[t].m(e,i);pn(e,t,i)},p(e,[a]){51&a&&(n=e[1],o=mr(o,a,r,1,e,n,i,t.parentNode,hr,Jp,t,Zp))},i:Vi,o:Vi,d(e){for(let t=0;t<o.length;t+=1)o[t].d(e);e&&mn(t)}}}function em(e,t,o){let i,n,r,{rect:a=null}=t,{visible:s=!1}=t,{style:l}=t;const c=qa(void 0,{precision:1e-4,stiffness:.2,damping:.4});Zi(e,c,(e=>o(8,n=e)));const d=qa(0,{precision:.001});let u;Zi(e,d,(e=>o(9,r=e)));const h=_n();return e.$$set=e=>{"rect"in e&&o(6,a=e.rect),"visible"in e&&o(7,s=e.visible),"style"in e&&o(0,l=e.style)},e.$$.update=()=>{128&e.$$.dirty&&c.set(s?1:.5),128&e.$$.dirty&&d.set(s?1:0),832&e.$$.dirty&&o(1,i=Object.keys(Vp).map(((e,t)=>{const o=Vp[e],i=Kp[o](a),s=1===o.length?"edge":"corner",l="corner"===s;return{key:o,type:s,scale:{x:/^(t|b)$/.test(o)?a.width:l?jr(n,.5,1.25):1,y:/^(r|l)$/.test(o)?a.height:l?jr(n,.5,1.25):1},translate:{x:i.x,y:i.y},opacity:r}})))},[l,i,c,d,(e,t)=>({detail:o})=>{u&&t!==u||"resizestart"!==e&&void 0===u||("resizestart"===e&&(u=t),"resizeend"===e&&(u=void 0),h(e,{direction:t,translation:o&&o.translation}))},e=>({detail:t})=>{h("resizestart",{direction:e,translation:{x:0,y:0}}),h("resizemove",{direction:e,translation:t}),h("resizeend",{direction:e,translation:{x:0,y:0}})},a,s,n,r]}class tm extends Sr{constructor(e){super(),wr(this,e,em,Qp,Gi,{rect:6,visible:7,style:0})}}var om=e=>{function t(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}const o=o=>{o.preventDefault(),e.addEventListener("gesturechange",i),e.addEventListener("gestureend",n),t("gesturedown")},i=e=>{e.preventDefault(),t("gestureupdate",e.scale)},n=e=>{t("gestureup",e.scale),e.preventDefault(),r()},r=()=>{e.removeEventListener("gesturechange",i),e.removeEventListener("gestureend",n)};return e.addEventListener("gesturestart",o),{destroy:()=>{r(),e.removeEventListener("gesturestart",o)}}},im=e=>G(e.clientX,e.clientY),nm={[Np]:Up,[Hp]:jp,[Up]:Np,[jp]:Hp,[Xp]:Gp,[Yp]:qp,[Gp]:Xp,[qp]:Yp},rm={[Np]:[.5,0],[Hp]:[1,.5],[Up]:[.5,1],[jp]:[0,.5],[Xp]:[0,0],[Yp]:[1,0],[Gp]:[1,1],[qp]:[0,1]},am=e=>{const t=e===jp||e===Hp,o=e===Np||e===Up;return[e===Hp||e===Yp||e===Gp,e===jp||e===qp||e===Xp,e===Np||e===Yp||e===Xp,e===Up||e===Gp||e===qp,t,o,t||o]};const sm=(e,t,o,i)=>{const{aspectRatio:n,minSize:r,maxSize:a}=i,s=t===Hp||t===Yp||t===Gp,l=t===jp||t===qp||t===Xp,c=t===Np||t===Yp||t===Xp,d=t===Up||t===Gp||t===qp,u=t===jp||t===Hp,h=t===Np||t===Up,p=Ie(o);s?(p.x=e.x,p.width-=e.x):l&&(p.width=e.x),d?(p.y=e.y,p.height-=e.y):c&&(p.height=e.y);const m=(g=Math.min(p.width,a.width),f=Math.min(p.height,a.height),Ae(0,0,g,f));var g,f;if(n)if(u){const t=Math.min(e.y,o.height-e.y);m.height=Math.min(2*t,m.height)}else if(h){const t=Math.min(e.x,o.width-e.x);m.width=Math.min(2*t,m.width)}const $=n?fe(Je(m,n)):m,y=n?fe(Ze(Le(r),n)):r;let b,x,v,w;s?b=e.x:l&&(x=e.x),d?v=e.y:c&&(w=e.y),s?x=b+y.width:l&&(b=x-y.width),d?w=v+y.height:c&&(v=w-y.height),u?(v=e.y-.5*y.height,w=e.y+.5*y.height):h&&(b=e.x-.5*y.width,x=e.x+.5*y.width);const S=Be(G(b,v),G(x,w));s?x=b+$.width:l&&(b=x-$.width),d?w=v+$.height:c&&(v=w-$.height),u?(v=e.y-.5*$.height,w=e.y+.5*$.height):h&&(b=e.x-.5*$.width,x=e.x+.5*$.width);return{inner:S,outer:Be(G(b,v),G(x,w))}};var lm=(e,t,o={})=>{const{target:i,translate:n}=t,{aspectRatio:r}=o,a=rm[nm[i]],s=ne(Ie(e),G(a[0]*e.width,a[1]*e.height)),l=rm[i],c=ne(Ie(e),G(l[0]*e.width,l[1]*e.height)),[d,u,h,p,m,g,f]=am(i);let $=n.x,y=n.y;m?y=0:g&&($=0);let[b,x,v,w]=Qe(e);if(d?w=s.x:u&&(x=s.x),p?b=s.y:h&&(v=s.y),d?x=c.x+$:u&&(w=c.x+$),p?v=c.y+y:h&&(b=c.y+y),r)if(f){let e=x-w,t=v-b;m?(t=e/r,b=s.y-.5*t,v=s.y+.5*t):g&&(e=t*r,w=s.x-.5*e,x=s.x+.5*e)}else{const e=G(c.x+$-s.x,c.y+y-s.y);i===Yp?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):i===Gp?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):i===qp?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):i===Xp&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=Q(e),o=G(r,1),n=ae(ee(o),t);i===Yp?(x=s.x+n.x,b=s.y-n.y):i===Gp?(x=s.x+n.x,v=s.y+n.y):i===qp?(w=s.x-n.x,v=s.y+n.y):i===Xp&&(w=s.x-n.x,b=s.y-n.y)}return Oe(w,b,x-w,v-b)},cm=e=>180*e/Math.PI;function dm(e){let t,o,i;return o=new Dp({props:{elasticity:e[5],min:e[7],max:e[8],value:e[12],valueMin:e[0],valueMax:e[1],labelReset:e[6],base:e[11],valueLabel:Math.round(cm(e[12]))+"°",oninputstart:e[2],oninputmove:e[14],oninputend:e[15]}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"class","PinturaImageRotator")},m(e,n){pn(e,t,n),br(o,t,null),i=!0},p(e,[t]){const i={};32&t&&(i.elasticity=e[5]),128&t&&(i.min=e[7]),256&t&&(i.max=e[8]),4096&t&&(i.value=e[12]),1&t&&(i.valueMin=e[0]),2&t&&(i.valueMax=e[1]),64&t&&(i.labelReset=e[6]),2048&t&&(i.base=e[11]),4096&t&&(i.valueLabel=Math.round(cm(e[12]))+"°"),4&t&&(i.oninputstart=e[2]),1544&t&&(i.oninputmove=e[14]),1552&t&&(i.oninputend=e[15]),o.$set(i)},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o)}}}function um(e,t,o){let i,n,r,s,l,c;const d=Math.PI/2,u=Math.PI/4;let{rotation:h}=t,{valueMin:p}=t,{valueMax:m}=t,{oninputstart:g=a}=t,{oninputmove:f=a}=t,{oninputend:$=a}=t,{elasticity:y=0}=t,{labelReset:b}=t;return e.$$set=e=>{"rotation"in e&&o(13,h=e.rotation),"valueMin"in e&&o(0,p=e.valueMin),"valueMax"in e&&o(1,m=e.valueMax),"oninputstart"in e&&o(2,g=e.oninputstart),"oninputmove"in e&&o(3,f=e.oninputmove),"oninputend"in e&&o(4,$=e.oninputend),"elasticity"in e&&o(5,y=e.elasticity),"labelReset"in e&&o(6,b=e.labelReset)},e.$$.update=()=>{384&e.$$.dirty&&o(11,r=i+.5*(n-i)),8192&e.$$.dirty&&o(9,s=Math.sign(h)),8192&e.$$.dirty&&o(10,l=Math.round(Math.abs(h)/d)*d),9728&e.$$.dirty&&o(12,c=h-s*l)},o(7,i=1e-9-u),o(8,n=u-1e-9),[p,m,g,f,$,y,b,i,n,s,l,r,c,h,e=>f(s*l+e),e=>$(s*l+e)]}class hm extends Sr{constructor(e){super(),wr(this,e,um,dm,Gi,{rotation:13,valueMin:0,valueMax:1,oninputstart:2,oninputmove:3,oninputend:4,elasticity:5,labelReset:6})}}function pm(e){let t,o,i,n,r;return{c(){t=gn("div"),o=gn("p"),i=$n(e[0]),n=$n(" × "),r=$n(e[1]),Sn(t,"class","PinturaImageInfo")},m(e,a){pn(e,t,a),hn(t,o),hn(o,i),hn(o,n),hn(o,r)},p(e,[t]){1&t&&Cn(i,e[0]),2&t&&Cn(r,e[1])},i:Vi,o:Vi,d(e){e&&mn(t)}}}function mm(e,t,o){let{width:i}=t,{height:n}=t;return e.$$set=e=>{"width"in e&&o(0,i=e.width),"height"in e&&o(1,n=e.height)},[i,n]}class gm extends Sr{constructor(e){super(),wr(this,e,mm,pm,Gi,{width:0,height:1})}}function fm(e){let t,o;return t=new Sd({props:{items:e[0]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};1&o[0]&&(i.items=e[0]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function $m(e){let t,o,i;return o=new Wp({props:{$$slots:{default:[fm]},$$scope:{ctx:e}}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"slot","header")},m(e,n){pn(e,t,n),br(o,t,null),i=!0},p(e,t){const i={};1&t[0]|64&t[6]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o)}}}function ym(e){let t,o;return t=new Sl({props:{onclick:e[80],label:e[4].cropLabelButtonRecenter,icon:e[4].cropIconButtonRecenter,class:"PinturaButtonCenter",disabled:!e[10],hideLabel:!0,style:`opacity: ${e[27]}; transform: translate3d(${e[28].x}px, ${e[28].y}px, 0)`}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.label=e[4].cropLabelButtonRecenter),16&o[0]&&(i.icon=e[4].cropIconButtonRecenter),1024&o[0]&&(i.disabled=!e[10]),402653184&o[0]&&(i.style=`opacity: ${e[27]}; transform: translate3d(${e[28].x}px, ${e[28].y}px, 0)`),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function bm(e){let t,o;return t=new tm({props:{rect:e[11],visible:e[9],style:e[2]}}),t.$on("resizestart",e[60]),t.$on("resizemove",e[61]),t.$on("resizeend",e[62]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};2048&o[0]&&(i.rect=e[11]),512&o[0]&&(i.visible=e[9]),4&o[0]&&(i.style=e[2]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function xm(e){let t,o;return t=new gm({props:{width:Math.round(e[7].width),height:Math.round(e[7].height)}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};128&o[0]&&(i.width=Math.round(e[7].width)),128&o[0]&&(i.height=Math.round(e[7].height)),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function vm(e){let t,o,i,n,r,a,s,l,c=e[17]&&e[18]&&ym(e),d=e[17]&&bm(e),u=e[16]&&xm(e);return{c(){t=gn("div"),o=gn("div"),c&&c.c(),i=yn(),d&&d.c(),r=yn(),u&&u.c(),Sn(o,"class","PinturaStage"),Sn(t,"slot","main")},m(h,p){pn(h,t,p),hn(t,o),c&&c.m(o,null),hn(o,i),d&&d.m(o,null),e[145](o),hn(t,r),u&&u.m(t,null),a=!0,s||(l=[xn(o,"measure",e[143]),rn(as.call(null,o)),xn(o,"wheel",(function(){Yi(e[3]&&e[79])&&(e[3]&&e[79]).apply(this,arguments)}),{passive:!1}),xn(o,"interactionstart",e[66]),xn(o,"interactionupdate",e[67]),xn(o,"interactionrelease",e[69]),xn(o,"interactionend",e[68]),rn(n=Cl.call(null,o,{drag:!0,pinch:e[3],inertia:!0,matchTarget:!0,getEventPosition:e[146]})),xn(o,"gesturedown",e[76]),xn(o,"gestureupdate",e[77]),xn(o,"gestureup",e[78]),rn(om.call(null,o))],s=!0)},p(r,a){(e=r)[17]&&e[18]?c?(c.p(e,a),393216&a[0]&&sr(c,1)):(c=ym(e),c.c(),sr(c,1),c.m(o,i)):c&&(rr(),lr(c,1,1,(()=>{c=null})),ar()),e[17]?d?(d.p(e,a),131072&a[0]&&sr(d,1)):(d=bm(e),d.c(),sr(d,1),d.m(o,null)):d&&(rr(),lr(d,1,1,(()=>{d=null})),ar()),n&&Yi(n.update)&&32776&a[0]&&n.update.call(null,{drag:!0,pinch:e[3],inertia:!0,matchTarget:!0,getEventPosition:e[146]}),e[16]?u?(u.p(e,a),65536&a[0]&&sr(u,1)):(u=xm(e),u.c(),sr(u,1),u.m(t,null)):u&&(rr(),lr(u,1,1,(()=>{u=null})),ar())},i(e){a||(sr(c),sr(d),sr(u),a=!0)},o(e){lr(c),lr(d),lr(u),a=!1},d(o){o&&mn(t),c&&c.d(),d&&d.d(),e[145](null),u&&u.d(),s=!1,Xi(l)}}}function wm(e){let t,o,i,n;const r=[{class:"PinturaControlList"},{tabs:e[12]},e[21]];let a={$$slots:{default:[Sm,({tab:e})=>({191:e}),({tab:e})=>[0,0,0,0,0,0,e?32:0]]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=Hi(a,r[e]);t=new Js({props:a}),t.$on("select",e[144]);const s=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[22]},e[21]];let l={$$slots:{default:[Mm,({panel:e})=>({190:e}),({panel:e})=>[0,0,0,0,0,0,e?16:0]]},$$scope:{ctx:e}};for(let e=0;e<s.length;e+=1)l=Hi(l,s[e]);return i=new dl({props:l}),{c(){yr(t.$$.fragment),o=yn(),yr(i.$$.fragment)},m(e,r){br(t,e,r),pn(e,o,r),br(i,e,r),n=!0},p(e,o){const n=2101248&o[0]?gr(r,[r[0],4096&o[0]&&{tabs:e[12]},2097152&o[0]&&fr(e[21])]):{};96&o[6]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n);const a=6291456&o[0]?gr(s,[s[0],s[1],4194304&o[0]&&{panels:e[22]},2097152&o[0]&&fr(e[21])]):{};117457168&o[0]|80&o[6]&&(a.$$scope={dirty:o,ctx:e}),i.$set(a)},i(e){n||(sr(t.$$.fragment,e),sr(i.$$.fragment,e),n=!0)},o(e){lr(t.$$.fragment,e),lr(i.$$.fragment,e),n=!1},d(e){xr(t,e),e&&mn(o),xr(i,e)}}}function Sm(e){let t,o,i=e[191].label+"";return{c(){t=gn("span"),o=$n(i)},m(e,i){pn(e,t,i),hn(t,o)},p(e,t){32&t[6]&&i!==(i=e[191].label+"")&&Cn(o,i)},d(e){e&&mn(t)}}}function km(e){let t,o;return t=new Dp({props:{elasticity:e[35]*e[36],base:Am,min:e[14],max:Pm,valueMin:e[25][0],valueMax:e[25][1],value:e[26],labelReset:e[4].labelReset,valueLabel:Math.round(100*e[26])+"%",oninputstart:e[73],oninputmove:e[74],oninputend:e[75]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};16384&o[0]&&(i.min=e[14]),33554432&o[0]&&(i.valueMin=e[25][0]),33554432&o[0]&&(i.valueMax=e[25][1]),67108864&o[0]&&(i.value=e[26]),16&o[0]&&(i.labelReset=e[4].labelReset),67108864&o[0]&&(i.valueLabel=Math.round(100*e[26])+"%"),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Cm(e){let t,o;return t=new hm({props:{elasticity:e[35]*e[36],rotation:e[8],labelReset:e[4].labelReset,valueMin:e[24][0],valueMax:e[24][1],oninputstart:e[63],oninputmove:e[64],oninputend:e[65]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};256&o[0]&&(i.rotation=e[8]),16&o[0]&&(i.labelReset=e[4].labelReset),16777216&o[0]&&(i.valueMin=e[24][0]),16777216&o[0]&&(i.valueMax=e[24][1]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Mm(e){let t,o,i,n;const r=[Cm,km],a=[];function s(e,t){return e[190]===e[85]+"-rotation"?0:e[190]===e[85]+"-zoom"?1:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=bn()},m(e,o){~t&&a[t].m(e,o),pn(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(rr(),lr(a[l],1,1,(()=>{a[l]=null})),ar()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sr(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(sr(o),n=!0)},o(e){lr(o),n=!1},d(e){~t&&a[t].d(e),e&&mn(i)}}}function Tm(e){let t,o,i=e[20]&&wm(e);return{c(){t=gn("div"),i&&i.c(),Sn(t,"slot","footer"),Sn(t,"style",e[23])},m(e,n){pn(e,t,n),i&&i.m(t,null),o=!0},p(e,n){e[20]?i?(i.p(e,n),1048576&n[0]&&sr(i,1)):(i=wm(e),i.c(),sr(i,1),i.m(t,null)):i&&(rr(),lr(i,1,1,(()=>{i=null})),ar()),(!o||8388608&n[0])&&Sn(t,"style",e[23])},i(e){o||(sr(i),o=!0)},o(e){lr(i),o=!1},d(e){e&&mn(t),i&&i.d()}}}function Rm(e){let t,o,i;function n(t){e[147](t)}let r={hasHeader:e[19],$$slots:{footer:[Tm],main:[vm],header:[$m]},$$scope:{ctx:e}};return void 0!==e[13]&&(r.root=e[13]),t=new Lp({props:r}),Un.push((()=>$r(t,"root",n))),t.$on("measure",e[148]),{c(){yr(t.$$.fragment)},m(e,o){br(t,e,o),i=!0},p(e,i){const n={};524288&i[0]&&(n.hasHeader=e[19]),536338429&i[0]|64&i[6]&&(n.$$scope={dirty:i,ctx:e}),!o&&8192&i[0]&&(o=!0,n.root=e[13],Kn((()=>o=!1))),t.$set(n)},i(e){i||(sr(t.$$.fragment,e),i=!0)},o(e){lr(t.$$.fragment,e),i=!1},d(e){xr(t,e)}}}const Pm=1,Am=0;function Im(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,f,$,y,b,x,v,w,S,k,C,M,T,P,A,I,E,L,F,B,z,D,O,V,H,j,X,Y,q,J,te,ie,se,le,ce,de,ue,he,pe,ge,ye,xe,Me,Te,Re,Pe,Ae,Ee,Fe,Be,ze,Ne=Vi,Xe=()=>(Ne(),Ne=qi(Ye,(e=>o(9,H=e))),Ye);e.$$.on_destroy.push((()=>Ne()));let{isActive:Ye}=t;Xe();let{stores:Ge}=t,{cropImageSelectionCornerStyle:et="circle"}=t,{cropWillRenderImageSelectionGuides:ot=((e,t)=>{const o="rotate"==e;return{rows:o?5:3,cols:o?5:3,opacity:.25*t}})}=t,{cropAutoCenterImageSelectionTimeout:it}=t,{cropEnableZoomMatchImageAspectRatio:nt=!0}=t,{cropEnableRotateMatchImageAspectRatio:rt="never"}=t,{cropEnableRotationInput:at=!0}=t,{cropEnableZoom:st=!0}=t,{cropEnableZoomInput:lt=!0}=t,{cropEnableZoomAutoHide:ct=!0}=t,{cropEnableImageSelection:dt=!0}=t,{cropEnableInfoIndicator:ut=!1}=t,{cropEnableZoomTowardsWheelPosition:ht=!0}=t,{cropEnableLimitWheelInputToCropSelection:pt=!0}=t,{cropEnableCenterImageSelection:mt=!0}=t,{cropEnableButtonRotateLeft:gt=!0}=t,{cropEnableButtonRotateRight:ft=!1}=t,{cropEnableButtonFlipHorizontal:$t=!0}=t,{cropEnableButtonFlipVertical:yt=!1}=t,{cropSelectPresetOptions:bt}=t,{cropEnableSelectPreset:xt=!0}=t,{cropEnableButtonToggleCropLimit:vt=!1}=t,{cropWillRenderTools:wt=W}=t,{locale:St={}}=t,{tools:kt=[]}=t,Ct="idle";const Mt=()=>void 0===P,Tt=(e,t,o)=>U(o)?t.width===Math.round(e.height)||t.height===Math.round(e.width):t.width===Math.round(e.width)||t.height===Math.round(e.height),Rt=()=>(Mt()||"always"===rt&&(()=>{if(1===P)return!1;const e=1/P;return!!bt&&!!hc(bt).find((([t])=>t===e))})())&&((e,t,o)=>{const i=Ce(Se(me(t),o),(e=>Math.abs(Math.round(e)))),n=we(i),r=_e(e);return oe(n,r)})(A,I,E)&&Tt(A,I,E),Pt=e=>{if("never"!==rt&&Rt()){nn(Xt,E+=e,E);const t=U(E),o=t?I.height:I.width,i=t?I.width:I.height;nn(oo,A=Oe(0,0,o,i),A),Mt()||nn(ao,P=_(o,i),P)}else nn(Xt,E+=e,E)},{history:At,env:It,isInteracting:Et,isInteractingFraction:Lt,rootRect:Ft,stageRect:Bt,utilRect:zt,rootLineColor:Dt,animation:Ot,elasticityMultiplier:_t,rangeInputElasticity:Wt,presentationScalar:Vt,imagePreviewModifiers:Nt,imageOutlineOpacity:Ht,imageFlipX:Ut,imageFlipY:jt,imageRotation:Xt,imageRotationRange:Yt,imageOutputSize:Gt,imageSelectionRect:qt,imageSelectionRectSnapshot:Zt,imageSelectionRectIntent:Jt,imageSelectionRectPresentation:Qt,imageCropRectIntent:eo,imageCropRectOrigin:to,imageCropRect:oo,imageCropMinSize:io,imageCropMaxSize:no,imageCropRange:ro,imageCropAspectRatio:ao,imageCropRectAspectRatio:so,imageCropLimitToImage:lo,imageSize:co,imageScalar:uo,imageOverlayMarkup:ho,framePadded:po}=Ge;let mo,go,$o;Zi(e,It,(e=>o(118,V=e))),Zi(e,Et,(e=>o(119,j=e))),Zi(e,Ft,(e=>o(15,de=e))),Zi(e,Bt,(e=>o(124,ue=e))),Zi(e,zt,(e=>o(123,ie=e))),Zi(e,Ot,(e=>o(141,Re=e))),Zi(e,Vt,(e=>o(122,q=e))),Zi(e,Nt,(e=>o(136,xe=e))),Zi(e,Ut,(e=>o(112,F=e))),Zi(e,jt,(e=>o(111,L=e))),Zi(e,Xt,(e=>o(8,E=e))),Zi(e,Yt,(e=>o(24,Ae=e))),Zi(e,Gt,(e=>o(159,z=e))),Zi(e,qt,(e=>o(121,Y=e))),Zi(e,Zt,(e=>o(120,X=e))),Zi(e,Jt,(e=>o(161,te=e))),Zi(e,Qt,(e=>o(127,pe=e))),Zi(e,eo,(e=>o(163,le=e))),Zi(e,to,(e=>o(162,se=e))),Zi(e,oo,(e=>o(7,A=e))),Zi(e,io,(e=>o(116,D=e))),Zi(e,no,(e=>o(160,J=e))),Zi(e,ro,(e=>o(164,ce=e))),Zi(e,ao,(e=>o(158,P=e))),Zi(e,lo,(e=>o(117,O=e))),Zi(e,co,(e=>o(110,I=e))),Zi(e,uo,(e=>o(134,ge=e))),Zi(e,ho,(e=>o(166,Me=e))),Zi(e,po,(e=>o(135,ye=e)));const yo=(e,t)=>{const o={target:e,translate:t};let i,n=lm(X,o,{aspectRatio:P});const r=fe(He(Ie(n),q));if(Vr(I,E),r.width<D.width||r.height<D.height){const o=t.y<0,n=t.x>0,a=t.x<0,s=t.y>0,l="t"===e&&o||"r"===e&&n||"b"===e&&s||"l"===e&&a||"tr"===e&&(n||o)||"tl"===e&&(a||o)||"br"===e&&(n||s)||"bl"===e&&(a||s),c=je(r),d=Nr(I,E,c);if(l&&(d.width<D.width||d.height<D.height)){if(0!==E){const e=Math.sign(E),t=Math.round(Math.abs(E)/N)*N,o=E-e*t,i=t/N%2==1,n=i?I.height:I.width,a=i?I.width:I.height,s=Math.abs(o),l=Math.sin(s),c=Math.cos(s);if(r.width<D.width){r.width=D.width;const e=n-(c*r.width+l*r.height),t=a-(l*r.width+c*r.height);e<t?r.height=(n-c*r.width)/l:t<e&&(r.height=(a-l*r.width)/c)}if(r.height<D.height){r.height=D.height;const e=n-(c*r.width+l*r.height),t=a-(l*r.width+c*r.height);e<t?r.width=(n-l*r.height)/c:t<e&&(r.width=(a-c*r.height)/l)}}else r.width<D.width&&(r.width=D.width,r.height=I.height),r.height<D.height&&(r.height=D.height,r.width=I.width);i=je(r)}}return i&&(n=lm(X,o,{aspectRatio:i||P})),{boundsLimited:((e,t,o,i={})=>{const{target:n,translate:r}=t,{aspectRatio:a,minSize:s,maxSize:l}=i,c=rm[nm[n]],d=ne(G(e.x,e.y),G(c[0]*e.width,c[1]*e.height)),u=rm[n],h=ne(Ie(e),G(u[0]*e.width,u[1]*e.height)),[p,m,g,f,$,y,b]=am(n);let x=r.x,v=r.y;$?v=0:y&&(x=0);const w=sm(d,n,o,{aspectRatio:a,minSize:s,maxSize:l});let[S,k,C,M]=Qe(e);if(p?M=d.x:m&&(k=d.x),f?S=d.y:g&&(C=d.y),p){const e=w.inner.x+w.inner.width,t=w.outer.x+w.outer.width;k=jr(h.x+x,e,t)}else if(m){const e=w.outer.x,t=w.inner.x;M=jr(h.x+x,e,t)}if(f){const e=w.inner.y+w.inner.height,t=w.outer.y+w.outer.height;C=jr(h.y+v,e,t)}else if(g){const e=w.outer.y,t=w.inner.y;S=jr(h.y+v,e,t)}if(a)if(b){let e=k-M,t=C-S;$?(t=e/a,S=d.y-.5*t,C=d.y+.5*t):y&&(e=t*a,M=d.x-.5*e,k=d.x+.5*e)}else{const e=G(h.x+x-d.x,h.y+v-d.y);n===Yp?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):n===Gp?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):n===qp?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):n===Xp&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=Q(e),o=Q(G(w.inner.width,w.inner.height)),i=Q(G(w.outer.width,w.outer.height)),r=jr(t,o,i),s=G(a,1),l=ae(ee(s),r);n===Yp?(k=d.x+l.x,S=d.y-l.y):n===Gp?(k=d.x+l.x,C=d.y+l.y):n===qp?(M=d.x-l.x,C=d.y+l.y):n===Xp&&(M=d.x-l.x,S=d.y-l.y)}return Oe(M,S,k-M,C-S)})(X,o,ie,{aspectRatio:P||i,minSize:go,maxSize:$o}),boundsIntent:n}};let bo=void 0,xo=void 0;const vo=({translation:e,scalar:t})=>{const o=Math.min(Y.width/A.width,Y.height/A.height),i=ae(K(e),1/o);let n;if(xo){const t=re(K(xo),e);xo=e,n=We(Ie(A),t)}else n=We(Ie(bo),Z(K(i))),void 0!==t&&Ve(n,1/t);nn(eo,le=n,le),nn(oo,A=n,A)},wo=Tr([ro,oo],(([e,t],o)=>{if(!t)return;const[i,n]=e,r=je(t);o([fe(tt(Ze(i,r),fo)),fe(tt(Je(n,r),fo))])}));Zi(e,wo,(e=>o(165,he=e)));const So=Tr([co,lo,io,no,ro,Xt],(([e,t,o,i,n,r],a)=>{if(!e)return;const s=n[0],l=n[1];let c,d;t?(c=((e,t,o)=>U(o)?1-1/Math.min(e.height/t.width,e.width/t.height):1-1/Math.min(e.width/t.width,e.height/t.height))(e,l,r),d=Math.min(s.width/o.width,s.height/o.height)):(d=1,c=-1);a([fo(c),fo(d)])}));Zi(e,So,(e=>o(25,Ee=e)));const ko=Tr([co,oo,ro,Xt],(([e,t,o,i],n)=>{if(!e||!t)return n(0);let r;const a=o[0],s=o[1],l=t.width,c=t.height,d=je(t),u=U(i)?be(e.height,e.width):e,h=Je(u,d);if(l<=h.width||c<=h.height){const e=h.width-a.width,t=h.height-a.height;r=0===e||0===t?1:1-Math.min((l-a.width)/e,(c-a.height)/t)}else{const e=s.width-h.width,t=s.height-h.height,o=Je({width:e,height:t},d);r=-Math.min((l-h.width)/o.width,(c-h.height)/o.height)}n(r)}));Zi(e,ko,(e=>o(26,Fe=e)));const Co=e=>{const t=je(bo);let o,i,n;const r=U(E)?be(I.height,I.width):I,a=Je(r,t);if(e>=0){const r=a.width-ce[0].width,s=a.height-ce[0].height;o=a.width-r*e,i=a.height-s*e,n=Ze({width:o,height:i},t)}else{const r=ce[1].width-a.width,s=ce[1].height-a.height;o=a.width+r*-e,i=a.height+s*-e,n=Je({width:o,height:i},t)}o=n.width,i=n.height;const s=bo.x+.5*bo.width-.5*o,l=bo.y+.5*bo.height-.5*i;nn(oo,A={x:s,y:l,width:o,height:i},A)};let Mo;const To=e=>{const t=Ve(Ie(Mo),1/e);nn(eo,le=t,le),nn(oo,A=t,A)};let Ro;const Po=_n(),Ao=()=>{Po("measure",Ie(ie))};let Io;const Eo=qa(0,{precision:1e-4});Zi(e,Eo,(e=>o(27,Be=e)));const Lo=qa();Zi(e,Lo,(e=>o(28,ze=e)));const Fo=Tr([ao,Gt],(([e,t],o)=>{if(!bt)return;const i=hc(bt),n=[...i].map((e=>e[0])).sort(((e,t)=>Kt(e[0])&&!Kt(t[0])?1:-1)).find((o=>{if(Kt(o)&&t){const[i,n]=o,r=t.width===i&&t.height===n,a=e===_(i,n);return r&&a}return o===e}));o(i.map((e=>e[0])).findIndex((e=>Kt(e)?qr(e,n):e===n)))}));Zi(e,Fo,(e=>o(114,B=e)));const Bo=e=>{if(!bt||-1===e)return;const t=hc(bt)[e][0];return t?Kt(t)?_(t[0],t[1]):t:void 0},zo=Tr([Dt,Qt,Lt],(([e,t,o],i)=>{const{rows:n,cols:r,opacity:a}=ot(Ct,o);if(!t||a<=0)return i([]);const{x:s,y:l,width:c,height:d}=t,u=c/r,h=d/n,p=[];for(let t=1;t<=n-1;t++){const o=l+h*t;p.push({id:"image-selection-guide-row-"+t,points:[G(s,o),G(s+c,o)],opacity:a,strokeWidth:1,strokeColor:e})}for(let t=1;t<=r-1;t++){const o=s+u*t;p.push({id:"image-selection-guide-col-"+t,points:[G(o,l),G(o,l+d)],opacity:a,strokeWidth:1,strokeColor:e})}i(p)}));Zi(e,zo,(e=>o(137,Te=e)));const Do="crop-"+R();let Oo,_o=Do+"-"+(at?"rotation":"zoom"),Wo=_o,Vo=void 0;const No=qa(Re?20:0);Zi(e,No,(e=>o(142,Pe=e)));return e.$$set=e=>{"isActive"in e&&Xe(o(1,Ye=e.isActive)),"stores"in e&&o(88,Ge=e.stores),"cropImageSelectionCornerStyle"in e&&o(2,et=e.cropImageSelectionCornerStyle),"cropWillRenderImageSelectionGuides"in e&&o(89,ot=e.cropWillRenderImageSelectionGuides),"cropAutoCenterImageSelectionTimeout"in e&&o(90,it=e.cropAutoCenterImageSelectionTimeout),"cropEnableZoomMatchImageAspectRatio"in e&&o(91,nt=e.cropEnableZoomMatchImageAspectRatio),"cropEnableRotateMatchImageAspectRatio"in e&&o(92,rt=e.cropEnableRotateMatchImageAspectRatio),"cropEnableRotationInput"in e&&o(93,at=e.cropEnableRotationInput),"cropEnableZoom"in e&&o(3,st=e.cropEnableZoom),"cropEnableZoomInput"in e&&o(94,lt=e.cropEnableZoomInput),"cropEnableZoomAutoHide"in e&&o(95,ct=e.cropEnableZoomAutoHide),"cropEnableImageSelection"in e&&o(96,dt=e.cropEnableImageSelection),"cropEnableInfoIndicator"in e&&o(97,ut=e.cropEnableInfoIndicator),"cropEnableZoomTowardsWheelPosition"in e&&o(98,ht=e.cropEnableZoomTowardsWheelPosition),"cropEnableLimitWheelInputToCropSelection"in e&&o(99,pt=e.cropEnableLimitWheelInputToCropSelection),"cropEnableCenterImageSelection"in e&&o(100,mt=e.cropEnableCenterImageSelection),"cropEnableButtonRotateLeft"in e&&o(101,gt=e.cropEnableButtonRotateLeft),"cropEnableButtonRotateRight"in e&&o(102,ft=e.cropEnableButtonRotateRight),"cropEnableButtonFlipHorizontal"in e&&o(103,$t=e.cropEnableButtonFlipHorizontal),"cropEnableButtonFlipVertical"in e&&o(104,yt=e.cropEnableButtonFlipVertical),"cropSelectPresetOptions"in e&&o(105,bt=e.cropSelectPresetOptions),"cropEnableSelectPreset"in e&&o(106,xt=e.cropEnableSelectPreset),"cropEnableButtonToggleCropLimit"in e&&o(107,vt=e.cropEnableButtonToggleCropLimit),"cropWillRenderTools"in e&&o(108,wt=e.cropWillRenderTools),"locale"in e&&o(4,St=e.locale),"tools"in e&&o(0,kt=e.tools)},e.$$.update=()=>{33554432&e.$$.dirty[3]&&o(132,u="overlay"===V.layoutMode),8192&e.$$.dirty[3]|256&e.$$.dirty[4]&&o(113,b=xt&&!u),1342177280&e.$$.dirty[3]&&o(128,a=ie&&Y&&qe(ie,Y)),268435456&e.$$.dirty[3]|16&e.$$.dirty[4]&&o(129,s=!(!Y||!a)),268435456&e.$$.dirty[3]|48&e.$$.dirty[4]&&o(115,l=s&&Ue(Y,a,(e=>fo(e,5)))),272&e.$$.dirty[0]|67034880&e.$$.dirty[3]&&o(0,kt=wt([gt&&["Button","rotate-left",{label:St.cropLabelButtonRotateLeft,labelClass:"PinturaToolbarContentWide",icon:St.cropIconButtonRotateLeft,onclick:()=>{Pt(-Math.PI/2),At.write()}}],ft&&["Button","rotate-right",{label:St.cropLabelButtonRotateRight,labelClass:"PinturaToolbarContentWide",icon:St.cropIconButtonRotateRight,onclick:()=>{Pt(Math.PI/2),At.write()}}],$t&&["Button","flip-horizontal",{label:St.cropLabelButtonFlipHorizontal,labelClass:"PinturaToolbarContentWide",icon:St.cropIconButtonFlipHorizontal,onclick:()=>{U(E)?nn(jt,L=!L,L):nn(Ut,F=!F,F),At.write()}}],yt&&["Button","flip-vertical",{label:St.cropLabelButtonFlipVertical,labelClass:"PinturaToolbarContentWide",icon:St.cropIconButtonFlipVertical,onclick:()=>{U(E)?nn(Ut,F=!F,F):nn(jt,L=!L,L),At.write()}}],b&&bt&&["Dropdown","select-preset",{icon:mc(St.cropIconSelectPreset,St,Bo(B)),label:St.cropLabelSelectPreset,labelClass:"PinturaToolbarContentWide",options:bt,selectedIndex:B,onchange:({value:e})=>{Kt(e)?(nn(ao,P=_(e[0],e[1]),P),nn(Gt,z=$e(e),z)):nn(ao,P=e,P),l&&Ao(),At.write()},optionMapper:e=>{let t=!1;const o=Kt(e.value)?e.value[0]/e.value[1]:e.value;if(o){const e=Nr(I,E,o);t=e.width<D.width||e.height<D.height}return e.icon=((e,t={})=>{const{width:o=24,height:i=24,bounds:n=16,radius:r=3}=t;let a,s,l,c,d=Kt(e)?_(e[0],e[1]):e,u=!!d;return d=u?d:1,l=d>1?n:d*n,c=l/d,a=Math.round(.5*(o-l)),s=Math.round(.5*(i-c)),`<rect fill="${u?"currentColor":"none"}" stroke="${u?"none":"currentColor"}" stroke-width="${o/16}" stroke-dasharray="${[o/12,o/6].join(" ")}" x="${a}" y="${s}" width="${l}" height="${c}" rx="${r}"/>`})(e.value,{bounds:14}),{...e,disabled:t}}}],vt&&["Dropdown","select-crop-limit",{icon:mc(St.cropIconCropBoundary,St,O),label:St.cropLabelCropBoundary,labelClass:"PinturaToolbarContentWide",onchange:({value:e})=>{nn(lo,O=e,O),At.write()},options:[[!0,St.cropLabelCropBoundaryEdge,{icon:mc(St.cropIconCropBoundary,St,!0)}],[!1,St.cropLabelCropBoundaryNone,{icon:mc(St.cropIconCropBoundary,St,!1)}]]}]].filter(Boolean),V,(()=>({}))).filter(Boolean)),512&e.$$.dirty[0]&&H&&Ht.set(1),16777216&e.$$.dirty[3]&&o(14,i=O?0:-1),1073741824&e.$$.dirty[3]|1&e.$$.dirty[4]&&o(125,n=ie&&G(-(ue.x-ie.x),-(ue.y-ie.y))),10&e.$$.dirty[4]&&o(126,r=pe&&G(Jl(pe.x+.5*pe.width+n.x),Jl(pe.y+.5*pe.height+n.y))),134217728&e.$$.dirty[3]&&o(130,c=null!=X),1073741824&e.$$.dirty[3]|16&e.$$.dirty[4]&&o(131,d=ie&&a&&(a.height===ie.height||a.width===ie.width)),536870912&e.$$.dirty[3]|1152&e.$$.dirty[4]&&o(133,h=!d&&q<1&&ge<1),4194304&e.$$.dirty[3]|608&e.$$.dirty[4]&&o(10,p=s&&!c&&(!l||h)),128&e.$$.dirty[0]|16&e.$$.dirty[3]|256&e.$$.dirty[4]&&o(16,m=ut&&!!A&&!u),10&e.$$.dirty[4]&&o(11,$=pe&&n&&{x:pe.x+n.x,y:pe.y+n.y,width:pe.width,height:pe.height}),2048&e.$$.dirty[0]|8&e.$$.dirty[3]|256&e.$$.dirty[4]&&o(17,g=dt&&!!$&&!u),268435456&e.$$.dirty[2]|128&e.$$.dirty[3]|4&e.$$.dirty[4]&&o(18,f=mt&&!!r&&!it),1024&e.$$.dirty[0]|268435456&e.$$.dirty[2]|67174400&e.$$.dirty[3]&&p&&it&&!j&&(clearTimeout(Io),o(109,Io=setTimeout(Ao,it))),67174400&e.$$.dirty[3]&&j&&clearTimeout(Io),1024&e.$$.dirty[0]&&Eo.set(p?1:0),4&e.$$.dirty[4]&&Lo.set(r),512&e.$$.dirty[0]|6144&e.$$.dirty[4]&&(H&&!ye?nn(Nt,xe.crop={maskOpacity:.85,maskMarkupOpacity:.85},xe):delete xe.crop),8192&e.$$.dirty[4]&&Te&&(()=>{const e=Me.filter((e=>!/^image\-selection\-guide/.test(e.id)));nn(ho,Me=H?[...e,...Te]:e,Me)})(),33554432&e.$$.dirty[3]&&o(138,y="short"!==V.verticalSpace),16640&e.$$.dirty[4]&&o(19,x=y&&!u),8&e.$$.dirty[0]|2&e.$$.dirty[3]&&o(139,v=st&&lt),4&e.$$.dirty[3]|49152&e.$$.dirty[4]&&o(140,w=ct?y&&v:v),1&e.$$.dirty[3]|65536&e.$$.dirty[4]&&o(20,S=at||w),65536&e.$$.dirty[4]&&(w||o(5,Wo=_o)),32&e.$$.dirty[0]&&o(21,k={name:Do,selected:Wo}),16&e.$$.dirty[0]|1&e.$$.dirty[3]|65536&e.$$.dirty[4]&&o(12,C=[at&&{id:Do+"-rotation",label:St.cropLabelTabRotation},w&&{id:Do+"-zoom",label:St.cropLabelTabZoom}].filter(Boolean)),4096&e.$$.dirty[0]&&o(22,M=C.map((e=>e.id))),64&e.$$.dirty[0]|256&e.$$.dirty[4]&&Oo&&!Oo.children.length&&u&&Oo.dispatchEvent(new CustomEvent("measure",{detail:Oo.rect})),512&e.$$.dirty[0]|131072&e.$$.dirty[4]&&Re&&No.set(H?0:20),262144&e.$$.dirty[4]&&o(23,T=Pe?`transform: translateY(${Pe}px)`:void 0)},[kt,Ye,et,st,St,Wo,Oo,A,E,H,p,$,C,Vo,i,de,m,g,f,x,S,k,M,T,Ae,Ee,Fe,Be,ze,It,Et,Ft,Bt,zt,Ot,_t,Wt,Vt,Nt,Ut,jt,Xt,Yt,Gt,qt,Zt,Jt,Qt,eo,to,oo,io,no,ro,ao,lo,co,uo,ho,po,()=>{Ct="select",nn(Et,j=!0,j),nn(Zt,X=Ie(Y),X),mo=q,go=ve(me(D),mo),$o=ve(me(J),mo)},({detail:e})=>{const{boundsLimited:t,boundsIntent:o}=yo(e.direction,e.translation);nn(Jt,te=o,te),nn(qt,Y=t,Y)},({detail:e})=>{const{boundsLimited:t}=yo(e.direction,e.translation);nn(Et,j=!1,j),nn(Jt,te=void 0,te),Q(e.translation)&&(nn(qt,Y=t,Y),At.write()),nn(Zt,X=void 0,X),Ct=void 0},()=>{Ct="rotate",nn(Et,j=!0,j),nn(to,se=Ie(A),se)},e=>{nn(Xt,E=e,E)},e=>{nn(Et,j=!1,j),nn(Xt,E=e,E),At.write(),nn(to,se=void 0,se)},()=>{Ct="pan",xo=void 0,nn(Et,j=!0,j),bo=Ie(A)},({detail:e})=>vo(e),({detail:e})=>{nn(Et,j=!1,j),(Q(e.translation)>0||0!==e.scalar)&&(vo(e),At.write()),nn(eo,le=void 0,le),bo=void 0},({detail:e})=>{xo=e.translation,nn(Et,j=!1,j)},wo,So,ko,()=>{Ct="zoom",nn(Et,j=!0,j),bo=Ie(A)},e=>{Co(e)},e=>{Co(e),At.write(),nn(Et,j=!1,j),bo=void 0},()=>{Ct="zoom",bo||(Mo=Ie(A),nn(Et,j=!0,j))},({detail:e})=>{Mo&&To(e)},({detail:e})=>{Mo&&(nn(Et,j=!1,j),To(e),nn(eo,le=void 0,le),Mo=void 0,At.write())},e=>{const t=((e,t,o)=>{const i=im(e);return re(re(i,t),o)})(e,de,ue);if(pt&&!Ke(Y,t))return;Ct="zoom",nn(Et,j=!0,j),e.preventDefault(),e.stopPropagation();const o=Al(e),i=1+o/100,n=Ie(A),r=1===Math.min(A.width/D.width,A.height/D.height);if(nt&&O){const e=Tt(A,I,E);if(Mt()&&e&&o>0&&l){nn(Et,j=!1,j);const e=U(E)?Le({height:I.width,width:I.height}):Le(I);if(Ue(n,e))return;if(clearTimeout(Ro),Ue(At.state.crop,e))return;return nn(oo,A=e,A),void At.write()}}let a=_e(A);if(ht&&o<0&&!r){const e=re(K(t),Y),o=Math.min(Y.width/A.width,Y.height/A.height),i=Ve(Ie(Y),1.1);a=Ke(i,t)?ne(Ie(A),ae(e,1/o)):a}let s=Ve(Ie(A),i,a);ke(he[1],s)||(s=De(_e(s),he[1])),ke(s,he[0])||(s=De(_e(s),he[0])),Ue(n,s,fo)?nn(Et,j=!1,j):(nn(oo,A=tt(s,(e=>fo(e,5))),A),nn(Et,j=!1,j),clearTimeout(Ro),Ro=setTimeout((()=>{At.write()}),500))},Ao,Eo,Lo,Fo,zo,Do,No,"crop",Ge,ot,it,nt,rt,at,lt,ct,dt,ut,ht,pt,mt,gt,ft,$t,yt,bt,xt,vt,wt,Io,I,L,F,b,B,l,D,O,V,j,X,Y,q,ie,ue,n,r,pe,a,s,c,d,u,h,ge,ye,xe,Te,y,v,w,Re,Pe,function(t){Nn(e,t)},({detail:e})=>o(5,Wo=e),function(e){Un[e?"unshift":"push"]((()=>{Oo=e,o(6,Oo)}))},e=>im(e),function(e){Vo=e,o(13,Vo)},function(t){Nn(e,t)}]}var Em={util:["crop",class extends Sr{constructor(e){super(),wr(this,e,Im,Rm,Gi,{name:87,isActive:1,stores:88,cropImageSelectionCornerStyle:2,cropWillRenderImageSelectionGuides:89,cropAutoCenterImageSelectionTimeout:90,cropEnableZoomMatchImageAspectRatio:91,cropEnableRotateMatchImageAspectRatio:92,cropEnableRotationInput:93,cropEnableZoom:3,cropEnableZoomInput:94,cropEnableZoomAutoHide:95,cropEnableImageSelection:96,cropEnableInfoIndicator:97,cropEnableZoomTowardsWheelPosition:98,cropEnableLimitWheelInputToCropSelection:99,cropEnableCenterImageSelection:100,cropEnableButtonRotateLeft:101,cropEnableButtonRotateRight:102,cropEnableButtonFlipHorizontal:103,cropEnableButtonFlipVertical:104,cropSelectPresetOptions:105,cropEnableSelectPreset:106,cropEnableButtonToggleCropLimit:107,cropWillRenderTools:108,locale:4,tools:0},[-1,-1,-1,-1,-1,-1,-1])}get name(){return this.$$.ctx[87]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$set({isActive:e}),Qn()}get stores(){return this.$$.ctx[88]}set stores(e){this.$set({stores:e}),Qn()}get cropImageSelectionCornerStyle(){return this.$$.ctx[2]}set cropImageSelectionCornerStyle(e){this.$set({cropImageSelectionCornerStyle:e}),Qn()}get cropWillRenderImageSelectionGuides(){return this.$$.ctx[89]}set cropWillRenderImageSelectionGuides(e){this.$set({cropWillRenderImageSelectionGuides:e}),Qn()}get cropAutoCenterImageSelectionTimeout(){return this.$$.ctx[90]}set cropAutoCenterImageSelectionTimeout(e){this.$set({cropAutoCenterImageSelectionTimeout:e}),Qn()}get cropEnableZoomMatchImageAspectRatio(){return this.$$.ctx[91]}set cropEnableZoomMatchImageAspectRatio(e){this.$set({cropEnableZoomMatchImageAspectRatio:e}),Qn()}get cropEnableRotateMatchImageAspectRatio(){return this.$$.ctx[92]}set cropEnableRotateMatchImageAspectRatio(e){this.$set({cropEnableRotateMatchImageAspectRatio:e}),Qn()}get cropEnableRotationInput(){return this.$$.ctx[93]}set cropEnableRotationInput(e){this.$set({cropEnableRotationInput:e}),Qn()}get cropEnableZoom(){return this.$$.ctx[3]}set cropEnableZoom(e){this.$set({cropEnableZoom:e}),Qn()}get cropEnableZoomInput(){return this.$$.ctx[94]}set cropEnableZoomInput(e){this.$set({cropEnableZoomInput:e}),Qn()}get cropEnableZoomAutoHide(){return this.$$.ctx[95]}set cropEnableZoomAutoHide(e){this.$set({cropEnableZoomAutoHide:e}),Qn()}get cropEnableImageSelection(){return this.$$.ctx[96]}set cropEnableImageSelection(e){this.$set({cropEnableImageSelection:e}),Qn()}get cropEnableInfoIndicator(){return this.$$.ctx[97]}set cropEnableInfoIndicator(e){this.$set({cropEnableInfoIndicator:e}),Qn()}get cropEnableZoomTowardsWheelPosition(){return this.$$.ctx[98]}set cropEnableZoomTowardsWheelPosition(e){this.$set({cropEnableZoomTowardsWheelPosition:e}),Qn()}get cropEnableLimitWheelInputToCropSelection(){return this.$$.ctx[99]}set cropEnableLimitWheelInputToCropSelection(e){this.$set({cropEnableLimitWheelInputToCropSelection:e}),Qn()}get cropEnableCenterImageSelection(){return this.$$.ctx[100]}set cropEnableCenterImageSelection(e){this.$set({cropEnableCenterImageSelection:e}),Qn()}get cropEnableButtonRotateLeft(){return this.$$.ctx[101]}set cropEnableButtonRotateLeft(e){this.$set({cropEnableButtonRotateLeft:e}),Qn()}get cropEnableButtonRotateRight(){return this.$$.ctx[102]}set cropEnableButtonRotateRight(e){this.$set({cropEnableButtonRotateRight:e}),Qn()}get cropEnableButtonFlipHorizontal(){return this.$$.ctx[103]}set cropEnableButtonFlipHorizontal(e){this.$set({cropEnableButtonFlipHorizontal:e}),Qn()}get cropEnableButtonFlipVertical(){return this.$$.ctx[104]}set cropEnableButtonFlipVertical(e){this.$set({cropEnableButtonFlipVertical:e}),Qn()}get cropSelectPresetOptions(){return this.$$.ctx[105]}set cropSelectPresetOptions(e){this.$set({cropSelectPresetOptions:e}),Qn()}get cropEnableSelectPreset(){return this.$$.ctx[106]}set cropEnableSelectPreset(e){this.$set({cropEnableSelectPreset:e}),Qn()}get cropEnableButtonToggleCropLimit(){return this.$$.ctx[107]}set cropEnableButtonToggleCropLimit(e){this.$set({cropEnableButtonToggleCropLimit:e}),Qn()}get cropWillRenderTools(){return this.$$.ctx[108]}set cropWillRenderTools(e){this.$set({cropWillRenderTools:e}),Qn()}get locale(){return this.$$.ctx[4]}set locale(e){this.$set({locale:e}),Qn()}get tools(){return this.$$.ctx[0]}set tools(e){this.$set({tools:e}),Qn()}}]};function Lm(e){let t,o,i,n,r,a,s,l=e[68],c=(qt(e[68].label)?e[68].label(e[2]):e[68].label)+"";function d(...t){return e[48](e[68],...t)}const u=()=>e[49](o,l),h=()=>e[49](null,l);return{c(){t=gn("div"),o=gn("div"),i=yn(),n=gn("span"),r=$n(c),Sn(o,"class",Dm),Sn(t,"slot","option"),Sn(t,"class","PinturaFilterOption")},m(e,l){pn(e,t,l),hn(t,o),u(),hn(t,i),hn(t,n),hn(n,r),a||(s=[xn(o,"measure",d),rn(as.call(null,o))],a=!0)},p(t,o){l!==(e=t)[68]&&(h(),l=e[68],u()),4&o[0]|64&o[2]&&c!==(c=(qt(e[68].label)?e[68].label(e[2]):e[68].label)+"")&&Cn(r,c)},d(e){e&&mn(t),h(),a=!1,Xi(s)}}}function Fm(e){let t,o;return t=new Nc({props:{locale:e[2],layout:"row",options:e[3],selectedIndex:e[10],onchange:e[29],$$slots:{option:[Lm,({option:e})=>({68:e}),({option:e})=>[0,0,e?64:0]]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};4&o[0]&&(i.locale=e[2]),8&o[0]&&(i.options=e[3]),1024&o[0]&&(i.selectedIndex=e[10]),516&o[0]|192&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Bm(e){let t,o,i,n,r,a,s,l;function c(t){e[51](t)}function d(t){e[52](t)}function u(t){e[53](t)}let h={elasticity:e[15]*e[16],onscroll:e[50],$$slots:{default:[Fm]},$$scope:{ctx:e}};return void 0!==e[4]&&(h.maskFeatherStartOpacity=e[4]),void 0!==e[5]&&(h.maskFeatherEndOpacity=e[5]),void 0!==e[6]&&(h.maskFeatherSize=e[6]),o=new Ll({props:h}),Un.push((()=>$r(o,"maskFeatherStartOpacity",c))),Un.push((()=>$r(o,"maskFeatherEndOpacity",d))),Un.push((()=>$r(o,"maskFeatherSize",u))),o.$on("measure",e[54]),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"slot","footer"),Sn(t,"style",e[11])},m(i,n){pn(i,t,n),br(o,t,null),a=!0,s||(l=xn(t,"transitionend",e[27]),s=!0)},p(e,s){const l={};128&s[0]&&(l.onscroll=e[50]),1548&s[0]|128&s[2]&&(l.$$scope={dirty:s,ctx:e}),!i&&16&s[0]&&(i=!0,l.maskFeatherStartOpacity=e[4],Kn((()=>i=!1))),!n&&32&s[0]&&(n=!0,l.maskFeatherEndOpacity=e[5],Kn((()=>n=!1))),!r&&64&s[0]&&(r=!0,l.maskFeatherSize=e[6],Kn((()=>r=!1))),o.$set(l),(!a||2048&s[0])&&Sn(t,"style",e[11])},i(e){a||(sr(o.$$.fragment,e),a=!0)},o(e){lr(o.$$.fragment,e),a=!1},d(e){e&&mn(t),xr(o),s=!1,l()}}}function zm(e){let t,o;return t=new Lp({props:{$$slots:{footer:[Bm]},$$scope:{ctx:e}}}),t.$on("measure",e[55]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};4092&o[0]|128&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}let Dm="PinturaFilterPreview";function Om(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,f,$,y,b,x,v=Vi,w=()=>(v(),v=qi(C,(e=>o(40,u=e))),C),S=Vi,k=()=>(S(),S=qi(M,(e=>o(45,y=e))),M);e.$$.on_destroy.push((()=>v())),e.$$.on_destroy.push((()=>S()));let{isActive:C}=t;w();let{isActiveFraction:M}=t;k();let{stores:T}=t,{locale:R}=t,{filterFunctions:P}=t,{filterOptions:A}=t;const{history:I,interfaceImages:E,stageRect:L,utilRect:F,animation:B,elasticityMultiplier:z,scrollElasticity:D,imageSize:O,imagePreview:_,imageCropRect:W,imageRotation:V,imageFlipX:N,imageFlipY:H,imageBackgroundColor:U,imageGamma:j,imageColorMatrix:X}=T;Zi(e,L,(e=>o(42,p=e))),Zi(e,F,(e=>o(41,h=e))),Zi(e,B,(e=>o(39,d=e))),Zi(e,O,(e=>o(57,f=e))),Zi(e,_,(e=>o(44,g=e))),Zi(e,U,(e=>o(58,$=e))),Zi(e,j,(e=>o(43,m=e))),Zi(e,X,(e=>o(36,a=e)));const q=Mr({});Zi(e,q,(e=>o(37,s=e)));const J=(e,t)=>nn(q,s[e.value]=t,s),Q=Tr(q,(e=>{if(!e[void 0])return;const t=e[void 0];return l&&xe(l,t)?l:me(t)}));Zi(e,Q,(e=>o(56,l=e)));const ee=Tr([C,Q,W,O,V,N,H],(([e,t,o,i,n,r,a],s)=>{if(!e||!t||!i)return c;const l=Le(i),d=_e(l),u=Ur(i,o,n),h=_e(u),p=re(K(d),h),m=Z(K(p)),g=Math.max(t.width/o.width,t.height/o.height);s({origin:m,translation:p,rotation:{x:a?Math.PI:0,y:r?Math.PI:0,z:n},perspective:Y(),scale:g})}));Zi(e,ee,(e=>o(38,c=e)));const te=qa(d?20:0);let oe;Zi(e,te,(e=>o(46,b=e)));const ie={};let ne,ae,se,le,ce,de={x:0,y:0};const ue=Mr([]);Zi(e,ue,(e=>o(47,x=e)));const he=e=>{const t={...e,data:g,size:f,offset:{...e.offset},mask:{...e.mask},backgroundColor:$};return t.opacity=y,t.offset.y+=b,t.mask.y+=b,t};On((()=>{E.set([])}));return e.$$set=e=>{"isActive"in e&&w(o(0,C=e.isActive)),"isActiveFraction"in e&&k(o(1,M=e.isActiveFraction)),"stores"in e&&o(31,T=e.stores),"locale"in e&&o(2,R=e.locale),"filterFunctions"in e&&o(32,P=e.filterFunctions),"filterOptions"in e&&o(3,A=e.filterOptions)},e.$$.update=()=>{if(8&e.$$.dirty[0]&&o(35,i=hc(A)),48&e.$$.dirty[1]&&o(10,n=((e,t)=>{if(!e||!e.filter||!t)return 0;const o=e.filter;return t.findIndex((([e])=>{if(!P[e])return!1;const t=P[e]();return qr(t,o)}))})(a,i)),768&e.$$.dirty[1]&&d&&te.set(u?0:20),3584&e.$$.dirty[1]&&u&&h&&p){const e=p.y+p.height+h.y;o(34,ce={x:p.x-h.x,y:e})}if(496&e.$$.dirty[0]|4350&e.$$.dirty[1]&&c&&ce&&de&&le&&oe){const e=ce.x+le.x+de.x,t=ce.y,o=le.x+ce.x,n=o+le.width;ue.set(i.map((([i],r)=>{const l=s[i],d=de.x+l.x,u=d+l.width;if(u<0||d>le.width)return!1;const h=e+l.x,p=t+l.y,g=(e=>({origin:K(e.origin),translation:K(e.translation),rotation:{...e.rotation},perspective:K(e.perspective),scale:e.scale}))(c);g.offset=G(.5*l.width+h,.5*l.height+p);g.maskOpacity=1,g.mask=Oe(h+0,p,l.width+0,l.height),g.maskFeather=[1,0,1,0,1,n,1,n],d<se&&ne<1&&(g.maskFeather[0]=ne,g.maskFeather[1]=o,g.maskFeather[2]=1,g.maskFeather[3]=o+se),u>le.width-se&&ae<1&&(g.maskFeather[4]=ae,g.maskFeather[5]=n-se,g.maskFeather[6]=1,g.maskFeather[7]=n),g.maskCornerRadius=oe[i];let f=a&&Object.keys(a).filter((e=>"filter"!=e)).map((e=>a[e]))||[];return qt(P[i])&&f.push(P[i]()),g.colorMatrix=f.length?_i(f):void 0,g.gamma=m,g})).filter(Boolean))}122880&e.$$.dirty[1]&&(y>0&&x?E.set(x.map(he)):E.set([])),32768&e.$$.dirty[1]&&o(11,r=b?`transform: translateY(${b}px)`:void 0)},[C,M,R,A,ne,ae,se,de,le,ie,n,r,L,F,B,z,D,O,_,U,j,X,q,J,Q,ee,te,e=>{e.target.className===Dm&&o(33,oe=Object.keys(ie).reduce(((e,t)=>{const o=ie[t],i=getComputedStyle(o),n=["top-left","top-right","bottom-left","bottom-right"].map((e=>i.getPropertyValue(`border-${e}-radius`))).map(Pl).map((e=>1.25*e));return e[t]=n,e}),{}))},ue,({value:e})=>{nn(X,a={...a,filter:qt(P[e])?P[e]():void 0},a),I.write()},"filter",T,P,oe,ce,i,a,s,c,d,u,h,p,m,g,y,b,x,(e,t)=>J(e,t.detail),function(e,t){Un[e?"unshift":"push"]((()=>{ie[t.value]=e,o(9,ie)}))},e=>o(7,de=e),function(e){ne=e,o(4,ne)},function(e){ae=e,o(5,ae)},function(e){se=e,o(6,se)},e=>o(8,le=e.detail),function(t){Nn(e,t)}]}var _m={util:["filter",class extends Sr{constructor(e){super(),wr(this,e,Om,zm,Gi,{name:30,isActive:0,isActiveFraction:1,stores:31,locale:2,filterFunctions:32,filterOptions:3},[-1,-1,-1])}get name(){return this.$$.ctx[30]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$set({isActive:e}),Qn()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$set({isActiveFraction:e}),Qn()}get stores(){return this.$$.ctx[31]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[2]}set locale(e){this.$set({locale:e}),Qn()}get filterFunctions(){return this.$$.ctx[32]}set filterFunctions(e){this.$set({filterFunctions:e}),Qn()}get filterOptions(){return this.$$.ctx[3]}set filterOptions(e){this.$set({filterOptions:e}),Qn()}}]};function Wm(e){let t,o,i=e[37].label+"";return{c(){t=gn("span"),o=$n(i)},m(e,i){pn(e,t,i),hn(t,o)},p(e,t){64&t[1]&&i!==(i=e[37].label+"")&&Cn(o,i)},d(e){e&&mn(t)}}}function Vm(e){let t,o;const i=[{class:"PinturaControlList"},{tabs:e[1]},e[3]];let n={$$slots:{default:[Wm,({tab:e})=>({37:e}),({tab:e})=>[0,e?64:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=Hi(n,i[e]);return t=new Js({props:n}),t.$on("select",e[22]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const n=10&o[0]?gr(i,[i[0],2&o[0]&&{tabs:e[1]},8&o[0]&&fr(e[3])]):{};192&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Nm(e){let t,o;const i=[e[5][e[36]]];let n={};for(let e=0;e<i.length;e+=1)n=Hi(n,i[e]);return t=new Dp({props:n}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const n=32&o[0]|32&o[1]?gr(i,[fr(e[5][e[36]])]):{};t.$set(n)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Hm(e){let t,o,i,n,r;o=new Ll({props:{elasticity:e[9]*e[8],class:"PinturaControlListScroller",$$slots:{default:[Vm]},$$scope:{ctx:e}}});const a=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[4]},e[3]];let s={$$slots:{default:[Nm,({panel:e})=>({36:e}),({panel:e})=>[0,e?32:0]]},$$scope:{ctx:e}};for(let e=0;e<a.length;e+=1)s=Hi(s,a[e]);return n=new dl({props:s}),{c(){t=gn("div"),yr(o.$$.fragment),i=yn(),yr(n.$$.fragment),Sn(t,"slot","footer"),Sn(t,"style",e[6])},m(e,a){pn(e,t,a),br(o,t,null),hn(t,i),br(n,t,null),r=!0},p(e,i){const s={};14&i[0]|128&i[1]&&(s.$$scope={dirty:i,ctx:e}),o.$set(s);const l=24&i[0]?gr(a,[a[0],a[1],16&i[0]&&{panels:e[4]},8&i[0]&&fr(e[3])]):{};32&i[0]|160&i[1]&&(l.$$scope={dirty:i,ctx:e}),n.$set(l),(!r||64&i[0])&&Sn(t,"style",e[6])},i(e){r||(sr(o.$$.fragment,e),sr(n.$$.fragment,e),r=!0)},o(e){lr(o.$$.fragment,e),lr(n.$$.fragment,e),r=!1},d(e){e&&mn(t),xr(o),xr(n)}}}function Um(e){let t,o;return t=new Lp({props:{$$slots:{footer:[Hm]},$$scope:{ctx:e}}}),t.$on("measure",e[23]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};126&o[0]|128&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function jm(e,t,o){let i,n,r,a,s,l,c,d,u,h,p=Vi,m=()=>(p(),p=qi(f,(e=>o(20,u=e))),f);e.$$.on_destroy.push((()=>p()));let{stores:g}=t,{isActive:f}=t;m();let{locale:$={}}=t,{finetuneControlConfiguration:y}=t,{finetuneOptions:b}=t;const{history:x,animation:v,scrollElasticity:w,elasticityMultiplier:S,rangeInputElasticity:k,imageColorMatrix:C,imageConvolutionMatrix:M,imageGamma:T,imageVignette:P,imageNoise:A}=g;Zi(e,v,(e=>o(19,d=e)));const I={imageColorMatrix:C,imageConvolutionMatrix:M,imageGamma:T,imageVignette:P,imageNoise:A},E="finetune-"+R(),L=Mr({});Zi(e,L,(e=>o(18,c=e)));const F=Mr({});Zi(e,F,(e=>o(5,l=e)));let B=[];const z=qa(d?20:0);Zi(e,z,(e=>o(21,h=e)));return e.$$set=e=>{"stores"in e&&o(14,g=e.stores),"isActive"in e&&m(o(0,f=e.isActive)),"locale"in e&&o(15,$=e.locale),"finetuneControlConfiguration"in e&&o(16,y=e.finetuneControlConfiguration),"finetuneOptions"in e&&o(17,b=e.finetuneOptions)},e.$$.update=()=>{var t;163840&e.$$.dirty[0]&&o(1,i=b?b.map((([e,t])=>({id:e,label:qt(t)?t($):t}))):[]),2&e.$$.dirty[0]&&o(2,n=i.length&&i[0].id),4&e.$$.dirty[0]&&o(3,r={name:E,selected:n}),2&e.$$.dirty[0]&&o(4,a=i.map((e=>e.id))),65536&e.$$.dirty[0]&&y&&(t=y,B&&B.forEach((e=>e())),B=a.map((e=>{const{getStore:o,getValue:i=W}=t[e];return o(I).subscribe((t=>{const o=null!=t?i(t):t;nn(L,c={...c,[e]:o},c)}))}))),327680&e.$$.dirty[0]&&y&&c&&nn(F,l=Object.keys(c).reduce(((e,t)=>{const{base:o,min:i,max:n,getLabel:r,getStore:a,setValue:s=((e,t)=>e.set(t))}=y[t],l=a(I),d=null!=c[t]?c[t]:o;return e[t]={base:o,min:i,max:n,value:d,valueLabel:r?r(d,i,n,n-i):Math.round(100*d),oninputmove:e=>{s(l,e)},oninputend:e=>{s(l,e),x.write()},elasticity:S*k,labelReset:$.labelReset},e}),{}),l),1572864&e.$$.dirty[0]&&d&&z.set(u?0:20),2097152&e.$$.dirty[0]&&o(6,s=h?`transform: translateY(${h}px)`:void 0)},[f,i,n,r,a,l,s,v,w,S,L,F,z,"finetune",g,$,y,b,c,d,u,h,({detail:e})=>o(2,n=e),function(t){Nn(e,t)}]}var Xm={util:["finetune",class extends Sr{constructor(e){super(),wr(this,e,jm,Um,Gi,{name:13,stores:14,isActive:0,locale:15,finetuneControlConfiguration:16,finetuneOptions:17},[-1,-1])}get name(){return this.$$.ctx[13]}get stores(){return this.$$.ctx[14]}set stores(e){this.$set({stores:e}),Qn()}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$set({isActive:e}),Qn()}get locale(){return this.$$.ctx[15]}set locale(e){this.$set({locale:e}),Qn()}get finetuneControlConfiguration(){return this.$$.ctx[16]}set finetuneControlConfiguration(e){this.$set({finetuneControlConfiguration:e}),Qn()}get finetuneOptions(){return this.$$.ctx[17]}set finetuneOptions(e){this.$set({finetuneOptions:e}),Qn()}}]};function Ym(e,t,o){const i=e.slice();return i[47]=t[o].key,i[48]=t[o].index,i[49]=t[o].translate,i[50]=t[o].scale,i[14]=t[o].rotate,i[51]=t[o].dir,i[52]=t[o].center,i[53]=t[o].type,i}function Gm(e){let t,o;return{c(){t=gn("div"),Sn(t,"class","PinturaShapeManipulator"),Sn(t,"data-control","point"),Sn(t,"style",o=`pointer-events:none;transform: translate3d(${e[52].x}px, ${e[52].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[6]}`)},m(e,o){pn(e,t,o)},p(e,i){104&i[0]&&o!==(o=`pointer-events:none;transform: translate3d(${e[52].x}px, ${e[52].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[6]}`)&&Sn(t,"style",o)},d(e){e&&mn(t)}}}function qm(e,t){let o,i,n,r,a,s,l,c,d;function u(...e){return t[18](t[48],...e)}let h="edge"===t[53]&&"both"!==t[2]&&Gm(t);return{key:e,first:null,c(){o=gn("div"),s=yn(),h&&h.c(),l=bn(),Sn(o,"role","button"),Sn(o,"aria-label",i=`Drag ${t[53]} ${t[47]}`),Sn(o,"tabindex",n="edge"===t[53]?-1:0),Sn(o,"class","PinturaShapeManipulator"),Sn(o,"data-control",r=t[53]),Sn(o,"style",a=`cursor: ${t[51]?t[51]+"-resize":"move"}; transform: translate3d(${t[49].x}px, ${t[49].y}px, 0)${"edge"===t[53]?` rotate(${t[14]}rad)`:""} scale(${"point"===t[53]?t[5]:t[50].x}, ${"point"===t[53]?t[5]:t[50].y}); opacity: ${t[6]}`),this.first=o},m(e,i){pn(e,o,i),pn(e,s,i),h&&h.m(e,i),pn(e,l,i),c||(d=[xn(o,"keydown",t[7]),xn(o,"keyup",t[8]),xn(o,"nudge",u),rn(Ml.call(null,o)),xn(o,"interactionstart",(function(){Yi(t[11]("start",t[48]))&&t[11]("start",t[48]).apply(this,arguments)})),xn(o,"interactionupdate",(function(){Yi(t[11]("move",t[48]))&&t[11]("move",t[48]).apply(this,arguments)})),xn(o,"interactionend",(function(){Yi(t[11]("end",t[48]))&&t[11]("end",t[48]).apply(this,arguments)})),rn(Cl.call(null,o))],c=!0)},p(e,s){t=e,8&s[0]&&i!==(i=`Drag ${t[53]} ${t[47]}`)&&Sn(o,"aria-label",i),8&s[0]&&n!==(n="edge"===t[53]?-1:0)&&Sn(o,"tabindex",n),8&s[0]&&r!==(r=t[53])&&Sn(o,"data-control",r),104&s[0]&&a!==(a=`cursor: ${t[51]?t[51]+"-resize":"move"}; transform: translate3d(${t[49].x}px, ${t[49].y}px, 0)${"edge"===t[53]?` rotate(${t[14]}rad)`:""} scale(${"point"===t[53]?t[5]:t[50].x}, ${"point"===t[53]?t[5]:t[50].y}); opacity: ${t[6]}`)&&Sn(o,"style",a),"edge"===t[53]&&"both"!==t[2]?h?h.p(t,s):(h=Gm(t),h.c(),h.m(l.parentNode,l)):h&&(h.d(1),h=null)},d(e){e&&mn(o),e&&mn(s),h&&h.d(e),e&&mn(l),c=!1,Xi(d)}}}function Km(e){let t,o,i,n;return{c(){t=gn("div"),Sn(t,"role","button"),Sn(t,"aria-label","Drag rotator"),Sn(t,"tabindex","0"),Sn(t,"class","PinturaShapeManipulator"),Sn(t,"data-control","rotate"),Sn(t,"style",o=`transform: translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[6]}`)},m(o,r){pn(o,t,r),i||(n=[xn(t,"keydown",e[7]),xn(t,"keyup",e[8]),xn(t,"nudge",e[13]),rn(Ml.call(null,t)),xn(t,"interactionstart",e[14]("start")),xn(t,"interactionupdate",e[14]("move")),xn(t,"interactionend",e[14]("end")),rn(Cl.call(null,t))],i=!0)},p(e,i){97&i[0]&&o!==(o=`transform: translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[6]}`)&&Sn(t,"style",o)},d(e){e&&mn(t),i=!1,Xi(n)}}}function Zm(e){let t,o,i=[],n=new Map,r=e[3];const a=e=>e[47];for(let t=0;t<r.length;t+=1){let o=Ym(e,r,t),s=a(o);n.set(s,i[t]=qm(s,o))}let s=e[1]&&e[4]&&Km(e);return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=yn(),s&&s.c(),o=bn()},m(e,n){for(let t=0;t<i.length;t+=1)i[t].m(e,n);pn(e,t,n),s&&s.m(e,n),pn(e,o,n)},p(e,l){6636&l[0]&&(r=e[3],i=mr(i,l,a,1,e,r,n,t.parentNode,hr,qm,t,Ym)),e[1]&&e[4]?s?s.p(e,l):(s=Km(e),s.c(),s.m(o.parentNode,o)):s&&(s.d(1),s=null)},i:Vi,o:Vi,d(e){for(let t=0;t<i.length;t+=1)i[t].d(e);e&&mn(t),s&&s.d(e),e&&mn(o)}}}function Jm(e,t,o){let i,n,r,a,s;const l=_n(),c=.5*H,d=N-c,u=N+c,h=-N,p=h-c,m=h+c,g=V-c,f=-V+c,$=c,y=-c,b=N-H,x=b-c,v=b+c,w=V-H,S=w-c,C=w+c,M=h-H,T=M+c,R=M-c,P=h+H,A=P+c,I=P-c;let{points:E=[]}=t,{rotatorPoint:L}=t,{visible:F=!1}=t,{enableResizing:B=!0}=t,{enableRotating:z=!0}=t,D=!1;const O=qa(.5,{precision:1e-4,stiffness:.3,damping:.7});Zi(e,O,(e=>o(5,a=e)));const _=qa(0,{precision:.001,stiffness:.3,damping:.7});Zi(e,_,(e=>o(6,s=e)));const W=e=>{let t="";return(e<=u&&e>=d||e>=p&&e<=m)&&(t="ns"),(e<=f||e>=g||e>=y&&e<=$)&&(t="ew"),(e>=S&&e<=C||e<=A&&e>=I)&&(t="nesw"),(e>=x&&e<=v||e<=T&&e>=R)&&(t="nwse"),t},U=(e,t)=>{l("resizestart",{indexes:e,translation:Y()}),l("resizemove",{indexes:e,translation:t}),l("resizeend",{indexes:e,translation:Y()})};return e.$$set=e=>{"points"in e&&o(15,E=e.points),"rotatorPoint"in e&&o(0,L=e.rotatorPoint),"visible"in e&&o(16,F=e.visible),"enableResizing"in e&&o(17,B=e.enableResizing),"enableRotating"in e&&o(1,z=e.enableRotating)},e.$$.update=()=>{65536&e.$$.dirty[0]&&O.set(F?1:.5),65536&e.$$.dirty[0]&&_.set(F?1:0),131072&e.$$.dirty[0]&&o(2,i=!!B&&(k(B)?B:"both")),32772&e.$$.dirty[0]&&o(3,n=i&&((e,t)=>{let o=0;const i=de(e),n=[],r=e.length,a=2===r,s="both"!==t;for(;o<r;o++){const l=e[o-1]||e[e.length-1],c=e[o],d=e[o+1]||e[0],u=Math.atan2(d.y-c.y,d.x-c.x);if(!s){const e=ee(G(l.x-c.x,l.y-c.y)),t=ee(G(d.x-c.x,d.y-c.y)),i=G(e.x+t.x,e.y+t.y);n.push({index:[o],key:"point-"+o,type:"point",scale:{x:1,y:1},translate:{x:c.x,y:c.y},angle:void 0,rotate:a?0:u,center:c,dir:a?void 0:W(Math.atan2(i.y,i.x))})}if(a)continue;const h=G(c.x+.5*(d.x-c.x),c.y+.5*(d.y-c.y));"horizontal"===t&&o%2==0||"vertical"===t&&o%2!=0||n.push({index:[o,o+1===r?0:o+1],key:"edge-"+o,type:"edge",scale:{x:ce(c,d),y:1},translate:{x:c.x,y:c.y},angle:u,rotate:u,center:h,dir:W(Math.atan2(i.y-h.y,i.x-h.x))})}return n})(E,i)||[]),32768&e.$$.dirty[0]&&o(4,r=E.length>2)},[L,z,i,n,r,a,s,e=>D=e.shiftKey,e=>D=!1,O,_,(e,t)=>({detail:o})=>{const i=o&&o.translation?o.translation:G(0,0);l("resize"+e,{indexes:t,translation:i,shiftKey:D})},U,({detail:e})=>{l("rotatestart",{translation:Y()}),l("rotatemove",{translation:e}),l("rotateend",{translation:Y()})},e=>({detail:t})=>{const o=t&&t.translation?t.translation:G(0,0);l("rotate"+e,{translation:o,shiftKey:D})},E,F,B,(e,{detail:t})=>U(e,t)]}class Qm extends Sr{constructor(e){super(),wr(this,e,Jm,Zm,Gi,{points:15,rotatorPoint:0,visible:16,enableResizing:17,enableRotating:1},[-1,-1])}}var eg=(e,t)=>{const o=im(e);return re(o,t)};let tg=null;let og=null;var ig=e=>{if(null===og&&(og=u()&&"visualViewport"in window),!og)return!1;const t=visualViewport.height,o=()=>{e(visualViewport.height<t?"visible":"hidden")};return visualViewport.addEventListener("resize",o),()=>visualViewport.removeEventListener("resize",o)};function ng(e){let t,o,i,n,r,a,s,l,c,d;i=new Sl({props:{onclick:e[1],label:e[5],icon:e[7],hideLabel:!e[6]}});const u=e[20].default,h=Ji(u,e,e[19],null);return s=new Sl({props:{onclick:e[0],label:e[2],icon:e[4],hideLabel:!e[3],class:"PinturaInputFormButtonConfirm"}}),{c(){t=gn("div"),o=gn("div"),yr(i.$$.fragment),n=yn(),r=gn("div"),h&&h.c(),a=yn(),yr(s.$$.fragment),Sn(r,"class","PinturaInputFormFields"),Sn(o,"class","PinturaInputFormInner"),Sn(t,"class","PinturaInputForm"),Sn(t,"style",e[9])},m(u,p){pn(u,t,p),hn(t,o),br(i,o,null),hn(o,n),hn(o,r),h&&h.m(r,null),hn(o,a),br(s,o,null),e[21](t),l=!0,c||(d=[xn(t,"focusin",e[10]),xn(t,"focusout",e[11]),xn(t,"measure",e[12]),rn(as.call(null,t))],c=!0)},p(e,o){const n={};2&o[0]&&(n.onclick=e[1]),32&o[0]&&(n.label=e[5]),128&o[0]&&(n.icon=e[7]),64&o[0]&&(n.hideLabel=!e[6]),i.$set(n),h&&h.p&&524288&o[0]&&en(h,u,e,e[19],o,null,null);const r={};1&o[0]&&(r.onclick=e[0]),4&o[0]&&(r.label=e[2]),16&o[0]&&(r.icon=e[4]),8&o[0]&&(r.hideLabel=!e[3]),s.$set(r),(!l||512&o[0])&&Sn(t,"style",e[9])},i(e){l||(sr(i.$$.fragment,e),sr(h,e),sr(s.$$.fragment,e),l=!0)},o(e){lr(i.$$.fragment,e),lr(h,e),lr(s.$$.fragment,e),l=!1},d(o){o&&mn(t),xr(i),h&&h.d(o),xr(s),e[21](null),c=!1,Xi(d)}}}function rg(e,t,o){let i,n,r,a,{$$slots:s={},$$scope:l}=t,{onconfirm:c}=t,{oncancel:d}=t,{autoFocus:u=!0}=t,{autoPositionCursor:h=!0}=t,{labelConfirm:p}=t,{labelConfirmShow:m=!0}=t,{iconConfirm:g}=t,{labelCancel:f}=t,{labelCancelShow:$=!1}=t,{iconCancel:y}=t,{panelOffset:b=Y()}=t,x=!1,v=void 0,w=void 0,S="",k=0;const C=()=>{const e=a.querySelector("input, textarea");e.focus(),e.select()},M=()=>{x=!0,R||!It()&&(null===tg&&(tg=Pt(/Android/)),!tg)||o(16,S="top:1em;bottom:auto;"),It()&&(e=>{let t;const o=e=>t=e.touches[0].screenY,i=e=>{const o=e.touches[0].screenY,i=e.target;/textarea/i.test(i.nodeName)?(o>t?0==i.scrollTop&&e.preventDefault():o<t?i.scrollTop+i.offsetHeight==i.scrollHeight&&e.preventDefault():e.preventDefault(),t=o):e.preventDefault()};e.addEventListener("touchstart",o),e.addEventListener("touchmove",i)})(a),o(17,k=1)};let T;const R=ig((e=>{n?"hidden"!==e||x?(clearTimeout(w),w=void 0,o(16,S=`top:${visualViewport.height-v-b.y}px`),"visible"===e?(o(8,a.dataset.layout="stick",a),C(),M()):(x=!1,o(17,k=0))):C():o(16,S="top: 4.5em; bottom: auto")}));return zn((()=>{u&&C()})),On((()=>{R&&R()})),e.$$set=e=>{"onconfirm"in e&&o(0,c=e.onconfirm),"oncancel"in e&&o(1,d=e.oncancel),"autoFocus"in e&&o(13,u=e.autoFocus),"autoPositionCursor"in e&&o(14,h=e.autoPositionCursor),"labelConfirm"in e&&o(2,p=e.labelConfirm),"labelConfirmShow"in e&&o(3,m=e.labelConfirmShow),"iconConfirm"in e&&o(4,g=e.iconConfirm),"labelCancel"in e&&o(5,f=e.labelCancel),"labelCancelShow"in e&&o(6,$=e.labelCancelShow),"iconCancel"in e&&o(7,y=e.iconCancel),"panelOffset"in e&&o(15,b=e.panelOffset),"$$scope"in e&&o(19,l=e.$$scope)},e.$$.update=()=>{256&e.$$.dirty[0]&&o(18,i=a&&getComputedStyle(a)),262144&e.$$.dirty[0]&&(n=i&&"1"===i.getPropertyValue("--editor-modal")),196608&e.$$.dirty[0]&&o(9,r=`opacity:${k};${S}`)},[c,d,p,m,g,f,$,y,a,r,e=>{var t;(e=>/textarea/i.test(e))(e.target)&&(T=Date.now(),h&&((t=e.target).selectionStart=t.selectionEnd=t.value.length),clearTimeout(w),w=setTimeout(M,200))},e=>{Date.now()-T>50||(e.stopPropagation(),C())},({detail:e})=>{v=e.height},u,h,b,S,k,i,l,s,function(e){Un[e?"unshift":"push"]((()=>{a=e,o(8,a)}))}]}class ag extends Sr{constructor(e){super(),wr(this,e,rg,ng,Gi,{onconfirm:0,oncancel:1,autoFocus:13,autoPositionCursor:14,labelConfirm:2,labelConfirmShow:3,iconConfirm:4,labelCancel:5,labelCancelShow:6,iconCancel:7,panelOffset:15},[-1,-1])}}function sg(e,t,o){const i=e.slice();return i[178]=t[o],i[180]=o,i}function lg(e,t){let o,i,n,r,a,s,l,c,d,u,h,p=t[178].name+"";function m(...e){return t[124](t[180],...e)}return n=new yh({props:{color:t[178].color}}),{key:e,first:null,c(){o=gn("li"),i=gn("button"),yr(n.$$.fragment),r=yn(),a=gn("span"),s=$n(p),c=yn(),Sn(i,"class","PinturaShapeListItem"),Sn(i,"type","button"),Sn(i,"aria-label",l="Select shape "+t[178].name),this.first=o},m(e,t){pn(e,o,t),hn(o,i),br(n,i,null),hn(i,r),hn(i,a),hn(a,s),hn(o,c),d=!0,u||(h=xn(i,"click",m),u=!0)},p(e,o){t=e;const r={};524288&o[0]&&(r.color=t[178].color),n.$set(r),(!d||524288&o[0])&&p!==(p=t[178].name+"")&&Cn(s,p),(!d||524288&o[0]&&l!==(l="Select shape "+t[178].name))&&Sn(i,"aria-label",l)},i(e){d||(sr(n.$$.fragment,e),d=!0)},o(e){lr(n.$$.fragment,e),d=!1},d(e){e&&mn(o),xr(n),u=!1,h()}}}function cg(e){let t,o;return t=new Qm({props:{visible:!0,points:e[8],rotatorPoint:e[14],enableResizing:e[13],enableRotating:e[6]}}),t.$on("resizestart",e[25]),t.$on("resizemove",e[26]),t.$on("resizeend",e[27]),t.$on("rotatestart",e[28]),t.$on("rotatemove",e[29]),t.$on("rotateend",e[30]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};256&o[0]&&(i.points=e[8]),16384&o[0]&&(i.rotatorPoint=e[14]),8192&o[0]&&(i.enableResizing=e[13]),64&o[0]&&(i.enableRotating=e[6]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function dg(e){let t,o;return t=new ag({props:{panelOffset:e[1],onconfirm:e[36],oncancel:e[37],labelCancel:e[3].shapeLabelInputCancel,iconCancel:e[3].shapeIconInputCancel,labelConfirm:e[3].shapeLabelInputConfirm,iconConfirm:e[3].shapeIconInputConfirm,$$slots:{default:[ug]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};2&o[0]&&(i.panelOffset=e[1]),8&o[0]&&(i.labelCancel=e[3].shapeLabelInputCancel),8&o[0]&&(i.iconCancel=e[3].shapeIconInputCancel),8&o[0]&&(i.labelConfirm=e[3].shapeLabelInputConfirm),8&o[0]&&(i.iconConfirm=e[3].shapeIconInputConfirm),100352&o[0]|67108864&o[5]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function ug(e){let t,o,i;return{c(){t=gn("textarea"),Sn(t,"style",e[16]),Sn(t,"spellcheck","false"),Sn(t,"autocorrect","off"),Sn(t,"autocapitalize","off")},m(n,r){pn(n,t,r),e[125](t),Mn(t,e[15]),o||(i=[xn(t,"keydown",e[34]),xn(t,"keypress",e[33]),xn(t,"keyup",e[35]),xn(t,"input",e[32]),xn(t,"input",e[126])],o=!0)},p(e,o){65536&o[0]&&Sn(t,"style",e[16]),32768&o[0]&&Mn(t,e[15])},d(n){n&&mn(t),e[125](null),o=!1,Xi(i)}}}function hg(e){let t,o,i,n,r;return o=new Sd({props:{items:e[18]}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"class","PinturaShapeControls"),Sn(t,"style",e[17])},m(a,s){pn(a,t,s),br(o,t,null),i=!0,n||(r=[xn(t,"measure",e[127]),rn(as.call(null,t))],n=!0)},p(e,n){const r={};262144&n[0]&&(r.items=e[18]),o.$set(r),(!i||131072&n[0])&&Sn(t,"style",e[17])},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o),n=!1,Xi(r)}}}function pg(e){let t,o,i,n,r,a,s,l,c,d,u=[],h=new Map,p=e[19];const m=e=>e[178].id;for(let t=0;t<p.length;t+=1){let o=sg(e,p,t),i=m(o);h.set(i,u[t]=lg(i,o))}let g=e[7]&&cg(e),f=e[9]&&dg(e),$=e[10]>0&&hg(e);return{c(){t=gn("div"),o=gn("nav"),i=gn("ul");for(let e=0;e<u.length;e+=1)u[e].c();n=yn(),g&&g.c(),r=yn(),f&&f.c(),a=yn(),$&&$.c(),Sn(o,"class","PinturaShapeList"),Sn(o,"data-visible",e[12]),Sn(t,"class","PinturaShapeEditor"),Sn(t,"tabindex","0")},m(h,p){pn(h,t,p),hn(t,o),hn(o,i);for(let e=0;e<u.length;e+=1)u[e].m(i,null);hn(t,n),g&&g.m(t,null),hn(t,r),f&&f.m(t,null),hn(t,a),$&&$.m(t,null),l=!0,c||(d=[xn(o,"focusin",e[40]),xn(o,"focusout",e[41]),xn(t,"keydown",e[31]),xn(t,"nudge",e[39]),xn(t,"measure",e[123]),rn(as.call(null,t)),rn(Ml.call(null,t)),xn(t,"interactionstart",e[21]),xn(t,"interactionupdate",e[22]),xn(t,"interactionrelease",e[23]),xn(t,"interactionend",e[24]),rn(s=Cl.call(null,t,{drag:!0,pinch:!0,inertia:!0,matchTarget:!0,getEventPosition:e[128]}))],c=!0)},p(e,n){524305&n[0]&&(p=e[19],rr(),u=mr(u,n,m,1,e,p,h,i,pr,lg,null,sg),ar()),(!l||4096&n[0])&&Sn(o,"data-visible",e[12]),e[7]?g?(g.p(e,n),128&n[0]&&sr(g,1)):(g=cg(e),g.c(),sr(g,1),g.m(t,r)):g&&(rr(),lr(g,1,1,(()=>{g=null})),ar()),e[9]?f?(f.p(e,n),512&n[0]&&sr(f,1)):(f=dg(e),f.c(),sr(f,1),f.m(t,a)):f&&(rr(),lr(f,1,1,(()=>{f=null})),ar()),e[10]>0?$?($.p(e,n),1024&n[0]&&sr($,1)):($=hg(e),$.c(),sr($,1),$.m(t,null)):$&&(rr(),lr($,1,1,(()=>{$=null})),ar()),s&&Yi(s.update)&&4&n[0]&&s.update.call(null,{drag:!0,pinch:!0,inertia:!0,matchTarget:!0,getEventPosition:e[128]})},i(e){if(!l){for(let e=0;e<p.length;e+=1)sr(u[e]);sr(g),sr(f),sr($),l=!0}},o(e){for(let e=0;e<u.length;e+=1)lr(u[e]);lr(g),lr(f),lr($),l=!1},d(e){e&&mn(t);for(let e=0;e<u.length;e+=1)u[e].d();g&&g.d(),f&&f.d(),$&&$.d(),c=!1,Xi(d)}}}function mg(e,t,o){let i,n,r,s,l,c,d,u,h,p,m,g,f,$,y,b,x,v,w,S,C,M,T,P,A,I,E,L,F,B,z,D,O,_,V,N,H,{uid:U=R()}=t,{ui:j}=t,{markup:Y}=t,{offset:q}=t,{contextRotation:Z=0}=t,{contextFlipX:Q=!1}=t,{contextFlipY:oe=!1}=t,{contextScale:le}=t,{active:pe=!1}=t,{opacity:me=1}=t,{parentRect:ge}=t,{rootRect:fe}=t,{utilRect:$e}=t,{oninteractionstart:ye=a}=t,{oninteractionupdate:xe=a}=t,{oninteractionrelease:ve=a}=t,{oninteractionend:we=a}=t,{onaddshape:Se=a}=t,{onupdateshape:ke=a}=t,{onselectshape:Ce=a}=t,{onremoveshape:Te=a}=t,{beforeSelectShape:Pe=(()=>!0)}=t,{beforeDeselectShape:Ae=(()=>!0)}=t,{beforeRemoveShape:Ie=(()=>!0)}=t,{beforeUpdateShape:Ee=((e,t)=>t)}=t,{willRenderShapeControls:Le=W}=t,{mapEditorPointToImagePoint:De}=t,{mapImagePointToEditorPoint:We}=t,{eraseRadius:Ve}=t,{selectRadius:Ne}=t,{enableButtonFlipVertical:He=!1}=t,{enableTapToAddText:Ue=!0}=t,{locale:je}=t;const Xe=(e,t,o)=>{let i=Ee({...e},t,{...o});mi(e,i,o)},Ye=(e,t,o,i)=>{const n=G(e.x-o.x,e.y-o.y),r=G(i.x-o.x,i.y-o.y),a=se(r,r);let s=se(n,r)/a;s=s<0?0:s,s=s>1?1:s;const l=G(r.x*s+o.x-e.x,r.y*s+o.y-e.y);return se(l,l)<=t*t},qe=(e,t,o)=>{const i=o.length;for(let n=0;n<i-1;n++)if(Ye(e,t,o[n],o[n+1]))return!0;return!1},Ke=(e,t,o)=>!!st(e,o)||(!!qe(e,t,o)||Ye(e,t,o[0],o[o.length-1])),Ze=(e,t,o,i,n)=>Ke(e,t,Ge(o,i,n||_e(o))),tt=Vn("keysPressed");Zi(e,tt,(e=>o(137,N=e)));const ot=(e,t,o)=>0===e||t&&o?e:t||o?-e:e,it=(e,t)=>{const o=We(e);return De(ne(o,t))},nt=(e,t,o)=>{if(Po(e)){const i=it(wo(t),o),n=it(So(t),o);Xe(e,{x1:i.x,y1:i.y,x2:n.x,y2:n.y},ge)}else if(To(e)||ko(e)||Ro(e)){const i=it(t,o);Xe(e,i,ge)}ft()},rt={0:1,1:0,2:3,3:2},lt={0:3,1:2,2:1,3:0};let dt;const ut=()=>{if(Y.length)return Y.find(Bo)},ht=()=>{if(Y.length)return Y.findIndex(Bo)},pt=(e,t=!0)=>{if(!ut())return Wo(e),$t(e,t)},mt=()=>{const e=ut();if(e)return e._isDraft=!1,ft(),e},gt=()=>{ut()&&(Y.splice(ht(),1),ft())},ft=()=>o(0,Y),$t=(e,t=!0)=>(Y.push(e),t&&ft(),e),yt=(e,t=[],o=!0)=>{t.forEach((t=>delete e[t])),o&&ft()},bt=(e,t,o=!0)=>{e=Object.assign(e,t),o&&ft()},xt=(e,t,o,i=!0)=>{e[t]=o,i&&ft()},vt=(e,t=!0)=>{Y.forEach((t=>bt(t,e,!1))),t&&ft()},wt=()=>[...Y].reverse().find(Fo),St=()=>!!wt(),kt=e=>{if(!Ie(e))return!1;o(0,Y=Y.filter((t=>t!==e))),Te(e)},Ct=()=>{const e=wt();if(!e)return;const t=Y.filter((e=>Ho(e)&&No(e))),o=t.findIndex((t=>t===e));if(!1===kt(e))return;if(Mt=e,t.length-1<=0)return Tt();const i=o-1<0?t.length-1:o-1;Pt(t[i])};let Mt=void 0;const Tt=()=>{Object.keys(eo).forEach((e=>eo[e]={})),Mt=Rt(),vt({isSelected:!1,isEditing:!1})},Rt=()=>Y.find(Fo),Pt=(e,t=!0)=>{if(Bo(e))return;const o=Rt()||Mt;Mt=void 0,Pe(o,e)&&(Tt(),(e=>{e.isSelected=!0})(e),Ce(e),t&&ft())},At=e=>{bt(e,{isSelected:!1,isEditing:!1})},It=e=>{bt(e,{isSelected:!0,isEditing:!0})},Et=e=>{bt(e,{isSelected:!0,isEditing:!1})},Lt=e=>{const t=e.filter(Ie);return o(0,Y=Y.filter((e=>!t.includes(e)))),t},Ft=e=>{const t=po(e.text,e);return Oe(e.x,e.y,e.width?Math.min(e.width,t.width):t.width,e.height?Math.min(e.height,t.height):t.height)},Bt=e=>{if(zo(e))return Fe(e);if(Ro(e))return ze(e);const t=Ft(e);return t.width=Math.max(10,e.width||t.width),t},zt=(e,t=0)=>[...Y].reverse().map((e=>({shape:e,priority:1}))).filter((e=>No(e.shape))).filter((o=>{const{shape:i}=o,n=di($o(i),ge),r=t+(n.strokeWidth||0);if(To(n))return Ze(e,r,n,i.rotation);if(ko(n)){const t=Bt(n),a=Ze(e,r,t,i.rotation);let s=!1;if(a&&!Fo(i)){const a=Ft(n);"right"!==i.textAlign||i.flipX||(a.x=t.x+t.width-a.width),"center"===i.textAlign&&(a.x=t.x+.5*t.width-.5*a.width),s=Ze(e,r,a,i.rotation,_e(t)),s||(o.priority=-1)}return a}return Ro(n)?((e,t,o,i,n,r)=>{const a=ct(G(o.x,o.y),o.rx,o.ry,i,n,r,12);return Ke(e,t,a)})(e,r,n,i.rotation,i.flipX,i.flipY):Po(n)?Ye(e,Math.max(16,r),wo(n),So(n)):!!Io(n)&&qe(e,Math.max(16,r),n.points)})).sort(((e,t)=>e.priority<t.priority?1:e.priority>t.priority?-1:0)),Dt=(e,t,o,i=0)=>{const n=Math.abs(i),r=Re(Me(t,o),n),a=(({start:e,end:t},o)=>{if(0===o)return[G(e.x,e.y),G(e.x,e.y),G(t.x,t.y),G(t.x,t.y)];const i=Math.atan2(t.y-e.y,t.x-e.x),n=Math.sin(i)*o,r=Math.cos(i)*o;return[G(n+e.x,-r+e.y),G(-n+e.x,r+e.y),G(-n+t.x,r+t.y),G(n+t.x,-r+t.y)]})(r,n);return e.filter((e=>{const t=di($o(e),ge);if(Po(t)||Io(t)){const e=t.points?[...t.points]:[wo(t),So(t)];return!!((e,t)=>{const o=t.length,i=[];for(let n=0;n<o-1;n++){const o=at(e.start,e.end,t[n],t[n+1]);o&&i.push(o)}return i.length?i:void 0})(r,e)}return((e,t)=>!(!e.find((e=>st(e,t)))&&!t.find((t=>st(t,e)))))(a,((e,t=12)=>{if(To(e))return Ge(e,e.rotation,_e(e));if(ko(e)){const t=Bt(e);return Ge(t,e.rotation,_e(t))}return Ro(e)?ct(G(e.x,e.y),e.rx,e.ry,e.rotation,e.flipX,e.flipY,t):[]})(t))}))};let Ot=void 0,_t=void 0,Wt=void 0,Vt=void 0,Nt=void 0,Ht=!1;const Ut=e=>{let t;if(To(e)){const o=_e(e);t=et(e),(e.flipX||e.flipY)&&ue(t,e.flipX,e.flipY,o.x,o.y),t=he(t,e.rotation,o.x,o.y)}else if(Ro(e)){const o=e;t=et(ze(e)),(e.flipX||e.flipY)&&ue(t,e.flipX,e.flipY,o.x,o.y),t=he(t,e.rotation,o.x,o.y)}else if(Po(e))t=[wo(e),So(e)];else if(Io(e))t=[...e.points];else if(ko(e)){const o=Bt(e);o.width=Math.max(10,o.width);const i=_e(o);t=et(o),(e.flipX||e.flipY)&&ue(t,e.flipX,e.flipY,i.x,i.y),t=he(t,e.rotation,i.x,i.y)}return t},jt=e=>{const t=Ut(e);let o,i;return e.flipY?(o=de([t[0],t[1]]),i=ee(G(t[1].x-t[2].x,t[1].y-t[2].y))):(o=de([t[2],t[3]]),i=ee(G(t[2].x-t[1].x,t[2].y-t[1].y))),ae(i,20/le),{origin:o,dir:i}};let Xt="markup-manipulator-segment";const Yt=e=>{const t=j.find((e=>e.id===Xt)),n=t?Math.max(t.opacity,e):e,r=[],a=.1*n,s=n,l=[0,0,0],c=[1,1,1],d=!Io(i)&&!Po(i);r.push({id:Xt,points:m.map((e=>G(e.x+1,e.y+1))),pathClose:d,strokeColor:l,strokeWidth:2,opacity:a,_group:U}),f&&r.push({id:Xt,points:[G(f.origin.x+1,f.origin.y+1),G(f.position.x+1,f.position.y+1)],strokeColor:l,strokeWidth:2,opacity:a,_group:U}),r.push({id:Xt,points:m,pathClose:d,strokeColor:c,strokeWidth:1.5,opacity:s,_group:U}),f&&r.push({id:Xt,points:[{x:f.origin.x,y:f.origin.y},{x:f.position.x,y:f.position.y}],strokeColor:c,strokeWidth:1.5,opacity:s,_group:U}),o(42,j=[...j.filter((e=>e.id!==Xt)),...r])},qt=()=>{o(42,j=j.filter((e=>0===e.opacity&&e.id!==Xt)))};On((()=>{qt()}));let Kt;const Zt=()=>{const e=Co(i)?no(Kt.value):Kt.value,t=jo(i,e),o=!0===t?e:t;let n=v.x,a=v.y;if(!i.height){const e=Ge({...S},i.rotation),t=po(o,r),s=Ge({x:n,y:a,...t},i.rotation),[l,,c]=e,[d,,u]=s;let h=l,p=d;i.flipX&&(h=c,p=u);const m=re(K(h),p);n+=m.x,a+=m.y}bt(i,{x:k(x.x)?io(n,ge.width):n,y:k(x.y)?io(a,ge.height):a,text:o})},Jt=(e,t,{flipX:o,flipY:i,rotation:n},r="top left")=>{let a,s;const[l,c,d,u]=Ge(e,n),[h,p,m,g]=Ge(t,n);if("top center"===r){a=de(i?[u,d]:[l,c]),s=de(i?[g,m]:[h,p])}else"top right"===r&&!o||"top left"===r&&o?(a=i?d:c,s=i?m:p):(a=i?u:l,s=i?g:h);return re(K(a),s)},Qt=(e,t,o)=>G(k(e.x)?io(t.x+o.x,ge.width):t.x+o.x,k(e.y)?io(t.y+o.y,ge.height):t.y+o.y),eo={},to=()=>{const e=po(i.text,r),t=Gt(i,"height"),o=!t&&Gt(i,"width"),n=i.id;let a=eo[n];a||(eo[n]={},a=eo[n]);const s=e=>{const{width:t,...o}=r,n=po(i.text,o),a=Jt(Oe(r.x,r.y,e.width,e.height),Oe(r.x,r.y,n.width,n.height),r,"top "+i.textAlign);yt(i,["width","height","textAlign"]),bt(i,{...Qt(i,r,a)})},l=t=>{const o=be(a.width||r.width||e.width,e.height),n=a.textAlign||"left",s=Jt(Oe(r.x,r.y,t.width,t.height),Oe(r.x,r.y,o.width,o.height),r,"top "+n);yt(i,["height"]),bt(i,{...Qt(i,r,s),width:k(i.width)?io(o.width,ge.width):o.width,textAlign:n})},c=t=>{const o=be(a.width||e.width,a.height||e.height),n=a.textAlign||"left",s=Jt(Oe(r.x,r.y,t.width,t.height),Oe(r.x,r.y,o.width,o.height),r,"top "+n);bt(i,{...Qt(i,r,s),width:k(i.width)?io(o.width,ge.width):o.width,height:k(i.width)?io(o.height,ge.height):o.height,textAlign:n})};if(t){a.textAlign=i.textAlign,a.width=r.width,a.height=r.height;const e=be(r.width,r.height);Xo(i,"auto-height")?l(e):Xo(i,"auto-width")&&s(e)}else if(o){a.textAlign=i.textAlign,a.width=r.width;const t=be(r.width,e.height);Xo(i,"auto-width")?s(t):Xo(i,"fixed-size")&&c(t)}else{const t=be(e.width,e.height);Xo(i,"fixed-size")?c(t):Xo(i,"auto-height")&&l(t)}},oo=()=>It(i),no=e=>e.split(/[\n\r]/g).map((e=>e.trim())).filter((e=>e.length)).join(" "),ro=()=>{let e=Bo(i);Bo(i)&&mt(),Zt(),Et(i),e?Se(i):ke(i)},ao=()=>{Bo(i)?gt():(bt(i,{text:x.text,x:x.x,y:x.y}),Et(i))},so=e=>{e.stopPropagation();const t=i.flipX||!1;xt(i,"flipX",!t),ke(i)},lo=e=>{e.stopPropagation();const t=i.flipY||!1;xt(i,"flipY",!t),ke(i)},co=e=>{xt(i,"opacity",e),ke(i)},uo=e=>{e.stopPropagation(),e.target.blur(),Ct()},ho=e=>{e.stopPropagation();Y.findIndex((e=>e===i))!==Y.length-1&&(o(0,Y=Y.filter((e=>e!==i)).concat([i])),ke(i))},mo=e=>{e.stopPropagation();const t=$o(i);t.id=R();const o=G(50,-50);if(Po(t)){const e=pi(t,["x1","y1","x2","y2"],ge);e.x1+=o.x,e.y1+=o.y,e.x2+=o.x,e.y2+=o.y,mi(t,e,ge)}else{const e=pi(t,["x","y"],ge);e.x+=50,e.y-=50,mi(t,e,ge)}Y.push(t),Se(t),Pt(t)},go=qa(0,{stiffness:.2,damping:.7});let yo;Zi(e,go,(e=>o(10,H=e)));const bo=(e,t)=>{const{disableTextLayout:o=[]}=t;return"height"in t?o.includes("auto-height")?e.shapeIconButtonTextLayoutAutoWidth:e.shapeIconButtonTextLayoutAutoHeight:"width"in t?o.includes("auto-width")?e.shapeIconButtonTextLayoutFixedSize:e.shapeIconButtonTextLayoutAutoWidth:o.includes("fixed-size")?e.shapeIconButtonTextLayoutAutoHeight:e.shapeIconButtonTextLayoutFixedSize},xo=(e,t)=>{const{disableTextLayout:o=[]}=t;return"height"in t?o.includes("auto-height")?e.shapeTitleButtonTextLayoutAutoWidth:e.shapeTitleButtonTextLayoutAutoHeight:"width"in t?o.includes("auto-width")?e.shapeTitleButtonTextLayoutFixedSize:e.shapeTitleButtonTextLayoutAutoWidth:o.includes("fixed-size")?e.shapeTitleButtonTextLayoutAutoHeight:e.shapeTitleButtonTextLayoutFixedSize};let vo=!1;return e.$$set=e=>{"uid"in e&&o(43,U=e.uid),"ui"in e&&o(42,j=e.ui),"markup"in e&&o(0,Y=e.markup),"offset"in e&&o(1,q=e.offset),"contextRotation"in e&&o(44,Z=e.contextRotation),"contextFlipX"in e&&o(45,Q=e.contextFlipX),"contextFlipY"in e&&o(46,oe=e.contextFlipY),"contextScale"in e&&o(47,le=e.contextScale),"active"in e&&o(48,pe=e.active),"opacity"in e&&o(49,me=e.opacity),"parentRect"in e&&o(50,ge=e.parentRect),"rootRect"in e&&o(2,fe=e.rootRect),"utilRect"in e&&o(51,$e=e.utilRect),"oninteractionstart"in e&&o(52,ye=e.oninteractionstart),"oninteractionupdate"in e&&o(53,xe=e.oninteractionupdate),"oninteractionrelease"in e&&o(54,ve=e.oninteractionrelease),"oninteractionend"in e&&o(55,we=e.oninteractionend),"onaddshape"in e&&o(56,Se=e.onaddshape),"onupdateshape"in e&&o(57,ke=e.onupdateshape),"onselectshape"in e&&o(58,Ce=e.onselectshape),"onremoveshape"in e&&o(59,Te=e.onremoveshape),"beforeSelectShape"in e&&o(60,Pe=e.beforeSelectShape),"beforeDeselectShape"in e&&o(61,Ae=e.beforeDeselectShape),"beforeRemoveShape"in e&&o(62,Ie=e.beforeRemoveShape),"beforeUpdateShape"in e&&o(63,Ee=e.beforeUpdateShape),"willRenderShapeControls"in e&&o(64,Le=e.willRenderShapeControls),"mapEditorPointToImagePoint"in e&&o(65,De=e.mapEditorPointToImagePoint),"mapImagePointToEditorPoint"in e&&o(66,We=e.mapImagePointToEditorPoint),"eraseRadius"in e&&o(67,Ve=e.eraseRadius),"selectRadius"in e&&o(68,Ne=e.selectRadius),"enableButtonFlipVertical"in e&&o(69,He=e.enableButtonFlipVertical),"enableTapToAddText"in e&&o(70,Ue=e.enableTapToAddText),"locale"in e&&o(3,je=e.locale)},e.$$.update=()=>{var t,a;if(1&e.$$.dirty[0]&&o(100,i=Y&&(ut()||wt())),128&e.$$.dirty[3]&&o(101,n=i&&!Bo(i)?i.id:void 0),4&e.$$.dirty[0]|524288&e.$$.dirty[1]|128&e.$$.dirty[3]&&o(102,r=fe&&i&&di($o(i),ge)),128&e.$$.dirty[3]&&o(103,s=!(!i||!Bo(i))),128&e.$$.dirty[3]&&o(104,l=i||void 0),262144&e.$$.dirty[1]|640&e.$$.dirty[3]&&o(105,c=i&&me&&Ut(r)||[]),128&e.$$.dirty[3]&&o(106,d=i&&(Yo(t=i)&&Go(t)&&!0!==t.disableResize&&(zo(t)||Mo(t)||Ro(t)||Po(t)))&&!Eo(i)),128&e.$$.dirty[3]&&o(6,u=i&&(e=>Yo(e)&&!0!==e.disableRotate&&(zo(e)||Gt(e,"text")||Ro(e)))(i)&&!Eo(i)),8320&e.$$.dirty[3]&&o(13,h=d&&Gt(i,"text")&&!i.height?"horizontal":d),4224&e.$$.dirty[3]&&o(7,p=i&&c.length>1),16&e.$$.dirty[2]|4096&e.$$.dirty[3]&&o(107,m=c.map(We)),2&e.$$.dirty[0]|16384&e.$$.dirty[3]&&o(8,g=m.map((e=>G(e.x-q.x,e.y-q.y)))),192&e.$$.dirty[0]|262144&e.$$.dirty[1]|512&e.$$.dirty[3]&&o(108,f=p&&u&&me&&(e=>{const t=jt(e),o=We({x:t.origin.x+t.dir.x,y:t.origin.y+t.dir.y});return{origin:We(t.origin),position:o}})(r)),2&e.$$.dirty[0]|32768&e.$$.dirty[3]&&o(14,$=f&&G(f.position.x-q.x,f.position.y-q.y)),256&e.$$.dirty[0]|393216&e.$$.dirty[1]|128&e.$$.dirty[3])if(pe)if(me>0){o(42,j=j.map((e=>(e.id!==Xt||(e._group=U),e))));const e=i&&Bo(i)&&Io(i);g.length>2&&!e?Yt(me):qt()}else i||Yt(me);else j.find((e=>e._group===U))&&Yt(me);128&e.$$.dirty[3]&&o(109,y=i&&ko(i)),65664&e.$$.dirty[3]&&o(9,b=y&&!1!==jo(i)&&i.isEditing),512&e.$$.dirty[0]&&o(110,x=b?{...i}:void 0),524288&e.$$.dirty[1]|131072&e.$$.dirty[3]&&o(111,v=x&&di({...x},ge)),262144&e.$$.dirty[3]&&o(112,w=v&&po(v.text,v)),786432&e.$$.dirty[3]&&(S=v&&Oe(v.x,v.y,w.width,w.height)),512&e.$$.dirty[0]|128&e.$$.dirty[3]&&o(15,C=b?i.text:""),512&e.$$.dirty[0]|2048&e.$$.dirty[3]&&o(16,M=b&&`\n text-align: ${l.textAlign||"left"};\n font-family: ${l.fontFamily||"sans-serif"};\n`),1049728&e.$$.dirty[3]&&o(113,T=i&&!s?i:T),1048576&e.$$.dirty[3]&&o(114,P=T&&Uo(T)),1048576&e.$$.dirty[3]&&o(115,A=T&&Xo(T)),1048576&e.$$.dirty[3]&&o(116,I=T&&(e=>!0!==e.disableDuplicate&&Go(e))(T)),1048576&e.$$.dirty[3]&&o(117,E=T&&Ho(T)),1048576&e.$$.dirty[3]&&o(118,L=T&&(e=>!0!==e.disableReorder)(T)),1048576&e.$$.dirty[3]&&o(119,F=T&&!1!==jo(T)),1048576&e.$$.dirty[3]&&o(120,B=T&&Gt(T,"backgroundImage")&&Vo(T,"opacity")),512&e.$$.dirty[0]|1216&e.$$.dirty[3]&&go.set(!i||s||Ht||b?0:1),256&e.$$.dirty[0]|268436608&e.$$.dirty[3]&&o(121,z=i&&!s?(a=Be(g),ie(G(a.x+.5*a.width,a.y),Jl)):z),32&e.$$.dirty[0]|1048576&e.$$.dirty[1]|268435456&e.$$.dirty[3]&&o(122,D=z&&yo&&$e&&(e=>{const t=$e.x,o=$e.y,i=t+$e.width;let n=Math.max(e.x-.5*yo.width,t),r=Math.max(e.y-yo.height-16,o);return n+yo.width>i&&(n=i-yo.width),G(n,r)})(z)),1024&e.$$.dirty[0]|536870912&e.$$.dirty[3]&&o(17,O=D&&`transform: translate(${D.x}px, ${D.y}px);opacity:${H}`),8&e.$$.dirty[0]|132&e.$$.dirty[2]|266338688&e.$$.dirty[3]&&o(18,_=n&&Le([B&&["div","alpha",{class:"PinturaShapeControlsGroup"},[["Slider","adjust-opacity",{onchange:co,step:.01,value:Gt(i,"opacity")?i.opacity:1,label:(e,t,o)=>Math.round(e/o*100)+"%",min:0,max:1,direction:"x"}]]],["div","beta",{class:"PinturaShapeControlsGroup"},[P&&["Button","flip-horizontal",{onclick:so,label:je.shapeTitleButtonFlipHorizontal,icon:je.shapeIconButtonFlipHorizontal,hideLabel:!0}],P&&He&&["Button","flip-vertical",{onclick:lo,label:je.shapeTitleButtonFlipVertical,icon:je.shapeIconButtonFlipVertical,hideLabel:!0}],L&&["Button","to-front",{onclick:ho,label:je.shapeTitleButtonMoveToFront,icon:je.shapeIconButtonMoveToFront,hideLabel:!0}],I&&["Button","duplicate",{onclick:mo,label:je.shapeTitleButtonDuplicate,icon:je.shapeIconButtonDuplicate,hideLabel:!0}],E&&["Button","remove",{onclick:uo,label:je.shapeTitleButtonRemove,icon:je.shapeIconButtonRemove,hideLabel:!0}]].filter(Boolean)],F&&A&&["div","gamma",{class:"PinturaShapeControlsGroup"},[["Button","text-layout",{onclick:to,label:mc(xo,je,i),icon:mc(bo,je,i),hideLabel:!0}]]],F&&["div","delta",{class:"PinturaShapeControlsGroup"},[["Button","edit-text",{label:je.shapeLabelInputText,onclick:oo}]]]].filter(Boolean),n)),9&e.$$.dirty[0]&&o(19,V=Y.filter(No).filter((e=>!Bo(e))).map((e=>({id:e.id,color:ko(e)?e.color:Po(e)?e.strokeColor:e.backgroundColor,name:e.name||je["shapeLabelTool"+zr(ii(e))]}))))},[Y,q,fe,je,Pt,yo,u,p,g,b,H,Kt,vo,h,$,C,M,O,_,V,tt,e=>{const{origin:t}=e.detail;Wt=void 0,Vt=void 0,Nt=void 0,_t=void 0,clearTimeout(Ot),Ot=setTimeout((()=>o(99,Ht=!0)),250);ut()&&mt();const i=De(K(t)),n=zt(i,Ne),r=n.length&&n.shift().shape;if(r&&Fo(r))return Wt=r,Vt=$o(Wt),void(Nt=di($o(Wt),ge));_t=r;!ye(e)&&r&&(Pt(r),Wt=r,Vt=$o(Wt),Nt=di($o(Wt),ge))},e=>{if(Wt){if(!Go(Wt))return;if(Eo(Wt))return;return nt(Wt,Nt,e.detail.translation)}xe(e)},e=>{clearTimeout(Ot),o(99,Ht=!1),Wt?Wt.isEditing?ao():e.detail.isDoubleTap&&ko(Wt)&&!1!==jo(Wt)&&It(Wt):ve(e)},e=>{const t=_t&&e.detail.isTap;if(Wt)return o=Wt,i=Vt,JSON.stringify(o)!==JSON.stringify(i)&&ke(Wt),void(Wt=void 0);var o,i;const n=Rt(),r=!n||Ae(n,_t);r&&Tt(),we(e),r&&t&&Pt(_t)},e=>{o(99,Ht=!0),Wt=i,Nt=r},e=>{const{translation:t,indexes:o,shiftKey:i}=e.detail;((e,t,o,i,n)=>{if(Po(e)){const[n]=o,r=N.includes(16)?(e,t)=>{const o=ce(e,t),i=te(e,t),n=Math.PI/4,r=n*Math.round(i/n)-Z%n;t.x=e.x+o*Math.cos(r),t.y=e.y+o*Math.sin(r)}:(e,t)=>t;if(0===n){const o=it(wo(t),i);r(G(t.x2,t.y2),o),Xe(e,{x1:o.x,y1:o.y},ge)}else if(1===n){const o=it(So(t),i);r(G(t.x1,t.y1),o),Xe(e,{x2:o.x,y2:o.y},ge)}}else if(zo(e)||Ro(e)||Mo(e)){let r,a,s=!1;if(Ro(e))r=ze(t);else if(zo(e))r=Fe(t);else{s=!0,r=Fe(t);const e=po(t.text,t);r.height=e.height}e.aspectRatio?a=e.aspectRatio:n.shiftKey&&!s&&(a=r.width/r.height);const l=Fe(r),c=_e(l),d=e.rotation,u=et(l),h=Ge(l,d);if(1===o.length){let t=o[0];e.flipX&&(t=rt[t]),e.flipY&&(t=lt[t]);const[n,r,s,l]=u,p=We(h[t]);ne(p,i);const m=De(p),g=G(m.x-h[t].x,m.y-h[t].y),f=J(K(g),-d),$=G(u[t].x+f.x,u[t].y+f.y);let y;0===t&&(y=s),1===t&&(y=l),2===t&&(y=n),3===t&&(y=r);const b=Be(y,$);if(a){const{width:e,height:t}=Je(b,a),[o,i,n,r]=Qe(b);b.width=e,b.height=t,$.y<y.y&&(b.y=n-t),$.x<y.x&&(b.x=i-e)}const x=Ge(b,d,c),v=de(x),w=J(x[0],-d,v),S=J(x[2],-d,v),k=Be(w,S);Xe(e,Ro(e)?X(k):k,ge)}else{o=o.map((t=>(e.flipX&&(t=rt[t]),e.flipY&&(t=lt[t]),t)));const[t,n]=o.map((e=>h[e])),r={x:t.x+.5*(n.x-t.x),y:t.y+.5*(n.y-t.y)},[l,p]=o.map((e=>u[e])),[m,g]=o.map((e=>{const t=e+2;return t<4?u[t]:u[t-4]})),f={x:m.x+.5*(g.x-m.x),y:m.y+.5*(g.y-m.y)},$=We(r);ne($,i);const y=De($),b=G(y.x-r.x,y.y-r.y),x=J(K(b),-d),v=re(K(l),p),w=ie(v,(e=>1-Math.abs(Math.sign(e)))),S=G(x.x*w.x,x.y*w.y);ne(l,S),ne(p,S);const k=Be(u);if(a){let e=k.width,t=k.height;0===w.y?t=e/a:e=t*a,k.width=e,k.height=t,0===w.y?k.y=f.y-.5*t:k.x=f.x-.5*e}const C=Ge(k,d,c),M=de(C),T=J(C[0],-d,M),R=J(C[2],-d,M),P=Be(T,R);let A;Ro(e)?A=X(P):zo(e)?A=P:s&&(A={x:P.x,y:P.y,width:P.width}),Xe(e,A,ge)}}ft()})(Wt,Nt,o,t,{shiftKey:i})},e=>{Pt(Wt),Wt=void 0,o(99,Ht=!1),ke(i)},e=>{dt=jt(r).origin,o(99,Ht=!0),Wt=i,Nt=r},e=>{const{translation:t,shiftKey:o}=e.detail;((e,t,o,i)=>{const n=Bt(di($o(e),ge)),r=_e(n),a=it(dt,o);let s=te(a,r)+Math.PI/2;if(i.shiftKey){const e=Math.PI/16;s=e*Math.round(s/e)-Z%e}Xe(e,{rotation:s},ge),ft()})(Wt,0,t,{shiftKey:o})},()=>{Pt(Wt),Wt=void 0,o(99,Ht=!1),ke(i)},e=>{if(!St())return;const{key:t}=e;if(/escape/i.test(t))return At(i);/backspace/i.test(t)&&!/input|textarea/i.test(e.target.nodeName)&&(e.preventDefault(),Ct())},Zt,e=>{const t=e.target.value,o=e.target.selectionStart,n=e.target.selectionEnd,r=t.substring(0,o),a=t.substring(n),s=r+e.key+a;if(jo(i,s)!==s)return e.preventDefault()},e=>Co(i)&&/enter/i.test(e.code)?e.preventDefault():/arrow/i.test(e.code)?e.stopPropagation():/escape/i.test(e.key)?ao():void 0,e=>{const{key:t,ctrlKey:o,altKey:i}=e;if(/enter/i.test(t)&&o|i)return ro()},ro,ao,go,e=>{const t=wt();t&&Go(t)&&(Wt=t,Nt=di($o(Wt),ge),nt(Wt,Nt,e.detail))},e=>{o(12,vo=!0)},({relatedTarget:e})=>{e&&e.classList.contains("shape-selector__button")||o(12,vo=!1)},j,U,Z,Q,oe,le,pe,me,ge,$e,ye,xe,ve,we,Se,ke,Ce,Te,Pe,Ae,Ie,Ee,Le,De,We,Ve,Ne,He,Ue,(e,t={})=>{let o,i,n,r=Ro(e),a=ko(e),s="relative"===t.position;return Io(e)?{start:t=>{const{origin:r}=t.detail;i=4,o=K(r),n=K(r);const a=De(r);s&&(a.x=s?io(a.x,ge.width):a.x,a.y=s?io(a.y,ge.height):a.y),pt({...e,points:[a]})},update:e=>{const t=ut(),{translation:r}=e.detail,a=G(o.x+r.x,o.y+r.y),l=ce(n,a);if(fo(l,5)<=i)return;const c=te(a,n),d=i-l;n.x+=d*Math.cos(c),n.y+=d*Math.sin(c);const u=De(n);u&&(u.x=s?io(u.x,ge.width):u.x,u.y=s?io(u.y,ge.height):u.y),t.points=t.points.concat(u),ft()},release:e=>e.detail.preventInertia(),end:e=>{if(e.detail.isTap)return gt();const t=mt();Se(t)}}:r||a||To(e)?{start:t=>{const{origin:i}=t.detail;o=K(i);const n=De(o),a={...e,rotation:-1*ot(Z,Q,oe),x:s?io(n.x,ge.width):n.x,y:s?io(n.y,ge.height):n.y};a.flipX=Q,a.flipY=oe,delete a.position,a.opacity=0,r?(a.rx=s?io(0):0,a.ry=s?io(0):0):(a.width=s?io(0):0,a.height=s?io(0):0),pt(a)},update:e=>{const t=ut();t.opacity=1;const{aspectRatio:i}=t;let{translation:n}=e.detail;if(i){const e=Math.abs(n.x)*i;n.x=n.x,n.y=e*Math.sign(n.y)}const a=G(o.x+n.x,o.y+n.y),s=De(o),l=De(a),c={x:s.x+.5*(l.x-s.x),y:s.y+.5*(l.y-s.y)},d=ot(Z,Q,oe);J(s,d,c),J(l,d,c);const u=Math.min(s.x,l.x),h=Math.min(s.y,l.y);let p=Math.max(s.x,l.x)-u,m=Math.max(s.y,l.y)-h,g={};r?(g.x=u+.5*p,g.y=h+.5*m,g.rx=.5*p,g.ry=.5*m):(g.x=u,g.y=h,g.width=p,g.height=m),Xe(t,g,ge),ft()},release:e=>{e.detail.preventInertia()},end:e=>{const t=ut();if(e.detail.isTap){if(!ko(t)||!Ue||_t)return gt();delete t.width,delete t.height,delete t.textAlign;const e=di({...t},ge),i=po(t.text,e);i.width*=le,i.height*=le;const n=De({x:o.x,y:o.y-.5*i.height}),r=De({x:o.x+i.width,y:o.y+.5*i.height}),a={x:n.x+.5*(r.x-n.x),y:n.y+.5*(r.y-n.y)},s=ot(Z,Q,oe);J(n,s,a),J(r,s,a);const l=Math.min(n.x,r.x),c=Math.min(n.y,r.y);t.x=k(t.x)?io(l,ge.width):l,t.y=k(t.y)?io(c,ge.height):c}if(t.opacity=1,!ko(t)){const e=mt();Se(e)}Pt(t),ko(t)&&It(t)}}:Po(e)?{start:t=>{const{origin:i}=t.detail,n=De(i),r=ie(n,Jl);o=K(i),pt({...e,x1:s?io(r.x,ge.width):r.x,y1:s?io(r.y,ge.height):r.y,x2:s?io(r.x,ge.width):r.x,y2:s?io(r.y,ge.height):r.y,opacity:0})},update:e=>{const t=ut(),{translation:i}=e.detail,n=ne(K(o),i);if(N.includes(16)){const e=ce(o,n),t=te(o,n),i=Math.PI/4,r=i*Math.round(t/i);n.x=o.x+e*Math.cos(r),n.y=o.y+e*Math.sin(r)}const r=De(n);bt(t,{x2:s?io(r.x,ge.width):r.x,y2:s?io(r.y,ge.height):r.y,opacity:1}),ft()},release:e=>e.detail.preventInertia(),end:e=>{const t=ut();if(e.detail.isTap)return gt();t.opacity=1;const o=mt();Se(o),Pt(o)}}:void 0},()=>{let e,t;return{start:o=>{e=o.detail.origin,t=e},update:o=>{const{translation:i}=o.detail,n=G(e.x+i.x,e.y+i.y),r=Y.filter((e=>!e.disableErase)),a=Dt(r,De(t),De(n),Ve);Lt(a).forEach(Te),t=K(n)},release:e=>e.detail.preventInertia(),end:()=>{}}},ut,ht,pt,mt,gt,(e={})=>({id:R(),...e}),ft,$t,yt,bt,xt,(e,t,o=!0)=>{Y.forEach((o=>xt(o,e,t,!1))),o&&ft()},vt,wt,St,kt,Ct,Tt,At,It,Et,Lt,Ft,Bt,zt,Dt,Ht,i,n,r,s,l,c,d,m,f,y,x,v,w,T,P,A,I,E,L,F,B,z,D,function(t){Nn(e,t)},(e,t)=>Pt(Y[e]),function(e){Un[e?"unshift":"push"]((()=>{Kt=e,o(11,Kt)}))},function(){C=this.value,o(15,C),o(9,b),o(100,i),o(109,y),o(0,Y)},e=>o(5,yo=e.detail),e=>eg(e,fe)]}class gg extends Sr{constructor(e){super(),wr(this,e,mg,pg,Gi,{uid:43,ui:42,markup:0,offset:1,contextRotation:44,contextFlipX:45,contextFlipY:46,contextScale:47,active:48,opacity:49,parentRect:50,rootRect:2,utilRect:51,oninteractionstart:52,oninteractionupdate:53,oninteractionrelease:54,oninteractionend:55,onaddshape:56,onupdateshape:57,onselectshape:58,onremoveshape:59,beforeSelectShape:60,beforeDeselectShape:61,beforeRemoveShape:62,beforeUpdateShape:63,willRenderShapeControls:64,mapEditorPointToImagePoint:65,mapImagePointToEditorPoint:66,eraseRadius:67,selectRadius:68,enableButtonFlipVertical:69,enableTapToAddText:70,locale:3,createShape:71,eraseShape:72,getMarkupItemDraft:73,getMarkupItemDraftIndex:74,addMarkupItemDraft:75,confirmMarkupItemDraft:76,discardMarkupItemDraft:77,createMarkupItem:78,syncShapes:79,addShape:80,removeMarkupShapeProps:81,updateMarkupShape:82,updateMarkupShapeProperty:83,updateMarkupItemsShapeProperty:84,updateMarkupShapeItems:85,getActiveMarkupItem:86,hasActiveMarkupItem:87,removeShape:88,removeActiveMarkupItem:89,blurShapes:90,selectShape:4,deselectMarkupItem:91,editMarkupItem:92,finishEditMarkupItem:93,removeMarkupItems:94,getTextShapeRect:95,getMarkupShapeRect:96,getShapesNearPosition:97,getShapesBetweenPoints:98},[-1,-1,-1,-1,-1,-1])}get createShape(){return this.$$.ctx[71]}get eraseShape(){return this.$$.ctx[72]}get getMarkupItemDraft(){return this.$$.ctx[73]}get getMarkupItemDraftIndex(){return this.$$.ctx[74]}get addMarkupItemDraft(){return this.$$.ctx[75]}get confirmMarkupItemDraft(){return this.$$.ctx[76]}get discardMarkupItemDraft(){return this.$$.ctx[77]}get createMarkupItem(){return this.$$.ctx[78]}get syncShapes(){return this.$$.ctx[79]}get addShape(){return this.$$.ctx[80]}get removeMarkupShapeProps(){return this.$$.ctx[81]}get updateMarkupShape(){return this.$$.ctx[82]}get updateMarkupShapeProperty(){return this.$$.ctx[83]}get updateMarkupItemsShapeProperty(){return this.$$.ctx[84]}get updateMarkupShapeItems(){return this.$$.ctx[85]}get getActiveMarkupItem(){return this.$$.ctx[86]}get hasActiveMarkupItem(){return this.$$.ctx[87]}get removeShape(){return this.$$.ctx[88]}get removeActiveMarkupItem(){return this.$$.ctx[89]}get blurShapes(){return this.$$.ctx[90]}get selectShape(){return this.$$.ctx[4]}get deselectMarkupItem(){return this.$$.ctx[91]}get editMarkupItem(){return this.$$.ctx[92]}get finishEditMarkupItem(){return this.$$.ctx[93]}get removeMarkupItems(){return this.$$.ctx[94]}get getTextShapeRect(){return this.$$.ctx[95]}get getMarkupShapeRect(){return this.$$.ctx[96]}get getShapesNearPosition(){return this.$$.ctx[97]}get getShapesBetweenPoints(){return this.$$.ctx[98]}}function fg(e,t,o){const i=e.slice();return i[7]=t[o],i}function $g(e,t){let o,i,n,r,a,s,l,c=mc(t[7].componentProps.title,t[1])+"";const d=[t[7].componentProps];var u=t[7].component;function h(e){let t={};for(let e=0;e<d.length;e+=1)t=Hi(t,d[e]);return{props:t}}return u&&(a=new u(h())),{key:e,first:null,c(){o=gn("li"),i=gn("span"),n=$n(c),r=yn(),a&&yr(a.$$.fragment),s=yn(),Sn(i,"class","PinturaShapeStyleLabel"),Sn(o,"class","PinturaShapeStyle"),this.first=o},m(e,t){pn(e,o,t),hn(o,i),hn(i,n),hn(o,r),a&&br(a,o,null),hn(o,s),l=!0},p(e,i){t=e,(!l||3&i)&&c!==(c=mc(t[7].componentProps.title,t[1])+"")&&Cn(n,c);const r=1&i?gr(d,[fr(t[7].componentProps)]):{};if(u!==(u=t[7].component)){if(a){rr();const e=a;lr(e.$$.fragment,1,0,(()=>{xr(e,1)})),ar()}u?(a=new u(h()),yr(a.$$.fragment),sr(a.$$.fragment,1),br(a,o,s)):a=null}else u&&a.$set(r)},i(e){l||(a&&sr(a.$$.fragment,e),l=!0)},o(e){a&&lr(a.$$.fragment,e),l=!1},d(e){e&&mn(o),a&&xr(a)}}}function yg(e){let t,o,i=[],n=new Map,r=e[0];const a=e=>e[7].id;for(let t=0;t<r.length;t+=1){let o=fg(e,r,t),s=a(o);n.set(s,i[t]=$g(s,o))}return{c(){t=gn("ul");for(let e=0;e<i.length;e+=1)i[e].c();Sn(t,"class","PinturaShapeStyleList")},m(e,n){pn(e,t,n);for(let e=0;e<i.length;e+=1)i[e].m(t,null);o=!0},p(e,o){3&o&&(r=e[0],rr(),i=mr(i,o,a,1,e,r,n,t,pr,$g,null,fg),ar())},i(e){if(!o){for(let e=0;e<r.length;e+=1)sr(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)lr(i[e]);o=!1},d(e){e&&mn(t);for(let e=0;e<i.length;e+=1)i[e].d()}}}function bg(e){let t,o,i;return o=new Ll({props:{class:"PinturaShapeStyles",elasticity:e[2],$$slots:{default:[yg]},$$scope:{ctx:e}}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"style",e[3])},m(e,n){pn(e,t,n),br(o,t,null),i=!0},p(e,[n]){const r={};4&n&&(r.elasticity=e[2]),1027&n&&(r.$$scope={dirty:n,ctx:e}),o.$set(r),(!i||8&n)&&Sn(t,"style",e[3])},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o)}}}function xg(e,t,o){let i,n,{isActive:r=!1}=t,{controls:a=[]}=t,{locale:s}=t,{scrollElasticity:l}=t;const c=qa(0);return Zi(e,c,(e=>o(6,n=e))),e.$$set=e=>{"isActive"in e&&o(5,r=e.isActive),"controls"in e&&o(0,a=e.controls),"locale"in e&&o(1,s=e.locale),"scrollElasticity"in e&&o(2,l=e.scrollElasticity)},e.$$.update=()=>{32&e.$$.dirty&&c.set(r?1:0),96&e.$$.dirty&&o(3,i=`opacity:${n};${r?"":"pointer-events:none;"}${n<=0?"visibility:hidden":""}`)},[a,s,l,i,c,r,n]}class vg extends Sr{constructor(e){super(),wr(this,e,xg,bg,Gi,{isActive:5,controls:0,locale:1,scrollElasticity:2})}}function wg(e,t,o){const i=e.slice();return i[11]=t[o].key,i[2]=t[o].controls,i[12]=t[o].isActive,i}function Sg(e,t){let o,i,n;return i=new vg({props:{isActive:t[12],controls:t[2],locale:t[0],scrollElasticity:t[1]}}),{key:e,first:null,c(){o=bn(),yr(i.$$.fragment),this.first=o},m(e,t){pn(e,o,t),br(i,e,t),n=!0},p(e,o){t=e;const n={};8&o&&(n.isActive=t[12]),8&o&&(n.controls=t[2]),1&o&&(n.locale=t[0]),2&o&&(n.scrollElasticity=t[1]),i.$set(n)},i(e){n||(sr(i.$$.fragment,e),n=!0)},o(e){lr(i.$$.fragment,e),n=!1},d(e){e&&mn(o),xr(i,e)}}}function kg(e){let t,o,i=[],n=new Map,r=e[3];const a=e=>e[11];for(let t=0;t<r.length;t+=1){let o=wg(e,r,t),s=a(o);n.set(s,i[t]=Sg(s,o))}return{c(){t=gn("div");for(let e=0;e<i.length;e+=1)i[e].c();Sn(t,"class","PinturaShapeStyleEditor")},m(e,n){pn(e,t,n);for(let e=0;e<i.length;e+=1)i[e].m(t,null);o=!0},p(e,[o]){11&o&&(r=e[3],rr(),i=mr(i,o,a,1,e,r,n,t,pr,Sg,null,wg),ar())},i(e){if(!o){for(let e=0;e<r.length;e+=1)sr(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)lr(i[e]);o=!1},d(e){e&&mn(t);for(let e=0;e<i.length;e+=1)i[e].d()}}}function Cg(e,t,o){let i,n,r,{controls:a={}}=t,{shape:s}=t,{onchange:l}=t,{locale:c}=t,{scrollElasticity:d}=t;const u=[];return e.$$set=e=>{"controls"in e&&o(2,a=e.controls),"shape"in e&&o(4,s=e.shape),"onchange"in e&&o(5,l=e.onchange),"locale"in e&&o(0,c=e.locale),"scrollElasticity"in e&&o(1,d=e.scrollElasticity)},e.$$.update=()=>{4&e.$$.dirty&&o(6,i=Object.keys(a).filter((e=>a[e]))),80&e.$$.dirty&&o(7,n=s&&i&&Vo(s)?(e=>{const t=e.id||"tool";return i.filter((t=>t.split("_").every((t=>Gt(e,t)&&Vo(e,t))))).map((o=>{const i=o.split("_"),n=i.length>1?i.map((t=>e[t])):e[o];let[r,s]=a[o];if(k(r)){if(!a[r])return;const e={...s};[r,s]=a[r],s={...s,...e}}const d=qt(s.options)?s.options(e):s.options;return{id:`${t}_${o}`,component:r,componentProps:{...s,options:d,locale:c,value:n,optionLabelClass:"PinturaButtonLabel",onchange:t=>{const n=v(t)&&!Kt(t)?t.value:t;s.onchange&&s.onchange(n,e);const r=i.length>1?i.reduce(((e,t,o)=>({...e,[t]:Array.isArray(n)?n[o]:n})),{}):{[o]:n};l(r)}}}})).filter(Boolean)})(s):[]),144&e.$$.dirty&&o(3,r=s?((e,t)=>{let o=u.find((t=>t.key===e));return o||(o={key:e,controls:t},u.push(o)),u.forEach((e=>e.isActive=!1)),o.controls=t,o.isActive=!0,u})(Object.keys(s).join("_"),n):[])},[c,d,a,r,s,l,i,n]}class Mg extends Sr{constructor(e){super(),wr(this,e,Cg,kg,Gi,{controls:2,shape:4,onchange:5,locale:0,scrollElasticity:1})}}function Tg(e){let t,o,i;return{c(){t=gn("button"),Sn(t,"class","PinturaDragButton"),Sn(t,"title",e[1]),t.disabled=e[2]},m(n,r){pn(n,t,r),t.innerHTML=e[0],e[9](t),o||(i=xn(t,"pointerdown",e[4]),o=!0)},p(e,[o]){1&o&&(t.innerHTML=e[0]),2&o&&Sn(t,"title",e[1]),4&o&&(t.disabled=e[2])},i:Vi,o:Vi,d(n){n&&mn(t),e[9](null),o=!1,i()}}}function Rg(e,t,o){let i,{html:n}=t,{title:r}=t,{onclick:s}=t,{disabled:l=!1}=t,{ongrab:c=a}=t,{ondrag:d=a}=t,{ondrop:u=a}=t;const h=e=>le(p,G(e.pageX,e.pageY))<256;let p;const m=e=>{document.documentElement.removeEventListener("pointermove",g),document.documentElement.removeEventListener("pointerup",m);const t=G(e.pageX,e.pageY);if(le(p,t)<32)return s(e);h(e)||u(e)},g=e=>{h(e)||d(e)};return e.$$set=e=>{"html"in e&&o(0,n=e.html),"title"in e&&o(1,r=e.title),"onclick"in e&&o(5,s=e.onclick),"disabled"in e&&o(2,l=e.disabled),"ongrab"in e&&o(6,c=e.ongrab),"ondrag"in e&&o(7,d=e.ondrag),"ondrop"in e&&o(8,u=e.ondrop)},[n,r,l,i,e=>{p=G(e.pageX,e.pageY),c(e),document.documentElement.addEventListener("pointermove",g),document.documentElement.addEventListener("pointerup",m)},s,c,d,u,function(e){Un[e?"unshift":"push"]((()=>{i=e,o(3,i)}))}]}class Pg extends Sr{constructor(e){super(),wr(this,e,Rg,Tg,Gi,{html:0,title:1,onclick:5,disabled:2,ongrab:6,ondrag:7,ondrop:8})}}function Ag(e,t,o){const i=e.slice();return i[14]=t[o],i}function Ig(e,t){let o,i,n,r,a,s,l;function c(){return t[10](t[14])}function d(...e){return t[11](t[14],...e)}function u(...e){return t[12](t[14],...e)}function h(...e){return t[13](t[14],...e)}return i=new Pg({props:{onclick:c,ongrab:d,ondrag:u,ondrop:h,disabled:t[1]||t[14].disabled,title:t[14].title,html:t[14].thumb}}),{key:e,first:null,c(){o=gn("li"),yr(i.$$.fragment),n=yn(),Sn(o,"class","PinturaShapePreset"),Sn(o,"style",t[6]),this.first=o},m(e,c){pn(e,o,c),br(i,o,null),hn(o,n),a=!0,s||(l=rn(r=t[8].call(null,o,t[14])),s=!0)},p(e,n){t=e;const s={};5&n&&(s.onclick=c),9&n&&(s.ongrab=d),17&n&&(s.ondrag=u),33&n&&(s.ondrop=h),3&n&&(s.disabled=t[1]||t[14].disabled),1&n&&(s.title=t[14].title),1&n&&(s.html=t[14].thumb),i.$set(s),(!a||64&n)&&Sn(o,"style",t[6]),r&&Yi(r.update)&&1&n&&r.update.call(null,t[14])},i(e){a||(sr(i.$$.fragment,e),a=!0)},o(e){lr(i.$$.fragment,e),a=!1},d(e){e&&mn(o),xr(i),s=!1,l()}}}function Eg(e){let t,o,i=[],n=new Map,r=e[0];const a=e=>e[14].id;for(let t=0;t<r.length;t+=1){let o=Ag(e,r,t),s=a(o);n.set(s,i[t]=Ig(s,o))}return{c(){t=gn("ul");for(let e=0;e<i.length;e+=1)i[e].c();Sn(t,"class","PinturaShapePresetsList")},m(e,n){pn(e,t,n);for(let e=0;e<i.length;e+=1)i[e].m(t,null);o=!0},p(e,[o]){127&o&&(r=e[0],rr(),i=mr(i,o,a,1,e,r,n,t,pr,Ig,null,Ag),ar())},i(e){if(!o){for(let e=0;e<r.length;e+=1)sr(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)lr(i[e]);o=!1},d(e){e&&mn(t);for(let e=0;e<i.length;e+=1)i[e].d()}}}function Lg(e,t,o){let i,n,{presets:r}=t,{disabled:a}=t,{onclickpreset:s}=t,{ongrabpreset:l}=t,{ondragpreset:c}=t,{ondroppreset:d}=t;const u=Ya(0,{duration:300});Zi(e,u,(e=>o(9,n=e)));zn((()=>u.set(1)));return e.$$set=e=>{"presets"in e&&o(0,r=e.presets),"disabled"in e&&o(1,a=e.disabled),"onclickpreset"in e&&o(2,s=e.onclickpreset),"ongrabpreset"in e&&o(3,l=e.ongrabpreset),"ondragpreset"in e&&o(4,c=e.ondragpreset),"ondroppreset"in e&&o(5,d=e.ondroppreset)},e.$$.update=()=>{512&e.$$.dirty&&o(6,i="opacity:"+n)},[r,a,s,l,c,d,i,u,(e,t)=>t.mount&&t.mount(e.firstChild,t),n,e=>s(e.id),(e,t)=>l&&l(e.id,t),(e,t)=>c&&c(e.id,t),(e,t)=>d&&d(e.id,t)]}class Fg extends Sr{constructor(e){super(),wr(this,e,Lg,Eg,Gi,{presets:0,disabled:1,onclickpreset:2,ongrabpreset:3,ondragpreset:4,ondroppreset:5})}}var Bg=e=>/<svg /.test(e);function zg(e){let t,o;return t=new Sd({props:{items:e[13]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};8192&o&&(i.items=e[13]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Dg(e){let t,o,i,n;const r=[_g,Og],a=[];function s(e,t){return e[7]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=bn()},m(e,o){a[t].m(e,o),pn(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?a[t].p(e,n):(rr(),lr(a[l],1,1,(()=>{a[l]=null})),ar(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sr(o,1),o.m(i.parentNode,i))},i(e){n||(sr(o),n=!0)},o(e){lr(o),n=!1},d(e){a[t].d(e),e&&mn(i)}}}function Og(e){let t,o,i,n,r=e[13]&&Wg(e);return i=new Ll({props:{scrollAutoCancel:e[6],elasticity:e[0],$$slots:{default:[Vg]},$$scope:{ctx:e}}}),{c(){t=gn("div"),r&&r.c(),o=yn(),yr(i.$$.fragment),Sn(t,"class","PinturaShapePresetsFlat")},m(e,a){pn(e,t,a),r&&r.m(t,null),hn(t,o),br(i,t,null),n=!0},p(e,n){e[13]?r?(r.p(e,n),8192&n&&sr(r,1)):(r=Wg(e),r.c(),sr(r,1),r.m(t,o)):r&&(rr(),lr(r,1,1,(()=>{r=null})),ar());const a={};64&n&&(a.scrollAutoCancel=e[6]),1&n&&(a.elasticity=e[0]),536870974&n&&(a.$$scope={dirty:n,ctx:e}),i.$set(a)},i(e){n||(sr(r),sr(i.$$.fragment,e),n=!0)},o(e){lr(r),lr(i.$$.fragment,e),n=!1},d(e){e&&mn(t),r&&r.d(),xr(i)}}}function _g(e){let t,o,i,n,r,a,s,l=e[13]&&Ng(e);const c=[{class:"PinturaControlList"},{tabs:e[8]},e[11],{layout:"compact"}];let d={$$slots:{default:[Xg,({tab:e})=>({28:e}),({tab:e})=>e?268435456:0]},$$scope:{ctx:e}};for(let e=0;e<c.length;e+=1)d=Hi(d,c[e]);n=new Js({props:d}),n.$on("select",e[18]);const u=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[12]},e[11]];let h={$$slots:{default:[Gg,({panel:e,panelIsActive:t})=>({26:e,27:t}),({panel:e,panelIsActive:t})=>(e?67108864:0)|(t?134217728:0)]},$$scope:{ctx:e}};for(let e=0;e<u.length;e+=1)h=Hi(h,u[e]);return a=new dl({props:h}),{c(){t=gn("div"),o=gn("div"),l&&l.c(),i=yn(),yr(n.$$.fragment),r=yn(),yr(a.$$.fragment),Sn(o,"class","PinturaShapePresetsGroups"),Sn(t,"class","PinturaShapePresetsGrouped")},m(e,c){pn(e,t,c),hn(t,o),l&&l.m(o,null),hn(o,i),br(n,o,null),hn(t,r),br(a,t,null),s=!0},p(e,t){e[13]?l?(l.p(e,t),8192&t&&sr(l,1)):(l=Ng(e),l.c(),sr(l,1),l.m(o,i)):l&&(rr(),lr(l,1,1,(()=>{l=null})),ar());const r=2304&t?gr(c,[c[0],256&t&&{tabs:e[8]},2048&t&&fr(e[11]),c[3]]):{};805306368&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const s=6144&t?gr(u,[u[0],u[1],4096&t&&{panels:e[12]},2048&t&&fr(e[11])]):{};738198623&t&&(s.$$scope={dirty:t,ctx:e}),a.$set(s)},i(e){s||(sr(l),sr(n.$$.fragment,e),sr(a.$$.fragment,e),s=!0)},o(e){lr(l),lr(n.$$.fragment,e),lr(a.$$.fragment,e),s=!1},d(e){e&&mn(t),l&&l.d(),xr(n),xr(a)}}}function Wg(e){let t,o;return t=new Sd({props:{items:e[13]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};8192&o&&(i.items=e[13]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Vg(e){let t,o;return t=new Fg({props:{presets:e[5],onclickpreset:e[1],ongrabpreset:e[2],ondragpreset:e[3],ondroppreset:e[4]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};32&o&&(i.presets=e[5]),2&o&&(i.onclickpreset=e[1]),4&o&&(i.ongrabpreset=e[2]),8&o&&(i.ondragpreset=e[3]),16&o&&(i.ondroppreset=e[4]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Ng(e){let t,o;return t=new Sd({props:{items:e[13]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};8192&o&&(i.items=e[13]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Hg(e){let t,o;return t=new fl({props:{$$slots:{default:[Ug]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};805306368&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Ug(e){let t,o=e[28].icon+"";return{c(){t=fn("g")},m(e,i){pn(e,t,i),t.innerHTML=o},p(e,i){268435456&i&&o!==(o=e[28].icon+"")&&(t.innerHTML=o)},d(e){e&&mn(t)}}}function jg(e){let t,o,i=e[28].label+"";return{c(){t=gn("span"),o=$n(i)},m(e,i){pn(e,t,i),hn(t,o)},p(e,t){268435456&t&&i!==(i=e[28].label+"")&&Cn(o,i)},d(e){e&&mn(t)}}}function Xg(e){let t,o,i,n=e[28].icon&&Hg(e),r=!e[28].hideLabel&&jg(e);return{c(){n&&n.c(),t=yn(),r&&r.c(),o=bn()},m(e,a){n&&n.m(e,a),pn(e,t,a),r&&r.m(e,a),pn(e,o,a),i=!0},p(e,i){e[28].icon?n?(n.p(e,i),268435456&i&&sr(n,1)):(n=Hg(e),n.c(),sr(n,1),n.m(t.parentNode,t)):n&&(rr(),lr(n,1,1,(()=>{n=null})),ar()),e[28].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=jg(e),r.c(),r.m(o.parentNode,o))},i(e){i||(sr(n),i=!0)},o(e){lr(n),i=!1},d(e){n&&n.d(e),e&&mn(t),r&&r.d(e),e&&mn(o)}}}function Yg(e){let t,o;return t=new Fg({props:{presets:e[10][e[26]].items,disabled:e[10][e[26]].disabled,onclickpreset:e[1],ongrabpreset:e[2],ondragpreset:e[3],ondroppreset:e[4]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};67109888&o&&(i.presets=e[10][e[26]].items),67109888&o&&(i.disabled=e[10][e[26]].disabled),2&o&&(i.onclickpreset=e[1]),4&o&&(i.ongrabpreset=e[2]),8&o&&(i.ondragpreset=e[3]),16&o&&(i.ondroppreset=e[4]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Gg(e){let t,o;return t=new Ll({props:{scroll:e[27]?{scrollOffset:0,animate:!1}:void 0,scrollAutoCancel:e[6],elasticity:e[0],$$slots:{default:[Yg]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};134217728&o&&(i.scroll=e[27]?{scrollOffset:0,animate:!1}:void 0),64&o&&(i.scrollAutoCancel=e[6]),1&o&&(i.elasticity=e[0]),603980830&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function qg(e){let t,o,i,n;const r=[Dg,zg],a=[];function s(e,t){return e[6]?0:e[13]?1:-1}return~(o=s(e))&&(i=a[o]=r[o](e)),{c(){t=gn("div"),i&&i.c(),Sn(t,"class","PinturaShapePresetsPalette")},m(e,i){pn(e,t,i),~o&&a[o].m(t,null),n=!0},p(e,[n]){let l=o;o=s(e),o===l?~o&&a[o].p(e,n):(i&&(rr(),lr(a[l],1,1,(()=>{a[l]=null})),ar()),~o?(i=a[o],i?i.p(e,n):(i=a[o]=r[o](e),i.c()),sr(i,1),i.m(t,null)):i=null)},i(e){n||(sr(i),n=!0)},o(e){lr(i),n=!1},d(e){e&&mn(t),~o&&a[o].d()}}}function Kg(e,t,o){let i,n,r,s,l,c,d,u,h,{locale:p}=t,{presets:m}=t,{scrollElasticity:f}=t,{enableSelectImage:$=!0}=t,{willRenderPresetToolbar:y=W}=t,{onaddpreset:b=a}=t,{ongrabpreset:x}=t,{ondragpreset:v}=t,{ondroppreset:w}=t;const S="presets-"+R(),C=(e,t="")=>Bg(e)?e:Yt(e)?to(e,t):`<img src="${e}" alt="${t}"/>`,M=e=>B(pt(e)),T=["src","alt","thumb","shape","id","mount","disabled"],P=e=>e.map((e=>(e=>Kt(e)&&k(e[0])&&Kt(e[1]))(e)?{...e[2],id:`${S}-${e[0].toLowerCase()}`,label:e[0],items:P(e[1])}:(e=>{let t,o,i,n,r,a,s,l=e;return k(e)?Yt(e)?(t=e,r=e,n=C(t,r)):(t=e,r=M(t),n=C(t,r)):(t=e.src,r=e.alt||(k(t)?M(t):k(e.thumb)?M(e.thumb):void 0),n=C(e.thumb||t,r),o=e.shape,a=e.mount,s=e.disabled,i=Object.keys(e).reduce(((t,o)=>(T.includes(o)||(t[o]=e[o]),t)),{})),{id:l,src:t,thumb:n,shape:o,shapeProps:i,alt:r,title:r,mount:a,disabled:s}})(e)));return e.$$set=e=>{"locale"in e&&o(14,p=e.locale),"presets"in e&&o(15,m=e.presets),"scrollElasticity"in e&&o(0,f=e.scrollElasticity),"enableSelectImage"in e&&o(16,$=e.enableSelectImage),"willRenderPresetToolbar"in e&&o(17,y=e.willRenderPresetToolbar),"onaddpreset"in e&&o(1,b=e.onaddpreset),"ongrabpreset"in e&&o(2,x=e.ongrabpreset),"ondragpreset"in e&&o(3,v=e.ondragpreset),"ondroppreset"in e&&o(4,w=e.ondroppreset)},e.$$.update=()=>{32768&e.$$.dirty&&o(5,i=P(m)),32&e.$$.dirty&&o(6,n=i.length),96&e.$$.dirty&&o(7,r=n&&i.some((e=>!!e.items))),160&e.$$.dirty&&o(8,s=r&&i),160&e.$$.dirty&&o(10,l=r&&i.reduce(((e,t)=>(e[t.id]=t,e)),{})),768&e.$$.dirty&&o(9,c=c||s&&(s.find((e=>!e.disabled))||{}).id),512&e.$$.dirty&&o(11,d={name:S,selected:c}),256&e.$$.dirty&&o(12,u=s&&s.map((e=>e.id))),212994&e.$$.dirty&&o(13,h=p&&y([$&&["Button","browse",{label:p.shapeLabelButtonSelectSticker,icon:p.shapeIconButtonSelectSticker,onclick:()=>{const e=g("input",{type:"file",accept:"image/*",onchange:()=>{const[t]=e.files;t&&b(t)}});e.click()}}]]))},[f,b,x,v,w,i,n,r,s,c,l,d,u,h,p,m,$,y,({detail:e})=>o(9,c=e)]}class Zg extends Sr{constructor(e){super(),wr(this,e,Kg,qg,Gi,{locale:14,presets:15,scrollElasticity:0,enableSelectImage:16,willRenderPresetToolbar:17,onaddpreset:1,ongrabpreset:2,ondragpreset:3,ondroppreset:4})}}function Jg(e){let t,o,i,n;const r=[{locale:e[4]},{uid:e[13]},{parentRect:e[23]},{rootRect:e[31]},{utilRect:e[25]},{offset:e[33]},{contextScale:e[42]},{contextRotation:e[16]},{contextFlipX:e[17]},{contextFlipY:e[18]},{active:e[24]},{opacity:e[28]},{eraseRadius:e[34]},{selectRadius:e[6]},{enableButtonFlipVertical:e[8]},{mapEditorPointToImagePoint:e[14]},{mapImagePointToEditorPoint:e[15]},{enableTapToAddText:e[11]},{oninteractionstart:e[54]},{oninteractionupdate:e[55]},{oninteractionrelease:e[56]},{oninteractionend:e[57]},{onaddshape:e[89]},{onselectshape:e[90]},{onupdateshape:e[91]},{onremoveshape:e[92]},e[39]];function a(t){e[94](t)}function s(t){e[95](t)}let l={};for(let e=0;e<r.length;e+=1)l=Hi(l,r[e]);return void 0!==e[26]&&(l.markup=e[26]),void 0!==e[41]&&(l.ui=e[41]),t=new gg({props:l}),e[93](t),Un.push((()=>$r(t,"markup",a))),Un.push((()=>$r(t,"ui",s))),{c(){yr(t.$$.fragment)},m(e,o){br(t,e,o),n=!0},p(e,n){const a=327674192&n[0]|125831469&n[1]|4&n[2]?gr(r,[16&n[0]&&{locale:e[4]},8192&n[0]&&{uid:e[13]},8388608&n[0]&&{parentRect:e[23]},1&n[1]&&{rootRect:e[31]},33554432&n[0]&&{utilRect:e[25]},4&n[1]&&{offset:e[33]},2048&n[1]&&{contextScale:e[42]},65536&n[0]&&{contextRotation:e[16]},131072&n[0]&&{contextFlipX:e[17]},262144&n[0]&&{contextFlipY:e[18]},16777216&n[0]&&{active:e[24]},268435456&n[0]&&{opacity:e[28]},8&n[1]&&{eraseRadius:e[34]},64&n[0]&&{selectRadius:e[6]},256&n[0]&&{enableButtonFlipVertical:e[8]},16384&n[0]&&{mapEditorPointToImagePoint:e[14]},32768&n[0]&&{mapImagePointToEditorPoint:e[15]},2048&n[0]&&{enableTapToAddText:e[11]},8388608&n[1]&&{oninteractionstart:e[54]},16777216&n[1]&&{oninteractionupdate:e[55]},33554432&n[1]&&{oninteractionrelease:e[56]},67108864&n[1]&&{oninteractionend:e[57]},32&n[1]|4&n[2]&&{onaddshape:e[89]},32&n[1]&&{onselectshape:e[90]},32&n[1]|4&n[2]&&{onupdateshape:e[91]},32&n[1]|4&n[2]&&{onremoveshape:e[92]},256&n[1]&&fr(e[39])]):{};!o&&67108864&n[0]&&(o=!0,a.markup=e[26],Kn((()=>o=!1))),!i&&1024&n[1]&&(i=!0,a.ui=e[41],Kn((()=>i=!1))),t.$set(a)},i(e){n||(sr(t.$$.fragment,e),n=!0)},o(e){lr(t.$$.fragment,e),n=!1},d(o){e[93](null),xr(t,o)}}}function Qg(e){let t,o,i,n,r=e[32]&&Jg(e);return{c(){var e,o,i;t=gn("div"),r&&r.c(),Sn(t,"slot","main"),e="cursor",o="crosshair",t.style.setProperty(e,o,i?"important":"")},m(s,l){pn(s,t,l),r&&r.m(t,null),e[96](t),o=!0,i||(n=[rn(cs.call(null,t)),xn(t,"dropfiles",(function(){Yi(e[10]?e[63]:a)&&(e[10]?e[63]:a).apply(this,arguments)})),rn(as.call(null,t)),xn(t,"measure",e[87])],i=!0)},p(o,i){(e=o)[32]?r?(r.p(e,i),2&i[1]&&sr(r,1)):(r=Jg(e),r.c(),sr(r,1),r.m(t,null)):r&&(rr(),lr(r,1,1,(()=>{r=null})),ar())},i(e){o||(sr(r),o=!0)},o(e){lr(r),o=!1},d(o){o&&mn(t),r&&r.d(),e[96](null),i=!1,Xi(n)}}}function ef(e){let t,o;return t=new Zg({props:{locale:e[4],presets:e[12],enableSelectImage:e[9],willRenderPresetToolbar:e[38],onaddpreset:e[62],ongrabpreset:e[59],ondragpreset:e[60],ondroppreset:e[61],scrollElasticity:e[37]}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),4096&o[0]&&(i.presets=e[12]),512&o[0]&&(i.enableSelectImage=e[9]),128&o[1]&&(i.willRenderPresetToolbar=e[38]),64&o[1]&&(i.scrollElasticity=e[37]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function tf(e){let t,o,i,n,r,a;const s=[nf,of],l=[];function c(e,t){return e[35]?0:1}o=c(e),i=l[o]=s[o](e);let d=e[22]&&rf(e);return{c(){t=gn("div"),i.c(),n=yn(),d&&d.c(),r=bn(),Sn(t,"class","PinturaControlPanels")},m(e,i){pn(e,t,i),l[o].m(t,null),pn(e,n,i),d&&d.m(e,i),pn(e,r,i),a=!0},p(e,n){let a=o;o=c(e),o===a?l[o].p(e,n):(rr(),lr(l[a],1,1,(()=>{l[a]=null})),ar(),i=l[o],i?i.p(e,n):(i=l[o]=s[o](e),i.c()),sr(i,1),i.m(t,null)),e[22]?d?(d.p(e,n),4194304&n[0]&&sr(d,1)):(d=rf(e),d.c(),sr(d,1),d.m(r.parentNode,r)):d&&(rr(),lr(d,1,1,(()=>{d=null})),ar())},i(e){a||(sr(i),sr(d),a=!0)},o(e){lr(i),lr(d),a=!1},d(e){e&&mn(t),l[o].d(),e&&mn(n),d&&d.d(e),e&&mn(r)}}}function of(e){let t,o,i;return o=new Mg({props:{locale:e[4],shape:e[27],onchange:e[58],controls:e[7],scrollElasticity:e[37]}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"class","PinturaControlPanel")},m(e,n){pn(e,t,n),br(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),134217728&t[0]&&(i.shape=e[27]),128&t[0]&&(i.controls=e[7]),64&t[1]&&(i.scrollElasticity=e[37]),o.$set(i)},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o)}}}function nf(e){let t,o,i;return o=new Zg({props:{locale:e[4],presets:e[12],enableSelectImage:e[9],willRenderPresetToolbar:e[38],onaddpreset:e[62],ongrabpreset:e[59],ondragpreset:e[60],ondroppreset:e[61],scrollElasticity:e[37]}}),{c(){t=gn("div"),yr(o.$$.fragment),Sn(t,"class","PinturaControlPanel")},m(e,n){pn(e,t,n),br(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),4096&t[0]&&(i.presets=e[12]),512&t[0]&&(i.enableSelectImage=e[9]),128&t[1]&&(i.willRenderPresetToolbar=e[38]),64&t[1]&&(i.scrollElasticity=e[37]),o.$set(i)},i(e){i||(sr(o.$$.fragment,e),i=!0)},o(e){lr(o.$$.fragment,e),i=!1},d(e){e&&mn(t),xr(o)}}}function rf(e){let t,o;return t=new Ll({props:{class:"PinturaControlListScroller",elasticity:e[37],$$slots:{default:[cf]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};64&o[1]&&(i.elasticity=e[37]),2097169&o[0]|4194304&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function af(e){let t,o;return t=new fl({props:{$$slots:{default:[sf]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};16&o[0]|6291456&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function sf(e){let t,o=(qt(e[114].icon)?e[114].icon(e[4]):e[114].icon)+"";return{c(){t=fn("g")},m(e,i){pn(e,t,i),t.innerHTML=o},p(e,i){16&i[0]|2097152&i[3]&&o!==(o=(qt(e[114].icon)?e[114].icon(e[4]):e[114].icon)+"")&&(t.innerHTML=o)},d(e){e&&mn(t)}}}function lf(e){let t,o,i,n,r,a=(qt(e[114].label)?e[114].label(e[4]):e[114].label)+"",s=e[114].icon&&af(e);return{c(){t=gn("div"),s&&s.c(),o=yn(),i=gn("span"),n=$n(a),Sn(t,"slot","option")},m(e,a){pn(e,t,a),s&&s.m(t,null),hn(t,o),hn(t,i),hn(i,n),r=!0},p(e,i){e[114].icon?s?(s.p(e,i),2097152&i[3]&&sr(s,1)):(s=af(e),s.c(),sr(s,1),s.m(t,o)):s&&(rr(),lr(s,1,1,(()=>{s=null})),ar()),(!r||16&i[0]|2097152&i[3])&&a!==(a=(qt(e[114].label)?e[114].label(e[4]):e[114].label)+"")&&Cn(n,a)},i(e){r||(sr(s),r=!0)},o(e){lr(s),r=!1},d(e){e&&mn(t),s&&s.d()}}}function cf(e){let t,o;return t=new Nc({props:{locale:e[4],class:"PinturaControlList",optionClass:"PinturaControlListOption",layout:"row",options:e[21],selectedIndex:e[21].findIndex(e[88]),onchange:e[53],$$slots:{option:[lf,({option:e})=>({114:e}),({option:e})=>[0,0,0,e?2097152:0]]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),2097152&o[0]&&(i.options=e[21]),2097153&o[0]&&(i.selectedIndex=e[21].findIndex(e[88])),16&o[0]|6291456&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function df(e){let t,o,i,n;const r=[tf,ef],a=[];function s(e,t){return e[30]?0:e[35]?1:-1}return~(o=s(e))&&(i=a[o]=r[o](e)),{c(){t=gn("div"),i&&i.c(),Sn(t,"slot","footer"),Sn(t,"style",e[40])},m(e,i){pn(e,t,i),~o&&a[o].m(t,null),n=!0},p(e,l){let c=o;o=s(e),o===c?~o&&a[o].p(e,l):(i&&(rr(),lr(a[c],1,1,(()=>{a[c]=null})),ar()),~o?(i=a[o],i?i.p(e,l):(i=a[o]=r[o](e),i.c()),sr(i,1),i.m(t,null)):i=null),(!n||512&l[1])&&Sn(t,"style",e[40])},i(e){n||(sr(i),n=!0)},o(e){lr(i),n=!1},d(e){e&&mn(t),~o&&a[o].d()}}}function uf(e){let t,o;return t=new Lp({props:{$$slots:{footer:[df],main:[Qg]},$$scope:{ctx:e}}}),t.$on("measure",e[97]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};2146959313&o[0]|4095&o[1]|4194304&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function hf(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,f,$,y,b,x,v,w,S,C,M,T,R,P,A,I,E,L,F,B,z,D,O,_,V,N=Vi,H=()=>(N(),N=qi(ke,(e=>o(23,C=e))),ke),U=Vi,j=()=>(U(),U=qi(Q,(e=>o(24,T=e))),Q),X=Vi,Y=()=>(X(),X=qi(te,(e=>o(78,P=e))),te),q=Vi,K=()=>(q(),q=qi(ne,(e=>o(26,E=e))),ne),Z=Vi,J=()=>(Z(),Z=qi(ee,(e=>o(28,F=e))),ee);e.$$.on_destroy.push((()=>N())),e.$$.on_destroy.push((()=>U())),e.$$.on_destroy.push((()=>X())),e.$$.on_destroy.push((()=>q())),e.$$.on_destroy.push((()=>Z()));let{isActive:Q}=t;j();let{isActiveFraction:ee}=t;J();let{isVisible:te}=t;Y();let{stores:oe}=t,{locale:ie={}}=t,{shapes:ne}=t;K();let{tools:re=[]}=t,{toolShapes:ae=[]}=t,{toolActive:se}=t,{toolSelectRadius:le}=t,{shapeControls:de={}}=t,{enableButtonFlipVertical:ue=!1}=t,{enablePresetSelectImage:he=!0}=t,{enablePresetDropImage:pe=!0}=t,{enableSelectToolToAddShape:me=!1}=t,{enableTapToAddText:ge=!1}=t,{willRenderPresetToolbar:fe}=t,{shapePresets:$e=[]}=t,{utilKey:ye}=t,{mapScreenPointToImagePoint:be}=t,{mapImagePointToScreenPoint:xe}=t,{imageRotation:ve=0}=t,{imageFlipX:we=!1}=t,{imageFlipY:Se=!1}=t,{parentRect:ke}=t;H();let{hooks:Ce={}}=t;const{env:Me,animation:Te,history:Re,rootRect:Pe,stageRect:Ae,utilRect:Ie,elasticityMultiplier:Ee,scrollElasticity:Le,imageOverlayMarkup:Fe,imagePreviewModifiers:Be,imageCropRect:ze,presentationScalar:De,shapePreprocessor:Oe,imagePresentationScale:We,imagePresentationPan:Ve}=oe;Zi(e,Me,(e=>o(84,z=e))),Zi(e,Te,(e=>o(85,D=e))),Zi(e,Pe,(e=>o(31,M=e))),Zi(e,Ae,(e=>o(79,I=e))),Zi(e,Ie,(e=>o(25,A=e))),Zi(e,Fe,(e=>o(41,_=e))),Zi(e,Be,(e=>o(76,R=e))),Zi(e,ze,(e=>o(101,B=e))),Zi(e,De,(e=>o(42,V=e))),Zi(e,Oe,(e=>o(83,L=e)));const Ne=e=>{const[t,o]=ae[e];let i,n="relative"===o.position;const r=n?"20%":.2*C.width,a=n?"0%":0,s=n?"0%":0;To(t)||ko(t)?(i=$o(t),i.x=a,i.y=s,mi(i,{width:r,height:r},C)):Ro(t)?(i=$o(t),i.x=a,i.y=s,mi(i,{rx:r,ry:r},C)):Po(t)&&(i=$o(t),i.x1=a,i.y1=s,i.x2=a,i.y2=s),i&&Promise.resolve().then((()=>{qe(Ye(i,void 0,r))}))},He=e=>be(eg(e,M));let Ue,je,Xe={};const Ye=(e,t,o)=>{let i=!1;t||(i=!0,t=y?be(_e(I)):_e(B)),t.x-=C.x||0,t.y-=C.y||0,(we||Se)&&(e.flipX=we,e.flipY=Se);const n=Ue.getShapesNearPosition(t);if(i&&n.length){const e=.1*Math.min(B.width,B.height);t.x+=Math.round(-e+Math.random()*e*2),t.y+=Math.round(-e+Math.random()*e*2)}if(0!==ve&&(e.rotation=we&&Se?-ve:we||Se?ve:-ve),Gt(e,"width")&&Gt(e,"height")){const{width:o,height:i}=pi(e,["width","height"],C);mi(e,{x:t.x-.5*o,y:t.y-.5*i},C)}else if(Ro(e))mi(e,{x:t.x,y:t.y},C);else if(Po(e)){const{x1:i,y1:n,x2:r,y2:a}=pi(e,["x1","y1","x2","y2"],C),s=ce(G(i,n),G(r,a))||k(o)?ni(o,C.width):o;mi(e,{x1:t.x-s,y1:t.y+s,x2:t.x+s,y2:t.y-s},C)}return e},Ge=(e,t)=>{const o=Ye(vo(e,B),t);return qe(o)},qe=e=>{const{beforeAddShape:t=(()=>!0)}=Ce;if(t(e))return Ue.addShape(e),Ue.selectShape(e),Re.write(),e};let Ze=!1;const Je=()=>Re.write();let Qe;const et=qa(D?20:0);Zi(e,et,(e=>o(86,O=e)));return e.$$set=e=>{"isActive"in e&&j(o(1,Q=e.isActive)),"isActiveFraction"in e&&J(o(2,ee=e.isActiveFraction)),"isVisible"in e&&Y(o(3,te=e.isVisible)),"stores"in e&&o(66,oe=e.stores),"locale"in e&&o(4,ie=e.locale),"shapes"in e&&K(o(5,ne=e.shapes)),"tools"in e&&o(67,re=e.tools),"toolShapes"in e&&o(68,ae=e.toolShapes),"toolActive"in e&&o(0,se=e.toolActive),"toolSelectRadius"in e&&o(6,le=e.toolSelectRadius),"shapeControls"in e&&o(7,de=e.shapeControls),"enableButtonFlipVertical"in e&&o(8,ue=e.enableButtonFlipVertical),"enablePresetSelectImage"in e&&o(9,he=e.enablePresetSelectImage),"enablePresetDropImage"in e&&o(10,pe=e.enablePresetDropImage),"enableSelectToolToAddShape"in e&&o(69,me=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(11,ge=e.enableTapToAddText),"willRenderPresetToolbar"in e&&o(70,fe=e.willRenderPresetToolbar),"shapePresets"in e&&o(12,$e=e.shapePresets),"utilKey"in e&&o(13,ye=e.utilKey),"mapScreenPointToImagePoint"in e&&o(14,be=e.mapScreenPointToImagePoint),"mapImagePointToScreenPoint"in e&&o(15,xe=e.mapImagePointToScreenPoint),"imageRotation"in e&&o(16,ve=e.imageRotation),"imageFlipX"in e&&o(17,we=e.imageFlipX),"imageFlipY"in e&&o(18,Se=e.imageFlipY),"parentRect"in e&&H(o(19,ke=e.parentRect)),"hooks"in e&&o(71,Ce=e.hooks)},e.$$.update=()=>{var t;4096&e.$$.dirty[0]|32&e.$$.dirty[2]&&o(21,i=0===$e.length?re.filter((e=>"preset"!==e[0])):re),128&e.$$.dirty[0]&&o(73,n=Object.keys(de).length),2097152&e.$$.dirty[0]&&o(22,r=i.length>1),2097152&e.$$.dirty[0]&&o(74,a=!!i.length),6291457&e.$$.dirty[0]&&r&&void 0===se&&o(0,se=i[0][0]),1&e.$$.dirty[0]&&o(75,s=void 0!==se),14336&e.$$.dirty[2]&&o(30,l=(!s||a)&&n),16785408&e.$$.dirty[0]|16384&e.$$.dirty[2]&&(T?nn(Be,R[ye]={maskMarkupOpacity:.85},R):delete R[ye]),1&e.$$.dirty[0]&&se&&Ue&&Ue.blurShapes(),65536&e.$$.dirty[2]&&o(32,c=P),33554432&e.$$.dirty[0]|131072&e.$$.dirty[2]&&o(33,d=A&&G(I.x-A.x,I.y-A.y)),128&e.$$.dirty[0]&&o(80,u=Object.keys(de)),67108864&e.$$.dirty[0]&&o(81,h=E.filter(Fo)[0]),16777217&e.$$.dirty[0]|64&e.$$.dirty[2]&&o(82,p=T&&(ae[se]?oi($o(ae[se][0])):{})),1311744&e.$$.dirty[2]&&o(77,m=p&&Object.keys(p).reduce(((e,t)=>{const o="disableStyle"===t,i=u.find((e=>e.split("_").includes(t)));return o||i?(void 0===p[t]||(e[t]=Xe[t]||p[t]),e):e}),{})),557056&e.$$.dirty[2]&&o(27,g=h||m),134217728&e.$$.dirty[0]|2097152&e.$$.dirty[2]&&g&&g.lineEnd&&!L&&console.warn("Set shapePreprocessor property to draw lineStart and lineEnd styles.\nhttps://pqina.nl/pintura/docs/v8/api/exports/#createshapepreprocessor"),1048576&e.$$.dirty[2]&&o(34,f=p&&Xt(p.eraseRadius)?p.eraseRadius:void 0),268440065&e.$$.dirty[0]&&o(35,$=F>0&&"preset"===se&&($e.length>0||he)),8388608&e.$$.dirty[0]&&(y=!Gt(C,"x")&&!Gt(C,"y")),1048576&e.$$.dirty[0]&&o(36,b=Qe&&(t=Qe,(e,o)=>{t.dispatchEvent(Md(e,o))})),4194560&e.$$.dirty[2]&&o(38,v=fe?e=>fe(e,Ge,{...z}):W),512&e.$$.dirty[2]&&o(39,w=Object.keys(Ce).reduce(((e,t)=>("beforeAddShape"===t||(e[t]=Ce[t]),e)),{})),16777216&e.$$.dirty[0]|8388608&e.$$.dirty[2]&&D&&et.set(T?0:20),16777216&e.$$.dirty[2]&&o(40,S=O?`transform: translateY(${O}px)`:void 0)},o(37,x=Ee*Le),[se,Q,ee,te,ie,ne,le,de,ue,he,pe,ge,$e,ye,be,xe,ve,we,Se,ke,Qe,i,r,C,T,A,E,g,F,Ue,l,M,c,d,f,$,b,x,v,w,S,_,V,Me,Te,Pe,Ae,Ie,Fe,Be,ze,De,Oe,({value:e},t)=>{o(0,se=e),(me||$c(t.key))&&Ne(e)},e=>{if("eraser"===se)je=Ue.eraseShape();else if(se&&ae[se]){const[e,t]=ae[se];je=Ue.createShape({...e,...m},t)}else je=void 0;return!!je&&(je.start(e),!0)},e=>!!je&&(je.update(e),!0),e=>!!je&&(je.release(e),!0),e=>!!je&&(je.end(e),je=void 0,!0),function(e){Object.keys(e).forEach((t=>o(72,Xe[t]=e[t],Xe))),h&&(Ue.updateMarkupShape(h,e),Je())},()=>{Ze=!1},(e,t)=>{if(Ze)return;const{beforeAddShape:o=(()=>!0)}=Ce,i=He(t),n=Ue.getMarkupItemDraft(),r=Ke(B,{x:i.x+(C.x||0),y:i.y+(C.y||0)});if(n&&!r&&Ue.discardMarkupItemDraft(),r){if(!n){const n=Ye(vo(e,B),i);return o(n)?(Wo(n),void Ue.addShape(n)):(Ze=!0,void t.preventDefault())}To(n)&&(i.x-=.5*n.width,i.y-=.5*n.height),Ue.updateMarkupShape(n,i)}},(e,t)=>{if(Ze)return;const o=He(t);if(!Ke(B,{x:o.x+(C.x||0),y:o.y+(C.y||0)}))return void Ue.discardMarkupItemDraft();const i=Ue.confirmMarkupItemDraft();Ue.selectShape(i),Re.write()},e=>Ge(e),e=>{return t=e.detail.resources,o=He(e.detail.event),t.forEach((e=>Ge(e,o)));var t,o},Je,et,oe,re,ae,me,fe,Ce,Xe,n,a,s,R,m,P,I,u,h,p,L,z,D,O,function(t){Nn(e,t)},e=>e[0]===se,e=>{b("addshape",e),Je()},e=>{b("selectshape",e)},e=>{b("updateshape",e),Je()},e=>{b("removeshape",e),Je()},function(e){Un[e?"unshift":"push"]((()=>{Ue=e,o(29,Ue)}))},function(e){E=e,ne.set(E)},function(e){_=e,Fe.set(_)},function(e){Un[e?"unshift":"push"]((()=>{Qe=e,o(20,Qe)}))},function(t){Nn(e,t)}]}class pf extends Sr{constructor(e){super(),wr(this,e,hf,uf,Gi,{isActive:1,isActiveFraction:2,isVisible:3,stores:66,locale:4,shapes:5,tools:67,toolShapes:68,toolActive:0,toolSelectRadius:6,shapeControls:7,enableButtonFlipVertical:8,enablePresetSelectImage:9,enablePresetDropImage:10,enableSelectToolToAddShape:69,enableTapToAddText:11,willRenderPresetToolbar:70,shapePresets:12,utilKey:13,mapScreenPointToImagePoint:14,mapImagePointToScreenPoint:15,imageRotation:16,imageFlipX:17,imageFlipY:18,parentRect:19,hooks:71},[-1,-1,-1,-1])}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$set({isActive:e}),Qn()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$set({isActiveFraction:e}),Qn()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$set({isVisible:e}),Qn()}get stores(){return this.$$.ctx[66]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[4]}set locale(e){this.$set({locale:e}),Qn()}get shapes(){return this.$$.ctx[5]}set shapes(e){this.$set({shapes:e}),Qn()}get tools(){return this.$$.ctx[67]}set tools(e){this.$set({tools:e}),Qn()}get toolShapes(){return this.$$.ctx[68]}set toolShapes(e){this.$set({toolShapes:e}),Qn()}get toolActive(){return this.$$.ctx[0]}set toolActive(e){this.$set({toolActive:e}),Qn()}get toolSelectRadius(){return this.$$.ctx[6]}set toolSelectRadius(e){this.$set({toolSelectRadius:e}),Qn()}get shapeControls(){return this.$$.ctx[7]}set shapeControls(e){this.$set({shapeControls:e}),Qn()}get enableButtonFlipVertical(){return this.$$.ctx[8]}set enableButtonFlipVertical(e){this.$set({enableButtonFlipVertical:e}),Qn()}get enablePresetSelectImage(){return this.$$.ctx[9]}set enablePresetSelectImage(e){this.$set({enablePresetSelectImage:e}),Qn()}get enablePresetDropImage(){return this.$$.ctx[10]}set enablePresetDropImage(e){this.$set({enablePresetDropImage:e}),Qn()}get enableSelectToolToAddShape(){return this.$$.ctx[69]}set enableSelectToolToAddShape(e){this.$set({enableSelectToolToAddShape:e}),Qn()}get enableTapToAddText(){return this.$$.ctx[11]}set enableTapToAddText(e){this.$set({enableTapToAddText:e}),Qn()}get willRenderPresetToolbar(){return this.$$.ctx[70]}set willRenderPresetToolbar(e){this.$set({willRenderPresetToolbar:e}),Qn()}get shapePresets(){return this.$$.ctx[12]}set shapePresets(e){this.$set({shapePresets:e}),Qn()}get utilKey(){return this.$$.ctx[13]}set utilKey(e){this.$set({utilKey:e}),Qn()}get mapScreenPointToImagePoint(){return this.$$.ctx[14]}set mapScreenPointToImagePoint(e){this.$set({mapScreenPointToImagePoint:e}),Qn()}get mapImagePointToScreenPoint(){return this.$$.ctx[15]}set mapImagePointToScreenPoint(e){this.$set({mapImagePointToScreenPoint:e}),Qn()}get imageRotation(){return this.$$.ctx[16]}set imageRotation(e){this.$set({imageRotation:e}),Qn()}get imageFlipX(){return this.$$.ctx[17]}set imageFlipX(e){this.$set({imageFlipX:e}),Qn()}get imageFlipY(){return this.$$.ctx[18]}set imageFlipY(e){this.$set({imageFlipY:e}),Qn()}get parentRect(){return this.$$.ctx[19]}set parentRect(e){this.$set({parentRect:e}),Qn()}get hooks(){return this.$$.ctx[71]}set hooks(e){this.$set({hooks:e}),Qn()}}var mf=(e,t,o,i,n,r,a,s,l)=>{const c=K(e),d=.5*o.width,u=.5*o.height,h=.5*t.width,p=.5*t.height,m=n.x+i.x,g=n.y+i.y;s&&(c.x=o.width-c.x),l&&(c.y=o.height-c.y);const f=Math.cos(r),$=Math.sin(r);c.x-=d,c.y-=u;const y=c.x*f-c.y*$,b=c.x*$+c.y*f;c.x=d+y,c.y=u+b,c.x*=a,c.y*=a,c.x+=h,c.y+=p,c.x+=m,c.y+=g,c.x-=d*a,c.y-=u*a;const x=(n.x-m)*a,v=(n.y-g)*a,w=x*f-v*$,S=x*$+v*f;return c.x+=w,c.y+=S,c},gf=(e,t,o,i,n,r,a,s,l)=>{const c=K(e),d=we(o),u=we(t),h=G(n.x+i.x,n.y+i.y),p=Math.cos(r),m=Math.sin(r);c.x-=u.x,c.y-=u.y;const g=(n.x-h.x)*a,f=(n.y-h.y)*a,$=g*p-f*m,y=g*m+f*p;c.x-=$,c.y-=y,c.x-=h.x,c.y-=h.y,c.x/=a,c.y/=a;const b=c.x*p+c.y*m,x=c.x*m-c.y*p;return c.x=b,c.y=-x,c.x+=d.x,c.y+=d.y,s&&(c.x=o.width-c.x),l&&(c.y=o.height-c.y),c};function ff(e){let t,o,i;function n(t){e[39](t)}let r={stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[36],mapImagePointToScreenPoint:e[37],utilKey:"annotate",imageRotation:e[28],imageFlipX:e[26],imageFlipY:e[27],shapes:e[30],tools:e[11]||e[6],toolShapes:e[12]||e[7],enableSelectToolToAddShape:e[18],enableTapToAddText:e[19],shapeControls:e[13]||e[8],shapePresets:e[16],enableButtonFlipVertical:e[14],parentRect:e[31],enablePresetSelectImage:e[15],toolSelectRadius:e[9],willRenderPresetToolbar:e[17]||e[10],hooks:{willRenderShapeControls:e[20],beforeAddShape:e[21],beforeRemoveShape:e[22],beforeDeselectShape:e[23],beforeSelectShape:e[24],beforeUpdateShape:e[25]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new pf({props:r}),Un.push((()=>$r(t,"toolActive",n))),t.$on("measure",e[40]),{c(){yr(t.$$.fragment)},m(e,o){br(t,e,o),i=!0},p(e,i){const n={};16&i[0]&&(n.stores=e[4]),32&i[0]&&(n.locale=e[5]),2&i[0]&&(n.isActive=e[1]),4&i[0]&&(n.isActiveFraction=e[2]),8&i[0]&&(n.isVisible=e[3]),268435456&i[0]&&(n.imageRotation=e[28]),67108864&i[0]&&(n.imageFlipX=e[26]),134217728&i[0]&&(n.imageFlipY=e[27]),2112&i[0]&&(n.tools=e[11]||e[6]),4224&i[0]&&(n.toolShapes=e[12]||e[7]),262144&i[0]&&(n.enableSelectToolToAddShape=e[18]),524288&i[0]&&(n.enableTapToAddText=e[19]),8448&i[0]&&(n.shapeControls=e[13]||e[8]),65536&i[0]&&(n.shapePresets=e[16]),16384&i[0]&&(n.enableButtonFlipVertical=e[14]),32768&i[0]&&(n.enablePresetSelectImage=e[15]),512&i[0]&&(n.toolSelectRadius=e[9]),132096&i[0]&&(n.willRenderPresetToolbar=e[17]||e[10]),66060288&i[0]&&(n.hooks={willRenderShapeControls:e[20],beforeAddShape:e[21],beforeRemoveShape:e[22],beforeDeselectShape:e[23],beforeSelectShape:e[24],beforeUpdateShape:e[25]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],Kn((()=>o=!1))),t.$set(n)},i(e){i||(sr(t.$$.fragment,e),i=!0)},o(e){lr(t.$$.fragment,e),i=!1},d(e){xr(t,e)}}}function $f(e,t,o){let i,n,r,a,s,l;let{isActive:c}=t,{isActiveFraction:d}=t,{isVisible:u}=t,{stores:h}=t,{locale:p={}}=t,{markupEditorToolbar:m}=t,{markupEditorToolStyles:g}=t,{markupEditorShapeStyleControls:f}=t,{markupEditorToolSelectRadius:$}=t,{willRenderShapePresetToolbar:y}=t,{annotateTools:b}=t,{annotateToolShapes:x}=t,{annotateShapeControls:v}=t,{annotateActiveTool:w}=t,{annotateEnableButtonFlipVertical:S=!1}=t,{annotateEnableSelectImagePreset:k=!1}=t,{annotatePresets:C=[]}=t,{annotateWillRenderShapePresetToolbar:M}=t,{enableSelectToolToAddShape:T}=t,{enableTapToAddText:R}=t,{willRenderShapeControls:P}=t,{beforeAddShape:A}=t,{beforeRemoveShape:I}=t,{beforeDeselectShape:E}=t,{beforeSelectShape:L}=t,{beforeUpdateShape:F}=t;const{rootRect:B,imageAnnotation:z,imageSize:D,imageTransforms:O,imageRotation:_,imageFlipX:W,imageFlipY:V}=h;Zi(e,B,(e=>o(41,i=e))),Zi(e,D,(e=>o(42,n=e))),Zi(e,O,(e=>o(43,r=e))),Zi(e,_,(e=>o(28,l=e))),Zi(e,W,(e=>o(26,a=e))),Zi(e,V,(e=>o(27,s=e)));return e.$$set=e=>{"isActive"in e&&o(1,c=e.isActive),"isActiveFraction"in e&&o(2,d=e.isActiveFraction),"isVisible"in e&&o(3,u=e.isVisible),"stores"in e&&o(4,h=e.stores),"locale"in e&&o(5,p=e.locale),"markupEditorToolbar"in e&&o(6,m=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(7,g=e.markupEditorToolStyles),"markupEditorShapeStyleControls"in e&&o(8,f=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(9,$=e.markupEditorToolSelectRadius),"willRenderShapePresetToolbar"in e&&o(10,y=e.willRenderShapePresetToolbar),"annotateTools"in e&&o(11,b=e.annotateTools),"annotateToolShapes"in e&&o(12,x=e.annotateToolShapes),"annotateShapeControls"in e&&o(13,v=e.annotateShapeControls),"annotateActiveTool"in e&&o(0,w=e.annotateActiveTool),"annotateEnableButtonFlipVertical"in e&&o(14,S=e.annotateEnableButtonFlipVertical),"annotateEnableSelectImagePreset"in e&&o(15,k=e.annotateEnableSelectImagePreset),"annotatePresets"in e&&o(16,C=e.annotatePresets),"annotateWillRenderShapePresetToolbar"in e&&o(17,M=e.annotateWillRenderShapePresetToolbar),"enableSelectToolToAddShape"in e&&o(18,T=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(19,R=e.enableTapToAddText),"willRenderShapeControls"in e&&o(20,P=e.willRenderShapeControls),"beforeAddShape"in e&&o(21,A=e.beforeAddShape),"beforeRemoveShape"in e&&o(22,I=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(23,E=e.beforeDeselectShape),"beforeSelectShape"in e&&o(24,L=e.beforeSelectShape),"beforeUpdateShape"in e&&o(25,F=e.beforeUpdateShape)},[w,c,d,u,h,p,m,g,f,$,y,b,x,v,S,k,C,M,T,R,P,A,I,E,L,F,a,s,l,B,z,D,O,_,W,V,e=>gf(e,i,n,r.origin,r.translation,r.rotation.z,r.scale,a,s),e=>mf(e,i,n,r.origin,r.translation,r.rotation.z,r.scale,a,s),"annotate",function(e){w=e,o(0,w)},function(t){Nn(e,t)}]}var yf={util:["annotate",class extends Sr{constructor(e){super(),wr(this,e,$f,ff,Gi,{name:38,isActive:1,isActiveFraction:2,isVisible:3,stores:4,locale:5,markupEditorToolbar:6,markupEditorToolStyles:7,markupEditorShapeStyleControls:8,markupEditorToolSelectRadius:9,willRenderShapePresetToolbar:10,annotateTools:11,annotateToolShapes:12,annotateShapeControls:13,annotateActiveTool:0,annotateEnableButtonFlipVertical:14,annotateEnableSelectImagePreset:15,annotatePresets:16,annotateWillRenderShapePresetToolbar:17,enableSelectToolToAddShape:18,enableTapToAddText:19,willRenderShapeControls:20,beforeAddShape:21,beforeRemoveShape:22,beforeDeselectShape:23,beforeSelectShape:24,beforeUpdateShape:25},[-1,-1])}get name(){return this.$$.ctx[38]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$set({isActive:e}),Qn()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$set({isActiveFraction:e}),Qn()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$set({isVisible:e}),Qn()}get stores(){return this.$$.ctx[4]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[5]}set locale(e){this.$set({locale:e}),Qn()}get markupEditorToolbar(){return this.$$.ctx[6]}set markupEditorToolbar(e){this.$set({markupEditorToolbar:e}),Qn()}get markupEditorToolStyles(){return this.$$.ctx[7]}set markupEditorToolStyles(e){this.$set({markupEditorToolStyles:e}),Qn()}get markupEditorShapeStyleControls(){return this.$$.ctx[8]}set markupEditorShapeStyleControls(e){this.$set({markupEditorShapeStyleControls:e}),Qn()}get markupEditorToolSelectRadius(){return this.$$.ctx[9]}set markupEditorToolSelectRadius(e){this.$set({markupEditorToolSelectRadius:e}),Qn()}get willRenderShapePresetToolbar(){return this.$$.ctx[10]}set willRenderShapePresetToolbar(e){this.$set({willRenderShapePresetToolbar:e}),Qn()}get annotateTools(){return this.$$.ctx[11]}set annotateTools(e){this.$set({annotateTools:e}),Qn()}get annotateToolShapes(){return this.$$.ctx[12]}set annotateToolShapes(e){this.$set({annotateToolShapes:e}),Qn()}get annotateShapeControls(){return this.$$.ctx[13]}set annotateShapeControls(e){this.$set({annotateShapeControls:e}),Qn()}get annotateActiveTool(){return this.$$.ctx[0]}set annotateActiveTool(e){this.$set({annotateActiveTool:e}),Qn()}get annotateEnableButtonFlipVertical(){return this.$$.ctx[14]}set annotateEnableButtonFlipVertical(e){this.$set({annotateEnableButtonFlipVertical:e}),Qn()}get annotateEnableSelectImagePreset(){return this.$$.ctx[15]}set annotateEnableSelectImagePreset(e){this.$set({annotateEnableSelectImagePreset:e}),Qn()}get annotatePresets(){return this.$$.ctx[16]}set annotatePresets(e){this.$set({annotatePresets:e}),Qn()}get annotateWillRenderShapePresetToolbar(){return this.$$.ctx[17]}set annotateWillRenderShapePresetToolbar(e){this.$set({annotateWillRenderShapePresetToolbar:e}),Qn()}get enableSelectToolToAddShape(){return this.$$.ctx[18]}set enableSelectToolToAddShape(e){this.$set({enableSelectToolToAddShape:e}),Qn()}get enableTapToAddText(){return this.$$.ctx[19]}set enableTapToAddText(e){this.$set({enableTapToAddText:e}),Qn()}get willRenderShapeControls(){return this.$$.ctx[20]}set willRenderShapeControls(e){this.$set({willRenderShapeControls:e}),Qn()}get beforeAddShape(){return this.$$.ctx[21]}set beforeAddShape(e){this.$set({beforeAddShape:e}),Qn()}get beforeRemoveShape(){return this.$$.ctx[22]}set beforeRemoveShape(e){this.$set({beforeRemoveShape:e}),Qn()}get beforeDeselectShape(){return this.$$.ctx[23]}set beforeDeselectShape(e){this.$set({beforeDeselectShape:e}),Qn()}get beforeSelectShape(){return this.$$.ctx[24]}set beforeSelectShape(e){this.$set({beforeSelectShape:e}),Qn()}get beforeUpdateShape(){return this.$$.ctx[25]}set beforeUpdateShape(e){this.$set({beforeUpdateShape:e}),Qn()}}]};function bf(e){let t,o,i;function n(t){e[33](t)}let r={stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[30],mapImagePointToScreenPoint:e[31],utilKey:"decorate",shapes:e[27],tools:e[11]||e[6],toolShapes:e[12]||e[7],shapeControls:e[13]||e[8],shapePresets:e[16],enableSelectToolToAddShape:e[18],enableTapToAddText:e[19],enablePresetSelectImage:e[15],enableButtonFlipVertical:e[14],parentRect:e[26],toolSelectRadius:e[9],willRenderPresetToolbar:e[17]||e[10],hooks:{willRenderShapeControls:e[20],beforeAddShape:e[21],beforeRemoveShape:e[22],beforeDeselectShape:e[23],beforeSelectShape:e[24],beforeUpdateShape:e[25]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new pf({props:r}),Un.push((()=>$r(t,"toolActive",n))),t.$on("measure",e[34]),{c(){yr(t.$$.fragment)},m(e,o){br(t,e,o),i=!0},p(e,i){const n={};16&i[0]&&(n.stores=e[4]),32&i[0]&&(n.locale=e[5]),2&i[0]&&(n.isActive=e[1]),4&i[0]&&(n.isActiveFraction=e[2]),8&i[0]&&(n.isVisible=e[3]),2112&i[0]&&(n.tools=e[11]||e[6]),4224&i[0]&&(n.toolShapes=e[12]||e[7]),8448&i[0]&&(n.shapeControls=e[13]||e[8]),65536&i[0]&&(n.shapePresets=e[16]),262144&i[0]&&(n.enableSelectToolToAddShape=e[18]),524288&i[0]&&(n.enableTapToAddText=e[19]),32768&i[0]&&(n.enablePresetSelectImage=e[15]),16384&i[0]&&(n.enableButtonFlipVertical=e[14]),512&i[0]&&(n.toolSelectRadius=e[9]),132096&i[0]&&(n.willRenderPresetToolbar=e[17]||e[10]),66060288&i[0]&&(n.hooks={willRenderShapeControls:e[20],beforeAddShape:e[21],beforeRemoveShape:e[22],beforeDeselectShape:e[23],beforeSelectShape:e[24],beforeUpdateShape:e[25]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],Kn((()=>o=!1))),t.$set(n)},i(e){i||(sr(t.$$.fragment,e),i=!0)},o(e){lr(t.$$.fragment,e),i=!1},d(e){xr(t,e)}}}function xf(e,t,o){let i,n;let{isActive:r}=t,{isActiveFraction:a}=t,{isVisible:s}=t,{stores:l}=t,{locale:c={}}=t,{markupEditorToolbar:d}=t,{markupEditorToolStyles:u}=t,{markupEditorShapeStyleControls:h}=t,{markupEditorToolSelectRadius:p}=t,{willRenderShapePresetToolbar:m}=t,{decorateTools:g}=t,{decorateToolShapes:f}=t,{decorateShapeControls:$}=t,{decorateActiveTool:y}=t,{decorateEnableButtonFlipVertical:b=!1}=t,{decorateEnableSelectImagePreset:x=!1}=t,{decoratePresets:v=[]}=t,{decorateWillRenderShapePresetToolbar:w}=t,{enableSelectToolToAddShape:S}=t,{enableTapToAddText:k}=t,{willRenderShapeControls:C}=t,{beforeAddShape:M}=t,{beforeRemoveShape:T}=t,{beforeDeselectShape:R}=t,{beforeSelectShape:P}=t,{beforeUpdateShape:A}=t;const{imageCropRect:I,imageDecoration:E,imageSelectionRectPresentation:L,presentationScalar:F}=l;Zi(e,L,(e=>o(35,i=e))),Zi(e,F,(e=>o(36,n=e)));return e.$$set=e=>{"isActive"in e&&o(1,r=e.isActive),"isActiveFraction"in e&&o(2,a=e.isActiveFraction),"isVisible"in e&&o(3,s=e.isVisible),"stores"in e&&o(4,l=e.stores),"locale"in e&&o(5,c=e.locale),"markupEditorToolbar"in e&&o(6,d=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(7,u=e.markupEditorToolStyles),"markupEditorShapeStyleControls"in e&&o(8,h=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(9,p=e.markupEditorToolSelectRadius),"willRenderShapePresetToolbar"in e&&o(10,m=e.willRenderShapePresetToolbar),"decorateTools"in e&&o(11,g=e.decorateTools),"decorateToolShapes"in e&&o(12,f=e.decorateToolShapes),"decorateShapeControls"in e&&o(13,$=e.decorateShapeControls),"decorateActiveTool"in e&&o(0,y=e.decorateActiveTool),"decorateEnableButtonFlipVertical"in e&&o(14,b=e.decorateEnableButtonFlipVertical),"decorateEnableSelectImagePreset"in e&&o(15,x=e.decorateEnableSelectImagePreset),"decoratePresets"in e&&o(16,v=e.decoratePresets),"decorateWillRenderShapePresetToolbar"in e&&o(17,w=e.decorateWillRenderShapePresetToolbar),"enableSelectToolToAddShape"in e&&o(18,S=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(19,k=e.enableTapToAddText),"willRenderShapeControls"in e&&o(20,C=e.willRenderShapeControls),"beforeAddShape"in e&&o(21,M=e.beforeAddShape),"beforeRemoveShape"in e&&o(22,T=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(23,R=e.beforeDeselectShape),"beforeSelectShape"in e&&o(24,P=e.beforeSelectShape),"beforeUpdateShape"in e&&o(25,A=e.beforeUpdateShape)},[y,r,a,s,l,c,d,u,h,p,m,g,f,$,b,x,v,w,S,k,C,M,T,R,P,A,I,E,L,F,e=>{const t=K(e);return t.x-=i.x,t.y-=i.y,t.x/=n,t.y/=n,t},e=>{const t=K(e);return t.x*=n,t.y*=n,t.x+=i.x,t.y+=i.y,t},"decorate",function(e){y=e,o(0,y)},function(t){Nn(e,t)}]}var vf={util:["decorate",class extends Sr{constructor(e){super(),wr(this,e,xf,bf,Gi,{name:32,isActive:1,isActiveFraction:2,isVisible:3,stores:4,locale:5,markupEditorToolbar:6,markupEditorToolStyles:7,markupEditorShapeStyleControls:8,markupEditorToolSelectRadius:9,willRenderShapePresetToolbar:10,decorateTools:11,decorateToolShapes:12,decorateShapeControls:13,decorateActiveTool:0,decorateEnableButtonFlipVertical:14,decorateEnableSelectImagePreset:15,decoratePresets:16,decorateWillRenderShapePresetToolbar:17,enableSelectToolToAddShape:18,enableTapToAddText:19,willRenderShapeControls:20,beforeAddShape:21,beforeRemoveShape:22,beforeDeselectShape:23,beforeSelectShape:24,beforeUpdateShape:25},[-1,-1])}get name(){return this.$$.ctx[32]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$set({isActive:e}),Qn()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$set({isActiveFraction:e}),Qn()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$set({isVisible:e}),Qn()}get stores(){return this.$$.ctx[4]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[5]}set locale(e){this.$set({locale:e}),Qn()}get markupEditorToolbar(){return this.$$.ctx[6]}set markupEditorToolbar(e){this.$set({markupEditorToolbar:e}),Qn()}get markupEditorToolStyles(){return this.$$.ctx[7]}set markupEditorToolStyles(e){this.$set({markupEditorToolStyles:e}),Qn()}get markupEditorShapeStyleControls(){return this.$$.ctx[8]}set markupEditorShapeStyleControls(e){this.$set({markupEditorShapeStyleControls:e}),Qn()}get markupEditorToolSelectRadius(){return this.$$.ctx[9]}set markupEditorToolSelectRadius(e){this.$set({markupEditorToolSelectRadius:e}),Qn()}get willRenderShapePresetToolbar(){return this.$$.ctx[10]}set willRenderShapePresetToolbar(e){this.$set({willRenderShapePresetToolbar:e}),Qn()}get decorateTools(){return this.$$.ctx[11]}set decorateTools(e){this.$set({decorateTools:e}),Qn()}get decorateToolShapes(){return this.$$.ctx[12]}set decorateToolShapes(e){this.$set({decorateToolShapes:e}),Qn()}get decorateShapeControls(){return this.$$.ctx[13]}set decorateShapeControls(e){this.$set({decorateShapeControls:e}),Qn()}get decorateActiveTool(){return this.$$.ctx[0]}set decorateActiveTool(e){this.$set({decorateActiveTool:e}),Qn()}get decorateEnableButtonFlipVertical(){return this.$$.ctx[14]}set decorateEnableButtonFlipVertical(e){this.$set({decorateEnableButtonFlipVertical:e}),Qn()}get decorateEnableSelectImagePreset(){return this.$$.ctx[15]}set decorateEnableSelectImagePreset(e){this.$set({decorateEnableSelectImagePreset:e}),Qn()}get decoratePresets(){return this.$$.ctx[16]}set decoratePresets(e){this.$set({decoratePresets:e}),Qn()}get decorateWillRenderShapePresetToolbar(){return this.$$.ctx[17]}set decorateWillRenderShapePresetToolbar(e){this.$set({decorateWillRenderShapePresetToolbar:e}),Qn()}get enableSelectToolToAddShape(){return this.$$.ctx[18]}set enableSelectToolToAddShape(e){this.$set({enableSelectToolToAddShape:e}),Qn()}get enableTapToAddText(){return this.$$.ctx[19]}set enableTapToAddText(e){this.$set({enableTapToAddText:e}),Qn()}get willRenderShapeControls(){return this.$$.ctx[20]}set willRenderShapeControls(e){this.$set({willRenderShapeControls:e}),Qn()}get beforeAddShape(){return this.$$.ctx[21]}set beforeAddShape(e){this.$set({beforeAddShape:e}),Qn()}get beforeRemoveShape(){return this.$$.ctx[22]}set beforeRemoveShape(e){this.$set({beforeRemoveShape:e}),Qn()}get beforeDeselectShape(){return this.$$.ctx[23]}set beforeDeselectShape(e){this.$set({beforeDeselectShape:e}),Qn()}get beforeSelectShape(){return this.$$.ctx[24]}set beforeSelectShape(e){this.$set({beforeSelectShape:e}),Qn()}get beforeUpdateShape(){return this.$$.ctx[25]}set beforeUpdateShape(e){this.$set({beforeUpdateShape:e}),Qn()}}]};function wf(e){let t,o;return t=new pf({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[32],mapImagePointToScreenPoint:e[33],utilKey:"sticker",shapePresets:e[5],shapes:e[6]?e[25]:e[26],toolActive:"preset",imageFlipX:!!e[6]&&e[18],imageFlipY:!!e[6]&&e[19],imageRotation:e[6]?e[20]:0,parentRect:e[6]?e[27]:e[23],enablePresetSelectImage:e[7],enableButtonFlipVertical:e[8],toolSelectRadius:e[11],willRenderPresetToolbar:e[9]||e[12],hooks:{willRenderShapeControls:e[10],beforeAddShape:e[13],beforeRemoveShape:e[14],beforeDeselectShape:e[15],beforeSelectShape:e[16],beforeUpdateShape:e[17]}}}),t.$on("measure",e[35]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};8&o[0]&&(i.stores=e[3]),16&o[0]&&(i.locale=e[4]),1&o[0]&&(i.isActive=e[0]),2&o[0]&&(i.isActiveFraction=e[1]),4&o[0]&&(i.isVisible=e[2]),32&o[0]&&(i.shapePresets=e[5]),64&o[0]&&(i.shapes=e[6]?e[25]:e[26]),262208&o[0]&&(i.imageFlipX=!!e[6]&&e[18]),524352&o[0]&&(i.imageFlipY=!!e[6]&&e[19]),1048640&o[0]&&(i.imageRotation=e[6]?e[20]:0),64&o[0]&&(i.parentRect=e[6]?e[27]:e[23]),128&o[0]&&(i.enablePresetSelectImage=e[7]),256&o[0]&&(i.enableButtonFlipVertical=e[8]),2048&o[0]&&(i.toolSelectRadius=e[11]),4608&o[0]&&(i.willRenderPresetToolbar=e[9]||e[12]),254976&o[0]&&(i.hooks={willRenderShapeControls:e[10],beforeAddShape:e[13],beforeRemoveShape:e[14],beforeDeselectShape:e[15],beforeSelectShape:e[16],beforeUpdateShape:e[17]}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Sf(e,t,o){let i,n,r,a,s,l,c,d;let{isActive:u}=t,{isActiveFraction:h}=t,{isVisible:p}=t,{stores:m}=t,{locale:g={}}=t,{stickers:f=[]}=t,{stickerStickToImage:$=!1}=t,{stickerEnableSelectImage:y=!0}=t,{stickersEnableButtonFlipVertical:b=!1}=t,{stickersWillRenderShapePresetToolbar:x}=t,{willRenderShapeControls:v}=t,{markupEditorToolSelectRadius:w}=t,{willRenderShapePresetToolbar:S}=t,{beforeAddShape:k}=t,{beforeRemoveShape:C}=t,{beforeDeselectShape:M}=t,{beforeSelectShape:T}=t,{beforeUpdateShape:R}=t;const{presentationScalar:P,rootRect:A,imageCropRect:I,imageSelectionRectPresentation:E,imageAnnotation:L,imageDecoration:F,imageSize:B,imageTransforms:z,imageRotation:D,imageFlipX:O,imageFlipY:_}=m;Zi(e,P,(e=>o(40,c=e))),Zi(e,A,(e=>o(36,i=e))),Zi(e,E,(e=>o(39,l=e))),Zi(e,B,(e=>o(37,n=e))),Zi(e,z,(e=>o(38,r=e))),Zi(e,D,(e=>o(20,d=e))),Zi(e,O,(e=>o(18,a=e))),Zi(e,_,(e=>o(19,s=e)));const W=$?e=>gf(e,i,n,r.origin,r.translation,r.rotation.z,r.scale,a,s):e=>{const t=K(e);return t.x-=l.x,t.y-=l.y,t.x/=c,t.y/=c,t},V=$?e=>mf(e,i,n,r.origin,r.translation,r.rotation.z,r.scale,a,s):e=>{const t=K(e);return t.x*=c,t.y*=c,t.x+=l.x,t.y+=l.y,t};return e.$$set=e=>{"isActive"in e&&o(0,u=e.isActive),"isActiveFraction"in e&&o(1,h=e.isActiveFraction),"isVisible"in e&&o(2,p=e.isVisible),"stores"in e&&o(3,m=e.stores),"locale"in e&&o(4,g=e.locale),"stickers"in e&&o(5,f=e.stickers),"stickerStickToImage"in e&&o(6,$=e.stickerStickToImage),"stickerEnableSelectImage"in e&&o(7,y=e.stickerEnableSelectImage),"stickersEnableButtonFlipVertical"in e&&o(8,b=e.stickersEnableButtonFlipVertical),"stickersWillRenderShapePresetToolbar"in e&&o(9,x=e.stickersWillRenderShapePresetToolbar),"willRenderShapeControls"in e&&o(10,v=e.willRenderShapeControls),"markupEditorToolSelectRadius"in e&&o(11,w=e.markupEditorToolSelectRadius),"willRenderShapePresetToolbar"in e&&o(12,S=e.willRenderShapePresetToolbar),"beforeAddShape"in e&&o(13,k=e.beforeAddShape),"beforeRemoveShape"in e&&o(14,C=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(15,M=e.beforeDeselectShape),"beforeSelectShape"in e&&o(16,T=e.beforeSelectShape),"beforeUpdateShape"in e&&o(17,R=e.beforeUpdateShape)},[u,h,p,m,g,f,$,y,b,x,v,w,S,k,C,M,T,R,a,s,d,P,A,I,E,L,F,B,z,D,O,_,W,V,"sticker",function(t){Nn(e,t)}]}var kf={util:["sticker",class extends Sr{constructor(e){super(),wr(this,e,Sf,wf,Gi,{name:34,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,stickers:5,stickerStickToImage:6,stickerEnableSelectImage:7,stickersEnableButtonFlipVertical:8,stickersWillRenderShapePresetToolbar:9,willRenderShapeControls:10,markupEditorToolSelectRadius:11,willRenderShapePresetToolbar:12,beforeAddShape:13,beforeRemoveShape:14,beforeDeselectShape:15,beforeSelectShape:16,beforeUpdateShape:17},[-1,-1])}get name(){return this.$$.ctx[34]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$set({isActive:e}),Qn()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$set({isActiveFraction:e}),Qn()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$set({isVisible:e}),Qn()}get stores(){return this.$$.ctx[3]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[4]}set locale(e){this.$set({locale:e}),Qn()}get stickers(){return this.$$.ctx[5]}set stickers(e){this.$set({stickers:e}),Qn()}get stickerStickToImage(){return this.$$.ctx[6]}set stickerStickToImage(e){this.$set({stickerStickToImage:e}),Qn()}get stickerEnableSelectImage(){return this.$$.ctx[7]}set stickerEnableSelectImage(e){this.$set({stickerEnableSelectImage:e}),Qn()}get stickersEnableButtonFlipVertical(){return this.$$.ctx[8]}set stickersEnableButtonFlipVertical(e){this.$set({stickersEnableButtonFlipVertical:e}),Qn()}get stickersWillRenderShapePresetToolbar(){return this.$$.ctx[9]}set stickersWillRenderShapePresetToolbar(e){this.$set({stickersWillRenderShapePresetToolbar:e}),Qn()}get willRenderShapeControls(){return this.$$.ctx[10]}set willRenderShapeControls(e){this.$set({willRenderShapeControls:e}),Qn()}get markupEditorToolSelectRadius(){return this.$$.ctx[11]}set markupEditorToolSelectRadius(e){this.$set({markupEditorToolSelectRadius:e}),Qn()}get willRenderShapePresetToolbar(){return this.$$.ctx[12]}set willRenderShapePresetToolbar(e){this.$set({willRenderShapePresetToolbar:e}),Qn()}get beforeAddShape(){return this.$$.ctx[13]}set beforeAddShape(e){this.$set({beforeAddShape:e}),Qn()}get beforeRemoveShape(){return this.$$.ctx[14]}set beforeRemoveShape(e){this.$set({beforeRemoveShape:e}),Qn()}get beforeDeselectShape(){return this.$$.ctx[15]}set beforeDeselectShape(e){this.$set({beforeDeselectShape:e}),Qn()}get beforeSelectShape(){return this.$$.ctx[16]}set beforeSelectShape(e){this.$set({beforeSelectShape:e}),Qn()}get beforeUpdateShape(){return this.$$.ctx[17]}set beforeUpdateShape(e){this.$set({beforeUpdateShape:e}),Qn()}}]};function Cf(e){let t,o,i,n,r,a=(e[13](e[27].value)||"")+"",s=(qt(e[27].label)?e[27].label(e[1]):e[27].label)+"";return{c(){t=gn("div"),i=yn(),n=gn("span"),r=$n(s),o=new Rn(i),Sn(t,"slot","option")},m(e,s){pn(e,t,s),o.m(a,t),hn(t,i),hn(t,n),hn(n,r)},p(e,t){134217728&t&&a!==(a=(e[13](e[27].value)||"")+"")&&o.p(a),134217730&t&&s!==(s=(qt(e[27].label)?e[27].label(e[1]):e[27].label)+"")&&Cn(r,s)},d(e){e&&mn(t)}}}function Mf(e){let t,o;return t=new Nc({props:{locale:e[1],layout:"row",options:e[2],selectedIndex:e[10],onchange:e[11],$$slots:{option:[Cf,({option:e})=>({27:e}),({option:e})=>e?134217728:0]},$$scope:{ctx:e}}}),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};2&o&&(i.locale=e[1]),4&o&&(i.options=e[2]),402653186&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Tf(e){let t,o,i,n,r;return o=new Mg({props:{locale:e[1],shape:e[5],onchange:e[12],controls:e[3],scrollElasticity:e[4]}}),n=new Ll({props:{elasticity:e[8],$$slots:{default:[Mf]},$$scope:{ctx:e}}}),{c(){t=gn("div"),yr(o.$$.fragment),i=yn(),yr(n.$$.fragment),Sn(t,"slot","footer"),Sn(t,"style",e[6])},m(e,a){pn(e,t,a),br(o,t,null),hn(t,i),br(n,t,null),r=!0},p(e,i){const a={};2&i&&(a.locale=e[1]),32&i&&(a.shape=e[5]),8&i&&(a.controls=e[3]),16&i&&(a.scrollElasticity=e[4]),o.$set(a);const s={};268435462&i&&(s.$$scope={dirty:i,ctx:e}),n.$set(s),(!r||64&i)&&Sn(t,"style",e[6])},i(e){r||(sr(o.$$.fragment,e),sr(n.$$.fragment,e),r=!0)},o(e){lr(o.$$.fragment,e),lr(n.$$.fragment,e),r=!1},d(e){e&&mn(t),xr(o),xr(n)}}}function Rf(e){let t,o;return t=new Lp({props:{$$slots:{footer:[Tf]},$$scope:{ctx:e}}}),t.$on("measure",e[21]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,[o]){const i={};268435582&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Pf(e,t,o){let i,n,r,a,s,l,c=Vi,d=()=>(c(),c=qi(u,(e=>o(19,s=e))),u);e.$$.on_destroy.push((()=>c()));let{isActive:u}=t;d();let{stores:h}=t,{locale:p={}}=t,{frameStyles:m={}}=t,{frameOptions:g=[]}=t,{markupEditorShapeStyleControls:f}=t;const{animation:$,elasticityMultiplier:y,scrollElasticity:b,imageFrame:x}=h;Zi(e,$,(e=>o(18,a=e))),Zi(e,x,(e=>o(5,r=e)));let v=r?g.findIndex((([e])=>e===r.id)):0,w={frameColor:[1,1,1]};const S=qa(a?20:0);return Zi(e,S,(e=>o(20,l=e))),e.$$set=e=>{"isActive"in e&&d(o(0,u=e.isActive)),"stores"in e&&o(16,h=e.stores),"locale"in e&&o(1,p=e.locale),"frameStyles"in e&&o(17,m=e.frameStyles),"frameOptions"in e&&o(2,g=e.frameOptions),"markupEditorShapeStyleControls"in e&&o(3,f=e.markupEditorShapeStyleControls)},e.$$.update=()=>{786432&e.$$.dirty&&a&&S.set(s?0:20),1048576&e.$$.dirty&&o(6,n=l?`transform: translateY(${l}px)`:void 0)},o(4,i=y*b),[u,p,g,f,i,r,n,$,b,x,v,({value:e})=>{const t=m[e];if(!t||!t.shape)return void x.set(void 0);const o={id:e,...w,...$o(t.shape)};x.set(o)},function(e){Gt(e,"frameColor")&&(w.frameColor=e.frameColor),r&&(mi(r,e),x.set(r))},e=>{const t=m[e];var o;if(t&&t.thumb)return o=t.thumb,/div/i.test(o)||Bg(o)?o:/rect|path|circle|line|<g>/i.test(o)?`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" stroke-width="1" stroke="currentColor" fill="none" aria-hidden="true" focusable="false" stroke-linecap="round" stroke-linejoin="round">${o}</svg>`:`<img src="${o}" alt=""/>`},S,"frame",h,m,a,s,l,function(t){Nn(e,t)}]}var Af={util:["frame",class extends Sr{constructor(e){super(),wr(this,e,Pf,Rf,Gi,{name:15,isActive:0,stores:16,locale:1,frameStyles:17,frameOptions:2,markupEditorShapeStyleControls:3})}get name(){return this.$$.ctx[15]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$set({isActive:e}),Qn()}get stores(){return this.$$.ctx[16]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[1]}set locale(e){this.$set({locale:e}),Qn()}get frameStyles(){return this.$$.ctx[17]}set frameStyles(e){this.$set({frameStyles:e}),Qn()}get frameOptions(){return this.$$.ctx[2]}set frameOptions(e){this.$set({frameOptions:e}),Qn()}get markupEditorShapeStyleControls(){return this.$$.ctx[3]}set markupEditorShapeStyleControls(e){this.$set({markupEditorShapeStyleControls:e}),Qn()}}]};function If(e){let t,o,i,n,r,a,s,l;return{c(){t=gn("div"),o=gn("label"),i=$n(e[1]),n=yn(),r=gn("input"),Sn(o,"for",e[0]),Sn(o,"title",e[2]),Sn(o,"aria-label",e[2]),Sn(r,"id",e[0]),Sn(r,"type","text"),Sn(r,"inputmode","numeric"),Sn(r,"pattern","[0-9]*"),Sn(r,"data-state",e[3]),Sn(r,"autocomplete","off"),Sn(r,"placeholder",e[4]),r.value=a=void 0===e[5]?"":e[7](e[5]+""),Sn(t,"class","PinturaInputDimension")},m(a,c){pn(a,t,c),hn(t,o),hn(o,i),hn(t,n),hn(t,r),s||(l=xn(r,"input",e[8]),s=!0)},p(e,[t]){2&t&&Cn(i,e[1]),1&t&&Sn(o,"for",e[0]),4&t&&Sn(o,"title",e[2]),4&t&&Sn(o,"aria-label",e[2]),1&t&&Sn(r,"id",e[0]),8&t&&Sn(r,"data-state",e[3]),16&t&&Sn(r,"placeholder",e[4]),160&t&&a!==(a=void 0===e[5]?"":e[7](e[5]+""))&&r.value!==a&&(r.value=a)},i:Vi,o:Vi,d(e){e&&mn(t),s=!1,l()}}}function Ef(e,t,o){let{id:i}=t,{label:n}=t,{title:r}=t,{state:a}=t,{placeholder:s}=t,{value:l}=t,{onchange:c}=t,{format:d=(e=>e.replace(/\D/g,""))}=t;return e.$$set=e=>{"id"in e&&o(0,i=e.id),"label"in e&&o(1,n=e.label),"title"in e&&o(2,r=e.title),"state"in e&&o(3,a=e.state),"placeholder"in e&&o(4,s=e.placeholder),"value"in e&&o(5,l=e.value),"onchange"in e&&o(6,c=e.onchange),"format"in e&&o(7,d=e.format)},[i,n,r,a,s,l,c,d,e=>c(d(e.currentTarget.value))]}class Lf extends Sr{constructor(e){super(),wr(this,e,Ef,If,Gi,{id:0,label:1,title:2,state:3,placeholder:4,value:5,onchange:6,format:7})}}function Ff(e){let t;return{c(){t=fn("g")},m(o,i){pn(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&mn(t)}}}function Bf(e){let t,o,i,n,r,a,s,l;return r=new fl({props:{$$slots:{default:[Ff]},$$scope:{ctx:e}}}),{c(){t=gn("div"),o=gn("input"),i=yn(),n=gn("label"),yr(r.$$.fragment),Sn(o,"id",e[0]),Sn(o,"class","implicit"),Sn(o,"type","checkbox"),o.checked=e[1],Sn(n,"for",e[0]),Sn(n,"title",e[3])},m(c,d){pn(c,t,d),hn(t,o),hn(t,i),hn(t,n),br(r,n,null),a=!0,s||(l=xn(o,"change",e[5]),s=!0)},p(e,[t]){(!a||1&t)&&Sn(o,"id",e[0]),(!a||2&t)&&(o.checked=e[1]);const i={};68&t&&(i.$$scope={dirty:t,ctx:e}),r.$set(i),(!a||1&t)&&Sn(n,"for",e[0]),(!a||8&t)&&Sn(n,"title",e[3])},i(e){a||(sr(r.$$.fragment,e),a=!0)},o(e){lr(r.$$.fragment,e),a=!1},d(e){e&&mn(t),xr(r),s=!1,l()}}}function zf(e,t,o){let{id:i}=t,{locked:n}=t,{icon:r}=t,{title:a}=t,{onchange:s}=t;return e.$$set=e=>{"id"in e&&o(0,i=e.id),"locked"in e&&o(1,n=e.locked),"icon"in e&&o(2,r=e.icon),"title"in e&&o(3,a=e.title),"onchange"in e&&o(4,s=e.onchange)},[i,n,r,a,s,e=>s(e.currentTarget.checked)]}class Df extends Sr{constructor(e){super(),wr(this,e,zf,Bf,Gi,{id:0,locked:1,icon:2,title:3,onchange:4})}}function Of(e){let t;return{c(){t=$n("Save")},m(e,o){pn(e,t,o)},d(e){e&&mn(t)}}}function _f(e){let t,o,i,n,r,a,s,l,c,d,u,h,p,m=e[1].resizeLabelFormCaption+"";return l=new Sd({props:{items:e[3]}}),d=new Sl({props:{type:"submit",class:"implicit",$$slots:{default:[Of]},$$scope:{ctx:e}}}),{c(){t=gn("form"),o=gn("div"),i=gn("fieldset"),n=gn("legend"),r=$n(m),a=yn(),s=gn("div"),yr(l.$$.fragment),c=yn(),yr(d.$$.fragment),Sn(n,"class","implicit"),Sn(s,"class","PinturaFieldsetInner"),Sn(o,"class","PinturaFormInner"),Sn(t,"slot","footer"),Sn(t,"style",e[4])},m(m,g){pn(m,t,g),hn(t,o),hn(o,i),hn(i,n),hn(n,r),hn(i,a),hn(i,s),br(l,s,null),e[62](s),hn(o,c),br(d,o,null),u=!0,h||(p=[xn(s,"focusin",e[13]),xn(s,"focusout",e[14]),xn(t,"submit",vn(e[15]))],h=!0)},p(e,o){(!u||2&o[0])&&m!==(m=e[1].resizeLabelFormCaption+"")&&Cn(r,m);const i={};8&o[0]&&(i.items=e[3]),l.$set(i);const n={};524288&o[2]&&(n.$$scope={dirty:o,ctx:e}),d.$set(n),(!u||16&o[0])&&Sn(t,"style",e[4])},i(e){u||(sr(l.$$.fragment,e),sr(d.$$.fragment,e),u=!0)},o(e){lr(l.$$.fragment,e),lr(d.$$.fragment,e),u=!1},d(o){o&&mn(t),xr(l),e[62](null),xr(d),h=!1,Xi(p)}}}function Wf(e){let t,o;return t=new Lp({props:{$$slots:{footer:[_f]},$$scope:{ctx:e}}}),t.$on("measure",e[63]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,o){const i={};30&o[0]|524288&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Vf(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,f,$,y,b,x,v,w,S,C,M,T,P,A,I,E,L=Vi,F=()=>(L(),L=qi(z,(e=>o(60,I=e))),z);e.$$.on_destroy.push((()=>L()));const B=(e,t=0,o=9999)=>{if(k(e)&&!(e=e.replace(/\D/g,"")).length)return;const i=Math.round(e);return Number.isNaN(i)?void 0:jr(i,t,o)};let{isActive:z}=t;F();let{stores:D}=t,{locale:O={}}=t,{resizeMinSize:V=be(1,1)}=t,{resizeMaxSize:N=be(9999,9999)}=t,{resizeSizePresetOptions:H}=t,{resizeWidthPresetOptions:U}=t,{resizeHeightPresetOptions:j}=t,{resizeWillRenderFooter:X=W}=t;const Y=qa(0,{stiffness:.15,damping:.3});Zi(e,Y,(e=>o(57,T=e)));const{animation:G,imageSize:q,imageCropRect:K,imageCropRectAspectRatio:Z,imageCropAspectRatio:J,imageOutputSize:Q,history:ee,env:te}=D;Zi(e,G,(e=>o(59,A=e))),Zi(e,q,(e=>o(69,g=e))),Zi(e,K,(e=>o(52,M=e))),Zi(e,Z,(e=>o(39,h=e))),Zi(e,J,(e=>o(68,m=e))),Zi(e,Q,(e=>o(67,p=e))),Zi(e,te,(e=>o(58,P=e)));const oe=R();let ie,ne,re,ae,se,le=!1;const ce=(e,t,o,i,n)=>null!=e&&o!==t?e>=i[t]&&e<=n[t]?"valid":"invalid":"undetermined",de=(e,t,o)=>Math.round(null!=e?e/t:o.height),ue=()=>{le&&ne&&re&&("width"===ae?o(36,re=Math.round(ne/h)):"height"===ae?o(35,ne=Math.round(re*h)):("width"===se?o(36,re=Math.round(ne/h)):"height"===se&&o(35,ne=Math.round(re*h)),he()))},he=e=>{let t=B(ne),i=B(re),n=t,r=i,a=n&&r,s=e||h;if(!n&&!r)return;n&&!r?r=Math.round(n/s):r&&!n&&(n=Math.round(r*s)),s=e||a?_(n,r):h;let l=be(n,r);ke(N,l)||(l=Je(N,s)),ke(l,V)||(l=Ze(V,s)),o(35,ne=null!=t?Math.round(l.width):void 0),o(36,re=null!=i?Math.round(l.height):void 0)},pe=()=>{he();const{width:e,height:t}=p||{};e===ne&&t===re||(ne||re?(ne&&re&&nn(J,m=ne/re,m),nn(Q,p=be(ne,re),p)):(nn(J,m=g.width/g.height,m),nn(J,m=void 0,m),nn(Q,p=void 0,p)),ee.write())};Q.subscribe((e=>{if(!e)return o(35,ne=void 0),void o(36,re=void 0);o(35,ne=e.width),o(36,re=e.height),he()})),J.subscribe((e=>{(ne||re)&&e&&(ne&&re&&_(ne,re)!==e?(o(36,re=ne/e),he(e)):he())}));const me=e=>k(e[0])?(e[1]=e[1].map(me),e):Xt(e)?[e,""+e]:e,ge=e=>{if(k(e[0]))return e[1]=e[1].map(ge),e;let[t,o]=e;if(Xt(t)&&Xt(o)){const[e,i]=[t,o];o=`${e} × ${i}`,t=[e,i]}return[t,o]},fe=Mr();Zi(e,fe,(e=>o(40,f=e)));const ye=Mr();Zi(e,ye,(e=>o(41,$=e)));const xe=Mr();Zi(e,xe,(e=>o(42,y=e)));const ve=Mr();Zi(e,ve,(e=>o(43,b=e)));const we=Mr();Zi(e,we,(e=>o(44,x=e)));const Se=Mr();Zi(e,Se,(e=>o(45,v=e)));const Ce=Tr([Q,ye],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>{if(!t&&!e)return!0;if(!t)return!1;const[o,i]=t;return e.width===o&&e.height===i}));o(i<0?0:i)}));Zi(e,Ce,(e=>o(47,w=e)));const Me=Tr([Q,ve],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>!t&&!e||!!t&&e.width===t));o(i<0?0:i)}));Zi(e,Me,(e=>o(49,S=e)));const Te=Tr([Q,Se],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>!t&&!e||!!t&&e.height===t));o(i<0?0:i)}));Zi(e,Te,(e=>o(51,C=e)));let Re=void 0,Pe=void 0;let Ae={};const Ie=qa(A?20:0);return Zi(e,Ie,(e=>o(61,E=e))),e.$$set=e=>{"isActive"in e&&F(o(0,z=e.isActive)),"stores"in e&&o(27,D=e.stores),"locale"in e&&o(1,O=e.locale),"resizeMinSize"in e&&o(28,V=e.resizeMinSize),"resizeMaxSize"in e&&o(29,N=e.resizeMaxSize),"resizeSizePresetOptions"in e&&o(30,H=e.resizeSizePresetOptions),"resizeWidthPresetOptions"in e&&o(31,U=e.resizeWidthPresetOptions),"resizeHeightPresetOptions"in e&&o(32,j=e.resizeHeightPresetOptions),"resizeWillRenderFooter"in e&&o(33,X=e.resizeWillRenderFooter)},e.$$.update=()=>{var t,g,R;1073741824&e.$$.dirty[0]|512&e.$$.dirty[1]&&H&&(nn(fe,f=H.map(ge),f),nn(ye,$=hc(f),$)),512&e.$$.dirty[1]&&o(53,a=!!f),66560&e.$$.dirty[1]&&o(46,i=w>-1&&$[w][1]),2049&e.$$.dirty[1]&&U&&(nn(xe,y=U.map(me),y),nn(ve,b=hc(y),b)),4196352&e.$$.dirty[1]&&o(54,s=!a&&y),266240&e.$$.dirty[1]&&o(48,n=S>-1&&b[S][1]),8194&e.$$.dirty[1]&&j&&(nn(we,x=j.map(me),x),nn(Se,v=hc(x),v)),4202496&e.$$.dirty[1]&&o(55,l=!a&&x),1064960&e.$$.dirty[1]&&o(50,r=C>-1&&v[C][1]),29360128&e.$$.dirty[1]&&o(56,c=!a&&!s&&!l),805306370&e.$$.dirty[0]|268413948&e.$$.dirty[1]&&o(3,d=Ae&&X([a&&["Dropdown","size-presets",{label:i,options:f,onchange:e=>{return(t=e.value)&&!Re&&(Re={...M},Pe=m),t?(nn(J,m=_(t[0],t[1]),m),nn(Q,p=$e(t),p)):(nn(K,M=Re,M),nn(J,m=Pe,m),nn(Q,p=void 0,p),Re=void 0,Pe=void 0),void ee.write();var t},selectedIndex:w}],s&&["Dropdown","width-presets",{label:n,options:y,onchange:e=>{o(35,ne=e.value),pe()},selectedIndex:S}],s&&l&&["span","times",{class:"PinturaResizeLabel",innerHTML:"&times;"}],l&&["Dropdown","height-presets",{label:r,options:x,onchange:e=>{o(36,re=e.value),pe()},selectedIndex:C}],c&&[Lf,"width-input",{id:"width-"+oe,title:O.resizeTitleInputWidth,label:O.resizeLabelInputWidth,placeholder:(t=B(re),g=h,R=M,Math.round(null!=t?t*g:R.width)),value:ne,state:ce(B(ne),"width",ae,V,N),onchange:e=>{o(35,ne=e),ue()}}],c&&[Df,"aspect-ratio-lock",{id:"aspect-ratio-lock-"+oe,title:O.resizeTitleButtonMaintainAspectRatio,icon:k(O.resizeIconButtonMaintainAspectRatio)?O.resizeIconButtonMaintainAspectRatio:O.resizeIconButtonMaintainAspectRatio(le,T),locked:le,onchange:e=>{o(34,le=e),ue()}}],c&&[Lf,"height-input",{id:"height-"+oe,title:O.resizeTitleInputHeight,label:O.resizeLabelInputHeight,placeholder:de(B(ne),h,M),value:re,state:ce(B(re),"height",ae,V,N),onchange:e=>{o(36,re=e),ue()}}]].filter(Boolean),{...P},(()=>o(38,Ae={}))).filter(Boolean)),8&e.$$.dirty[1]&&Y.set(le?1:0),64&e.$$.dirty[1]&&ae&&(se=ae),805306368&e.$$.dirty[1]&&A&&Ie.set(I?0:20),1073741824&e.$$.dirty[1]&&o(4,u=E?`transform: translateY(${E}px)`:void 0)},[z,O,ie,d,u,Y,G,q,K,Z,J,Q,te,e=>{const t=e.target.id;/width/.test(t)?o(37,ae="width"):/height/.test(t)?o(37,ae="height"):/aspectRatio/i.test(t)?o(37,ae="lock"):o(37,ae=void 0)},e=>{ie.contains(e.relatedTarget)||pe(),o(37,ae=void 0)},pe,fe,ye,xe,ve,we,Se,Ce,Me,Te,Ie,"resize",D,V,N,H,U,j,X,le,ne,re,ae,Ae,h,f,$,y,b,x,v,i,w,n,S,r,C,M,a,s,l,c,T,P,A,I,E,function(e){Un[e?"unshift":"push"]((()=>{ie=e,o(2,ie)}))},function(t){Nn(e,t)}]}var Nf={util:["resize",class extends Sr{constructor(e){super(),wr(this,e,Vf,Wf,Gi,{name:26,isActive:0,stores:27,locale:1,resizeMinSize:28,resizeMaxSize:29,resizeSizePresetOptions:30,resizeWidthPresetOptions:31,resizeHeightPresetOptions:32,resizeWillRenderFooter:33},[-1,-1,-1])}get name(){return this.$$.ctx[26]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$set({isActive:e}),Qn()}get stores(){return this.$$.ctx[27]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[1]}set locale(e){this.$set({locale:e}),Qn()}get resizeMinSize(){return this.$$.ctx[28]}set resizeMinSize(e){this.$set({resizeMinSize:e}),Qn()}get resizeMaxSize(){return this.$$.ctx[29]}set resizeMaxSize(e){this.$set({resizeMaxSize:e}),Qn()}get resizeSizePresetOptions(){return this.$$.ctx[30]}set resizeSizePresetOptions(e){this.$set({resizeSizePresetOptions:e}),Qn()}get resizeWidthPresetOptions(){return this.$$.ctx[31]}set resizeWidthPresetOptions(e){this.$set({resizeWidthPresetOptions:e}),Qn()}get resizeHeightPresetOptions(){return this.$$.ctx[32]}set resizeHeightPresetOptions(e){this.$set({resizeHeightPresetOptions:e}),Qn()}get resizeWillRenderFooter(){return this.$$.ctx[33]}set resizeWillRenderFooter(e){this.$set({resizeWillRenderFooter:e}),Qn()}}]};function Hf(e){let t,o;return t=new pf({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[15],mapImagePointToScreenPoint:e[16],utilKey:"redact",imageRotation:e[7],imageFlipX:e[5],imageFlipY:e[6],shapes:e[8],tools:["rect"],toolShapes:{rectangle:[{x:0,y:0,width:0,height:0}]},toolActive:"rectangle",parentRect:e[10],enablePresetDropImage:!1,enablePresetSelectImage:!1,hooks:{willRenderShapeControls:e[18]}}}),t.$on("measure",e[19]),{c(){yr(t.$$.fragment)},m(e,i){br(t,e,i),o=!0},p(e,[o]){const i={};8&o&&(i.stores=e[3]),16&o&&(i.locale=e[4]),1&o&&(i.isActive=e[0]),2&o&&(i.isActiveFraction=e[1]),4&o&&(i.isVisible=e[2]),128&o&&(i.imageRotation=e[7]),32&o&&(i.imageFlipX=e[5]),64&o&&(i.imageFlipY=e[6]),t.$set(i)},i(e){o||(sr(t.$$.fragment,e),o=!0)},o(e){lr(t.$$.fragment,e),o=!1},d(e){xr(t,e)}}}function Uf(e,t,o){let i,n,r,a,s,l;let{isActive:c}=t,{isActiveFraction:d}=t,{isVisible:u}=t,{stores:h}=t,{locale:p={}}=t;const{imageRedaction:m,rootRect:g,imageSize:f,imageTransforms:$,imageRotation:y,imageFlipX:b,imageFlipY:x}=h;Zi(e,g,(e=>o(20,i=e))),Zi(e,f,(e=>o(21,n=e))),Zi(e,$,(e=>o(22,r=e))),Zi(e,y,(e=>o(7,l=e))),Zi(e,b,(e=>o(5,a=e))),Zi(e,x,(e=>o(6,s=e)));return e.$$set=e=>{"isActive"in e&&o(0,c=e.isActive),"isActiveFraction"in e&&o(1,d=e.isActiveFraction),"isVisible"in e&&o(2,u=e.isVisible),"stores"in e&&o(3,h=e.stores),"locale"in e&&o(4,p=e.locale)},[c,d,u,h,p,a,s,l,m,g,f,$,y,b,x,e=>gf(e,i,n,r.origin,r.translation,r.rotation.z,r.scale,a,s),e=>mf(e,i,n,r.origin,r.translation,r.rotation.z,r.scale,a,s),"redact",e=>{const t=ku(e[0]);return Mu("to-front",t),e},function(t){Nn(e,t)}]}var jf={util:["redact",class extends Sr{constructor(e){super(),wr(this,e,Uf,Hf,Gi,{name:17,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4})}get name(){return this.$$.ctx[17]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$set({isActive:e}),Qn()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$set({isActiveFraction:e}),Qn()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$set({isVisible:e}),Qn()}get stores(){return this.$$.ctx[3]}set stores(e){this.$set({stores:e}),Qn()}get locale(){return this.$$.ctx[4]}set locale(e){this.$set({locale:e}),Qn()}}]};const Xf='<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M18 6L6 18M6 6l12 12"></path></path></g>',Yf='<path fill="none" d="M9 15 L12 9 L15 15 M10 13.5 h3" stroke="currentColor" stroke-width=".125em"/>';var Gf={labelReset:"Reset",labelDefault:"Default",labelAuto:"Auto",labelNone:"None",labelEdit:"Edit",labelClose:"Close",labelSupportError:e=>e.join(", ")+" not supported on this browser",labelColor:"Color",labelWidth:"Width",labelSize:"Size",labelOffset:"Offset",labelAmount:"Amount",labelInset:"Inset",labelRadius:"Radius",labelSizeExtraSmall:"Extra small",labelSizeSmall:"Small",labelSizeMediumSmall:"Medium small",labelSizeMedium:"Medium",labelSizeMediumLarge:"Medium large",labelSizeLarge:"Large",labelSizeExtraLarge:"Extra large",labelButtonRevert:"Revert",labelButtonCancel:"Cancel",labelButtonUndo:"Undo",labelButtonRedo:"Redo",labelButtonExport:"Done",iconSupportError:'<g fill="none" stroke="currentColor" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><g><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></g>',iconButtonClose:Xf,iconButtonRevert:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M7.388 18.538a8 8 0 10-2.992-9.03"/><path fill="currentColor" d="M2.794 11.696L2.37 6.714l5.088 3.18z"/><path d="M12 8v4M12 12l4 2"/></g>',iconButtonUndo:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M10 8h4c2.485 0 5 2 5 5s-2.515 5-5 5h-4"/><path fill="currentColor" d="M5 8l4-3v6z"/></g>',iconButtonRedo:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M14 8h-4c-2.485 0-5 2-5 5s2.515 5 5 5h4"/><path fill="currentColor" d="M19 8l-4-3v6z"/></g>',iconButtonExport:'<polyline points="20 6 9 17 4 12" fill="none" stroke="currentColor" stroke-width=".125em"></polyline>',statusLabelButtonClose:"Close",statusIconButtonClose:Xf,statusLabelLoadImage:e=>e&&e.task?e.error?"IMAGE_TOO_SMALL"===e.error.code?"Minimum image size is {minWidth} × {minHeight}":"Error loading image":"blob-to-bitmap"===e.task?"Creating preview…":"Loading image…":"Waiting for image",statusLabelProcessImage:e=>{if(e&&e.task)return"store"===e.task?e.error?"Error uploading image":"Uploading image…":e.error?"Error processing image":"Processing image…"}};const qf={shapeLabelButtonSelectSticker:"Select image",shapeIconButtonSelectSticker:'<g fill="none" stroke="currentColor" stroke-width="0.0625em"><path d="M8 21 L15 11 L19 15"/><path d="M15 2 v5 h5"/><path d="M8 2 h8 l4 4 v12 q0 4 -4 4 h-8 q-4 0 -4 -4 v-12 q0 -4 4 -4z"/></g><circle fill="currentColor" cx="10" cy="8" r="1.5"/>',shapeIconButtonFlipHorizontal:'<g stroke="currentColor" stroke-width=".125em"><path fill="none" d="M6 6.5h5v11H6z"/><path fill="currentColor" d="M15 6.5h3v11h-3z"/><path d="M11 4v16" fill="currentColor"/></g>',shapeIconButtonFlipVertical:'<g stroke="currentColor" stroke-width=".125em"><rect x="7" y="8" width="11" height="5" fill="none"/><rect x="7" y="17" width="11" height="2" fill="currentColor"/><line x1="5" y1="13" x2="20" y2="13"/></g>',shapeIconButtonRemove:'<g fill="none" fill-rule="evenodd"><path stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M7.5 7h9z"/><path d="M7.916 9h8.168a1 1 0 01.99 1.14l-.972 6.862a2 2 0 01-1.473 1.653c-.877.23-1.753.345-2.629.345-.876 0-1.752-.115-2.628-.345a2 2 0 01-1.473-1.653l-.973-6.862A1 1 0 017.916 9z" fill="currentColor"/><rect fill="currentColor" x="10" y="5" width="4" height="3" rx="1"/></g>',shapeIconButtonDuplicate:'<g fill="none" fill-rule="evenodd"><path d="M15 13.994V16a2 2 0 01-2 2H8a2 2 0 01-2-2v-5a2 2 0 012-2h2.142" stroke="currentColor" stroke-width=".125em"/><path d="M15 9V8a1 1 0 00-2 0v1h-1a1 1 0 000 2h1v1a1 1 0 002 0v-1h1a1 1 0 000-2h-1zm-4-4h6a2 2 0 012 2v6a2 2 0 01-2 2h-6a2 2 0 01-2-2V7a2 2 0 012-2z" fill="currentColor"/></g>',shapeIconButtonMoveToFront:'<g fill="none" fill-rule="evenodd"><rect fill="currentColor" x="11" y="13" width="8" height="2" rx="1"/><rect fill="currentColor" x="9" y="17" width="10" height="2" rx="1"/><path d="M11.364 8H10a5 5 0 000 10M12 6.5L14.5 8 12 9.5z" stroke="currentColor" stroke-width=".125em" stroke-linecap="round"/></g>',shapeIconButtonTextLayoutAutoWidth:""+Yf,shapeIconButtonTextLayoutAutoHeight:'<g fill="currentColor"><circle cx="4" cy="12" r="1.5"/><circle cx="20" cy="12" r="1.5"/></g>'+Yf,shapeIconButtonTextLayoutFixedSize:'<g fill="currentColor"><circle cx="5" cy="6" r="1.5"/><circle cx="19" cy="6" r="1.5"/><circle cx="19" cy="19" r="1.5"/><circle cx="5" cy="19" r="1.5"/></g>'+Yf,shapeTitleButtonTextLayoutAutoWidth:"Auto width",shapeTitleButtonTextLayoutAutoHeight:"Auto height",shapeTitleButtonTextLayoutFixedSize:"Fixed size",shapeTitleButtonFlipHorizontal:"Flip Horizontal",shapeTitleButtonFlipVertical:"Flip Vertical",shapeTitleButtonRemove:"Remove",shapeTitleButtonDuplicate:"Duplicate",shapeTitleButtonMoveToFront:"Move to front",shapeLabelInputText:"Edit text",shapeIconInputCancel:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M18 6L6 18M6 6l12 12"/></g>',shapeIconInputConfirm:'<g fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><polyline points="20 6 9 17 4 12"/></g>',shapeLabelInputCancel:"Cancel",shapeLabelInputConfirm:"Confirm",shapeLabelStrokeNone:"No outline",shapeLabelFontStyleNormal:"Normal",shapeLabelFontStyleBold:"Bold",shapeLabelFontStyleItalic:"Italic",shapeLabelFontStyleItalicBold:"Bold Italic",shapeTitleBackgroundColor:"Fill color",shapeTitleFontFamily:"Font",shapeTitleFontSize:"Font size",shapeTitleFontStyle:"Font style",shapeTitleLineHeight:"Leading",shapeTitleLineStart:"Start",shapeTitleLineEnd:"End",shapeTitleStrokeWidth:"Line width",shapeTitleStrokeColor:"Line color",shapeTitleLineDecorationBar:"Bar",shapeTitleLineDecorationCircle:"Circle",shapeTitleLineDecorationSquare:"Square",shapeTitleLineDecorationArrow:"Arrow",shapeTitleLineDecorationCircleSolid:"Circle solid",shapeTitleLineDecorationSquareSolid:"Square solid",shapeTitleLineDecorationArrowSolid:"Arrow solid",shapeIconLineDecorationBar:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16"/><path d="M16,8 V16"/></g>',shapeIconLineDecorationCircle:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><circle fill="none" stroke-width=".125em" cx="16" cy="12" r="4"/></g>',shapeIconLineDecorationSquare:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><rect fill="none" stroke-width=".125em" x="12" y="8" width="8" height="8"/></g>',shapeIconLineDecorationArrow:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16 M13,7 l6,5 l-6,5" fill="none"/></g>',shapeIconLineDecorationCircleSolid:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><circle fill="currentColor" cx="16" cy="12" r="4"/></g>',shapeIconLineDecorationSquareSolid:'<g stroke="currentColor" stroke-linecap="round"><path stroke-width=".125em" d="M5,12 H12"/><rect fill="currentColor" x="12" y="8" width="8" height="8"/></g>',shapeIconLineDecorationArrowSolid:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H16"/><path d="M13,7 l6,5 l-6,5z" fill="currentColor"/></g>',shapeTitleColorTransparent:"Transparent",shapeTitleColorWhite:"White",shapeTitleColorSilver:"Silver",shapeTitleColorGray:"Gray",shapeTitleColorBlack:"Black",shapeTitleColorNavy:"Navy",shapeTitleColorBlue:"Blue",shapeTitleColorAqua:"Aqua",shapeTitleColorTeal:"Teal",shapeTitleColorOlive:"Olive",shapeTitleColorGreen:"Green",shapeTitleColorYellow:"Yellow",shapeTitleColorOrange:"Orange",shapeTitleColorRed:"Red",shapeTitleColorMaroon:"Maroon",shapeTitleColorFuchsia:"Fuchsia",shapeTitleColorPurple:"Purple",shapeTitleTextColor:"Font color",shapeTitleTextAlign:"Text align",shapeTitleTextAlignLeft:"Left align text",shapeTitleTextAlignCenter:"Center align text",shapeTitleTextAlignRight:"Right align text",shapeIconTextAlignLeft:'<g stroke-width=".125em" stroke="currentColor"><line x1="5" y1="8" x2="15" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="5" y1="16" x2="14" y2="16"/></g>',shapeIconTextAlignCenter:'<g stroke-width=".125em" stroke="currentColor"><line x1="7" y1="8" x2="17" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="8" y1="16" x2="16" y2="16"/></g>',shapeIconTextAlignRight:'<g stroke-width=".125em" stroke="currentColor"><line x1="9" y1="8" x2="19" y2="8"/><line x1="5" y1="12" x2="19" y2="12"/><line x1="11" y1="16" x2="19" y2="16"/></g>',shapeLabelToolSharpie:"Sharpie",shapeLabelToolEraser:"Eraser",shapeLabelToolRectangle:"Rectangle",shapeLabelToolEllipse:"Ellipse",shapeLabelToolArrow:"Arrow",shapeLabelToolLine:"Line",shapeLabelToolText:"Text",shapeLabelToolPreset:"Stickers",shapeIconToolSharpie:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M2.025 5c5.616-2.732 8.833-3.857 9.65-3.374C12.903 2.351.518 12.666 2.026 14 3.534 15.334 16.536.566 17.73 2.566 18.924 4.566 3.98 17.187 4.831 18c.851.813 9.848-6 11.643-6 1.087 0-2.53 5.11-2.92 7-.086.41 3.323-1.498 4.773-1 .494.17.64 2.317 1.319 3 .439.443 1.332.776 2.679 1" stroke="currentColor" stroke-width=".125em" fill="none" fill-rule="evenodd" stroke-linejoin="round"/></g>',shapeIconToolEraser:'<g stroke-width=".125em" stroke="currentColor" stroke-linecap="round" fill="none"><g transform="translate(3, 15) rotate(-45)"><rect x="0" y="0" width="18" height="10" rx="3"/></g><line x1="11" y1="21" x2="18" y2="21"/><line x1="20" y1="21" x2="22" y2="21"/></g>',shapeIconToolRectangle:'<g stroke-width=".125em" stroke="currentColor" fill="none"><rect x="2" y="2" width="20" height="20" rx="3"/></g>',shapeIconToolEllipse:'<g stroke-width=".125em" stroke="currentColor" fill="none"><circle cx="12" cy="12" r="11"/></g>',shapeIconToolArrow:'<g stroke-width=".125em" stroke="currentColor" fill="none"><line x1="20" y1="3" x2="6" y2="21"/><path d="m10 5 L22 1 L21 13" fill="currentColor" stroke="none"/></g>',shapeIconToolLine:'<g stroke-width=".125em" stroke="currentColor" fill="none"><line x1="20" y1="3" x2="6" y2="21"/></g>',shapeIconToolText:'<g stroke="none" fill="currentColor" transform="translate(6,0)"><path d="M8.14 20.085c.459 0 .901-.034 1.329-.102a8.597 8.597 0 001.015-.21v1.984c-.281.135-.695.247-1.242.336a9.328 9.328 0 01-1.477.133c-3.312 0-4.968-1.745-4.968-5.235V6.804H.344v-1.25l2.453-1.078L3.89.819h1.5v3.97h4.97v2.015H5.39v10.078c0 1.031.245 1.823.735 2.375s1.161.828 2.015.828z"/>',shapeIconToolPreset:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M12 22c2.773 0 1.189-5.177 3-7 1.796-1.808 7-.25 7-3 0-5.523-4.477-10-10-10S2 6.477 2 12s4.477 10 10 10z"></path><path d="M20 17c-3 3-5 5-8 5"></path></g>'};var Kf={cropLabel:"Crop",cropIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M23 17H9a2 2 0 0 1-2-2v-5m0-3V1 M1 7h14a2 2 0 0 1 2 2v7m0 4v3"/></g>',cropIconButtonRecenter:'<path stroke="currentColor" fill="none" stroke-width="2" stroke-linejoin="bevel" d="M1.5 7.5v-6h6M1.5 16.5v6h6M22.5 16.5v6h-6M22.5 7.5v-6h-6"/><circle cx="12" cy="12" r="3.5" fill="currentColor" stroke="none"/>',cropIconButtonRotateLeft:'<g stroke="none" fill="currentColor"><path fill="none" d="M-1-1h582v402H-1z"/><rect x="3" rx="1" height="12" width="12" y="9"/><path d="M15 5h-1a5 5 0 015 5 1 1 0 002 0 7 7 0 00-7-7h-1.374l.747-.747A1 1 0 0011.958.84L9.603 3.194a1 1 0 000 1.415l2.355 2.355a1 1 0 001.415-1.414l-.55-.55H15z"/></g>',cropIconButtonRotateRight:'<g stroke="none" fill="currentColor"><path fill="none" d="M-1-1h582v402H-1z"/><path d="M11.177 5H10a5 5 0 00-5 5 1 1 0 01-2 0 7 7 0 017-7h1.374l-.747-.747A1 1 0 0112.042.84l2.355 2.355a1 1 0 010 1.415l-2.355 2.354a1 1 0 01-1.415-1.414l.55-.55z"/><rect rx="1" height="12" width="12" y="9" x="9"/></g>',cropIconButtonFlipVertical:'<g stroke="none" fill="currentColor"><path d="M19.993 12.143H7a1 1 0 0 1-1-1V5.994a1 1 0 0 1 1.368-.93l12.993 5.15a1 1 0 0 1-.368 1.93z"/><path d="M19.993 14a1 1 0 0 1 .368 1.93L7.368 21.078A1 1 0 0 1 6 20.148V15a1 1 0 0 1 1-1h12.993z" opacity=".6"/></g>',cropIconButtonFlipHorizontal:'<g stroke="none" fill="currentColor"><path d="M11.93 7.007V20a1 1 0 0 1-1 1H5.78a1 1 0 0 1-.93-1.368l5.15-12.993a1 1 0 0 1 1.929.368z"/><path d="M14 7.007V20a1 1 0 0 0 1 1h5.149a1 1 0 0 0 .93-1.368l-5.15-12.993A1 1 0 0 0 14 7.007z" opacity=".6"/></g>',cropIconSelectPreset:(e,t)=>{const[o,i,n]=t?[t<1?1:.3,1===t?.85:.5,t>1?1:.3]:[.2,.3,.4];return`<g fill="currentColor">\n <rect opacity="${o}" x="2" y="4" width="10" height="18" rx="1"/>\n <rect opacity="${i}" x="4" y="8" width="14" height="14" rx="1"/>\n <rect opacity="${n}" x="6" y="12" width="17" height="10" rx="1"/>\n </g>`},cropIconCropBoundary:(e,t)=>{const[o,i,n,r]=t?[.3,1,0,0]:[0,0,.3,1];return`<g fill="currentColor">\n <rect opacity="${o}" x="2" y="3" width="20" height="20" rx="1"/>\n <rect opacity="${i}" x="7" y="8" width="10" height="10" rx="1"/>\n <rect opacity="${n}" x="4" y="8" width="14" height="14" rx="1"/>\n <rect opacity="${r}" x="12" y="4" width="10" height="10" rx="1"/>\n </g>`},cropLabelButtonRecenter:"Recenter",cropLabelButtonRotateLeft:"Rotate left",cropLabelButtonRotateRight:"Rotate right",cropLabelButtonFlipHorizontal:"Flip horizontal",cropLabelButtonFlipVertical:"Flip vertical",cropLabelSelectPreset:"Crop shape",cropLabelCropBoundary:"Crop boundary",cropLabelCropBoundaryEdge:"Edge of image",cropLabelCropBoundaryNone:"None",cropLabelTabRotation:"Rotation",cropLabelTabZoom:"Zoom"},Zf={frameLabel:"Frame",frameIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em">\n <rect x="2" y="2" width="20" height="20" rx="4"/>\n <rect x="6" y="6" width="12" height="12" rx="1"/>\n </g>',frameLabelMatSharp:"Mat",frameLabelMatRound:"Bevel",frameLabelLineSingle:"Line",frameLabelLineMultiple:"Zebra",frameLabelEdgeSeparate:"Inset",frameLabelEdgeOverlap:"Plus",frameLabelEdgeCross:"Lumber",frameLabelCornerHooks:"Hook",frameLabelPolaroid:"Polaroid"},Jf={redactLabel:"Redact",redactIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em">\n\n <path d="M 2 7 l 0.1 -.1"/>\n <path d="M 2 12 l 5 -5"/>\n <path d="M 2 17 l 10 -10"/>\n <path d="M 7 17 l 10 -10"/>\n <path d="M 12 17 l 10 -10"/>\n <path d="M 17 17 l 5 -5"/>\n <path d="M 22 17 l .1 -.1"/>\n\n </g>'},Qf=(e,t)=>{const o=Object.getOwnPropertyDescriptors(e);Object.keys(o).forEach((i=>{o[i].get?Object.defineProperty(t,i,{get:()=>e[i],set:t=>e[i]=t}):t[i]=e[i]}))},e$=e=>{const t={},{sub:o,pub:i}=vi();u()&&null!==document.doctype||console.warn("Browser is in quirks mode, add <!DOCTYPE html> to page to fix render issues");const n=ca();Qf(n,t);const r=((e,t)=>{const o={},i=new uu({target:e,props:{stores:t,pluginComponents:Array.from($u)}});let n=!1;const r=()=>{n||(u()&&window.removeEventListener("pagehide",r),i&&(n=!0,i.$destroy()))};mu||(mu=new Set(Ha(uu).filter((e=>!pu.includes(e))))),mu.forEach((e=>{Object.defineProperty(o,e,{get:()=>i[e],set:t=>i[e]=t})})),Object.defineProperty(o,"previewImageData",{get:()=>i.imagePreviewCurrent}),gu.forEach((e=>{const t=fu[e],n=t[0];Object.defineProperty(o,e,{get:()=>i.pluginInterface[n][e],set:o=>{const n=t.reduce(((t,n)=>(t[n]={...i.pluginOptions[n],[e]:o},t)),{});i.pluginOptions={...i.pluginOptions,...n}}})})),Object.defineProperty(o,"element",{get:()=>i.root,set:()=>{}});const a=i.history;return Dr(o,{on:(e,t)=>{if(n)return()=>{};if(/undo|redo|revert/.test(e))return a.on(e,t);const o=[i.sub(e,t),i.$on(e,(e=>t(e instanceof CustomEvent&&!e.detail?void 0:e)))].filter(Boolean);return()=>o.forEach((e=>e()))},updateImagePreview:e=>{i.imagePreviewSrc=e},close:()=>!n&&i.pub("close"),destroy:r}),Object.defineProperty(o,"history",{get:()=>({undo:()=>a.undo(),redo:()=>a.redo(),revert:()=>a.revert(),get:()=>a.get(),set:e=>a.set(e),write:e=>a.write(e),get length(){return a.length()},get index(){return a.index}})}),u()&&window.addEventListener("pagehide",r),o})(e,n.stores);Qf(r,t);const s=["loadImage","processImage","abortProcessImage","abortLoadImage"].map((e=>r.on(e,(t=>{const o=n[e](t&&t.detail);o instanceof Promise&&o.catch((()=>{}))})))),l=(e,t)=>{const i=o(e,t),a=n.on(e,t),s=r.on(e,t);return()=>{i(),a(),s()}};t.handleEvent=a;const c=bu.map((e=>l(e,(o=>t.handleEvent(e,o)))));return Dr(t,{on:l,updateImage:e=>new Promise(((o,i)=>{const r=t.history.get(),a=t.imageState;n.loadImage(e).then((e=>{t.history.set(r),t.imageState=a,o(e)})).catch(i)})),close:()=>{i("close")},destroy:()=>{[...s,...c].forEach((e=>e())),r.destroy(),n.destroy(),i("destroy")}}),t};const t$="pintura-editor";var o$=()=>new Promise((e=>{if(!i$)return e([]);var t;t=t$,document.createElement(t).constructor===HTMLElement&&customElements.define(t$,i$),customElements.whenDefined(t$).then((()=>e(document.querySelectorAll(t$))))}));const i$=u()&&class extends HTMLElement{constructor(){super(),this._editor=void 0,this._unsubs=void 0}static get observedAttributes(){return["src"]}attributeChangedCallback(e,t,o){this[e]=o}connectedCallback(){this._editor=e$(this),Qf(this._editor,this),this._editor.src=this.getAttribute("src"),this._unsubs=xu(this._editor,this)}disconnectedCallback(){this._editor.destroy(),this._unsubs.forEach((e=>e()))}},n$="pintura-editor";var r$=(e,t={})=>{const o=k(e)?document.querySelector(e):e;if(!ut(o))return;t.class=t.class?"pintura-editor "+t.class:n$;const i=e$(o);return Object.assign(i,t)};const{document:a$,window:s$}=ur;function l$(e){let t,o,i,n;return qn(e[27]),{c(){t=yn(),o=gn("div"),Sn(o,"class",e[5]),Sn(o,"style",e[4])},m(r,a){pn(r,t,a),pn(r,o,a),e[28](o),i||(n=[xn(s$,"keydown",e[10]),xn(s$,"orientationchange",e[11]),xn(s$,"resize",e[27]),xn(a$.body,"focusin",(function(){Yi(!e[1]&&e[7])&&(!e[1]&&e[7]).apply(this,arguments)})),xn(a$.body,"focusout",(function(){Yi(e[2]&&e[8])&&(e[2]&&e[8]).apply(this,arguments)})),xn(o,"wheel",e[9],{passive:!1})],i=!0)},p(t,i){e=t,32&i[0]&&Sn(o,"class",e[5]),16&i[0]&&Sn(o,"style",e[4])},i:Vi,o:Vi,d(r){r&&mn(t),r&&mn(o),e[28](null),i=!1,Xi(n)}}}function c$(e,t,o){let i,n,r,a,s,l,c,d;const h=_n();let{root:p}=t,{preventZoomViewport:m=!0}=t,{preventScrollBodyIfNeeded:f=!0}=t,{preventFooterOverlapIfNeeded:$=!0}=t,{class:y}=t,b=!0,x=!1,v=!1,w=u()&&document.documentElement,S=u()&&document.body,k=u()&&document.head;const C=qa(0,{precision:.001,damping:.5});Zi(e,C,(e=>o(23,d=e)));const M=C.subscribe((e=>{v&&e>=1?(o(19,v=!1),o(1,b=!1),h("show")):x&&e<=0&&(o(18,x=!1),o(1,b=!0),h("hide"))}));On((()=>{w.classList.remove("PinturaModalBodyLock"),M()}));let T=!1,R=void 0,P=void 0,A=void 0;const I=()=>document.querySelector("meta[name=viewport]"),E=()=>Array.from(document.querySelectorAll("meta[name=theme-color]"));let L;const F=(e,t)=>{const o=()=>{e()?t():requestAnimationFrame(o)};requestAnimationFrame(o)};let B,z,D=0,O=void 0;const _=()=>{z||(z=g("div",{style:"position:fixed;height:100vh;top:0"}),S.append(z))};zn((()=>{$&&It()&&_()})),Dn((()=>{z&&(o(21,O=z.offsetHeight),z.remove(),z=void 0)}));let W=void 0;const V=()=>w.style.setProperty("--pintura-document-height",window.innerHeight+"px");return e.$$set=e=>{"root"in e&&o(0,p=e.root),"preventZoomViewport"in e&&o(12,m=e.preventZoomViewport),"preventScrollBodyIfNeeded"in e&&o(13,f=e.preventScrollBodyIfNeeded),"preventFooterOverlapIfNeeded"in e&&o(14,$=e.preventFooterOverlapIfNeeded),"class"in e&&o(15,y=e.class)},e.$$.update=()=>{9175042&e.$$.dirty[0]&&o(22,i=v||x?d:b?0:1),4096&e.$$.dirty[0]&&(n="width=device-width,height=device-height,initial-scale=1"+(m?",maximum-scale=1,user-scalable=0":"")),786434&e.$$.dirty[0]&&o(24,r=!v&&!b&&!x),12&e.$$.dirty[0]&&(T||o(20,B=D)),2097160&e.$$.dirty[0]&&o(25,a=Xt(O)?"--viewport-pad-footer:"+(O>D?0:1):""),38797312&e.$$.dirty[0]&&o(4,s=`opacity:${i};height:${B}px;--editor-modal:1;${a}`),32768&e.$$.dirty[0]&&o(5,l=Us(["pintura-editor","PinturaModal",y])),8192&e.$$.dirty[0]&&o(26,c=f&&It()&&/15_/.test(navigator.userAgent)),83886080&e.$$.dirty[0]&&c&&(e=>{e?(W=window.scrollY,w.classList.add("PinturaDocumentLock"),V(),window.addEventListener("resize",V)):(window.removeEventListener("resize",V),w.classList.remove("PinturaDocumentLock"),Xt(W)&&window.scrollTo(0,W),W=void 0)})(r)},[p,b,T,D,s,l,C,e=>{/textarea/i.test(e.target)&&(o(2,T=!0),L=D)},e=>{if(/textarea/i.test(e.target))if(clearTimeout(undefined),L===D)o(2,T=!1);else{const e=D;F((()=>D!==e),(()=>o(2,T=!1)))}},e=>e.preventDefault(),e=>{const{key:t}=e;if(!/escape/i.test(t))return;const o=e.target;if(o&&/input|textarea/i.test(o.nodeName))return;const i=document.querySelectorAll(".PinturaModal");i[i.length-1]===p&&h("close")},_,m,f,$,y,()=>{if(v||!b)return;o(19,v=!0);const e=I()||g("meta",{name:"viewport"});R=!R&&e.getAttribute("content"),e.setAttribute("content",n+(/cover/.test(R)?",viewport-fit=cover":"")),e.parentNode||k.append(e);const t=getComputedStyle(p).getPropertyValue("--color-background"),i=E();if(i.length)P=i.map((e=>e.getAttribute("content")));else{const e=g("meta",{name:"theme-color"});k.append(e),i.push(e)}i.forEach((e=>e.setAttribute("content",`rgb(${t})`))),clearTimeout(A),A=setTimeout((()=>C.set(1)),250)},()=>{if(x||b)return;clearTimeout(A),o(18,x=!0);const e=I();R?e.setAttribute("content",R):e.remove();const t=E();P?t.forEach(((e,t)=>{e.setAttribute("content",P[t])})):t.forEach((e=>e.remove())),C.set(0)},x,v,B,O,i,d,r,a,c,function(){o(3,D=s$.innerHeight)},function(e){Un[e?"unshift":"push"]((()=>{p=e,o(0,p)}))}]}class d$ extends Sr{constructor(e){super(),wr(this,e,c$,l$,Gi,{root:0,preventZoomViewport:12,preventScrollBodyIfNeeded:13,preventFooterOverlapIfNeeded:14,class:15,show:16,hide:17},[-1,-1])}get root(){return this.$$.ctx[0]}set root(e){this.$set({root:e}),Qn()}get preventZoomViewport(){return this.$$.ctx[12]}set preventZoomViewport(e){this.$set({preventZoomViewport:e}),Qn()}get preventScrollBodyIfNeeded(){return this.$$.ctx[13]}set preventScrollBodyIfNeeded(e){this.$set({preventScrollBodyIfNeeded:e}),Qn()}get preventFooterOverlapIfNeeded(){return this.$$.ctx[14]}set preventFooterOverlapIfNeeded(e){this.$set({preventFooterOverlapIfNeeded:e}),Qn()}get class(){return this.$$.ctx[15]}set class(e){this.$set({class:e}),Qn()}get show(){return this.$$.ctx[16]}get hide(){return this.$$.ctx[17]}}const u$=(e,t,o,i)=>{const n=G(t.x-e.x,t.y-e.y),r=ee(n),a=5*o;let s;s=i?.5*a:Math.ceil(.5*(a-1));const l=ae(K(r),s);return{anchor:K(e),offset:l,normal:r,solid:i,size:a,sizeHalf:s}},h$=({anchor:e,solid:t,normal:o,offset:i,size:n,sizeHalf:r,strokeWidth:a,strokeColor:s},l)=>{const c=e.x,d=e.y,u=ae(K(o),n),h=G(c+u.x,d+u.y);if(ae(u,.55),t){ne(l,i);const e=ae(K(o),.5*r);return[{points:[G(c-e.x,d-e.y),G(h.x-u.y,h.y+u.x),G(h.x+u.y,h.y-u.x)],backgroundColor:s}]}{const e=ae((e=>{const t=e.x;return e.x=-e.y,e.y=t,e})(K(o)),.5),t=G(c-e.x,d-e.y),i=G(c+e.x,d+e.y);return[{points:[G(h.x+u.y,h.y-u.x),t,G(c,d),i,G(h.x-u.y,h.y+u.x)],strokeWidth:a,strokeColor:s}]}},p$=({anchor:e,solid:t,offset:o,normal:i,sizeHalf:n,strokeWidth:r,strokeColor:a},s)=>(ne(s,o),t&&ne(s,Z(K(i))),[{x:e.x,y:e.y,rx:n,ry:n,backgroundColor:t?a:void 0,strokeWidth:t?void 0:r,strokeColor:t?void 0:a}]),m$=({anchor:e,offset:t,strokeWidth:o,strokeColor:i})=>[{points:[G(e.x-t.y,e.y+t.x),G(e.x+t.y,e.y-t.x)],strokeWidth:o,strokeColor:i}],g$=({anchor:e,solid:t,offset:o,normal:i,sizeHalf:n,strokeWidth:r,strokeColor:a},s)=>{return ne(s,o),[{x:e.x-n,y:e.y-n,width:2*n,height:2*n,rotation:(l=i,Math.atan2(l.y,l.x)),backgroundColor:t?a:void 0,strokeWidth:t?void 0:r,strokeColor:t?void 0:a}];var l},f$=(e,t)=>{const o=parseFloat(e)*t;return k(e)?o+"%":o},$$=(e,t)=>k(e)?ni(e,t):e,y$=e=>[{...e,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:e.frameSize?f$(e.frameSize,2):"2.5%",frameRadius:e.frameRound?f$(e.frameSize,2):0}],b$=({x:e,y:t,width:o,height:i,frameInset:n="3.5%",frameSize:r=".25%",frameColor:a=[1,1,1],frameOffset:s="5%",frameAmount:l=1,frameRadius:c=0,expandsCanvas:d=!1},{isPreview:u})=>{const h=Math.sqrt(o*i);let p=$$(r,h);const m=$$(n,h),g=$$(s,h);let f=0;u||(p=Math.max(1,Math.round(p)),f=p%2==0?0:.5);const $=$$(f$(c,l),h);return new Array(l).fill(void 0).map(((n,r)=>{const s=g*r;let l=e+m+s,c=t+m+s,h=e+o-m-s,y=t+i-m-s;u||(l=Math.round(l),c=Math.round(c),h=Math.round(h),y=Math.round(y));return{x:l+f,y:c+f,width:h-l,height:y-c,cornerRadius:$>0?$-s:0,strokeWidth:p,strokeColor:a,expandsCanvas:d}}))},x$=({x:e,y:t,width:o,height:i,frameSize:n=".25%",frameOffset:r=0,frameInset:a="2.5%",frameColor:s=[1,1,1]},{isPreview:l})=>{const c=Math.sqrt(o*i);let d=$$(n,c),u=$$(a,c),h=$$(r,c),p=0;l||(d=Math.max(1,Math.round(d)),u=Math.round(u),h=Math.round(h),p=d%2==0?0:.5);const m=h-u,g=e+u+p,f=t+u+p,$=e+o-u-p,y=t+i-u-p;return[{points:[G(g+m,f),G($-m,f)]},{points:[G($,f+m),G($,y-m)]},{points:[G($-m,y),G(g+m,y)]},{points:[G(g,y-m),G(g,f+m)]}].map((e=>(e.strokeWidth=d,e.strokeColor=s,e)))},v$=({x:e,y:t,width:o,height:i,frameSize:n=".25%",frameInset:r="2.5%",frameLength:a="2.5%",frameColor:s=[1,1,1]},{isPreview:l})=>{const c=Math.sqrt(o*i);let d=$$(n,c),u=$$(r,c),h=$$(a,c),p=0;l||(d=Math.max(1,Math.round(d)),u=Math.round(u),h=Math.round(h),p=d%2==0?0:.5);const m=e+u+p,g=t+u+p,f=e+o-u-p,$=t+i-u-p;return[{points:[G(m,g+h),G(m,g),G(m+h,g)]},{points:[G(f-h,g),G(f,g),G(f,g+h)]},{points:[G(f,$-h),G(f,$),G(f-h,$)]},{points:[G(m+h,$),G(m,$),G(m,$-h)]}].map((e=>(e.strokeWidth=d,e.strokeColor=s,e)))},w$=({x:e,y:t,width:o,height:i,frameColor:n=[1,1,1]},{isPreview:r})=>{const a=Math.sqrt(o*i),s=.1*a;let l=.2*a;const c=.5*s;let d=.0025*a;return r||(l=Math.ceil(l),d=Math.max(2,d)),n.length=3,[{id:"border",x:e-c,y:t-c,width:o+s,height:i+l,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:s,frameColor:n,expandsCanvas:!0},{id:"chin",x:e-c,y:i,width:o+s,height:l,backgroundColor:n,expandsCanvas:!0},r&&{x:e,y:t,width:o,height:i,strokeWidth:d,strokeColor:n}].filter(Boolean)},S$=()=>((e={})=>t=>{if(!Gt(t,"lineStart")&&!Gt(t,"lineEnd"))return;const o=[],{lineStart:i,lineEnd:n,strokeWidth:r,strokeColor:a}=t,s=G(t.x1,t.y1),l=G(t.x2,t.y2),c=[s,l];if(i){const[t,n]=i.split("-"),c=e[t];if(c){const e=u$(s,l,r,!!n);o.push(...c({...e,strokeColor:a,strokeWidth:r},s))}}if(n){const[t,i]=n.split("-"),c=e[t];if(c){const e=u$(l,s,r,!!i);o.push(...c({...e,strokeColor:a,strokeWidth:r},l))}}return[{points:c,strokeWidth:r,strokeColor:a},...o]})({arrow:h$,circle:p$,square:g$,bar:m$}),k$=()=>((e={})=>(t,o)=>{if(!Gt(t,"frameStyle"))return;const i=t.frameStyle,n=e[i];if(!n)return;const{frameStyle:r,...a}=t;return n(a,o)})({solid:y$,hook:v$,line:b$,edge:x$,polaroid:w$}),C$=e=>{const t=(o,i={isPreview:!0})=>{const n=e.map((e=>{const n=e(o,i);if(n)return n.map((e=>t(e,i)))})).filter(Boolean).flat();return n.length?n.flat():o};return t},M$=_a,T$=Wa,R$=()=>({read:c,apply:x}),P$=(e={})=>{const{blurAmount:t,scrambleAmount:o,enableSmoothing:i,backgroundColor:n}=e;return(e,r)=>(async(e,t={})=>{if(!e)return;const{width:o,height:i}=e,{dataSize:n=96,dataSizeScalar:r=1,scrambleAmount:a=4,blurAmount:s=6,outputFormat:l="canvas",backgroundColor:c=[0,0,0]}=t,d=Math.round(n*r),u=Math.min(d/o,d/i),h=Math.floor(o*u),p=Math.floor(i*u),m=g("canvas",{width:h,height:p}),f=m.getContext("2d");if(c.length=3,f.fillStyle=no(c),f.fillRect(0,0,h,p),y(e)){const t=g("canvas",{width:o,height:i});t.getContext("2d").putImageData(e,0,0),f.drawImage(t,0,0,h,p),$(t)}else f.drawImage(e,0,0,h,p);const b=f.getImageData(0,0,h,p),x=[];if(a>0&&x.push([Va,{amount:a}]),s>0)for(let e=0;e<s;e++)x.push([Vt,{matrix:Na}]);let v;if(x.length){const e=(t,o)=>`(err, imageData) => {\n (${t[o][0].toString()})(Object.assign({ imageData: imageData }, filterInstructions[${o}]), \n ${t[o+1]?e(t,o+1):"done"})\n }`,t=`function (options, done) {\n const filterInstructions = options.filterInstructions;\n const imageData = options.imageData;\n (${e(x,0)})(null, imageData)\n }`,o=await A(t,[{imageData:b,filterInstructions:x.map((e=>e[1]))}],[b.data.buffer]);v=Ot(o)}else v=b;return"canvas"===l?(f.putImageData(v,0,0),m):v})(e,{blurAmount:t,scrambleAmount:o,enableSmoothing:i,backgroundColor:n,...r})},A$=ca,I$=Hh,E$=Vh,L$=bp,F$={markupEditorToolbar:Hh(),markupEditorToolStyles:Vh(),markupEditorShapeStyleControls:bp()},B$=yu,z$=Em,D$=_m,O$=Xm,_$=yf,W$=vf,V$=kf,N$=Af,H$=jf,U$=Nf,j$=Uu,X$=nh,Y$=mh,G$=Gf,q$=qf,K$=Kf,Z$={filterLabel:"Filter",filterIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M18.347 9.907a6.5 6.5 0 1 0-1.872 3.306M3.26 11.574a6.5 6.5 0 1 0 2.815-1.417 M10.15 17.897A6.503 6.503 0 0 0 16.5 23a6.5 6.5 0 1 0-6.183-8.51"/></g>',filterLabelChrome:"Chrome",filterLabelFade:"Fade",filterLabelCold:"Cold",filterLabelWarm:"Warm",filterLabelPastel:"Pastel",filterLabelMonoDefault:"Mono",filterLabelMonoNoir:"Noir",filterLabelMonoWash:"Wash",filterLabelMonoStark:"Stark",filterLabelSepiaDefault:"Sepia",filterLabelSepiaBlues:"Blues",filterLabelSepiaRust:"Rust",filterLabelSepiaColor:"Color"},J$={finetuneLabel:"Finetune",finetuneIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M4 1v5.5m0 3.503V23M12 1v10.5m0 3.5v8M20 1v15.5m0 3.5v3M2 7h4M10 12h4M18 17h4"/></g>',finetuneLabelBrightness:"Brightness",finetuneLabelContrast:"Contrast",finetuneLabelSaturation:"Saturation",finetuneLabelExposure:"Exposure",finetuneLabelTemperature:"Temperature",finetuneLabelGamma:"Gamma",finetuneLabelClarity:"Clarity",finetuneLabelVignette:"Vignette"},Q$={resizeLabel:"Resize",resizeIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><rect x="2" y="12" width="10" height="10" rx="2"/><path d="M4 11.5V4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5"/><path d="M14 10l3.365-3.365M14 6h4v4"/></g>',resizeLabelFormCaption:"Image output size",resizeLabelInputWidth:"w",resizeTitleInputWidth:"Width",resizeLabelInputHeight:"h",resizeTitleInputHeight:"Height",resizeTitleButtonMaintainAspectRatio:"Maintain aspectratio",resizeIconButtonMaintainAspectRatio:(e,t)=>`\n <defs>\n <mask id="mask1" x="0" y="0" width="24" height="24" >\n <rect x="0" y="0" width="24" height="10" fill="#fff" stroke="none"/>\n </mask>\n </defs>\n <g fill="none" fill-rule="evenodd">\n <g mask="url(#mask1)">\n <path transform="translate(0 ${3*(t-1)})" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" d="M9.401 10.205v-.804a2.599 2.599 0 0 1 5.198 0V17"/>\n </g>\n <rect fill="currentColor" x="7" y="10" width="10" height="7" rx="1.5"/>\n </g>\n `},ey={decorateLabel:"Decorate",decorateIcon:'<g fill="none" fill-rule="evenodd"><path stroke="currentColor" stroke-width=".125em" stroke-linecap="round" stroke-linejoin="round" d="M12 18.5l-6.466 3.4 1.235-7.2-5.23-5.1 7.228-1.05L12 2l3.233 6.55 7.229 1.05-5.231 5.1 1.235 7.2z"/></g>'},ty={annotateLabel:"Annotate",annotateIcon:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M17.086 2.914a2.828 2.828 0 1 1 4 4l-14.5 14.5-5.5 1.5 1.5-5.5 14.5-14.5z"/></g>'},oy={stickerLabel:"Sticker",stickerIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M12 22c2.773 0 1.189-5.177 3-7 1.796-1.808 7-.25 7-3 0-5.523-4.477-10-10-10S2 6.477 2 12s4.477 10 10 10z"/><path d="M20 17c-3 3-5 5-8 5"/></g>'},iy=Zf,ny=Jf,ry=(e,t,o={})=>(k(t)?Array.from(document.querySelectorAll(t)):t).filter(Boolean).map((t=>e(t,S(o)))),ay=r$,sy=(e={},t)=>{const{sub:o,pub:i}=vi(),n={},r=((e={},t)=>new d$({target:t||document.body,props:{class:e.class,preventZoomViewport:e.preventZoomViewport,preventScrollBodyIfNeeded:e.preventScrollBodyIfNeeded,preventFooterOverlapIfNeeded:e.preventFooterOverlapIfNeeded}}))(e,t),s=()=>{r.hide&&r.hide()},l=()=>{r.show&&r.show()},c=e$(r.root);Qf(c,n),n.handleEvent=a,c.handleEvent=(e,t)=>n.handleEvent(e,t),c.on("close",(async()=>{const{willClose:t}=e;if(!t)return s();await t()&&s()}));const d=(e,t)=>/show|hide/.test(e)?o(e,t):c.on(e,t),u=["show","hide"].map((e=>d(e,(t=>n.handleEvent(e,t))))),h=()=>{u.forEach((e=>e())),s(),r.$destroy(),c.destroy()};return Dr(n,{on:d,destroy:h,hide:s,show:l}),Object.defineProperty(n,"modal",{get:()=>r.root,set:()=>{}}),r.$on("close",c.close),r.$on("show",(()=>i("show"))),r.$on("hide",(()=>{i("hide"),!1!==e.enableAutoDestroy&&h()})),!1!==e.enableAutoHide&&c.on("process",s),c.on("loadstart",l),!1!==e.enableButtonClose&&(e.enableButtonClose=!0),delete e.class,Object.assign(n,e),n},ly=(e,t)=>r$(e,{...t,layout:"overlay"}),cy=(e={})=>{let t=void 0;Array.isArray(e.imageWriter)||(t=e.imageWriter,delete e.imageReader);let o=void 0;Array.isArray(e.imageWriter)||(o=e.imageWriter,delete e.imageWriter);let i=void 0;return qt(e.imageScrambler)||(i=e.imageScrambler,delete e.imageScrambler),{imageReader:M$(t),imageWriter:T$(o),imageOrienter:R$(),imageScrambler:P$(i)}},dy=C$,uy=()=>C$([k$(),S$()]),hy=(e={})=>{yu(...[z$,D$,O$,_$,W$,V$,N$,H$,U$].filter(Boolean));const t=["crop","filter","finetune","annotate","decorate",e.stickers&&"sticker","frame","redact","resize"].filter(Boolean),o=cy(e),i={...G$,...q$,...K$,...Z$,...J$,...iy,...ny,...Q$,...ey,...ty,...oy,...e.locale};return delete e.locale,Rr([{...o,shapePreprocessor:uy(),utils:t,...j$,...X$,...Y$,...F$,stickerStickToImage:!0,locale:i},e])},py=async(e={})=>{const t=await o$();return t.forEach((t=>Object.assign(t,S(e)))),t},my=(e,t)=>ay(e,hy(t));e.appendDefaultEditor=my,e.appendDefaultEditors=(e,t)=>ry(my,e,t),e.appendEditor=ay,e.appendEditors=(e,t)=>ry(ay,e,t),e.appendNode=(e,t)=>{if(wu(t))return t.push(e);t[3]=[...ku(t),e]},e.blobToFile=O,e.colorStringToColorArray=Id,e.createDefaultColorOptions=Uh,e.createDefaultFontFamilyOptions=Gh,e.createDefaultFontScaleOptions=jh,e.createDefaultFontSizeOptions=()=>[16,18,20,24,30,36,48,64,72,96,144],e.createDefaultFontStyleOptions=Kh,e.createDefaultImageOrienter=R$,e.createDefaultImageReader=M$,e.createDefaultImageScrambler=P$,e.createDefaultImageWriter=T$,e.createDefaultLineEndStyleOptions=Yh,e.createDefaultShapePreprocessor=uy,e.createDefaultStrokeScaleOptions=Xh,e.createDefaultStrokeWidthOptions=()=>[1,2,3,4,6,8,12,16,20,24,32,48,64],e.createDefaultTextAlignOptions=qh,e.createEditor=A$,e.createMarkupEditorBackgroundColorControl=cp,e.createMarkupEditorColorControl=ap,e.createMarkupEditorColorOptions=Zh,e.createMarkupEditorFontColorControl=gp,e.createMarkupEditorFontFamilyControl=lp,e.createMarkupEditorFontFamilyOptions=ep,e.createMarkupEditorFontScaleOptions=Jh,e.createMarkupEditorFontSizeControl=$p,e.createMarkupEditorFontSizeOptions=e=>e.map(Bh),e.createMarkupEditorFontStyleControl=fp,e.createMarkupEditorFontStyleOptions=tp,e.createMarkupEditorLineEndStyleControl=mp,e.createMarkupEditorLineEndStyleOptions=op,e.createMarkupEditorLineHeightControl=e=>[Qc,{title:e=>e.shapeTitleLineHeight,options:np(e,{defaultKey:"labelAuto"})}],e.createMarkupEditorLineStartStyleControl=pp,e.createMarkupEditorShapeStyleControls=L$,e.createMarkupEditorStrokeColorControl=dp,e.createMarkupEditorStrokeScaleOptions=Qh,e.createMarkupEditorStrokeWidthControl=up,e.createMarkupEditorStrokeWidthOptions=e=>e.map(Bh),e.createMarkupEditorTextAlignControl=yp,e.createMarkupEditorToolStyle=Wh,e.createMarkupEditorToolStyles=E$,e.createMarkupEditorToolbar=I$,e.createNode=function(e,t,o,i){return Array.isArray(o)&&(i=o,o={}),[e,t,o||{},i||[]]},e.createShapePreprocessor=dy,e.defineCustomElements=py,e.defineDefaultCustomElements=e=>py(hy(e)),e.degToRad=Ts,e.dispatchEditorEvents=xu,e.effectBrightness=zu,e.effectClarity=Nu,e.effectContrast=Du,e.effectExposure=_u,e.effectGamma=Wu,e.effectSaturation=Ou,e.effectTemperature=Hu,e.effectVignette=Vu,e.filterChrome=Xu,e.filterCold=qu,e.filterFade=Yu,e.filterInvert=()=>[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e.filterMonoDefault=Ku,e.filterMonoNoir=Zu,e.filterMonoStark=Qu,e.filterMonoWash=Ju,e.filterPastel=ju,e.filterSepiaBlues=th,e.filterSepiaColor=ih,e.filterSepiaDefault=eh,e.filterSepiaRust=oh,e.filterWarm=Gu,e.findNode=Tu,e.frameEdgeCross=dh,e.frameEdgeOverlap=uh,e.frameEdgeSeparate=ch,e.frameHook=hh,e.frameLineMultiple=lh,e.frameLineSingle=sh,e.framePolaroid=ph,e.frameSolidRound=ah,e.frameSolidSharp=rh,e.getEditorDefaults=hy,e.getEditorProps=()=>(()=>{const e=aa.map(sa),t=Br.map((([e])=>e)).filter((e=>!ra.includes(e)));return e.concat(t)})().concat((mu=new Set(Ha(uu).filter((e=>!pu.includes(e)))),[...mu,...gu])),e.insertNodeAfter=(e,t,o)=>Cu(e,t,o,(e=>e+1)),e.insertNodeBefore=(e,t,o)=>Cu(e,t,o),e.isSupported=()=>(null===Fu&&(Fu=u()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"File"in window&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window),Fu),e.legacyDataToImageState=(e,t,o={})=>{const i={};if(!((e={})=>{if("markup"in e||"color"in e||"filter"in e)return!0;const{crop:t}=e;return!(!t||!("flip"in t||"center"in t||"aspectRatio"in t||"rotation"in t))})(o))return o;if(o.crop&&Object.assign(i,Lu(t,o.crop)),o.markup){const e=Array.isArray(o.markup)?o.markup:Object.values(o.markup);i.decoration=e.map((e=>((e,t,o)=>{const i=Object.keys(o).reduce(((e,t)=>{let i=o[t];return t=Pu[t]||t,/px$/.test(i)?i=Au(i):/^(?:x|y|left|right|top|bottom|width|height|fontSize|strokeWidth)$/.test(t)&&"number"==typeof i&&(/strokeWidth/.test(t)&&(i*=2),i=Au(i)),/color/i.test(t)&&(i=Id(i)),null===i&&(i=void 0),e[t]=i,e}),{});if("line"===t&&(1===i.lineDecoration.length&&(i.lineEnd="arrow"),2===i.lineDecoration.length&&(i.lineStart="arrow"),i.x1=i.x,i.y1=i.y,i.x2=Iu(i.x,i.width),i.y2=Iu(i.y,i.height),delete i.x,delete i.y,delete i.width,delete i.height,delete i.lineDecoration,delete i.lineStyle),"text"===t&&(i.y=Iu(i.y,"-"+i.fontSize),delete i.width,delete i.height,delete i.borderStyle),"ellipse"===t){let t,o;if(/%$/.test(i.width)){t=parseFloat(i.width)/100,o=parseFloat(i.height)/100;const n=t*e.width,r=o*e.height;t=n/e.width*100,o=r/e.height*100}else t=i.width,o=i.height;i.rx=.5*t,i.ry=.5*o,/%$/.test(i.width)&&(i.rx+="%",i.ry+="%"),i.x=Iu(i.x,i.rx),i.y=Iu(i.y,i.ry),delete i.width,delete i.height,delete i.borderStyle}return"rect"===t&&delete i.borderStyle,"path"===t&&(i.points=i.points.map((e=>({x:Au(e.x),y:Au(e.y)})))),i})(i.crop||t,e[0],e[1])))}return o.color&&Object.keys(o.color).filter((e=>o.color[e])).map((e=>[e,Array.isArray(o.color[e].matrix)?o.color[e].matrix:Object.values(o.color[e].matrix)])).forEach((([e,t])=>{i.colorMatrix||(i.colorMatrix={}),i.colorMatrix[e]=t})),o.filter&&(i.colorMatrix||(i.colorMatrix={}),i.colorMatrix.filter="string"==typeof o.filter&&e.filterFunctions[o.filter]?e.filterFunctions[o.filter]():o.filter.matrix),i},e.locale_en_gb=G$,e.markup_editor_defaults=F$,e.markup_editor_locale_en_gb=q$,e.openDefaultEditor=e=>sy(hy(e)),e.openEditor=sy,e.overlayDefaultEditor=(e,t)=>ly(e,hy(t)),e.overlayEditor=ly,e.plugin_annotate=_$,e.plugin_annotate_locale_en_gb=ty,e.plugin_crop=z$,e.plugin_crop_locale_en_gb=K$,e.plugin_decorate=W$,e.plugin_decorate_locale_en_gb=ey,e.plugin_filter=D$,e.plugin_filter_defaults=X$,e.plugin_filter_locale_en_gb=Z$,e.plugin_finetune=O$,e.plugin_finetune_defaults=j$,e.plugin_finetune_locale_en_gb=J$,e.plugin_frame=N$,e.plugin_frame_defaults=Y$,e.plugin_frame_locale_en_gb=iy,e.plugin_redact=H$,e.plugin_redact_locale_en_gb=ny,e.plugin_resize=U$,e.plugin_resize_locale_en_gb=Q$,e.plugin_sticker=V$,e.plugin_sticker_locale_en_gb=oy,e.processDefaultImage=(e,t={})=>da(e,{...cy(t),...t}),e.processImage=da,e.removeNode=Mu,e.setPlugins=B$,e.supportsWebGL=Ld,Object.defineProperty(e,"__esModule",{value:!0})}));