/*!
 * Pintura v8.62.0 - Test version
 * (c) 2018-2023 PQINA Inc. - All Rights Reserved
 * License: https://pqina.nl/pintura/license/
 * 
 * This version of Pintura is for testing purposes only.
 * Visit https://pqina.nl/pintura/ to obtain a commercial license.
 */
/* eslint-disable */

!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=[{value:65504,name:"jfif"},{value:65498,name:"sos"},{value:65505,subvalue:17784,name:"exif"},{value:65505,subvalue:26740,name:"xmp"},{value:65506,subvalue:19792,name:"mpf"}];var o=e=>{if(65496!==e.getUint16(0))return;const o=e.byteLength;let i,n=2,r=void 0;for(;n<o&&255===e.getUint8(n);){i=e.getUint16(n);const o=t.find((t=>t.value===i&&(!t.subvalue||t.subvalue===e.getUint16(n+2+2))));if(o){const{name:t}=o;r||(r={}),r[t]||(r[t]={offset:n,size:e.getUint16(n+2)})}if(65498===i)break;n+=2+e.getUint16(n+2)}return r};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;const 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=>{const r=[];let a=t;const s=Math.min(e.byteLength,t+o-16);for(;a<s;a+=12){const 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.error),l.onprogress=t,l[a](e)})))(e.slice(...t),o),c=async(e,t)=>{const o=await l(e,[0,262144],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/jpeg;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 $={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 f=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=e=>u()?RegExp(e).test(window.navigator.userAgent):void 0;let x=null;var v=()=>(null===x&&(x=b(/Android/)),x),w=(e,t)=>{const o=g("canvas",{width:e.width,height:e.height});return o.getContext("2d",t).drawImage(e,0,0),o},S=async(e,t=1)=>{const o=await p(),[i,n]=o||t<5?[e.width,e.height]:[e.height,e.width],r=g("canvas",{width:i,height:n}),a=r.getContext("2d",{willReadFrequently:!0});if(y(e)&&!o&&t>1){const t=g("canvas",{width:e.width,height:e.height});t.getContext("2d",{willReadFrequently:!0}).putImageData(e,0,0),e=t}if(!o&&t>1&&a.transform.apply(a,((e,t,o=-1)=>(-1===o&&(o=1),$[o](e,t)))(e.width,e.height,t)),y(e)){if(a.putImageData(e,0,0),v())return w(r)}else a.drawImage(e,0,0);return e instanceof HTMLCanvasElement&&f(e),r},k=async(e,t=1)=>1===t||await p()?e:m(await S(e,t)),C=e=>"object"==typeof e;const M=e=>e instanceof HTMLElement?e:C(e)?T(e):e,T=e=>{let t;return Array.isArray(e)?(t=[],e.forEach(((e,o)=>{t[o]=M(e)}))):(t={},Object.keys(e).forEach((o=>{const i=e[o];t[o]=M(i)}))),t};var P=e=>"string"==typeof e,R=e=>"function"==typeof e,I=(e,t)=>new Promise(((o,i)=>{const n=()=>o(((e,{width:t,height:o,canvasMemoryLimit:i,contextOptions:n})=>{let r=t||e.naturalWidth,a=o||e.naturalHeight;r||a||(r=300,a=150);const s=r*a;if(i&&s>i){const e=Math.sqrt(i)/Math.sqrt(s);r=Math.floor(r*e),a=Math.floor(a*e)}const l=g("canvas");return l.width=r,l.height=a,l.getContext("2d",n).drawImage(e,0,0,r,a),l})(e,t));e.complete&&e.width?n():(e.onload=n,e.onerror=()=>i(new Error("Failed to load image")))})),A=()=>"createImageBitmap"in window,E=e=>/svg/.test(e.type),L=()=>Math.random().toString(36).substr(2,9);const F=new Map;var z=(e,t,o)=>new Promise(((i,n)=>{const r=e.toString();let a=F.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,terminationTimeout:void 0,terminate:()=>{clearTimeout(a.terminationTimeout),a.worker.terminate(),URL.revokeObjectURL(o),F.delete(r)}},n.onmessage=function(e){const{id:t,content:o,error:n}=e.data;if(clearTimeout(a.terminationTimeout),a.terminationTimeout=setTimeout((()=>{i.size>0||a.terminate()}),500),!i.has(t))return;const r=i.get(t);i.delete(t),null!=n?r.reject(n):r.resolve(o)},F.set(r,a)}const s=L();a.messages.set(s,{resolve:i,reject:n}),a.worker.postMessage({id:s,content:t},o)})),D=async(e,t)=>{const o=async()=>{const o=await(async(e,t)=>{const o=g("img",{src:URL.createObjectURL(e)}),i=await I(o,t);return URL.revokeObjectURL(o.src),i})(e,{canvasMemoryLimit:t,contextOptions:{willReadFrequently:!0}}),i=m(o);return f(o),i};if(v())return await o();let i;if(A()&&!E(e)&&"OffscreenCanvas"in window)try{i=await z(((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",{willReadFrequently:!0});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){}return i&&i.width?i:await o()},O=(e,t,o)=>new Promise(((i,n)=>{try{e.toBlob((e=>{if(!e)return n(new Error("Failed to create blob"));i(e)}),t,o)}catch(e){n(e)}})),B=async(e,t,o)=>{const i=await S(e),n=await O(i,t,o);return f(i),n};const _={matroska:"mkv"};var W=e=>{const t=(e.match(/\/([a-z0-9]+)/)||[])[1];if(/^x/.test(t)){const[,t=""]=e.split("/x-");return _[t]}return t},V=e=>e.substr(0,e.lastIndexOf("."))||e;const N=/avif|bmp|gif|jpg|jpeg|jpe|jif|jfif|png|svg|tiff|webp/;var H=e=>{return e&&(t=(o=e,o.split(".").pop()).toLowerCase(),N.test(t)?"image/"+(/jfif|jif|jpe|jpg/.test(t)?"jpeg":"svg"===t?"svg+xml":t):"");var t,o},j=(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=H(e);if(o===t)return e;const i=W(t)||o;return`${V(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}},U=(e,t)=>e/t,Z=e=>e;const X=Math.PI,G=Math.PI/2,Y=G/2;var q=e=>{const t=Math.abs(e)%Math.PI;return t>Y&&t<Math.PI-Y};const K={Top:"t",Right:"r",Bottom:"b",Left:"l",TopLeft:"tl",TopRight:"tr",BottomRight:"br",BottomLeft:"bl"},{Top:J,Right:Q,Bottom:ee,Left:te,TopLeft:oe,TopRight:ie,BottomRight:ne,BottomLeft:re}=K;var ae={[J]:[.5,0],[Q]:[1,.5],[ee]:[.5,1],[te]:[0,.5],[oe]:[0,0],[ie]:[1,0],[ne]:[1,1],[re]:[0,1]},se=(e,t=12)=>parseFloat(e.toFixed(t));const le=(e,t,o)=>o+(e-o)*t,ce=e=>({x:e.x+.5*e.width,y:e.y+.5*e.height,rx:.5*e.width,ry:.5*e.height}),de=()=>ue(0,0),ue=(e,t)=>({x:e,y:t}),he=e=>ue(e.pageX,e.pageY),pe=e=>ue(e.x,e.y),me=e=>(e.x=-e.x,e.y=-e.y,e),ge=(e,t,o=de())=>{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},$e=e=>Math.sqrt(e.x*e.x+e.y*e.y),fe=e=>{const t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?de():(e.x/=t,e.y/=t,e)},ye=(e,t)=>Math.atan2(t.y-e.y,t.x-e.x),be=(e,t)=>e.x===t.x&&e.y===t.y,xe=(e,t)=>(e.x=t(e.x),e.y=t(e.y),e),ve=(e,t)=>(e.x+=t.x,e.y+=t.y,e),we=(e,t)=>(e.x-=t.x,e.y-=t.y,e),Se=(e,t)=>(e.x/=t,e.y/=t,e),ke=(e,t)=>(e.x*=t,e.y*=t,e),Ce=(e,t)=>e.x*t.x+e.y*t.y,Me=(e,t)=>e.x*t.y-e.y*t.x,Te=(e,t=de())=>{const o=e.x-t.x,i=e.y-t.y;return o*o+i*i},Pe=(e,t=de())=>Math.sqrt(Te(e,t)),Re=(e,t,o)=>(e.x=le(e.x,t,o.x),e.y=le(e.y,t,o.y),e),Ie=e=>{let t=0,o=0;return e.forEach((e=>{t+=e.x,o+=e.y})),ue(t/e.length,o/e.length)},Ae=(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),Ee=(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},Le=(e,t)=>({width:e,height:t}),Fe=e=>Le(e.width,e.height),ze=e=>Le(e.width,e.height),De=e=>Le(e.width,e.height),Oe=e=>Le(e[0],e[1]),Be=e=>{return/img/i.test(e.nodeName)?Le((t=e).naturalWidth,t.naturalHeight):ze(e);var t},_e=(e,t)=>Le(e,t),We=(e,t,o=Z)=>o(e.width)===o(t.width)&&o(e.height)===o(t.height),Ve=(e,t)=>(e.width*=t,e.height*=t,e),Ne=e=>ue(.5*e.width,.5*e.height),He=(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},je=(e,t)=>e.width>=t.width&&e.height>=t.height,Ue=(e,t)=>(e.width=t(e.width),e.height=t(e.height),e),Ze=(e,t)=>({start:e,end:t}),Xe=e=>Ze(pe(e.start),pe(e.end)),Ge=(e,t)=>{if(0===t)return e;const o=ue(e.start.x-e.end.x,e.start.y-e.end.y),i=fe(o),n=ke(i,t);return e.start.x+=n.x,e.start.y+=n.y,e.end.x-=n.x,e.end.y-=n.y,e},Ye=[ue(-1,-1),ue(-1,1),ue(1,1),ue(1,-1)],qe=(e,t,o,i)=>({x:e,y:t,width:o,height:i}),Ke=e=>qe(e.x,e.y,e.width,e.height),Je=()=>qe(0,0,0,0),Qe=e=>qe(0,0,e.width,e.height),et=e=>qe(e.x||0,e.y||0,e.width||0,e.height||0),tt=e=>{let t=e[0].x,o=e[0].x,i=e[0].y,n=e[0].y;return e.forEach((e=>{t=Math.min(t,e.x),o=Math.max(o,e.x),i=Math.min(i,e.y),n=Math.max(n,e.y)})),qe(t,i,o-t,n-i)},ot=e=>nt(e.x-e.rx,e.y-e.ry,2*e.rx,2*e.ry),it=(e,t)=>qe(e.x-.5*t.width,e.y-.5*t.height,t.width,t.height),nt=(e,t,o,i)=>qe(e,t,o,i),rt=e=>ue(e.x+.5*e.width,e.y+.5*e.height),at=(e,t)=>(e.x+=t.x,e.y+=t.y,e),st=(e,t,o)=>(o=o||rt(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),lt=(e,t,o,i)=>{const n=(i.x-e.x)/e.width,r=(i.y-e.y)/e.height;let a=Math.max(t.width,e.width),s=Math.max(t.height,e.height);return a=Math.min(o.width,a),s=Math.min(o.height,s),e.x=i.x-n*a,e.y=i.y-r*s,e.width=a,e.height=s,e},ct=(e,t)=>{const[o,i]=ae[t],n=o*e.width,r=i*e.height;return ue(e.x+n,e.y+r)},dt=(e,t)=>(e.x*=t,e.y*=t,e.width*=t,e.height*=t,e),ut=(e,t,o=Z)=>o(e.x)===o(t.x)&&o(e.y)===o(t.y)&&o(e.width)===o(t.width)&&o(e.height)===o(t.height),ht=e=>U(e.width,e.height),pt=(e,t,o,i,n)=>(e.x=t,e.y=o,e.width=i,e.height=n,e),mt=(e,t)=>(e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e),gt=(e,t,o)=>(o||(o=rt(e)),vt(e).map((e=>ge(e,t,o)))),$t=(e,t)=>qe(.5*e.width-.5*t.width,.5*e.height-.5*t.height,t.width,t.height),ft=(e,t)=>!(t.x<e.x)&&(!(t.y<e.y)&&(!(t.x>e.x+e.width)&&!(t.y>e.y+e.height))),yt=(e,t,o=de())=>{if(0===e.width||0===e.height)return Je();const i=ht(e);t||(t=i);let n=e.width,r=e.height;return t>i?n=r*t:r=n/t,qe(o.x+.5*(e.width-n),o.y+.5*(e.height-r),n,r)},bt=(e,t=ht(e),o=de())=>{if(0===e.width||0===e.height)return Je();let i=e.width,n=i/t;return n>e.height&&(n=e.height,i=n*t),qe(o.x+.5*(e.width-i),o.y+.5*(e.height-n),i,n)},xt=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)],vt=e=>[ue(e.x,e.y),ue(e.x+e.width,e.y),ue(e.x+e.width,e.y+e.height),ue(e.x,e.y+e.height)],wt=(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},St=(e,t,o=rt(e))=>vt(e).map(((e,i)=>{const n=Ye[i];return ue(le(e.x,1+n.x*t.x,o.x),le(e.y,1+n.y*t.y,o.y))})),kt=e=>(e.x=0,e.y=0,e),Ct=e=>{const t=e[0],o=e[e.length-1];e=be(t,o)?e:[...e,t];const i=t.x,n=t.y;let r,a,s,l=0,c=0,d=0,u=0;const h=e.length;for(;c<h;c++)r=e[c],a=e[c+1>h-1?0:c+1],s=(r.y-n)*(a.x-i)-(a.y-n)*(r.x-i),l+=s,d+=(r.x+a.x-2*i)*s,u+=(r.y+a.y-2*n)*s;return s=3*l,ue(i+d/s,n+u/s)},Mt=(e,t)=>Tt(e.start,e.end,t.start,t.end),Tt=(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:ue(e.x+r*(t.x-e.x),e.y+r*(t.y-e.y))},Pt=(e,t,{ignoreIdenticalLines:o=!1,breakOnIntersection:i=!1}={})=>{const n=t.length,r=[];for(let a=0;a<n-1;a++){if(o&&(be(e.start,t[a])||be(e.start,t[a+1])||be(e.end,t[a])||be(e.end,t[a+1])))continue;const n=Tt(e.start,e.end,t[a],t[a+1]);if(n){if(i)return[n];r.push(n)}}return r.length?r:void 0},Rt=(e,t)=>{let o=0,i=0,n=!1;const r=t.length;for(o=0,i=r-1;o<r;i=o++)t[o].y>e.y!=t[i].y>e.y&&e.x<(t[i].x-t[o].x)*(e.y-t[o].y)/(t[i].y-t[o].y)+t[o].x&&(n=!n);return n},It=e=>{const t=[];for(let o=0;o<e.length;o++){let i=o+1;i===e.length&&(i=0),t.push(Ze(pe(e[o]),pe(e[i])))}return t},At=(e,t=0)=>It(e).map((e=>Ge(e,t))),Et=(e,t,o,i=0,n=!1,r=!1,a=12)=>{const s=[];for(let i=0;i<a;i++)s.push(ue(e.x+t*Math.cos(i*(2*Math.PI)/a),e.y+o*Math.sin(i*(2*Math.PI)/a)));return(n||r)&&Ae(s,n,r,e.x,e.y),i&&Ee(s,i,e.x,e.y),s};var Lt=(e,t)=>{const o=Qe(e),i=rt(o),n=gt(o,t,i);return kt(tt(n))},Ft=(e,t)=>e instanceof HTMLElement&&(!t||new RegExp(`^${t}$`,"i").test(e.nodeName)),zt=e=>e instanceof File,Dt=async(e,t,o)=>{const i=await O(e,t,o);return j(i,"canvas")},Ot=e=>e.split("/").pop().split(/\?|\#/).shift();const Bt=u()&&!!Node.prototype.replaceChildren?(e,t)=>e.replaceChildren(t):(e,t)=>{for(;e.lastChild;)e.removeChild(e.lastChild);void 0!==t&&e.append(t)},_t=u()&&g("div",{class:"PinturaMeasure",style:"position:absolute;left:0;top:0;width:99999px;height:0;pointer-events:none;contain:strict;margin:0;padding:0;"});let Wt;var Vt=e=>(Bt(_t,e),_t.parentNode||document.body.append(_t),clearTimeout(Wt),Wt=setTimeout((()=>{_t.remove()}),500),e);let Nt=null;var Ht=()=>(null===Nt&&(Nt=u()&&/^((?!chrome|android).)*(safari|iphone|ipad)/i.test(navigator.userAgent)),Nt),jt=e=>new Promise(((t,o)=>{let i=!1;!e.parentNode&&Ht()&&(i=!0,e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0;width:0;height:0;",Vt(e));const n=()=>{const o=e.naturalWidth,n=e.naturalHeight;o&&n&&(i&&e.remove(),clearInterval(r),t({width:o,height:n}))};e.onerror=e=>{clearInterval(r),o(e)};const r=setInterval(n,1);n()})),Ut=e=>new Promise(((t,o)=>{const i=()=>{t({width:e.videoWidth,height:e.videoHeight})};if(e.readyState>=1)return i();e.onloadedmetadata=i,e.onerror=()=>o(e.error)})),Zt=e=>/^image/.test(e.type),Xt=e=>new Promise((t=>{const o=P(e)?e:URL.createObjectURL(e),i=()=>{const e=new Image;e.src=o,t(e)};if(e instanceof Blob&&Zt(e))return i();const n=document.createElement("video");n.preload="metadata",n.onloadedmetadata=()=>t(n),n.onerror=i,n.src=o})),Gt=e=>"VIDEO"===e.nodeName,Yt=async e=>{let t,o;t=e.src?e:await Xt(e);try{o=Gt(t)?await Ut(t):await jt(t)}finally{zt(e)&&URL.revokeObjectURL(t.src)}return o};var qt=async e=>{const t=await Yt(e),o=await(e=>new Promise(((t,o)=>{if(e.complete)return t(e);e.onload=()=>t(e),e.onerror=()=>o(new Error("Failed to load image"))})))(e),i=g("canvas",t);i.getContext("2d",{willReadFrequently:!0}).drawImage(o,0,0);const n=await O(i);return j(n,Ot(o.src))},Kt=(e=0,t=!0)=>new(r("ProgressEvent"))("progress",{loaded:100*e,total:100,lengthComputable:t}),Jt=(e,t,o=(e=>e))=>e.getAllResponseHeaders().indexOf(t)>=0?o(e.getResponseHeader(t)):void 0,Qt=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 eo="URL_REQUEST";class to extends Error{constructor(e,t,o){super(e),this.name="EditorError",this.code=t,this.metadata=o}}var oo=(e,t)=>{const{headers:o={},credentials:i}=t||{};Object.entries(o).forEach((([t,o])=>e.setRequestHeader(t,o))),i&&(e.withCredentials="omit"!==i)},io=(e,t,o)=>/^data:/.test(e)?(async(e,t="data-uri",o=a)=>{o(Kt(0));const i=await fetch(e);o(Kt(.33));const n=await i.blob();let r;Zt(n)||(r="image/"+(e.includes(",/9j/")?"jpeg":"png")),o(Kt(.66));const s=j(n,t,r);return o(Kt(1)),s})(e,void 0,t):((e,t,o)=>new Promise(((i,n)=>{const r=()=>n(new to("Error fetching image",eo,a)),a=new XMLHttpRequest;a.onprogress=t,a.onerror=r,a.onload=()=>{if(!a.response||a.status>=300||a.status<200)return r();const t=Jt(a,"Content-Type"),o=Jt(a,"Content-Disposition",Qt)||Ot(e);i(j(a.response,o,t||H(o)))};const{willRequest:s}=o;Promise.resolve(s&&s(e,{resourceType:"image"})).then((t=>{if(!1===t)return n("Image load rejected");a.open("GET",e),oo(a,t),a.responseType="blob",a.send()})).catch(console.error)})))(e,t,o),no=e=>e instanceof Blob&&!(e instanceof File),ro=e=>"close"in e,ao=async(e,t,o)=>{if(zt(e)||no(e))return e;if(P(e))return await io(e,t,o);if(Ft(e,"canvas"))return await Dt(e);if(Ft(e,"img"))return await qt(e);if(y(e)||ro(e))return await Dt(await S(e));throw new to("Invalid image source","invalid-image-source")};let so=null;var lo=()=>(null===so&&(so=u()&&/^mac/i.test(navigator.platform)),so);let co=null;var uo=()=>(null===co&&(co=u()&&(b(/iPhone|iPad|iPod/)||lo()&&navigator.maxTouchPoints>=1)),co),ho=async(e,t=1)=>await p()||uo()||t<5?e:_e(e.height,e.width),po=e=>/jpeg/.test(e.type),mo=e=>{return"object"!=typeof(t=e)||t.constructor!=Object?e:JSON.stringify(e);var t},go=(e,t=0,o)=>(0===t||(e.translate(o.x,o.y),e.rotate(t),e.translate(-o.x,-o.y)),e),$o=async(e,t={})=>{const{flipX:o,flipY:i,rotation:n,crop:r}=t,a=ze(e),s=o||i,l=!!n,c=r&&(r.x||r.y||r.width||r.height),d=c&&ut(r,Qe(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",{willReadFrequently:!0}).putImageData(e,0,0),s){const e=g("canvas",{width:p.width,height:p.height}).getContext("2d",{willReadFrequently:!0});((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(),f(p),p=e.canvas}if(l){const e=Ue(De(tt(gt(et(p),n))),Math.floor),t=g("canvas",{width:r.width,height:r.height}).getContext("2d",{willReadFrequently:!0});((e,t,o)=>{e.translate(t,o)})(t,-r.x,-r.y),go(t,n,Ne(e)),t.drawImage(p,.5*(e.width-p.width),.5*(e.height-p.height)),t.restore(),f(p),p=t.canvas}else if(u){return h=p.getContext("2d",{willReadFrequently:!0}).getImageData(r.x,r.y,r.width,r.height),f(p),h}return h=p.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,p.width,p.height),f(p),h},fo=(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,$=0,f=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)continue;if(i=2*u*u*u-3*u*u+1,i<=0)continue;t=4*(e+o*r);const h=c[t+3];f+=i*h,a+=i,h<255&&(i=i*h/250),l+=i*c[t],g+=i*c[t+1],$+=i*c[t+2],n+=i}}d[o]=l/n,d[o+1]=g/n,d[o+2]=$/n,d[o+3]=f/a}t(null,{data:d,width:s,height:l})},yo=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},bo=async(e,t={},o)=>{const{width:i,height:n,fit:r,upscale:a}=t;if(!i&&!n)return e;let s=i,l=n;if(i?n||(l=i):s=n,"force"!==r){const t=s/e.width,o=l/e.height;let i=1;if("cover"===r?i=Math.max(t,o):"contain"===r&&(i=Math.min(t,o)),i>1&&!1===a)return e;s=Math.round(e.width*i),l=Math.round(e.height*i)}return s=Math.max(s,1),l=Math.max(l,1),e.width===s&&e.height===l?e:o?o(e,s,l):(e=await z(fo,[{imageData:e,width:s,height:l}],[e.data.buffer]),yo(e))},xo=(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],$=i[9],f=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,P=0,R=0,I=0,A=0,E=0,L=0,F=0,z=0,D=0,O=0,B=0;for(;T<a;T+=4)P=r[T]/255,R=r[T+1]/255,I=r[T+2]/255,A=r[T+3]/255,E=P*s+R*l+I*c+A*d+u,L=P*h+R*p+I*m+A*g+$,F=P*f+R*y+I*b+A*x+v,z=P*w+R*S+I*k+A*C+M,D=Math.max(0,E*z)+(1-z),O=Math.max(0,L*z)+(1-z),B=Math.max(0,F*z)+(1-z),n[T]=255*Math.max(0,Math.min(1,D)),n[T+1]=255*Math.max(0,Math.min(1,O)),n[T+2]=255*Math.max(0,Math.min(1,B)),n[T+3]=255*A;t(null,{data:n,width:o.width,height:o.height})},vo=(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,$=0,f=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,$=0,y=0;y<u;y++)for(f=0;f<u;f++)b=d+y-h,x=c+f-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+f],p+=s[v]*w,m+=s[v+1]*w,g+=s[v+2]*w,$+=s[v+3]*w;S[l]=p/n,S[l+1]=m/n,S[l+2]=g/n,S[l+3]=$/n,l+=4}t(null,{data:S,width:r,height:a})},wo=(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,P=l(x,v)*i/k,m=M[C]/255,g=M[C+1]/255,$=M[C+2]/255,f=M[C+3]/255,y=1-P,b=y*f+P,T[C]=(y*f*m+P*u)/b*255,T[C+1]=(y*f*g+P*h)/b*255,T[C+2]=(y*f*$+P*p)/b*255,T[C+3]=255*b;var C,M,T,P;t(null,{data:n,width:o.width,height:o.height})},So=(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})},ko=(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})},Co=async(e,t={})=>{const{colorMatrix:o,convolutionMatrix:i,gamma:n,noise:r,vignette:a}=t,s=[];if(i&&s.push([vo,{matrix:i.clarity}]),n>0&&s.push([ko,{level:1/n}]),o&&!(e=>{const t=e.length;let o;const 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([xo,{matrix:o}]),(r>0||r<0)&&s.push([So,{level:r}]),(a>0||a<0)&&s.push([wo,{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 z(c,[{imageData:e,filterInstructions:s.map((e=>e[1]))}],[e.data.buffer]),yo(e)},Mo=e=>"number"==typeof e,To=e=>P(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),Po=(e,t)=>e.hasOwnProperty(t),Ro=e=>Array.isArray(e);let Io=64,Ao=102,Eo=112,Lo=!1;var Fo=(e,t)=>(!Lo&&u()&&(/^win/i.test(navigator.platform)&&(Ao=103),(uo()||lo())&&(Io=63.5,Ao=110,Eo=123),Lo=!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="${Io}" y="${Ao}" alignment-baseline="text-top" dominant-baseline="text-top" text-anchor="middle" font-size="${Eo}px">${e}</text></svg>`),zo=e=>e instanceof Blob,Do=(e,t)=>e/t*100+"%",Oo=e=>`rgba(${Math.round(255*e[0])}, ${Math.round(255*e[1])}, ${Math.round(255*e[2])}, ${Mo(e[3])?e[3]:1})`,Bo=e=>Object.values(e).join("_");const _o=async(e,t=0)=>{const o=g("canvas",{width:80,height:80}).getContext("2d");return await((e=0)=>new Promise((t=>{setTimeout(t,e)})))(t),o.drawImage(e,0,0,80,80),!((e=>!new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data.buffer).some((e=>0!==e)))(o)&&t<=256)||await _o(e,t+16)},Wo=new Map;var Vo=e=>new Promise(((t,o)=>{const i=new FileReader;i.onerror=()=>o(i.error),i.onload=()=>t(i.result),i.readAsDataURL(e)})),No=()=>{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)))}}};let Ho=null;var jo=()=>(null===Ho&&(Ho=b(/Firefox/)),Ho);const Uo=32,Zo=({color:e=[0,0,0],fontSize:t=16,fontFamily:o="sans-serif",fontVariant:i="normal",fontWeight:n="normal",fontStyle:r="normal",textAlign:a="left",lineHeight:s=20},l=1)=>`font-size:${t*l}px;font-style:${r};font-weight:${n};font-family:${o};font-variant:${i};line-height:${s*l}px;text-align:${a};color:${Oo(e)};`,Xo=(e,t,o=1)=>{const{width:i,height:n,disableNewline:r}=t,a=!i,s=!1===r?((e="")=>e.split("\n").length)(e):void 0,l=a?"normal":"break-word",c=a&&!s?"nowrap":"pre-line";return`max-width:none;min-width:auto;width:${a?"auto":i*o+"px"};height:${n?n*o+"px":"auto"};margin-top:0;margin-bottom:0;padding-top:${(({fontSize:e=16,lineHeight:t=20}={})=>.5*Math.max(0,e-t))(t)*o}px;word-break:${l};word-wrap:normal;white-space:${c};`},Go=new Map,Yo=e=>{const t=[];for(const o of Array.from(e.childNodes))o.nodeType===Node.TEXT_NODE?t.push(Ko(o)):t.push(...Yo(o));return t},qo="pointer-events:none;visibility:hidden;position:absolute;left:0;top:0;",Ko=e=>{const t=e.nodeValue;if(!t)return[];const o=t.length,i=document.createRange();i.selectNodeContents(e);const n=[];for(let r=0;r<o;r++){i.setStart(e,0),i.setEnd(e,r+1);const o=i.getClientRects().length-1,a=t.charAt(r);n[o]?n[o]+=a:n.push(a)}const r=i.getClientRects();return n.map(((e,t)=>({rect:r[t],text:e})))},Jo=new Map,Qo=(e="",t)=>{const{width:o=0,height:i=0}=t;if(o&&i)return _e(o,i);let{fontSize:n=16,fontFamily:r,lineHeight:a=20,fontWeight:s,fontStyle:l,fontVariant:c}=t;const d=Bo({text:e,fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,lineHeight:a,width:o});let u=Jo.get(d);if(u)return u;let h=1;n>1e3&&jo()&&(h=n/1e3,n=1e3,a/=h);const p=Vt(g("pre",{contenteditable:"true",spellcheck:"false",style:`${qo}${Zo({...t,fontSize:n,lineHeight:a})};${Xo(e,t)}"`,innerHTML:e})).getBoundingClientRect();return u=ze(p),u.height+=Math.max(0,n-a),u=Ue(u,(e=>e*h)),o&&(u.width=o),Jo.set(d,u),u},ei=new Map,ti=(e,t)=>new Promise(((o,i)=>{let n=ei.get(e);void 0===n&&(n=((e,t)=>{const{sub:o,pub:i}=No();let n,r;return Promise.resolve(t&&t(e,{resourceType:"stylesheet"})).then((t=>{if(!1===t)return r="requestPrevented",i("error",r);const{headers:o,credentials:a}=t||{};fetch(e,{headers:o,credentials:a}).then((e=>e.text())).then((e=>{n=e,i("load",n)})).catch((e=>{r=e,i("error",r)}))})),{sub:(e,t)=>"load"===e&&n?t(n):"error"===e&&r?t(r):void o(e,t)}})(e,t),ei.set(e,n)),n.sub("load",o),n.sub("error",i)})),oi=async(e,t)=>{let o;try{o=await ti(e,t)}catch(e){return[]}const i=g("style",{innerHTML:o,id:L()});document.head.append(i);const n=Array.from(document.styleSheets).find((e=>e.ownerNode.id===i.id));return i.remove(),Array.from(n.cssRules)},ii=new Map,ni=async(e,t)=>{if(ii.has(e.href))return ii.get(e.href);let o;try{o=Array.from(e.cssRules);for(const e of(e=>e.filter((e=>e instanceof CSSImportRule)))(o)){const i=e.href;if(ii.has(i)){const e=ii.get(i);o=[...o,...e];continue}const n=await oi(i,t);ii.set(i,n),o=[...o,...n]}}catch(i){const n=e.href;o=await oi(n,t),ii.set(n,o)}return(e=>e.filter((e=>e instanceof CSSFontFaceRule)))(o)},ri=(e,t)=>e.style.getPropertyValue(t),ai=(e,t)=>{if(!e.style)return!1;return ri(e,"font-family").replace(/^"|"$/g,"")==t},si=async(e,t)=>{const o=((e,t)=>{const o=[];for(const i of e)ai(i,t)&&o.push(i);return o})(await(async e=>{const t=Array.from(document.styleSheets).map((t=>ni(t,e))),o=await Promise.all(t),i=[];return o.forEach((e=>i.push(...e))),i})(t),e);return o.length?o.map((e=>{const t=e.parentStyleSheet.href&&new URL(e.parentStyleSheet.href),o=t?t.origin+(e=>e.pathname.split("/").slice(0,-1).join("/"))(t)+"/":"",i=e.style.getPropertyValue("src").match(/url\("?(.*?)"?\)/)[1],n=Array.from(e.style).filter((e=>"src"!=e)).reduce(((t,o)=>t+=o+":"+ri(e,o)+";"),"");return[/^http/.test(i)?i:o+i,n]})):[]},li=new Map,ci=new Map;var di=async(e="",t)=>{if(!e.length)return;let{imageWidth:o=300,imageHeight:i=150,paddingLeft:n=Uo,paddingRight:r=Uo,fontFamily:a,fontSize:s,pixelRatio:l=1,willRequest:c}=t,d=1,u="";s>1e3&&jo()&&(d=s/1e3,u=`transform-origin:0 0;transform:scale(${d})`);const h=l/d,p=(o+n+r)*l,m=i*l,g=Zo({...t,fontSize:s},h),$=Xo(e,t,h),f=await(async(e,t)=>{if(li.get(e))return;let o=ci.get(e);if(!o){const n=await si(e,t);if(!n.length)return void li.set(e,!0);const r=[];for(const[e,t]of n){const o=await fetch(e).then((e=>e.blob())),n=!(i=o.type)||/woff2/.test(i)?"woff2":/woff/.test(i)?"woff":/ttf|truetype/.test(i)?"truetype":/otf|opentype/.test(i)?"opentype":/svg/.test(i)?"svg":"woff2",a=await Vo(o);r.push(`@font-face { src:url(${a}) format('${n}');${t};font-display:block; }`)}o=r.join(""),ci.set(e,o)}var i;return o})(a,c);return((e,{safariCacheKey:t="*"}={})=>new Promise(((o,i)=>{const n=new Image;n.onerror=()=>i(new Error("Failed to load SVG")),n.onload=()=>{if(!Ht()||!e.includes("@font-face")||Wo.has(t))return o(n);_o(n).then((()=>{Wo.set(t,!0),o(n)}))},n.src="data:image/svg+xml,"+e})))(`<svg xmlns="http://www.w3.org/2000/svg" width="${p}" height="${m}" viewBox="0 0 ${p} ${m}"><foreignObject x="0" y="0" width="${p}" height="${m}"><div xmlns="http://www.w3.org/1999/xhtml">${f?`<style>${f}</style>`:""}<pre contenteditable="true" spellcheck="false" style="position:absolute;padding-right:${r*h}px;padding-left:${n*h}px;${g};${$};${u}">${e.replace(/%/g,"%25").replace(/#/g,"%23").replace(/&nbsp;/g," ").replace(/&(?!#\d{4};|[a-z]+;)/gi,"&amp;").replace(/<br>|\n/g,"<br/>")}</pre></div></foreignObject></svg>`,{safariCacheKey:a})};const ui=e=>{const t={...e};return T(t)},hi=(e,t={})=>{const o=ht(e);let i,n;const r=t.width||t.rx,a=t.height||t.ry;if(r&&a)return Fe(t);if(r||a){i=parseFloat(r||Number.MAX_SAFE_INTEGER),n=parseFloat(a||Number.MAX_SAFE_INTEGER);const e=Math.min(i,n);P(r)||P(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}},pi=(e,t={})=>{return{width:void 0,height:void 0,...t,aspectRatio:1,backgroundImage:(o=Fo(e),"data:image/svg+xml,"+o.replace("<","%3C").replace(">","%3E"))};var o},mi=(e,t={})=>({backgroundColor:[0,0,0,0],...wi(t)?{}:{width:void 0,height:void 0,aspectRatio:void 0},...t,backgroundImage:P(e)?e:zo(e)?URL.createObjectURL(e):e}),gi=(e,t)=>{let o;if(P(e)||zo(e)){const i={...hi(t),backgroundSize:"contain"};o=To(e)?pi(e,i):mi(e,i)}else if(e.src){const i=hi(t,e.shape||e),n={...e.shape,...i};if(e.width&&e.height&&!Po(n,"aspectRatio")){const e=an(i,"width",t),o=an(i,"height",t);n.aspectRatio=U(e,o)}n.backgroundSize||e.shape||e.width&&e.height||(n.backgroundSize="contain"),o=To(e.src)?pi(e.src,n):mi(e.src,n)}else e.shape&&(o=ui(e.shape));return Po(o,"backgroundImage")&&(Po(o,"backgroundColor")||(o.backgroundColor=[0,0,0,0]),Po(o,"disableStyle")||(o.disableStyle=["cornerRadius","backgroundColor","strokeColor","strokeWidth"])),t?nn(o,t):o},$i=e=>ue(e.x1,e.y1),fi=e=>ue(e.x2,e.y2),yi=e=>Po(e,"text"),bi=e=>yi(e)&&!(Ei(e)||Po(e,"width")),xi=e=>yi(e)&&(Ei(e)||Po(e,"width")),vi=e=>!yi(e)&&Li(e),wi=e=>Po(e,"rx"),Si=e=>Po(e,"x1"),ki=e=>Po(e,"points"),Ci=e=>yi(e)&&e.isEditing,Mi=e=>!Po(e,"opacity")||e.opacity>0,Ti=e=>e.isSelected,Pi=e=>e.isEditing,Ri=e=>e._isDraft,Ii=e=>Po(e,"width")&&Po(e,"height"),Ai=e=>{const t=Po(e,"right"),o=Po(e,"bottom");return t||o},Ei=e=>(Po(e,"x")||Po(e,"left"))&&Po(e,"right")||(Po(e,"y")||Po(e,"top"))&&Po(e,"bottom"),Li=e=>Ii(e)||Ei(e),Fi=e=>(e._isDraft=!0,e),zi=(e,t)=>!0!==e.disableStyle&&(!Ro(e.disableStyle)||!t||!e.disableStyle.includes(t)),Di=e=>!0!==e.disableSelect,Oi=e=>!0!==e.disableRemove,Bi=e=>!e.disableFlip&&(!Ri(e)&&!Ai(e)&&(e=>Po(e,"backgroundImage")||Po(e,"text"))(e)),_i=(e,t)=>!!yi(e)&&(!0!==e.disableInput&&(R(e.disableInput)?e.disableInput(null!=t?t:e.text):t||!0)),Wi=(e,t)=>!0!==e.disableTextLayout&&(!Ro(e.disableTextLayout)||!t||!e.disableTextLayout.includes(t)),Vi=e=>!0!==e.disableManipulate&&!Ri(e)&&!Ai(e),Ni=e=>Vi(e)&&!0!==e.disableMove,Hi=e=>(delete e.left,delete e.right,delete e.top,delete e.bottom,e),ji=e=>(delete e.rotation,e),Ui=e=>(e.strokeWidth=e.strokeWidth||1,e.strokeColor=e.strokeColor||[0,0,0],e),Zi=e=>(e.backgroundColor=e.backgroundColor?e.backgroundColor:e.strokeWidth||e.backgroundImage?void 0:[0,0,0],e),Xi=e=>{let t=e.text;t=t.replace(/&(#[0-9]+|[a-z]+);/gi,((e,t)=>`___${t}___`)),t=t.replace(/&/,"&amp;"),e.text=t.replace(/___(#[0-9]+|[a-z]+)___/gi,((e,t)=>`&${t};`))},Gi=e=>(e.fontSize=e.fontSize||"4%",e.fontFamily=e.fontFamily||"sans-serif",e.fontWeight=e.fontWeight||"normal",e.fontStyle=e.fontStyle||"normal",e.fontVariant=e.fontVariant||"normal",e.lineHeight=e.lineHeight||"120%",e.color=e.color||[0,0,0],e.format="html"===e.format?"html":"text","html"===e.format?Xi(e):(e=>{Xi(e);let t=e.text;t=t.replace(/</g,"&gt;"),t=t.replace(/>/g,"&lt;"),e.text=t})(e),bi(e)?Yi(e):qi(e)),Yi=e=>(!1!==e.disableNewline&&(delete e.textAlign,e.text=e.text.replace(/\n/g," ")),Hi(e)),qi=e=>(e.textAlign=e.textAlign||"left",e),Ki=e=>((e=>{P(e.id)||(e.id=L()),Po(e,"rotation")||(e.rotation=0),Po(e,"opacity")||(e.opacity=1),Po(e,"disableErase")||(e.disableErase=!0)})(e),yi(e)?Gi(e):vi(e)?(e=>{e.cornerRadius=e.cornerRadius||0,e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],Zi(e)})(e):ki(e)?(e=>{Ui(e),ji(e),Po(e,"pathClose")||(e.disableResize=!0,Po(e,"disableMove")||(e.disableMove=!0)),Hi(e)})(e):Si(e)?(e=>{Ui(e),e.lineStart=e.lineStart||void 0,e.lineEnd=e.lineEnd||void 0,ji(e),Hi(e)})(e):wi(e)&&(e=>{e.strokeWidth=e.strokeWidth||0,e.strokeColor=e.strokeColor||[0,0,0],Zi(e)})(e),e),Ji=e=>yi(e)?"text":vi(e)?"rectangle":ki(e)?"path":Si(e)?"line":wi(e)?"ellipse":void 0,Qi=(e,t)=>parseFloat(e)/100*t,en=new RegExp(/^x|left|right|^width|rx|fontSize|cornerRadius|strokeWidth/,"i"),tn=new RegExp(/^y|top|bottom|^height|ry/,"i"),on=(e,t)=>{Object.entries(e).map((([o,i])=>{e[o]=((e,t,{width:o,height:i})=>{if(Array.isArray(t))return t.map((e=>(C(e)&&on(e,{width:o,height:i}),e)));if("string"!=typeof t)return t;if(!t.endsWith("%"))return t;const n=parseFloat(t)/100;return en.test(e)?se(o*n,6):tn.test(e)?se(i*n,6):t})(o,i,t)}));const o=e.lineHeight;P(o)&&(e.lineHeight=Math.round(e.fontSize*(parseFloat(o)/100)))},nn=(e,t)=>(on(e,t),un(e,t),e),rn=(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},an=(e,t,o)=>Array.isArray(e[t])?e[t].map((e=>Object.entries(e).reduce(((e,[t,i])=>(e[t]=P(i)?Qi(i,rn(t,o)):i,e)),{}))):P(e[t])?Qi(e[t],rn(t,o)):e[t],sn=(e,t,o)=>t.reduce(((t,i)=>{const n=an(e,i,o);return t[i]=n,t}),{}),ln=(e,t,o)=>(Object.keys(t).forEach((i=>((e,t,o,i)=>{if(!P(e[t]))return e[t]=o,e;const n=rn(t,i);return e[t]=void 0===n?o:Do(o,n),e})(e,i,t[i],o))),e),cn=(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=Je(),o=e.strokeWidth||0;if(vi(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(Si(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 wi(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&&Po(e,"rotation")&&gt(t,e.rotation),xt(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},dn=(e,t,o)=>{const i=ui(e);nn(i,t);const n=o(i);return Array.isArray(n)?n:[n]},un=(e,t)=>{if(Po(e,"left")&&(e.x=e.left),Po(e,"right")&&!P(e.right)){const o=t.width-e.right;Po(e,"left")?(e.x=e.left,e.width=Math.max(0,o-e.left)):Po(e,"width")&&(e.x=o-e.width)}if(Po(e,"top")&&(e.y=e.top),Po(e,"bottom")&&!P(e.bottom)){const o=t.height-e.bottom;Po(e,"top")?(e.y=e.top,e.height=Math.max(0,o-e.top)):Po(e,"height")&&(e.y=o-e.height)}return e},hn=(e,t)=>(ki(e)&&e.points.filter((e=>Mo(e.x))).forEach((e=>{e.x*=t,e.y*=t})),Si(e)&&Mo(e.x1)&&(e.x1*=t,e.y1*=t,e.x2*=t,e.y2*=t),Mo(e.x)&&Mo(e.y)&&(e.x*=t,e.y*=t),Mo(e.width)&&Mo(e.height)&&(e.width*=t,e.height*=t),Mo(e.rx)&&Mo(e.ry)&&(e.rx*=t,e.ry*=t),(e=>Mo(e.strokeWidth)&&e.strokeWidth>0)(e)&&(e.strokeWidth*=t),yi(e)&&(e._scale=t,Mo(e.fontSize)&&(e.fontSize*=t),Mo(e.lineHeight)&&(e.lineHeight*=t),Mo(e.width)&&!Mo(e.height)&&(e.width*=t)),Po(e,"cornerRadius")&&Mo(e.cornerRadius)&&(e.cornerRadius*=t),e),pn=e=>{if(vi(e))return ue(e.x+.5*e.width,e.y+.5*e.height);if(wi(e))return ue(e.x,e.y);if(e.text){if(xi(e)){const t=e.height||Qo(e.text,e).height;return ue(e.x+.5*e.width,e.y+.5*t)}const t=Qo(e.text,e);return ue(e.x+.5*t.width,e.y+.5*t.height)}return ki(e)?Ie(e.points):Si(e)?Ie([$i(e),fi(e)]):void 0};var mn=e=>/canvas/i.test(e.nodeName),gn=(e,t)=>new Promise(((o,i)=>{let n=e,r=!1;const a=()=>{r||(r=!0,R(t)&&Promise.resolve().then((()=>t(_e(n.naturalWidth,n.naturalHeight)))))};if(n.src||(n=new Image,P(e)&&new URL(e,location.href).origin!==location.origin&&(n.crossOrigin="anonymous"),n.src=P(e)?e:URL.createObjectURL(e)),n.complete)return a(),o(n);R(t)&&jt(n).then(a).catch(i),n.onload=()=>{a(),o(n)},n.onerror=()=>i(new Error("Failed to load image"))}));const $n=new Map([]),fn=(e,t={})=>new Promise(((o,i)=>{const{onMetadata:n=a,onLoad:r=o,onError:s=i,onComplete:l=a}=t;let c=$n.get(e);if(c||(c={loading:!1,complete:!1,error:!1,image:void 0,size:void 0,bus:No()},$n.set(e,c)),c.bus.sub("meta",n),c.bus.sub("load",r),c.bus.sub("error",s),c.bus.sub("complete",l),mn(e)){const t=e,o=t.cloneNode();c.complete=!0,c.image=o,c.size=Be(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=No());c.loading||(c.loading=!0,gn(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=No()})))})),yn=(e,t,o,i)=>e.drawImage(t,o.x,o.x,o.width,o.height,i.x,i.y,i.width,i.height);var bn=async(e,t,o,i,n=yn)=>{e.save(),e.clip(),await n(e,t,o,i),e.restore()};const xn=(e,t,o,i,n)=>{const r=Ke(e);if(i){const e=wt(tt(i),se);return e.x*=o.width,e.width*=o.width,e.y*=o.height,e.height*=o.height,{srcRect:e,destRect:r}}const a=nt(0,0,o.width,o.height);if("contain"===t){const t=bt(e,ht(a));r.width=t.width,r.height=t.height,n?(r.x+=n.x,r.y+=n.y):(r.x+=t.x,r.y+=t.y)}else if("cover"===t){const e=yt(r,a.width/a.height);r.width=e.width,r.height=e.height,n?(r.x+=n.x,r.y+=n.y):(r.x+=e.x,r.y+=e.y)}else t?(r.width=t.width,r.height=t.height,n&&(r.x+=n.x,r.y+=n.y)):n&&(r.width=o.width,r.height=o.height,r.x+=n.x,r.y+=n.y);return{srcRect:a,destRect:r}},vn=(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),wn=(e,t)=>(t.backgroundColor&&e.fill(),e),Sn=(e,t)=>(t.strokeWidth&&e.stroke(),e);var kn=async(e,t,o={})=>{const{drawImage:i}=o;if(e.lineWidth=t.strokeWidth?t.strokeWidth:1,e.strokeStyle=t.strokeColor?Oo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Oo(t.backgroundColor):"none",e.globalAlpha=t.opacity,t.backgroundImage){let o;o=mn(t.backgroundImage)?t.backgroundImage:await fn(t.backgroundImage),vn(e,t),wn(e,t);const{srcRect:n,destRect:r}=xn(t,t.backgroundSize,Be(o),t.backgroundCorners,t.backgroundPosition);return await bn(e,o,n,r,i),Sn(e,t),[]}return vn(e,t),wn(e,t),Sn(e,t),[]},Cn=async(e,t,o={})=>new Promise((async(i,n)=>{const{drawImage:r}=o;if(e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Oo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Oo(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 fn(t.backgroundImage)}catch(e){n(e)}const a=nt(t.x-t.rx,t.y-t.ry,2*t.rx,2*t.ry),{srcRect:s,destRect:l}=xn(a,t.backgroundSize,Be(o),t.backgroundCorners,t.backgroundPosition);await bn(e,o,s,l,r),t.strokeWidth&&e.stroke(),i([])}else t.strokeWidth&&e.stroke(),i([])})),Mn=async(e,t,o)=>{const i=t.width&&t.height?ze(t):Qo(t.text,t),n={x:t.x,y:t.y,width:i.width,height:i.height};if(kn(e,{...t,...n,options:o}),!t.text.length)return[];const{willRequest:r}=o,a=await di(t.text,{...t,...n,imageWidth:n.width,imageHeight:n.height,willRequest:r});return e.drawImage(a,t.x-Uo,t.y,a.width,a.height),[]},Tn=async(e,t)=>new Promise((async o=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Oo(t.strokeColor):"none",e.globalAlpha=t.opacity;let i=$i(t),n=fi(t);e.moveTo(i.x,i.y),e.lineTo(n.x,n.y),t.strokeWidth&&e.stroke(),o([])})),Pn=async(e,t)=>new Promise(((o,i)=>{e.lineWidth=t.strokeWidth||1,e.strokeStyle=t.strokeColor?Oo(t.strokeColor):"none",e.fillStyle=t.backgroundColor?Oo(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 Rn=async(e,t,o)=>{const i=pn(t);let n;if(go(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),vi(t)?n=kn:wi(t)?n=Cn:Si(t)?n=Tn:ki(t)?n=Pn:yi(t)&&(n=Mn),n){const i=await n(e,t,o);if(!i.length)return[];return[t,...await In(e,i,o)]}return[]};var In=async(e,t,o)=>{let i=[];for(const n of t)e.save(),e.beginPath(),i=[...i,...await Rn(e,n,o)],e.restore();return i},An=async(e,t={})=>{const{shapes:o=[],contextBounds:i=e,transform:n=a,drawImage:r,willRequest:s,canvasMemoryLimit:l,computeShape:c=Z,preprocessShape:d=Z}=t;if(!o.length)return e;const u=g("canvas");u.width=i.width,u.height=i.height;const h=u.getContext("2d",{willReadFrequently:!0});h.putImageData(e,i.x||0,i.y||0);const p=o.map(ui).map(c).map(d).flat();n(h),await In(h,p,{drawImage:r,canvasMemoryLimit:l,willRequest:s});const m=h.getImageData(0,0,u.width,u.height);return f(u),m},En=async(e,t={})=>{const{backgroundColor:o,backgroundImage:i}=t,n=!(!o||o&&0===o[3]);if(!i&&!n)return e;const r=g("canvas");r.width=e.width,r.height=e.height;const a=r.getContext("2d",{willReadFrequently:!0});if(a.putImageData(e,0,0),a.globalCompositeOperation="destination-over",n&&(a.fillStyle=Oo(o),a.fillRect(0,0,r.width,r.height)),i){let t;t=mn(i)?i:await fn(i);const{srcRect:o,destRect:n}=xn({x:0,y:0,width:e.width,height:e.height},"cover",{width:t.width,height:t.height});a.drawImage(t,o.x,o.y,o.width,o.height,n.x,n.y,n.width,n.height)}const s=a.getImageData(0,0,r.width,r.height);return f(r),s},Ln=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()):[],Fn=(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 zn(){}const Dn=e=>e;function On(e,t){for(const o in t)e[o]=t[o];return e}function Bn(e){return e()}function _n(){return Object.create(null)}function Wn(e){e.forEach(Bn)}function Vn(e){return"function"==typeof e}function Nn(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function Hn(e,...t){if(null==e)return zn;const o=e.subscribe(...t);return o.unsubscribe?()=>o.unsubscribe():o}function jn(e){let t;return Hn(e,(e=>t=e))(),t}function Un(e,t,o){e.$$.on_destroy.push(Hn(t,o))}function Zn(e,t,o,i){if(e){const n=Xn(e,t,o,i);return e[0](n)}}function Xn(e,t,o,i){return e[1]&&i?On(o.ctx.slice(),e[1](i(t))):o.ctx}function Gn(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}function Yn(e,t,o,i,n,r){if(n){const a=Xn(t,o,i,r);e.p(a,n)}}function qn(e){if(e.ctx.length>32){const t=[],o=e.ctx.length/32;for(let e=0;e<o;e++)t[e]=-1;return t}return-1}function Kn(e){const t={};for(const o in e)"$"!==o[0]&&(t[o]=e[o]);return t}function Jn(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 Qn(e,t,o){return e.set(o),t}function er(e){return e&&Vn(e.destroy)?e.destroy:zn}const tr="undefined"!=typeof window;let or=tr?()=>window.performance.now():()=>Date.now(),ir=tr?e=>requestAnimationFrame(e):zn;const nr=new Set;function rr(e){nr.forEach((t=>{t.c(e)||(nr.delete(t),t.f())})),0!==nr.size&&ir(rr)}function ar(e){let t;return 0===nr.size&&ir(rr),{promise:new Promise((o=>{nr.add(t={c:e,f:o})})),abort(){nr.delete(t)}}}function sr(e,t){e.appendChild(t)}function lr(e){if(!e)return document;const t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function cr(e){const t=hr("style");return function(e,t){sr(e.head||e,t),t.sheet}(lr(e),t),t.sheet}function dr(e,t,o){e.insertBefore(t,o||null)}function ur(e){e.parentNode.removeChild(e)}function hr(e){return document.createElement(e)}function pr(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function mr(e){return document.createTextNode(e)}function gr(){return mr(" ")}function $r(){return mr("")}function fr(e,t,o,i){return e.addEventListener(t,o,i),()=>e.removeEventListener(t,o,i)}function yr(e){return function(t){return t.preventDefault(),e.call(this,t)}}function br(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function xr(e,t,o){null==o?e.removeAttribute(t):e.getAttribute(t)!==o&&e.setAttribute(t,o)}function vr(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]:xr(e,i,t[i])}function wr(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function Sr(e,t){e.value=null==t?"":t}function kr(e,t,{bubbles:o=!1,cancelable:i=!1}={}){const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,o,i,t),n}class Cr{constructor(e=!1){this.is_svg=!1,this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,o=null){this.e||(this.is_svg?this.e=pr(t.nodeName):this.e=hr(t.nodeName),this.t=t,this.c(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)dr(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(ur)}}function Mr(e,t){return new e(t)}const Tr=new Map;let Pr,Rr=0;function Ir(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=lr(e),{stylesheet:p,rules:m}=Tr.get(h)||function(e,t){const o={stylesheet:cr(t),rules:{}};return Tr.set(e,o),o}(h,e);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`,Rr+=1,u}function Ar(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(", "),Rr-=n,Rr||ir((()=>{Rr||(Tr.forEach((e=>{const{ownerNode:t}=e.stylesheet;t&&ur(t)})),Tr.clear())})))}function Er(e){Pr=e}function Lr(){if(!Pr)throw new Error("Function called outside component initialization");return Pr}function Fr(e){Lr().$$.on_mount.push(e)}function zr(e){Lr().$$.after_update.push(e)}function Dr(e){Lr().$$.on_destroy.push(e)}function Or(){const e=Lr();return(t,o,{cancelable:i=!1}={})=>{const n=e.$$.callbacks[t];if(n){const r=kr(t,o,{cancelable:i});return n.slice().forEach((t=>{t.call(e,r)})),!r.defaultPrevented}return!0}}function Br(e,t){return Lr().$$.context.set(e,t),t}function _r(e){return Lr().$$.context.get(e)}function Wr(e,t){const o=e.$$.callbacks[t.type];o&&o.slice().forEach((e=>e.call(this,t)))}const Vr=[],Nr=[],Hr=[],jr=[],Ur=Promise.resolve();let Zr=!1;function Xr(){Zr||(Zr=!0,Ur.then(ea))}function Gr(){return Xr(),Ur}function Yr(e){Hr.push(e)}function qr(e){jr.push(e)}const Kr=new Set;let Jr,Qr=0;function ea(){const e=Pr;do{for(;Qr<Vr.length;){const e=Vr[Qr];Qr++,Er(e),ta(e.$$)}for(Er(null),Vr.length=0,Qr=0;Nr.length;)Nr.pop()();for(let e=0;e<Hr.length;e+=1){const t=Hr[e];Kr.has(t)||(Kr.add(t),t())}Hr.length=0}while(Vr.length);for(;jr.length;)jr.pop()();Zr=!1,Kr.clear(),Er(e)}function ta(e){if(null!==e.fragment){e.update(),Wn(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Yr)}}function oa(e,t,o){e.dispatchEvent(kr(`${t?"intro":"outro"}${o}`))}const ia=new Set;let na;function ra(){na={r:0,c:[],p:na}}function aa(){na.r||Wn(na.c),na=na.p}function sa(e,t){e&&e.i&&(ia.delete(e),e.i(t))}function la(e,t,o,i){if(e&&e.o){if(ia.has(e))return;ia.add(e),na.c.push((()=>{ia.delete(e),i&&(o&&e.d(1),i())})),e.o(t)}else i&&i()}const ca={duration:0};function da(e,t,o,i){let n=t(e,o),r=i?0:1,a=null,s=null,l=null;function c(){l&&Ar(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=Dn,tick:h=zn,css:p}=n||ca,m={start:or()+o,b:t};t||(m.group=na,na.r+=1),a||s?s=m:(p&&(c(),l=Ir(e,r,t,i,o,u,p)),t&&h(0,1),a=d(m,i),Yr((()=>oa(e,t,"start"))),ar((t=>{if(s&&t>s.start&&(a=d(s,i),s=null,oa(e,a.b,"start"),p&&(c(),l=Ir(e,r,a.b,a.duration,0,u,n.css))),a)if(t>=a.end)h(r=a.b,1-r),oa(e,a.b,"end"),s||(a.b?c():--a.group.r||Wn(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){Vn(n)?(Jr||(Jr=Promise.resolve(),Jr.then((()=>{Jr=null}))),Jr).then((()=>{n=n(),u(e)})):u(e)},end(){c(),a=s=null}}}const ua="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function ha(e,t){e.d(1),t.delete(e.key)}function pa(e,t){la(e,1,1,(()=>{t.delete(e.key)}))}function ma(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()),f.set(s,$[m]=l),s in g&&y.set(s,Math.abs(m-g[s]))}const b=new Set,x=new Set;function v(e){sa(e,1),e.m(s,d),a.set(e.key,e),d=e.first,p--}for(;h&&p;){const t=$[p-1],o=e[h-1],i=t.key,n=o.key;t===o?(d=t.first,h--,p--):f.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];f.has(t.key)||l(t,a)}for(;p;)v($[p-1]);return $}function ga(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 $a(e){return"object"==typeof e&&null!==e?e:{}}function fa(e,t,o){const i=e.$$.props[t];void 0!==i&&(e.$$.bound[i]=o,o(e.$$.ctx[i]))}function ya(e){e&&e.c()}function ba(e,t,o,i){const{fragment:n,after_update:r}=e.$$;n&&n.m(t,o),i||Yr((()=>{const t=e.$$.on_mount.map(Bn).filter(Vn);e.$$.on_destroy?e.$$.on_destroy.push(...t):Wn(t),e.$$.on_mount=[]})),r.forEach(Yr)}function xa(e,t){const o=e.$$;null!==o.fragment&&(Wn(o.on_destroy),o.fragment&&o.fragment.d(t),o.on_destroy=o.fragment=null,o.ctx=[])}function va(e,t,o,i,n,r,a,s=[-1]){const l=Pr;Er(e);const c=e.$$={fragment:null,ctx:[],props:r,update:zn,not_equal:n,bound:_n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:_n(),dirty:s,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let d=!1;if(c.ctx=o?o(e,t.props||{},((t,o,...i)=>{const r=i.length?i[0]:o;return c.ctx&&n(c.ctx[t],c.ctx[t]=r)&&(!c.skip_bound&&c.bound[t]&&c.bound[t](r),d&&function(e,t){-1===e.$$.dirty[0]&&(Vr.push(e),Xr(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),o})):[],c.update(),d=!0,Wn(c.before_update),c.fragment=!!i&&i(c.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);c.fragment&&c.fragment.l(e),e.forEach(ur)}else c.fragment&&c.fragment.c();t.intro&&sa(e.$$.fragment),ba(e,t.target,t.anchor,t.customElement),ea()}Er(l)}class wa{$destroy(){xa(this,1),this.$destroy=zn}$on(e,t){if(!Vn(t))return zn;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 Sa=[];function ka(e,t){return{subscribe:Ca(e,t).subscribe}}function Ca(e,t=zn){let o;const i=new Set;function n(t){if(Nn(e,t)&&(e=t,o)){const t=!Sa.length;for(const t of i)t[1](),Sa.push(t,e);if(t){for(let e=0;e<Sa.length;e+=2)Sa[e][0](Sa[e+1]);Sa.length=0}}}return{set:n,update:function(t){n(t(e))},subscribe:function(r,a=zn){const s=[r,a];return i.add(s),1===i.size&&(o=t(n)||zn),r(e),()=>{i.delete(s),0===i.size&&(o(),o=null)}}}}function Ma(e,t,o){const i=!Array.isArray(e),n=i?[e]:e,r=t.length<2;return ka(o,(e=>{let o=!1;const a=[];let s=0,l=zn;const c=()=>{if(s)return;l();const o=t(i?a[0]:a,e);r?e(o):l=Vn(o)?o:zn},d=n.map(((e,t)=>Hn(e,(e=>{a[t]=e,s&=~(1<<t),o&&c()}),(()=>{s|=1<<t}))));return o=!0,c(),function(){Wn(d),l()}}))}var Ta=e=>e.reduce(((e,t)=>Object.assign(e,t)),{});const Pa=e=>({updateValue:e}),Ra=e=>({defaultValue:e}),Ia=e=>({store:e}),Aa=e=>({store:(t,o)=>Ma(...e(o))}),Ea=e=>({store:(t,o)=>{const[i,n,r=(()=>!1)]=e(o);let a,s=!0;return Ma(i,((e,t)=>{n(e,(e=>{!s&&r(a,e)||(a=e,s=!1,t(e))}))}))}}),La=e=>({store:(t,o)=>{const[i,n={},r]=e(o);let a=[];const s={},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}=Ca(t||[]);return{set:c,update:e=>c(e(a)),subscribe:u}}});var Fa=e=>{const t={},o={};return e.forEach((([e,...i])=>{const n=Ta(i),r=t[e]=((e,t,o)=>{const{store:i=(e=>Ca(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):Z;return s.set=e=>c((t=>h(e,t,u))),s.defaultValue=n,s})(o,t,n),s={get:()=>jn(r),set:r.set};Object.defineProperty(o,e,s)})),{stores:t,accessors:o}};var za=[["src",Ia((()=>{let e;const{subscribe:t,set:o}=Ca(),i=t=>{e!==t&&(e=t,o(e))};return{set:i,subscribe:t,update:t=>i(t(e))}}))],["imageReader"],["imageWriter"],["imageScrambler"],["imageRedactionRendering",Ra((()=>"pixelated"))],["images",Ra((()=>[]))],["shapePreprocessor"],["willRequestResource"],["willRequest"]],Da=e=>e.charAt(0).toUpperCase()+e.slice(1),Oa=(e,t)=>{Object.keys(t).forEach((o=>{const i=R(t[o])?{value:t[o],writable:!1}:t[o];Object.defineProperty(e,o,i)}))};const Ba=(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},_a=1e4;var Wa=(e,t)=>{const o=It(t),i=de();vt(e).forEach((e=>{ve(e,i),Ba(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)*_a,r=Math.cos(Math.PI-o)*_a,a=ue(e.x+n,e.y+r),s=Ge(Xe(t),_a),l=Mt(Ze(e,a),s);l&&ve(i,we(pe(l),e))}))}));const n=Ke(e);ve(n,i);return!!vt(n).every((e=>Ba(e,t)))&&(mt(e,n),!0)},Va=(e,t)=>{const o=vt(e),i=At(t,5),n=rt(e),r=[];o.forEach((e=>{const t=((e,t)=>{if(0===t)return e;const o=ue(e.start.x-e.end.x,e.start.y-e.end.y),i=fe(o),n=ke(i,t);return e.end.x+=n.x,e.end.y+=n.y,e})(Ze(pe(n),pe(e)),1e6);let o=!1;i.map(Xe).forEach((e=>{const i=Mt(t,e);i&&!o&&(r.push(i),o=!0)}))}));const a=Pe(r[0],r[2])<Pe(r[1],r[3])?[r[0],r[2]]:[r[1],r[3]],s=tt(a);return s.width<e.width&&(mt(e,s),!0)},Na=(e,t,o={x:0,y:0})=>{const i=Qe(e),n=rt(i),r=St(i,o,n).map((e=>ge(e,t,n))),a=tt(r);return r.map((e=>we(e,a)))},Ha=(e,t=0,o=ht(e))=>{let i,n;if(0!==t){const r=Math.atan2(1,o),a=Math.sign(t)*t,s=a%Math.PI,l=a%G;let c;c=s>Y&&s<G+Y?l>Y?a:G-l:l>Y?G-l:a;const d=Math.min(Math.abs(e.height/Math.sin(r+c)),Math.abs(e.width/Math.cos(r-c)));i=Math.cos(r)*d,n=i/o}else i=e.width,n=i/o,n>e.height&&(n=e.height,i=n*o);return _e(i,n)},ja=(e,t,o,i,n,r,a,s)=>{const l=Fe(a),c=Fe(s),d=se(Math.max(t.width/c.width,t.height/c.height)),u=se(Math.min(t.width/l.width,t.height/l.height)),h=Ke(t);if(u<1||d>1){const o=rt(e),i=rt(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;pt(h,r-.5*s,a-.5*l,s,l)}return r?(((e,t,o=0,i=de(),n)=>{if(Mo(o)&&0!==o||i.x||i.y){const n=ht(e),r=Na(t,o,i),a=Ha(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)}Wa(e,r),Va(e,r)&&Wa(e,r)}else{const o=ht(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=rt(e),r=bt(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,mt(e,r)}})(h,o,i,n,l),{crop:h}):{crop:h}},Ua=(e,t,o)=>{const i=Qe(e),n=rt(i),r=gt(i,o,n),a=rt(kt(tt(r))),s=rt(t),l=ge(s,-o,a),c=we(l,a),d=xe(ve(n,c),se);return nt(d.x-.5*t.width,d.y-.5*t.height,t.width,t.height)},Za=(e,t,o)=>Math.max(t,Math.min(e,o));const Xa=["cropLimitToImage","cropMinSize","cropMaxSize","cropAspectRatio","flipX","flipY","rotation","crop","colorMatrix","convolutionMatrix","gamma","vignette","redaction","annotation","decoration","frame","backgroundColor","backgroundImage","targetSize","metadata","trim","volume"],Ga=e=>Ro(e)?e.map(Ga):no(e)||zt(e)?e:C(e)?{...e}:e,Ya=e=>e.map((e=>Object.entries(e).reduce(((e,[t,o])=>(t.startsWith("_")||(e[t]=o),e)),{})));const qa=(e,t)=>e===t;var Ka=(e,t,o=qa)=>{if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!o(e[i],t[i]))return!1;return!0};const Ja=(e,t,o)=>{const i=xe(rt(e),(e=>se(e,8))),n=Qe(t),r=rt(n),a=gt(n,o,r),s=xe(Ne(tt(a)),(e=>se(e,8))),l=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y);return l<1&&c<1},Qa=(e,t,o,i,n)=>{if(!n)return[-1/0,1/0];const r=Math.max(o.width/i.width,o.height/i.height),a=_e(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[-1/0,1/0];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[-1/0,1/0];const m=Number.isNaN(h)?p:Number.isNaN(p)?h:Math.min(h,p);return[-m,m]},es=(e,t)=>{const{context:o,props:i}=t;return e._isFormatted||((e=Ki(e))._isFormatted=!0,Object.assign(e,i)),e._isDraft||!Ei(e)||e._context&&ut(o,e._context)||(un(e,o),e._context={...o}),e};var ts=[["file"],["size"],["loadState"],["processState"],["aspectRatio",Aa((({size:e})=>[e,e=>e?ht(e):void 0]))],["perspectiveX",Ra((()=>0))],["perspectiveY",Ra((()=>0))],["perspective",Aa((({perspectiveX:e,perspectiveY:t})=>[[e,t],([e,t])=>({x:e,y:t})]))],["rotation",Ra((()=>0)),Pa((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=u&&((e,t,o)=>{const i=Ha(t,o,ht(e));return We(Ue(i,Math.round),Ue(Fe(e),Math.round))})(c,r,o),m=u&&Ja(c,r,o),g=((e,t,o,i,n,r,a,s,l,c)=>{const d=Fe(l),u=Fe(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=Ua(n,i,t),c=Qe(n),m=rt(c),g=St(c,r,m),$=we(pe(m),Ct(g)),f=ge(rt(l),o,m),y=we(pe(m),f);g.forEach((e=>ge(e,o,m)));const b=tt(g),x=Ct(g),v=ve(we(we(x,y),b),$),w=nt(v.x-.5*l.width,v.y-.5*l.height,l.width,l.height);if(s&&st(w,s.width/w.width),a){const e=Na(n,o,r);Va(w,e)}const S=se(Math.min(w.width/d.width,w.height/d.height),8),k=se(Math.max(w.width/u.width,w.height/u.height),8);return(S<1||k>1)&&se(Math.abs(o-t))===se(Math.PI/2)&&!h?(h=!0,p(e,e+Math.sign(o-t)*Math.PI)):{rotation:o,crop:wt(w,(e=>se(e,8)))}},m=Math.sign(t)*Math.round(Math.abs(t)/G)*G,g=Za(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=Ha(r,t,ht(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=wt(g.crop,(e=>se(e,8)))})),g.rotation}))],["flipX",Ra((()=>!1))],["flipY",Ra((()=>!1))],["flip",Aa((({flipX:e,flipY:t})=>[[e,t],([e,t])=>({x:e,y:t})]))],["isRotatedSideways",Ea((({rotation:e})=>[[e],([e],t)=>t(q(e)),(e,t)=>e!==t]))],["crop",Pa((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=Qe(Ha(n,c,l||ht(n))));const u=ja(o,t,n,c,d,s,r,a),h=wt(u.crop,(e=>se(e,8)));return ut(o,h)?o:h}))],["cropAspectRatio",Pa((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(Ja(n,r,a)&&s&&c>=.1){const o=((e,t)=>{const o=e.width,i=e.height;return q(t)&&(e.width=i,e.height=o),e})(Fe(r),a);e.crop=wt(bt(Qe(o),t),se)}else{const t={width:n.height*l,height:n.height},o=.5*(n.width-t.width),i=.5*(n.height-t.height);e.crop=wt(nt(n.x+o,n.y+i,t.width,t.height),se)}return l}))],["cropOrigin"],["cropMinSize",Ra((()=>({width:1,height:1})))],["cropMaxSize",Ra((()=>({width:32768,height:32768})))],["cropLimitToImage",Ra((()=>!0)),Pa((e=>(t,o,i)=>{const{crop:n}=e;return n?(!o&&t&&i((()=>e.crop=Ke(e.crop))),t):t}))],["cropSize",Ea((({crop:e})=>[[e],([e],t)=>{e&&t(_e(e.width,e.height))},(e,t)=>We(e,t)]))],["cropRectAspectRatio",Aa((({cropSize:e})=>[[e],([e],t)=>{e&&t(se(ht(e),5))}]))],["cropRange",Ea((({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=Fe(i),s=Fe(n);return r?[a,Ue(Ha(e,t,o),Math.round)]:[a,s]})(e,t,o,i,n,r))},(e,t)=>Ka(e,t)]))],["rotationRange",Ea((({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(Qa(e,t,o,i,n))},(e,t)=>Ka(e,t)]))],["backgroundColor",Pa((()=>e=>((e=[0,0,0,0],t=1)=>4===e.length?e:[...e,t])(e)))],["backgroundImage"],["targetSize"],["colorMatrix"],["convolutionMatrix"],["gamma"],["noise"],["vignette"],["duration"],["minDuration",Ra((()=>1))],["maxDuration",Ra((()=>1/0))],["trim"],["volume"],["redaction",La((({size:e})=>[es,{context:e}]))],["annotation",La((({size:e})=>[es,{context:e}]))],["decoration",La((({crop:e})=>[es,{context:e}]))],["frame",Pa((()=>e=>{if(!e)return;const t={frameStyle:void 0,x:0,y:0,width:"100%",height:"100%",disableStyle:["backgroundColor","strokeColor","strokeWidth"]};return P(e)?t.frameStyle=e:Object.assign(t,e),t}))],["metadata"],["state",Ia(((e,t,o)=>{const i=Xa.map((e=>t[e]));let n=!1;const r=Ca({}),{subscribe:a}=Ma([...i,r],((e,t)=>{if(n)return;const o=Xa.reduce(((t,o,i)=>(t[o]=Ga(e[i]),t)),{});o.crop&&wt(o.crop,Math.round),o.redaction=o.redaction&&Ya(o.redaction),o.annotation=o.annotation&&Ya(o.annotation),o.decoration=o.decoration&&Ya(o.decoration),t(o)})),s=e=>{e&&(n=!0,o.cropOrigin=void 0,Xa.filter((t=>Po(e,t))).forEach((t=>{const i=e[t];o[t]=null===i?void 0:Ga(i)})),n=!1,r.set({}))};return{set:s,update:e=>s(e(null)),subscribe:a}}))]],os=async(e,t,o={},i)=>{const{ontaskstart:n,ontaskprogress:r,ontaskend:s,token:l}=i;let c=!1;const d={cancel:a};l.cancel=()=>{c=!0,d.cancel()};for(const[i,a]of t.entries()){if(c)return;const[t,l]=a;n(i,l);try{e=await t(e,{...o,taskCancelToken:d},(e=>r(i,l,e)))}catch(e){throw c=!0,e}s(i,l)}return e};const is=["loadstart","loadabort","loaderror","loadprogress","load","processstart","processabort","processerror","processprogress","process"],ns=["flip","cropOrigin","isRotatedSideways","perspective","perspectiveX","perspectiveY","cropRange"],rs=["images"],as=ts.map((([e])=>e)).filter((e=>!ns.includes(e))),ss=e=>"image"+Da(e),ls=e=>Po(e,"crop");var cs=()=>{const{stores:e,accessors:t}=Fa(za),{sub:o,pub:i}=No(),n=()=>t.images?t.images[0]:{};let r={};const s={};as.forEach((e=>{Object.defineProperty(t,ss(e),{get:()=>{const t=n();if(t)return t.accessors[e]},set:t=>{r[ss(e)]=t,s[ss(e)]=t;const o=n();o&&(o.accessors[e]=t)}})}));const l=()=>t.images&&t.images[0],c=e.src.subscribe((e=>{if(!e)return t.images=[];t.imageReader&&(t.images.length&&(r={}),u(e))})),d=e.imageReader.subscribe((e=>{e&&(t.images.length||t.src&&u(t.src))})),u=e=>{Promise.resolve().then((()=>p(e,r))).catch((()=>{}))};let h;const p=(e,o={})=>new Promise(((n,c)=>{let d=l();const u=!(!1===o.cropLimitToImage||!1===o.imageCropLimitToImage||!1===s.imageCropLmitedToImage),p=o.cropMinSize||o.imageCropMinSize||s.imageCropMinSize,m=u?p:d&&d.accessors.cropMinSize,$=o.minDuration||o.imageMinDuration;d&&g(),d=(({minSize:e={width:1,height:1},minDuration:t=0}={})=>{const{stores:o,accessors:i}=Fa(ts),{pub:n,sub:r}=No(),s=(e,t)=>{const o=()=>i[e]||{},r=t=>{i[e]={...o(),...t,timeStamp:Date.now()}},a=()=>o().error,s=e=>{a()||(r({error:e}),n(t+"error",{...o()}))};return{start(){n(t+"start")},onabort(){r({abort:!0}),n(t+"abort",{...o()})},ontaskstart(e,i){a()||(r({index:e,task:i,taskProgress:void 0,taskLengthComputable:void 0}),n(t+"taskstart",{...o()}))},ontaskprogress(e,i,s){a()||(r({index:e,task:i,taskProgress:s.loaded/s.total,taskLengthComputable:s.lengthComputable}),n(t+"taskprogress",{...o()}),n(t+"progress",{...o()}))},ontaskend(e,i){a()||(r({index:e,task:i}),n(t+"taskend",{...o()}))},ontaskerror(e){s(e)},error(e){s(e)},beforeComplete(e){a()||(r({beforeComplete:!0}),n("before"+t,e))},complete(e){a()||(r({complete:!0}),n(t,e))}}};return Oa(i,{read:(o,{reader:n},r={})=>{if(!n)return;Object.assign(i,{file:void 0,size:void 0,loadState:void 0});let l={cancel:a},c=!1;const d=s("loadState","load"),u={token:l,...d},h={src:o,size:void 0,dest:void 0,duration:void 0};return Promise.resolve().then((async()=>{try{if(d.start(),c)return d.onabort();const o=await os(h,n,r,u);if(c)return d.onabort();const{size:a,duration:s,dest:p}=o||{};if(!a||!a.width||!a.height)throw new to("Image size missing","IMAGE_SIZE_MISSING",o);if(s>0&&s<t)throw new to("Video too short","VIDEO_TOO_SHORT",{...o,minDuration:t});if(a.width<e.width||a.height<e.height)throw new to("Image too small","IMAGE_TOO_SMALL",{...o,minWidth:e.width,minHeight:e.height});Object.assign(i,{file:p,size:a,duration:s}),d.beforeComplete(o),d.complete(o)}catch(e){d.error(e)}finally{l=void 0}})),()=>{c=!0,l&&l.cancel(),d.onabort()}},write:(e,t)=>{if(!i.loadState.complete)return;i.processState=void 0;const o=s("processState","process"),n={src:i.file,imageState:i.state,dest:void 0};if(R(e)&&(e=e(i.file,i.state)),!e)return o.start(),void o.complete(n);let r={cancel:a},l=!1;const c=t,d={token:r,...o};return Promise.resolve().then((async()=>{try{if(o.start(),l)return o.onabort();const t=await os(n,e,c,d);if(l)return o.onabort();o.complete(t)}catch(e){o.error(e)}finally{r=void 0}})),()=>{l=!0,r&&r.cancel()}},on:r}),{accessors:i,stores:o}})({minSize:m,minDuration:$}),is.map((e=>{return d.accessors.on(e,(t=e,e=>i(t,e)));var t}));const f=()=>{r={},y.forEach((e=>e()))},y=[];y.push(d.accessors.on("loaderror",(e=>{f(),c(e)}))),y.push(d.accessors.on("loadabort",(()=>{f(),c({name:"AbortError"})}))),y.push(d.accessors.on("load",(e=>{h=void 0,f(),n(e)}))),y.push(d.accessors.on("beforeload",(()=>((e,o)=>{if(ls(o))return void(t.imageState=o);if(!o.imageCrop){const t=e.accessors.size,i=o.imageRotation||0,n=He(Fe(t),i),r=Qe(n);r.width=se(Math.abs(r.width),6),r.height=se(Math.abs(r.height),6);const a=o.imageCropAspectRatio||(o.imageCropLimitToImage?ht(t):ht(r));let s;o.imageCropLimitToImage?s=bt(r,a):(s=yt(r,a),s.x=(t.width-s.width)/2,s.y=(t.height-s.height)/2),o.imageCrop=s}const i=["imageCropLimitToImage","imageCrop","imageCropAspectRatio","imageRotation"];i.filter((e=>Po(o,e))).forEach((e=>{t[e]=o[e],delete o[e]}));const n=Object.keys(o).filter((e=>!i.includes(e))).reduce(((e,t)=>(e[t]=o[t],e)),{});Object.assign(t,n)})(d,o)))),t.images=[d],o.imageReader&&(t.imageReader=o.imageReader),o.imageWriter&&(t.imageWriter=o.imageWriter),h=d.accessors.read(e,{reader:t.imageReader},{willRequest:t.willRequest})}));let m;const g=()=>{const e=l();e&&(h&&h(),e.accessors.loadState=void 0,t.images=[])};return Object.defineProperty(t,"stores",{get:()=>e}),Oa(t,{on:o,loadImage:p,abortLoadImage:()=>{h&&h(),t.images=[]},editImage:(e,o)=>new Promise(((i,n)=>{p(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:g,processImage:(e,o)=>new Promise(((i,n)=>{try{const r=[],a=()=>{m=void 0,r.forEach((e=>e()))};(async()=>{if((e=>P(e)||zo(e)||Ft(e))(e))try{await p(e,o)}catch(e){n(e)}else e&&(ls(e)?t.imageState=e:Object.assign(t,e));const s=l();if(!s)return n("no image");r.push(s.accessors.on("processerror",(e=>{a(),n(e)}))),r.push(s.accessors.on("processabort",(()=>{a(),n({name:"AbortError"})}))),r.push(s.accessors.on("process",(e=>{a(),i(e)}))),m=s.accessors.write(t.imageWriter,{redactionRenderStyle:t.imageRedactionRendering,shapePreprocessor:t.shapePreprocessor||Z,imageScrambler:t.imageScrambler,willRequest:t.willRequest,willRequestResource:t.willRequestResource})})()}catch(e){n(e)}})),abortProcessImage:()=>{const e=l();e&&(m&&m(),e.accessors.processState=void 0)},destroy:()=>{c&&c(),d&&d()}}),t};const ds=(e,t)=>{const{processImage:o}=cs();return o(e,t)};var us=()=>Ht()?uo()?/15_|16_/.test(navigator.userAgent)?14745600:16777216:/15_/.test(navigator.userAgent)?16777216:1/0:1/0,hs=(e,t)=>Object.keys(e).filter((e=>!t.includes(e))).reduce(((t,o)=>(t[o]=e[o],t)),{}),ps=e=>new Promise((t=>{if(e.duration===1/0)return e.ontimeupdate=()=>{e.ontimeupdate=void 0,t(e)},void(e.currentTime=Number.MAX_SAFE_INTEGER);t(e)}));const ms=({imageDataResizer:e,canvasMemoryLimit:t}={})=>async(o,i,n,r)=>{n.width=Math.max(n.width,1),n.height=Math.max(n.height,1),r.width=Math.max(r.width,1),r.height=Math.max(r.height,1);const{dest:a}=await ds(i,{imageReader:Hs(),imageWriter:Us({format:"canvas",targetSize:{...r,upscale:!0},imageDataResizer:e,canvasMemoryLimit:t}),imageCrop:n});o.drawImage(a,r.x,r.y,r.width,r.height),f(a)},gs=(e,t=((...e)=>e),o)=>async(i,n,r)=>{r(Kt(0,!1));let a=!1;const s=await e(...t(i,n,(e=>{a=!0,r(e)})));return o&&o(i,s),a||r(Kt(1,!1)),i},$s=({willRequest:e,srcProp:t="src",destProp:o="dest"}={})=>[gs(ao,((o,i,n)=>[o[t],n,{...i,willRequest:e}]),((e,t)=>e[o]=t)),"any-to-file"],fs=({srcProp:e="dest",destProp:t="dest"}={})=>[gs((async e=>{if(/octet-stream/.test(e.type)){console.warn(`Pintura: File has unknown mime type "${e.type}", make sure your server sets the correct Content-Type header.`);let t="image";const o=await Xt(e);/video/i.test(o.nodeName)&&(t="video");const i={type:t+"/unknown"};return zt(e)?new File([e],e.name,{...i,lastModified:e.lastModified}):new Blob([e],i)}return e}),(t=>[t[e]]),((e,o)=>e[t]=o)),"any-to-file"],ys=({srcProp:e="src",destProp:t="size"}={})=>[gs(Yt,(t=>[t[e]]),((e,o)=>e[t]=o)),"read-image-size"],bs=async e=>{const t=await Xt(e);if(Gt(t))return await(e=>new Promise(((t,o)=>{const i=()=>{ps(e).then((()=>{t(e.duration)}))};if(e.readyState>=1)return i();e.onloadedmetadata=i,e.onerror=()=>o(e.error)})))(t)},xs=({srcProp:e="src",destProp:t="duration"}={})=>[gs(bs,(t=>[t[e]]),((e,o)=>e[t]=o)),"read-media-duration"],vs=({srcSize:e="size",srcOrientation:t="orientation",destSize:o="size"}={})=>[gs(ho,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"image-size-match-orientation"],ws=({srcProp:e="src",destProp:t="head"}={})=>[gs(((e,t)=>po(e)?l(e,t):void 0),(t=>[t[e],[0,262144],onprogress]),((e,o)=>e[t]=o)),"read-image-head"],Ss=({srcProp:e="head",destProp:t="orientation"}={})=>[gs(i,(t=>[t[e],274]),((e,o=1)=>e[t]=o)),"read-exif-orientation-tag"],ks=({srcProp:e="head"}={})=>[gs(i,(t=>[t[e],274,1])),"clear-exif-orientation-tag"],Cs=({srcImageSize:e="size",srcCanvasSize:t="imageData",srcImageState:o="imageState",destImageSize:i="size",destScalar:n="scalar"}={})=>[gs(((e,t)=>[Math.min(t.width/e.width,t.height/e.height),ze(t)]),(i=>[i[e],i[t],i[o]]),((e,[t,o])=>{e[n]=t,e[i]=o})),"calculate-canvas-scalar"],Ms=({srcProp:e="src",destProp:t="imageData",canvasMemoryLimit:o}={})=>[gs(D,(t=>[t[e],o]),((e,o)=>e[t]=o)),"blob-to-image-data"],Ts=({srcImageData:e="imageData",srcOrientation:t="orientation"}={})=>[gs(k,(o=>[o[e],o[t]]),((e,t)=>e.imageData=t)),"image-data-match-orientation"],Ps=({srcImageData:e="imageData",srcImageState:t="imageState"}={})=>[gs(En,(o=>[o[e],{backgroundColor:o[t].backgroundColor,backgroundImage:o[t].backgroundImage}]),((e,t)=>e.imageData=t)),"image-data-fill"],Rs=({srcImageData:e="imageData",srcImageState:t="imageState",destScalar:o="scalar"}={})=>[gs($o,(i=>{const n=i[o];let{crop:r}=i[t];return r&&1!==n&&(r=st(Ke(r),n,de())),[i[e],{crop:r,rotation:i[t].rotation,flipX:i[t].flipX,flipY:i[t].flipY}]}),((e,t)=>e.imageData=t)),"image-data-crop"],Is=({targetSize:e={width:void 0,height:void 0,fit:void 0,upscale:void 0},imageDataResizer:t,srcProp:o="imageData",srcImageState:i="imageState",destImageScaledSize:n="imageScaledSize"})=>[gs(bo,(n=>{const r=Math.min(e.width||Number.MAX_SAFE_INTEGER,n[i].targetSize&&n[i].targetSize.width||Number.MAX_SAFE_INTEGER),a=Math.min(e.height||Number.MAX_SAFE_INTEGER,n[i].targetSize&&n[i].targetSize.height||Number.MAX_SAFE_INTEGER);return[n[o],{width:r,height:a,fit:e.fit||"contain",upscale:(s=n[i],!!(s.targetSize&&s.targetSize.width||s.targetSize&&s.targetSize.height)||(e.upscale||!1))},t];var s}),((e,t)=>{We(e.imageData,t)||(e[n]=ze(t)),e.imageData=t})),"image-data-resize"],As=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData"}={})=>[gs(Co,(o=>{const{colorMatrix:i}=o[t],n=i&&Object.keys(i).map((e=>i[e])).filter(Boolean);return[o[e],{colorMatrix:n&&Ln(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"],Es=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destScalar:i="scalar"}={})=>[gs((async(e,t,o,i,n,r)=>{if(!t||!i.length)return e;let a;try{const n={dataSizeScalar:Fn(e,i)};o&&o[3]>0&&(n.backgroundColor=[...o]),a=await t(e,n)}catch(e){}const s=g("canvas");s.width=e.width,s.height=e.height;const l=s.getContext("2d",{willReadFrequently:!0});if(l.putImageData(e,0,0),"auto"===r){const t=Math.sqrt(e.width*e.height);l.filter=`blur(${Math.round(t/100)}px)`}const c=new Path2D;i.forEach((e=>{const t=nt(e.x,e.y,e.width,e.height);dt(t,n);const o=gt(Ke(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)})),c.addPath(i)})),l.clip(c,"nonzero"),l.imageSmoothingEnabled=!1,l.drawImage(a,0,0,s.width,s.height),f(a);const d=l.getImageData(0,0,s.width,s.height);return f(s),d}),((o,{imageScrambler:n,redactionRenderStyle:r})=>[o[e],n,o[t].backgroundColor,o[t].redaction,o[i],r]),((e,t)=>e[o]=t)),"image-data-redact"],Ls=({srcImageData:e="imageData",srcSize:t="size",srcImageState:o="imageState",destImageData:i="imageData",destImageScaledSize:n="imageScaledSize",destScalar:r="scalar",imageDataResizer:a,canvasMemoryLimit:s}={})=>[gs(An,((i,{shapePreprocessor:l,willRequestResource:c,willRequest:d})=>{const{annotation:u}=i[o];if(!u.length)return[i[e]];const h=i[r],{crop:p}=i[o],m=i[t];let g=h;const $=i[n];$&&(g=Math.min($.width/p.width,$.height/p.height));const f={width:m.width/h,height:m.height/h};return[i[e],{shapes:u,computeShape:e=>(e=nn(e,f),e=hs(e,["left","right","top","bottom"]),e=hn(e,g)),transform:e=>{const a=i[t],{rotation:s=0,flipX:l,flipY:c,cropLimitToImage:d}=i[o],u=i[r],{crop:h=Qe(a)}=i[o],p=i[n],m=p?Math.min(p.width/h.width,p.height/h.height):1,g={width:a.width/u*m,height:a.height/u*m},$=Lt(g,s),f=$.width,y=$.height,b=.5*g.width-.5*f,x=.5*g.height-.5*y,v=Ne(g);e.translate(-b,-x),e.translate(-h.x*m,-h.y*m),e.translate(v.x,v.y),e.rotate(s),e.translate(-v.x,-v.y),e.scale(l?-1:1,c?-1:1),e.translate(l?-g.width:0,c?-g.height:0),d&&(e.rect(0,0,g.width,g.height),e.clip())},drawImage:ms({imageDataResizer:a,canvasMemoryLimit:s}),preprocessShape:e=>l(e,{isPreview:!1,...i[o]}),canvasMemoryLimit:s,willRequest:d||c}]}),((e,t)=>e[i]=t)),"image-data-annotate"],Fs=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize",imageDataResizer:n,canvasMemoryLimit:r,destScalar:a="scalar"}={})=>[gs(An,((o,{shapePreprocessor:s,willRequestResource:l,willRequest:c})=>{let{decoration:d}=o[t];if("undefined"!=typeof window&&(e=>{if(e&&e._uahonds)return;const[i]=[[85,110,108,105,99,101,110,115,101,100,32,80,105,110,116,117,114,97,32,105,110,115,116,97,110,99,101,32]].map((e=>e.map((e=>String.fromCharCode(e))).join(""))),{width:n,height:r}=o[t].crop,a=r/15;d=[...d,{x:.5*-a,y:.5*-a,width:1.5*n,height:1.25*r,text:Array(50).fill(i).join(""),fontWeight:900,lineHeight:a,fontSize:a,color:[1,1,1,.05]}]})(window),!d.length)return[o[e]];let u=o[a];const{crop:h}=o[t],p=o[i];if(p){const e=Math.min(p.width/h.width,p.height/h.height);u=e}return[o[e],{shapes:d,drawImage:ms({imageDataResizer:n,canvasMemoryLimit:r}),computeShape:e=>(e=nn(e,h),e=hs(e,["left","right","top","bottom"]),e=hn(e,u)),preprocessShape:e=>s(e,{isPreview:!1,...o[t]}),canvasMemoryLimit:r,willRequest:c||l}]}),((e,t)=>e[o]=t)),"image-data-decorate"],zs=({srcImageData:e="imageData",srcImageState:t="imageState",destImageData:o="imageData",destImageScaledSize:i="imageScaledSize",imageDataResizer:n,canvasMemoryLimit:r,destScalar:a="scalar"}={})=>[gs(An,((o,{shapePreprocessor:s,willRequestResource:l,willRequest:c})=>{const d=o[t].frame;if(!d)return[o[e]];const u=o[a];let{crop:h}=o[t];h&&1!==u&&(h=st(Ke(h),u,de()));const p={...h},m=cn(dn(d,p,s),p);p.x=Math.abs(m.left),p.y=Math.abs(m.top),p.width+=Math.abs(m.left)+Math.abs(m.right),p.height+=Math.abs(m.top)+Math.abs(m.bottom);const g=o[i],$=g?Math.min(g.width/h.width,g.height/h.height):1;return dt(p,$),p.x=Math.floor(p.x),p.y=Math.floor(p.y),p.width=Math.floor(p.width),p.height=Math.floor(p.height),[o[e],{shapes:[d],contextBounds:p,computeShape:t=>nn(t,o[e]),transform:e=>{e.translate(p.x,p.y)},drawImage:ms({imageDataResizer:n,canvasMemoryLimit:r}),preprocessShape:e=>s(e,{isPreview:!1,...o[t]}),canvasMemoryLimit:r,willRequest:c||l}]}),((e,t)=>e[o]=t)),"image-data-frame"],Ds=({mimeType:e,quality:t,srcImageData:o="imageData",srcFile:i="src",destBlob:n="blob"}={})=>[gs(B,(n=>[n[o],e||H(n[i].name)||n[i].type,t]),((e,t)=>e[n]=t)),"image-data-to-blob"],Os=({srcImageData:e="imageData",srcOrientation:t="orientation",destCanvas:o="dest"}={})=>[gs(S,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"image-data-to-canvas"],Bs=async(e,t)=>{if(!po(e)||!t)return e;const i=new DataView(t),n=o(i);if(!n||!n.exif)return e;const r=["exif","mpf","xmp"].reduce(((e,t)=>n[t]?Math.max(e,n[t].offset+n[t].size):e),0);return((e,t,o=[0,e.size])=>t?new Blob([t,e.slice(...o)],{type:e.type}):e)(e,t.slice(0,r+2),[20])},_s=(e="blob",t="head",o="blob")=>[gs(Bs,(o=>[o[e],o[t]]),((e,t)=>e[o]=t)),"blob-write-image-head"],Ws=({renameFile:e,srcBlob:t="blob",srcFile:o="src",destFile:i="dest",defaultFilename:n}={})=>[gs(j,(i=>[i[t],e?e(i[o]):i[o].name||`${n}.${W(i[t].type)}`]),((e,t)=>e[i]=t)),"blob-to-file"],Vs=({url:e="./",dataset:t=(e=>[["dest",e.dest,e.dest.name],["imageState",e.imageState]]),destStore:o="store",credentials:i,headers:n={}})=>[gs((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 instanceof FormData?t:t.reduce(((e,t)=>(e.append(...t.map(mo)),e)),new FormData))})))(e,t,{onprogress:o,beforeSend:e=>oo(e,{headers:n,credentials:i})})),((e,o,i)=>[t(e),i]),((e,t)=>e[o]=t)),"store"],Ns=e=>[gs((t=>e&&e.length?(Object.keys(t).forEach((o=>{e.includes(o)||delete t[o]})),t):t)),"prop-filter"],Hs=(e={})=>{const{orientImage:t=!0,outputProps:o=["src","dest","size","duration"],preprocessImageFile:i,request:n={}}=e;return[$s({willRequest:()=>n}),fs(),i&&[gs(i,((e,t,o)=>[e.dest,t,o]),((e,t)=>e.dest=t)),"preprocess-image-file"],ys({srcProp:"dest"}),xs({srcProp:"dest"}),t&&ws({srcProp:"dest"}),t&&Ss(),t&&vs(),Ns(o)].filter(Boolean)},js=e=>e&&(P(e)?Vs({url:e}):R(e)?[e,"store"]:Vs(e)),Us=(e={})=>(t,o,i={})=>{if(!Zt(t))return;const{canvasMemoryLimit:n=us(),orientImage:r=!0,copyImageHead:a=!0,mimeType:s,quality:l,renameFile:c,targetSize:d,imageDataResizer:u,store:h,format:p="file",outputProps:m=["src","dest","imageState","store"],preprocessImageSource:g,preprocessImageState:$,postprocessImageData:f,postprocessImageBlob:y}={...e,...i};return[g&&[gs(g,((e,t,o)=>[e.src,t,o,e.imageState]),((e,t)=>e.src=t)),"preprocess-image-source"],(r||a)&&ws(),r&&Ss(),ys(),$&&[gs($,((e,t,o,i)=>[e.imageState,t,o,{size:e.size,orientation:e.orientation}]),((e,t)=>e.imageState=t)),"preprocess-image-state"],Ms({canvasMemoryLimit:n}),r&&vs(),r&&Ts(),Cs(),Es(),Rs(),Is({imageDataResizer:u,targetSize:d}),As(),Ps(),Ls({imageDataResizer:u,canvasMemoryLimit:n}),Fs({imageDataResizer:u,canvasMemoryLimit:n}),zs({imageDataResizer:u,canvasMemoryLimit:n}),f&&[gs(f,((e,t,o)=>[e.imageData,t,o]),((e,t)=>e.imageData=t)),"postprocess-image-data"],"file"===p?Ds({mimeType:s,quality:l}):"canvas"===p?Os():[e=>(e.dest=e.imageData,e)],"file"===p&&r&&ks(),"file"===p&&a&&_s(),y&&[gs(y,(({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"===p&&Ws({defaultFilename:"image",renameFile:c}),"file"===p?js(h):R(h)&&[h,"store"],Ns(m)].filter(Boolean)};var Zs=(e,t,o,i,n,r,a,s,l,c,d)=>{if(!(e&&t&&o&&i&&s))return;s*=r;const u=kt(Ke(t)),h=rt(u),p=rt(e),m=Qe(o),g=rt(m),$=Ua(o,i,l),f=rt($),y=we(pe(g),f),b=we(pe(p),h);y.x+=b.x,y.y+=b.y;const x=me(pe(y));x.x+=b.x,x.y+=b.y;const v=rt(at(at(Ke(n),a),e)),w=we(v,p);return ve(y,w),{origin:x,translation:y,rotation:{x:d?Math.PI:0,y:c?Math.PI:0,z:l},scale:s}};let Xs=null;var Gs=()=>{if(null===Xs)if("WebGL2RenderingContext"in window){let e;try{e=g("canvas"),Xs=!!e.getContext("webgl2")}catch(e){Xs=!1}e&&f(e),e=void 0}else Xs=!1;return Xs},Ys=e=>0==(e&e-1),qs=(e,t={},o="",i="")=>Object.keys(t).filter((e=>!C(t[e]))).reduce(((e,n)=>e.replace(new RegExp(o+n+i),t[n])),e);const Ks={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);"},Js={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(uRepeat.y,vTexCoord.y))*step(0.0,vTexCoord.y)*(1.0-step(uRepeat.x,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>=.9999&&colorFlattened.g==0.0&&colorFlattened.b>=.9999){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)-1.0;vec2 p=r-s;float cornerRadius=uCornerRadius[0];bool left=r.x<s.x;bool top=r.y<s.y;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));"},Qs=(e,t,o)=>{const i=e.createShader(o),n=((e,t,o)=>(t=qs(t,o===e.VERTEX_SHADER?Ks:Js,"##").trim(),Gs()?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},el=(e,t,o,i,n)=>{const r=Qs(e,t,e.VERTEX_SHADER),a=Qs(e,o,e.FRAGMENT_SHADER),s=e.createProgram();e.attachShader(s,r),e.attachShader(s,a),e.linkProgram(s);const l={};return i.forEach((t=>{l[t]=e.getAttribLocation(s,t)})),n.forEach((t=>{l[t]=e.getUniformLocation(s,t)})),{program:s,locations:l,destroy(){e.detachShader(s,r),e.detachShader(s,a),e.deleteShader(r),e.deleteShader(a),e.deleteProgram(s)}}},tl=e=>"VIDEO"!==e.nodeName&&(!!Gs()||Ys(e.width)&&Ys(e.height)),ol=(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,tl(t)?e.LINEAR_MIPMAP_LINEAR:e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o.filterParam),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o.wrapParam),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o.wrapParam),tl(t)&&e.generateMipmap(e.TEXTURE_2D)})(e,o,i),e.bindTexture(e.TEXTURE_2D,null),t),il=(e,t=1)=>e?[e[0],e[1],e[2],Mo(e[3])?t*e[3]:t]:[0,0,0,0],nl=()=>{const e=new Float32Array(16);return e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},rl=(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},al=(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]},sl=(e,t)=>{e[0]*=t,e[1]*=t,e[2]*=t,e[3]*=t,e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t,e[8]*=t,e[9]*=t,e[10]*=t,e[11]*=t},ll=(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},cl=(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},dl=(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};var ul=e=>e*Math.PI/180,hl=(e,t)=>Gs()?e.getContext("webgl2",t):e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const pl=(e,t)=>{const o=e.length;return t>=o?e[t%o]:t<0?e[t%o+o]:e[t]},ml=(e,t,o,i)=>{const n=ue(o.x-t.x,o.y-t.y),r=ue(i.x-o.x,i.y-o.y),a=ue(t.x-i.x,t.y-i.y),s=ue(e.x-t.x,e.y-t.y),l=ue(e.x-o.x,e.y-o.y),c=ue(e.x-i.x,e.y-i.y),d=Me(n,s),u=Me(r,l),h=Me(a,c);return d<=0&&u<=0&&h<=0},gl=e=>{if(e.length<3)return[];if((e=>{const t=e.length;for(let o=0;o<t;o++){const t=Ze(e[o],pl(e,o+1));if(Pt(t,e,{ignoreIdenticalLines:!0,breakOnIntersection:!0}))return!0}return!1})(e))return[];(e=>{let t,o,i,n,r,a=0;const s=e.length;for(t=0;t<s;t++)o=e[t],i=e[(t+1)%s],n=i.x-o.x,r=(i.y+o.y)/2,a+=n*r;return a})(e)<0&&e.reverse();const t=e.length,o=[...Array(t).keys()],i=[];let n,r,a,s,l,c,d,u,h,p,m,g,$=128;for(;o.length>3;){if($<=0)return[];for($--,n=0;n<o.length;n++)if(a=o[n],s=pl(o,n-1),l=pl(o,n+1),c=e[a],d=e[s],u=e[l],h=ue(d.x-c.x,d.y-c.y),p=ue(u.x-c.x,u.y-c.y),!(Me(h,p)<0)){for(m=!0,r=0;r<t;r++)if(r!==a&&r!==s&&r!==l&&(g=e[r],ml(g,d,c,u))){m=!1;break}if(m){i.push([d,c,u]),o.splice(n,1);break}}}return i.push([e[o[0]],e[o[1]],e[o[2]]]),i},$l=(e,t,o,i,n)=>{const r=fe(ue(i.x-o.x,i.y-o.y)),a=fe(ue(n.x-i.x,n.y-i.y)),s=fe(ue(r.x+a.x,r.y+a.y)),l=ue(-s.y,s.x),c=ue(-r.y,r.x),d=Math.min(1/Ce(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},fl=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},yl=(e,t=0,o,i)=>{const n=vt(e),r=e.x+.5*e.width,a=e.y+.5*e.height;return(o||i)&&Ae(n,o,i,r,a),0!==t&&Ee(n,t,r,a),n},bl=(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*G+a*G,l=i*Math.cos(s),c=i*Math.sin(s),e.push(ue(t+l,o+c))};let xl=null;var vl=()=>{if(null!==xl)return xl;let e=g("canvas");const t=hl(e);return xl=t?t.getParameter(t.MAX_TEXTURE_SIZE):void 0,f(e),e=void 0,xl},wl=()=>u()&&!!window.chrome;const Sl=new Float32Array([0,1,0,0,1,1,1,0]),kl=new Float32Array([1,0,0,0,1,1,0,1]),Cl=u()&&jo(),Ml=[0,0,0,0,1,0,0,0,0],Tl=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],Pl=[0,0,0,0],Rl=[0,0,0,0],Il=(e,t,o,i,n)=>{if(!o||!i)return Sl;let r=i.x/o.width,a=i.y/o.height,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 Al=(e,t={})=>{const{alpha:o=!1}=t,i={width:0,height:0},n={width:0,height:0},r=vl()||1024;let a,s,l;const c=nl(),d=nl();let u,h,p,m,g,$,y,b,x,v=0,w=0,S=0,k=1;const C=new Map([]),M=()=>{R.stencilOp(R.KEEP,R.KEEP,R.KEEP),R.stencilFunc(R.ALWAYS,1,255),R.stencilMask(255)},T=ul(30),P=Math.tan(T/2),R=hl(e,{alpha:o,antialias:!1,premultipliedAlpha:!0,stencil:!0});if(!R)return;R.getExtension("OES_standard_derivatives"),R.disable(R.DEPTH_TEST),R.enable(R.STENCIL_TEST),R.enable(R.BLEND),R.blendFunc(R.ONE,R.ONE_MINUS_SRC_ALPHA),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!(!o&&jo())),M();const I=R.createTexture();R.bindTexture(R.TEXTURE_2D,I),R.texImage2D(R.TEXTURE_2D,0,R.RGBA,1,1,0,R.RGBA,R.UNSIGNED_BYTE,new Uint8Array(Pl)),C.set(0,I);const A=R.createTexture();C.set(2,A);const E=R.createFramebuffer(),L=R.createTexture();C.set(1,L);const F=R.createFramebuffer(),z=el(R,"\n##head\n##text\nvoid main(){vTexCoord=aTexCoord;gl_Position=uMatrix*aPosition;}","\n##head\nin vec2 vTexCoord;uniform sampler2D uTexture;uniform sampler2D uTextureOverlay;uniform sampler2D uTextureBlend;uniform vec2 uTextureSize;uniform float uOpacity;uniform int uAntialias;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){return(c*m)+(o*c.a);}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(clamp((colorSum/w),0.0,1.0).rgb,c.a);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;if(uAntialias==1){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);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=blendPremultipliedAlpha(color,texture(uTextureBlend,vTexCoord));color=applyGamma(color,uColorGamma);color=applyColorMatrix(color,uColorMatrix,uColorOffset);color*=a;if(uColorVignette!=0.0){vec2 pos=gl_FragCoord.xy-offset;color=applyVignette(color,pos,center-offset,uColorVignette);}color=blendPremultipliedAlpha(color,texture(uTextureOverlay,vTexCoord));if(overlayColorAlpha<=0.0){color*=1.0-uOverlayColor.a;}color*=uOpacity;fragColor=color;}",["aPosition","aTexCoord"],["uMatrix","uTexture","uTextureBlend","uTextureOverlay","uTextureSize","uColorGamma","uColorVignette","uColorOffset","uColorMatrix","uClarityKernel","uClarityKernelWeight","uOpacity","uMaskOpacity","uMaskBounds","uMaskCornerRadius","uMaskFeather","uOverlayColor","uAntialias"]),D=R.createBuffer(),O=R.createBuffer();R.bindBuffer(R.ARRAY_BUFFER,O),R.bufferData(R.ARRAY_BUFFER,Sl,R.STATIC_DRAW);const B=R.createBuffer();R.bindBuffer(R.ARRAY_BUFFER,B),R.bufferData(R.ARRAY_BUFFER,kl,R.STATIC_DRAW);const _=el(R,"#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 float uSharpness;uniform mat4 uMatrix;void main(){vMiter=aMiter;vNormal=aNormal;vWidth=(uWidth*.5)+uSharpness;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","uSharpness","uMaskBounds","uMaskOpacity"]),W=R.createBuffer();wl()&&(R.bindBuffer(R.ARRAY_BUFFER,W),R.bufferData(R.ARRAY_BUFFER,1,R.DYNAMIC_DRAW));const V=(e,t,o,i=!1)=>{const{program:n,locations:r}=_;R.useProgram(n),R.enableVertexAttribArray(r.aPosition),R.enableVertexAttribArray(r.aNormal),R.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:ue(i.x+(i.x-n.x),i.y+(i.y-n.y))),n||(n=t?l:ue(i.x+(i.x-o.x),i.y+(i.y-o.y))),$l(s,10*r,o,i,n);return t&&$l(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;R.uniform1f(r.uWidth,t),R.uniform1f(r.uSharpness,l),R.uniform4fv(r.uColor,o),R.uniformMatrix4fv(r.uMatrix,!1,u),R.uniform4f(r.uCanvasColor,v,w,S,k),R.uniform1fv(r.uMaskBounds,y),R.uniform1f(r.uMaskOpacity,$),R.bindBuffer(R.ARRAY_BUFFER,W),R.bufferData(R.ARRAY_BUFFER,a,R.STATIC_DRAW),R.vertexAttribPointer(r.aPosition,2,R.FLOAT,!1,s,0),R.vertexAttribPointer(r.aNormal,2,R.FLOAT,!1,s,c),R.vertexAttribPointer(r.aMiter,1,R.FLOAT,!1,s,d),R.drawArrays(R.TRIANGLE_STRIP,0,a.length/5),R.disableVertexAttribArray(r.aPosition),R.disableVertexAttribArray(r.aNormal),R.disableVertexAttribArray(r.aMiter)},N=el(R,"\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"]),H=R.createBuffer(),j=el(R,"\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 vec2 uRepeat;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","uRepeat","uPosition","uSize","uMaskBounds","uMaskOpacity","uMaskFeather","uCornerRadius","uInverted"]),Z=R.createBuffer(),X=R.createBuffer(),G=R.createBuffer(),Y=el(R,"\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 uRepeat;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","uRepeat","uColor","uCanvasColor","uMatrix","uRadius","uInverted","uMaskBounds","uMaskOpacity"]),q=R.createBuffer(),K=R.createBuffer(),J=new Map,Q={2:{width:0,height:0},1:{width:0,height:0}},ee=(e,t,o,n=1)=>{const a=Math.min(Math.min(4096,r)/o.width,Math.min(4096,r)/o.height,n),l=Math.floor(a*o.width),c=Math.floor(a*o.height);We(o,Q[e])?R.bindFramebuffer(R.FRAMEBUFFER,t):(R.bindTexture(R.TEXTURE_2D,C.get(e)),R.texImage2D(R.TEXTURE_2D,0,R.RGBA,l,c,0,R.RGBA,R.UNSIGNED_BYTE,null),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.LINEAR),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),R.bindFramebuffer(R.FRAMEBUFFER,t),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,C.get(e),0),Q[e]=o);const h=o.width*s,p=o.height*s;var m,g;rl(d,0,h,p,0,-1,1),al(d,0,p,0),g=1,(m=d)[0]*=g,m[1]*=g,m[2]*=g,m[3]*=g,((e,t)=>{e[4]*=t,e[5]*=t,e[6]*=t,e[7]*=t})(d,-1),u=d,R.viewport(0,0,l,c),R.colorMask(!0,!0,!0,!0),R.clearColor(0,0,0,0),R.clear(R.COLOR_BUFFER_BIT),x=[1,0,1,0,1,Math.max(i.width,o.width),1,Math.max(i.width,o.width)]},te=(e,t)=>{const{forceRelease:o=!1}=t||{},{src:i}=J.get(e);i instanceof HTMLCanvasElement&&(o||i.dataset.retain||f(i)),J.delete(e),R.deleteTexture(e)},oe=e=>J.get(e).isRotatedVideo;return{drawPath:(e,t=0,o=!1,i=!1,n,r,a,l,c)=>{if(e.length<2)return;const d=e.map((e=>({x:e.x*s,y:e.y*s}))),h=n*s;if(h>0&&V(d,h,il(r,c),a),d.length<3||!l||0===l[3]||!a)return;const p=gl(d),m=new Float32Array(6*p.length);p.forEach((([e,t,o],i)=>{const n=6*i;m[n+0]=e.x,m[n+1]=e.y,m[n+2]=t.x,m[n+3]=t.y,m[n+4]=o.x,m[n+5]=o.y})),((e,t)=>{const{program:o,locations:i}=N;R.useProgram(o),R.enableVertexAttribArray(i.aPosition),R.uniform4fv(i.uColor,t),R.uniformMatrix4fv(i.uMatrix,!1,u),R.uniform1fv(i.uMaskBounds,y),R.uniform1f(i.uMaskOpacity,$),R.uniform4f(i.uCanvasColor,v,w,S,k),R.bindBuffer(R.ARRAY_BUFFER,H),R.bufferData(R.ARRAY_BUFFER,e,R.STATIC_DRAW),R.vertexAttribPointer(i.aPosition,2,R.FLOAT,!1,0,0),R.drawArrays(R.TRIANGLES,0,e.length/2),R.disableVertexAttribArray(i.aPosition)})(m,il(l,c))},drawRect:(e,t=0,o=!1,i=!1,n,r,a,l,c,d=!1,h,p,m,g,f,b,C)=>{const M=dt(Ke(e),s),T=n.map((t=>((e,t)=>Math.floor(Za(e,0,Math.min(.5*(t.width-1),.5*(t.height-1)))))(t||0,e))).map((e=>e*s));if(r||a){const e=Ke(M);e.x-=.5,e.y-=.5,e.width+=1,e.height+=1;const n=yl(e,t,o,i),p=fl(n);let m;b&&(m=il(b),0===m[3]&&(m[3]=.001));const P=l&&d?[e.width/l.width,e.height/l.height]:[1,1];((e,t,o,i,n,r=I,a,l=1,c=Pl,d=Sl,h=x,p)=>{const{program:m,locations:g}=j;R.useProgram(m),R.enableVertexAttribArray(g.aPosition),R.enableVertexAttribArray(g.aTexCoord),R.enableVertexAttribArray(g.aRectCoord),R.uniform4fv(g.uColor,n),R.uniform2fv(g.uSize,[t,o]),R.uniform2fv(g.uPosition,[e[2],e[3]]),R.uniform2fv(g.uRepeat,a),R.uniform1i(g.uInverted,p?1:0),R.uniform1fv(g.uCornerRadius,i),R.uniform4f(g.uCanvasColor,v,w,S,k),R.uniform1fv(g.uMaskFeather,h.map(((e,t)=>t%2==0?e:e*s))),R.uniform1fv(g.uMaskBounds,y),R.uniform1f(g.uMaskOpacity,$),R.uniformMatrix4fv(g.uMatrix,!1,u),R.uniform1i(g.uTexture,4),R.uniform4fv(g.uTextureColor,c),R.uniform1f(g.uTextureOpacity,l),R.activeTexture(R.TEXTURE0+4),R.bindTexture(R.TEXTURE_2D,r),R.bindBuffer(R.ARRAY_BUFFER,X),R.bufferData(R.ARRAY_BUFFER,d,R.STATIC_DRAW),R.vertexAttribPointer(g.aTexCoord,2,R.FLOAT,!1,0,0),R.bindBuffer(R.ARRAY_BUFFER,G),R.bufferData(R.ARRAY_BUFFER,Sl,R.STATIC_DRAW),R.vertexAttribPointer(g.aRectCoord,2,R.FLOAT,!1,0,0),R.bindBuffer(R.ARRAY_BUFFER,Z),R.bufferData(R.ARRAY_BUFFER,e,R.STATIC_DRAW),R.vertexAttribPointer(g.aPosition,2,R.FLOAT,!1,0,0),R.drawArrays(R.TRIANGLE_STRIP,0,e.length/2),R.disableVertexAttribArray(g.aPosition),R.disableVertexAttribArray(g.aTexCoord),R.disableVertexAttribArray(g.aRectCoord)})(p,e.width,e.height,T,il(r,g),a,P,g,m,h?new Float32Array(h):Il(e.width,e.height,l,c,s),f,C)}p&&(p=Math.min(p,M.width,M.height),V(((e,t,o,i,n,r,a,s)=>{const l=[];if(r.every((e=>0===e)))l.push(ue(e,t),ue(e+o,t),ue(e+o,t+i),ue(e,t+i));else{const[n,a,s,c]=r,d=e,u=e+o,h=t,p=t+i;l.push(ue(d+n,h)),bl(l,u-a,h+a,a,-1),l.push(ue(u,h+a)),bl(l,u-c,p-c,c,0),l.push(ue(u-c,p)),bl(l,d+s,p-s,s,1),l.push(ue(d,p-s)),bl(l,d+n,h+n,n,2)}return(a||s)&&Ae(l,a,s,e+.5*o,t+.5*i),n&&Ee(l,n,e+.5*o,t+.5*i),l})(M.x,M.y,M.width,M.height,t,T,o,i),p*s,il(m,g),!0))},drawEllipse:(e,t,o,i,n,r,a,l,c,d,h,p,m,g,f)=>{const b=dt(nt(e.x-t,e.y-o,2*t,2*o),s);if(a||l){const e=Ke(b);e.x-=.5,e.y-=.5,e.width+=1,e.height+=1;const t=yl(e,i,n,r);((e,t,o,i,n=I,r=Sl,a=1,s=!1)=>{const{program:l,locations:c}=Y;R.useProgram(l),R.enableVertexAttribArray(c.aPosition),R.enableVertexAttribArray(c.aTexCoord),R.uniformMatrix4fv(c.uMatrix,!1,u),R.uniform2fv(c.uRadius,[.5*t,.5*o]),R.uniform1i(c.uInverted,s?1:0),R.uniform4fv(c.uColor,i),R.uniform4f(c.uCanvasColor,v,w,S,k),R.uniform2fv(c.uRepeat,[1,1]),R.uniform1fv(c.uMaskBounds,y),R.uniform1f(c.uMaskOpacity,$),R.uniform1i(c.uTexture,4),R.uniform1f(c.uTextureOpacity,a),R.activeTexture(R.TEXTURE0+4),R.bindTexture(R.TEXTURE_2D,n),R.bindBuffer(R.ARRAY_BUFFER,K),R.bufferData(R.ARRAY_BUFFER,r,R.STATIC_DRAW),R.vertexAttribPointer(c.aTexCoord,2,R.FLOAT,!1,0,0),R.bindBuffer(R.ARRAY_BUFFER,q),R.bufferData(R.ARRAY_BUFFER,e,R.STATIC_DRAW),R.vertexAttribPointer(c.aPosition,2,R.FLOAT,!1,0,0),R.drawArrays(R.TRIANGLE_STRIP,0,e.length/2),R.disableVertexAttribArray(c.aPosition),R.disableVertexAttribArray(c.aTexCoord)})(fl(t),e.width,e.height,il(a,g),l,h?new Float32Array(h):Il(e.width,e.height,c,d,s),g,f)}p&&V(((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 Et(ue(e+s,t+l),s,l,n,r,a,d)})(b.x,b.y,b.width,b.height,i,n,r),p*s,il(m,g),!0)},drawImage:(e,t,o,n,r,l,c,d,u,h,p=Tl,m=1,g,f=1,x=0,v=b,w=Rl,S=Pl,k=!1,M=!1,I=!0)=>{const A=t.width*s,E=t.height*s,L=-.5*A,F=.5*E,_=.5*A,W=-.5*E,V=new Float32Array([L,W,0,L,F,0,_,W,0,_,F,0]);R.bindBuffer(R.ARRAY_BUFFER,D),R.bufferData(R.ARRAY_BUFFER,V,R.STATIC_DRAW);const N=t.height/2/P*(i.height/t.height)*-1;r*=s,l*=s,o*=s,n*=s;const{program:H,locations:j}=z,U=nl();((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,T,a,1,2*-N),al(U,r,-l,N),al(U,o,-n,0),dl(U,-u),sl(U,h),al(U,-o,n,0),cl(U,d),ll(U,c),R.useProgram(H),R.enableVertexAttribArray(j.aPosition),R.enableVertexAttribArray(j.aTexCoord),R.uniform1i(j.uTexture,3),R.uniform2f(j.uTextureSize,t.width,t.height),R.activeTexture(R.TEXTURE0+3),R.bindTexture(R.TEXTURE_2D,e);const Z=M?1:0,X=C.get(Z);R.uniform1i(j.uTextureBlend,Z),R.activeTexture(R.TEXTURE0+Z),R.bindTexture(R.TEXTURE_2D,X);const G=k?2:0,Y=C.get(G);R.uniform1i(j.uTextureOverlay,G),R.activeTexture(R.TEXTURE0+G),R.bindTexture(R.TEXTURE_2D,Y),R.bindBuffer(R.ARRAY_BUFFER,D),R.vertexAttribPointer(j.aPosition,3,R.FLOAT,!1,0,0);const q=Cl&&oe(e);let K;R.bindBuffer(R.ARRAY_BUFFER,q?B:O),R.vertexAttribPointer(j.aTexCoord,2,R.FLOAT,!1,0,0),R.uniformMatrix4fv(j.uMatrix,!1,U),R.uniform4fv(j.uOverlayColor,S),!g||Ka(g,Ml)?(g=Ml,K=-1):(K=g.reduce(((e,t)=>e+t),0),K=K<=0?1:K),R.uniform1fv(j.uClarityKernel,g),R.uniform1f(j.uClarityKernelWeight,K),R.uniform1f(j.uColorGamma,1/f),R.uniform1f(j.uColorVignette,x),R.uniform1i(j.uAntialias,I?1:0),R.uniform4f(j.uColorOffset,p[4],p[9],p[14],p[19]),R.uniformMatrix4fv(j.uColorMatrix,!1,[p[0],p[1],p[2],p[3],p[5],p[6],p[7],p[8],p[10],p[11],p[12],p[13],p[15],p[16],p[17],p[18]]),R.uniform1f(j.uOpacity,m),R.uniform1f(j.uMaskOpacity,$),R.uniform1fv(j.uMaskBounds,y),R.uniform1fv(j.uMaskCornerRadius,w.map((e=>e*s))),R.uniform1fv(j.uMaskFeather,v.map(((e,t)=>t%2==0?e:e*s))),R.drawArrays(R.TRIANGLE_STRIP,0,4),R.disableVertexAttribArray(j.aPosition),R.disableVertexAttribArray(j.aTexCoord)},textureFilterNearest:R.NEAREST,textureFilterLinear:R.LINEAR,textureClamp:R.CLAMP_TO_EDGE,textureRepeat:R.REPEAT,textureCreate:()=>R.createTexture(),textureUpdate:(e,t,o)=>(J.set(e,{src:t,options:o,isRotatedVideo:"VIDEO"===t.nodeName&&(t.dataset&&90==t.dataset.rotation||270==t.dataset.rotation)}),ol(R,e,t,o)),textureGetSize:e=>{const{src:t,options:o}=J.get(e),i=ze(t);return o.scalar?Ue(i,(e=>e/o.scalar)):i},textureDelete:te,enablePreviewStencil:()=>{R.stencilOp(R.KEEP,R.KEEP,R.REPLACE),R.stencilFunc(R.ALWAYS,1,255),R.stencilMask(255)},applyPreviewStencil:()=>{R.stencilFunc(R.EQUAL,1,255),R.stencilMask(0)},disablePreviewStencil:M,setCanvasColor(e){v=e[0],w=e[1],S=e[2],k=o?e[3]:1,R.clear(R.COLOR_BUFFER_BIT)},resetCanvasMatrix:()=>{rl(c,0,i.width,i.height,0,-1,1)},updateCanvasMatrix(e,t,o,n,r){const a=e.width,l=e.height,d=i.width*(.5/s),u=i.height*(.5/s),h={x:d+(o.x+t.x),y:u+(o.y+t.y)},p={x:h.x-t.x,y:h.y-t.y},m=.5*a,g=.5*l;ge(p,r.z,h),Re(p,n,h);al(c,(p.x-m)*s,(p.y-g)*s,0),al(c,m*s,g*s,0),dl(c,r.z);const $=r.x>Math.PI/2;ll(c,$?Math.PI:0);const f=r.y>Math.PI/2;cl(c,f?Math.PI:0),sl(c,n),al(c,-m*s,-g*s,0)},drawToCanvas(){R.bindFramebuffer(R.FRAMEBUFFER,null),u=c,R.viewport(0,0,R.drawingBufferWidth,R.drawingBufferHeight),R.colorMask(!0,!0,!0,!0),R.clearColor(v,w,S,k),R.clear(R.COLOR_BUFFER_BIT),x=[1,0,1,0,1,i.width,1,i.width]},drawToImageBlendBuffer(e,t){ee(1,F,e,t)},drawToImageOverlayBuffer(e,t){ee(2,E,e,t)},enableMask(e,t){const o=e.x*s,n=e.y*s,r=e.width*s,a=e.height*s;g=o,p=g+r,h=i.height-n,m=i.height-(n+a),$=1-t,y=[h,p,m,g]},disableMask(){g=0,p=i.width,h=i.height,m=0,$=1,y=[h,p,m,g]},resize:(t,o,r)=>{s=r,l=1===s?.75:1,n.width=t,n.height=o,i.width=t*s,i.height=o*s,a=U(i.width,i.height),e.width=i.width,e.height=i.height,rl(c,0,i.width,i.height,0,-1,1),b=[1,0,1,0,1,n.width,1,n.width]},release(){Array.from(J.keys()).forEach((e=>te(e,{forceRelease:!0}))),J.clear(),C.forEach((e=>{R.deleteTexture(e)})),C.clear(),z.destroy(),_.destroy(),N.destroy(),j.destroy(),Y.destroy(),e.width=1,e.height=1,e=void 0}}},El=e=>e%2==0?e:e+1;var Ll=(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,$=0,f=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,$=0,f=0,p<.5&&($=4*(-r+Math.round(Math.random()*n))),p>.5&&(f=(-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 Fl=[.0625,.125,.0625,.125,.25,.125,.0625,.125,.0625];function zl(e){return Math.sqrt(1- --e*e)}function Dl(e){return"[object Date]"===Object.prototype.toString.call(e)}function Ol(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)=>Ol(e[o],t)));return e=>o.map((t=>t(e)))}if("object"===o){if(!e||!t)throw new Error("Object cannot be null");if(Dl(e)&&Dl(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]=Ol(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 Bl(e,t={}){const o=Ca(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=Dn,interpolate:h=Ol}=On(On({},t),a);if(0===d)return s&&(s.abort(),s=null),o.set(e=n),Promise.resolve();const p=or()+c;let m;return i=ar((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 _l(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(Ro(o))return o.map(((n,r)=>_l(e,t[r],o[r],i[r])));if("object"==typeof o){const n={};for(const r in o)n[r]=_l(e,t[r],o[r],i[r]);return n}throw new Error(`Cannot spring ${typeof o} values`)}function Wl(e,t={}){const o=Ca(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=ar((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=_l(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 Vl=ka(!1,(e=>{const t=window.matchMedia("(prefers-reduced-motion:reduce)"),o=()=>e(t.matches);return o(),t.addListener(o),()=>t.removeListener(o)})),Nl=()=>"ResizeObserver"in window;const Hl=Je(),jl=(e,t,o,i,n)=>{e.rect||(e.rect=Je());const r=e.rect;pt(Hl,t,o,i,n),ut(r,Hl)||(mt(r,Hl),e.dispatchEvent(new CustomEvent("measure",{detail:r})))},Ul=Math.round,Zl=e=>{const t=e.getBoundingClientRect();Kl&&jl(e,Ul(t.x),Ul(t.y),Ul(t.width),Ul(t.height))},Xl=e=>{Kl&&jl(e,e.offsetLeft,e.offsetTop,e.offsetWidth,e.offsetHeight)},Gl=[];let Yl,ql,Kl=void 0;function Jl(){Gl.length?(Gl.forEach((e=>e.measure(e))),Kl=requestAnimationFrame(Jl)):Kl=void 0}let Ql=new Map([]),ec=0,tc=0;var oc=(e,t={})=>{const{observePosition:o=!1,observeViewRect:i=!1,once:n=!1,disabled:r=!1,isMeasureRoot:a=!1}=t;if(Nl()&&a&&(ql||(ql=new ResizeObserver((e=>{e.forEach((e=>{Ql.set(e.target,e.contentRect)}));const t=Array.from(Ql.values()).some((({width:e,height:t})=>e>0&&t>0));t?t&&!1===Kl&&Jl():(Kl&&cancelAnimationFrame(Kl),Kl=!1)}))),ql.observe(e),ec++),!r)return!Nl()||o||i?(e.measure=i?Zl:Xl,Gl.push(e),void 0===Kl&&(Kl=requestAnimationFrame(Jl)),e.measure(e),{destroy(){a&&ql&&(Ql.delete(e),ql.unobserve(e),ec--,0===ec&&(ql.disconnect(),ql=void 0));const t=Gl.indexOf(e);Gl.splice(t,1),delete e.measure}}):(Yl||(Yl=new ResizeObserver((e=>{e.forEach((e=>{Kl&&Xl(e.target)}))}))),Yl.observe(e),Xl(e),n?Yl.unobserve(e):tc++,{destroy(){a&&ql&&(Ql.delete(e),ql.unobserve(e),ec--,0===ec&&(ql.disconnect(),ql=void 0)),n||(Yl.unobserve(e),tc--,0===tc&&(Yl.disconnect(),Yl=void 0))}})},ic=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 nc=async e=>new Promise((t=>{if("file"===e.kind)return t(e.getAsFile());e.getAsString(t)}));var rc=(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(nc)).then((e=>{t(e.filter((e=>zo(e)&&Zt(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 ac=null;var sc=()=>{if(null===ac)if(u()){const e=g("canvas");ac=!hl(e,{failIfMajorPerformanceCaveat:!0}),f(e)}else ac=!1;return ac},lc=e=>e instanceof WebGLTexture;function cc(e){let t,o,i,n;return{c(){t=hr("div"),o=hr("canvas"),xr(t,"class","PinturaCanvas")},m(r,a){dr(r,t,a),sr(t,o),e[35](o),i||(n=[fr(o,"measure",e[36]),er(oc.call(null,o))],i=!0)},p:zn,i:zn,o:zn,d(o){o&&ur(t),e[35](null),i=!1,Wn(n)}}}function dc(e,t,o){let i,n,r,s,l,c,d;const h=[0,0,0,0],p=u()&&(e=>{const t=.5*e,o=g("canvas",{"data-retain":!0,width:e,height:e}),i=o.getContext("2d");return i.fillStyle="#f0f",i.fillRect(0,0,t,t),i.fillRect(t,t,t,t),o})(128),m=Or();let $,{isAnimated:f}=t,{isTransparent:b}=t,{maskRect:x}=t,{maskOpacity:v=1}=t,{maskFrameOpacity:w=.95}=t,{maskMarkupOpacity:S=1}=t,{clipAnnotationsToImage:k=!0}=t,{pixelRatio:C=1}=t,{textPixelRatio:M=C}=t,{backgroundColor:T}=t,{willRender:R=Z}=t,{didRender:I=Z}=t,{willRequest:A}=t,{loadImageData:E=Z}=t,{enableGrid:L=!1}=t,{gridColors:F}=t,{gridSize:z}=t,{gridOpacity:D=0}=t,{images:O=[]}=t,{interfaceImages:B=[]}=t,_=null,W=null,V=null;const N=(e,t)=>e.set(t,{hard:!f}),H={precision:1e-4*.01};let j=0;const X=Bl(void 0,{duration:0});Un(e,X,(e=>o(34,d=e)));const G=Wl(1,H);Un(e,G,(e=>o(33,l=e)));const Y=Wl(1,H);Un(e,Y,(e=>o(45,r=e)));const q=Ca();Un(e,q,(e=>o(47,c=e)));const K=Ca();Un(e,K,(e=>o(46,s=e)));const J=()=>requestAnimationFrame((()=>{ce=!0,be=0,n()})),Q=new Map([]),ee=new Map([]),te=(e,t)=>({filterParam:"pixelated"===e?_.textureFilterNearest:_.textureFilterLinear,wrapParam:"repeat"===t?_.textureRepeat:_.textureClamp}),oe=(e,t,o)=>{if(!Q.has(e)){Q.set(e,e);const n=te(t,o);if(!P(i=e)&&(ro(i)||y(i)||mn(i)||Gt(i))){const t=_.textureCreate();_.textureUpdate(t,e,n),Q.set(e,t)}else E(e).then((t=>{if(!_||!t)return;const o=_.textureCreate();_.textureUpdate(o,t,n),Q.set(e,o),J()})).catch((e=>{console.error(e)}))}var i,n;if(Gt(e)&&((n=e).currentTime>0&&!n.paused&&!n.ended&&n.readyState>2||"true"===e.dataset.redraw)){const i=Q.get(e),n=te(t,o);return _.textureUpdate(i,e,n),e.dataset.redraw=!1,i}return Q.get(e)},ie=e=>{if(!e.text.length)return void ee.delete(e.id);let{text:t,textAlign:o,fontFamily:i,fontSize:n=16,fontWeight:r,fontVariant:a,fontStyle:s,lineHeight:l=n,width:c,height:d}=e;c=Mo(c)?Math.floor(c):c,d=Mo(d)?Math.floor(d):d;const{textSize:u,signature:h}=((e="",t)=>{let{width:o=0,height:i="auto",fontSize:n,fontFamily:r,lineHeight:a,fontWeight:s,fontStyle:l,fontVariant:c}=t;const d=Bo({text:e,fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,lineHeight:a,width:o,height:i});let u=Go.get(d);if(u)return u;let h=1;n>1e3&&jo()&&(h=n/1e3,n=1e3,a*=h);const p=Vt(g("pre",{contenteditable:"true",spellcheck:"false",style:`${qo}${Zo({fontFamily:r,fontWeight:s,fontStyle:l,fontVariant:c,fontSize:n,lineHeight:a})};${Xo(e,t)}"`,innerHTML:e})),m=p.getBoundingClientRect();return u={signature:Yo(p).flat().map((e=>e.text)).join("_;_"),textSize:Ue(ze(m),(e=>Math.ceil(e*h)))},Go.set(d,u),p.remove(),u})(t,{...e,width:c,height:d}),p=Bo({text:t,textAlign:o,fontFamily:i,fontSize:n,fontWeight:r,fontVariant:a,fontStyle:s,lineHeight:l,signature:h});if(!Q.has(p)){Q.set(p,t);const h=Math.ceil(u.width),m=Math.ceil(u.height/l)*l;if(0===h||0===m)return;const g=vl(),$=Math.min(1,(g-Uo*M*2)/(h*M),g/(m*M));di(t,{fontSize:n,fontFamily:i,fontWeight:r,fontVariant:a,fontStyle:s,textAlign:o,lineHeight:l,width:c,height:d,imageWidth:h,imageHeight:m,pixelRatio:M*$,willRequest:A,color:[1,0,1]}).then((t=>{if(!_)return;const o=_.textureCreate();_.textureUpdate(o,t,{filterParam:_.textureFilterLinear,wrapParam:_.textureClamp,scalar:$}),Q.set(p,o),ee.set(e.id,o),J()})).catch(console.error)}const m=Q.get(p);return lc(m)?m:ee.get(e.id)},ne=({data:e,size:t,origin:o,translation:i,rotation:n,scale:r,colorMatrix:a,opacity:s,convolutionMatrix:l,gamma:c,vignette:d,maskFeather:u,maskCornerRadius:h,overlayColor:p,enableOverlay:m,enableBlend:g,enableAntialiasing:$})=>{const f=oe(e);let y=0,b=0;if(1===C){const e=Math.abs(1-r)<Number.EPSILON;y=e&&W%2!=0?.5:0,b=e&&V%2!=0?.5:0}return _.drawImage(f,t,o.x,o.y,i.x+y,i.y+b,n.x,n.y,n.z,r,a,Za(s,0,1),l,c,d,u,h,p,m,g,$),f},re=([e,t,o,i])=>[i.x,i.y,e.x,e.y,o.x,o.y,t.x,t.y],ae=de(),se=(e=[],t)=>e.map((e=>{let t=!e._isLoading&&(e=>{let t;if(e.backgroundImage)t=oe(e.backgroundImage,e.backgroundImageRendering);else if(P(e.text)){if(e.width&&e.width<1||e.height&&e.height<1)return;t=ie(e)}return t})(e),o=lc(t)?t:void 0;const i=e._scale||1,n=e._translate||ae,r=e.strokeWidth&&e.strokeWidth*i;if(Ro(e.points)){const t=e.points.map((e=>ue(e.x*i+n.x,e.y*i+n.y)));_.drawPath(t,e.rotation,e.flipX,e.flipY,r,e.strokeColor,e.pathClose,e.backgroundColor,e.opacity)}else if(Mo(e.rx)&&Mo(e.ry)){let t=e.x,a=e.y;t*=i,a*=i,t+=n.x,a+=n.y,_.drawEllipse(ue(t,a),e.rx*i,e.ry*i,e.rotation,e.flipX,e.flipY,e.backgroundColor,o,void 0,void 0,e.backgroundCorners&&re(e.backgroundCorners),r,e.strokeColor,e.opacity,e.inverted)}else if(P(e.text)&&o||e.width){const t=o&&_.textureGetSize(o);let a,s,l,c=void 0,d=e.backgroundColor,u=e.strokeColor,h=[e.cornerRadius,e.cornerRadius,e.cornerRadius,e.cornerRadius].map((e=>e*i));if(a=e.width?et(e):{x:e.x,y:e.y,...t},i&&n&&(a.x*=i,a.y*=i,a.x+=n.x,a.y+=n.y,a.width*=i,a.height*=i),t)if(e.backgroundImage&&(e.backgroundSize||e.backgroundPosition)){const o=U(t.width,t.height);if("contain"===e.backgroundSize){const t=bt(a,o,a);s=De(t),l=e.backgroundPosition?e.backgroundPosition:ue(.5*(a.width-s.width),.5*(a.height-s.height))}else if("cover"===e.backgroundSize){const t=yt(a,o,a);s=De(t),e.backgroundPosition?l=e.backgroundPosition:(l=ue(t.x,t.y),l=ue(.5*(a.width-s.width),.5*(a.height-s.height)))}else e.backgroundSize?(s=e.backgroundSize,l=e.backgroundPosition):e.backgroundPosition&&(s={...t},l=e.backgroundPosition)}else if(e.text){const o={width:t.width/M,height:t.height/M};let n=1;if(e.fontSize>1e3&&jo()&&(n=e.fontSize/1e3),l=ue(0,0),s={width:o.width*i,height:o.height*i},e.backgroundColor||e.strokeColor){d=void 0,u=void 0;let t=(e.width||o.width-2*Uo)*i,n=(e.height||o.height)*i;_.drawRect({...a,width:t,height:n},e.rotation,e.flipX,e.flipY,h,e.backgroundColor,void 0,void 0,void 0,!1,void 0,r,e.strokeColor,e.opacity,void 0,void 0,e.inverted)}a.x-=Uo*i,c=e.color||[0,0,0],e.width?(a.height=a.height||o.height*i,a.width+=2*Uo*i/n,"center"===e.textAlign?l.x=.5*(a.width-s.width/n):"right"===e.textAlign&&(l.x=a.width-s.width/n)):(a.width=o.width*i,a.height=o.height*i),e._prerender&&(c[3]=0)}_.drawRect(a,e.rotation,e.flipX,e.flipY,h,d,o,s,l,!1,e.backgroundCorners&&re(e.backgroundCorners),r,u,e.opacity,void 0,c,e.inverted)}return t})).filter(Boolean),le=(e,t,o,i,n,r)=>_.drawRect(t,0,!1,!1,h,h,e,i,o,!0,void 0,0,void 0,r,void 0,n);let ce=!1,he=!0,pe=!1;const me=[],ge=[],$e=[],fe=()=>{$e.length=0;const e=O[0],{blendShapes:t,blendShapesDirty:o,annotationShapes:i,annotationShapesDirty:n,interfaceShapes:a,decorationShapes:u,frameShapes:m}=R({opacity:e.opacity,rotation:e.rotation,scale:e.scale,images:O,size:_e(W,V),backgroundColor:[...d],selectionRect:c}),g=[...d],$=c,f=Za(l,0,1),y=s,v=Math.abs(e.rotation.x/Math.PI*2-1),w=Math.abs(e.rotation.y/Math.PI*2-1),C=v<.99||w<.99,T={...e.size},P=e.backgroundColor,A=e.backgroundImage,E=t.length>0,N=i.length>0,H=P[3]>0,j=!!k&&S>=1;if(f<1&&H){const e=g[0],t=g[1],o=g[2],i=1-f,n=P[0]*i,r=P[1]*i,a=P[2]*i,s=1-i;g[0]=n+e*s,g[1]=r+t*s,g[2]=a+o*s,g[3]=1}_.setCanvasColor(b?h:g),E&&o?(_.disableMask(),_.drawToImageBlendBuffer(T),me.length=0,me.push(...se(t))):E||(me.length=0),$e.push(...me),he&&(_.drawToImageOverlayBuffer(T,M),he=!1);if(C?(N&&(n||ce)||!pe?(_.disableMask(),_.drawToImageOverlayBuffer(T,M),ge.length=0,ge.push(...se(i))):N||(ge.length=0),pe=!0):pe=!1,_.drawToCanvas(),_.enableMask($,f),L&&z>=1&&2===F.length&&D&&((e,t,o,i,n)=>{const r=_e(t,t),a=oe(p,"pixelated","repeat"),s=ue(-e.x%t,-e.y%t),l=ue(s.x+.5*r.width,s.y);le(a,e,s,r,o,n),le(a,e,l,r,i,n)})($,z,F[0],F[1],D),H&&_.drawRect($,0,!1,!1,h,P),A){_.enableMask($,1);const e=Math.max(x.width/A.width,x.height/A.height),t=A.width*e,o=A.height*e,i={x:x.x+.5*x.width-.5*t,y:x.y+.5*x.height-.5*o,width:t,height:o};_.drawRect(i,0,!1,!1,h,h,oe(A,"linear")),_.enableMask($,f)}if(j&&_.enablePreviewStencil(),$e.push(...[...O].reverse().map((e=>ne({...e,enableOverlay:C&&N,enableBlend:E,enableAntialiasing:!0,mask:$,maskOpacity:f,overlayColor:y})))),_.enableMask($,S),C||(j&&_.applyPreviewStencil(),_.resetCanvasMatrix(),_.updateCanvasMatrix(T,e.origin,e.translation,e.scale,e.rotation),ge.length=0,ge.push(...se(i)),j&&_.disablePreviewStencil()),$e.push(...ge),_.resetCanvasMatrix(),_.enableMask($,S),$e.push(...se(u)),m.length){_.enableMask($,1);const e=m.filter((e=>!e.expandsCanvas)),t=m.filter((e=>e.expandsCanvas));e.length&&$e.push(...se(e)),t.length&&(_.enableMask({x:$.x+.5,y:$.y+.5,width:$.width-1,height:$.height-1},r),$e.push(...se(t)))}_.disableMask(),$e.push(...se(a)),B.forEach((e=>{if(_.enableMask(e.mask,e.maskOpacity),e.backgroundColor){const t=A&&yt({...e.mask},A.width/A.height),o=A&&oe(A,"linear");_.drawRect(e.mask,0,!1,!1,e.maskCornerRadius,e.backgroundColor,o,t,t,void 0,void 0,void 0,void 0,e.opacity,e.maskFeather),o&&$e.push(o)}const t=ne({...e,enableAntialiasing:!1,translation:{x:e.translation.x+e.offset.x-.5*W,y:e.translation.y+e.offset.y-.5*V}});$e.push(t)})),_.disableMask(),(e=>{Q.forEach(((t,o)=>{!e.find((e=>e===t))&&lc(t)&&(Array.from(ee.values()).includes(t)||(Q.delete(o),_.textureDelete(t)))}))})($e),I(),ce=!1};let ye,be=0;const xe=()=>{clearTimeout(ye);const e=Date.now();e-be<48?ye=setTimeout(xe,48):(be=e,fe())};zr((()=>n())),Fr((()=>o(29,_=Al($,{alpha:b})))),Dr((()=>{_&&(_.release(),o(29,_=void 0),o(0,$=void 0))}));return e.$$set=e=>{"isAnimated"in e&&o(9,f=e.isAnimated),"isTransparent"in e&&o(10,b=e.isTransparent),"maskRect"in e&&o(11,x=e.maskRect),"maskOpacity"in e&&o(12,v=e.maskOpacity),"maskFrameOpacity"in e&&o(13,w=e.maskFrameOpacity),"maskMarkupOpacity"in e&&o(14,S=e.maskMarkupOpacity),"clipAnnotationsToImage"in e&&o(15,k=e.clipAnnotationsToImage),"pixelRatio"in e&&o(16,C=e.pixelRatio),"textPixelRatio"in e&&o(17,M=e.textPixelRatio),"backgroundColor"in e&&o(18,T=e.backgroundColor),"willRender"in e&&o(19,R=e.willRender),"didRender"in e&&o(20,I=e.didRender),"willRequest"in e&&o(21,A=e.willRequest),"loadImageData"in e&&o(22,E=e.loadImageData),"enableGrid"in e&&o(23,L=e.enableGrid),"gridColors"in e&&o(24,F=e.gridColors),"gridSize"in e&&o(25,z=e.gridSize),"gridOpacity"in e&&o(26,D=e.gridOpacity),"images"in e&&o(27,O=e.images),"interfaceImages"in e&&o(28,B=e.interfaceImages)},e.$$.update=()=>{if(1&e.$$.dirty[0]&&$){const e=getComputedStyle($).getPropertyValue("--color-transition-duration");o(30,j=(e=>{let t=parseFloat(e);return/^[0-9]+s$/.test(e)?1e3*t:t})(e))}1074004480&e.$$.dirty[0]&&T&&X.set(T,{duration:f?j:0}),4096&e.$$.dirty[0]&&N(G,Mo(v)?v:1),8192&e.$$.dirty[0]&&N(Y,Mo(w)?w:1),2048&e.$$.dirty[0]&&x&&q.set(x),12&e.$$.dirty[1]&&d&&K.set([d[0],d[1],d[2],Za(l,0,1)]),671088646&e.$$.dirty[0]&&o(32,i=!!(_&&W&&V&&O.length)),536936454&e.$$.dirty[0]&&W&&V&&_&&(be=0,_.resize(W,V,C)),2&e.$$.dirty[1]&&o(31,n=i?sc()?xe:fe:a),3&e.$$.dirty[1]&&i&&n&&n()},[$,W,V,m,X,G,Y,q,K,f,b,x,v,w,S,k,C,M,T,R,I,A,E,L,F,z,D,O,B,_,j,n,i,l,d,function(e){Nr[e?"unshift":"push"]((()=>{$=e,o(0,$)}))},e=>{o(1,W=e.detail.width),o(2,V=e.detail.height),m("measure",{width:W,height:V})}]}class uc extends wa{constructor(e){super(),va(this,e,dc,cc,Nn,{isAnimated:9,isTransparent:10,maskRect:11,maskOpacity:12,maskFrameOpacity:13,maskMarkupOpacity:14,clipAnnotationsToImage:15,pixelRatio:16,textPixelRatio:17,backgroundColor:18,willRender:19,didRender:20,willRequest:21,loadImageData:22,enableGrid:23,gridColors:24,gridSize:25,gridOpacity:26,images:27,interfaceImages:28},null,[-1,-1,-1])}}var hc=(e,t=Boolean,o=" ")=>e.filter(t).join(o);function pc(e,t,o){const i=e.slice();return i[17]=t[o],i}const mc=e=>({tab:4&e}),gc=e=>({tab:e[17]});function $c(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=pc(e,a,t),i=s(o);r.set(i,n[t]=fc(i,o))}return{c(){t=hr("ul");for(let e=0;e<n.length;e+=1)n[e].c();xr(t,"class",o=hc(["PinturaTabList",e[0]])),xr(t,"role","tablist"),xr(t,"data-layout",e[1])},m(o,r){dr(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],ra(),n=ma(n,l,s,1,e,a,r,t,pa,fc,null,pc),aa()),(!i||1&l&&o!==(o=hc(["PinturaTabList",e[0]])))&&xr(t,"class",o),(!i||2&l)&&xr(t,"data-layout",e[1])},i(e){if(!i){for(let e=0;e<a.length;e+=1)sa(n[e]);i=!0}},o(e){for(let e=0;e<n.length;e+=1)la(n[e]);i=!1},d(o){o&&ur(t);for(let e=0;e<n.length;e+=1)n[e].d();e[14](null)}}}function fc(e,t){let o,i,n,r,a,s,l,c,d,u;const h=t[11].default,p=Zn(h,t,t[10],gc);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=hr("li"),i=hr("button"),p&&p.c(),r=gr(),xr(i,"type","button"),i.disabled=n=t[17].disabled,xr(o,"role","tab"),xr(o,"aria-controls",a=t[17].href.substr(1)),xr(o,"id",s=t[17].tabId),xr(o,"aria-selected",l=t[17].selected),this.first=o},m(e,t){dr(e,o,t),sr(o,i),p&&p.m(i,null),sr(o,r),c=!0,d||(u=[fr(i,"keydown",m),fr(i,"click",g)],d=!0)},p(e,r){t=e,p&&p.p&&(!c||1028&r)&&Yn(p,h,t,t[10],c?Gn(h,t[10],r,mc):qn(t[10]),gc),(!c||4&r&&n!==(n=t[17].disabled))&&(i.disabled=n),(!c||4&r&&a!==(a=t[17].href.substr(1)))&&xr(o,"aria-controls",a),(!c||4&r&&s!==(s=t[17].tabId))&&xr(o,"id",s),(!c||4&r&&l!==(l=t[17].selected))&&xr(o,"aria-selected",l)},i(e){c||(sa(p,e),c=!0)},o(e){la(p,e),c=!1},d(e){e&&ur(o),p&&p.d(e),d=!1,Wn(u)}}}function yc(e){let t,o,i=e[4]&&$c(e);return{c(){i&&i.c(),t=$r()},m(e,n){i&&i.m(e,n),dr(e,t,n),o=!0},p(e,[o]){e[4]?i?(i.p(e,o),16&o&&sa(i,1)):(i=$c(e),i.c(),sa(i,1),i.m(t.parentNode,t)):i&&(ra(),la(i,1,1,(()=>{i=null})),aa())},i(e){o||(sa(i),o=!0)},o(e){la(i),o=!1},d(e){i&&i.d(e),e&&ur(t)}}}function bc(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=Or(),m=e=>{const t=r.querySelectorAll('[role="tab"] button')[e];t&&t.focus()},g=(e,t)=>{e.preventDefault(),e.stopPropagation(),p("select",t)},$=({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,$,c,d,u,s,a,(e,t)=>$(t,e.id),(e,t)=>g(t,e.id),function(e){Nr[e?"unshift":"push"]((()=>{r=e,o(3,r)}))}]}class xc extends wa{constructor(e){super(),va(this,e,bc,yc,Nn,{class:0,name:7,selected:8,tabs:9,layout:1})}}const vc=e=>({panel:16&e}),wc=e=>({panel:e[4][0].id,panelIsActive:!0});function Sc(e,t,o){const i=e.slice();return i[14]=t[o].id,i[15]=t[o].shouldDraw,i[16]=t[o].panelId,i[17]=t[o].tabindex,i[18]=t[o].labelledBy,i[19]=t[o].isActive,i[20]=t[o].hidden,i[3]=t[o].visible,i}const kc=e=>({panel:16&e,panelIsActive:16&e}),Cc=e=>({panel:e[14],panelIsActive:e[19]});function Mc(e){let t,o,i,n,r,a;const s=e[11].default,l=Zn(s,e,e[10],wc);return{c(){t=hr("div"),o=hr("div"),l&&l.c(),xr(o,"class",i=hc([e[1]])),xr(t,"class",e[0]),xr(t,"style",e[2])},m(i,s){dr(i,t,s),sr(t,o),l&&l.m(o,null),n=!0,r||(a=[fr(t,"measure",e[13]),er(oc.call(null,t))],r=!0)},p(e,r){l&&l.p&&(!n||1040&r)&&Yn(l,s,e,e[10],n?Gn(s,e[10],r,vc):qn(e[10]),wc),(!n||2&r&&i!==(i=hc([e[1]])))&&xr(o,"class",i),(!n||1&r)&&xr(t,"class",e[0]),(!n||4&r)&&xr(t,"style",e[2])},i(e){n||(sa(l,e),n=!0)},o(e){la(l,e),n=!1},d(e){e&&ur(t),l&&l.d(e),r=!1,Wn(a)}}}function Tc(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=Sc(e,l,t),i=c(o);s.set(i,a[t]=Rc(i,o))}return{c(){t=hr("div");for(let e=0;e<a.length;e+=1)a[e].c();xr(t,"class",o=hc(["PinturaTabPanels",e[0]])),xr(t,"style",e[2])},m(o,s){dr(o,t,s);for(let e=0;e<a.length;e+=1)a[e].m(t,null);i=!0,n||(r=[fr(t,"measure",e[12]),er(oc.call(null,t,{observePosition:!0}))],n=!0)},p(e,n){1042&n&&(l=e[4],ra(),a=ma(a,n,c,1,e,l,s,t,pa,Rc,null,Sc),aa()),(!i||1&n&&o!==(o=hc(["PinturaTabPanels",e[0]])))&&xr(t,"class",o),(!i||4&n)&&xr(t,"style",e[2])},i(e){if(!i){for(let e=0;e<l.length;e+=1)sa(a[e]);i=!0}},o(e){for(let e=0;e<a.length;e+=1)la(a[e]);i=!1},d(e){e&&ur(t);for(let e=0;e<a.length;e+=1)a[e].d();n=!1,Wn(r)}}}function Pc(e){let t;const o=e[11].default,i=Zn(o,e,e[10],Cc);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,n){i&&i.p&&(!t||1040&n)&&Yn(i,o,e,e[10],t?Gn(o,e[10],n,kc):qn(e[10]),Cc)},i(e){t||(sa(i,e),t=!0)},o(e){la(i,e),t=!1},d(e){i&&i.d(e)}}}function Rc(e,t){let o,i,n,r,a,s,l,c,d,u=t[15]&&Pc(t);return{key:e,first:null,c(){o=hr("div"),u&&u.c(),i=gr(),xr(o,"class",n=hc(["PinturaTabPanel",t[1]])),o.hidden=r=t[20],xr(o,"id",a=t[16]),xr(o,"tabindex",s=t[17]),xr(o,"aria-labelledby",l=t[18]),xr(o,"data-inert",c=!t[3]),this.first=o},m(e,t){dr(e,o,t),u&&u.m(o,null),sr(o,i),d=!0},p(e,h){(t=e)[15]?u?(u.p(t,h),16&h&&sa(u,1)):(u=Pc(t),u.c(),sa(u,1),u.m(o,i)):u&&(ra(),la(u,1,1,(()=>{u=null})),aa()),(!d||2&h&&n!==(n=hc(["PinturaTabPanel",t[1]])))&&xr(o,"class",n),(!d||16&h&&r!==(r=t[20]))&&(o.hidden=r),(!d||16&h&&a!==(a=t[16]))&&xr(o,"id",a),(!d||16&h&&s!==(s=t[17]))&&xr(o,"tabindex",s),(!d||16&h&&l!==(l=t[18]))&&xr(o,"aria-labelledby",l),(!d||16&h&&c!==(c=!t[3]))&&xr(o,"data-inert",c)},i(e){d||(sa(u),d=!0)},o(e){la(u),d=!1},d(e){e&&ur(o),u&&u.d()}}}function Ic(e){let t,o,i,n;const r=[Tc,Mc],a=[];function s(e,t){return e[5]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=$r()},m(e,o){a[t].m(e,o),dr(e,i,o),n=!0},p(e,[n]){let l=t;t=s(e),t===l?a[t].p(e,n):(ra(),la(a[l],1,1,(()=>{a[l]=null})),aa(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sa(o,1),o.m(i.parentNode,i))},i(e){n||(sa(o),n=!0)},o(e){la(o),n=!1},d(e){a[t].d(e),e&&ur(i)}}}function Ac(e,t,o){let i,n,{$$slots:r={},$$scope:a}=t,{class:s}=t,{name:l}=t,{selected:c}=t,{panelClass:d}=t,{panels:u=[]}=t,{visible: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),"panelClass"in e&&o(1,d=e.panelClass),"panels"in e&&o(8,u=e.panels),"visible"in e&&o(3,h=e.visible),"style"in e&&o(2,p=e.style),"$$scope"in e&&o(10,a=e.$$scope)},e.$$.update=()=>{968&e.$$.dirty&&o(4,i=u.map((e=>{const t=e===c;t&&o(9,m[e]=!0,m);const i=h?-1!==h.indexOf(e):t;return{id:e,panelId:`panel-${l}-${e}`,labelledBy:`tab-${l}-${e}`,isActive:t,hidden:!t,visible:i,tabindex:t?0:-1,shouldDraw:t||m[e]}}))),16&e.$$.dirty&&o(5,n=i.length>1)},[s,d,p,h,i,n,l,c,u,m,a,r,function(t){Wr.call(this,e,t)},function(t){Wr.call(this,e,t)}]}class Ec extends wa{constructor(e){super(),va(this,e,Ac,Ic,Nn,{class:0,name:6,selected:7,panelClass:1,panels:8,visible:3,style:2})}}var Lc=e=>{const t=Object.getOwnPropertyDescriptors(e.prototype);return Object.keys(t).filter((e=>!!t[e].get))};function Fc(e){let t,o,i,n;const r=[e[4]];function a(t){e[22](t)}var s=e[10];function l(e){let t={};for(let e=0;e<r.length;e+=1)t=On(t,r[e]);return void 0!==e[2]&&(t.name=e[2]),{props:t}}return s&&(t=Mr(s,l(e)),Nr.push((()=>fa(t,"name",a))),e[23](t),t.$on("measure",e[11])),{c(){t&&ya(t.$$.fragment),i=$r()},m(e,o){t&&ba(t,e,o),dr(e,i,o),n=!0},p(e,n){const c=16&n[0]?ga(r,[$a(e[4])]):{};if(!o&&4&n[0]&&(o=!0,c.name=e[2],qr((()=>o=!1))),s!==(s=e[10])){if(t){ra();const e=t;la(e.$$.fragment,1,0,(()=>{xa(e,1)})),aa()}s?(t=Mr(s,l(e)),Nr.push((()=>fa(t,"name",a))),e[23](t),t.$on("measure",e[11]),ya(t.$$.fragment),sa(t.$$.fragment,1),ba(t,i.parentNode,i)):t=null}else s&&t.$set(c)},i(e){n||(t&&sa(t.$$.fragment,e),n=!0)},o(e){t&&la(t.$$.fragment,e),n=!1},d(o){e[23](null),o&&ur(i),t&&xa(t,o)}}}function zc(e){let t,o,i,n=e[5]&&Fc(e);return{c(){t=hr("div"),n&&n.c(),xr(t,"data-util",e[2]),xr(t,"class",o=hc(["PinturaUtilPanel",e[1]])),xr(t,"style",e[6])},m(o,r){dr(o,t,r),n&&n.m(t,null),e[24](t),i=!0},p(e,r){e[5]?n?(n.p(e,r),32&r[0]&&sa(n,1)):(n=Fc(e),n.c(),sa(n,1),n.m(t,null)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa()),(!i||4&r[0])&&xr(t,"data-util",e[2]),(!i||2&r[0]&&o!==(o=hc(["PinturaUtilPanel",e[1]])))&&xr(t,"class",o),(!i||64&r[0])&&xr(t,"style",e[6])},i(e){i||(sa(n),i=!0)},o(e){la(n),i=!1},d(o){o&&ur(t),n&&n.d(),e[24](null)}}}function Dc(e,t,o){let i,n,r,a,s,l;const c=Or();let{isActive:d=!0}=t,{stores:u}=t,{content:h}=t,{component:p}=t,{locale:m}=t,{class:g}=t;const $=_r("isAnimated");let f;Un(e,$,(e=>o(21,l=e)));const y=Wl(0),b=Ma(y,(e=>Za(e,0,1)));Un(e,b,(e=>o(20,s=e)));let x=!d;const v=Ca(d);Un(e,v,(e=>o(25,a=e)));const w={isActive:Ma(v,(async(e,t)=>{if(!e)return t(e);await Gr(),t(e)})),isActiveFraction:Ma(b,(e=>e)),isVisible:Ma(b,(e=>e>0))},S=h.view,k=Lc(S),C=Object.keys(h.props||{}).reduce(((e,t)=>k.includes(t)?(e[t]=h.props[t],e):e),{}),M=Object.keys(w).reduce(((e,t)=>k.includes(t)?(e[t]=w[t],e):e),{});let T,P;const R=e=>{o(17,f={...e.detail}),A&&d&&c("measure",{...f})};Br("measurable",oc);const I=Lr().$$.context;let A=!1;return Fr((()=>{if(o(19,A=!0),r)return;o(0,p=new S({target:P,props:{...n},context:I})),o(2,T=p.name);const e=p.$on("measure",R);return()=>{e(),p.$destroy()}})),e.$$set=e=>{"isActive"in e&&o(12,d=e.isActive),"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(1,g=e.class)},e.$$.update=()=>{135169&e.$$.dirty[0]&&f&&d&&p&&c("measure",f),2101248&e.$$.dirty[0]&&y.set(d?1:0,{hard:!1===l}),1310720&e.$$.dirty[0]&&(s<=0&&!x?o(18,x=!0):s>0&&x&&o(18,x=!1)),786432&e.$$.dirty[0]&&A&&c(x?"hide":"show"),1048576&e.$$.dirty[0]&&c("fade",s),1048576&e.$$.dirty[0]&&o(6,i=s<1?"opacity: "+s:void 0),4096&e.$$.dirty[0]&&Qn(v,a=d,a),40960&e.$$.dirty[0]&&o(4,n={...C,...M,stores:u,locale:m})},o(5,r=!k.includes("external")),[p,g,T,P,n,r,i,$,b,v,S,R,d,u,h,m,y,f,x,A,s,l,function(e){T=e,o(2,T)},function(e){Nr[e?"unshift":"push"]((()=>{p=e,o(0,p)}))},function(e){Nr[e?"unshift":"push"]((()=>{P=e,o(3,P)}))}]}class Oc extends wa{constructor(e){super(),va(this,e,Dc,zc,Nn,{isActive:12,stores:13,content:14,component:0,locale:15,class:1,opacity:16},null,[-1,-1])}get opacity(){return this.$$.ctx[16]}}function Bc(e){let t,o,i;const n=e[5].default,r=Zn(n,e,e[4],null);return{c(){t=pr("svg"),r&&r.c(),xr(t,"class",e[3]),xr(t,"style",e[2]),xr(t,"width",e[0]),xr(t,"height",e[1]),xr(t,"viewBox",o="0 0 "+e[0]+"\n    "+e[1]),xr(t,"xmlns","http://www.w3.org/2000/svg"),xr(t,"aria-hidden","true"),xr(t,"focusable","false"),xr(t,"stroke-linecap","round"),xr(t,"stroke-linejoin","round")},m(e,o){dr(e,t,o),r&&r.m(t,null),i=!0},p(e,[a]){r&&r.p&&(!i||16&a)&&Yn(r,n,e,e[4],i?Gn(n,e[4],a,null):qn(e[4]),null),(!i||8&a)&&xr(t,"class",e[3]),(!i||4&a)&&xr(t,"style",e[2]),(!i||1&a)&&xr(t,"width",e[0]),(!i||2&a)&&xr(t,"height",e[1]),(!i||3&a&&o!==(o="0 0 "+e[0]+"\n    "+e[1]))&&xr(t,"viewBox",o)},i(e){i||(sa(r,e),i=!0)},o(e){la(r,e),i=!1},d(e){e&&ur(t),r&&r.d(e)}}}function _c(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 Wc extends wa{constructor(e){super(),va(this,e,_c,Bc,Nn,{width:0,height:1,style:2,class:3})}}var Vc=(e,t)=>t===e.target||t.contains(e.target),Nc=(e,t,o)=>{return(P(t)?t:e)+(o?` (${i=o,i.map((e=>"CMD"===e?lo()?"⌘":"Ctrl":e)).join("+")})`:"");var i};function Hc(e){let t,o;return t=new Wc({props:{class:"PinturaButtonIcon",$$slots:{default:[jc]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};536870920&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function jc(e){let t;return{c(){t=pr("g")},m(o,i){dr(o,t,i),t.innerHTML=e[3]},p(e,o){8&o&&(t.innerHTML=e[3])},d(e){e&&ur(t)}}}function Uc(e){let t;return{c(){t=hr("span"),xr(t,"class",e[11])},m(o,i){dr(o,t,i),t.innerHTML=e[0]},p(e,o){1&o&&(t.innerHTML=e[0]),2048&o&&xr(t,"class",e[11])},d(e){e&&ur(t)}}}function Zc(e){let t,o,i,n,r;const a=e[27].default,s=Zn(a,e,e[29],null),l=s||function(e){let t,o,i,n=e[3]&&Hc(e),r=e[0]&&Uc(e);return{c(){t=hr("span"),n&&n.c(),o=gr(),r&&r.c(),xr(t,"class",e[13])},m(e,a){dr(e,t,a),n&&n.m(t,null),sr(t,o),r&&r.m(t,null),i=!0},p(e,a){e[3]?n?(n.p(e,a),8&a&&sa(n,1)):(n=Hc(e),n.c(),sa(n,1),n.m(t,o)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa()),e[0]?r?r.p(e,a):(r=Uc(e),r.c(),r.m(t,null)):r&&(r.d(1),r=null),(!i||8192&a)&&xr(t,"class",e[13])},i(e){i||(sa(n),i=!0)},o(e){la(n),i=!1},d(e){e&&ur(t),n&&n.d(),r&&r.d()}}}(e);return{c(){t=hr("button"),l&&l.c(),xr(t,"type",e[6]),xr(t,"style",e[4]),t.disabled=e[5],xr(t,"class",e[12]),xr(t,"title",o=Nc(e[0],e[1],e[2]))},m(o,a){dr(o,t,a),l&&l.m(t,null),e[28](t),i=!0,n||(r=[fr(t,"keydown",(function(){Vn(e[8])&&e[8].apply(this,arguments)})),fr(t,"click",(function(){Vn(e[7])&&e[7].apply(this,arguments)})),fr(t,"pointerdown",(function(){Vn(e[14])&&e[14].apply(this,arguments)})),er(e[9].call(null,t))],n=!0)},p(n,[r]){e=n,s?s.p&&(!i||536870912&r)&&Yn(s,a,e,e[29],i?Gn(a,e[29],r,null):qn(e[29]),null):l&&l.p&&(!i||10249&r)&&l.p(e,i?r:-1),(!i||64&r)&&xr(t,"type",e[6]),(!i||16&r)&&xr(t,"style",e[4]),(!i||32&r)&&(t.disabled=e[5]),(!i||4096&r)&&xr(t,"class",e[12]),(!i||7&r&&o!==(o=Nc(e[0],e[1],e[2])))&&xr(t,"title",o)},i(e){i||(sa(l,e),i=!0)},o(e){la(l,e),i=!1},d(o){o&&ur(t),l&&l.d(o),e[28](null),n=!1,Wn(r)}}}function Xc(e,t,o){let i,n,r,a,s,l,{$$slots:c={},$$scope:d}=t,{class:u}=t,{label:h}=t,{title:p}=t,{shortcut:m}=t,{labelClass:g}=t,{innerClass:$}=t,{hideLabel:f=!1}=t,{icon:y}=t,{style:b}=t,{disabled:x}=t,{type:v="button"}=t,{onclick:w}=t,{onkeydown:S}=t,{onhold:k}=t,{action:C=(()=>{})}=t,{holdThreshold:M=500}=t,{holdSpeedUpFactor:T=.5}=t,{holdSpeedMin:P=20}=t;const R=e=>{o(25,l=setTimeout((()=>{k(),R(Math.max(e*T,P))}),e))};let I;return e.$$set=e=>{"class"in e&&o(15,u=e.class),"label"in e&&o(0,h=e.label),"title"in e&&o(1,p=e.title),"shortcut"in e&&o(2,m=e.shortcut),"labelClass"in e&&o(16,g=e.labelClass),"innerClass"in e&&o(17,$=e.innerClass),"hideLabel"in e&&o(18,f=e.hideLabel),"icon"in e&&o(3,y=e.icon),"style"in e&&o(4,b=e.style),"disabled"in e&&o(5,x=e.disabled),"type"in e&&o(6,v=e.type),"onclick"in e&&o(7,w=e.onclick),"onkeydown"in e&&o(8,S=e.onkeydown),"onhold"in e&&o(19,k=e.onhold),"action"in e&&o(9,C=e.action),"holdThreshold"in e&&o(20,M=e.holdThreshold),"holdSpeedUpFactor"in e&&o(21,T=e.holdSpeedUpFactor),"holdSpeedMin"in e&&o(22,P=e.holdSpeedMin),"$$scope"in e&&o(29,d=e.$$scope)},e.$$.update=()=>{101187584&e.$$.dirty&&o(26,n=k?()=>{l&&(clearTimeout(l),o(25,l=void 0),document.documentElement.removeEventListener("pointerup",n))}:zn),68681728&e.$$.dirty&&o(14,i=k?()=>{document.documentElement.addEventListener("pointerup",n),R(M)}:zn),131072&e.$$.dirty&&o(13,r=hc(["PinturaButtonInner",$])),294912&e.$$.dirty&&o(12,a=hc(["PinturaButton",f&&"PinturaButtonIconOnly",u])),327680&e.$$.dirty&&o(11,s=hc([f?"implicit":"PinturaButtonLabel",g]))},[h,p,m,y,b,x,v,w,S,C,I,s,a,r,i,u,g,$,f,k,M,T,P,e=>Vc(e,I),()=>I,l,n,c,function(e){Nr[e?"unshift":"push"]((()=>{I=e,o(10,I)}))},d]}class Gc extends wa{constructor(e){super(),va(this,e,Xc,Zc,Nn,{class:15,label:0,title:1,shortcut:2,labelClass:16,innerClass:17,hideLabel:18,icon:3,style:4,disabled:5,type:6,onclick:7,onkeydown:8,onhold:19,action:9,holdThreshold:20,holdSpeedUpFactor:21,holdSpeedMin:22,isEventTarget:23,getElement:24})}get isEventTarget(){return this.$$.ctx[23]}get getElement(){return this.$$.ctx[24]}}var Yc=(e,t)=>{const o=e.findIndex(t);if(o>=0)return e.splice(o,1)};const qc=80;var Kc=(e,t={})=>{const{inertia:o=!1,inertiaDurationMultiplier:i=qc,shouldStartInteraction:n=(()=>!0),pinch:r=!1,multiTouch:a,getEventPosition:s=(e=>ue(e.clientX,e.clientY))}=t;function l(t,o){e.dispatchEvent(new CustomEvent(t,{detail:o}))}function c(){v&&v(),v=void 0}const d=[],u=e=>0===e.timeStamp?Date.now():e.timeStamp,h=()=>{const e=pe(d[0].position);if(d[1]){const t=.5*(d[1].position.x-e.x),o=.5*(d[1].position.y-e.y);e.x+=t,e.y+=o}return e},p=e=>{e.origin.x=e.position.x,e.origin.y=e.position.y,e.translation.x=0,e.translation.y=0},m=e=>{const t=(e=>d.findIndex((t=>t.event.pointerId===e.pointerId)))(e);if(!(t<0))return d[t]},g=()=>1===d.length,$=()=>2===d.length,f=e=>{const t=Ie(e.map((e=>e.position)));return{center:t,distance:((e,t)=>e.reduce(((e,o)=>e+Pe(t,o.position)),0)/e.length)(e,t),velocity:Ie(e.map((e=>e.velocity))),translation:Ie(e.map((e=>e.translation)))}};let y,b,x,v,w,S,k,C,M=0,T=void 0;function P(t){if(!$()&&!(e=>Mo(e.button)&&0!==e.button)(t)&&n(t,e))if(c(),(e=>{const t=u(e),o={timeStamp:t,timeStampInitial:t,position:s(e),origin:s(e),velocity:de(),velocityHistory:[],velocityAverage:de(),translation:de(),interactionState:void 0,event:e};d.push(o),o.interactionState=f(d)})(t),g())document.documentElement.addEventListener("pointermove",I),document.documentElement.addEventListener("pointerup",A),document.documentElement.addEventListener("pointercancel",A),document.addEventListener("visibilitychange",L),C=!1,k=1,S=de(),w=void 0,l("interactionstart",{origin:pe(m(t).origin)});else if(r)C=!0,w=Pe(d[0].position,d[1].position),S.x+=d[0].translation.x,S.y+=d[0].translation.y,p(d[0]);else if(!1===a)return d.length=0,z(),l("interactioncancel")}e.addEventListener("pointerdown",P);let R=Date.now();function I(e){e.preventDefault(),(e=>{const t=m(e);if(!t)return;const o=u(e),i=s(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.velocityHistory.push(pe(t.velocity)),t.velocityHistory=t.velocityHistory.slice(-3),t.velocityAverage=t.velocityHistory.reduce(((e,t,o,i)=>(e.x+=t.x/i.length,e.y+=t.y/i.length,e)),de()),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);const t=pe(d[0].translation);let o=k;if(r&&$()){o*=Pe(d[0].position,d[1].position)/w,ve(t,d[1].translation)}ve(t,S);const i=Date.now();i-R<16||(R=i,l("interactionupdate",{position:h(),translation:t,scalar:r?o:void 0,isMultiTouching:$()}))}function A(e){if(!m(e))return;const t=h(),n=(e=>{const t=Yc(d,(t=>t.event.pointerId===e.pointerId));if(t)return t[0]})(e);if(r&&g()){const e=Pe(d[0].position,n.position);k*=e/w,S.x+=d[0].translation.x+n.translation.x,S.y+=d[0].translation.y+n.translation.y,p(d[0])}let a=!1,s=!1;if(!C&&n){const e=performance.now(),t=e-n.timeStampInitial,o=Te(n.translation);a=o<64&&t<300,s=!!(T&&a&&e-M<700&&Te(T,n.position)<128),a&&(T=pe(n.position),M=e)}if(d.length>0)return;z();const c=pe(n.translation),u=pe(n.velocityAverage);let $=!1;l("interactionrelease",{isTap:a,isDoubleTap:s,position:t,translation:c,scalar:k,preventInertia:()=>$=!0});const f=Pe(u);if($||!o||f<.25)return F(c,{isTap:a,isDoubleTap:s});b=pe(t),x=pe(c),y=Bl(pe(c),{easing:zl,duration:f*i}),y.set({x:c.x+50*u.x,y:c.y+50*u.y}).then((()=>{v&&F(jn(y),{isTap:a,isDoubleTap:s})})),v=y.subscribe(E)}function E(e){e&&l("interactionupdate",{position:ue(b.x+(e.x-x.x),b.y+(e.y-x.y)),translation:e,scalar:r?k:void 0})}function L(e){if("visible"===document.visibilityState||!d.length)return;const t=f(d);c(),l("interactionend",{...t}),d.length=0,z()}function F(e,t){c(),l("interactionend",{...t,translation:e,scalar:r?k:void 0})}function z(){document.documentElement.removeEventListener("pointermove",I),document.documentElement.removeEventListener("pointerup",A),document.documentElement.removeEventListener("pointercancel",A),document.addEventListener("visibilitychange",L)}return{destroy(){c(),e.removeEventListener("pointerdown",P)}}},Jc=(e,t={})=>{const{direction:o,shiftMultiplier:i=10,bubbles:n=!1,preventDefault:r=!1,stopKeydownPropagation:a=!0}=t,s="horizontal"===o,l="vertical"===o,c=t=>{const{key:o}=t,c=t.shiftKey,d=/up|down/i.test(o),u=/left|right/i.test(o);if(!u&&!d)return;if(s&&d)return;if(l&&u)return;const h=c?i:1;a&&t.stopPropagation(),r&&t.preventDefault(),e.dispatchEvent(new CustomEvent("nudge",{bubbles:n,detail:ue((/left/i.test(o)?-1:/right/i.test(o)?1:0)*h,(/up/i.test(o)?-1:/down/i.test(o)?1:0)*h)}))};return e.addEventListener("keydown",c),{destroy(){e.removeEventListener("keydown",c)}}};function Qc(e,t){return t?t*Math.sign(e)*Math.log10(1+Math.abs(e)/t):e}const ed=(e,t,o)=>{if(!t||!o)return{...e};const i=e.x+Qc(t.x-e.x,o),n=e.x+e.width+Qc(t.x+t.width-(e.x+e.width),o),r=e.y+Qc(t.y-e.y,o);return{x:i,y:r,width:n-i,height:e.y+e.height+Qc(t.y+t.height-(e.y+e.height),o)-r}},td=(e,t,o)=>t&&o?ue(e.x+Qc(t.x-e.x,o),e.y+Qc(t.y-e.y,o)):{...e};var od=(e,t)=>{if(e)return/em/.test(e)?16*parseInt(e,10):/px/.test(e)?parseInt(e,10):void 0},id=e=>{let t=e.detail||0;const{deltaX:o,deltaY:i,wheelDelta:n,wheelDeltaX:r,wheelDeltaY:a}=e;return Mo(r)&&Math.abs(r)>Math.abs(a)?t=r/-120:Mo(o)&&Math.abs(o)>Math.abs(i)?t=o/20:(n||a)&&(t=(n||a)/-120),t||(t=i/20),(jo()||Ht())&&(t*=2),t};function nd(e){let t,o,i,n,r,a,s;const l=e[36].default,c=Zn(l,e,e[35],null);return{c(){t=hr("div"),o=hr("div"),c&&c.c(),xr(o,"style",e[5]),xr(t,"class",i=hc(["PinturaScrollable",e[0]])),xr(t,"style",e[4]),xr(t,"data-direction",e[1]),xr(t,"data-state",e[6])},m(i,l){dr(i,t,l),sr(t,o),c&&c.m(o,null),e[38](t),r=!0,a||(s=[fr(o,"interactionstart",e[8]),fr(o,"interactionupdate",e[10]),fr(o,"interactionend",e[11]),fr(o,"interactionrelease",e[9]),er(Kc.call(null,o,{inertia:!0})),fr(o,"measure",e[37]),er(oc.call(null,o)),fr(t,"wheel",e[13],{passive:!1}),fr(t,"scroll",e[15]),fr(t,"focusin",e[14]),fr(t,"nudge",e[16]),fr(t,"measure",e[12]),er(oc.call(null,t,{observePosition:!0})),er(n=Jc.call(null,t,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1}))],a=!0)},p(e,a){c&&c.p&&(!r||16&a[1])&&Yn(c,l,e,e[35],r?Gn(l,e[35],a,null):qn(e[35]),null),(!r||32&a[0])&&xr(o,"style",e[5]),(!r||1&a[0]&&i!==(i=hc(["PinturaScrollable",e[0]])))&&xr(t,"class",i),(!r||16&a[0])&&xr(t,"style",e[4]),(!r||2&a[0])&&xr(t,"data-direction",e[1]),(!r||64&a[0])&&xr(t,"data-state",e[6]),n&&Vn(n.update)&&2&a[0]&&n.update.call(null,{direction:"x"===e[1]?"horizontal":"vertical",stopKeydownPropagation:!1})},i(e){r||(sa(c,e),r=!0)},o(e){la(c,e),r=!1},d(o){o&&ur(t),c&&c.d(o),e[38](null),a=!1,Wn(s)}}}function rd(e,t,o){let i,n,r,s,l,c,d,u,{$$slots:h={},$$scope:p}=t;const m=Or();let g,$,f,y,b="idle",x=Wl(0);Un(e,x,(e=>o(34,u=e)));let v,{class:w}=t,{scrollBlockInteractionDist:S=5}=t,{scrollStep:k=10}=t,{scrollFocusMargin:C=64}=t,{scrollDirection:M="x"}=t,{scrollAutoCancel:T=!1}=t,{elasticity:P=0}=t,{onscroll:R=a}=t,{maskFeatherSize:I}=t,{maskFeatherStartOpacity:A}=t,{maskFeatherEndOpacity:E}=t,{scroll:L}=t,F="",z=!0;const D=x.subscribe((e=>{const t=de();t[M]=e,R(t)})),O=e=>Math.max(Math.min(0,e),f[i]-$[i]);let B,_,W;const V=(e,t={})=>{const{elastic:i=!1,animate:n=!1,preventScrollState:r=!1}=t;Math.abs(e-g)>S&&"idle"===b&&!y&&!r&&o(27,b="scrolling");const a=O(e),s=i&&P&&!y?a+Qc(e-a,P):a;let l=!0;n?l=!1:z||(l=!y),z=!1,x.set(s,{hard:l}).then((e=>{y&&(z=!0)}))};Dr((()=>{D()}));return e.$$set=e=>{"class"in e&&o(0,w=e.class),"scrollBlockInteractionDist"in e&&o(20,S=e.scrollBlockInteractionDist),"scrollStep"in e&&o(21,k=e.scrollStep),"scrollFocusMargin"in e&&o(22,C=e.scrollFocusMargin),"scrollDirection"in e&&o(1,M=e.scrollDirection),"scrollAutoCancel"in e&&o(23,T=e.scrollAutoCancel),"elasticity"in e&&o(24,P=e.elasticity),"onscroll"in e&&o(25,R=e.onscroll),"maskFeatherSize"in e&&o(19,I=e.maskFeatherSize),"maskFeatherStartOpacity"in e&&o(17,A=e.maskFeatherStartOpacity),"maskFeatherEndOpacity"in e&&o(18,E=e.maskFeatherEndOpacity),"scroll"in e&&o(26,L=e.scroll),"$$scope"in e&&o(35,p=e.$$scope)},e.$$.update=()=>{if(2&e.$$.dirty[0]&&o(31,i="x"===M?"width":"height"),2&e.$$.dirty[0]&&o(29,n=M.toUpperCase()),8&e.$$.dirty[0]&&o(33,r=v&&getComputedStyle(v)),8&e.$$.dirty[0]|4&e.$$.dirty[1]&&o(32,s=r&&od(r.getPropertyValue("--scrollable-feather-size"))),268828676&e.$$.dirty[0]|11&e.$$.dirty[1]&&null!=u&&f&&null!=s&&$){const e=-1*u/s,t=-(f[i]-$[i]-u)/s;o(17,A=Za(1-e,0,1)),o(18,E=Za(1-t,0,1)),o(19,I=s),o(4,F=`--scrollable-feather-start-opacity: ${A};--scrollable-feather-end-opacity: ${E}`)}67108872&e.$$.dirty[0]&&v&&void 0!==L&&(Mo(L)?V(L):V(L.scrollOffset,L)),268435460&e.$$.dirty[0]|1&e.$$.dirty[1]&&o(30,l=f&&$?$[i]>f[i]:void 0),1207959552&e.$$.dirty[0]&&o(6,c=hc([b,l?"overflows":void 0])),1610612736&e.$$.dirty[0]|8&e.$$.dirty[1]&&o(5,d=l?`transform: translate${n}(${u}px)`:void 0)},[w,M,$,v,F,d,c,x,()=>{l&&(_=!1,B=!0,W=ue(0,0),y=!1,o(27,b="idle"),g=jn(x))},({detail:e})=>{l&&(y=!0,o(27,b="idle"))},({detail:e})=>{l&&(_||B&&(B=!1,Te(e.translation)<.1)||(!T||"x"!==M||(e=>{const t=xe(ue(e.x-W.x,e.y-W.y),Math.abs);W=pe(e);const o=Te(t),i=t.x-t.y;return!(o>1&&i<-.5)})(e.translation)?V(g+e.translation[M],{elastic:!0}):_=!0))},({detail:e})=>{if(!l)return;if(_)return;const t=g+e.translation[M],o=O(t);z=!1,x.set(o).then((e=>{y&&(z=!0)}))},({detail:e})=>{o(28,f=e),m("measure",{x:e.x,y:e.y,width:e.width,height:e.height})},e=>{if(!l)return;e.preventDefault(),e.stopPropagation();const t=e.shiftKey,o=id(e)*(t?-1:1),i=jn(x);V(i+o*k,{animate:!0})},e=>{if(!l)return;if(!y)return;let t=e.target;e.target.classList.contains("implicit")&&(t=t.parentNode);const o=t["x"===M?"offsetLeft":"offsetTop"],n=o+t["x"===M?"offsetWidth":"offsetHeight"],r=jn(x),a=C+I;r+o<a?V(-o+a):r+n>f[i]-a&&V(f[i]-n-a,{animate:!0})},()=>{o(3,v["x"===M?"scrollLeft":"scrollTop"]=0,v)},({detail:e})=>{if(v.querySelector("[data-focus-visible]"))return;const t=-2*e[M],o=jn(x);V(o+t*k,{animate:!0,preventScrollState:!0})},A,E,I,S,k,C,T,P,R,L,b,f,n,l,i,s,r,u,p,h,e=>o(2,$=e.detail),function(e){Nr[e?"unshift":"push"]((()=>{v=e,o(3,v)}))}]}class ad extends wa{constructor(e){super(),va(this,e,rd,nd,Nn,{class:0,scrollBlockInteractionDist:20,scrollStep:21,scrollFocusMargin:22,scrollDirection:1,scrollAutoCancel:23,elasticity:24,onscroll:25,maskFeatherSize:19,maskFeatherStartOpacity:17,maskFeatherEndOpacity:18,scroll:26},null,[-1,-1])}}function sd(e,{delay:t=0,duration:o=400,easing:i=Dn}={}){const n=+getComputedStyle(e).opacity;return{delay:t,duration:o,easing:i,css:e=>"opacity: "+e*n}}function ld(e){let t,o,i,n,r;return{c(){t=hr("span"),xr(t,"class","PinturaStatusMessage")},m(o,a){dr(o,t,a),t.innerHTML=e[0],i=!0,n||(r=[fr(t,"measure",(function(){Vn(e[1])&&e[1].apply(this,arguments)})),er(oc.call(null,t))],n=!0)},p(o,[n]){e=o,(!i||1&n)&&(t.innerHTML=e[0])},i(e){i||(Yr((()=>{o||(o=da(t,sd,{duration:500},!0)),o.run(1)})),i=!0)},o(e){o||(o=da(t,sd,{duration:500},!1)),o.run(0),i=!1},d(e){e&&ur(t),e&&o&&o.end(),n=!1,Wn(r)}}}function cd(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 dd extends wa{constructor(e){super(),va(this,e,cd,ld,Nn,{text:0,onmeasure:1})}}function ud(e){let t,o,i,n,r,a,s,l;return{c(){t=hr("span"),o=pr("svg"),i=pr("g"),n=pr("circle"),r=pr("circle"),a=gr(),s=hr("span"),l=mr(e[3]),xr(n,"class","PinturaProgressIndicatorBar"),xr(n,"r","8.5"),xr(n,"cx","10"),xr(n,"cy","10"),xr(n,"stroke-linecap","round"),xr(n,"opacity",".25"),xr(r,"class","PinturaProgressIndicatorFill"),xr(r,"r","8.5"),xr(r,"stroke-dasharray",e[2]),xr(r,"cx","10"),xr(r,"cy","10"),xr(r,"transform","rotate(-90) translate(-20)"),xr(i,"fill","none"),xr(i,"stroke","currentColor"),xr(i,"stroke-width","2.5"),xr(i,"stroke-linecap","round"),xr(i,"opacity",e[1]),xr(o,"width","20"),xr(o,"height","20"),xr(o,"viewBox","0 0 20 20"),xr(o,"xmlns","http://www.w3.org/2000/svg"),xr(o,"aria-hidden","true"),xr(o,"focusable","false"),xr(s,"class","implicit"),xr(t,"class","PinturaProgressIndicator"),xr(t,"data-status",e[0])},m(e,c){dr(e,t,c),sr(t,o),sr(o,i),sr(i,n),sr(i,r),sr(t,a),sr(t,s),sr(s,l)},p(e,[o]){4&o&&xr(r,"stroke-dasharray",e[2]),2&o&&xr(i,"opacity",e[1]),8&o&&wr(l,e[3]),1&o&&xr(t,"data-status",e[0])},i:zn,o:zn,d(e){e&&ur(t)}}}function hd(e,t,o){let i,n,r,a,s,l;const c=Or();let{progress:d}=t,{min:u=0}=t,{max:h=100}=t,{labelBusy:p="Busy"}=t;const m=Wl(0,{precision:.01}),g=Wl(0,{precision:.01});Un(e,g,(e=>o(10,s=e)));const $=Ma([m],(e=>Za(e,u,h)));Un(e,$,(e=>o(11,l=e)));const f=$.subscribe((e=>{1===d&&Math.round(e)>=100&&c("complete")}));return Fr((()=>{g.set(1)})),Dr((()=>{f()})),e.$$set=e=>{"progress"in e&&o(6,d=e.progress),"min"in e&&o(7,u=e.min),"max"in e&&o(8,h=e.max),"labelBusy"in e&&o(9,p=e.labelBusy)},e.$$.update=()=>{64&e.$$.dirty&&d&&d!==1/0&&m.set(100*d),2624&e.$$.dirty&&o(3,i=d===1/0?p:Math.round(l)+"%"),2112&e.$$.dirty&&o(2,n=d===1/0?"26.5 53":l/100*53+" 53"),1024&e.$$.dirty&&o(1,r=s),64&e.$$.dirty&&o(0,a=d===1/0?"busy":"loading")},[a,r,n,i,g,$,d,u,h,p,s,l]}class pd extends wa{constructor(e){super(),va(this,e,hd,ud,Nn,{progress:6,min:7,max:8,labelBusy:9})}}function md(e){let t,o,i;const n=e[5].default,r=Zn(n,e,e[4],null);return{c(){t=hr("span"),r&&r.c(),xr(t,"class",o="PinturaStatusAside "+e[0]),xr(t,"style",e[1])},m(e,o){dr(e,t,o),r&&r.m(t,null),i=!0},p(e,[a]){r&&r.p&&(!i||16&a)&&Yn(r,n,e,e[4],i?Gn(n,e[4],a,null):qn(e[4]),null),(!i||1&a&&o!==(o="PinturaStatusAside "+e[0]))&&xr(t,"class",o),(!i||2&a)&&xr(t,"style",e[1])},i(e){i||(sa(r,e),i=!0)},o(e){la(r,e),i=!1},d(e){e&&ur(t),r&&r.d(e)}}}function gd(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 $d extends wa{constructor(e){super(),va(this,e,gd,md,Nn,{offset:2,opacity:3,class:0})}}function fd(e){let t,o,i;const n=e[3].default,r=Zn(n,e,e[2],null);let a=[{for:o="_"},e[1]],s={};for(let e=0;e<a.length;e+=1)s=On(s,a[e]);return{c(){t=hr("label"),r&&r.c(),vr(t,s)},m(e,o){dr(e,t,o),r&&r.m(t,null),i=!0},p(e,o){r&&r.p&&(!i||4&o)&&Yn(r,n,e,e[2],i?Gn(n,e[2],o,null):qn(e[2]),null),vr(t,s=ga(a,[{for:"_"},2&o&&e[1]]))},i(e){i||(sa(r,e),i=!0)},o(e){la(r,e),i=!1},d(e){e&&ur(t),r&&r.d(e)}}}function yd(e){let t,o;const i=e[3].default,n=Zn(i,e,e[2],null);let r=[e[1]],a={};for(let e=0;e<r.length;e+=1)a=On(a,r[e]);return{c(){t=hr("div"),n&&n.c(),vr(t,a)},m(e,i){dr(e,t,i),n&&n.m(t,null),o=!0},p(e,s){n&&n.p&&(!o||4&s)&&Yn(n,i,e,e[2],o?Gn(i,e[2],s,null):qn(e[2]),null),vr(t,a=ga(r,[2&s&&e[1]]))},i(e){o||(sa(n,e),o=!0)},o(e){la(n,e),o=!1},d(e){e&&ur(t),n&&n.d(e)}}}function bd(e){let t,o;const i=e[3].default,n=Zn(i,e,e[2],null);let r=[e[1]],a={};for(let e=0;e<r.length;e+=1)a=On(a,r[e]);return{c(){t=hr("div"),n&&n.c(),vr(t,a)},m(e,i){dr(e,t,i),n&&n.m(t,null),o=!0},p(e,s){n&&n.p&&(!o||4&s)&&Yn(n,i,e,e[2],o?Gn(i,e[2],s,null):qn(e[2]),null),vr(t,a=ga(r,[2&s&&e[1]]))},i(e){o||(sa(n,e),o=!0)},o(e){la(n,e),o=!1},d(e){e&&ur(t),n&&n.d(e)}}}function xd(e){let t,o,i,n;const r=[bd,yd,fd],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=$r()},m(e,o){~t&&a[t].m(e,o),dr(e,i,o),n=!0},p(e,[n]){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(ra(),la(a[l],1,1,(()=>{a[l]=null})),aa()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sa(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(sa(o),n=!0)},o(e){la(o),n=!1},d(e){~t&&a[t].d(e),e&&ur(i)}}}function vd(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 wd extends wa{constructor(e){super(),va(this,e,vd,xd,Nn,{name:0,attributes:1})}}var Sd=()=>u()&&window.devicePixelRatio||1;let kd=null;var Cd=e=>(null===kd&&(kd=1===Sd()?Math.round:e=>e),kd(e)),Md=(e,t={})=>{if(e){if(t.preventScroll&&Ht()){const t=document.body.scrollTop;return e.focus(),void(document.body.scrollTop=t)}e.focus(t)}};const Td=e=>({}),Pd=e=>({}),Rd=e=>({}),Id=e=>({});function Ad(e){let t,o;const i=[e[7]];let n={$$slots:{default:[Ld]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=On(n,i[e]);return t=new Gc({props:n}),e[40](t),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const n=128&o[0]?ga(i,[$a(e[7])]):{};8192&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(o){e[40](null),xa(t,o)}}}function Ed(e){let t,o;const i=[e[7]];let n={};for(let e=0;e<i.length;e+=1)n=On(n,i[e]);return t=new Gc({props:n}),e[39](t),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const n=128&o[0]?ga(i,[$a(e[7])]):{};t.$set(n)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(o){e[39](null),xa(t,o)}}}function Ld(e){let t;const o=e[38].label,i=Zn(o,e,e[44],Id);return{c(){i&&i.c()},m(e,o){i&&i.m(e,o),t=!0},p(e,n){i&&i.p&&(!t||8192&n[1])&&Yn(i,o,e,e[44],t?Gn(o,e[44],n,Rd):qn(e[44]),Id)},i(e){t||(sa(i,e),t=!0)},o(e){la(i,e),t=!1},d(e){i&&i.d(e)}}}function Fd(e){let t,o,i,n,r,a,s;const l=e[38].details,c=Zn(l,e,e[44],Pd);return{c(){t=hr("div"),c&&c.c(),o=gr(),i=hr("span"),xr(i,"class","PinturaPanelTip"),xr(i,"style",e[10]),xr(t,"class",n=hc(["PinturaPanel","pintura-editor-panel",e[2]])),xr(t,"tabindex","-1"),xr(t,"style",e[11])},m(n,l){dr(n,t,l),c&&c.m(t,null),sr(t,o),sr(t,i),e[41](t),r=!0,a||(s=[fr(t,"close",e[42]),fr(t,"keydown",e[18]),fr(t,"measure",e[43]),er(oc.call(null,t))],a=!0)},p(e,o){c&&c.p&&(!r||8192&o[1])&&Yn(c,l,e,e[44],r?Gn(l,e[44],o,Td):qn(e[44]),Pd),(!r||1024&o[0])&&xr(i,"style",e[10]),(!r||4&o[0]&&n!==(n=hc(["PinturaPanel","pintura-editor-panel",e[2]])))&&xr(t,"class",n),(!r||2048&o[0])&&xr(t,"style",e[11])},i(e){r||(sa(c,e),r=!0)},o(e){la(c,e),r=!1},d(o){o&&ur(t),c&&c.d(o),e[41](null),a=!1,Wn(s)}}}function zd(e){let t,o,i,n,r,a,s,l,c;const d=[Ed,Ad],u=[];function h(e,t){return e[1]?0:1}o=h(e),i=u[o]=d[o](e);let p=e[6]&&Fd(e);return{c(){t=gr(),i.c(),n=gr(),p&&p.c(),r=gr(),a=$r()},m(i,d){dr(i,t,d),u[o].m(i,d),dr(i,n,d),p&&p.m(i,d),dr(i,r,d),dr(i,a,d),s=!0,l||(c=[fr(document.body,"pointerdown",(function(){Vn(e[9])&&e[9].apply(this,arguments)})),fr(document.body,"pointerup",(function(){Vn(e[8])&&e[8].apply(this,arguments)}))],l=!0)},p(t,a){let s=o;o=h(e=t),o===s?u[o].p(e,a):(ra(),la(u[s],1,1,(()=>{u[s]=null})),aa(),i=u[o],i?i.p(e,a):(i=u[o]=d[o](e),i.c()),sa(i,1),i.m(n.parentNode,n)),e[6]?p?(p.p(e,a),64&a[0]&&sa(p,1)):(p=Fd(e),p.c(),sa(p,1),p.m(r.parentNode,r)):p&&(ra(),la(p,1,1,(()=>{p=null})),aa())},i(e){s||(sa(i),sa(p),sa(false),s=!0)},o(e){la(i),la(p),la(false),s=!1},d(e){e&&ur(t),u[o].d(e),e&&ur(n),p&&p.d(e),e&&ur(r),e&&ur(a),l=!1,Wn(c)}}}let Dd=12;function Od(e,t,o){let i,n,r,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,{$$slots:w={},$$scope:S}=t,{buttonClass:k}=t,{buttonLabel:C}=t,{panelClass:M}=t,{isActive:T=!1}=t,{onshow:P=(({panel:e})=>Md(e,{preventScroll:!0}))}=t,{onhide:R=a}=t;const I=_r("isAnimated");Un(e,I,(e=>o(37,v=e)));const A=_r("rootPortal");Un(e,A,(e=>o(32,$=e)));const E=_r("rootRect");let L,F,z;Un(e,E,(e=>o(36,x=e)));const D=()=>o(22,z=i&&i.getBoundingClientRect());let O=de(),B=Wl(0);Un(e,B,(e=>o(34,y=e)));let _=de();const W=Ca({x:0,y:0});Un(e,W,(e=>o(33,f=e)));const V=Wl(-5,{stiffness:.1,damping:.35,precision:.001});Un(e,V,(e=>o(35,b=e)));const N=e=>Vc(e,$)||F.isEventTarget(e);let H,j,U=!1;const Z=e=>{T||D(),o(26,j=e),o(0,T=!T)},X=e=>{/down/i.test(e.key)&&(o(0,T=!0),o(26,j=e))};Dr((()=>{if(!$)return;if(!H)return;const e=H;Gr().then((()=>{e.parentNode&&e.remove()}))}));return e.$$set=e=>{"buttonClass"in e&&o(19,k=e.buttonClass),"buttonLabel"in e&&o(1,C=e.buttonLabel),"panelClass"in e&&o(2,M=e.panelClass),"isActive"in e&&o(0,T=e.isActive),"onshow"in e&&o(20,P=e.onshow),"onhide"in e&&o(21,R=e.onhide),"$$scope"in e&&o(44,S=e.$$scope)},e.$$.update=()=>{if(16&e.$$.dirty[0]&&(i=F&&F.getElement()),33554433&e.$$.dirty[0]&&o(8,m=T?e=>{U&&(o(25,U=!1),N(e)||o(0,T=!1))}:void 0),1&e.$$.dirty[0]|64&e.$$.dirty[1]&&B.set(T?1:0,{hard:!1===v}),1&e.$$.dirty[0]|64&e.$$.dirty[1]&&V.set(T?0:-5,{hard:!1===v}),16&e.$$.dirty[1]&&o(29,n=1-b/-5),1&e.$$.dirty[0]|32&e.$$.dirty[1]&&x&&T&&D(),4194313&e.$$.dirty[0]|32&e.$$.dirty[1]&&x&&L&&z&&T){let e=z.x-x.x+.5*z.width-.5*L.width,t=z.y-x.y+z.height;const i=Dd,n=Dd,r=x.width-Dd,a=x.height-Dd,s=e,l=t,c=s+L.width,d=l+L.height;if(s<i&&(o(24,_.x=s-i,_),e=i),c>r&&(o(24,_.x=c-r,_),e=r-L.width),d>a){o(23,O.y=-1,O);n<t-L.height-z.height?(o(24,_.y=0,_),t-=L.height+z.height):(o(24,_.y=t-(d-a),_),t-=d-a)}else o(23,O.y=1,O);Qn(W,f=xe(ue(e,t),Cd),f)}8&e.$$.dirty[1]&&o(6,r=y>0),8&e.$$.dirty[1]&&o(31,s=y<1),8388608&e.$$.dirty[0]|20&e.$$.dirty[1]&&o(30,l=`translateX(${Math.round(f.x)+O.x*Dd}px) translateY(${Math.round(f.y)+O.y*Dd+O.y*b}px)`),1073741824&e.$$.dirty[0]|9&e.$$.dirty[1]&&o(11,c=s?`opacity: ${y}; pointer-events: ${y<1?"none":"all"}; transform: ${l};`:"transform: "+l),536870912&e.$$.dirty[0]&&o(27,d=.5+.5*n),536870912&e.$$.dirty[0]&&o(28,u=n),427819016&e.$$.dirty[0]|4&e.$$.dirty[1]&&o(10,h=f&&L&&`opacity:${u};transform:scaleX(${d})rotate(45deg);top:${O.y<0?_.y+L.height:0}px;left:${_.x+.5*L.width}px`),1&e.$$.dirty[0]&&o(9,p=T?e=>{N(e)||o(25,U=!0)}:void 0),96&e.$$.dirty[0]|2&e.$$.dirty[1]&&r&&$&&H&&H.parentNode!==$&&$.append(H),1&e.$$.dirty[0]&&(T||o(26,j=void 0)),68157537&e.$$.dirty[0]&&T&&r&&H&&P({e:j,panel:H}),2097217&e.$$.dirty[0]&&r&&!T&&R(),524290&e.$$.dirty[0]&&o(7,g={label:C,class:hc(["PinturaPanelButton",k]),onkeydown:X,onclick:Z})},[T,C,M,L,F,H,r,g,m,p,h,c,I,A,E,B,W,V,e=>{/esc/i.test(e.key)&&(o(0,T=!1),i.focus())},k,P,R,z,O,_,U,j,d,u,n,l,s,$,f,y,b,x,v,w,function(e){Nr[e?"unshift":"push"]((()=>{F=e,o(4,F)}))},function(e){Nr[e?"unshift":"push"]((()=>{F=e,o(4,F)}))},function(e){Nr[e?"unshift":"push"]((()=>{H=e,o(5,H)}))},e=>{e.stopPropagation(),o(0,T=!1)},e=>o(3,L=ze(e.detail)),S]}class Bd extends wa{constructor(e){super(),va(this,e,Od,zd,Nn,{buttonClass:19,buttonLabel:1,panelClass:2,isActive:0,onshow:20,onhide:21},null,[-1,-1])}}var _d={Up:38,Down:40,Left:37,Right:39};function Wd(e){let t,o,i,n,r,a,s,l;const c=e[15].default,d=Zn(c,e,e[14],null);return{c(){t=hr("li"),o=hr("input"),i=gr(),n=hr("label"),d&&d.c(),xr(o,"type","radio"),xr(o,"class","implicit"),xr(o,"id",e[7]),xr(o,"name",e[0]),o.value=e[3],o.disabled=e[6],o.hidden=e[5],o.checked=e[4],xr(n,"for",e[7]),xr(n,"title",e[2]),xr(t,"class",r=hc(["PinturaRadioGroupOption",e[1]])),xr(t,"data-hidden",e[5]),xr(t,"data-disabled",e[6]),xr(t,"data-selected",e[4])},m(r,c){dr(r,t,c),sr(t,o),sr(t,i),sr(t,n),d&&d.m(n,null),a=!0,s||(l=[fr(o,"change",br(e[16])),fr(o,"keydown",e[9]),fr(o,"click",e[10])],s=!0)},p(e,[i]){(!a||128&i)&&xr(o,"id",e[7]),(!a||1&i)&&xr(o,"name",e[0]),(!a||8&i)&&(o.value=e[3]),(!a||64&i)&&(o.disabled=e[6]),(!a||32&i)&&(o.hidden=e[5]),(!a||16&i)&&(o.checked=e[4]),d&&d.p&&(!a||16384&i)&&Yn(d,c,e,e[14],a?Gn(c,e[14],i,null):qn(e[14]),null),(!a||128&i)&&xr(n,"for",e[7]),(!a||4&i)&&xr(n,"title",e[2]),(!a||2&i&&r!==(r=hc(["PinturaRadioGroupOption",e[1]])))&&xr(t,"class",r),(!a||32&i)&&xr(t,"data-hidden",e[5]),(!a||64&i)&&xr(t,"data-disabled",e[6]),(!a||16&i)&&xr(t,"data-selected",e[4])},i(e){a||(sa(d,e),a=!0)},o(e){la(d,e),a=!1},d(e){e&&ur(t),d&&d.d(e),s=!1,Wn(l)}}}function Vd(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,{hidden:g=!1}=t,{disabled:$=!1}=t;const f=Object.values(_d),y=_r("keysPressed");Un(e,y,(e=>o(17,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(11,d=e.id),"value"in e&&o(3,u=e.value),"checked"in e&&o(4,h=e.checked),"onkeydown"in e&&o(12,p=e.onkeydown),"onclick"in e&&o(13,m=e.onclick),"hidden"in e&&o(5,g=e.hidden),"disabled"in e&&o(6,$=e.disabled),"$$scope"in e&&o(14,a=e.$$scope)},e.$$.update=()=>{2049&e.$$.dirty&&o(7,i=`${s}-${d}`)},[s,l,c,u,h,g,$,i,y,e=>{p(e)},e=>{n.some((e=>f.includes(e)))||m(e)},d,p,m,a,r,function(t){Wr.call(this,e,t)}]}class Nd extends wa{constructor(e){super(),va(this,e,Vd,Wd,Nn,{name:0,class:1,label:2,id:11,value:3,checked:4,onkeydown:12,onclick:13,hidden:5,disabled:6})}}var Hd=(e=[])=>e.reduce(((e,t)=>(Ro(t)?Ro(t[1]):!!t.options)?e.concat(Ro(t)?t[1]:t.options):(e.push(t),e)),[]);const jd=(e,t,o)=>{let i;return Ro(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 Ud=(e,t,o)=>R(e)?e(t,o):e;const Zd=(e,t)=>e.map((([e,o,i])=>{if(Ro(o))return[Ud(e,t),Zd(o,t)];{const n=[e,Ud(o,t)];if(i){let e={...i};i.icon&&(e.icon=Ud(i.icon,t)),n.push(e)}return n}}));var Xd=(e,t)=>Zd(e,t),Gd=(e,t)=>Array.isArray(e)&&Array.isArray(t)?Ka(e,t):e===t;function Yd(e,t,o){const i=e.slice();return i[27]=t[o],i}const qd=e=>({option:1024&e[0]}),Kd=e=>({option:e[27]});function Jd(e,t,o){const i=e.slice();return i[27]=t[o],i}const Qd=e=>({option:1024&e[0]}),eu=e=>({option:e[27]}),tu=e=>({option:1024&e[0]}),ou=e=>({option:e[27]});function iu(e){let t,o,i,n,r,a=[],s=new Map,l=e[1]&&nu(e),c=e[10];const d=e=>e[27].id;for(let t=0;t<c.length;t+=1){let o=Yd(e,c,t),i=d(o);s.set(i,a[t]=$u(i,o))}return{c(){t=hr("fieldset"),l&&l.c(),o=gr(),i=hr("ul");for(let e=0;e<a.length;e+=1)a[e].c();xr(i,"class","PinturaRadioGroupOptions"),xr(t,"class",n=hc(["PinturaRadioGroup",e[3]])),xr(t,"data-layout",e[5]),xr(t,"title",e[7])},m(e,n){dr(e,t,n),l&&l.m(t,null),sr(t,o),sr(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=nu(e),l.c(),l.m(t,o)):l&&(l.d(1),l=null),8419153&u[0]&&(c=e[10],ra(),a=ma(a,u,d,1,e,c,s,i,pa,$u,null,Yd),aa()),(!r||8&u[0]&&n!==(n=hc(["PinturaRadioGroup",e[3]])))&&xr(t,"class",n),(!r||32&u[0])&&xr(t,"data-layout",e[5]),(!r||128&u[0])&&xr(t,"title",e[7])},i(e){if(!r){for(let e=0;e<c.length;e+=1)sa(a[e]);r=!0}},o(e){for(let e=0;e<a.length;e+=1)la(a[e]);r=!1},d(e){e&&ur(t),l&&l.d();for(let e=0;e<a.length;e+=1)a[e].d()}}}function nu(e){let t,o,i;return{c(){t=hr("legend"),o=mr(e[1]),xr(t,"class",i=e[2]&&"implicit")},m(e,i){dr(e,t,i),sr(t,o)},p(e,n){2&n[0]&&wr(o,e[1]),4&n[0]&&i!==(i=e[2]&&"implicit")&&xr(t,"class",i)},d(e){e&&ur(t)}}}function ru(e){let t,o;return t=new Nd({props:{name:e[4],label:e[27].label,id:e[27].id,value:e[27].value,disabled:e[27].disabled,hidden:e[27].hidden,class:e[8],checked:e[12](e[27])===e[0],onkeydown:e[13](e[27]),onclick:e[14](e[27]),$$slots:{default:[du]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.name=e[4]),1024&o[0]&&(i.label=e[27].label),1024&o[0]&&(i.id=e[27].id),1024&o[0]&&(i.value=e[27].value),1024&o[0]&&(i.disabled=e[27].disabled),1024&o[0]&&(i.hidden=e[27].hidden),256&o[0]&&(i.class=e[8]),1025&o[0]&&(i.checked=e[12](e[27])===e[0]),1024&o[0]&&(i.onkeydown=e[13](e[27])),1024&o[0]&&(i.onclick=e[14](e[27])),8389696&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function au(e){let t,o,i,n,r,a,s=[],l=new Map;const c=e[22].group,d=Zn(c,e,e[23],ou),u=d||function(e){let t,o,i=e[27].label+"";return{c(){t=hr("span"),o=mr(i),xr(t,"class","PinturaRadioGroupOptionGroupLabel")},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){1024&t[0]&&i!==(i=e[27].label+"")&&wr(o,i)},d(e){e&&ur(t)}}}(e);let h=e[27].options;const p=e=>e[27].id;for(let t=0;t<h.length;t+=1){let o=Jd(e,h,t),i=p(o);l.set(i,s[t]=gu(i,o))}return{c(){t=hr("li"),u&&u.c(),o=gr(),i=hr("ul");for(let e=0;e<s.length;e+=1)s[e].c();n=gr(),xr(i,"class","PinturaRadioGroupOptions"),xr(t,"class",r=hc(["PinturaRadioGroupOptionGroup",e[9]]))},m(e,r){dr(e,t,r),u&&u.m(t,null),sr(t,o),sr(t,i);for(let e=0;e<s.length;e+=1)s[e].m(i,null);sr(t,n),a=!0},p(e,o){d?d.p&&(!a||8389632&o[0])&&Yn(d,c,e,e[23],a?Gn(c,e[23],o,tu):qn(e[23]),ou):u&&u.p&&(!a||1024&o[0])&&u.p(e,a?o:[-1,-1]),8418641&o[0]&&(h=e[27].options,ra(),s=ma(s,o,p,1,e,h,l,i,pa,gu,null,Jd),aa()),(!a||512&o[0]&&r!==(r=hc(["PinturaRadioGroupOptionGroup",e[9]])))&&xr(t,"class",r)},i(e){if(!a){sa(u,e);for(let e=0;e<h.length;e+=1)sa(s[e]);a=!0}},o(e){la(u,e);for(let e=0;e<s.length;e+=1)la(s[e]);a=!1},d(e){e&&ur(t),u&&u.d(e);for(let e=0;e<s.length;e+=1)s[e].d()}}}function su(e){let t,o;return t=new Wc({props:{$$slots:{default:[lu]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};8389632&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function lu(e){let t,o=e[27].icon+"";return{c(){t=pr("g")},m(e,i){dr(e,t,i),t.innerHTML=o},p(e,i){1024&i[0]&&o!==(o=e[27].icon+"")&&(t.innerHTML=o)},d(e){e&&ur(t)}}}function cu(e){let t,o,i=e[27].label+"";return{c(){t=hr("span"),o=mr(i),xr(t,"class",e[6])},m(e,i){dr(e,t,i),sr(t,o)},p(e,n){1024&n[0]&&i!==(i=e[27].label+"")&&wr(o,i),64&n[0]&&xr(t,"class",e[6])},d(e){e&&ur(t)}}}function du(e){let t;const o=e[22].option,i=Zn(o,e,e[23],Kd),n=i||function(e){let t,o,i,n=e[27].icon&&su(e),r=!e[27].hideLabel&&cu(e);return{c(){n&&n.c(),t=gr(),r&&r.c(),o=gr()},m(e,a){n&&n.m(e,a),dr(e,t,a),r&&r.m(e,a),dr(e,o,a),i=!0},p(e,i){e[27].icon?n?(n.p(e,i),1024&i[0]&&sa(n,1)):(n=su(e),n.c(),sa(n,1),n.m(t.parentNode,t)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa()),e[27].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=cu(e),r.c(),r.m(o.parentNode,o))},i(e){i||(sa(n),i=!0)},o(e){la(n),i=!1},d(e){n&&n.d(e),e&&ur(t),r&&r.d(e),e&&ur(o)}}}(e);return{c(){n&&n.c()},m(e,o){n&&n.m(e,o),t=!0},p(e,r){i?i.p&&(!t||8389632&r[0])&&Yn(i,o,e,e[23],t?Gn(o,e[23],r,qd):qn(e[23]),Kd):n&&n.p&&(!t||1088&r[0])&&n.p(e,t?r:[-1,-1])},i(e){t||(sa(n,e),t=!0)},o(e){la(n,e),t=!1},d(e){n&&n.d(e)}}}function uu(e){let t,o;return t=new Wc({props:{$$slots:{default:[hu]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};8389632&o[0]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function hu(e){let t,o=e[27].icon+"";return{c(){t=pr("g")},m(e,i){dr(e,t,i),t.innerHTML=o},p(e,i){1024&i[0]&&o!==(o=e[27].icon+"")&&(t.innerHTML=o)},d(e){e&&ur(t)}}}function pu(e){let t,o,i=e[27].label+"";return{c(){t=hr("span"),o=mr(i),xr(t,"class",e[6])},m(e,i){dr(e,t,i),sr(t,o)},p(e,n){1024&n[0]&&i!==(i=e[27].label+"")&&wr(o,i),64&n[0]&&xr(t,"class",e[6])},d(e){e&&ur(t)}}}function mu(e){let t;const o=e[22].option,i=Zn(o,e,e[23],eu),n=i||function(e){let t,o,i,n=e[27].icon&&uu(e),r=!e[27].hideLabel&&pu(e);return{c(){n&&n.c(),t=gr(),r&&r.c(),o=gr()},m(e,a){n&&n.m(e,a),dr(e,t,a),r&&r.m(e,a),dr(e,o,a),i=!0},p(e,i){e[27].icon?n?(n.p(e,i),1024&i[0]&&sa(n,1)):(n=uu(e),n.c(),sa(n,1),n.m(t.parentNode,t)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa()),e[27].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=pu(e),r.c(),r.m(o.parentNode,o))},i(e){i||(sa(n),i=!0)},o(e){la(n),i=!1},d(e){n&&n.d(e),e&&ur(t),r&&r.d(e),e&&ur(o)}}}(e);return{c(){n&&n.c()},m(e,o){n&&n.m(e,o),t=!0},p(e,r){i?i.p&&(!t||8389632&r[0])&&Yn(i,o,e,e[23],t?Gn(o,e[23],r,Qd):qn(e[23]),eu):n&&n.p&&(!t||1088&r[0])&&n.p(e,t?r:[-1,-1])},i(e){t||(sa(n,e),t=!0)},o(e){la(n,e),t=!1},d(e){n&&n.d(e)}}}function gu(e,t){let o,i,n;return i=new Nd({props:{name:t[4],label:t[27].label,id:t[27].id,value:t[27].value,disabled:t[27].disabled,hidden:t[27].hidden,class:t[8],checked:t[12](t[27])===t[0],onkeydown:t[13](t[27]),onclick:t[14](t[27]),$$slots:{default:[mu]},$$scope:{ctx:t}}}),{key:e,first:null,c(){o=$r(),ya(i.$$.fragment),this.first=o},m(e,t){dr(e,o,t),ba(i,e,t),n=!0},p(e,o){t=e;const n={};16&o[0]&&(n.name=t[4]),1024&o[0]&&(n.label=t[27].label),1024&o[0]&&(n.id=t[27].id),1024&o[0]&&(n.value=t[27].value),1024&o[0]&&(n.disabled=t[27].disabled),1024&o[0]&&(n.hidden=t[27].hidden),256&o[0]&&(n.class=t[8]),1025&o[0]&&(n.checked=t[12](t[27])===t[0]),1024&o[0]&&(n.onkeydown=t[13](t[27])),1024&o[0]&&(n.onclick=t[14](t[27])),8389696&o[0]&&(n.$$scope={dirty:o,ctx:t}),i.$set(n)},i(e){n||(sa(i.$$.fragment,e),n=!0)},o(e){la(i.$$.fragment,e),n=!1},d(e){e&&ur(o),xa(i,e)}}}function $u(e,t){let o,i,n,r,a;const s=[au,ru],l=[];function c(e,t){return e[27].options?0:1}return i=c(t),n=l[i]=s[i](t),{key:e,first:null,c(){o=$r(),n.c(),r=$r(),this.first=o},m(e,t){dr(e,o,t),l[i].m(e,t),dr(e,r,t),a=!0},p(e,o){let a=i;i=c(t=e),i===a?l[i].p(t,o):(ra(),la(l[a],1,1,(()=>{l[a]=null})),aa(),n=l[i],n?n.p(t,o):(n=l[i]=s[i](t),n.c()),sa(n,1),n.m(r.parentNode,r))},i(e){a||(sa(n),a=!0)},o(e){la(n),a=!1},d(e){e&&ur(o),l[i].d(e),e&&ur(r)}}}function fu(e){let t,o,i,n=e[11].length&&iu(e);return{c(){n&&n.c(),t=gr(),o=$r()},m(e,r){n&&n.m(e,r),dr(e,t,r),dr(e,o,r),i=!0},p(e,o){e[11].length?n?(n.p(e,o),2048&o[0]&&sa(n,1)):(n=iu(e),n.c(),sa(n,1),n.m(t.parentNode,t)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa())},i(e){i||(sa(n),sa(false),i=!0)},o(e){la(n),la(false),i=!1},d(e){n&&n.d(e),e&&ur(t),e&&ur(o)}}}function yu(e,t,o){let i,n,r,{$$slots:a={},$$scope:s}=t;const l=Or();let{label:c}=t,{hideLabel:d=!0}=t,{class:u}=t,{name:h="radio-group-"+L()}=t,{selectedIndex:p=-1}=t,{options:m=[]}=t,{onchange:g}=t,{layout:$}=t,{optionMapper:f}=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,$=e.layout),"optionMapper"in e&&o(17,f=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[0]&&o(11,i=Xd(y?m.filter(y):m,w)),133120&e.$$.dirty[0]&&o(10,n=((e=[],t)=>{let o=0;return e.map((e=>(o++,Ro(e)?Ro(e[1])?{id:o,label:e[0],options:e[1].map((e=>jd(e,++o,t)))}:jd(e,o,t):e.options?{id:e.id||o,label:e.label,options:e.options.map((e=>jd(e,++o,t)))}:jd(e,o,t))))})(i,f)),1024&e.$$.dirty[0]&&o(21,r=Hd(n)),2654209&e.$$.dirty[0]&&p<0&&(o(0,p=r.findIndex((e=>Gd(e.value,b)))),p<0&&o(0,p=(e=>e.findIndex((e=>void 0===e[0])))(m)))},[p,c,d,u,h,$,x,v,S,k,n,i,C,e=>t=>{var o;(o=t.key,/enter| /i.test(o))&&M(e,t)},e=>t=>{M(e,t)},m,g,f,y,b,w,r,a,s]}class bu extends wa{constructor(e){super(),va(this,e,yu,fu,Nn,{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},null,[-1,-1])}}const xu=e=>({}),vu=e=>({});function wu(e){let t,o;return t=new Wc({props:{class:"PinturaButtonIcon",$$slots:{default:[Su]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};268435520&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Su(e){let t;return{c(){t=pr("g")},m(o,i){dr(o,t,i),t.innerHTML=e[6]},p(e,o){64&o&&(t.innerHTML=e[6])},d(e){e&&ur(t)}}}function ku(e){let t,o,i,n,r,a,s,l=(e[2]||e[18])+"",c=e[6]&&wu(e);return{c(){t=hr("span"),c&&c.c(),o=gr(),i=hr("span"),xr(i,"class",n=hc(["PinturaButtonLabel",e[3],e[5]&&"implicit"])),xr(t,"slot","label"),xr(t,"title",r=Ud(e[1],e[15])),xr(t,"class",a=hc(["PinturaButtonInner",e[4]]))},m(e,n){dr(e,t,n),c&&c.m(t,null),sr(t,o),sr(t,i),i.innerHTML=l,s=!0},p(e,d){e[6]?c?(c.p(e,d),64&d&&sa(c,1)):(c=wu(e),c.c(),sa(c,1),c.m(t,o)):c&&(ra(),la(c,1,1,(()=>{c=null})),aa()),(!s||262148&d)&&l!==(l=(e[2]||e[18])+"")&&(i.innerHTML=l),(!s||40&d&&n!==(n=hc(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&xr(i,"class",n),(!s||32770&d&&r!==(r=Ud(e[1],e[15])))&&xr(t,"title",r),(!s||16&d&&a!==(a=hc(["PinturaButtonInner",e[4]])))&&xr(t,"class",a)},i(e){s||(sa(c),s=!0)},o(e){la(c),s=!1},d(e){e&&ur(t),c&&c.d()}}}function Cu(e){let t,o,i=e[30].label+"";return{c(){t=hr("span"),o=mr(i),xr(t,"slot","group")},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){1073741824&t&&i!==(i=e[30].label+"")&&wr(o,i)},d(e){e&&ur(t)}}}function Mu(e){let t,o;return t=new Wc({props:{style:R(e[13])?e[13](e[30].value):e[13],$$slots:{default:[Tu]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};1073750016&o&&(i.style=R(e[13])?e[13](e[30].value):e[13]),1342177280&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Tu(e){let t,o=e[30].icon+"";return{c(){t=pr("g")},m(e,i){dr(e,t,i),t.innerHTML=o},p(e,i){1073741824&i&&o!==(o=e[30].icon+"")&&(t.innerHTML=o)},d(e){e&&ur(t)}}}function Pu(e){let t,o=e[30].sublabel+"";return{c(){t=hr("span"),xr(t,"class","PinturaDropdownOptionSublabel")},m(e,i){dr(e,t,i),t.innerHTML=o},p(e,i){1073741824&i&&o!==(o=e[30].sublabel+"")&&(t.innerHTML=o)},d(e){e&&ur(t)}}}function Ru(e){let t,o,i,n,r,a,s,l,c=e[30].label+"",d=e[30].icon&&Mu(e),u=e[30].sublabel&&Pu(e);return{c(){t=hr("span"),d&&d.c(),o=gr(),i=hr("span"),n=new Cr(!1),r=gr(),u&&u.c(),n.a=r,xr(i,"style",a=R(e[14])?e[14](e[30].value):e[14]),xr(i,"class",s=hc(["PinturaDropdownOptionLabel",e[10]])),xr(t,"slot","option")},m(e,a){dr(e,t,a),d&&d.m(t,null),sr(t,o),sr(t,i),n.m(c,i),sr(i,r),u&&u.m(i,null),l=!0},p(e,r){e[30].icon?d?(d.p(e,r),1073741824&r&&sa(d,1)):(d=Mu(e),d.c(),sa(d,1),d.m(t,o)):d&&(ra(),la(d,1,1,(()=>{d=null})),aa()),(!l||1073741824&r)&&c!==(c=e[30].label+"")&&n.p(c),e[30].sublabel?u?u.p(e,r):(u=Pu(e),u.c(),u.m(i,null)):u&&(u.d(1),u=null),(!l||1073758208&r&&a!==(a=R(e[14])?e[14](e[30].value):e[14]))&&xr(i,"style",a),(!l||1024&r&&s!==(s=hc(["PinturaDropdownOptionLabel",e[10]])))&&xr(i,"class",s)},i(e){l||(sa(d),l=!0)},o(e){la(d),l=!1},d(e){e&&ur(t),d&&d.d(),u&&u.d()}}}function Iu(e){let t,o,i,n,r,a;const s=e[26].controls,l=Zn(s,e,e[28],vu);return i=new bu({props:{class:"PinturaOptionsList PinturaScrollableContent",name:e[7],value:e[9],selectedIndex:e[8],optionFilter:e[11],optionMapper:e[12],optionLabelClass:hc(["PinturaDropdownOptionLabel",e[10]]),optionGroupClass:"PinturaListOptionGroup",optionClass:"PinturaListOption",options:e[16],onchange:e[19],$$slots:{option:[Ru,({option:e})=>({30:e}),({option:e})=>e?1073741824:0],group:[Cu,({option:e})=>({30:e}),({option:e})=>e?1073741824:0]},$$scope:{ctx:e}}}),{c(){t=hr("div"),l&&l.c(),o=gr(),ya(i.$$.fragment),xr(t,"slot","details"),xr(t,"class","PinturaOptionsListWrapper")},m(s,c){dr(s,t,c),l&&l.m(t,null),sr(t,o),ba(i,t,null),n=!0,r||(a=fr(t,"keydown",e[21]),r=!0)},p(e,t){l&&l.p&&(!n||268435456&t)&&Yn(l,s,e,e[28],n?Gn(s,e[28],t,xu):qn(e[28]),vu);const o={};128&t&&(o.name=e[7]),512&t&&(o.value=e[9]),256&t&&(o.selectedIndex=e[8]),2048&t&&(o.optionFilter=e[11]),4096&t&&(o.optionMapper=e[12]),1024&t&&(o.optionLabelClass=hc(["PinturaDropdownOptionLabel",e[10]])),65536&t&&(o.options=e[16]),1342202880&t&&(o.$$scope={dirty:t,ctx:e}),i.$set(o)},i(e){n||(sa(l,e),sa(i.$$.fragment,e),n=!0)},o(e){la(l,e),la(i.$$.fragment,e),n=!1},d(e){e&&ur(t),l&&l.d(e),xa(i),r=!1,a()}}}function Au(e){let t,o,i;function n(t){e[27](t)}let r={onshow:e[20],buttonClass:hc(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"]),$$slots:{details:[Iu],label:[ku]},$$scope:{ctx:e}};return void 0!==e[17]&&(r.isActive=e[17]),t=new Bd({props:r}),Nr.push((()=>fa(t,"isActive",n))),{c(){ya(t.$$.fragment)},m(e,o){ba(t,e,o),i=!0},p(e,[i]){const n={};33&i&&(n.buttonClass=hc(["PinturaDropdownButton",e[0],e[5]&&"PinturaDropdownIconOnly"])),268828670&i&&(n.$$scope={dirty:i,ctx:e}),!o&&131072&i&&(o=!0,n.isActive=e[17],qr((()=>o=!1))),t.$set(n)},i(e){i||(sa(t.$$.fragment,e),i=!0)},o(e){la(t.$$.fragment,e),i=!1},d(e){xa(t,e)}}}function Eu(e,t,o){let i,n,{$$slots:r={},$$scope:s}=t,{class:l}=t,{title:c}=t,{label:d}=t,{labelClass:u}=t,{innerClass:h}=t,{hideLabel:p=!1}=t,{icon:m}=t,{name:g}=t,{options:$=[]}=t,{selectedIndex:f=-1}=t,{value:y}=t,{optionLabelClass:b}=t,{optionFilter:x}=t,{optionMapper:v}=t,{optionIconStyle:w}=t,{optionLabelStyle:S}=t,{locale:k}=t,{onchange:C=a}=t,{onload:M=a}=t,{ondestroy:T=a}=t;let P;return Fr((()=>M({options:$}))),Dr((()=>T({options:$}))),e.$$set=e=>{"class"in e&&o(0,l=e.class),"title"in e&&o(1,c=e.title),"label"in e&&o(2,d=e.label),"labelClass"in e&&o(3,u=e.labelClass),"innerClass"in e&&o(4,h=e.innerClass),"hideLabel"in e&&o(5,p=e.hideLabel),"icon"in e&&o(6,m=e.icon),"name"in e&&o(7,g=e.name),"options"in e&&o(22,$=e.options),"selectedIndex"in e&&o(8,f=e.selectedIndex),"value"in e&&o(9,y=e.value),"optionLabelClass"in e&&o(10,b=e.optionLabelClass),"optionFilter"in e&&o(11,x=e.optionFilter),"optionMapper"in e&&o(12,v=e.optionMapper),"optionIconStyle"in e&&o(13,w=e.optionIconStyle),"optionLabelStyle"in e&&o(14,S=e.optionLabelStyle),"locale"in e&&o(15,k=e.locale),"onchange"in e&&o(23,C=e.onchange),"onload"in e&&o(24,M=e.onload),"ondestroy"in e&&o(25,T=e.ondestroy),"$$scope"in e&&o(28,s=e.$$scope)},e.$$.update=()=>{4227072&e.$$.dirty&&o(16,i=k?Xd($,k):$),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 Gd(i,y)?n:void 0}),void 0)||(e=>{const t=e.find((e=>void 0===e[0]));if(t)return t[1]})(i)||y)},[l,c,d,u,h,p,m,g,f,y,b,x,v,w,S,k,i,P,n,e=>{o(18,n=e.value),C(e),o(17,P=!1)},({e:e,panel:t})=>{if(e&&e.key&&/up|down/i.test(e.key))return Md(t.querySelector("input:not([disabled])"));Md(t.querySelector("fieldset"))},e=>{/tab/i.test(e.key)&&e.preventDefault()},$,C,M,T,r,function(e){P=e,o(17,P)},s]}class Lu extends wa{constructor(e){super(),va(this,e,Eu,Au,Nn,{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})}}function Fu(e){let t;return{c(){t=hr("div"),xr(t,"slot","details")},m(o,i){dr(o,t,i),e[10](t)},p:zn,d(o){o&&ur(t),e[10](null)}}}function zu(e){let t,o,i;function n(t){e[11](t)}let r={buttonLabel:e[0],buttonClass:e[1],onshow:e[2],onhide:e[3],$$slots:{details:[Fu]},$$scope:{ctx:e}};return void 0!==e[5]&&(r.isActive=e[5]),t=new Bd({props:r}),Nr.push((()=>fa(t,"isActive",n))),{c(){ya(t.$$.fragment)},m(e,o){ba(t,e,o),i=!0},p(e,[i]){const n={};1&i&&(n.buttonLabel=e[0]),2&i&&(n.buttonClass=e[1]),4&i&&(n.onshow=e[2]),8&i&&(n.onhide=e[3]),4112&i&&(n.$$scope={dirty:i,ctx:e}),!o&&32&i&&(o=!0,n.isActive=e[5],qr((()=>o=!1))),t.$set(n)},i(e){i||(sa(t.$$.fragment,e),i=!0)},o(e){la(t.$$.fragment,e),i=!1},d(e){xa(t,e)}}}function Du(e,t,o){let{buttonLabel:i}=t,{buttonClass:n}=t,{root:r}=t,{ondestroy:s=a}=t,{onshow:l=a}=t,{onhide:c=a}=t;let d,u=!1;return Dr(s),e.$$set=e=>{"buttonLabel"in e&&o(0,i=e.buttonLabel),"buttonClass"in e&&o(1,n=e.buttonClass),"root"in e&&o(6,r=e.root),"ondestroy"in e&&o(7,s=e.ondestroy),"onshow"in e&&o(2,l=e.onshow),"onhide"in e&&o(3,c=e.onhide)},e.$$.update=()=>{80&e.$$.dirty&&d&&r&&d.firstChild!==r&&(d.hasChildNodes()?d.replaceChild(r,d.firstChild):d.append(r))},[i,n,l,c,d,u,r,s,()=>o(5,u=!1),()=>o(5,u=!0),function(e){Nr[e?"unshift":"push"]((()=>{d=e,o(4,d)}))},function(e){u=e,o(5,u)}]}class Ou extends wa{constructor(e){super(),va(this,e,Du,zu,Nn,{buttonLabel:0,buttonClass:1,root:6,ondestroy:7,onshow:2,onhide:3,hide:8,show:9})}get hide(){return this.$$.ctx[8]}get show(){return this.$$.ctx[9]}}var Bu=(e,t,o)=>(e-t)/(o-t);const _u=e=>({}),Wu=e=>({});function Vu(e){let t,o,i,n,r,a,s,l;return o=new Wc({props:{$$slots:{default:[Nu]},$$scope:{ctx:e}}}),r=new Wc({props:{$$slots:{default:[Hu]},$$scope:{ctx:e}}}),{c(){t=hr("button"),ya(o.$$.fragment),i=gr(),n=hr("button"),ya(r.$$.fragment),xr(t,"type","button"),xr(t,"aria-label","Increase"),xr(n,"type","button"),xr(n,"aria-label","Decrease")},m(c,d){dr(c,t,d),ba(o,t,null),dr(c,i,d),dr(c,n,d),ba(r,n,null),a=!0,s||(l=[fr(t,"pointerdown",e[20](1)),fr(n,"pointerdown",e[20](-1))],s=!0)},p(e,t){const i={};128&t[1]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i);const n={};128&t[1]&&(n.$$scope={dirty:t,ctx:e}),r.$set(n)},i(e){a||(sa(o.$$.fragment,e),sa(r.$$.fragment,e),a=!0)},o(e){la(o.$$.fragment,e),la(r.$$.fragment,e),a=!1},d(e){e&&ur(t),xa(o),e&&ur(i),e&&ur(n),xa(r),s=!1,Wn(l)}}}function Nu(e){let t;return{c(){t=pr("path"),xr(t,"d","M8 12 h8 M12 8 v8")},m(e,o){dr(e,t,o)},p:zn,d(e){e&&ur(t)}}}function Hu(e){let t;return{c(){t=pr("path"),xr(t,"d","M9 12 h6")},m(e,o){dr(e,t,o)},p:zn,d(e){e&&ur(t)}}}function ju(e){let t,o,i,n,r,a,s,l,c,d,u,h,p,m,g,$,f;const y=e[36].default,b=Zn(y,e,e[38],null),x=e[36].knob,v=Zn(x,e,e[38],Wu);let w=e[9]&&Vu(e);return{c(){t=hr("div"),o=hr("div"),i=hr("input"),r=gr(),a=hr("div"),b&&b.c(),l=gr(),c=hr("div"),d=hr("div"),v&&v.c(),p=gr(),w&&w.c(),xr(i,"type","range"),xr(i,"id",e[3]),xr(i,"min",e[0]),xr(i,"max",e[1]),xr(i,"step",e[2]),i.value=e[14],xr(i,"style",n=e[10]?"pointer-events:none":""),xr(a,"class",s=hc(["PinturaSliderTrack",e[5]])),xr(a,"style",e[4]),xr(d,"class",u=hc(["PinturaSliderKnob",e[7]])),xr(d,"style",e[6]),xr(c,"class","PinturaSliderKnobController"),xr(c,"style",e[17]),xr(o,"class","PinturaSliderControl"),xr(o,"style",h="--slider-position:"+Math.round(e[15])),xr(t,"class",m=hc(["PinturaSlider",e[12]])),xr(t,"data-direction",e[8])},m(n,s){dr(n,t,s),sr(t,o),sr(o,i),e[37](i),sr(o,r),sr(o,a),b&&b.m(a,null),sr(o,l),sr(o,c),sr(c,d),v&&v.m(d,null),sr(t,p),w&&w.m(t,null),g=!0,$||(f=[fr(i,"input",e[18]),fr(i,"nudge",e[19]),er(Jc.call(null,i)),fr(o,"pointerdown",(function(){Vn(e[11]&&e[13])&&(e[11]&&e[13]).apply(this,arguments)}))],$=!0)},p(r,l){e=r,(!g||8&l[0])&&xr(i,"id",e[3]),(!g||1&l[0])&&xr(i,"min",e[0]),(!g||2&l[0])&&xr(i,"max",e[1]),(!g||4&l[0])&&xr(i,"step",e[2]),(!g||16384&l[0])&&(i.value=e[14]),(!g||1024&l[0]&&n!==(n=e[10]?"pointer-events:none":""))&&xr(i,"style",n),b&&b.p&&(!g||128&l[1])&&Yn(b,y,e,e[38],g?Gn(y,e[38],l,null):qn(e[38]),null),(!g||32&l[0]&&s!==(s=hc(["PinturaSliderTrack",e[5]])))&&xr(a,"class",s),(!g||16&l[0])&&xr(a,"style",e[4]),v&&v.p&&(!g||128&l[1])&&Yn(v,x,e,e[38],g?Gn(x,e[38],l,_u):qn(e[38]),Wu),(!g||128&l[0]&&u!==(u=hc(["PinturaSliderKnob",e[7]])))&&xr(d,"class",u),(!g||64&l[0])&&xr(d,"style",e[6]),(!g||131072&l[0])&&xr(c,"style",e[17]),(!g||32768&l[0]&&h!==(h="--slider-position:"+Math.round(e[15])))&&xr(o,"style",h),e[9]?w?(w.p(e,l),512&l[0]&&sa(w,1)):(w=Vu(e),w.c(),sa(w,1),w.m(t,null)):w&&(ra(),la(w,1,1,(()=>{w=null})),aa()),(!g||4096&l[0]&&m!==(m=hc(["PinturaSlider",e[12]])))&&xr(t,"class",m),(!g||256&l[0])&&xr(t,"data-direction",e[8])},i(e){g||(sa(b,e),sa(v,e),sa(w),g=!0)},o(e){la(b,e),la(v,e),la(w),g=!1},d(o){o&&ur(t),e[37](null),b&&b.d(o),v&&v.d(o),w&&w.d(),$=!1,Wn(f)}}}function Uu(e,t,o){let i,n,r,s,l,c,d,u,h,p,m,g,$,f,y,{$$slots:b={},$$scope:x}=t,{min:v=0}=t,{max:w=100}=t,{step:S=1}=t,{id:k}=t,{value:C=0}=t,{valueMin:M}=t,{valueMax:T}=t,{trackStyle:R}=t,{trackClass:I}=t,{knobStyle:A}=t,{knobClass:E}=t,{ongrab:L=a}=t,{onchange:F=a}=t,{onrelease:z=a}=t,{onexceed:D=a}=t,{direction:O="x"}=t,{getValue:B=Z}=t,{setValue:_=Z}=t,{enableSpinButtons:W=!0}=t,{enableForceUseKnob:V=!1}=t,{enableStopPropagation:N=!0}=t,{enablePointerdownListener:H=!0}=t,{maxInteractionDistance:j=6}=t,{class:U}=t;const X=e=>_(((e,t)=>(t=1/t,Math.round(e*t)/t))(Za(e,v,w),S)),G=(e,t,i={})=>{const{grabbed:r=!1,released:a=!1}=i,s=X(v+e/t*n),l=M||v,c=T||w;o(21,C=P(s)?s:Za(s,l,c)),y!==s&&(y=s,!P(s)&&(s<l||s>c)&&D(C,s),C!==f&&(f=C,r&&L(C),F(C),a&&z(C)))};let Y;const q=e=>{const t=e[u]-$;G(g+t,m)},K=e=>{m=void 0,document.documentElement.removeEventListener("pointermove",q),document.documentElement.removeEventListener("pointerup",K),F(C),z(C)},J=()=>{o(21,C=X(i+ee*S)),F(C)};let Q,ee=1,te=!1;const oe=e=>{clearTimeout(Q),te||J(),z(C),document.removeEventListener("pointerup",oe)};return e.$$set=e=>{"min"in e&&o(0,v=e.min),"max"in e&&o(1,w=e.max),"step"in e&&o(2,S=e.step),"id"in e&&o(3,k=e.id),"value"in e&&o(21,C=e.value),"valueMin"in e&&o(22,M=e.valueMin),"valueMax"in e&&o(23,T=e.valueMax),"trackStyle"in e&&o(4,R=e.trackStyle),"trackClass"in e&&o(5,I=e.trackClass),"knobStyle"in e&&o(6,A=e.knobStyle),"knobClass"in e&&o(7,E=e.knobClass),"ongrab"in e&&o(24,L=e.ongrab),"onchange"in e&&o(25,F=e.onchange),"onrelease"in e&&o(26,z=e.onrelease),"onexceed"in e&&o(27,D=e.onexceed),"direction"in e&&o(8,O=e.direction),"getValue"in e&&o(28,B=e.getValue),"setValue"in e&&o(29,_=e.setValue),"enableSpinButtons"in e&&o(9,W=e.enableSpinButtons),"enableForceUseKnob"in e&&o(10,V=e.enableForceUseKnob),"enableStopPropagation"in e&&o(30,N=e.enableStopPropagation),"enablePointerdownListener"in e&&o(11,H=e.enablePointerdownListener),"maxInteractionDistance"in e&&o(31,j=e.maxInteractionDistance),"class"in e&&o(12,U=e.class),"$$scope"in e&&o(38,x=e.$$scope)},e.$$.update=()=>{270532608&e.$$.dirty[0]&&o(14,i=void 0!==C?B(C):0),3&e.$$.dirty[0]&&(n=w-v),16387&e.$$.dirty[0]&&o(33,r=Bu(i,v,w)),4&e.$$.dirty[1]&&o(15,s=100*r),256&e.$$.dirty[0]&&o(34,l=O.toUpperCase()),256&e.$$.dirty[0]&&o(35,c="x"===O?"Width":"Height"),16&e.$$.dirty[1]&&(d="offset"+c),e.$$.dirty[1],8&e.$$.dirty[1]&&(u="page"+l),32768&e.$$.dirty[0]|8&e.$$.dirty[1]&&o(17,h=`transform: translate${l}(${s}%)`)},[v,w,S,k,R,I,A,E,O,W,V,H,U,e=>{let t=!1;N&&e.stopPropagation(),clearTimeout(Y);const o=p.getBoundingClientRect();if(m=p[d],$=e[u],g=$-o[O],V){if(Math.abs(g-r*m)>j)return;t=!0,e.stopPropagation()}return document.activeElement!==p&&p.focus(),G(g,m,{grabbed:!0}),document.documentElement.addEventListener("pointermove",q),document.documentElement.addEventListener("pointerup",K),t},i,s,p,h,e=>{m||(o(21,C=_(parseFloat(e.target.value))),C!==f&&(f=C,F(C)))},e=>{const t=p[d];G(i/n*t+e.detail[O],t),clearTimeout(Y),Y=setTimeout((()=>{z(C)}),250)},e=>t=>{clearTimeout(Y),ee=e,te=!1,Q=setInterval((()=>{te=!0,J()}),100),document.addEventListener("pointercancel",oe),document.addEventListener("pointerup",oe)},C,M,T,L,F,z,D,B,_,N,j,e=>{const t=p.getBoundingClientRect(),o=e[u]-t[O],i=p[d];return Math.abs(o-r*i)},r,l,c,b,function(e){Nr[e?"unshift":"push"]((()=>{p=e,o(16,p)}))},x]}class Zu extends wa{constructor(e){super(),va(this,e,Uu,ju,Nn,{min:0,max:1,step:2,id:3,value:21,valueMin:22,valueMax:23,trackStyle:4,trackClass:5,knobStyle:6,knobClass:7,ongrab:24,onchange:25,onrelease:26,onexceed:27,direction:8,getValue:28,setValue:29,enableSpinButtons:9,enableForceUseKnob:10,enableStopPropagation:30,enablePointerdownListener:11,maxInteractionDistance:31,class:12,eventDistanceToKnob:32,handlePointerDown:13},null,[-1,-1])}get eventDistanceToKnob(){return this.$$.ctx[32]}get handlePointerDown(){return this.$$.ctx[13]}}function Xu(e){let t,o;return t=new Wc({props:{class:"PinturaButtonIcon",$$slots:{default:[Gu]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};524292&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Gu(e){let t;return{c(){t=pr("g")},m(o,i){dr(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&ur(t)}}}function Yu(e){let t,o,i,n,r,a,s,l,c=e[2]&&Xu(e);return{c(){t=hr("span"),c&&c.c(),o=gr(),i=hr("span"),n=mr(e[8]),xr(i,"class",r=hc(["PinturaButtonLabel",e[3],e[5]&&"implicit"])),xr(t,"slot","label"),xr(t,"title",a=Ud(e[1],e[6])),xr(t,"class",s=hc(["PinturaButtonInner",e[4]]))},m(e,r){dr(e,t,r),c&&c.m(t,null),sr(t,o),sr(t,i),sr(i,n),l=!0},p(e,d){e[2]?c?(c.p(e,d),4&d&&sa(c,1)):(c=Xu(e),c.c(),sa(c,1),c.m(t,o)):c&&(ra(),la(c,1,1,(()=>{c=null})),aa()),(!l||256&d)&&wr(n,e[8]),(!l||40&d&&r!==(r=hc(["PinturaButtonLabel",e[3],e[5]&&"implicit"])))&&xr(i,"class",r),(!l||66&d&&a!==(a=Ud(e[1],e[6])))&&xr(t,"title",a),(!l||16&d&&s!==(s=hc(["PinturaButtonInner",e[4]])))&&xr(t,"class",s)},i(e){l||(sa(c),l=!0)},o(e){la(c),l=!1},d(e){e&&ur(t),c&&c.d()}}}function qu(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=On(s,a[e]);return o=new Zu({props:s}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"slot","details")},m(a,s){dr(a,t,s),ba(o,t,null),i=!0,n||(r=fr(t,"keydown",e[9]),n=!0)},p(e,t){const i=3200&t?ga(a,[2048&t&&$a(e[11]),128&t&&{value:e[7]},1024&t&&{onchange:e[10]}]):{};o.$set(i)},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o),n=!1,r()}}}function Ku(e){let t,o;return t=new Bd({props:{panelClass:"PinturaSliderPanel",buttonClass:hc(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"]),$$slots:{details:[qu],label:[Yu]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,[o]){const i={};33&o&&(i.buttonClass=hc(["PinturaSliderButton",e[0],e[5]&&"PinturaSliderIconOnly"])),526846&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Ju(e,t,o){const i=["class","title","label","icon","labelClass","innerClass","hideLabel","locale","value","onchange"];let n=Jn(t,i),{class:r}=t,{title:s}=t,{label:l=Math.round}=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:$,max:f,getValue:y=Z}=n;let b;const x=e=>o(8,b=(e=>R(l)?l(y(e),$,f):l)(e));return e.$$set=e=>{t=On(On({},t),Kn(e)),o(11,n=Jn(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)},e.$$.update=()=>{4224&e.$$.dirty&&x(m)},[r,s,c,d,u,h,p,m,b,e=>{/tab/i.test(e.key)&&e.preventDefault()},e=>{x(e),g(e)},n,l,g]}class Qu extends wa{constructor(e){super(),va(this,e,Ju,Ku,Nn,{class:0,title:1,label:12,icon:2,labelClass:3,innerClass:4,hideLabel:5,locale:6,value:7,onchange:13})}}function eh(e,t,o){const i=e.slice();return i[9]=t[o][0],i[0]=t[o][1],i[10]=t[o][2],i[2]=t[o][3],i}function th(e){let t,o,i;const n=[e[10]];var r=e[3][e[9]]||e[9];function a(e){let t={};for(let e=0;e<n.length;e+=1)t=On(t,n[e]);return{props:t}}return r&&(t=Mr(r,a())),{c(){t&&ya(t.$$.fragment),o=$r()},m(e,n){t&&ba(t,e,n),dr(e,o,n),i=!0},p(e,i){const s=4&i?ga(n,[$a(e[10])]):{};if(r!==(r=e[3][e[9]]||e[9])){if(t){ra();const e=t;la(e.$$.fragment,1,0,(()=>{xa(e,1)})),aa()}r?(t=Mr(r,a()),ya(t.$$.fragment),sa(t.$$.fragment,1),ba(t,o.parentNode,o)):t=null}else r&&t.$set(s)},i(e){i||(t&&sa(t.$$.fragment,e),i=!0)},o(e){t&&la(t.$$.fragment,e),i=!1},d(e){e&&ur(o),t&&xa(t,e)}}}function oh(e){let t,o;return t=new wd({props:{name:e[9],attributes:e[4](e[10]),$$slots:{default:[ah]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};4&o&&(i.name=e[9]),4&o&&(i.attributes=e[4](e[10])),8196&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function ih(e){let t,o,i=e[10].innerHTML+"";return{c(){t=new Cr(!1),o=$r(),t.a=o},m(e,n){t.m(i,e,n),dr(e,o,n)},p(e,o){4&o&&i!==(i=e[10].innerHTML+"")&&t.p(i)},i:zn,o:zn,d(e){e&&ur(o),e&&t.d()}}}function nh(e){let t,o=e[10].textContent+"";return{c(){t=mr(o)},m(e,o){dr(e,t,o)},p(e,i){4&i&&o!==(o=e[10].textContent+"")&&wr(t,o)},i:zn,o:zn,d(e){e&&ur(t)}}}function rh(e){let t,o;return t=new dh({props:{items:e[2],discardEmptyItems:!0}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};4&o&&(i.items=e[2]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function ah(e){let t,o,i,n;const r=[rh,nh,ih],a=[];function s(e,t){return e[2]&&e[2].length?0:e[10].textContent?1:e[10].innerHTML?2:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=gr()},m(e,o){~t&&a[t].m(e,o),dr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(ra(),la(a[l],1,1,(()=>{a[l]=null})),aa()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sa(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(sa(o),n=!0)},o(e){la(o),n=!1},d(e){~t&&a[t].d(e),e&&ur(i)}}}function sh(e,t){let o,i,n,r,a,s;const l=[oh,th],c=[];function d(e,t){return 4&t&&(i=null),null==i&&(i=!e[5](e[9])),i?0:1}return n=d(t,-1),r=c[n]=l[n](t),{key:e,first:null,c(){o=$r(),r.c(),a=$r(),this.first=o},m(e,t){dr(e,o,t),c[n].m(e,t),dr(e,a,t),s=!0},p(e,o){let i=n;n=d(t=e,o),n===i?c[n].p(t,o):(ra(),la(c[i],1,1,(()=>{c[i]=null})),aa(),r=c[n],r?r.p(t,o):(r=c[n]=l[n](t),r.c()),sa(r,1),r.m(a.parentNode,a))},i(e){s||(sa(r),s=!0)},o(e){la(r),s=!1},d(e){e&&ur(o),c[n].d(e),e&&ur(a)}}}function lh(e){let t,o,i=[],n=new Map,r=e[2];const a=e=>e[0]+e[1];for(let t=0;t<r.length;t+=1){let o=eh(e,r,t),s=a(o);n.set(s,i[t]=sh(s,o))}return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=$r()},m(e,n){for(let t=0;t<i.length;t+=1)i[t].m(e,n);dr(e,t,n),o=!0},p(e,[o]){62&o&&(r=e[2],ra(),i=ma(i,o,a,1,e,r,n,t.parentNode,pa,sh,t,eh),aa())},i(e){if(!o){for(let e=0;e<r.length;e+=1)sa(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)la(i[e]);o=!1},d(e){for(let t=0;t<i.length;t+=1)i[t].d(e);e&&ur(t)}}}function ch(e,t,o){let i,n,{items:r}=t,{discardEmptyItems:a=!0}=t,{key:s=""}=t;const l={Button:Gc,Dropdown:Lu,Panel:Ou,Slider:Qu},c=e=>!P(e)||!!l[e],d=e=>{if(!e)return!1;const[t,,o,i=[]]=e;return!!c(t)||(i.some(d)||o.textContent||o.innerHTML)};return e.$$set=e=>{"items"in e&&o(6,r=e.items),"discardEmptyItems"in e&&o(7,a=e.discardEmptyItems),"key"in e&&o(0,s=e.key)},e.$$.update=()=>{1&e.$$.dirty&&o(1,i=s),192&e.$$.dirty&&o(2,n=(r&&a?r.filter(d):r)||[])},[s,i,n,l,(e={})=>{const{textContent:t,innerHTML:o,...i}=e;return i},c,r,a]}class dh extends wa{constructor(e){super(),va(this,e,ch,lh,Nn,{items:6,discardEmptyItems:7,key:0})}}const uh=["aspectRatio","isRotatedSideways","flip","cropSize"],hh=ts.map((([e])=>e)).filter((e=>!uh.includes(e)));var ph=(e,t)=>new CustomEvent("ping",{detail:{type:e,data:t},cancelable:!0,bubbles:!0}),mh=e=>(e=>/textarea/i.test(e.nodeName))(e)||(e=>/date|email|number|search|text|url/.test(e.type))(e)||e.isContentEditable,gh=(e,t)=>(t?qs(e,t):e).replace(/([a-z])([A-Z])/g,"$1-$2").replace(/\s+/g,"-").toLowerCase(),$h=(e,t=Z)=>{const{subscribe:o,set:i}=Ca(void 0);return{subscribe:o,destroy:((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}},fh=e=>/video/.test(e.type);var yh=(e,t,o)=>new Promise(((i,n)=>{(async()=>{fh(e)&&i(await(e=>new Promise(((t,o)=>{const i=g("video");i.onseeked=()=>{const e=g("canvas");Ut(i).then((({width:o,height:n})=>{e.width=o,e.height=n;const r=e.getContext("2d",{willReadFrequently:!0}),a=()=>{r.drawImage(i,0,0,e.width,e.height);const o=r.getImageData(0,0,e.width,e.height);f(e),t(o)};Ht()?setTimeout(a,16):a()}))},i.onloadeddata=()=>{i.currentTime=0},i.onerror=e=>{console.error(e),o(i.error)},i.src=URL.createObjectURL(e),i.load()})))(e));const r=await t.read(e),a=e=>D(e,o).then((e=>t.apply(e,r))).then(i).catch(n);if(E(e)||!A()||Ht()||uo())return a(e);let s;try{s=await z(((e,t)=>createImageBitmap(e).then((e=>t(null,e))).catch(t)),[e])}catch(e){}s&&s.width?await p()?wl()&&r>1?i(await(async e=>m(await S(e)))(s)):i(s):i(t.apply(s,r)):a(e)})()})),bh=(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",{willReadFrequently:!0}),l=y(e)?await S(e):e;s.drawImage(l,0,0,n,r),o(m(a))})),xh=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 vh=null;var wh=()=>{if(null===vh){let e=g("canvas");vh=!!hl(e),f(e),e=void 0}return vh};const Sh=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],kh={precision:1e-4},Ch={precision:.01*kh.precision};var Mh=()=>{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),e(o),()=>{t.splice(t.indexOf(e),1)})}},Th=e=>e[0]<.25&&e[1]<.25&&e[2]<.25,Ph=(e={})=>new Promise((t=>{const{accept:o="image/*"}=e,i=g("input",{style:"position:absolute;visibility:hidden;width:0;height:0;",type:"file",accept:o}),n=()=>{const[e]=i.files;i.parentNode&&i.remove(),i.removeEventListener("change",n),t(e)};i.addEventListener("change",n),uo()&&document.body.append(i),i.click()})),Rh=e=>{try{return e()}catch(e){console.error(e)}},Ih=([e,t])=>e+.5*(t-e),Ah=e=>Math.round(100*e),Eh=e=>ue(e.clientX,e.clientY),Lh=(e,t,o)=>{const i=Eh(e);return we(we(i,t),o)};function Fh(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,{root:S}=t,{locale:k}=t,{stores:C}=t,{allowPan:M=!0}=t,{allowZoom:T=!0}=t,{enablePan:P=!0}=t,{enableZoom:R=!0}=t,{enableZoomControls:I=R}=t,{enableZoomInput:A=!0}=t,{enablePanInput:E=!0}=t,{enablePanLimit:L=!0}=t,{panLimitGutterScalar:F=0}=t,{zoomOptions:z=[.25,.5,1,1.25,1.5,2,3,4,6,8,16]}=t,{zoomAdjustStep:D=.25}=t,{zoomAdjustFactor:O=.1}=t,{zoomAdjustWheelFactor:B=1}=t,{elasticity:_=5}=t,{imageSelectionRectCentered:W}=t,{imageSelectionRectScalar:V}=t,{zoomLevel:N=null}=t,{zoomControls:H}=t,{zoomMultiTouching:j=!1}=t;const{isAnimated:U,isInteracting:Z,rootRect:X,stageRect:G,stageScalar:Y,imageSelectionPan:q,imageSelectionZoom:K,imageSelectionStageFitScalar:J,imageSelectionRect:Q,imageSelectionStoredState:ee,imagePreviewUpscale:te}=C;Un(e,U,(e=>o(68,v=e))),Un(e,Z,(e=>o(67,b=e))),Un(e,X,(e=>o(65,f=e))),Un(e,G,(e=>o(64,$=e))),Un(e,Y,(e=>o(45,x=e))),Un(e,q,(e=>o(63,p=e))),Un(e,K,(e=>o(42,h=e))),Un(e,J,(e=>o(43,m=e))),Un(e,Q,(e=>o(66,y=e))),Un(e,ee,(e=>o(69,w=e))),Un(e,te,(e=>o(44,g=e)));let oe=!1,ie=void 0,ne=void 0,re=void 0,ae=void 0;const se=e=>{const t=S.querySelector(".PinturaMain > .PinturaUtilMain")||S.querySelector('div[tabindex="0"] .PinturaUtilMain');return!!t&&(!!t.contains(e.target)&&!mh(e.target))},le=(e={})=>{const{pan:t=p,zoom:o=h}=e;Qn(ee,w={translation:t,zoom:o},w)},ce=()=>p&&0===p.x&&0===p.y,he=()=>{Qn(K,h=void 0,h),ce()||Qn(q,p=de(),p),ge.set(void 0,{hard:!0})},me=()=>{he(),le()},ge=Wl(void 0,{precision:.01});ge.subscribe((e=>{if(void 0===e)return Qn(K,h=void 0,h),void(ce()||Qn(q,p=de(),p));const t=h;e<=1?ce()||Qn(q,p=de(),p):e<=t&&Qn(q,p=ke(p,.8),p),Qn(K,h=e,h)}));const fe=e=>{ge.update((t=>{const o=e(t||m);return le({zoom:o}),o}))},ye=e=>{e?ge.set(e,{hard:!1===v}):(e=void 0,ge.set(void 0,{hard:!0})),Qn(K,h=e,h),le({zoom:e})},be=(e,t)=>{const o=V*t,i={...W},n=1-Za(F,0,1);st(i,o<n?o:n);const r={...W};st(r,o),at(r,e);const a={...r};return r.x>i.x&&(a.x=i.x),r.y>i.y&&(a.y=i.y),r.x+r.width<i.x+i.width&&(a.x=i.x+i.width-r.width),r.y+r.height<i.y+i.height&&(a.y=i.y+i.height-r.height),we(rt(a),rt(i))},xe=({translation:e,zoom:t=1,elastify:o=!0})=>{if(!ie)return;let i=e;const n=ue(ie.x+i.x,ie.y+i.y);if(!L)return n;const r=be(n,t);return o?td(r,n,_):r};let ve,Ce;const Me=()=>{Ce=void 0,Qn(Z,b=!0,b),o(33,oe=E),ve=!1,re=!1,ie={...p},ne=g?h||m:r?h||1:h||m},Te=e=>{const{scalar:t,translation:n,isMultiTouching:r}=e.detail;if(!ie||!r&&!E)return;r&&ke(n,.5),(E||r)&&(ve=!0),j||o(12,j=r);const a=i?Za(ne*t,s,l):1,c=xe({translation:n,zoom:a,elastify:!0}),d=$e(c);ae=$e(p),re=d<ae,i&&K.set(a),q.set(c),Ce=j&&{translation:e.detail.translation,scalar:t}},Pe=e=>{Qn(Z,b=!1,b),o(33,oe=!1),o(12,j=!1),re&&ae<50&&(ie=void 0,ne=void 0,q.set(de()))},Re=e=>{Qn(Z,b=!1,b),o(33,oe=!1),o(12,j=!1),Promise.resolve().then((()=>{if(ve&&ie){const t=Ce||e.detail,o=i?Za(ne*t.scalar,s,l):1,n=xe({elastify:!1,translation:t.translation,zoom:o});q.set(n)}ie=void 0,ne=void 0,E&&e.detail.isDoubleTap&&me(),le()}))};let Ie,Ae=Date.now(),Ee=0,Le=!1,Fe=!1;const ze=e=>{if(!se(e))return;if(e.preventDefault(),e.stopPropagation(),Fe)return;clearTimeout(Ie);const t=id(e),o=Date.now(),i=o-Ae;Ae=o;const n=Math.abs(t/i)>.2;Ee=n?Ee+1:0;const r=1+-1*t*B/(n?50:100),a=Lh(e,f,$);De(a,r,{isZoomingFast:n})},De=(e,t,{isZoomingFast:o})=>{const i=g?h||m:r?h||1:h||m,n=i*t,a=de(),c=p,d=g?m:r?1:m,u=Math.abs(n-d),$=n<i,f=i>d&&$||i<d&&n>i,b=Ee>=5;if(o||(Le=!1),Ee>0&&!Le&&(Le=f),b&&Le)return me(),Fe=!0,void setTimeout((()=>{Fe=!1}),100);if(b)return;!o&&f&&u<=.05&&(Ie=setTimeout((()=>{me()}),250)),Qn(K,h=Za(n,s,l),h);const x=Ke(y);st(x,i),at(x,c);const v=rt(x),w=Ke(x);st(w,h-i+1,e);const S=rt(w),k=Se(we(S,v),i);((e,t,o)=>{e.x=t,e.y=o})(a,c.x+k.x,c.y+k.y),Qn(q,p=$&&o?ke(pe(p),.85):be(a,i),p),le()},Oe=e=>(e?"add":"remove")+"EventListener";let Be,_e,We,Ve;const Ne=e=>{e.preventDefault(),_e={...p},Ve=Ke(y),We=Lh(e,f,$),Be=g?h||m:r?h||1:h||m},He=e=>{e.preventDefault(),Qn(K,h=Za(e.scale*Be,s,l),h);const t=Ke(Ve);st(t,Be),at(t,_e);const o=rt(t),i=Ke(t);st(i,h-Be+1,We);const n=rt(i),r=Se(we(n,o),Be),a={x:_e.x+r.x,y:_e.y+r.y};Qn(q,p=be(a,h),p)},je=e=>{e.preventDefault()},Ue=e=>{S[Oe(e)]("wheel",ze),uo()||(S[Oe(e)]("gesturestart",Ne),S[Oe(e)]("gesturechange",He),S[Oe(e)]("gestureend",je))},Ze=e=>{const t=Oe(e);S[t]("interactionstart",Me),S[t]("interactionupdate",Te),S[t]("interactionrelease",Pe),S[t]("interactionend",Re)};let Xe;return Fr((()=>{Xe=Kc(S,{drag:!0,pinch:!0,inertia:!0,inertiaDurationMultiplier:10,shouldStartInteraction:se})})),Dr((()=>{Ue(!1),Ze(!1),Xe.destroy(),Xe=void 0})),e.$$set=e=>{"root"in e&&o(13,S=e.root),"locale"in e&&o(14,k=e.locale),"stores"in e&&o(15,C=e.stores),"allowPan"in e&&o(16,M=e.allowPan),"allowZoom"in e&&o(17,T=e.allowZoom),"enablePan"in e&&o(18,P=e.enablePan),"enableZoom"in e&&o(19,R=e.enableZoom),"enableZoomControls"in e&&o(20,I=e.enableZoomControls),"enableZoomInput"in e&&o(21,A=e.enableZoomInput),"enablePanInput"in e&&o(22,E=e.enablePanInput),"enablePanLimit"in e&&o(23,L=e.enablePanLimit),"panLimitGutterScalar"in e&&o(24,F=e.panLimitGutterScalar),"zoomOptions"in e&&o(25,z=e.zoomOptions),"zoomAdjustStep"in e&&o(26,D=e.zoomAdjustStep),"zoomAdjustFactor"in e&&o(27,O=e.zoomAdjustFactor),"zoomAdjustWheelFactor"in e&&o(28,B=e.zoomAdjustWheelFactor),"elasticity"in e&&o(29,_=e.elasticity),"imageSelectionRectCentered"in e&&o(30,W=e.imageSelectionRectCentered),"imageSelectionRectScalar"in e&&o(31,V=e.imageSelectionRectScalar),"zoomLevel"in e&&o(32,N=e.zoomLevel),"zoomControls"in e&&o(11,H=e.zoomControls),"zoomMultiTouching"in e&&o(12,j=e.zoomMultiTouching)},e.$$.update=()=>{var t,$;2752512&e.$$.dirty[0]&&o(35,i=T&&R&&A),327680&e.$$.dirty[0]&&o(34,n=M&&P),196608&e.$$.dirty[0]&&(M||T?(Qn(K,h=R?w.zoom:void 0,h),Qn(q,p=P?pe(w.translation):ce()?p:de(),p),ge.set(h)):he()),16384&e.$$.dirty[1]&&(r=x>=1),33570816&e.$$.dirty[0]|28672&e.$$.dirty[1]&&o(39,a=[(g||x<1)&&[m,Ah(m)+"%",{sublabel:k.labelZoomFit}],...z.map((e=>[e,Ah(e)+"%"]))].filter(Boolean).map((e=>(1===e[0]&&(e[2]={sublabel:k.labelZoomActual}),e))).sort(((e,t)=>{const o=e[0]||m,i=t[0]||m;return o<i?-1:i<o?1:0}))),4352&e.$$.dirty[1]&&o(37,s=Math.min(a.reduce(((e,[t])=>t<e?t:e),Number.MAX_SAFE_INTEGER),m)),256&e.$$.dirty[1]&&o(36,l=a.reduce(((e,[t])=>t>e?t:e),Number.MIN_SAFE_INTEGER)),2&e.$$.dirty[1]&&null!==N&&ye(N),30720&e.$$.dirty[1]&&o(41,d=h||(g||x<1?m:1)),1280&e.$$.dirty[1]&&o(38,(t=a.map((([e])=>e)),$=d,c=t.findIndex((e=>e===$)))),1024&e.$$.dirty[1]&&o(40,u=Ah(d)+"%"),202522624&e.$$.dirty[0]|3040&e.$$.dirty[1]&&o(11,H=(T||T)&&I?[["Button","zoom-out",{hideLabel:!0,label:k.labelZoomOut,icon:k.iconZoomOut,disabled:h===s,onclick:()=>fe((e=>Math.max(s,e-D))),onhold:()=>fe((e=>Math.max(s,e*(1-O))))}],["Dropdown","zoom-level",{label:u,labelClass:"PinturaFixedWidthCharacters",options:a,selectedIndex:c,onchange:e=>ye(e.value)}],["Button","zoom-in",{hideLabel:!0,label:k.labelZoomIn,icon:k.iconZoomIn,disabled:h===l,onclick:()=>fe((e=>Math.min(l,e+D))),onhold:()=>fe((e=>Math.min(l,e*(1+O))))}]]:[]),8192&e.$$.dirty[0]|16&e.$$.dirty[1]&&S&&Ue(i),8192&e.$$.dirty[0]|8&e.$$.dirty[1]&&S&&Ze(n),4202496&e.$$.dirty[0]|12&e.$$.dirty[1]&&S&&S.style.setProperty("--cursor",n&&E?oe?"grabbing":"grab":"")},[U,Z,X,G,Y,q,K,J,Q,ee,te,H,j,S,k,C,M,T,P,R,I,A,E,L,F,z,D,O,B,_,W,V,N,oe,n,i,l,s,c,a,u,d,h,m,g,x]}class zh extends wa{constructor(e){super(),va(this,e,Fh,null,Nn,{root:13,locale:14,stores:15,allowPan:16,allowZoom:17,enablePan:18,enableZoom:19,enableZoomControls:20,enableZoomInput:21,enablePanInput:22,enablePanLimit:23,panLimitGutterScalar:24,zoomOptions:25,zoomAdjustStep:26,zoomAdjustFactor:27,zoomAdjustWheelFactor:28,elasticity:29,imageSelectionRectCentered:30,imageSelectionRectScalar:31,zoomLevel:32,zoomControls:11,zoomMultiTouching:12},null,[-1,-1,-1,-1])}}const Dh=e=>new Promise((t=>{const o=new FileReader;o.onload=()=>t(o.result),o.readAsArrayBuffer(e)})),Oh=(e,{limit:t=1024}={})=>{let o=0;o+=4;if(1718909296!==e.getUint32(o))return 0;o+=4;if(1836069938!==e.getUint32(o))return 0;let i=!1,n=-1;for(let r=o;r<t;r++){if(i||1953653099!==e.getUint32(r)||(i=!0,r+=4),!i)continue;if(64==e.getUint8(r)){n=r;break}}if(n<0)return 0;const r=e.getUint32(n-28),a=e.getUint32(n-20),s=e.getUint32(n-32),l=e.getUint32(n-16);return 65536===r&&4294901760===a?90:4294901760===s&&4294901760===l?180:4294901760===r&&65536===a?270:0},{window:Bh}=ua;function _h(e){let t,o,i,n=e[41]&&Wh(e),r=e[38]&&Yh(e);return{c(){n&&n.c(),t=gr(),r&&r.c(),o=$r()},m(e,a){n&&n.m(e,a),dr(e,t,a),r&&r.m(e,a),dr(e,o,a),i=!0},p(e,i){e[41]?n?(n.p(e,i),1024&i[1]&&sa(n,1)):(n=Wh(e),n.c(),sa(n,1),n.m(t.parentNode,t)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa()),e[38]?r?(r.p(e,i),128&i[1]&&sa(r,1)):(r=Yh(e),r.c(),sa(r,1),r.m(o.parentNode,o)):r&&(ra(),la(r,1,1,(()=>{r=null})),aa())},i(e){i||(sa(n),sa(r),i=!0)},o(e){la(n),la(r),i=!1},d(e){n&&n.d(e),e&&ur(t),r&&r.d(e),e&&ur(o)}}}function Wh(e){let t,o,i,n,r,a;const s=[Nh,Vh],l=[];function c(e,t){return e[39]?0:e[34]?1:-1}return~(i=c(e))&&(n=l[i]=s[i](e)),{c(){t=hr("div"),o=hr("p"),n&&n.c(),xr(o,"style",e[68]),xr(t,"class","PinturaStatus"),xr(t,"style",r="opacity: "+e[53])},m(e,n){dr(e,t,n),sr(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&&(ra(),la(l[u],1,1,(()=>{l[u]=null})),aa()),~i?(n=l[i],n?n.p(e,d):(n=l[i]=s[i](e),n.c()),sa(n,1),n.m(o,null)):n=null),(!a||64&d[2])&&xr(o,"style",e[68]),(!a||4194304&d[1]&&r!==(r="opacity: "+e[53]))&&xr(t,"style",r)},i(e){a||(sa(n),a=!0)},o(e){la(n),a=!1},d(e){e&&ur(t),~i&&l[i].d()}}}function Vh(e){let t,o,i,n;t=new dd({props:{text:e[34].text||"",onmeasure:e[200]}});let r=e[34].aside&&Hh(e);return{c(){ya(t.$$.fragment),o=gr(),r&&r.c(),i=$r()},m(e,a){ba(t,e,a),dr(e,o,a),r&&r.m(e,a),dr(e,i,a),n=!0},p(e,o){const n={};8&o[1]&&(n.text=e[34].text||""),t.$set(n),e[34].aside?r?(r.p(e,o),8&o[1]&&sa(r,1)):(r=Hh(e),r.c(),sa(r,1),r.m(i.parentNode,i)):r&&(ra(),la(r,1,1,(()=>{r=null})),aa())},i(e){n||(sa(t.$$.fragment,e),sa(r),n=!0)},o(e){la(t.$$.fragment,e),la(r),n=!1},d(e){xa(t,e),e&&ur(o),r&&r.d(e),e&&ur(i)}}}function Nh(e){let t,o,i,n;return t=new dd({props:{text:e[39],onmeasure:e[200]}}),i=new $d({props:{class:"PinturaStatusIcon",offset:e[78],opacity:e[79],$$slots:{default:[Gh]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment),o=gr(),ya(i.$$.fragment)},m(e,r){ba(t,e,r),dr(e,o,r),ba(i,e,r),n=!0},p(e,o){const n={};256&o[1]&&(n.text=e[39]),t.$set(n);const r={};65536&o[2]&&(r.offset=e[78]),131072&o[2]&&(r.opacity=e[79]),8&o[0]|512&o[17]&&(r.$$scope={dirty:o,ctx:e}),i.$set(r)},i(e){n||(sa(t.$$.fragment,e),sa(i.$$.fragment,e),n=!0)},o(e){la(t.$$.fragment,e),la(i.$$.fragment,e),n=!1},d(e){xa(t,e),e&&ur(o),xa(i,e)}}}function Hh(e){let t,o;return t=new $d({props:{class:"PinturaStatusButton",offset:e[78],opacity:e[79],$$slots:{default:[Zh]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};65536&o[2]&&(i.offset=e[78]),131072&o[2]&&(i.opacity=e[79]),8&o[1]|512&o[17]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function jh(e){let t,o;return t=new pd({props:{progress:e[34].progressIndicator.progress}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};8&o[1]&&(i.progress=e[34].progressIndicator.progress),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Uh(e){let t,o;const i=[e[34].closeButton,{hideLabel:!0}];let n={};for(let e=0;e<i.length;e+=1)n=On(n,i[e]);return t=new Gc({props:n}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const n=8&o[1]?ga(i,[$a(e[34].closeButton),i[1]]):{};t.$set(n)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Zh(e){let t,o,i,n=e[34].progressIndicator.visible&&jh(e),r=e[34].closeButton&&e[34].text&&Uh(e);return{c(){n&&n.c(),t=gr(),r&&r.c(),o=$r()},m(e,a){n&&n.m(e,a),dr(e,t,a),r&&r.m(e,a),dr(e,o,a),i=!0},p(e,i){e[34].progressIndicator.visible?n?(n.p(e,i),8&i[1]&&sa(n,1)):(n=jh(e),n.c(),sa(n,1),n.m(t.parentNode,t)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa()),e[34].closeButton&&e[34].text?r?(r.p(e,i),8&i[1]&&sa(r,1)):(r=Uh(e),r.c(),sa(r,1),r.m(o.parentNode,o)):r&&(ra(),la(r,1,1,(()=>{r=null})),aa())},i(e){i||(sa(n),sa(r),i=!0)},o(e){la(n),la(r),i=!1},d(e){n&&n.d(e),e&&ur(t),r&&r.d(e),e&&ur(o)}}}function Xh(e){let t,o=e[3].iconSupportError+"";return{c(){t=pr("g")},m(e,i){dr(e,t,i),t.innerHTML=o},p(e,i){8&i[0]&&o!==(o=e[3].iconSupportError+"")&&(t.innerHTML=o)},d(e){e&&ur(t)}}}function Gh(e){let t,o;return t=new Wc({props:{$$slots:{default:[Xh]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};8&o[0]|512&o[17]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Yh(e){let t,o,i,n,r,a,s,l,c,d,u,h,p,m,g=e[10]&&qh(e),$=e[45]&&e[44]&&Kh(e);const f=[op,tp],y=[];function b(e,t){return e[45]?0:1}function x(t){e[388](t)}function v(t){e[389](t)}function w(t){e[390](t)}i=b(e),n=y[i]=f[i](e),a=new uc({props:{isAnimated:e[52],isTransparent:e[19],pixelRatio:e[56],textPixelRatio:e[6],backgroundColor:e[55],maskRect:e[57],maskOpacity:e[69]?e[69].maskOpacity:1,maskMarkupOpacity:e[7],maskFrameOpacity:e[5],clipAnnotationsToImage:e[81],images:e[54],interfaceImages:e[82],loadImageData:e[27],enableGrid:e[11],gridSize:e[83],gridColors:[e[84],e[85]],gridOpacity:e[86],willRequest:e[77]||e[87],willRender:e[385],didRender:e[386]}});let S={root:e[2],locale:e[3],stores:e[186],allowPan:e[89],enablePan:e[16],enablePanLimit:e[20],panLimitGutterScalar:e[21],enablePanInput:e[90],allowZoom:e[91],enableZoom:e[17],enableZoomInput:void 0!==e[18]?e[18]:e[92],enableZoomControls:e[93],zoomOptions:e[12]||e[22],zoomAdjustStep:e[13]||e[23],zoomAdjustFactor:e[14]||e[24],zoomAdjustWheelFactor:e[15]||e[25],imageSelectionRectCentered:e[94],imageSelectionRectScalar:e[95],elasticity:ap*e[8]};return void 0!==e[0]&&(S.zoomLevel=e[0]),void 0!==e[32]&&(S.zoomControls=e[32]),void 0!==e[33]&&(S.zoomMultiTouching=e[33]),d=new zh({props:S}),Nr.push((()=>fa(d,"zoomLevel",x))),Nr.push((()=>fa(d,"zoomControls",v))),Nr.push((()=>fa(d,"zoomMultiTouching",w))),{c(){g&&g.c(),t=gr(),$&&$.c(),o=gr(),n.c(),r=gr(),ya(a.$$.fragment),s=gr(),l=hr("div"),c=gr(),ya(d.$$.fragment),xr(l,"class","PinturaRootPortal")},m(n,u){g&&g.m(n,u),dr(n,t,u),$&&$.m(n,u),dr(n,o,u),y[i].m(n,u),dr(n,r,u),ba(a,n,u),dr(n,s,u),dr(n,l,u),e[387](l),dr(n,c,u),ba(d,n,u),m=!0},p(e,s){e[10]?g?(g.p(e,s),1024&s[0]&&sa(g,1)):(g=qh(e),g.c(),sa(g,1),g.m(t.parentNode,t)):g&&(ra(),la(g,1,1,(()=>{g=null})),aa()),e[45]&&e[44]?$?($.p(e,s),24576&s[1]&&sa($,1)):($=Kh(e),$.c(),sa($,1),$.m(o.parentNode,o)):$&&(ra(),la($,1,1,(()=>{$=null})),aa());let l=i;i=b(e),i===l?y[i].p(e,s):(ra(),la(y[l],1,1,(()=>{y[l]=null})),aa(),n=y[i],n?n.p(e,s):(n=y[i]=f[i](e),n.c()),sa(n,1),n.m(r.parentNode,r));const c={};2097152&s[1]&&(c.isAnimated=e[52]),524288&s[0]&&(c.isTransparent=e[19]),33554432&s[1]&&(c.pixelRatio=e[56]),64&s[0]&&(c.textPixelRatio=e[6]),16777216&s[1]&&(c.backgroundColor=e[55]),67108864&s[1]&&(c.maskRect=e[57]),128&s[2]&&(c.maskOpacity=e[69]?e[69].maskOpacity:1),128&s[0]&&(c.maskMarkupOpacity=e[7]),32&s[0]&&(c.maskFrameOpacity=e[5]),524288&s[2]&&(c.clipAnnotationsToImage=e[81]),8388608&s[1]&&(c.images=e[54]),1048576&s[2]&&(c.interfaceImages=e[82]),134217728&s[0]&&(c.loadImageData=e[27]),2048&s[0]&&(c.enableGrid=e[11]),2097152&s[2]&&(c.gridSize=e[83]),12582912&s[2]&&(c.gridColors=[e[84],e[85]]),16777216&s[2]&&(c.gridOpacity=e[86]),33587200&s[2]&&(c.willRequest=e[77]||e[87]),512&s[0]|1507344&s[1]|67108864&s[2]&&(c.willRender=e[385]),1879048192&s[1]|3&s[2]&&(c.didRender=e[386]),a.$set(c);const m={};4&s[0]&&(m.root=e[2]),8&s[0]&&(m.locale=e[3]),134217728&s[2]&&(m.allowPan=e[89]),65536&s[0]&&(m.enablePan=e[16]),1048576&s[0]&&(m.enablePanLimit=e[20]),2097152&s[0]&&(m.panLimitGutterScalar=e[21]),268435456&s[2]&&(m.enablePanInput=e[90]),536870912&s[2]&&(m.allowZoom=e[91]),131072&s[0]&&(m.enableZoom=e[17]),262144&s[0]|1073741824&s[2]&&(m.enableZoomInput=void 0!==e[18]?e[18]:e[92]),1&s[3]&&(m.enableZoomControls=e[93]),4198400&s[0]&&(m.zoomOptions=e[12]||e[22]),8396800&s[0]&&(m.zoomAdjustStep=e[13]||e[23]),16793600&s[0]&&(m.zoomAdjustFactor=e[14]||e[24]),33587200&s[0]&&(m.zoomAdjustWheelFactor=e[15]||e[25]),2&s[3]&&(m.imageSelectionRectCentered=e[94]),4&s[3]&&(m.imageSelectionRectScalar=e[95]),256&s[0]&&(m.elasticity=ap*e[8]),!u&&1&s[0]&&(u=!0,m.zoomLevel=e[0],qr((()=>u=!1))),!h&&2&s[1]&&(h=!0,m.zoomControls=e[32],qr((()=>h=!1))),!p&&4&s[1]&&(p=!0,m.zoomMultiTouching=e[33],qr((()=>p=!1))),d.$set(m)},i(e){m||(sa(g),sa($),sa(n),sa(a.$$.fragment,e),sa(d.$$.fragment,e),m=!0)},o(e){la(g),la($),la(n),la(a.$$.fragment,e),la(d.$$.fragment,e),m=!1},d(n){g&&g.d(n),n&&ur(t),$&&$.d(n),n&&ur(o),y[i].d(n),n&&ur(r),xa(a,n),n&&ur(s),n&&ur(l),e[387](null),n&&ur(c),xa(d,n)}}}function qh(e){let t,o,i,n,r;return o=new dh({props:{items:e[65]}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"class","PinturaNav PinturaNavTools")},m(a,s){dr(a,t,s),ba(o,t,null),i=!0,n||(r=[fr(t,"measure",e[372]),er(oc.call(null,t))],n=!0)},p(e,t){const i={};8&t[2]&&(i.items=e[65]),o.$set(i)},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o),n=!1,Wn(r)}}}function Kh(e){let t,o,i;return o=new ad({props:{elasticity:e[8]*lp,scrollDirection:e[71]?"y":"x",$$slots:{default:[ep]},$$scope:{ctx:e}}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"class","PinturaNav PinturaNavMain")},m(e,n){dr(e,t,n),ba(o,t,null),i=!0},p(e,t){const i={};256&t[0]&&(i.elasticity=e[8]*lp),512&t[2]&&(i.scrollDirection=e[71]?"y":"x"),4096&t[1]|12288&t[2]|512&t[17]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o)}}}function Jh(e){let t,o=e[535].icon+"";return{c(){t=pr("g")},m(e,i){dr(e,t,i),t.innerHTML=o},p(e,i){256&i[17]&&o!==(o=e[535].icon+"")&&(t.innerHTML=o)},d(e){e&&ur(t)}}}function Qh(e){let t,o,i,n,r,a=e[535].label+"";return t=new Wc({props:{$$slots:{default:[Jh]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment),o=gr(),i=hr("span"),n=mr(a)},m(e,a){ba(t,e,a),dr(e,o,a),dr(e,i,a),sr(i,n),r=!0},p(e,o){const i={};768&o[17]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i),(!r||256&o[17])&&a!==(a=e[535].label+"")&&wr(n,a)},i(e){r||(sa(t.$$.fragment,e),r=!0)},o(e){la(t.$$.fragment,e),r=!1},d(e){xa(t,e),e&&ur(o),e&&ur(i)}}}function ep(e){let t,o;const i=[e[75],{tabs:e[74]}];let n={$$slots:{default:[Qh,({tab:e})=>({535:e}),({tab:e})=>[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,e?256:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=On(n,i[e]);return t=new xc({props:n}),t.$on("select",e[373]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const n=12288&o[2]?ga(i,[8192&o[2]&&$a(e[75]),4096&o[2]&&{tabs:e[74]}]):{};768&o[17]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function tp(e){let t,o,i;function n(t){e[381](t)}let r={class:"PinturaMain",content:{...e[46].find(e[380]),props:e[26][e[43]]},locale:e[3],stores:e[186]};return void 0!==e[1][e[43]]&&(r.component=e[1][e[43]]),t=new Oc({props:r}),Nr.push((()=>fa(t,"component",n))),t.$on("measure",e[212]),t.$on("show",e[382]),t.$on("hide",e[383]),t.$on("fade",e[384]),{c(){ya(t.$$.fragment)},m(e,o){ba(t,e,o),i=!0},p(e,i){const n={};67108864&i[0]|36864&i[1]&&(n.content={...e[46].find(e[380]),props:e[26][e[43]]}),8&i[0]&&(n.locale=e[3]),!o&&2&i[0]|4096&i[1]&&(o=!0,n.component=e[1][e[43]],qr((()=>o=!1))),t.$set(n)},i(e){i||(sa(t.$$.fragment,e),i=!0)},o(e){la(t.$$.fragment,e),i=!1},d(e){xa(t,e)}}}function op(e){let t,o;const i=[{class:"PinturaMain"},{visible:e[58]},e[75],{panels:e[73]}];let n={$$slots:{default:[ip,({panel:e,panelIsActive:t})=>({533:e,534:t}),({panel:e,panelIsActive:t})=>[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(e?64:0)|(t?128:0)]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=On(n,i[e]);return t=new Ec({props:n}),t.$on("measure",e[379]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const n=134217728&o[1]|10240&o[2]?ga(i,[i[0],134217728&o[1]&&{visible:e[58]},8192&o[2]&&$a(e[75]),2048&o[2]&&{panels:e[73]}]):{};67108874&o[0]|134250560&o[1]|704&o[17]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function ip(e){let t,o,i;function n(...t){return e[374](e[533],...t)}function r(t){e[375](t,e[533])}let a={content:{...e[46].find(n),props:e[26][e[533]]},locale:e[3],isActive:e[534],stores:e[186]};return void 0!==e[1][e[533]]&&(a.component=e[1][e[533]]),t=new Oc({props:a}),Nr.push((()=>fa(t,"component",r))),t.$on("measure",e[212]),t.$on("show",(function(){return e[376](e[533])})),t.$on("hide",(function(){return e[377](e[533])})),t.$on("fade",(function(...t){return e[378](e[533],...t)})),{c(){ya(t.$$.fragment)},m(e,o){ba(t,e,o),i=!0},p(i,r){e=i;const a={};67108864&r[0]|32768&r[1]|64&r[17]&&(a.content={...e[46].find(n),props:e[26][e[533]]}),8&r[0]&&(a.locale=e[3]),128&r[17]&&(a.isActive=e[534]),!o&&2&r[0]|64&r[17]&&(o=!0,a.component=e[1][e[533]],qr((()=>o=!1))),t.$set(a)},i(e){i||(sa(t.$$.fragment,e),i=!0)},o(e){la(t.$$.fragment,e),i=!1},d(e){xa(t,e)}}}function np(e){let t,o;return{c(){t=hr("span"),xr(t,"class","PinturaEditorOverlay"),xr(t,"style",o="opacity:"+e[96])},m(e,o){dr(e,t,o)},p(e,i){8&i[3]&&o!==(o="opacity:"+e[96])&&xr(t,"style",o)},d(e){e&&ur(t)}}}function rp(e){let t,o,i,n,r;Yr(e[371]);let s=e[40]&&_h(e),l=e[96]>0&&np(e);return{c(){t=hr("div"),s&&s.c(),o=gr(),l&&l.c(),xr(t,"id",e[4]),xr(t,"class",e[72]),xr(t,"data-env",e[70])},m(c,d){dr(c,t,d),s&&s.m(t,null),sr(t,o),l&&l.m(t,null),e[391](t),i=!0,n||(r=[fr(Bh,"keydown",e[203]),fr(Bh,"keyup",e[204]),fr(Bh,"blur",e[205]),fr(Bh,"paste",e[209]),fr(Bh,"resize",e[371]),fr(t,"ping",(function(){Vn(e[64])&&e[64].apply(this,arguments)})),fr(t,"contextmenu",e[206]),fr(t,"touchstart",e[201],{passive:!1}),fr(t,"touchmove",(function(){Vn(e[67])&&e[67].apply(this,arguments)})),fr(t,"pointermove",(function(){Vn(e[66])&&e[66].apply(this,arguments)})),fr(t,"transitionend",e[191]),fr(t,"dropfiles",e[207]),fr(t,"measure",e[392]),fr(t,"click",(function(){Vn(e[42]?e[208]:a)&&(e[42]?e[208]:a).apply(this,arguments)})),er(oc.call(null,t,{observeViewRect:!0,isMeasureRoot:!0})),er(ic.call(null,t)),er(rc.call(null,t))],n=!0)},p(n,r){(e=n)[40]?s?(s.p(e,r),512&r[1]&&sa(s,1)):(s=_h(e),s.c(),sa(s,1),s.m(t,o)):s&&(ra(),la(s,1,1,(()=>{s=null})),aa()),e[96]>0?l?l.p(e,r):(l=np(e),l.c(),l.m(t,null)):l&&(l.d(1),l=null),(!i||16&r[0])&&xr(t,"id",e[4]),(!i||1024&r[2])&&xr(t,"class",e[72]),(!i||256&r[2])&&xr(t,"data-env",e[70])},i(e){i||(sa(s),i=!0)},o(e){la(s),i=!1},d(o){o&&ur(t),s&&s.d(),l&&l.d(),e[391](null),n=!1,Wn(r)}}}const ap=1,sp="stage-overlay",lp=10;function cp(e,t,o){let i,n,r,s,l,c,d,u,h,p,g,$,y,b,x,S,k,C,M,T,R,I,A,E,F,z,D,O,B,_,W,V,N,H,j,U,X,G,Y,q,K,J,Q,ee,te,oe,ie,ne,re,ae,le,ce,he,pe,me,ge,$e,fe,ye,be,ve,we,Se,ke,Ce,Me,Te,Pe,Re,Ie,Ae,Ee,Le,Fe,ze,De,Oe,Be,We,Ve,Ne,He,je,Ue,Ze,Xe,Ge,Ye,qe,et,ot,it,rt,lt,ct,pt,mt,ft,yt,vt,St,Ct,Mt,Tt,Pt,Rt,It,At,Et,Lt,Dt,Ot,Bt,_t,Wt,Vt,Nt,jt,Ut,Zt,Xt,Gt,Yt,qt,Kt,Jt,Qt,eo,to,oo,io,ro,ao,so,lo,co,ho,po,mo,go,$o,fo,yo,bo,xo,vo,wo,So,ko,Co,To,Po,Ro,Io,Ao,Eo,Lo,Fo,Do,Oo,Bo,_o,Wo,Vo,Ho,Uo,Zo,Xo,Go,Yo,qo,Ko,Jo,Qo,ei,ti,oi,ii,ni,ri,ai,si,li,ci,di,hi,pi,mi,gi,$i,fi=zn,xi=zn;Un(e,Vl,(e=>o(366,Bo=e))),e.$$.on_destroy.push((()=>fi())),e.$$.on_destroy.push((()=>xi()));const vi=No(),wi=Or();let{class:ki}=t,{layout:Ci}=t,{stores:Ti}=t,{locale:Pi}=t,{id:Ri}=t,{util:Ii}=t,{utils:Ai}=t,{animations:Ei="auto"}=t,{disabled:Li=!1}=t,{status:Fi}=t,{previewUpscale:zi=!1}=t,{previewPad:Di=!1}=t,{previewMaskOpacity:Oi=.95}=t,{previewImageDataMaxSize:Bi}=t,{previewImageTextPixelRatio:_i}=t,{markupMaskOpacity:Wi=1}=t,{zoomMaskOpacity:Vi=.85}=t,{elasticityMultiplier:Ni=10}=t,{willRevert:Hi=(()=>Promise.resolve(!0))}=t,{willProcessImage:ji=(()=>Promise.resolve(!0))}=t,{willRenderCanvas:Ui=Z}=t,{willRenderToolbar:Zi=Z}=t,{willSetHistoryInitialState:Xi=Z}=t,{enableButtonExport:Gi=!0}=t,{enableButtonRevert:Yi=!0}=t,{enableNavigateHistory:qi=!0}=t,{enableToolbar:Ki=!0}=t,{enableUtils:Ji=!0}=t,{enableButtonClose:Qi=!1}=t,{enableDropImage:en=!1}=t,{enablePasteImage:tn=!1}=t,{enableBrowseImage:on=!1}=t,{enableTransparencyGrid:rn=!1}=t,{layoutDirectionPreference:an="auto"}=t,{layoutHorizontalUtilsPreference:sn="left"}=t,{layoutVerticalUtilsPreference:ln="bottom"}=t,{layoutVerticalToolbarPreference:un="top"}=t,{layoutVerticalControlGroupsPreference:hn="bottom"}=t,{layoutVerticalControlTabsPreference:pn="bottom"}=t,{markupEditorZoomLevel:gn=null}=t,{markupEditorZoomLevels:$n}=t,{markupEditorZoomAdjustStep:fn}=t,{markupEditorZoomAdjustFactor:yn}=t,{markupEditorZoomAdjustWheelFactor:bn}=t,{markupEditorInteractionMode:xn=!1}=t,{muteAudio:vn=!0}=t,{willSetMediaInitialTimeOffset:wn=((e,t)=>e*Ih(t[0]))}=t,{enablePan:Sn=!0}=t,{enableZoom:kn=!0}=t,{enableZoomControls:Cn=!0}=t,{enableZoomInput:Mn}=t,{enablePanInput:Tn}=t,{enableCanvasAlpha:Pn=!1}=t,{enablePanLimit:Rn}=t,{panLimitGutterScalar:In}=t,{zoomPresetOptions:An=[.25,.5,1,1.25,1.5,2,3,4,6,8,16]}=t,{zoomAdjustStep:En=.25}=t,{zoomAdjustFactor:Dn=.1}=t,{zoomAdjustWheelFactor:On=1}=t,{zoomLevel:Bn=null}=t,{imagePreviewSrc:_n}=t,{imageOrienter:Wn={read:()=>1,apply:e=>e}}=t,{pluginComponents:Vn}=t,{pluginOptions:Nn={}}=t;const Zn=vi.sub,Xn={};let{root:Gn}=t;const Yn=Ca(vn);Un(e,Yn,(e=>o(352,ao=e)));const qn=Ca({});Un(e,qn,(e=>o(51,At=e))),Br("redrawTrigger",qn);const Kn=Ca(Ni);Un(e,Kn,(e=>o(433,qo=e))),Br("elasticityMultiplier",Kn);let Jn=[];const er=Wl();Un(e,er,(e=>o(96,$i=e)));const tr=vl()||1024,or=_e(tr,tr),ir=us(),nr=e=>Promise.resolve(Yo&&Yo(e,{resourceType:"image"})).then((t=>{if(!1===t)return;const{headers:o,credentials:i}=t||{};return fetch(e,{headers:o,credentials:i}).then((e=>{if(200!==e.status)throw`${e.status} (${e.statusText})`;return e.blob()})).then((e=>yh(e,Wn,ir))).then((e=>bh(e,r)))}));let{imageSourceToImageData:rr=(e=>P(e)?nr(e):Ft(e)?new Promise((t=>t(m(e)))):no(e)||zt(e)?yh(e,Wn,ir).then((e=>bh(e,r))):void 0)}=t;const ar=(()=>{let e,t;const o=hh.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=hh.map((e=>i.stores[e].subscribe((t=>{o[e].publish(t)}))))},stores:o,destroy:()=>{e&&e.forEach((e=>e()))}}})(),{file:sr,size:lr,duration:cr,trim:dr,minDuration:ur,maxDuration:hr,loadState:pr,processState:mr,cropAspectRatio:gr,cropLimitToImage:$r,crop:fr,cropMinSize:yr,cropMaxSize:br,cropRange:xr,cropOrigin:vr,cropRectAspectRatio:wr,rotation:Sr,rotationRange:kr,targetSize:Cr,flipX:Mr,flipY:Tr,backgroundColor:Pr,backgroundImage:Rr,colorMatrix:Ir,convolutionMatrix:Ar,gamma:Er,vignette:Lr,noise:Fr,decoration:zr,annotation:_r,redaction:Wr,frame:Vr,state:Hr}=ar.stores;Un(e,sr,(e=>o(349,eo=e))),Un(e,lr,(e=>o(321,qe=e))),Un(e,cr,(e=>o(418,so=e))),Un(e,dr,(e=>o(432,Go=e))),Un(e,pr,(e=>o(341,jt=e))),Un(e,mr,(e=>o(340,Nt=e))),Un(e,gr,(e=>o(429,Wo=e))),Un(e,$r,(e=>o(81,ei=e))),Un(e,fr,(e=>o(361,So=e))),Un(e,Sr,(e=>o(324,it=e))),Un(e,Mr,(e=>o(323,ot=e))),Un(e,Tr,(e=>o(322,et=e))),Un(e,Pr,(e=>o(331,Mt=e))),Un(e,zr,(e=>o(48,Ye=e))),Un(e,_r,(e=>o(49,rt=e))),Un(e,Wr,(e=>o(329,St=e))),Un(e,Vr,(e=>o(47,Ge=e))),Un(e,Hr,(e=>o(417,io=e)));const jr=(e,t,o=0)=>new Promise(((i,n)=>{if(fh(e)){return void(jo()?(async e=>{const t=await Dh(e),o=new DataView(t);return Oh(o)})(e):Promise.resolve()).then((t=>{const o=document.createElement("video");o.onerror=()=>console.error(o.error),o.playsInline=!0,o.preload="auto",o.onloadeddata=()=>{o.onloadeddata=void 0,o.dataset.rotation=t,ps(o).then((()=>{const e=wn(o.duration,Go||[[0,1]]);e>0?(o.onseeked=()=>{o.onseeked=void 0,i(o)},o.currentTime=e):(o.currentTime=e,i(o))}))},o.src=URL.createObjectURL(e),o.load()}))}let r,a=!1;t.cancel=()=>a=!0;const s=Date.now();rr(e).then((e=>{const t=Date.now()-s;clearTimeout(r),r=setTimeout((()=>{a||i(e)}),Math.max(0,o-t))})).catch(n)})),{images:Ur,shapePreprocessor:Zr,imageScrambler:Xr,imageRedactionRendering:Gr,willRequest:Yr,willRequestResource:qr}=Ti;let Kr;Un(e,Ur,(e=>o(370,Xo=e))),Un(e,Zr,(e=>o(369,Zo=e))),Un(e,Xr,(e=>o(332,Tt=e))),Un(e,Gr,(e=>o(330,Ct=e))),Un(e,Yr,(e=>o(77,Yo=e))),Un(e,qr,(e=>o(87,ai=e)));const Jr=Ma(Rr,((e,t)=>{if(!e)return t(void 0);Kr&&(Kr.cancel(),Kr=void 0),Kr={cancel:a},jr(e,Kr).then(t).catch((e=>{}))})),Qr=Hr.subscribe((e=>vi.pub("update",e))),ea=Ca();Br("ui",Ca({}));const ta=Ca(!0);Un(e,ta,(e=>o(89,li=e)));const oa=Ca(!0);Un(e,oa,(e=>o(91,di=e)));const ia=Ca(!0);Un(e,ia,(e=>o(368,Uo=e)));const na=Ca(!0);Un(e,na,(e=>o(430,Vo=e)));const ra=Ca(!0);Un(e,ra,(e=>o(92,hi=e)));const aa=Ca();Un(e,aa,(e=>o(93,pi=e)));const sa=Ca();Un(e,sa,(e=>o(431,Ho=e)));const la=Ma([sa,na],(()=>void 0!==Ho?Ho:Vo));Un(e,la,(e=>o(90,ci=e)));const ca=Ca([0,0,0]);Un(e,ca,(e=>o(55,po=e)));const da=Ca([1,1,1]);Un(e,da,(e=>o(414,yt=e)));const ua=Wl([1,1,1]);Un(e,ua,(e=>o(413,ft=e)));const ha=Ca(),pa=Ca();Un(e,pa,(e=>o(50,Rt=e)));const ma=Ca();Un(e,ma,(e=>o(326,ct=e)));const ga=Ca(Je());Un(e,ga,(e=>o(76,ro=e)));const $a=Ca(0);Un(e,$a,(e=>o(367,_o=e)));const fa=Ca(Je());Un(e,fa,(e=>o(80,Qo=e)));const ya=Ca();Un(e,ya,(e=>o(411,Xe=e)));const ba=$h("(pointer: fine)",(e=>e?"pointer-fine":"pointer-coarse"));Un(e,ba,(e=>o(347,Jt=e)));const xa=$h("(hover: hover)",(e=>e?"pointer-hover":"pointer-no-hover"));Un(e,xa,(e=>o(346,Kt=e)));const va=Ca(!1),wa=Ca(!1);Un(e,wa,(e=>o(327,mt=e)));const Sa=ka(void 0,(e=>{const t=Wl(0),o=[wa.subscribe((e=>{t.set(e?1:0)})),t.subscribe(e)];return()=>o.forEach((e=>e()))}));Un(e,Sa,(e=>o(412,pt=e)));const Ta=Ca();Un(e,Ta,(e=>o(416,Gt=e)));const Pa=Ca();let Ra;Un(e,Pa,(e=>o(52,Lt=e))),Br("isAnimated",Pa);const Ia=Ca(zi);Un(e,Ia,(e=>o(350,to=e)));const Aa=Ca(!1);Un(e,Aa,(e=>o(423,Po=e))),Br("imageIsStatic",Aa);const Ea=Ca();Un(e,Ea,(e=>o(424,Ro=e)));const La=Ca();Un(e,La,(e=>o(421,Co=e)));const Fa=ka(void 0,(e=>{const t=Ca(void 0),o=[fr.subscribe((()=>{if(!So)return;if(Po)return t.set(Ke(So));const e=ed(So,Co,5*Ni);t.set(e)})),t.subscribe(e)];return()=>o.forEach((e=>e()))})),za=Ca();Un(e,za,(e=>o(420,wo=e)));const Da=Ca();Un(e,Da,(e=>o(422,To=e)));const Oa=Ca(void 0);Un(e,Oa,(e=>o(427,Fo=e)));const Ba=Ca(de());Un(e,Ba,(e=>o(428,Do=e)));const _a=(e,t)=>{if(!t||!e)return{top:0,right:0,bottom:0,left:0};const o=dn(t,e,s),i=cn(o,e);return{top:Math.abs(i.top),right:Math.abs(i.right),bottom:Math.abs(i.bottom),left:Math.abs(i.left)}},Wa=Ca({}),Va=Ma([ya,ga,fa,Wa],(([e,t,o,n],r)=>{if(!e)return r(void 0);let a=0;1!==M.length||i||"bottom"===un||(a=o.y+o.height),r(nt(e.x+t.x,e.y+t.y+a,e.width,e.height))}));let Na={left:0,right:0,top:0,bottom:0};const Ha=Ca(!1),ja=Ma([Ha,Vr,Va,wa],(([e,t,o,i],n)=>{if(!o)return n({left:0,right:0,top:0,bottom:0});if(!e)return;const r=Math.min(o.width,o.height),a=_a({width:r,height:r},t);se(Na.top,4)===se(a.top,4)&&se(Na.bottom,4)===se(a.bottom,4)&&se(Na.right,4)===se(a.right,4)&&se(Na.left,4)===se(a.left,4)||(Na=a,n(a))}));Un(e,ja,(e=>o(359,bo=e)));const Ua=Ma([Ha,ja],(([e,t],o)=>{if(!e)return o(!1);o(Object.values(t).some((e=>e>0)))}));Un(e,Ua,(e=>o(360,xo=e)));const Xa=Ma([Ha,ya,Ua,ja],(([e,t,o,i],n)=>{if(t)return e&&o?void n(nt(t.x+i.left,t.y+i.top,t.width-i.left-i.right,t.height-i.top-i.bottom)):n({...t})})),Ga=Ma([Va,Ua,ja],(([e,t,o],i)=>e?t?void i(nt(e.x+o.left,e.y+o.top,e.width-o.left-o.right,e.height-o.top-o.bottom)):i(e):i(void 0)));Un(e,Ga,(e=>o(325,lt=e)));const Ya=Ma([Aa,lr,Sr],(([e,t,o],i)=>{if(!e||!t)return i(void 0);const n=Qe(t);i(gt(n,o))})),qa=Ma([Ya],(([e],t)=>{if(!e)return t(void 0);const o=tt(e);t(kt(o))}));Un(e,qa,(e=>o(362,ko=e)));const Ja=Ma([Ga,fr,qa,Ia],(([e,t,o,i],n)=>{if(!e||!t||!(!Ro&&!Co))return;const{width:r,height:a}=o||t,s=Math.min(e.width/r,e.height/a);n(i?s:Math.min(1,s))}));Un(e,Ja,(e=>o(363,Ao=e)));Br("imageStaticVisualCorners",Ma([Aa,lr,Sr,Ga,ya,Ja],(([e,t,o,i,n,r],a)=>{if(!(e&&i&&n&&t))return a(void 0);const s=Qe(t),l=kt(st(s,r)),c=$t(i,l);l.x=c.x,l.y=c.y;a(gt(l,o))})));const Qa=Ca(void 0);Un(e,Qa,(e=>o(365,Oo=e)));const es=Ma([fr,Ga],(([e,t])=>{if(t&&e)return Math.min(t.width/e.width,t.height/e.height)})),ts=Ma([fr,za],(([e,t])=>e&&t?Math.min(e.width/t.width,e.height/t.height):1));Un(e,ts,(e=>o(95,gi=e)));const os=Ma([Qa,ts],(([e,t])=>e&&t?t*e:1));Un(e,os,(e=>o(426,Eo=e)));const is=Ca(de());Un(e,is,(e=>o(364,Lo=e)));const ns=Ca({scalar:Eo,translation:Lo}),rs=()=>{ns.set({scalar:void 0,translation:de()})},as=ka(void 0,(e=>{const t=Wl(void 0,{precision:1e-4}),o=1===Sd()?e=>wt(e,Math.round):Z,i=()=>{if(!wo)return;const e=mt||!Gt;if(Po){const o=Ke(wo);return at(o,Do),at(o,lt),t.set(o,{hard:e})}const i=ed(wo,Fo,ap*Ni);i.width<0&&(i.width=0,i.x=wo.x),i.height<0&&(i.height=0,i.y=wo.y),at(i,lt),at(i,Lo),st(i,Eo),!e&&o(i),t.set(i,{hard:e})},n=[Ga.subscribe(i),za.subscribe(i),os.subscribe(i),is.subscribe(i),Vr.subscribe(i),t.subscribe(e)];return()=>n.forEach((e=>e()))}));Un(e,as,(e=>o(57,yo=e)));const ss=Ca(1);Un(e,ss,(e=>o(419,vo=e)));const ls=()=>{if(!So||!lt)return;let e=dt(Ke(So),Ao||1);const t=$t(lt,dt(Ke(ko),Ao));at(e,t);const o=Xe.width/e.width,i=Xe.height/e.height,n=Math.min(1,o,i);ss.set(n),st(e,n),((e,t)=>{const[o,i,n,r]=xt(e);o<t.y&&(e.y=Math.max(t.y,e.y)),i>t.width&&(e.x=t.width-e.width),n>t.height&&(e.y=t.height-e.height),r<t.x&&(e.x=Math.max(t.x,e.x))})(e,{...Xe,x:0,y:0}),za.set(e)},cs=Ma([Ga,Ja,fr,lr],(([e,t,o,i],n)=>{e&&(o||i)&&n(ds(e,t||1,o||i))}));Un(e,cs,(e=>o(94,mi=e)));const ds=(e,t,o)=>o.width<=e.width&&o.height<=e.height?$t(e,dt(Ke(o),t)):bt(e,ht(o));let hs,ms;const gs=e=>{if(i&&hs&&ut(hs,e)&&ms===Ao)return;if(Po)return ls();hs=e,ms=Ao;const t=ds(e,Ao,So||qe);za.set(t)};let $s=!1;const fs=Ja.subscribe((e=>{!$s&&void 0!==e&&So&&(gs(lt),$s=!0)})),ys=Ga.subscribe((e=>{e&&void 0!==Ao&&So&&gs(e)})),bs=Aa.subscribe((e=>{!e&&lt&&gs(lt)}));let xs;const vs=Da.subscribe((e=>{if(!e)return xs=void 0,void Qn(Ea,Ro=void 0,Ro);xs=Io;const t=Ke(So);Ea.set(t)})),ws=za.subscribe((e=>{if(!e||!To)return;const t=(o=Ke(e),i=To,o.x-=i.x,o.y-=i.y,o.width-=i.width,o.height-=i.height,o);var o,i;((e,t)=>{e.x/=t,e.y/=t,e.width/=t,e.height/=t})(t,xs);const n=((e,t)=>(e.x+=t.x,e.y+=t.y,e.width+=t.width,e.height+=t.height,e))(Ke(Ro),t);fr.set(n)})),Ss=fr.subscribe((e=>{if(!e||!wo)return;if(Po)return void(To||ls());if(mt||To||Co)return;const t=ht(wo),o=ht(e);if(se(t,6)===se(o,6))return;const{width:i,height:n}=ko||So,r=Math.min(lt.width/i,lt.height/n),a=_e(e.width*r,e.height*r),s=.5*(wo.width-a.width),l=.5*(wo.height-a.height),c=nt(wo.x+s,wo.y+l,a.width,a.height);za.set(c)})),ks=Ma([Ja,fr,za,Aa],(([e,t,o,i],n)=>{if(!e||!t||!o)return;if(i)return n(vo);const r=o.width/t.width,a=o.height/t.height;n(Math.max(r,a)/e)})),Cs=Ma([Ja,ks],(([e,t],o)=>{if(!t)return;o(e*t)}));Un(e,Cs,(e=>o(425,Io=e)));let Ms={left:0,right:0,top:0,bottom:0};const Ts=Ma([Vr,za],(([e,t],o)=>{if(!t)return o(Ms);const i=_a(t,e);se(Ms.top,4)===se(i.top,4)&&se(Ms.bottom,4)===se(i.bottom,4)&&se(Ms.right,4)===se(i.right,4)&&se(Ms.left,4)===se(i.left,4)||(Ms=i,o(i))})),Ps=Ma([Ts],(([e],t)=>{t(Object.values(e).some((e=>e>0)))})),Rs=Wl(.075,{stiffness:.03,damping:.4,precision:.001}),Is=Ma([ua,ca,Rs,as,os,Vr,Ps,Ts,Ua],(([e,t,o,n,r,a,s,l,c],d)=>{if(!n||i)return d([]);let{x:u,y:h,width:p,height:m}=n;u+=.5,h+=.5,p-=.5,m-=.5;const g=[];if(a){if(s){let{left:e,right:o,top:i,bottom:n}=l;e*=r,o*=r,i*=r,n*=r;const a=Th(t)?[1,1,1,.125]:[0,0,0,.075];g.push({x:u-e-.5,y:h-i-.5,width:p+e+o+1,height:m+i+n+1,strokeWidth:1,strokeColor:a,opacity:c?1:.5})}const i=Th(e);a&&a.frameColor&&Th(a.frameColor)||i||(g.push({x:u-1,y:h-1,width:p+2,height:m+2,strokeWidth:2,strokeColor:[0,0,0,.1],opacity:o}),g.push({x:u+1,y:h+1,width:p-2,height:m-2,strokeWidth:2,strokeColor:[0,0,0,.1],opacity:o}))}d([...g,{x:u,y:h,width:p,height:m,strokeWidth:1,strokeColor:e,opacity:o}])})),As=Ca([]);Un(e,As,(e=>o(353,lo=e)));const Es=Ma([Is,As],(([e,t],o)=>{o([...e,...t])}));Un(e,Es,(e=>o(88,si=e)));const Ls=Wl(0,{precision:.001});Un(e,Ls,(e=>o(355,ho=e)));const Fs=Wl();Un(e,Fs,(e=>o(358,$o=e)));const zs=Wl();Un(e,zs,(e=>o(357,go=e)));const Ds=Wl();Un(e,Ds,(e=>o(356,mo=e)));const Os=Wl();Un(e,Os,(e=>o(354,co=e)));const Bs=Ca(!1);Un(e,Bs,(e=>o(339,Vt=e)));const _s=Ca();let Ws;Un(e,_s,(e=>o(342,Ut=e)));const Vs=Ma([Bs,_s],(([e,t],i)=>{if(!e||!t)return void i(void 0);if(Ws&&(Ws.cancel(),o(256,Ws=void 0)),mn(t))return i(w(t));const n=cl.length?0:Lt?250:0;o(256,Ws={cancel:a}),jr(t,Ws,n).then(i).catch((e=>{Qn(pr,jt.error=e,jt)})).finally((()=>{o(256,Ws=void 0)}))}));fi(),fi=Hn(Vs,(e=>o(328,vt=e)));const Ns=e=>{so&&vt&&(e&&vt.paused?vt.play().catch((()=>{})):e||vt.paused||vt.pause())};let{imagePreviewCurrent:Hs}=t;const js=Ca({});Un(e,js,(e=>o(344,Yt=e)));const Us=Ca([]);Un(e,Us,(e=>o(82,ti=e)));const Xs=Ma([Ga,ma,lr,Fa,za,Cs,Sr,Mr,Tr,os,is,va],(([e,t,o,i,n,r,a,s,l,c,d,u],h)=>{if(!e||!n)return;const p=Zs(e,t,o,i,n,c,d,r,a,s,l);!u&&S(p),h(p)}));Un(e,Xs,(e=>o(345,qt=e)));const Gs=Ma([Ir,Ar,Er,Lr,Fr],(([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&&Ln(a)})}));let Ys,Ks;const Js=(()=>{if(!uo())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})(),Qs=Ca({});Un(e,Qs,(e=>o(333,It=e)));const el=Sd(),tl=ka(el,(e=>{const t=()=>e(Sd()),o=matchMedia(`(resolution: ${el}dppx)`);return o.addListener(t),()=>o.removeListener(t)}));Un(e,tl,(e=>o(56,fo=e)));const ol=((e,t)=>{const{sub:o,pub:i}=No(),n=[],r=Ca(0),a=[],s=()=>a.forEach((e=>e({index:jn(r),length:n.length}))),l={get index(){return jn(r)},set index(e){e=Number.isInteger(e)?e:0,e=Za(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 a=e(),c=n[n.length-1];JSON.stringify(a)!==JSON.stringify(c)&&(n.length=l.index+1,n.push(a),r.set(n.length-1),s(),i("writehistory"))},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})((()=>io),(e=>{Qn(Hr,io=e,io),ga.set(ro)}));xi(),xi=Hn(ol,(e=>o(351,oo=e)));const il=()=>{const e={x:0,y:0,...qe},t=wt(bt(e,io.cropAspectRatio),Math.round),o=Xi({...io,rotation:0,crop:t},io),i=[o];JSON.stringify(o)!==JSON.stringify(io)&&i.push({...io}),ol.set(i)},nl=pr.subscribe((e=>{e&&e.complete&&il()})),rl=()=>Hi().then((e=>e&&ol.revert())),al=Ca(!1);Un(e,al,(e=>o(334,Et=e)));const sl=()=>{Qn(al,Et=!0,Et),ji().then((e=>{if(!e)return void Qn(al,Et=!1,Et);let t;t=Dl.subscribe((e=>{1===e&&(t&&t(),wi("processImage"))}))}))},ll=mr.subscribe((e=>{if(!e)return void Qn(al,Et=!1,Et);Qn(al,Et=!0,Et);const{complete:t,abort:o}=e;(t||o)&&Qn(al,Et=!1,Et)})),cl=Mh();Un(e,cl,(e=>o(54,Zt=e)));const dl=Ma([cl],(([e],t)=>{if(!e.length)return t();const{origin:o,translation:i,rotation:n,scale:r}=e[0];t({origin:o,translation:i,rotation:n,scale:r})})),ul=Ca();Un(e,ul,(e=>o(348,Qt=e)));let hl,pl=[];const ml=Ca(),gl=Ca(),$l=Ma([Qa,gl,Ja,es],(([e,t,o,i])=>e||(t||o<1?i:1))),fl={...Ti,imageFile:sr,imageSize:lr,mediaDuration:cr,mediaMinDuration:ur,mediaMaxDuration:hr,mediaTrim:dr,imageBackgroundColor:Pr,imageBackgroundImage:Rr,imageCropAspectRatio:gr,imageCropMinSize:yr,imageCropMaxSize:br,imageCropLimitToImage:$r,imageCropRect:fr,imageCropRectOrigin:vr,imageCropRectSnapshot:Ea,imageCropRectAspectRatio:wr,imageCropRange:xr,imageRotation:Sr,imageRotationRange:kr,imageFlipX:Mr,imageFlipY:Tr,imageOutputSize:Cr,imageColorMatrix:Ir,imageConvolutionMatrix:Ar,imageGamma:Er,imageVignette:Lr,imageNoise:Fr,imageDecoration:zr,imageAnnotation:_r,imageRedaction:Wr,imageFrame:Vr,imagePreview:Vs,imagePreviewSource:_s,imageTransforms:Xs,imagePreviewModifiers:js,history:ol,animation:Ta,pixelRatio:tl,elasticityMultiplier:Ni,scrollElasticity:lp,rangeInputElasticity:5,redrawTrigger:qn,pointerAccuracy:ba,pointerHoverable:xa,env:Qs,rootRect:ma,stageRect:Ga,stageRectBase:Va,stageRecenter:Wa,stageScalar:Ja,stagePadding:ja,stagePadded:Ua,presentationScalar:Cs,imagePreviewUpscale:gl,utilRect:ya,utilRectPadded:Xa,allowPan:ta,allowZoom:oa,allowZoomControls:ia,enableZoomInput:ra,enablePanInput:na,enablePanInputStatus:la,imageSelectionMultiTouching:ml,rootBackgroundColor:ca,rootForegroundColor:da,rootLineColor:ua,rootColorSecondary:ha,imageOutlineOpacity:Rs,utilTools:ul,imageSelectionPan:is,imageSelectionZoom:Qa,imageSelectionZoomCurrent:$l,imageSelectionStageFitScalar:es,imageSelectionStoredState:ns,muteAudioStore:Yn,imageOverlayMarkup:As,interfaceImages:Us,isInteracting:wa,isTransformingImage:va,isInteractingFraction:Sa,imageCropRectIntent:La,imageCropRectPresentation:Fa,imageSelectionRect:za,imageSelectionRectIntent:Oa,imageSelectionRectPresentation:as,imageSelectionRectSnapshot:Da,imageScalar:ks,imageTransformsInterpolated:dl,imageEffects:Gs};delete fl.image;const yl="util-"+L();let bl=[];const xl=e=>T.find((([t])=>e===t));let Sl=[],kl=uo();const Cl=(e,t,o)=>{let i=ae.getPropertyValue(e);i=o?o(i):/^[0-9]+$/.test(i)?parseFloat(i):void 0,t.set(i,{hard:!Lt})},Ml=(e,t,o=!1)=>{const i=(e=>{const t=ae.getPropertyValue(e);return xh(t)})(e);i&&0!==i[3]&&(o||(i.length=3),t.set(i,{hard:!Lt}))},Tl=Ca();Un(e,Tl,(e=>o(83,oi=e)));const Pl=Ca();Un(e,Pl,(e=>o(84,ii=e)));const Rl=Ca();Un(e,Rl,(e=>o(85,ni=e)));const Il=Wl(0,{damping:.9});Un(e,Il,(e=>o(86,ri=e)));const Al=()=>{Ml("color",da),Ml(Pn?"--color-background":"background-color",ca),Ml("outline-color",ua),Ml("--color-secondary",ha),Ml("--grid-color-even",Pl,!0),Ml("--grid-color-odd",Rl,!0),Cl("--grid-size",Tl),Cl("--editor-inset-top",$a,(e=>parseInt(e,10)))},El=Ma([Xs,Gs,Pr,Jr],(([e,t,o,i])=>e&&{...e,...t,backgroundColor:o,backgroundImage:i}));Un(e,El,(e=>o(343,Xt=e)));const Ll=()=>{const e=cl.length?void 0:{resize:1.05},t=((e,t,o={})=>{const{resize:i=1,opacity:n=0}=o,r={opacity:[Wl(n,{...kh,stiffness:.1}),Z],resize:[Wl(i,{...kh,stiffness:.1}),Z],translation:[Wl(void 0,kh),Z],rotation:[Wl(void 0,Ch),Z],origin:[Wl(void 0,kh),Z],scale:[Wl(void 0,Ch),Z],gamma:[Wl(void 0,Ch),e=>e||1],vignette:[Wl(void 0,Ch),e=>e||0],colorMatrix:[Wl([...Sh],kh),e=>e||[...Sh]],convolutionMatrix:[Ca(void 0),e=>e&&e.clarity||void 0],backgroundColor:[Wl(void 0,kh),(e,t,o)=>{if(Array.isArray(e)){if(Array.isArray(t)){const i=[...e];0===t[3]?(i[3]=0,o(i)):0===i[3]&&((e=[...t])[3]=0)}return e}}],backgroundImage:[Ca(void 0),Z]},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,o)=>i.set(n(e,c[t],(e=>{i.set(e,{hard:!0})})),o),e}),{});let c;const d=Ma(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})(vt,qe,e);cl.unshift(t),Fl(Xt)},Fl=e=>{cl.forEach(((t,o)=>{const i=0===o?1:0;t.set({...e,opacity:i,resize:1},Gt)}))};let zl;const Dl=Bl(void 0,{duration:500});let Ol;Un(e,Dl,(e=>o(53,_t=e)));const _l=Ca(!1);let Nl;Un(e,_l,(e=>o(338,Wt=e)));const Hl=Wl(void 0,{stiffness:.1,damping:.7,precision:.25});Un(e,Hl,(e=>o(78,Ko=e)));const jl=Wl(0,{stiffness:.1,precision:.05});Un(e,jl,(e=>o(79,Jo=e)));const Ul=Wl(0,{stiffness:.02,damping:.5,precision:.25});Un(e,Ul,(e=>o(336,Ot=e)));const Zl=Wl(void 0,{stiffness:.02,damping:.5,precision:.25});Un(e,Zl,(e=>o(337,Bt=e)));const Xl=Wl(void 0,{stiffness:.02,damping:.5,precision:.25});let Gl;Un(e,Xl,(e=>o(335,Dt=e)));const Yl=()=>{wi("abortLoadImage")},ql=()=>{wi("abortProcessImage"),Qn(al,Et=!1,Et)},Kl=e=>e.preventDefault(),Jl=Js?e=>{const t=e.touches?e.touches[0]:e;t.pageX>20&&t.pageX<window.innerWidth-20||Kl(e)}:a,Ql=Ca([]);Un(e,Ql,(e=>o(415,Pt=e))),Br("keysPressed",Ql);const ec=e=>{!e||zo(e)&&!(e=>/^image/.test(e.type)&&!/svg/.test(e.type))(e)||!zo(e)&&!/^http/.test(e)||wi("loadImage",e)},tc=e=>{e&&ec(e)};let oc=void 0;let ic,nc=[];const rc=Ca();Br("rootPortal",rc),Br("rootRect",ma);const ac=()=>({foregroundColor:[...yt],lineColor:[...ft],utilVisibility:{...E},isInteracting:mt,isInteractingFraction:pt,rootRect:Ke(ct),stageRect:Ke(lt),annotationShapesDirty:vc,decorationShapesDirty:Sc,frameShapesDirty:kc,blendShapesDirty:Cc}),lc=(e,t,o)=>nn(e,_e(t.width/o,t.height/o)),cc=(e,t,o)=>{var i;return e._translate=ue((i=t).x,i.y),e._scale=o,e},dc=e=>{const t=[];return e.forEach((e=>t.push(uc(e)))),t.filter(Boolean)},uc=e=>Si(e)?(e.points=[ue(e.x1,e.y1),ue(e.x2,e.y2)],e):(!(e=>yi(e)&&!e.text.length)(e)||e.backgroundColor&&0!==e.backgroundColor[3]||(bi(e)&&(e.width=5,e.height=e.lineHeight),e.strokeWidth=1,e.strokeColor=[1,1,1,.5],e.backgroundColor=[0,0,0,.1]),e);let pc,mc=[],gc=[],$c=[],fc=[],yc=[],bc={};const xc=(e,t,o,i,n,r)=>{const{annotationShapesDirty:a,decorationShapesDirty:l,frameShapesDirty:c,blendShapesDirty:d,selectionRect:u,scale:h}=e,p=pc!==h,m=p||!ut(bc,u);m&&(pc=h,bc=u),(a||o!==rt)&&(mc=o.filter(Mi).map(ui).sort(((e,t)=>e.alwaysOnTop?1:t.alwaysOnTop?-1:0)).map((e=>nn(e,qe)))),(p||wc||a||o!==rt)&&(gc=dc(mc.map((e=>s(e,{flipX:ot,flipY:et,rotation:it,scale:h,context:Qe(qe)}))).flat())),d&&($c=t.filter(Mi).map((e=>nn(e,qe)))),(l||i!==Ye||m)&&(fc=dc(i.filter(Mi).map(ui).sort(((e,t)=>e.alwaysOnTop?1:t.alwaysOnTop?-1:0)).map((e=>lc(e,u,h))).map((e=>s(e,{context:u}))).flat().map((e=>cc(e,u,h))))),(c||r!==Ge||m)&&(yc=r?dc([r].map(ui).map((e=>lc(e,u,h))).map(s).flat().map((e=>cc(e,u,h)))):[]);let g=dc(n.filter(Mi));return"undefined"!=typeof window&&(e=>{if(e&&e._uahonds)return;const[t]=[[85,110,108,105,99,101,110,115,101,100,32,80,105,110,116,117,114,97,32,105,110,115,116,97,110,99,101]].map((e=>e.map((e=>String.fromCharCode(e))).join("")));g=[...g,{x:u.x+.5*u.width-82,y:u.y+u.height-16-12,width:164,height:16,text:t,fontWeight:900,fontSize:12,color:[1,1,1,.25]}]})(window),{blendShapesDirty:d,blendShapes:$c,annotationShapesDirty:a,annotationShapes:gc,decorationShapesDirty:l,decorationShapes:fc,frameShapesDirty:c,frameShapes:yc,interfaceShapes:g}};let vc=!0;let wc=!0;let Sc=!0;let kc=!0;let Cc=!0;Dr((()=>{Ns(!1),Qr(),ys(),fs(),bs(),vs(),ws(),Ss(),nl(),ll(),ba.destroy(),xa.destroy(),ar.destroy(),cl.clear(),mc.length=0,gc.length=0,$c.length=0,fc.length=0,yc.length=0;try{o(214,Hs=void 0),o(257,zl=void 0)}catch(e){}}));return e.$$set=e=>{"class"in e&&o(215,ki=e.class),"layout"in e&&o(216,Ci=e.layout),"stores"in e&&o(217,Ti=e.stores),"locale"in e&&o(3,Pi=e.locale),"id"in e&&o(4,Ri=e.id),"util"in e&&o(218,Ii=e.util),"utils"in e&&o(219,Ai=e.utils),"animations"in e&&o(220,Ei=e.animations),"disabled"in e&&o(221,Li=e.disabled),"status"in e&&o(213,Fi=e.status),"previewUpscale"in e&&o(222,zi=e.previewUpscale),"previewPad"in e&&o(223,Di=e.previewPad),"previewMaskOpacity"in e&&o(5,Oi=e.previewMaskOpacity),"previewImageDataMaxSize"in e&&o(224,Bi=e.previewImageDataMaxSize),"previewImageTextPixelRatio"in e&&o(6,_i=e.previewImageTextPixelRatio),"markupMaskOpacity"in e&&o(7,Wi=e.markupMaskOpacity),"zoomMaskOpacity"in e&&o(225,Vi=e.zoomMaskOpacity),"elasticityMultiplier"in e&&o(8,Ni=e.elasticityMultiplier),"willRevert"in e&&o(226,Hi=e.willRevert),"willProcessImage"in e&&o(227,ji=e.willProcessImage),"willRenderCanvas"in e&&o(9,Ui=e.willRenderCanvas),"willRenderToolbar"in e&&o(228,Zi=e.willRenderToolbar),"willSetHistoryInitialState"in e&&o(229,Xi=e.willSetHistoryInitialState),"enableButtonExport"in e&&o(230,Gi=e.enableButtonExport),"enableButtonRevert"in e&&o(231,Yi=e.enableButtonRevert),"enableNavigateHistory"in e&&o(232,qi=e.enableNavigateHistory),"enableToolbar"in e&&o(10,Ki=e.enableToolbar),"enableUtils"in e&&o(233,Ji=e.enableUtils),"enableButtonClose"in e&&o(234,Qi=e.enableButtonClose),"enableDropImage"in e&&o(235,en=e.enableDropImage),"enablePasteImage"in e&&o(236,tn=e.enablePasteImage),"enableBrowseImage"in e&&o(237,on=e.enableBrowseImage),"enableTransparencyGrid"in e&&o(11,rn=e.enableTransparencyGrid),"layoutDirectionPreference"in e&&o(238,an=e.layoutDirectionPreference),"layoutHorizontalUtilsPreference"in e&&o(239,sn=e.layoutHorizontalUtilsPreference),"layoutVerticalUtilsPreference"in e&&o(240,ln=e.layoutVerticalUtilsPreference),"layoutVerticalToolbarPreference"in e&&o(241,un=e.layoutVerticalToolbarPreference),"layoutVerticalControlGroupsPreference"in e&&o(242,hn=e.layoutVerticalControlGroupsPreference),"layoutVerticalControlTabsPreference"in e&&o(243,pn=e.layoutVerticalControlTabsPreference),"markupEditorZoomLevel"in e&&o(244,gn=e.markupEditorZoomLevel),"markupEditorZoomLevels"in e&&o(12,$n=e.markupEditorZoomLevels),"markupEditorZoomAdjustStep"in e&&o(13,fn=e.markupEditorZoomAdjustStep),"markupEditorZoomAdjustFactor"in e&&o(14,yn=e.markupEditorZoomAdjustFactor),"markupEditorZoomAdjustWheelFactor"in e&&o(15,bn=e.markupEditorZoomAdjustWheelFactor),"markupEditorInteractionMode"in e&&o(245,xn=e.markupEditorInteractionMode),"muteAudio"in e&&o(246,vn=e.muteAudio),"willSetMediaInitialTimeOffset"in e&&o(247,wn=e.willSetMediaInitialTimeOffset),"enablePan"in e&&o(16,Sn=e.enablePan),"enableZoom"in e&&o(17,kn=e.enableZoom),"enableZoomControls"in e&&o(248,Cn=e.enableZoomControls),"enableZoomInput"in e&&o(18,Mn=e.enableZoomInput),"enablePanInput"in e&&o(249,Tn=e.enablePanInput),"enableCanvasAlpha"in e&&o(19,Pn=e.enableCanvasAlpha),"enablePanLimit"in e&&o(20,Rn=e.enablePanLimit),"panLimitGutterScalar"in e&&o(21,In=e.panLimitGutterScalar),"zoomPresetOptions"in e&&o(22,An=e.zoomPresetOptions),"zoomAdjustStep"in e&&o(23,En=e.zoomAdjustStep),"zoomAdjustFactor"in e&&o(24,Dn=e.zoomAdjustFactor),"zoomAdjustWheelFactor"in e&&o(25,On=e.zoomAdjustWheelFactor),"zoomLevel"in e&&o(0,Bn=e.zoomLevel),"imagePreviewSrc"in e&&o(250,_n=e.imagePreviewSrc),"imageOrienter"in e&&o(251,Wn=e.imageOrienter),"pluginComponents"in e&&o(252,Vn=e.pluginComponents),"pluginOptions"in e&&o(26,Nn=e.pluginOptions),"root"in e&&o(2,Gn=e.root),"imageSourceToImageData"in e&&o(27,rr=e.imageSourceToImageData),"imagePreviewCurrent"in e&&o(214,Hs=e.imagePreviewCurrent)},e.$$.update=()=>{if(1&e.$$.dirty[0]|134217728&e.$$.dirty[7]&&o(0,Bn=null===Bn?gn:Bn),536870912&e.$$.dirty[7]&&Yn.set(vn),256&e.$$.dirty[0]&&Qn(Kn,qo=Ni,qo),1073741824&e.$$.dirty[6]&&o(317,i="overlay"===Ci),65536&e.$$.dirty[7]|128&e.$$.dirty[10]&&o(44,n=Ji&&!i),67108866&e.$$.dirty[0]&&Nn&&Object.entries(Nn).forEach((([e,t])=>{Object.entries(t).forEach((([t,i])=>{Xn[e]&&o(1,Xn[e][t]=i,Xn)}))})),2&e.$$.dirty[0]|16&e.$$.dirty[8]){let e=!1;Vn.forEach((([t])=>{Xn[t]||(o(1,Xn[t]={},Xn),e=!0)})),e&&o(254,Jn=[...Vn])}var t,m,v,w;if(16&e.$$.dirty[7]&&er.set(Li?1:0),128&e.$$.dirty[7]&&(r=Bi?(t=Bi,m=or,_e(Math.min(t.width,m.width),Math.min(t.height,m.height))):or),536870912&e.$$.dirty[11]&&ar.update(Xo[0]),268435456&e.$$.dirty[11]&&(s=Zo?(e,t)=>Zo(e,{flipX:void 0,flipY:void 0,rotation:void 0,...t,isPreview:!0}):Z),1&e.$$.dirty[8]|134217728&e.$$.dirty[11]&&aa.set(Uo&&Cn),268435456&e.$$.dirty[7]|2&e.$$.dirty[8]&&sa.set("pan"===xn||Tn),524288&e.$$.dirty[1]&&Rt&&ma.set(nt(Rt.x,Rt.y,Rt.width,Rt.height)),65664&e.$$.dirty[10]|1&e.$$.dirty[11]&&ct&&i&&jt&&jt.complete&&(()=>{const e=Wo,t=ht(ct);e&&e===t||(gr.set(ht(ct)),il())})(),8&e.$$.dirty[0]|4&e.$$.dirty[7]|64&e.$$.dirty[8]&&o(307,M=Pi&&Jn.length?Ai||Jn.map((([e])=>e)):[]),268435456&e.$$.dirty[9]&&o(45,O=M.length>1),16384&e.$$.dirty[1]&&(O||ga.set(Je())),1024&e.$$.dirty[0]|67108864&e.$$.dirty[11]&&(Ki||fa.set(nt(0,_o,0,0))),131584&e.$$.dirty[10]&&o(320,c=!mt&&l),33554432&e.$$.dirty[11]&&o(318,d=!Bo),524288&e.$$.dirty[1]&&o(264,Ve=Rt&&Rt.width>0&&Rt.height>0),67108864&e.$$.dirty[0]|64&e.$$.dirty[8]|268435456&e.$$.dirty[9]|256&e.$$.dirty[11]&&o(308,T=((e,t,o,i)=>{const n=t.filter((([t])=>e.includes(t))).filter((([e,{isSupported:t}])=>t({...i,...o[e]}))).map((([e,t])=>[e,t.Component]));return Ka(n,bl,((e,t)=>e[0]===t[0]&&e[1]===t[1]))?bl:(bl=n,n)})(M,Jn,Nn,{src:eo})),536870912&e.$$.dirty[9]&&o(263,R=T.length),8&e.$$.dirty[0]|98304&e.$$.dirty[8]&&o(40,Ne=Ve&&Pi&&!!R),512&e.$$.dirty[1]&&setTimeout((()=>o(255,Ra=Ne)),1),8&e.$$.dirty[7]|128&e.$$.dirty[8]|1280&e.$$.dirty[10]&&Qn(Ta,Gt="always"===Ei?c:"never"!==Ei&&(c&&Ra&&d),Gt),8&e.$$.dirty[7]|768&e.$$.dirty[10]&&Qn(Pa,Lt="always"===Ei?l:"never"!==Ei&&(l&&d),Lt),32&e.$$.dirty[7]|128&e.$$.dirty[10]&&Ia.set(zi||i),64&e.$$.dirty[7]&&Ha.set(Di),4&e.$$.dirty[0]|20971520&e.$$.dirty[11]&&Gn&&(Gn.dispatchEvent(ph("markupzoom",Oo)),Gn.dispatchEvent(ph("zoom",Mo(Oo)?Oo:Ao))),4&e.$$.dirty[0]|8388608&e.$$.dirty[11]&&Gn&&(Gn.dispatchEvent(ph("markuppan",Lo)),Gn.dispatchEvent(ph("pan",Lo))),1048576&e.$$.dirty[11]&&So&&rs(),2097152&e.$$.dirty[11]&&ko&&ls(),2&e.$$.dirty[7]|32768&e.$$.dirty[8]&&o(43,A=R&&Ii&&"string"==typeof Ii&&xl(Ii)?Ii:R>0?T[0][0]:void 0),2101248&e.$$.dirty[1]&&A&&Rs.set(.075,{hard:!Lt}),256&e.$$.dirty[7]&&o(315,u=Vi),786432&e.$$.dirty[11]&&o(316,h=xo?-Math.max(...Object.values(bo)):0),69206016&e.$$.dirty[1]|32864&e.$$.dirty[10]&&yo){let e=yo.x-lt.x,t=lt.x+lt.width-(yo.x+yo.width),o=yo.y-lt.y,i=lt.y+lt.height-(yo.y+yo.height),n=Math.min(e,o,t,i);Ls.set(n>h?0:Math.min(u,Math.abs(n/64)),{hard:!Lt})}if(33554432&e.$$.dirty[1]&&o(314,p=.55/fo),2097152&e.$$.dirty[1]|32784&e.$$.dirty[10]&&lt&&Fs.set({x:0,y:lt.y,width:lt.x<64?0:lt.x,height:lt.height+p},{hard:!Lt}),2097152&e.$$.dirty[1]|98320&e.$$.dirty[10]&&lt&&zs.set({x:0,y:0,width:ct.width,height:lt.y+p},{hard:!Lt}),2097152&e.$$.dirty[1]|98320&e.$$.dirty[10]&&lt){let e=lt.x+lt.width,t=ct.width-(lt.x+lt.width);t<64&&(e+=t,t=0),Ds.set({x:e,y:lt.y,width:t,height:lt.height+p},{hard:!Lt})}if(2097152&e.$$.dirty[1]|98304&e.$$.dirty[10]&&lt&&Os.set({x:0,y:lt.y+lt.height,width:ct.width,height:ct.height-(lt.y+lt.height)},{hard:!Lt}),16777216&e.$$.dirty[1]|147456&e.$$.dirty[11]&&o(310,g=$o&&{id:sp,backgroundColor:po,opacity:ho,...$o}),16777216&e.$$.dirty[1]|81920&e.$$.dirty[11]&&o(313,$=go&&{id:sp,backgroundColor:po,opacity:ho,...go}),16777216&e.$$.dirty[1]|49152&e.$$.dirty[11]&&o(312,y=mo&&{id:sp,backgroundColor:po,opacity:ho,...mo}),16777216&e.$$.dirty[1]|24576&e.$$.dirty[11]&&o(311,b=co&&{id:sp,backgroundColor:po,opacity:ho,...co}),15&e.$$.dirty[10]&&o(309,x=[$,y,b,g].filter(Boolean)),1073741824&e.$$.dirty[9]|4096&e.$$.dirty[11]&&x&&lo){const e=lo.filter((e=>e.id!==sp));As.set([...e,...x])}if(4&e.$$.dirty[8]|256&e.$$.dirty[11]&&_s.set(_n||(eo||void 0)),262144&e.$$.dirty[10]|2048&e.$$.dirty[11]&&vt&&(e=>{if(!so||!vt)return;vt.muted=e})(ao),4&e.$$.dirty[0]|268435456&e.$$.dirty[6]|262144&e.$$.dirty[10]&&(o(214,Hs=vt),vt&&Gn.dispatchEvent(ph("loadpreview",Hs))),2&e.$$.dirty[11]&&Ut&&(is.set(de()),Qa.set(void 0),rs(),Us.set([])),1024&e.$$.dirty[11]&&o(268,k=oo.index>0),1024&e.$$.dirty[11]&&o(267,C=oo.index<oo.length-1),4&e.$$.dirty[1]&&ml.set(hl),512&e.$$.dirty[11]&&gl.set(to),8&e.$$.dirty[0]|32768&e.$$.dirty[8]|268435456&e.$$.dirty[9]&&o(46,I=R&&M.map((e=>{const t=xl(e);if(t)return{id:e,view:t[1],tabIcon:Pi[e+"Icon"],tabLabel:Pi[e+"Label"]}})).filter(Boolean)||[]),4096&e.$$.dirty[1]&&ea.set(A),32832&e.$$.dirty[1]&&o(37,E=I.reduce(((e,t)=>(e[t.id]=E&&E[t.id]||0,e)),{})),4096&e.$$.dirty[1]&&o(75,F={name:yl,selected:A}),32768&e.$$.dirty[1]&&o(74,z=I.map((e=>({id:e.id,icon:e.tabIcon,label:e.tabLabel})))),32768&e.$$.dirty[1]&&o(73,D=I.map((e=>e.id))),536870912&e.$$.dirty[6]&&o(72,B=hc(["PinturaRoot","PinturaRootComponent",ki])),65536&e.$$.dirty[10]&&o(303,_=ct&&(ct.width>1e3?"wide":ct.width<600?"narrow":void 0)),65536&e.$$.dirty[10]&&o(290,W=ct&&(ct.width<=320||ct.height<=460)),65536&e.$$.dirty[10]&&o(302,V=ct&&(ct.height>1e3?"tall":ct.height<600?"short":void 0)),4&e.$$.dirty[0]&&o(270,N=Gn&&Gn.parentNode&&Gn.parentNode.classList.contains("PinturaModal")),1073741824&e.$$.dirty[0]|4194304&e.$$.dirty[8]|65536&e.$$.dirty[10]&&o(295,H=N&&ct&&Ys>ct.width),1&e.$$.dirty[1]|4194304&e.$$.dirty[8]|65536&e.$$.dirty[10]&&o(294,j=N&&ct&&Ks>ct.height),98304&e.$$.dirty[9]&&o(296,U=H&&j),524288&e.$$.dirty[0]&&o(293,X=Pn),16777216&e.$$.dirty[9]&&o(265,G="narrow"===_),2097152&e.$$.dirty[7]|65536&e.$$.dirty[10]&&o(304,(v=ct,w=an,Y=ct?"auto"===w?v.width>v.height?"landscape":"portrait":"horizontal"===w?v.width<500?"portrait":"landscape":"vertical"===w?v.height<400?"landscape":"portrait":void 0:"landscape")),33554432&e.$$.dirty[9]&&o(71,q="landscape"===Y),131072&e.$$.dirty[8]|8388608&e.$$.dirty[9]&&o(292,K=G||"short"===V),1073741824&e.$$.dirty[0]|65536&e.$$.dirty[10]&&o(291,J=kl&&ct&&Ys===ct.width&&!Js),2&e.$$.dirty[1]|128&e.$$.dirty[11]&&o(266,Q=[...Qt||[],...pl].filter(Boolean)),4194304&e.$$.dirty[7]&&o(301,ee="has-navigation-preference-"+sn),8388608&e.$$.dirty[7]&&o(300,te="has-navigation-preference-"+ln),16777216&e.$$.dirty[7]&&o(297,oe="has-toolbar-preference-"+un),33554432&e.$$.dirty[7]&&o(299,ie="has-controlgroups-preference-"+hn),67108864&e.$$.dirty[7]&&o(298,ne="has-controltabs-preference-"+pn),65536&e.$$.dirty[10]&&o(306,re=void 0!==ct&&ct.width>0&&ct.height>0),4&e.$$.dirty[0]|134217728&e.$$.dirty[9]&&o(305,ae=re&&Gn&&getComputedStyle(Gn)),67108864&e.$$.dirty[9]&&ae&&Al(),1024&e.$$.dirty[0]|2121728&e.$$.dirty[1]|1073741824&e.$$.dirty[6]|16&e.$$.dirty[7]|4194304&e.$$.dirty[8]|67106816&e.$$.dirty[9]|8388608&e.$$.dirty[10]|96&e.$$.dirty[11]&&Qs.set({...It,layoutMode:Ci,orientation:Y,horizontalSpace:_,verticalSpace:V,navigationHorizontalPreference:ee,navigationVerticalPreference:te,controlGroupsVerticalPreference:ie,controlTabsVerticalpreference:ne,toolbarVerticalPreference:oe,isModal:N,isDisabled:Li,isCentered:U,isCenteredHorizontally:H,isCenteredVertically:j,isAnimated:Lt,isTransparent:X,pointerAccuracy:Jt,pointerHoverable:Kt,isCompact:K,hasSwipeNavigation:J,hasLimitedSpace:W,hasToolbar:Ki,hasNavigation:O&&n,isIOS:kl,browserVersion:wl()?"chrome-"+(navigator.userAgent.match(/Chrome\/([0-9]+)/)||[])[1]:void 0}),8388608&e.$$.dirty[10]&&o(70,le=Object.entries(It).map((([e,t])=>/^is|has/.test(e)?t?gh(e):void 0:t)).filter(Boolean).join(" ")),4096&e.$$.dirty[1]&&A&&ul.set([]),24&e.$$.dirty[11]&&o(69,ce=qt&&Object.entries(Yt).filter((([,e])=>null!=e)).reduce(((e,[,t])=>e={...e,...t}),{})),1&e.$$.dirty[11]&&o(287,ge=jt&&"any-to-file"===jt.task),256&e.$$.dirty[9]&&ge&&cl&&cl.clear(),4&e.$$.dirty[11]&&o(289,he=!!Xt&&!!Xt.translation),512&e.$$.dirty[8]|1024&e.$$.dirty[9]|262144&e.$$.dirty[10]&&he&&vt&&vt!==zl&&(o(257,zl=vt),Ll()),1024&e.$$.dirty[9]|4&e.$$.dirty[11]&&he&&Fl(Xt),8388608&e.$$.dirty[1]&&Zt&&Zt.length>1){let e=[];cl.forEach(((t,o)=>{0!==o&&t.get().opacity<=0&&e.push(t)})),e.forEach((e=>cl.remove(e)))}if(8&e.$$.dirty[0]|512&e.$$.dirty[9]&&o(39,me=Pi&&pe.length&&Pi.labelSupportError(pe)),1&e.$$.dirty[11]&&o(279,$e=jt&&!!jt.error),1&e.$$.dirty[11]&&o(42,fe=!jt||!jt.complete&&void 0===jt.task),1&e.$$.dirty[11]&&o(280,ye=jt&&(jt.taskLengthComputable?jt.taskProgress:1/0)),256&e.$$.dirty[9]&&ge&&Qn(Bs,Vt=!1,Vt),2097152&e.$$.dirty[1]|1024&e.$$.dirty[8]|1&e.$$.dirty[11]&&jt&&jt.complete){const e=Lt?250:0;clearTimeout(Ol),o(258,Ol=setTimeout((()=>{Qn(Bs,Vt=!0,Vt)}),e))}if(2048&e.$$.dirty[1]|1&e.$$.dirty[9]|536870912&e.$$.dirty[10]|1&e.$$.dirty[11]&&o(284,be=jt&&!$e&&!fe&&!Vt),256&e.$$.dirty[8]|262144&e.$$.dirty[10]|2&e.$$.dirty[11]&&o(283,ve=!(!Ut||vt&&!Ws)),2097152&e.$$.dirty[1]|536870912&e.$$.dirty[10])if(Vt){setTimeout((()=>Il.set(1)),Lt?500:0)}else Il.set(0);if(1090519040&e.$$.dirty[10]&&o(278,we=!!(Et||Nt&&void 0!==Nt.progress&&!Nt.complete)),1073741824&e.$$.dirty[8]&&we&&Ns(!1),2048&e.$$.dirty[1]|1&e.$$.dirty[11]&&o(281,Se=jt&&!(jt.error||fe)),8&e.$$.dirty[0]|1&e.$$.dirty[11]&&o(282,ke=Pi&&(jt?!jt.complete||jt.error?qs(Pi.statusLabelLoadImage(jt),jt.error&&jt.error.metadata,"{","}"):Pi.statusLabelLoadImage({progress:1/0,task:"blob-to-bitmap"}):Pi.statusLabelLoadImage(jt))),8&e.$$.dirty[0]|1073741824&e.$$.dirty[10]&&o(277,Ce=Nt&&Pi&&Pi.statusLabelProcessImage(Nt)),1073741824&e.$$.dirty[10]&&o(275,Me=Nt&&(Nt.taskLengthComputable?Nt.taskProgress:1/0)),1073741824&e.$$.dirty[10]&&o(276,Te=Nt&&!Nt.error),1073741824&e.$$.dirty[10]&&o(274,Pe=!(!Nt||!Nt.error)),8&e.$$.dirty[0]|2048&e.$$.dirty[1]|134217728&e.$$.dirty[6]|2080374784&e.$$.dirty[8]|63&e.$$.dirty[9])if(Fi){let e,t,i,n,r;P(Fi)&&(e=Fi),Mo(Fi)?t=Fi:Array.isArray(Fi)&&([e,t,r]=Fi,!1===t&&(n=!0),Mo(t)&&(i=!0)),o(34,Nl=(e||t)&&{text:e,aside:n||i,progressIndicator:{visible:i,progress:t},closeButton:n&&{label:Pi.statusLabelButtonClose,icon:Pi.statusIconButtonClose,onclick:r||(()=>o(213,Fi=void 0))}})}else o(34,Nl=Pi&&fe||$e||be||ve?{text:ke,aside:$e||Se,progressIndicator:{visible:Se,progress:ye},closeButton:$e&&{label:Pi.statusLabelButtonClose,icon:Pi.statusIconButtonClose,onclick:Yl}}:Pi&&we&&Ce?{text:Ce,aside:Pe||Te,progressIndicator:{visible:Te,progress:Me},closeButton:Pe&&{label:Pi.statusLabelButtonClose,icon:Pi.statusIconButtonClose,onclick:ql}}:void 0);if(134217728&e.$$.dirty[6]&&o(286,Re=void 0!==Fi),2097152&e.$$.dirty[1]|4194304&e.$$.dirty[8]|1073741824&e.$$.dirty[10]&&N&&Nt&&Nt.complete&&(_l.set(!0),setTimeout((()=>_l.set(!1)),Lt?100:0)),4&e.$$.dirty[0]|4096&e.$$.dirty[1]|536870912&e.$$.dirty[10]&&Vt&&Gn&&Gn.dispatchEvent(ph("selectutil",A)),2304&e.$$.dirty[1]|1073741824&e.$$.dirty[8]|177&e.$$.dirty[9]|268435456&e.$$.dirty[10]&&o(285,Ie=Wt||me||fe||$e||be||ve||we||Re),64&e.$$.dirty[9]&&Qn(Dl,_t=Ie?1:0,_t),2097152&e.$$.dirty[1]|64&e.$$.dirty[9]&&Dl.set(Ie?1:0,{duration:Lt?500:1}),4194304&e.$$.dirty[1]&&o(41,Ae=_t>0),8&e.$$.dirty[1]&&o(273,Ee=!(!Nl||!Nl.aside)),2098184&e.$$.dirty[1]|33556480&e.$$.dirty[8]|134217728&e.$$.dirty[10]&&Ae&&Nl){clearTimeout(Gl);const e={hard:!1===Lt};if(Ee){const t=!!Nl.error||!Lt;jl.set(1,e),Hl.set(Bt,{hard:t}),o(259,Gl=setTimeout((()=>{Ul.set(16,e)}),1))}else jl.set(0,e),o(259,Gl=setTimeout((()=>{Ul.set(0,e)}),1))}if(1024&e.$$.dirty[1]&&(Ae||(Xl.set(void 0,{hard:!0}),Hl.set(void 0,{hard:!0}),Ul.set(0,{hard:!0}))),67108864&e.$$.dirty[10]&&o(272,Le=.5*Ot),16777216&e.$$.dirty[8]|33554432&e.$$.dirty[10]&&o(68,Fe=`transform: translateX(${Dt-Le}px)`),256&e.$$.dirty[1]|262144&e.$$.dirty[10]&&o(38,Ze=vt&&!me),128&e.$$.dirty[1]|12582912&e.$$.dirty[8]&&o(269,De=ze&&(Ze||N)?Kl:a),2097152&e.$$.dirty[8]&&o(67,Oe=De),2097152&e.$$.dirty[8]&&o(66,Be=De),8&e.$$.dirty[0]|1048576&e.$$.dirty[1]|190464&e.$$.dirty[7]|1966080&e.$$.dirty[8]|8388608&e.$$.dirty[10]&&o(65,We=Pi&&At&&Rh((()=>Zi([["div","alpha",{class:"PinturaNavGroup"},[["div","alpha-set",{class:"PinturaNavSet"},[Qi&&["Button","close",{label:Pi.labelClose,icon:Pi.iconButtonClose,onclick:()=>wi("close"),hideLabel:!0}],Yi&&["Button","revert",{label:Pi.labelButtonRevert,icon:Pi.iconButtonRevert,disabled:!k,onclick:rl,hideLabel:!0}]]]]],["div","beta",{class:"PinturaNavGroup PinturaNavGroupFloat"},[qi&&["div","history",{class:"PinturaNavSet"},[["Button","undo",{label:Pi.labelButtonUndo,icon:Pi.iconButtonUndo,disabled:!k,onclick:ol.undo,hideLabel:!0}],["Button","redo",{label:Pi.labelButtonRedo,icon:Pi.iconButtonRedo,disabled:!C,onclick:ol.redo,hideLabel:!0}]]],Q.length&&["div","plugin-tools",{class:"PinturaNavSet"},Q.filter(Boolean).map((([e,t,o])=>[e,t,{...o}]))]]],["div","gamma",{class:"PinturaNavGroup"},[Gi&&["Button","export",{label:Pi.labelButtonExport,icon:G&&Pi.iconButtonExport,class:"PinturaButtonExport",onclick:sl,hideLabel:G}]]]],{...It},(()=>qn.set({})))))),524288&e.$$.dirty[10]&&o(262,He=St&&!!St.length),16384&e.$$.dirty[8]|526336&e.$$.dirty[10]&&o(261,je=He&&Fn(qe,St)),24576&e.$$.dirty[8]|6553600&e.$$.dirty[10]&&He&&((e,t,i,n)=>{if(!t)return;const r={dataSizeScalar:i};n&&n[3]>0&&(r.backgroundColor=[...n]),t(e,r).then((e=>{oc&&f(oc),o(260,oc=e)}))})(vt,Tt,je,Mt),4096&e.$$.dirty[8]|1574912&e.$$.dirty[10]&&St&&oc&&qe){const{width:e,height:t}=qe,i=Ht()?"pixelated":"auto"===Ct?"auto":"pixelated";o(35,nc=St.map((o=>{const n=nt(o.x,o.y,o.width,o.height),r=gt(Ke(n),o.rotation).map((o=>ue(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,0],backgroundImage:oc,backgroundImageRendering:i,backgroundCorners:r}})))}32&e.$$.dirty[1]&&ic&&rc.set(ic),4&e.$$.dirty[0]|128&e.$$.dirty[1]&&Ze&&Gn.dispatchEvent(ph("ready")),262144&e.$$.dirty[1]&&o(59,vc=!0),30720&e.$$.dirty[10]&&o(60,wc=!0),131072&e.$$.dirty[1]&&o(61,Sc=!0),65536&e.$$.dirty[1]&&o(62,kc=!0),16&e.$$.dirty[1]&&o(63,Cc=!0)},o(319,l=!sc()),S=1===Sd()?e=>{e&&(xe(e.origin,Math.round),xe(e.translation,Math.round))}:Z,o(288,pe=[!wh()&&"WebGL"].filter(Boolean)),o(271,ze=uo()||v()&&jo()),o(64,Ue=((e,t=!0)=>o=>{"ping"===o.type&&(t&&o.stopPropagation(),e(o.detail.type,o.detail.data))})(vi.pub)),[Bn,Xn,Gn,Pi,Ri,Oi,_i,Wi,Ni,Ui,Ki,rn,$n,fn,yn,bn,Sn,kn,Mn,Pn,Rn,In,An,En,Dn,On,Nn,rr,Vs,ol,Ys,Ks,pl,hl,Nl,nc,ic,E,Ze,me,Ne,Ae,fe,A,n,O,I,Ge,Ye,rt,Rt,At,Lt,_t,Zt,po,fo,yo,Sl,vc,wc,Sc,kc,Cc,Ue,We,Be,Oe,Fe,ce,le,q,B,D,z,F,ro,Yo,Ko,Jo,Qo,ei,ti,oi,ii,ni,ri,ai,si,li,ci,di,hi,pi,mi,gi,$i,Yn,qn,Kn,er,sr,lr,cr,dr,pr,mr,gr,$r,fr,Sr,Mr,Tr,Pr,zr,_r,Wr,Vr,Hr,Ur,Zr,Xr,Gr,Yr,qr,ta,oa,ia,na,ra,aa,sa,la,ca,da,ua,pa,ma,ga,$a,fa,ya,ba,xa,wa,Sa,Ta,Pa,Ia,Aa,Ea,La,za,Da,Oa,Ba,ja,Ua,Ga,qa,Ja,Qa,ts,os,is,as,ss,cs,Cs,As,Es,Ls,Fs,zs,Ds,Os,Bs,_s,js,Us,Xs,Qs,tl,al,cl,ul,fl,Tl,Pl,Rl,Il,({target:e,propertyName:t})=>{e===Gn&&/background|outline/.test(t)&&ae&&Al()},El,Dl,_l,Hl,jl,Ul,Zl,Xl,e=>{const t=!(!Nl||!Nl.closeButton)||!Lt;Zl.set(e.detail.width,{hard:t}),Xl.set(Math.round(.5*-e.detail.width),{hard:t})},Jl,Ql,e=>{const{keyCode:t,metaKey:o,ctrlKey:i,shiftKey:n}=e;if(9===t&&Li)return void e.preventDefault();if(e.target&&32===t&&Gn.contains(e.target)&&!mh(e.target)&&e.preventDefault(),90===t&&(o||i))return void(n&&o?ol.redo():ol.undo());if(89===t&&i)return void ol.redo();if(229===t)return;if(o||i)return;const r=new Set([...Pt,t]);Ql.set(Array.from(r))},({key:e,keyCode:t})=>{if("Meta"===e)return Ql.set([]);Ql.set(Pt.filter((e=>e!==t)))},()=>{Ql.set([])},e=>{mh(e.target)||e.preventDefault()},e=>{en&&ec(e.detail.resources[0])},()=>{on&&Ph().then(tc)},e=>{if(!tn)return;const t=Za((window.innerWidth-Math.abs(ct.x))/ct.width,0,1),o=Za((window.innerHeight-Math.abs(ct.y))/ct.height,0,1);t<.75&&o<.75||ec((e.clipboardData||window.clipboardData).files[0])},ac,xc,e=>{Xe&&ut(e.detail,Xe)||Qn(ya,Xe=e.detail,Xe)},Fi,Hs,ki,Ci,Ti,Ii,Ai,Ei,Li,zi,Di,Bi,Vi,Hi,ji,Zi,Xi,Gi,Yi,qi,Ji,Qi,en,tn,on,an,sn,ln,un,hn,pn,gn,xn,vn,wn,Cn,Tn,_n,Wn,Vn,Zn,Jn,Ra,Ws,zl,Ol,Gl,oc,je,He,R,Ve,G,Q,C,k,De,N,ze,Le,Ee,Pe,Me,Te,Ce,we,$e,ye,Se,ke,ve,be,Ie,Re,ge,pe,he,W,J,K,X,j,H,U,oe,ne,ie,te,ee,V,_,Y,ae,re,M,T,x,g,b,y,$,p,u,h,i,d,l,c,qe,et,ot,it,lt,ct,mt,vt,St,Ct,Mt,Tt,It,Et,Dt,Ot,Bt,Wt,Vt,Nt,jt,Ut,Xt,Yt,qt,Kt,Jt,Qt,eo,to,oo,ao,lo,co,ho,mo,go,$o,bo,xo,So,ko,Ao,Lo,Oo,Bo,_o,Uo,Zo,Xo,function(){o(30,Ys=Bh.innerWidth),o(31,Ks=Bh.innerHeight)},e=>Qn(fa,Qo=e.detail,Qo),({detail:e})=>o(43,A=e),(e,t)=>t.id===e,function(t,i){e.$$.not_equal(Xn[i],t)&&(Xn[i]=t,o(1,Xn),o(26,Nn),o(252,Vn))},e=>o(58,Sl=Sl.concat(e)),e=>o(58,Sl=Sl.filter((t=>t!==e))),(e,{detail:t})=>o(37,E[e]=t,E),e=>Qn(ga,ro=e.detail,ro),e=>e.id===A,function(t){e.$$.not_equal(Xn[A],t)&&(Xn[A]=t,o(1,Xn),o(26,Nn),o(252,Vn))},()=>o(58,Sl=Sl.concat(A)),()=>o(58,Sl=Sl.filter((e=>e!==A))),({detail:e})=>o(37,E[A]=e,E),e=>{const t={...e,...ac()},{annotationShapes:o,decorationShapes:i,interfaceShapes:n,frameShapes:r}=Ui({annotationShapes:rt,decorationShapes:Ye,interfaceShapes:si,frameShapes:Ge},t);return xc(t,nc,o,i,n,r)},()=>{o(59,vc=!1),o(60,wc=!1),o(61,Sc=!1),o(62,kc=!1),o(63,Cc=!1)},function(e){Nr[e?"unshift":"push"]((()=>{ic=e,o(36,ic)}))},function(e){Bn=e,o(0,Bn),o(244,gn)},function(e){pl=e,o(32,pl)},function(e){hl=e,o(33,hl)},function(e){Nr[e?"unshift":"push"]((()=>{Gn=e,o(2,Gn)}))},e=>Qn(pa,Rt=e.detail,Rt)]}class dp extends wa{constructor(e){super(),va(this,e,cp,rp,Nn,{class:215,layout:216,stores:217,locale:3,id:4,util:218,utils:219,animations:220,disabled:221,status:213,previewUpscale:222,previewPad:223,previewMaskOpacity:5,previewImageDataMaxSize:224,previewImageTextPixelRatio:6,markupMaskOpacity:7,zoomMaskOpacity:225,elasticityMultiplier:8,willRevert:226,willProcessImage:227,willRenderCanvas:9,willRenderToolbar:228,willSetHistoryInitialState:229,enableButtonExport:230,enableButtonRevert:231,enableNavigateHistory:232,enableToolbar:10,enableUtils:233,enableButtonClose:234,enableDropImage:235,enablePasteImage:236,enableBrowseImage:237,enableTransparencyGrid:11,layoutDirectionPreference:238,layoutHorizontalUtilsPreference:239,layoutVerticalUtilsPreference:240,layoutVerticalToolbarPreference:241,layoutVerticalControlGroupsPreference:242,layoutVerticalControlTabsPreference:243,markupEditorZoomLevel:244,markupEditorZoomLevels:12,markupEditorZoomAdjustStep:13,markupEditorZoomAdjustFactor:14,markupEditorZoomAdjustWheelFactor:15,markupEditorInteractionMode:245,muteAudio:246,willSetMediaInitialTimeOffset:247,enablePan:16,enableZoom:17,enableZoomControls:248,enableZoomInput:18,enablePanInput:249,enableCanvasAlpha:19,enablePanLimit:20,panLimitGutterScalar:21,zoomPresetOptions:22,zoomAdjustStep:23,zoomAdjustFactor:24,zoomAdjustWheelFactor:25,zoomLevel:0,imagePreviewSrc:250,imageOrienter:251,pluginComponents:252,pluginOptions:26,sub:253,pluginInterface:1,root:2,imageSourceToImageData:27,imagePreview:28,imagePreviewCurrent:214,history:29},null,[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1])}get class(){return this.$$.ctx[215]}set class(e){this.$$set({class:e}),ea()}get layout(){return this.$$.ctx[216]}set layout(e){this.$$set({layout:e}),ea()}get stores(){return this.$$.ctx[217]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[3]}set locale(e){this.$$set({locale:e}),ea()}get id(){return this.$$.ctx[4]}set id(e){this.$$set({id:e}),ea()}get util(){return this.$$.ctx[218]}set util(e){this.$$set({util:e}),ea()}get utils(){return this.$$.ctx[219]}set utils(e){this.$$set({utils:e}),ea()}get animations(){return this.$$.ctx[220]}set animations(e){this.$$set({animations:e}),ea()}get disabled(){return this.$$.ctx[221]}set disabled(e){this.$$set({disabled:e}),ea()}get status(){return this.$$.ctx[213]}set status(e){this.$$set({status:e}),ea()}get previewUpscale(){return this.$$.ctx[222]}set previewUpscale(e){this.$$set({previewUpscale:e}),ea()}get previewPad(){return this.$$.ctx[223]}set previewPad(e){this.$$set({previewPad:e}),ea()}get previewMaskOpacity(){return this.$$.ctx[5]}set previewMaskOpacity(e){this.$$set({previewMaskOpacity:e}),ea()}get previewImageDataMaxSize(){return this.$$.ctx[224]}set previewImageDataMaxSize(e){this.$$set({previewImageDataMaxSize:e}),ea()}get previewImageTextPixelRatio(){return this.$$.ctx[6]}set previewImageTextPixelRatio(e){this.$$set({previewImageTextPixelRatio:e}),ea()}get markupMaskOpacity(){return this.$$.ctx[7]}set markupMaskOpacity(e){this.$$set({markupMaskOpacity:e}),ea()}get zoomMaskOpacity(){return this.$$.ctx[225]}set zoomMaskOpacity(e){this.$$set({zoomMaskOpacity:e}),ea()}get elasticityMultiplier(){return this.$$.ctx[8]}set elasticityMultiplier(e){this.$$set({elasticityMultiplier:e}),ea()}get willRevert(){return this.$$.ctx[226]}set willRevert(e){this.$$set({willRevert:e}),ea()}get willProcessImage(){return this.$$.ctx[227]}set willProcessImage(e){this.$$set({willProcessImage:e}),ea()}get willRenderCanvas(){return this.$$.ctx[9]}set willRenderCanvas(e){this.$$set({willRenderCanvas:e}),ea()}get willRenderToolbar(){return this.$$.ctx[228]}set willRenderToolbar(e){this.$$set({willRenderToolbar:e}),ea()}get willSetHistoryInitialState(){return this.$$.ctx[229]}set willSetHistoryInitialState(e){this.$$set({willSetHistoryInitialState:e}),ea()}get enableButtonExport(){return this.$$.ctx[230]}set enableButtonExport(e){this.$$set({enableButtonExport:e}),ea()}get enableButtonRevert(){return this.$$.ctx[231]}set enableButtonRevert(e){this.$$set({enableButtonRevert:e}),ea()}get enableNavigateHistory(){return this.$$.ctx[232]}set enableNavigateHistory(e){this.$$set({enableNavigateHistory:e}),ea()}get enableToolbar(){return this.$$.ctx[10]}set enableToolbar(e){this.$$set({enableToolbar:e}),ea()}get enableUtils(){return this.$$.ctx[233]}set enableUtils(e){this.$$set({enableUtils:e}),ea()}get enableButtonClose(){return this.$$.ctx[234]}set enableButtonClose(e){this.$$set({enableButtonClose:e}),ea()}get enableDropImage(){return this.$$.ctx[235]}set enableDropImage(e){this.$$set({enableDropImage:e}),ea()}get enablePasteImage(){return this.$$.ctx[236]}set enablePasteImage(e){this.$$set({enablePasteImage:e}),ea()}get enableBrowseImage(){return this.$$.ctx[237]}set enableBrowseImage(e){this.$$set({enableBrowseImage:e}),ea()}get enableTransparencyGrid(){return this.$$.ctx[11]}set enableTransparencyGrid(e){this.$$set({enableTransparencyGrid:e}),ea()}get layoutDirectionPreference(){return this.$$.ctx[238]}set layoutDirectionPreference(e){this.$$set({layoutDirectionPreference:e}),ea()}get layoutHorizontalUtilsPreference(){return this.$$.ctx[239]}set layoutHorizontalUtilsPreference(e){this.$$set({layoutHorizontalUtilsPreference:e}),ea()}get layoutVerticalUtilsPreference(){return this.$$.ctx[240]}set layoutVerticalUtilsPreference(e){this.$$set({layoutVerticalUtilsPreference:e}),ea()}get layoutVerticalToolbarPreference(){return this.$$.ctx[241]}set layoutVerticalToolbarPreference(e){this.$$set({layoutVerticalToolbarPreference:e}),ea()}get layoutVerticalControlGroupsPreference(){return this.$$.ctx[242]}set layoutVerticalControlGroupsPreference(e){this.$$set({layoutVerticalControlGroupsPreference:e}),ea()}get layoutVerticalControlTabsPreference(){return this.$$.ctx[243]}set layoutVerticalControlTabsPreference(e){this.$$set({layoutVerticalControlTabsPreference:e}),ea()}get markupEditorZoomLevel(){return this.$$.ctx[244]}set markupEditorZoomLevel(e){this.$$set({markupEditorZoomLevel:e}),ea()}get markupEditorZoomLevels(){return this.$$.ctx[12]}set markupEditorZoomLevels(e){this.$$set({markupEditorZoomLevels:e}),ea()}get markupEditorZoomAdjustStep(){return this.$$.ctx[13]}set markupEditorZoomAdjustStep(e){this.$$set({markupEditorZoomAdjustStep:e}),ea()}get markupEditorZoomAdjustFactor(){return this.$$.ctx[14]}set markupEditorZoomAdjustFactor(e){this.$$set({markupEditorZoomAdjustFactor:e}),ea()}get markupEditorZoomAdjustWheelFactor(){return this.$$.ctx[15]}set markupEditorZoomAdjustWheelFactor(e){this.$$set({markupEditorZoomAdjustWheelFactor:e}),ea()}get markupEditorInteractionMode(){return this.$$.ctx[245]}set markupEditorInteractionMode(e){this.$$set({markupEditorInteractionMode:e}),ea()}get muteAudio(){return this.$$.ctx[246]}set muteAudio(e){this.$$set({muteAudio:e}),ea()}get willSetMediaInitialTimeOffset(){return this.$$.ctx[247]}set willSetMediaInitialTimeOffset(e){this.$$set({willSetMediaInitialTimeOffset:e}),ea()}get enablePan(){return this.$$.ctx[16]}set enablePan(e){this.$$set({enablePan:e}),ea()}get enableZoom(){return this.$$.ctx[17]}set enableZoom(e){this.$$set({enableZoom:e}),ea()}get enableZoomControls(){return this.$$.ctx[248]}set enableZoomControls(e){this.$$set({enableZoomControls:e}),ea()}get enableZoomInput(){return this.$$.ctx[18]}set enableZoomInput(e){this.$$set({enableZoomInput:e}),ea()}get enablePanInput(){return this.$$.ctx[249]}set enablePanInput(e){this.$$set({enablePanInput:e}),ea()}get enableCanvasAlpha(){return this.$$.ctx[19]}set enableCanvasAlpha(e){this.$$set({enableCanvasAlpha:e}),ea()}get enablePanLimit(){return this.$$.ctx[20]}set enablePanLimit(e){this.$$set({enablePanLimit:e}),ea()}get panLimitGutterScalar(){return this.$$.ctx[21]}set panLimitGutterScalar(e){this.$$set({panLimitGutterScalar:e}),ea()}get zoomPresetOptions(){return this.$$.ctx[22]}set zoomPresetOptions(e){this.$$set({zoomPresetOptions:e}),ea()}get zoomAdjustStep(){return this.$$.ctx[23]}set zoomAdjustStep(e){this.$$set({zoomAdjustStep:e}),ea()}get zoomAdjustFactor(){return this.$$.ctx[24]}set zoomAdjustFactor(e){this.$$set({zoomAdjustFactor:e}),ea()}get zoomAdjustWheelFactor(){return this.$$.ctx[25]}set zoomAdjustWheelFactor(e){this.$$set({zoomAdjustWheelFactor:e}),ea()}get zoomLevel(){return this.$$.ctx[0]}set zoomLevel(e){this.$$set({zoomLevel:e}),ea()}get imagePreviewSrc(){return this.$$.ctx[250]}set imagePreviewSrc(e){this.$$set({imagePreviewSrc:e}),ea()}get imageOrienter(){return this.$$.ctx[251]}set imageOrienter(e){this.$$set({imageOrienter:e}),ea()}get pluginComponents(){return this.$$.ctx[252]}set pluginComponents(e){this.$$set({pluginComponents:e}),ea()}get pluginOptions(){return this.$$.ctx[26]}set pluginOptions(e){this.$$set({pluginOptions:e}),ea()}get sub(){return this.$$.ctx[253]}get pluginInterface(){return this.$$.ctx[1]}get root(){return this.$$.ctx[2]}set root(e){this.$$set({root:e}),ea()}get imageSourceToImageData(){return this.$$.ctx[27]}set imageSourceToImageData(e){this.$$set({imageSourceToImageData:e}),ea()}get imagePreview(){return this.$$.ctx[28]}get imagePreviewCurrent(){return this.$$.ctx[214]}set imagePreviewCurrent(e){this.$$set({imagePreviewCurrent:e}),ea()}get history(){return this.$$.ctx[29]}}"undefined"!=typeof window&&(e=>{if(e&&e._uahonds)return;const[t,o,i]=[[99,111,110,115,111,108,101],[108,111,103],[84,104,105,115,32,118,101,114,115,105,111,110,32,111,102,32,80,105,110,116,117,114,97,32,105,115,32,102,111,114,32,116,101,115,116,105,110,103,32,112,117,114,112,111,115,101,115,32,111,110,108,121,46,32,86,105,115,105,116,32,104,116,116,112,115,58,47,47,112,113,105,110,97,46,110,108,47,112,105,110,116,117,114,97,47,32,116,111,32,112,117,114,99,104,97,115,101,32,97,32,118,97,108,105,100,32,108,105,99,101,110,115,101,46]].map((e=>e.map((e=>String.fromCharCode(e))).join("")));e&&e[t]&&e[t][o](i)})(window);const up=["klass","stores","isVisible","isActive","isActiveFraction","locale"],hp=["history","klass","stores","navButtons","pluginComponents","pluginInterface","pluginOptions","sub","imagePreviewSrc","imagePreview","imagePreviewCurrent"],pp=["locale"];let mp;const gp=new Set([]),$p={},fp=new Map,yp=(...e)=>{e.filter((e=>!!e.util)).forEach((e=>{const[t,o,i=(()=>!0)]=e.util;fp.has(t)||(fp.set(t,{Component:o,isSupported:i}),Lc(o).filter((e=>!up.includes(e))).forEach((e=>{gp.add(e),$p[e]?$p[e].push(t):$p[e]=[t]})))}))};var bp=[...is,"init","update","undo","redo","revert","writehistory","destroy","show","hide","close","ready","zoom","pan","loadpreview","selectshape","updateshape","addshape","removeshape","selectstyle","markuptap","markupzoom","markuppan","selectutil","selectcontrol"];var xp=(e,t,o={})=>{const{prefix:i="pintura:"}=o;return bp.map((o=>e.on(o,(e=>Ft(t)?((e,t,o)=>e.dispatchEvent(new CustomEvent(t,{detail:o,bubbles:!0,cancelable:!0})))(t,`${i}${o}`,e):t(o,e)))))};const vp=e=>P(e[0]),wp=e=>!vp(e),Sp=e=>e[1],kp=e=>e[3]||[];const Cp=(e,t,o,i=(e=>e))=>{const n=Pp(t,o),r=n.findIndex((e=>Sp(e)===t));var a,s,l;a=n,s=i(r),l=e,a.splice(s,0,l)},Mp=(e,t)=>{const o=Pp(e,t);return Yc(o,(t=>Sp(t)===e)),o},Tp=(e,t)=>{if(t&&t.length){if(vp(t)){if(Sp(t)===e)return t;const o=Tp(e,kp(t));if(o)return o}if(wp(t))for(const o of t){const t=Tp(e,o);if(t)return t}}},Pp=(e,t)=>wp(t)?t.find((t=>Sp(t)===e))?t:t.find((t=>Pp(e,kp(t)))):Pp(e,kp(t)),Rp=()=>[.75,.25,.25,0,0,.25,.75,.25,0,0,.25,.25,.75,0,0,0,0,0,1,0],Ip=()=>[1.398,-.316,.065,-.273,.201,-.051,1.278,-.08,-.273,.201,-.051,.119,1.151,-.29,.215,0,0,0,1,0],Ap=()=>[1.073,-.015,.092,-.115,-.017,.107,.859,.184,-.115,-.017,.015,.077,1.104,-.115,-.017,0,0,0,1,0],Ep=()=>[1.06,0,0,0,0,0,1.01,0,0,0,0,0,.93,0,0,0,0,0,1,0],Lp=()=>[1.1,0,0,0,-.1,0,1.1,0,0,-.1,0,0,1.2,0,-.1,0,0,0,1,0],Fp=()=>[.212,.715,.114,0,0,.212,.715,.114,0,0,.212,.715,.114,0,0,0,0,0,1,0],zp=()=>[.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,.15,1.3,-.25,.1,-.2,0,0,0,1,0],Dp=()=>[.163,.518,.084,-.01,.208,.163,.529,.082,-.02,.21,.171,.529,.084,0,.214,0,0,0,1,0],Op=()=>[.338,.991,.117,.093,-.196,.302,1.049,.096,.078,-.196,.286,1.016,.146,.101,-.196,0,0,0,1,0],Bp=()=>[.393,.768,.188,0,0,.349,.685,.167,0,0,.272,.533,.13,0,0,0,0,0,1,0],_p=()=>[.289,.62,.185,0,.077,.257,.566,.163,0,.115,.2,.43,.128,0,.188,0,0,0,1,0],Wp=()=>[.269,.764,.172,.05,.1,.239,.527,.152,0,.176,.186,.4,.119,0,.159,0,0,0,1,0],Vp=()=>[.547,.764,.134,0,-.147,.281,.925,.12,0,-.135,.225,.558,.33,0,-.113,0,0,0,1,0],Np={chrome:Ip,fade:Ap,pastel:Rp,cold:Lp,warm:Ep,monoDefault:Fp,monoWash:Dp,monoNoir:zp,monoStark:Op,sepiaDefault:Bp,sepiaRust:Wp,sepiaBlues:_p,sepiaColor:Vp};var Hp={filterFunctions:Np,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 jp={borderColor:"strokeColor",borderWidth:"strokeWidth",lineWidth:"strokeWidth",fontColor:"color",lineColor:"strokeColor",src:"backgroundImage",fit:"backgroundSize"},Up=e=>0===e||"0%"===e||"0px"===e?0:/px$/.test(e)?parseInt(e,10):/\%$/.test(e)?e:e<=1?100*e+"%":void 0,Zp=(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},Xp=(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 ue(l*(c*a),l*(c*s))},Gp=(e,{flip:t,aspectRatio:o,rotation:i,center:n,zoom:r,scaleToFit:a})=>{const s={flipX:!1,flipY:!1},l=!n||n&&.5===n.x&&.5===n.y;t&&t.horizontal&&(s.flipX=t.horizontal),t&&t.vertical&&(s.flipY=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,n=t;let 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 _e(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 nt(n,r,o,i)})(e,o);if((o||!l||r)&&(s.crop=bt(Qe(h),c)),"number"==typeof i&&null!==i&&0!==i){null!=i&&(s.rotation=i);const t=((e,t)=>{const o=e.width,i=e.height,n=Xp(o,t),r=Xp(i,t),a=ue(e.x+Math.abs(n.x),e.y-Math.abs(n.y)),s=ue(e.x+e.width+Math.abs(r.y),e.y+Math.abs(r.x)),l=ue(e.x-Math.abs(r.y),e.y+e.height-Math.abs(r.x));return{width:Pe(a,s),height:Pe(a,l)}})(p,i),o=Math.max(t.width/h.width,t.height/h.height),r=ue(n.x*e.width,n.y*e.height),a=Lt(e,i),l=Ne(a),c=ue(.5*(a.width-e.width),.5*(a.height-e.height)),d=gt({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=Ee(d.map(pe),i,l.x,l.y),g=rt(tt(m)),$=Ee(m.map(pe),-2*i,g.x,g.y);s.crop=tt($)}else null!=r&&st(s.crop,1/r);return d||(s.cropLimitToImage=!1),s};let Yp=null;const qp={base:0,min:-.25,max:.25,getLabel:e=>Ah(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]})))},Kp={base:1,min:.5,max:1.5,getLabel:e=>Ah(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]})))},Jp={base:1,min:0,max:2,getLabel:e=>Ah(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]})))},Qp={base:1,min:.5,max:1.5,getLabel:e=>Ah(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]})))},em={base:1,min:.15,max:4,getLabel:e=>Ah(e<1?(e-.15)/.85-1:(e-1)/3),getStore:({imageGamma:e})=>e},tm={base:0,min:-1,max:1,getStore:({imageVignette:e})=>e},om={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]})))}},im={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 nm={finetuneControlConfiguration:{gamma:em,brightness:qp,contrast:Kp,saturation:Jp,exposure:Qp,temperature:im,clarity:om,vignette:tm},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],!sc()&&["clarity",e=>e.finetuneLabelClarity],["vignette",e=>e.finetuneLabelVignette]].filter(Boolean)};const rm={shape:{frameColor:[1,1,1],frameStyle:"solid",frameSize:"2.5%"},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%"/>'},am={shape:{frameColor:[1,1,1],frameStyle:"solid",frameSize:"2.5%",frameRound:!0},thumb:'<rect stroke-width="5" x="0" y="0" width="100%" height="100%" rx="12%"/>'},sm={shape:{frameColor:[1,1,1],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>'},lm={shape:{frameColor:[1,1,1],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>'},cm={shape:{frameColor:[1,1,1],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>'},dm={shape:{frameColor:[1,1,1],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>'},um={shape:{frameColor:[1,1,1],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>'},hm={shape:{frameColor:[1,1,1],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>'},pm={shape:{frameColor:[1,1,1],frameStyle:"polaroid"},thumb:'<rect stroke-width="20%" x="-5%" y="-5%" width="110%" height="96%"/>'};var mm={frameStyles:{solidSharp:rm,solidRound:am,lineSingle:sm,lineMultiple:lm,edgeSeparate:cm,edgeCross:dm,edgeOverlap:um,hook:hm,polaroid:pm},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]]},gm=(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 $m(e){let t,o,i;return{c(){t=hr("div"),o=hr("span"),xr(t,"class","PinturaColorPreview"),xr(t,"title",e[0]),xr(t,"style",i="--color:"+e[1])},m(e,i){dr(e,t,i),sr(t,o)},p(e,[o]){1&o&&xr(t,"title",e[0]),2&o&&i!==(i="--color:"+e[1])&&xr(t,"style",i)},i:zn,o:zn,d(e){e&&ur(t)}}}function fm(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?Oo(n):"transparent")},[r,i,n]}class ym extends wa{constructor(e){super(),va(this,e,fm,$m,Nn,{color:2,title:0})}}function bm(e){let t,o;return{c(){t=hr("span"),o=mr(e[0])},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){1&t[0]&&wr(o,e[0])},d(e){e&&ur(t)}}}function xm(e){let t,o,i,n;o=new ym({props:{color:e[4],title:Ud(e[8],e[10])}});let r=!e[9]&&bm(e);return{c(){t=hr("span"),ya(o.$$.fragment),i=gr(),r&&r.c(),xr(t,"slot","label"),xr(t,"class","PinturaButtonLabel")},m(e,a){dr(e,t,a),ba(o,t,null),sr(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=Ud(e[8],e[10])),o.$set(n),e[9]?r&&(r.d(1),r=null):r?r.p(e,i):(r=bm(e),r.c(),r.m(t,null))},i(e){n||(sa(o.$$.fragment,e),n=!0)},o(e){la(o.$$.fragment,e),n=!1},d(e){e&&ur(t),xa(o),r&&r.d()}}}function vm(e){let t,o,i,n,r,a,s,l,c,d,u,h,p;c=new Zu({props:{class:"PinturaHuePicker",knobStyle:"background-color:"+e[19],onchange:e[24],value:e[14],min:0,max:1,step:.01}});let m=e[11]&&wm(e);return{c(){t=hr("div"),o=hr("div"),i=hr("div"),n=hr("div"),l=gr(),ya(c.$$.fragment),d=gr(),m&&m.c(),xr(n,"role","button"),xr(n,"aria-label","Saturation slider"),xr(n,"class","PinturaPickerKnob"),xr(n,"tabindex","0"),xr(n,"style",r=`background-color:${e[18]};`),xr(i,"class","PinturaPickerKnobController"),xr(i,"style",a=`transform:translate(${e[22]}%,${e[21]}%)`),xr(o,"class","PinturaSaturationPicker"),xr(o,"style",s="background-color: "+e[19]),xr(t,"class","PinturaPicker")},m(r,a){dr(r,t,a),sr(t,o),sr(o,i),sr(i,n),e[32](o),sr(t,l),ba(c,t,null),sr(t,d),m&&m.m(t,null),u=!0,h||(p=[fr(n,"nudge",e[27]),er(Jc.call(null,n,{preventDefault:!0})),fr(o,"pointerdown",e[26])],h=!0)},p(e,l){(!u||262144&l[0]&&r!==(r=`background-color:${e[18]};`))&&xr(n,"style",r),(!u||6291456&l[0]&&a!==(a=`transform:translate(${e[22]}%,${e[21]}%)`))&&xr(i,"style",a),(!u||524288&l[0]&&s!==(s="background-color: "+e[19]))&&xr(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]&&sa(m,1)):(m=wm(e),m.c(),sa(m,1),m.m(t,null)):m&&(ra(),la(m,1,1,(()=>{m=null})),aa())},i(e){u||(sa(c.$$.fragment,e),sa(m),u=!0)},o(e){la(c.$$.fragment,e),la(m),u=!1},d(o){o&&ur(t),e[32](null),xa(c),m&&m.d(),h=!1,Wn(p)}}}function wm(e){let t,o;return t=new Zu({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(){ya(t.$$.fragment)},m(e,i){ba(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||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Sm(e){let t,o;return t=new bu({props:{label:Ud(e[10].labelColorPalette,e[10]),class:hc(["PinturaColorPresets",e[9]?"PinturaColorPresetsGrid":"PinturaColorPresetsList"]),hideLabel:!1,name:e[1],value:e[4],optionGroupClass:"PinturaListOptionGroup",optionClass:"PinturaListOption",options:e[2].map(e[33]),selectedIndex:e[3],optionMapper:e[7],optionLabelClass:e[6],onchange:e[34],$$slots:{option:[Mm,({option:e})=>({45:e}),({option:e})=>[0,e?16384:0]],group:[km,({option:e})=>({45:e}),({option:e})=>[0,e?16384:0]]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};1024&o[0]&&(i.label=Ud(e[10].labelColorPalette,e[10])),512&o[0]&&(i.class=hc(["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[33])),8&o[0]&&(i.selectedIndex=e[3]),128&o[0]&&(i.optionMapper=e[7]),64&o[0]&&(i.optionLabelClass=e[6]),512&o[0]|49152&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function km(e){let t,o,i=e[45].label+"";return{c(){t=hr("span"),o=mr(i),xr(t,"slot","group")},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){16384&t[1]&&i!==(i=e[45].label+"")&&wr(o,i)},d(e){e&&ur(t)}}}function Cm(e){let t,o,i=e[45].label+"";return{c(){t=hr("span"),o=mr(i),xr(t,"class","PinturaButtonLabel")},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){16384&t[1]&&i!==(i=e[45].label+"")&&wr(o,i)},d(e){e&&ur(t)}}}function Mm(e){let t,o,i,n;o=new ym({props:{title:e[45].label,color:e[45].value}});let r=!e[9]&&Cm(e);return{c(){t=hr("span"),ya(o.$$.fragment),i=gr(),r&&r.c(),xr(t,"slot","option")},m(e,a){dr(e,t,a),ba(o,t,null),sr(t,i),r&&r.m(t,null),n=!0},p(e,i){const n={};16384&i[1]&&(n.title=e[45].label),16384&i[1]&&(n.color=e[45].value),o.$set(n),e[9]?r&&(r.d(1),r=null):r?r.p(e,i):(r=Cm(e),r.c(),r.m(t,null))},i(e){n||(sa(o.$$.fragment,e),n=!0)},o(e){la(o.$$.fragment,e),n=!1},d(e){e&&ur(t),xa(o),r&&r.d()}}}function Tm(e){let t,o,i,n=e[13]&&vm(e),r=e[12]&&Sm(e);return{c(){t=hr("div"),n&&n.c(),o=gr(),r&&r.c(),xr(t,"slot","details"),xr(t,"class","PinturaColorPickerPanel")},m(e,a){dr(e,t,a),n&&n.m(t,null),sr(t,o),r&&r.m(t,null),i=!0},p(e,i){e[13]?n?(n.p(e,i),8192&i[0]&&sa(n,1)):(n=vm(e),n.c(),sa(n,1),n.m(t,o)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa()),e[12]?r?(r.p(e,i),4096&i[0]&&sa(r,1)):(r=Sm(e),r.c(),sa(r,1),r.m(t,null)):r&&(ra(),la(r,1,1,(()=>{r=null})),aa())},i(e){i||(sa(n),sa(r),i=!0)},o(e){la(n),la(r),i=!1},d(e){e&&ur(t),n&&n.d(),r&&r.d()}}}function Pm(e){let t,o;return t=new Bd({props:{buttonClass:hc(["PinturaColorPickerButton",e[5]]),$$slots:{details:[Tm],label:[xm]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};32&o[0]&&(i.buttonClass=hc(["PinturaColorPickerButton",e[5]])),8388575&o[0]|32768&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Rm(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,{label:g}=t,{name:$}=t,{options:f=[]}=t,{selectedIndex:y=-1}=t,{value:b}=t,{buttonClass:x}=t,{optionLabelClass:v}=t,{optionMapper:w}=t,{onchange:S}=t,{title:k}=t,{hidePresetLabel:C=!0}=t,{locale:M}=t,{enableOpacity:T=!0}=t,{enablePresets:P=!0}=t,{enablePicker:I=!0}=t;const A=(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=Mo(e[3])?e[3]:1)}o(16,d=Oo(e)),o(17,u=Oo([...c,0])),o(18,h=Oo([...c,1])),o(19,p=Oo(gm(r,1,1)))},E=()=>{const e=[...gm(r,a,s),l];A(e),S(e)},L=e=>{const t=3===e.length?[...e,1]:e;A(t,!0),S(t)},F=(e,t)=>{const i=Za(e.x/t.width,0,1),n=Za(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),E()};let z,D,O,B;const _=e=>{const t=we(he(e),B);F(ve(pe(O),t),D)},W=e=>{D=void 0,document.documentElement.removeEventListener("pointermove",_),document.documentElement.removeEventListener("pointerup",W)};return e.$$set=e=>{"label"in e&&o(0,g=e.label),"name"in e&&o(1,$=e.name),"options"in e&&o(2,f=e.options),"selectedIndex"in e&&o(3,y=e.selectedIndex),"value"in e&&o(4,b=e.value),"buttonClass"in e&&o(5,x=e.buttonClass),"optionLabelClass"in e&&o(6,v=e.optionLabelClass),"optionMapper"in e&&o(7,w=e.optionMapper),"onchange"in e&&o(28,S=e.onchange),"title"in e&&o(8,k=e.title),"hidePresetLabel"in e&&o(9,C=e.hidePresetLabel),"locale"in e&&o(10,M=e.locale),"enableOpacity"in e&&o(11,T=e.enableOpacity),"enablePresets"in e&&o(12,P=e.enablePresets),"enablePicker"in e&&o(13,I=e.enablePicker)},e.$$.update=()=>{16&e.$$.dirty[0]|1&e.$$.dirty[1]&&(!b||m&&Ka(b,m)||(o(31,m=[...b]),A(b,!0))),536870912&e.$$.dirty[0]&&o(22,i=100*a),1073741824&e.$$.dirty[0]&&o(21,n=100-100*s)},[g,$,f,y,b,x,v,w,k,C,M,T,P,I,r,l,d,u,h,p,z,n,i,L,e=>{o(14,r=e),0===l&&o(15,l=1),E()},e=>{o(15,l=e),E()},e=>{e.stopPropagation(),D=_e(z.offsetWidth,z.offsetHeight),O=(e=>ue(e.offsetX,e.offsetY))(e),B=he(e),F(O,D),document.documentElement.addEventListener("pointermove",_),document.documentElement.addEventListener("pointerup",W)},e=>{D=_e(z.offsetWidth,z.offsetHeight);const t=i/100*D.width,o=n/100*D.height;F({x:t+e.detail.x,y:o+e.detail.y},D)},S,a,s,m,function(e){Nr[e?"unshift":"push"]((()=>{z=e,o(20,z)}))},([e,t])=>[e,R(t)?t(M):t],e=>L(e.value)]}class Im extends wa{constructor(e){super(),va(this,e,Rm,Pm,Nn,{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},null,[-1,-1])}}var Am=e=>e.charAt(0).toUpperCase()+e.slice(1);let Em=null;var Lm=()=>{if(null===Em)if(u())try{Em=!1===document.fonts.check("16px TestNonExistingFont")}catch(e){Em=!1}else Em=!1;return Em};const Fm=(e,t)=>o=>o[t?`${t}${Am(e)}`:e],zm=e=>[e,""+e],Dm=(e,t)=>o=>[e[o],Fm(o,t)],Om=[1,.2549,.2118],Bm="0.5%",_m=[1,1,1,0],Wm={eraser:()=>({eraseRadius:0}),path:()=>({points:[]}),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"})},Vm=(e,t={},o)=>{if(!Wm[e])return;const{position:i="relative",inputMode:n="drag"}=o||{};return[{...Wm[e](),...t},{position:i,inputMode:n}]},Nm=e=>({sharpie:Vm("path",{strokeWidth:Bm,strokeColor:[...Om],disableErase:!1,disableResize:!0,disableMove:!0}),eraser:Vm("eraser"),path:Vm("path",{pathClose:void 0,strokeWidth:Bm,strokeColor:[...Om],backgroundColor:[0,0,0,0]},{inputMode:"step"}),line:Vm("line",{strokeColor:[...Om],strokeWidth:Bm}),arrow:Vm("line",{lineStart:"none",lineEnd:"arrow-solid",strokeColor:[...Om],strokeWidth:Bm}),rectangle:Vm("rectangle",{strokeColor:[..._m],backgroundColor:[...Om]}),ellipse:Vm("ellipse",{strokeColor:[..._m],backgroundColor:[...Om]}),text:Vm("text",{color:[...Om],fontSize:"2%"}),...e}),Hm=(e,t,o)=>[e,t||Fm(e,"shapeLabelTool"),{icon:Fm(e,"shapeIconTool"),...o}],jm=(e=["move","view","sharpie","eraser","path","line","arrow","rectangle","ellipse","text","preset"])=>e.map((e=>P(e)?Hm(e):Array.isArray(e)?C(e[1])?Hm(e[0],void 0,e[1]):Hm(e[0],e[1],e[2]):void 0)).filter(Boolean),Um=()=>({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]}),Zm=()=>[16,18,20,24,30,36,48,64,72,96,128,144],Xm=Zm,Gm=()=>({extraSmall:"2%",small:"4%",mediumSmall:"8%",medium:"10%",mediumLarge:"15%",large:"20%",extraLarge:"25%"}),Ym=()=>({extraSmall:"40%",small:"60%",mediumSmall:"100%",medium:"120%",mediumLarge:"140%",large:"180%",extraLarge:"220%"}),qm=()=>({extraSmall:"0.25%",small:"0.5%",mediumSmall:"1%",medium:"1.75%",mediumLarge:"2.5%",large:"3.5%",extraLarge:"5%"}),Km=()=>["bar","arrow","arrowSolid","circle","circleSolid","square","squareSolid"],Jm=()=>[["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"]],Qm=()=>["left","center","right"],eg=()=>[["normal","bold"],["italic","normal"],["italic","bold"]],tg=e=>Object.keys(e).map(Dm(e,"shapeTitleColor")),og=e=>Object.keys(e).map(Dm(e,"labelSize")),ig=e=>Object.keys(e).map(Dm(e,"labelSize")),ng=e=>Object.keys(e).map(Dm(e,"labelSize")),rg=e=>[...e],ag=e=>e.map((e=>[e,t=>t["shapeLabelFontStyle"+e.filter((e=>"normal"!==e)).map(Am).join("")]])),sg=e=>e.map((e=>[gh(e),t=>t["shapeTitleLineDecoration"+Am(e)],{icon:t=>t["shapeIconLineDecoration"+Am(e)]}])),lg=e=>e.map((e=>[e,t=>t["shapeTitleTextAlign"+Am(e)],{hideLabel:!0,icon:t=>t["shapeIconTextAlign"+Am(e)]}])),cg=(e,t)=>{const{defaultKey:o,defaultValue:i,defaultOptions:n}=t||{},r=[];return o&&(r[0]=[i,e=>e[o],{...n}]),[...r,...e]},dg=e=>e.split(",").map((e=>e.trim())).some((e=>document.fonts.check("16px "+e))),ug=(e,t={})=>[Im,{title:e=>e.labelColor,options:cg(e),...t}],hg=(e={})=>[Qu,{...e}],pg="PinturaFontTest",mg=(e,t={defaultKey:"labelDefault"})=>[Lu,{title:e=>e.shapeTitleFontFamily,onload:({options:e=[]})=>{Lm()&&e.map((([e])=>e)).filter(Boolean).filter((e=>!dg(e))).forEach((e=>{const t="PinturaFontTest-"+e.replace(/[^a-zA-Z0-9]+/g,"").toLowerCase();document.getElementById(t)||document.body.append(g("span",{textContent:" ",id:t,class:pg,style:`font-family:${e};font-size:0;color:transparent;`}))}))},ondestroy:()=>{if(!Lm())return;document.querySelectorAll(".PinturaFontTest").forEach((e=>e.remove()))},optionLabelStyle:e=>"font-family: "+e,options:cg(e,t),optionFilter:e=>{if(!Lm())return!0;const[t]=e;if(!t)return!0;return dg(t)}}],gg=(e,t={})=>[Im,{title:e=>e.shapeTitleBackgroundColor,options:cg(e),...t}],$g=(e,t={})=>[Im,{title:e=>e.shapeTitleStrokeColor,options:cg(e),buttonClass:"PinturaColorPickerButtonStroke",onchange:(e,o)=>{const i=o.strokeWidth;(Mo(i)||P(i)?parseFloat(i):0)>0||(o.strokeWidth=t&&t.defaultStrokeWidth||"0.5%")},...t}],fg=e=>[Lu,{title:e=>e.shapeTitleStrokeWidth,options:t=>Po(t,"backgroundColor")?cg(e,{defaultKey:"shapeLabelStrokeNone"}):cg(e),onchange:(e,t)=>{if(!e)return;const o=t.strokeColor||[];if(o[3])return;const i=[...o];i[3]=1,t.strokeColor=i}}],yg=(e,t,o)=>[Lu,{title:e=>e[t],options:cg(e,{defaultKey:"labelNone",defaultOptions:{icon:'<g stroke="currentColor" stroke-linecap="round" stroke-width=".125em"><path d="M5,12 H14"/></g>'}}),optionIconStyle:o}],bg=e=>yg(e,"shapeTitleLineStart","transform: scaleX(-1)"),xg=e=>yg(e,"shapeTitleLineEnd"),vg=e=>[Im,{title:e=>e.shapeTitleTextColor,options:cg(e)}],wg=e=>[Lu,{title:e=>e.shapeTitleFontStyle,optionLabelStyle:e=>e&&`font-style:${e[0]};font-weight:${e[1]}`,options:cg(e,{defaultKey:"shapeLabelFontStyleNormal"})}],Sg=(e,t)=>(t||e.find((([e])=>"4%"===e))||(t={defaultKey:"labelAuto",defaultValue:"4%"}),[Lu,{title:e=>e.shapeTitleFontSize,options:cg(e,t)}]),kg=e=>[bu,{title:e=>e.shapeTitleTextAlign,options:cg(e)}],Cg=(e,t)=>(t||e.find((([e])=>"120%"===e))||(t={defaultKey:"labelAuto",defaultValue:"120%"}),[Lu,{title:e=>e.shapeTitleLineHeight,options:cg(e,t)}]),Mg=(e={})=>{const{colorOptions:t=tg(Um()),lineEndStyleOptions:o=sg(Km()),fontFamilyOptions:i=rg(Jm()),fontStyleOptions:n=ag(eg()),textAlignOptions:r=lg(Qm())}=e;let{strokeWidthOptions:a=ng(qm()),fontSizeOptions:s=og(Gm()),lineHeightOptions:l=ig(Ym())}=e;[s,l,a]=[s,l,a].map((e=>Array.isArray(e)&&e.every(Mo)?e.map(zm):e));const c={defaultColor:t&&ug(t),defaultNumber:hg(),defaultPercentage:hg({getValue:e=>parseFloat(e),setValue:e=>e+"%",step:.05,label:(e,t,o)=>Math.round(e/o*100)+"%",labelClass:"PinturaPercentageLabel"}),backgroundColor:t&&gg(t),strokeColor:t&&$g(t),strokeWidth:a&&fg(a),lineStart:o&&bg(o),lineEnd:o&&xg(o),color:t&&vg(t),fontFamily:i&&mg(i),fontStyle_fontWeight:n&&wg(n),fontSize:s&&Sg(s),lineHeight:l&&Cg(l),textAlign:r&&kg(r),cornerRadius:["defaultPercentage",{min:0,max:50,title:e=>e.shapeTitleCornerRadius}],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}]};return Object.entries(e).forEach((([e,t])=>{c[e]||(c[e]=t)})),c};function Tg(e){let t,o,i,n;const r=e[5].default,a=Zn(r,e,e[4],null);return{c(){t=hr("div"),a&&a.c(),xr(t,"class",e[0])},m(r,s){dr(r,t,s),a&&a.m(t,null),o=!0,i||(n=[fr(t,"measure",(function(){Vn(e[1]&&e[3])&&(e[1]&&e[3]).apply(this,arguments)})),er(e[2].call(null,t))],i=!0)},p(i,[n]){e=i,a&&a.p&&(!o||16&n)&&Yn(a,r,e,e[4],o?Gn(r,e[4],n,null):qn(e[4]),null),(!o||1&n)&&xr(t,"class",e[0])},i(e){o||(sa(a,e),o=!0)},o(e){la(a,e),o=!1},d(e){e&&ur(t),a&&a.d(e),i=!1,Wn(n)}}}function Pg(e,t,o){let{$$slots:i={},$$scope:n}=t;const r=Or();let{class:a=null}=t;const s=_r("measurable");let l=!1;return Fr((()=>o(1,l=!0))),e.$$set=e=>{"class"in e&&o(0,a=e.class),"$$scope"in e&&o(4,n=e.$$scope)},[a,l,s,({detail:e})=>r("measure",e),n,i]}class Rg extends wa{constructor(e){super(),va(this,e,Pg,Tg,Nn,{class:0})}}const Ig=e=>({}),Ag=e=>({}),Eg=e=>({}),Lg=e=>({}),Fg=e=>({}),zg=e=>({});function Dg(e){let t,o;const i=e[4].header,n=Zn(i,e,e[3],zg);return{c(){t=hr("div"),n&&n.c(),xr(t,"class","PinturaUtilHeader")},m(e,i){dr(e,t,i),n&&n.m(t,null),o=!0},p(e,t){n&&n.p&&(!o||8&t)&&Yn(n,i,e,e[3],o?Gn(i,e[3],t,Fg):qn(e[3]),zg)},i(e){o||(sa(n,e),o=!0)},o(e){la(n,e),o=!1},d(e){e&&ur(t),n&&n.d(e)}}}function Og(e){let t,o;const i=e[4].footer,n=Zn(i,e,e[3],Ag);return{c(){t=hr("div"),n&&n.c(),xr(t,"class","PinturaUtilFooter")},m(e,i){dr(e,t,i),n&&n.m(t,null),o=!0},p(e,t){n&&n.p&&(!o||8&t)&&Yn(n,i,e,e[3],o?Gn(i,e[3],t,Ig):qn(e[3]),Ag)},i(e){o||(sa(n,e),o=!0)},o(e){la(n,e),o=!1},d(e){e&&ur(t),n&&n.d(e)}}}function Bg(e){let t,o,i,n,r,a,s=e[1]&&Dg(e);const l=e[4].main,c=Zn(l,e,e[3],Lg),d=c||function(e){let t,o;return t=new Rg({props:{class:"PinturaStage"}}),t.$on("measure",e[5]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p:zn,i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}(e);let u=e[2]&&Og(e);return{c(){s&&s.c(),t=gr(),o=hr("div"),d&&d.c(),i=gr(),u&&u.c(),n=gr(),r=$r(),xr(o,"class","PinturaUtilMain")},m(l,c){s&&s.m(l,c),dr(l,t,c),dr(l,o,c),d&&d.m(o,null),e[6](o),dr(l,i,c),u&&u.m(l,c),dr(l,n,c),dr(l,r,c),a=!0},p(e,[o]){e[1]?s?(s.p(e,o),2&o&&sa(s,1)):(s=Dg(e),s.c(),sa(s,1),s.m(t.parentNode,t)):s&&(ra(),la(s,1,1,(()=>{s=null})),aa()),c&&c.p&&(!a||8&o)&&Yn(c,l,e,e[3],a?Gn(l,e[3],o,Eg):qn(e[3]),Lg),e[2]?u?(u.p(e,o),4&o&&sa(u,1)):(u=Og(e),u.c(),sa(u,1),u.m(n.parentNode,n)):u&&(ra(),la(u,1,1,(()=>{u=null})),aa())},i(e){a||(sa(s),sa(d,e),sa(u),sa(false),a=!0)},o(e){la(s),la(d,e),la(u),la(false),a=!1},d(a){s&&s.d(a),a&&ur(t),a&&ur(o),d&&d.d(a),e[6](null),a&&ur(i),u&&u.d(a),a&&ur(n),a&&ur(r)}}}function _g(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=On(On({},t),Kn(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=Kn(t),[s,r,a,n,i,function(t){Wr.call(this,e,t)},function(e){Nr[e?"unshift":"push"]((()=>{s=e,o(0,s)}))}]}class Wg extends wa{constructor(e){super(),va(this,e,_g,Bg,Nn,{hasHeader:1,hasFooter:2,root:0})}}function Vg(e){let t,o;return{c(){t=hr("div"),xr(t,"class","PinturaRangeInputMeter"),xr(t,"style",o=`transform: translateX(${e[9].x-e[11].x}px) translateY(${e[9].y-e[11].y}px)`)},m(o,i){dr(o,t,i),t.innerHTML=e[7]},p(e,i){128&i[0]&&(t.innerHTML=e[7]),512&i[0]&&o!==(o=`transform: translateX(${e[9].x-e[11].x}px) translateY(${e[9].y-e[11].y}px)`)&&xr(t,"style",o)},d(e){e&&ur(t)}}}function Ng(e){let t,o,i,n,r,a,s,l,c,d,u,h=e[9]&&Vg(e);return{c(){t=hr("div"),o=hr("span"),i=gr(),n=hr("button"),r=mr(e[1]),s=gr(),l=hr("div"),h&&h.c(),xr(o,"class","PinturaRangeInputValue"),xr(n,"class","PinturaRangeInputReset"),xr(n,"type","button"),n.disabled=a=e[0]===e[2],xr(l,"class","PinturaRangeInputInner"),xr(l,"style",e[8]),xr(l,"data-value-limited",e[5]),xr(t,"class","PinturaRangeInput"),xr(t,"tabindex","0")},m(a,p){dr(a,t,p),sr(t,o),o.innerHTML=e[3],sr(t,i),sr(t,n),sr(n,r),sr(t,s),sr(t,l),h&&h.m(l,null),d||(u=[fr(n,"click",e[16]),fr(l,"interactionstart",e[12]),fr(l,"interactionupdate",e[14]),fr(l,"interactionend",e[15]),fr(l,"interactionrelease",e[13]),er(c=Kc.call(null,l,{inertia:e[6]})),fr(l,"measure",e[36]),er(oc.call(null,l)),fr(t,"wheel",e[18],{passive:!1}),fr(t,"nudge",e[19]),er(Jc.call(null,t,{direction:"horizontal",preventDefault:!0}))],d=!0)},p(e,t){8&t[0]&&(o.innerHTML=e[3]),2&t[0]&&wr(r,e[1]),5&t[0]&&a!==(a=e[0]===e[2])&&(n.disabled=a),e[9]?h?h.p(e,t):(h=Vg(e),h.c(),h.m(l,null)):h&&(h.d(1),h=null),256&t[0]&&xr(l,"style",e[8]),32&t[0]&&xr(l,"data-value-limited",e[5]),c&&Vn(c.update)&&64&t[0]&&c.update.call(null,{inertia:e[6]})},i:zn,o:zn,d(e){e&&ur(t),h&&h.d(),d=!1,Wn(u)}}}function Hg(e,t,o){let i,n,r,s,l,c,d,u,h,{labelReset:p="Reset"}=t,{direction:m="x"}=t,{min:g=0}=t,{max:$=1}=t,{base:f=g}=t,{value:y=0}=t,{valueLabel:b=0}=t,{valueMin:x}=t,{valueMax:v}=t,{oninputstart:w=a}=t,{oninputmove:S=a}=t,{oninputend:k=a}=t,{elasticity:C=0}=t,{nudgeMultiplier:M}=t,{step:T=8}=t;const P=_r("isAnimated");Un(e,P,(e=>o(6,u=e)));const R=(e,t,o)=>Math.ceil((e-o)/t)*t+o;let I,A,E;const L={x:2,y:0},F=(e,t,o)=>`M ${e-o} ${t} a ${o} ${o} 0 1 0 0 -1`;let z,D=void 0,O=!1,B={snap:!1,elastic:!1};const _=(e,t,o)=>{const i=e[m]+t[m],n=Za(i,z[1][m],z[0][m]),r=C?n+Qc(i-n,C):n,a=o.elastic?r:n,s=ue(0,0);return s[m]=a,W.set(s,{hard:o.snap}),Za(N(s,m),g,$)},W=Wl();Un(e,W,(e=>o(9,h=e)));const V=(e,t)=>{const o=.5*(I[t]-s[t])-(Bu(e,g,$)*s[t]-.5*s[t]);return{x:"x"===t?o:0,y:"y"===t?o:0}},N=(e,t)=>{const o=-(e[t]-.5*I[t])/s[t];return g+o*i},H=W.subscribe((e=>{e&&D&&S(Za(N(e,m),g,$))})),j=e=>{const t=[V(null!=x?x:g,m),V(null!=v?v:$,m)],o={x:"x"===m?h.x+e:0,y:"y"===m?h.y+e:0},i=Za(o[m],t[1][m],t[0][m]),n={...h,[m]:i};Qn(W,h=n,h);const r=Za(N(n,m),g,$);w(),S(r),k(r)};Dr((()=>{H()}));return e.$$set=e=>{"labelReset"in e&&o(1,p=e.labelReset),"direction"in e&&o(20,m=e.direction),"min"in e&&o(21,g=e.min),"max"in e&&o(22,$=e.max),"base"in e&&o(2,f=e.base),"value"in e&&o(0,y=e.value),"valueLabel"in e&&o(3,b=e.valueLabel),"valueMin"in e&&o(23,x=e.valueMin),"valueMax"in e&&o(24,v=e.valueMax),"oninputstart"in e&&o(25,w=e.oninputstart),"oninputmove"in e&&o(26,S=e.oninputmove),"oninputend"in e&&o(27,k=e.oninputend),"elasticity"in e&&o(28,C=e.elasticity),"nudgeMultiplier"in e&&o(29,M=e.nudgeMultiplier),"step"in e&&o(30,T=e.step)},e.$$.update=()=>{if(6291456&e.$$.dirty[0]&&o(32,i=$-g),10485760&e.$$.dirty[0]&&o(34,n=null!=x?Math.max(x,g):g),20971520&e.$$.dirty[0]&&o(33,r=null!=v?Math.min(v,$):$),6291460&e.$$.dirty[0]&&o(35,l=Bu(f,g,$)),16&e.$$.dirty[0]|16&e.$$.dirty[1]&&I){const e=.5*I.y;let t,i=40*l,n="",r=I.y,a="";for(let o=0;o<=40;o++){const r=L.x+10*o,s=e;n+=F(r,s,o%5==0?2:.75)+" ",t=r+L.x,o===i&&(a=`<path d="M${r} ${s-4} l2 3 l-2 -1 l-2 1 z"/>`)}o(7,A=`<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(31,E={x:t-2*L.x,y:r})}16&e.$$.dirty[0]|1&e.$$.dirty[1]&&(s=I&&E),6291456&e.$$.dirty[0]|12&e.$$.dirty[1]&&o(5,c=n!==g||r!==$),32&e.$$.dirty[0]|12&e.$$.dirty[1]&&o(8,d=c?function(e,t){const o=1/40,i=Bu(e,g,$),n=Bu(t,g,$);return`--range-mask-from:${100*se(R(i,o,0)-.0125)}%;--range-mask-to:${100*se(R(n,o,0)-.0125)}%`}(n,r):""),1048657&e.$$.dirty[0]|2&e.$$.dirty[1]&&i&&I&&I.x&&I.y&&W.set(V(y,m),{hard:!1===u})},[y,p,f,b,I,c,u,A,d,h,P,L,()=>{O=!1,D=jn(W),z=[V(null!=x?x:g,m),V(null!=v?v:$,m)],w()},()=>{O=!0},({detail:e})=>{B.snap=!O,B.elastic=!O,_(D,e.translation,B)},({detail:e})=>{B.snap=!1,B.elastic=!1;const t=_(D,e.translation,B);if(D=void 0,z=void 0,Math.abs(t-f)<.01)return k(f);k(t)},()=>{o(0,y=Za(f,n,r)),w(),k(y)},W,e=>{e.preventDefault(),e.stopPropagation();const t=id(e)*T;j(t)},({detail:e})=>{j(e[m]*Math.abs(M||8))},m,g,$,x,v,w,S,k,C,M,T,E,i,r,n,l,e=>o(4,I=(e=>ue(e.width,e.height))(e.detail))]}class jg extends wa{constructor(e){super(),va(this,e,Hg,Ng,Nn,{labelReset:1,direction:20,min:21,max:22,base:2,value:0,valueLabel:3,valueMin:23,valueMax:24,oninputstart:25,oninputmove:26,oninputend:27,elasticity:28,nudgeMultiplier:29,step:30},null,[-1,-1])}}function Ug(e){let t,o,i,n,r;const a=e[7].default,s=Zn(a,e,e[6],null);return{c(){t=hr("div"),o=hr("div"),s&&s.c(),xr(o,"class","PinturaToolbarInner"),xr(t,"class","PinturaToolbar"),xr(t,"data-layout",e[1]),xr(t,"data-overflow",e[0])},m(a,l){dr(a,t,l),sr(t,o),s&&s.m(o,null),i=!0,n||(r=[fr(o,"measure",e[3]),er(oc.call(null,o)),fr(t,"measure",e[2]),er(oc.call(null,t))],n=!0)},p(e,[o]){s&&s.p&&(!i||64&o)&&Yn(s,a,e,e[6],i?Gn(a,e[6],o,null):qn(e[6]),null),(!i||2&o)&&xr(t,"data-layout",e[1]),(!i||1&o)&&xr(t,"data-overflow",e[0])},i(e){i||(sa(s,e),i=!0)},o(e){la(s,e),i=!1},d(e){e&&ur(t),s&&s.d(e),n=!1,Wn(r)}}}function Zg(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 Xg extends wa{constructor(e){super(),va(this,e,Zg,Ug,Nn,{})}}var Gg={[J]:e=>({x:e.x,y:e.y}),[ie]:e=>({x:e.x+e.width,y:e.y}),[Q]:e=>({x:e.x+e.width,y:e.y}),[ne]:e=>({x:e.x+e.width,y:e.y+e.height}),[ee]:e=>({x:e.x,y:e.y+e.height}),[re]:e=>({x:e.x,y:e.y+e.height}),[te]:e=>({x:e.x,y:e.y}),[oe]:e=>({x:e.x,y:e.y})};function Yg(e,t,o){const i=e.slice();return i[14]=t[o].key,i[15]=t[o].translate,i[16]=t[o].scale,i[17]=t[o].type,i[18]=t[o].opacity,i}function qg(e,t){let o,i,n,r,a,s,l,c;return{key:e,first:null,c(){o=hr("div"),xr(o,"role","button"),xr(o,"aria-label",i=`Drag ${t[17]} ${t[14]}`),xr(o,"tabindex",n="edge"===t[17]?-1:0),xr(o,"class","PinturaRectManipulator"),xr(o,"data-direction",r=t[14]),xr(o,"data-shape",a=""+("edge"===t[17]?"edge":""+t[0])),xr(o,"style",s=`--tx:${t[15].x};--ty:${t[15].y};--sx:${t[16].x};--sy:${t[16].y};opacity:${t[18]}`),this.first=o},m(e,i){dr(e,o,i),l||(c=[fr(o,"nudge",(function(){Vn(t[6](t[14]))&&t[6](t[14]).apply(this,arguments)})),er(Jc.call(null,o,{preventDefault:!0})),fr(o,"interactionstart",(function(){Vn(t[5]("resizestart",t[14]))&&t[5]("resizestart",t[14]).apply(this,arguments)})),fr(o,"interactionupdate",(function(){Vn(t[5]("resizemove",t[14]))&&t[5]("resizemove",t[14]).apply(this,arguments)})),fr(o,"interactionend",(function(){Vn(t[5]("resizeend",t[14]))&&t[5]("resizeend",t[14]).apply(this,arguments)})),er(Kc.call(null,o))],l=!0)},p(e,l){t=e,2&l&&i!==(i=`Drag ${t[17]} ${t[14]}`)&&xr(o,"aria-label",i),2&l&&n!==(n="edge"===t[17]?-1:0)&&xr(o,"tabindex",n),2&l&&r!==(r=t[14])&&xr(o,"data-direction",r),3&l&&a!==(a=""+("edge"===t[17]?"edge":""+t[0]))&&xr(o,"data-shape",a),2&l&&s!==(s=`--tx:${t[15].x};--ty:${t[15].y};--sx:${t[16].x};--sy:${t[16].y};opacity:${t[18]}`)&&xr(o,"style",s)},d(e){e&&ur(o),l=!1,Wn(c)}}}function Kg(e){let t,o=[],i=new Map,n=e[1];const r=e=>e[14];for(let t=0;t<n.length;t+=1){let a=Yg(e,n,t),s=r(a);i.set(s,o[t]=qg(s,a))}return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=$r()},m(e,i){for(let t=0;t<o.length;t+=1)o[t].m(e,i);dr(e,t,i)},p(e,[a]){99&a&&(n=e[1],o=ma(o,a,r,1,e,n,i,t.parentNode,ha,qg,t,Yg))},i:zn,o:zn,d(e){for(let t=0;t<o.length;t+=1)o[t].d(e);e&&ur(t)}}}function Jg(e,t,o){let i,n,r,a,{rect:s=null}=t,{visible:l=!1}=t,{style:c}=t;const d=_r("isAnimated");Un(e,d,(e=>o(11,a=e)));const u=Wl(void 0,{precision:1e-4,stiffness:.2,damping:.4});Un(e,u,(e=>o(10,r=e)));const h=Wl(0,{precision:.001});let p;Un(e,h,(e=>o(9,n=e)));const m=Or();return e.$$set=e=>{"rect"in e&&o(7,s=e.rect),"visible"in e&&o(8,l=e.visible),"style"in e&&o(0,c=e.style)},e.$$.update=()=>{2304&e.$$.dirty&&u.set(l?1:.5,{hard:!1===a}),2304&e.$$.dirty&&h.set(l?1:0,{hard:!1===a}),1664&e.$$.dirty&&o(1,i=Object.keys(K).map(((e,t)=>{const o=K[e],i=Gg[o](s),a=1===o.length?"edge":"corner",l="corner"===a;return{key:o,type:a,scale:{x:/^(t|b)$/.test(o)?s.width:l?Za(r,.5,1.25):1,y:/^(r|l)$/.test(o)?s.height:l?Za(r,.5,1.25):1},translate:{x:i.x,y:i.y},opacity:n}})))},[c,i,d,u,h,(e,t)=>({detail:o})=>{p&&t!==p||"resizestart"!==e&&void 0===p||("resizestart"===e&&(p=t),"resizeend"===e&&(p=void 0),m(e,{direction:t,translation:o&&o.translation}))},e=>({detail:t})=>{m("resizestart",{direction:e,translation:{x:0,y:0}}),m("resizemove",{direction:e,translation:t}),m("resizeend",{direction:e,translation:{x:0,y:0}})},s,l,n,r,a]}class Qg extends wa{constructor(e){super(),va(this,e,Jg,Kg,Nn,{rect:7,visible:8,style:0})}}var e$=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)}}},t$={[J]:ee,[Q]:te,[ee]:J,[te]:Q,[oe]:ne,[ie]:re,[ne]:oe,[re]:ie},o$=e=>{const t=e===te||e===Q,o=e===J||e===ee;return[e===Q||e===ie||e===ne,e===te||e===re||e===oe,e===J||e===ie||e===oe,e===ee||e===ne||e===re,t,o,t||o]},i$=(e,t,o,i={})=>{const{target:n,translate:r}=t,{aspectRatio:a,minSize:s,maxSize:l}=i,c=ae[t$[n]],d=ve(ue(e.x,e.y),ue(c[0]*e.width,c[1]*e.height)),u=ae[n],h=ve(Ke(e),ue(u[0]*e.width,u[1]*e.height)),[p,m,g,$,f,y,b]=o$(n);let x=r.x,v=r.y;f?v=0:y&&(x=0);const{inner:w,outer:S}=n$(d,n,o,{aspectRatio:a,minSize:s,maxSize:l});let[k,C,M,T]=xt(e);if(p?T=d.x:m&&(C=d.x),$?k=d.y:g&&(M=d.y),p){const e=w.x+w.width,t=S.x+S.width;C=Za(h.x+x,e,t)}else if(m){const e=S.x,t=w.x;T=Za(h.x+x,e,t)}if($){const e=w.y+w.height,t=S.y+S.height;M=Za(h.y+v,e,t)}else if(g){const e=S.y,t=w.y;k=Za(h.y+v,e,t)}if(T>w.x&&(T=w.x),C<w.x+w.width&&(C=w.x+w.width),k>w.y&&(k=w.y),M<w.y+w.height&&(M=w.y+w.height),T<S.x){const e=S.x-T;T=S.x,C+=e}if(C>S.x+S.width){const e=C-(S.x+S.width);C=S.x+S.width,T-=e}if(k<S.y){const e=S.y-k;k=S.y,M+=e}if(M>S.y+S.height){const e=M-(S.y+S.height);M=S.y+S.height,k-=e}if(a)if(b){let e=C-T,t=M-k;f?(t=e/a,k=d.y-.5*t,M=d.y+.5*t):y&&(e=t*a,T=d.x-.5*e,C=d.x+.5*e)}else{const e=ue(h.x+x-d.x,h.y+v-d.y);n===ie?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):n===ne?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):n===re?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):n===oe&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=$e(e),o=$e(ue(w.width,w.height)),i=$e(ue(S.width,S.height)),r=Za(t,o,i),s=ue(a,1),l=ke(fe(s),r);n===ie?(C=d.x+l.x,k=d.y-l.y):n===ne?(C=d.x+l.x,M=d.y+l.y):n===re?(T=d.x-l.x,M=d.y+l.y):n===oe&&(T=d.x-l.x,k=d.y-l.y)}return nt(T,k,C-T,M-k)};const n$=(e,t,o,i)=>{const{aspectRatio:n,minSize:r,maxSize:a}=i,s=t===Q||t===ie||t===ne,l=t===te||t===re||t===oe,c=t===J||t===ie||t===oe,d=t===ee||t===ne||t===re,u=t===te||t===Q,h=t===J||t===ee,p=Ke(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=((e,t)=>qe(0,0,e,t))(Math.min(p.width,a.width),Math.min(p.height,a.height));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 g=n?De(yt(Qe(r),n)):r,$=n?De(bt(m,n)):m;let f,y,b,x;s?f=e.x:l&&(y=e.x),d?b=e.y:c&&(x=e.y),s?y=f+g.width:l&&(f=y-g.width),d?x=b+g.height:c&&(b=x-g.height),u?(b=e.y-.5*g.height,x=e.y+.5*g.height):h&&(f=e.x-.5*g.width,y=e.x+.5*g.width);const v=tt([ue(f,b),ue(y,x)]);s?y=f+$.width:l&&(f=y-$.width),d?x=b+$.height:c&&(b=x-$.height),u?(b=e.y-.5*$.height,x=e.y+.5*$.height):h&&(f=e.x-.5*$.width,y=e.x+.5*$.width),f=Math.max(o.x,f),y=Math.min(o.x+o.width,y),b=Math.max(o.y,b),x=Math.min(o.y+o.height,x);return{inner:v,outer:tt([ue(f,b),ue(y,x)])}};var r$=e=>180*e/Math.PI;function a$(e){let t,o,i;return o=new jg({props:{elasticity:e[5],min:e[9],max:e[10],value:e[11],valueMin:Math.max(e[9],e[0]),valueMax:Math.min(e[10],e[1]),labelReset:e[6],base:e[12],valueLabel:Math.round(r$(e[11]))+"&deg;",oninputstart:e[2],oninputmove:e[17],oninputend:e[18]}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"class","PinturaImageRotator")},m(e,n){dr(e,t,n),ba(o,t,null),i=!0},p(e,[t]){const i={};32&t&&(i.elasticity=e[5]),512&t&&(i.min=e[9]),1024&t&&(i.max=e[10]),2048&t&&(i.value=e[11]),513&t&&(i.valueMin=Math.max(e[9],e[0])),1026&t&&(i.valueMax=Math.min(e[10],e[1])),64&t&&(i.labelReset=e[6]),4096&t&&(i.base=e[12]),2048&t&&(i.valueLabel=Math.round(r$(e[11]))+"&deg;"),4&t&&(i.oninputstart=e[2]),392&t&&(i.oninputmove=e[17]),400&t&&(i.oninputend=e[18]),o.$set(i)},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o)}}}function s$(e,t,o){let i,n,r,s,l,c,d,{rotation:u}=t,{valueMin:h}=t,{valueMax:p}=t,{oninputstart:m=a}=t,{oninputmove:g=a}=t,{oninputend:$=a}=t,{elasticity:f=0}=t,{labelReset:y}=t,{rotationMin:b}=t,{rotationMax:x}=t;return e.$$set=e=>{"rotation"in e&&o(13,u=e.rotation),"valueMin"in e&&o(0,h=e.valueMin),"valueMax"in e&&o(1,p=e.valueMax),"oninputstart"in e&&o(2,m=e.oninputstart),"oninputmove"in e&&o(3,g=e.oninputmove),"oninputend"in e&&o(4,$=e.oninputend),"elasticity"in e&&o(5,f=e.elasticity),"labelReset"in e&&o(6,y=e.labelReset),"rotationMin"in e&&o(14,b=e.rotationMin),"rotationMax"in e&&o(15,x=e.rotationMax)},e.$$.update=()=>{16384&e.$$.dirty&&o(9,i=b+1e-9),32768&e.$$.dirty&&o(10,n=x-1e-9),1536&e.$$.dirty&&o(12,r=i+.5*(n-i)),32768&e.$$.dirty&&o(16,s=2*x),8192&e.$$.dirty&&o(8,l=Math.sign(u)),73728&e.$$.dirty&&o(7,c=Math.round(Math.abs(u)/s)*s),8576&e.$$.dirty&&o(11,d=u-l*c)},[h,p,m,g,$,f,y,c,l,i,n,d,r,u,b,x,s,e=>g(l*c+e),e=>$(l*c+e)]}class l$ extends wa{constructor(e){super(),va(this,e,s$,a$,Nn,{rotation:13,valueMin:0,valueMax:1,oninputstart:2,oninputmove:3,oninputend:4,elasticity:5,labelReset:6,rotationMin:14,rotationMax:15})}}function c$(e){let t,o,i,n,r;return{c(){t=hr("div"),o=hr("p"),i=mr(e[0]),n=mr(" × "),r=mr(e[1]),xr(t,"class","PinturaImageInfo")},m(e,a){dr(e,t,a),sr(t,o),sr(o,i),sr(o,n),sr(o,r)},p(e,[t]){1&t&&wr(i,e[0]),2&t&&wr(r,e[1])},i:zn,o:zn,d(e){e&&ur(t)}}}function d$(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 u$ extends wa{constructor(e){super(),va(this,e,d$,c$,Nn,{width:0,height:1})}}function h$(e){let t,o;return t=new bu({props:{class:"PinturaPresetListFilter",layout:"row",options:e[8],selectedIndex:e[7],onchange:e[10]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};256&o&&(i.options=e[8]),128&o&&(i.selectedIndex=e[7]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function p$(e){let t,o;return t=new Lu({props:{icon:e[0],label:e[1],labelClass:e[2],hideLabel:e[3],options:e[9],selectedIndex:e[4],onchange:e[5],optionMapper:e[6],$$slots:{controls:[h$]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,[o]){const i={};1&o&&(i.icon=e[0]),2&o&&(i.label=e[1]),4&o&&(i.labelClass=e[2]),8&o&&(i.hideLabel=e[3]),512&o&&(i.options=e[9]),16&o&&(i.selectedIndex=e[4]),32&o&&(i.onchange=e[5]),64&o&&(i.optionMapper=e[6]),262528&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}const m$='fill="none" stroke="currentColor"';function g$(e,t,o){let i,n,r,{icon:s}=t,{label:l}=t,{labelClass:c}=t,{hideLabel:d}=t,{options:u}=t,{selectedIndex:h}=t,{onchange:p}=t,{optionMapper:m}=t,{filter:g="landscape"}=t,{onfilterchange:$=a}=t;const f=(e,t,o,i,n)=>`\n    <rect ${m$} x="${e}" y="${t}" width="${o}" height="${i}" rx="${n}"/>`,y=(e,t)=>`<path ${m$} d="M${e} ${t} l2 2 l3 -4"/>`;return e.$$set=e=>{"icon"in e&&o(0,s=e.icon),"label"in e&&o(1,l=e.label),"labelClass"in e&&o(2,c=e.labelClass),"hideLabel"in e&&o(3,d=e.hideLabel),"options"in e&&o(12,u=e.options),"selectedIndex"in e&&o(4,h=e.selectedIndex),"onchange"in e&&o(5,p=e.onchange),"optionMapper"in e&&o(6,m=e.optionMapper),"filter"in e&&o(11,g=e.filter),"onfilterchange"in e&&o(13,$=e.onfilterchange)},e.$$.update=()=>{6144&e.$$.dirty&&o(9,i=((e,t)=>(e||[]).map((e=>P(e[0])?(e[1]=e[1].map(t),e):t(e))))(u,(e=>t=>{const[o,i,n={}]=t;return Mo(o)&&(n.hidden="landscape"===e?o<1:o>1),[o,i,n]})(g))),2048&e.$$.dirty&&o(7,n="landscape"===g?0:1),128&e.$$.dirty&&o(8,r=[["landscape","Landscape",{hideLabel:!0,icon:f(2,6,19,12,2)+(0===n?y(9,12):"")}],["portrait","Portrait",{hideLabel:!0,icon:f(5,3,13,18,2)+(1===n?y(9,12):"")}]])},[s,l,c,d,h,p,m,n,r,i,e=>{o(11,g=e.value),$(e.value)},g,u,$]}class $$ extends wa{constructor(e){super(),va(this,e,g$,p$,Nn,{icon:0,label:1,labelClass:2,hideLabel:3,options:12,selectedIndex:4,onchange:5,optionMapper:6,filter:11,onfilterchange:13})}}const f$=e=>xe(e,(e=>se(e,6))),y$=e=>wt(e,(e=>se(e,6))),b$=(e,t,o=1e-4)=>Math.abs(e-t)<o;var x$=(e,t,o,i,n={})=>{const{aspectRatio:r}=n;e=y$(e),i=i.map(f$);const a=ct(e,t$[o.target]),s=xe(a,(e=>se(e,6))),l=r?yt(n.minSize,r):n.minSize,c=r?bt(n.maxSize,r):n.maxSize,d=ct(t,o.target);if(Pe(d,a)<1){t=Ke(e);const o=Math.min(l.width/e.width,l.height/e.height);st(t,o,a)}t=lt(Ke(t),l,c,a);let u=Ke(t);t=y$(t);const h=At(i,1),p=vt(e),m=vt(t),g=p.findIndex((e=>be(xe(e,(e=>se(e,6))),s))),$=e=>h.map((t=>Mt(t,e))).filter(Boolean).pop();if(r){const t=m.map(((e,t)=>{if(t===g)return;const o=ue(a.x-e.x,a.y-e.y);fe(o),ke(o,.5);const i=ue(a.x-o.x,a.y-o.y),n=Ze(i,f$(e)),r=$(n);if(!r)return;const s=p[t];return{intersection:r,cornerDist:Pe(a,s),intersectionDist:Pe(a,r)}})).filter(Boolean);if(t.length){const o=t.reduce(((e,t)=>{const o=t.intersectionDist/t.cornerDist;return o<e?o:e}),Number.MAX_SAFE_INTEGER);u=Ke(e),st(u,o,a)}}else{const e=1===o.target.length,n=!(i[0].y===i[1].y||i[0].x===i[1].x),r=p.map(((t,o)=>{if(o===g)return;const i=m[o],r=!b$(i.x,s.x)&&!b$(i.y,s.y);if(!e&&!n&&r)return;if(e&&(b$(i.x,s.x)||b$(i.y,s.y)))return;const l=pe(e?t:a),c=we(pe(l),i);fe(c),ke(c,.5),e?ve(l,c):we(l,c);const d=Ze(l,i),u=$(d);return u||void 0})).filter(Boolean);if(r.length){const[e,i,n,l]=o$(o.target);let[c,d,h,p]=xt(t);r.forEach((({x:t,y:o})=>{const r=se(t,6),a=se(o,6);n&&!b$(a,s.y)&&(c=Math.max(c,o)),e&&!b$(r,s.x)&&(d=Math.min(d,t)),l&&!b$(a,s.y)&&(h=Math.min(h,o)),i&&!b$(r,s.x)&&(p=Math.max(p,t))})),u=qe((f=[c,d,h,p])[3],f[0],f[1]-f[3],f[2]-f[0]),st(u,.9999,a)}}var f;return lt(u,l,c,a),u};function v$(e){let t,o;return t=new dh({props:{items:e[11]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};2048&o[0]&&(i.items=e[11]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function w$(e){let t,o,i;return o=new Xg({props:{$$slots:{default:[v$]},$$scope:{ctx:e}}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"slot","header")},m(e,n){dr(e,t,n),ba(o,t,null),i=!0},p(e,t){const i={};2048&t[0]|1&t[7]&&(i.$$scope={dirty:t,ctx:e}),o.$set(i)},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o)}}}function S$(e){let t,o;return t=new Gc({props:{onclick:e[88],label:e[4].cropLabelButtonRecenter,icon:e[4].cropIconButtonRecenter,class:"PinturaButtonCenter",disabled:!e[9],hideLabel:!0,style:`opacity: ${e[29]}; transform: translate3d(${e[30].x}px, ${e[30].y}px, 0)`}}),{c(){ya(t.$$.fragment)},m(e,i){ba(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),512&o[0]&&(i.disabled=!e[9]),1610612736&o[0]&&(i.style=`opacity: ${e[29]}; transform: translate3d(${e[30].x}px, ${e[30].y}px, 0)`),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function k$(e){let t,o;return t=new Qg({props:{rect:e[8],visible:e[12],style:e[1]}}),t.$on("resizestart",e[68]),t.$on("resizemove",e[69]),t.$on("resizeend",e[70]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};256&o[0]&&(i.rect=e[8]),4096&o[0]&&(i.visible=e[12]),2&o[0]&&(i.style=e[1]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function C$(e){let t,o;return t=new u$({props:{width:Math.round(e[13].width),height:Math.round(e[13].height)}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};8192&o[0]&&(i.width=Math.round(e[13].width)),8192&o[0]&&(i.height=Math.round(e[13].height)),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function M$(e){let t,o,i,n,r,a,s,l,c=e[21]&&e[10]&&S$(e),d=e[21]&&k$(e),u=e[22]&&C$(e);return{c(){t=hr("div"),o=hr("div"),c&&c.c(),i=gr(),d&&d.c(),r=gr(),u&&u.c(),xr(o,"class","PinturaStage"),xr(t,"slot","main")},m(h,p){dr(h,t,p),sr(t,o),c&&c.m(o,null),sr(o,i),d&&d.m(o,null),e[162](o),sr(t,r),u&&u.m(t,null),a=!0,s||(l=[er(oc.call(null,o)),fr(o,"measure",e[160]),fr(o,"wheel",(function(){Vn(e[2]&&e[87])&&(e[2]&&e[87]).apply(this,arguments)}),{passive:!1}),fr(o,"interactionstart",e[74]),fr(o,"interactionupdate",e[75]),fr(o,"interactionrelease",e[77]),fr(o,"interactionend",e[76]),er(n=Kc.call(null,o,{drag:!0,inertia:!0,pinch:e[2],shouldStartInteraction:D$,getEventPosition:e[163]})),fr(o,"gesturedown",e[84]),fr(o,"gestureupdate",e[85]),fr(o,"gestureup",e[86]),er(e$.call(null,o))],s=!0)},p(r,a){(e=r)[21]&&e[10]?c?(c.p(e,a),2098176&a[0]&&sa(c,1)):(c=S$(e),c.c(),sa(c,1),c.m(o,i)):c&&(ra(),la(c,1,1,(()=>{c=null})),aa()),e[21]?d?(d.p(e,a),2097152&a[0]&&sa(d,1)):(d=k$(e),d.c(),sa(d,1),d.m(o,null)):d&&(ra(),la(d,1,1,(()=>{d=null})),aa()),n&&Vn(n.update)&&16777220&a[0]&&n.update.call(null,{drag:!0,inertia:!0,pinch:e[2],shouldStartInteraction:D$,getEventPosition:e[163]}),e[22]?u?(u.p(e,a),4194304&a[0]&&sa(u,1)):(u=C$(e),u.c(),sa(u,1),u.m(t,null)):u&&(ra(),la(u,1,1,(()=>{u=null})),aa())},i(e){a||(sa(c),sa(d),sa(u),a=!0)},o(e){la(c),la(d),la(u),a=!1},d(o){o&&ur(t),c&&c.d(),d&&d.d(),e[162](null),u&&u.d(),s=!1,Wn(l)}}}function T$(e){let t,o,i,n;const r=[{class:"PinturaControlList"},{tabs:e[7]},e[18]];let a={$$slots:{default:[P$,({tab:e})=>({216:e}),({tab:e})=>[0,0,0,0,0,0,e?1073741824:0]]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=On(a,r[e]);t=new xc({props:a}),t.$on("select",e[161]);const s=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[17]},e[18]];let l={$$slots:{default:[A$,({panel:e})=>({215:e}),({panel:e})=>[0,0,0,0,0,0,e?536870912:0]]},$$scope:{ctx:e}};for(let e=0;e<s.length;e+=1)l=On(l,s[e]);return i=new Ec({props:l}),{c(){ya(t.$$.fragment),o=gr(),ya(i.$$.fragment)},m(e,r){ba(t,e,r),dr(e,o,r),ba(i,e,r),n=!0},p(e,o){const n=262272&o[0]?ga(r,[r[0],128&o[0]&&{tabs:e[7]},262144&o[0]&&$a(e[18])]):{};1073741824&o[6]|1&o[7]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n);const a=393216&o[0]?ga(s,[s[0],s[1],131072&o[0]&&{panels:e[17]},262144&o[0]&&$a(e[18])]):{};511721496&o[0]|536870912&o[6]|1&o[7]&&(a.$$scope={dirty:o,ctx:e}),i.$set(a)},i(e){n||(sa(t.$$.fragment,e),sa(i.$$.fragment,e),n=!0)},o(e){la(t.$$.fragment,e),la(i.$$.fragment,e),n=!1},d(e){xa(t,e),e&&ur(o),xa(i,e)}}}function P$(e){let t,o,i=e[216].label+"";return{c(){t=hr("span"),o=mr(i)},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){1073741824&t[6]&&i!==(i=e[216].label+"")&&wr(o,i)},d(e){e&&ur(t)}}}function R$(e){let t,o;return t=new jg({props:{elasticity:e[25]*e[43],base:z$,min:e[23],max:F$,valueMin:e[27][0],valueMax:e[27][1],value:e[28],labelReset:e[4].labelReset,valueLabel:Math.round(100*e[28])+"%",oninputstart:e[81],oninputmove:e[82],oninputend:e[83]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};33554432&o[0]&&(i.elasticity=e[25]*e[43]),8388608&o[0]&&(i.min=e[23]),134217728&o[0]&&(i.valueMin=e[27][0]),134217728&o[0]&&(i.valueMax=e[27][1]),268435456&o[0]&&(i.value=e[28]),16&o[0]&&(i.labelReset=e[4].labelReset),268435456&o[0]&&(i.valueLabel=Math.round(100*e[28])+"%"),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function I$(e){let t,o;return t=new l$({props:{elasticity:e[25]*e[43],rotation:e[14],labelReset:e[4].labelReset,valueMin:e[26][0],valueMax:e[26][1],rotationMin:-e[3],rotationMax:e[3],oninputstart:e[71],oninputmove:e[72],oninputend:e[73]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};33554432&o[0]&&(i.elasticity=e[25]*e[43]),16384&o[0]&&(i.rotation=e[14]),16&o[0]&&(i.labelReset=e[4].labelReset),67108864&o[0]&&(i.valueMin=e[26][0]),67108864&o[0]&&(i.valueMax=e[26][1]),8&o[0]&&(i.rotationMin=-e[3]),8&o[0]&&(i.rotationMax=e[3]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function A$(e){let t,o,i,n;const r=[I$,R$],a=[];function s(e,t){return e[215]===e[93]+"-rotation"?0:e[215]===e[93]+"-zoom"?1:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=$r()},m(e,o){~t&&a[t].m(e,o),dr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(ra(),la(a[l],1,1,(()=>{a[l]=null})),aa()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sa(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(sa(o),n=!0)},o(e){la(o),n=!1},d(e){~t&&a[t].d(e),e&&ur(i)}}}function E$(e){let t,o,i=e[19]&&T$(e);return{c(){t=hr("div"),i&&i.c(),xr(t,"slot","footer"),xr(t,"style",e[16])},m(e,n){dr(e,t,n),i&&i.m(t,null),o=!0},p(e,n){e[19]?i?(i.p(e,n),524288&n[0]&&sa(i,1)):(i=T$(e),i.c(),sa(i,1),i.m(t,null)):i&&(ra(),la(i,1,1,(()=>{i=null})),aa()),(!o||65536&n[0])&&xr(t,"style",e[16])},i(e){o||(sa(i),o=!0)},o(e){la(i),o=!1},d(e){e&&ur(t),i&&i.d()}}}function L$(e){let t,o,i;function n(t){e[164](t)}let r={hasHeader:e[20],$$slots:{footer:[E$],main:[M$],header:[w$]},$$scope:{ctx:e}};return void 0!==e[15]&&(r.root=e[15]),t=new Wg({props:r}),Nr.push((()=>fa(t,"root",n))),t.$on("measure",e[165]),{c(){ya(t.$$.fragment)},m(e,o){ba(t,e,o),i=!0},p(e,i){const n={};1048576&i[0]&&(n.hasHeader=e[20]),2146402302&i[0]|1&i[7]&&(n.$$scope={dirty:i,ctx:e}),!o&&32768&i[0]&&(o=!0,n.root=e[15],qr((()=>o=!1))),t.$set(n)},i(e){i||(sa(t.$$.fragment,e),i=!0)},o(e){la(t.$$.fragment,e),i=!1},d(e){xa(t,e)}}}const F$=1,z$=0,D$=(e,t)=>e.target===t;function O$(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,R,I,A,E,F,z,D,O,B,_,W,V,N,H,j,X,G,K,J,Q,ee,te,le,ce,de,he,ge,ye,xe,Se,Ce,Me,Te,Pe,Re,Ie,Ae,Ee,Le,ze,Be,We,Ze,Xe,Ge,Ye,qe=zn,Je=()=>(qe(),qe=Hn(et,(e=>o(12,A=e))),et);e.$$.on_destroy.push((()=>qe()));let{isActive:et}=t;Je();let{stores:tt}=t,{cropImageSelectionCornerStyle:ot="circle"}=t,{cropWillRenderImageSelectionGuides:lt=((e,t)=>{const o="rotate"==e;return{rows:o?5:3,cols:o?5:3,opacity:.25*t}})}=t,{cropAutoCenterImageSelectionTimeout:ct}=t,{cropEnableZoomMatchImageAspectRatio:pt=!0}=t,{cropEnableRotateMatchImageAspectRatio:mt="never"}=t,{cropEnableRotationInput:gt=!0}=t,{cropEnableZoom:vt=!0}=t,{cropEnableZoomInput:St=!0}=t,{cropEnableZoomAutoHide:kt=!0}=t,{cropEnableImageSelection:Ct=!0}=t,{cropEnableInfoIndicator:Mt=!1}=t,{cropEnableZoomTowardsWheelPosition:Tt=!0}=t,{cropEnableLimitWheelInputToCropSelection:Pt=!0}=t,{cropEnableCenterImageSelection:Rt=!0}=t,{cropEnableButtonRotateLeft:It=!0}=t,{cropEnableButtonRotateRight:At=!1}=t,{cropEnableButtonFlipHorizontal:Et=!0}=t,{cropEnableButtonFlipVertical:Lt=!1}=t,{cropSelectPresetOptions:Ft}=t,{cropEnableSelectPreset:zt=!0}=t,{cropEnableFilterMatchAspectRatio:Dt=!0}=t,{cropSelectPresetFilter:Ot=!1}=t,{cropEnableButtonToggleCropLimit:Bt=!1}=t,{cropWillRenderTools:_t=Z}=t,{cropActiveTransformTool:Wt="rotation"}=t,{cropMinimizeToolbar:Vt="auto"}=t,{cropInteractionFocus:Nt="image"}=t,{cropRotationRange:Ht=Y}=t,{cropMaskOpacity:jt=.85}=t,{locale:Ut={}}=t;const Zt=_r("isAnimated");Un(e,Zt,(e=>o(139,E=e)));const Xt=_r("elasticityMultiplier");Un(e,Xt,(e=>o(25,Be=e)));const Gt=_r("redrawTrigger");Un(e,Gt,(e=>o(159,ze=e)));const Yt=_r("imageIsStatic");Un(e,Yt,(e=>o(145,V=e)));const qt=_r("imageStaticVisualCorners");Un(e,qt,(e=>o(181,Me=e)));let Kt="idle";const Jt=Ca();Un(e,Jt,(e=>o(156,Ae=e)));const Qt=()=>void 0===Se,eo=e=>1/e,to=e=>{Dt&&Ot!==e&&(o(95,Ot=e),Se&&1!==Se&&oo()&&Qn(Wo,Se=eo(Se),Se))},oo=()=>{if(1===Se||!i)return!1;const e=eo(Se);return!!Hd(Ae).find((([t])=>t===e))},io=(e,t,o)=>q(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),no=()=>(Qt()||"always"===mt&&oo())&&((e,t,o)=>{const i=Ue(He(Fe(t),o),(e=>Math.abs(Math.round(e)))),n=Ne(i),r=rt(e);return be(n,r)})(N,te,le)&&io(N,te,le),ro=e=>{if("never"!==mt&&no()){Qn(Mo,le+=e,le);const t=q(le),o=t?te.height:te.width,i=t?te.width:te.height;Qn(Do,N=nt(0,0,o,i),N),Qt()||Qn(Wo,Se=U(o,i),Se)}else Qn(Mo,le+=e,le)},{history:ao,env:so,isInteracting:lo,isInteractingFraction:co,isTransformingImage:uo,rootRect:ho,stageRect:po,utilRect:mo,utilRectPadded:go,rootLineColor:$o,allowPan:fo,allowZoom:yo,rangeInputElasticity:bo,presentationScalar:xo,utilTools:vo,imagePreviewModifiers:wo,imageOutlineOpacity:So,imageFlipX:ko,imageFlipY:Co,imageRotation:Mo,imageRotationRange:To,imageOutputSize:Po,imageSelectionRect:Io,imageSelectionRectSnapshot:Ao,imageSelectionRectIntent:Eo,imageSelectionRectPresentation:Lo,imageCropRectIntent:Fo,imageCropRectOrigin:zo,imageCropRect:Do,imageCropMinSize:Oo,imageCropMaxSize:Bo,imageCropRange:_o,imageCropAspectRatio:Wo,imageCropLimitToImage:Vo,imageSize:No,imageScalar:Ho,imageOverlayMarkup:jo,stagePadded:Uo,stageRecenter:Zo}=tt;let Xo;Un(e,so,(e=>o(140,F=e))),Un(e,lo,(e=>o(144,W=e))),Un(e,uo,(e=>o(174,Q=e))),Un(e,ho,(e=>o(24,he=e))),Un(e,po,(e=>o(151,J=e))),Un(e,go,(e=>o(148,X=e))),Un(e,xo,(e=>o(147,j=e))),Un(e,vo,(e=>o(183,Pe=e))),Un(e,wo,(e=>o(173,B=e))),Un(e,ko,(e=>o(158,Le=e))),Un(e,Co,(e=>o(157,Ee=e))),Un(e,Mo,(e=>o(14,le=e))),Un(e,To,(e=>o(26,We=e))),Un(e,Po,(e=>o(184,Re=e))),Un(e,Io,(e=>o(150,K=e))),Un(e,Ao,(e=>o(149,G=e))),Un(e,Eo,(e=>o(182,Te=e))),Un(e,Lo,(e=>o(143,_=e))),Un(e,Fo,(e=>o(176,ge=e))),Un(e,zo,(e=>o(178,xe=e))),Un(e,Do,(e=>o(13,N=e))),Un(e,Oo,(e=>o(154,de=e))),Un(e,Bo,(e=>o(180,Ce=e))),Un(e,_o,(e=>o(177,ye=e))),Un(e,Wo,(e=>o(179,Se=e))),Un(e,Vo,(e=>o(153,ce=e))),Un(e,No,(e=>o(152,te=e))),Un(e,Ho,(e=>o(146,H=e))),Un(e,jo,(e=>o(172,D=e))),Un(e,Uo,(e=>o(142,O=e)));const Go=(e,t)=>{const o={target:e,translate:t},i=Ve(Fe(de),j),n=Ve(Fe(Ce),j);let r=i$(G,o,{...X,x:0,y:0},{aspectRatio:Se,minSize:i,maxSize:n});if(r=((e,t,o)=>{const[i,n,r,a]=xt(e),s={...e};if(i<t.y&&(e.height=e.height-(t.y-i),e.y=t.y),n>t.x+t.width&&(e.width=t.x+t.width-e.x),r>t.y+t.height&&(e.height=t.y+t.height-e.y),a<t.x&&(e.width=e.width-(t.x-a),e.x=t.x),o){const t=Math.min(1,s.width/e.width,s.height/e.height);return dt(s,t)}return e})(r,{...X,x:0,y:0},Se),!ce)return{boundsLimited:r,boundsIntent:r};let a=x$(G,r,o,Me,{aspectRatio:Se,minSize:i,maxSize:n});return{boundsLimited:a,boundsIntent:a}},Yo=(e,t)=>{const o={target:e,translate:t},i=Ve(Fe(de),j),n=Ve(Fe(Ce),j),r=((e,t,o={})=>{const{target:i,translate:n}=t,{aspectRatio:r,minSize:a}=o,s=ae[t$[i]],l=ve(Ke(e),ue(s[0]*e.width,s[1]*e.height)),c=ae[i],d=ve(Ke(e),ue(c[0]*e.width,c[1]*e.height)),[u,h,p,m,g,$,f]=o$(i);let y=n.x,b=n.y;g?b=0:$&&(y=0);let[x,v,w,S]=xt(e);if(u?S=l.x:h&&(v=l.x),m?x=l.y:p&&(w=l.y),u?v=d.x+y:h&&(S=d.x+y),m?w=d.y+b:p&&(x=d.y+b),a&&g&&w-x<a.height){const e=a.height-(w-x);x-=.5*e,w+=.5*e}if(a&&$&&v-S<a.width){const e=a.width-(v-S);S-=.5*e,v+=.5*e}if(r)if(f){let e=v-S,t=w-x;g?(t=e/r,x=l.y-.5*t,w=l.y+.5*t):$&&(e=t*r,S=l.x-.5*e,v=l.x+.5*e)}else{const e=ue(d.x+y-l.x,d.y+b-l.y);i===ie?(e.x=Math.max(0,e.x),e.y=Math.min(0,e.y)):i===ne?(e.x=Math.max(0,e.x),e.y=Math.max(0,e.y)):i===re?(e.x=Math.min(0,e.x),e.y=Math.max(0,e.y)):i===oe&&(e.x=Math.min(0,e.x),e.y=Math.min(0,e.y));const t=$e(e),o=ue(r,1),n=ke(fe(o),t);i===ie?(v=l.x+n.x,x=l.y-n.y):i===ne?(v=l.x+n.x,w=l.y+n.y):i===re?(S=l.x-n.x,w=l.y+n.y):i===oe&&(S=l.x-n.x,x=l.y-n.y)}return nt(S,x,v-S,w-x)})(G,o,{aspectRatio:Se,minSize:i});return{boundsLimited:i$(G,o,{...X,x:0,y:0},{aspectRatio:Se,minSize:i,maxSize:n}),boundsIntent:r}};let qo=void 0,Ko=void 0;const Jo=({translation:e,scalar:t})=>{V&&(t=1,e=me(pe(e)));const o=Math.min(K.width/N.width,K.height/N.height),i=ke(pe(e),1/o);let n;if(Ko){const t=we(pe(Ko),e);Ko=e,n=at(Ke(N),t)}else n=at(Ke(qo),me(pe(i))),void 0!==t&&st(n,1/t);Qn(Fo,ge=n,ge),Qn(Do,N=n,N)},Qo=Ma([_o,Do],(([e,t],o)=>{if(!t)return;const[i,n]=e,r=ht(t);o([De(wt(yt(i,r),se)),De(wt(bt(n,r),se))])}));Un(e,Qo,(e=>o(175,ee=e)));const ei=Ma([No,Vo,Oo,Bo,_o,Mo],(([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)=>q(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)):(c=-1,d=1);a([c,d].map((e=>se(e))))}));Un(e,ei,(e=>o(27,Ze=e)));const ti=Ma([No,Do,_o,Mo],(([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=ht(t),u=q(i)?_e(e.height,e.width):e,h=bt(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=bt({width:e,height:t},d);r=-Math.min((l-h.width)/o.width,(c-h.height)/o.height)}n(r)}));Un(e,ti,(e=>o(28,Xe=e)));const oi=e=>{const t=ht(qo);let o,i,n;const r=q(le)?_e(te.height,te.width):te,a=bt(r,t);if(e>=0){const r=a.width-ye[0].width,s=a.height-ye[0].height;o=a.width-r*e,i=a.height-s*e,n=yt({width:o,height:i},t)}else{const r=ye[1].width-a.width,s=ye[1].height-a.height;o=a.width+r*-e,i=a.height+s*-e,n=bt({width:o,height:i},t)}o=n.width,i=n.height;const s=qo.x+.5*qo.width-.5*o,l=qo.y+.5*qo.height-.5*i;Qn(Do,N={x:s,y:l,width:o,height:i},N)};let ii;const ni=e=>{const t=st(Ke(ii),1/e);Qn(Fo,ge=t,ge),Qn(Do,N=t,N)};let ri;const ai=()=>{Zo.set({})};let si;const li=Wl(0,{precision:1e-4});Un(e,li,(e=>o(29,Ge=e)));const ci=Wl();Un(e,ci,(e=>o(30,Ye=e)));const di=Ma([Wo,Po,Jt],(([e,t,o],n)=>{if(!i)return;const r=Hd(o),a=[...r].map((e=>e[0])).sort(((e,t)=>Ro(e[0])&&!Ro(t[0])?1:-1)).find((o=>{if(Ro(o)&&t){const[i,n]=o,r=t.width===i&&t.height===n,a=e===U(i,n);return r&&a}return o===e}));if(!a)return n(void 0);n(r.map((e=>e[0])).findIndex((e=>Ro(e)?Ka(e,a):e===a)))}));Un(e,di,(e=>o(155,Ie=e)));const ui=(e,t)=>{if(!i||-1===e||void 0===e)return;const o=Hd(t)[e][0];return o?Ro(o)?U(o[0],o[1]):o:void 0},hi=Ma([$o,Lo,co],(([e,t,o],i)=>{const{rows:n,cols:r,opacity:a}=lt(Kt,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:[ue(s,o),ue(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:[ue(o,l),ue(o,l+d)],opacity:a,strokeWidth:1,strokeColor:e})}i(p)}));Un(e,hi,(e=>o(141,z=e)));const pi="crop-"+L();let mi,gi=pi+"-"+(gt?Wt:"zoom"),$i=gi,fi=void 0;const yi=Wl(E?20:0);Un(e,yi,(e=>o(138,I=e)));return e.$$set=e=>{"isActive"in e&&Je(o(0,et=e.isActive)),"stores"in e&&o(97,tt=e.stores),"cropImageSelectionCornerStyle"in e&&o(1,ot=e.cropImageSelectionCornerStyle),"cropWillRenderImageSelectionGuides"in e&&o(98,lt=e.cropWillRenderImageSelectionGuides),"cropAutoCenterImageSelectionTimeout"in e&&o(99,ct=e.cropAutoCenterImageSelectionTimeout),"cropEnableZoomMatchImageAspectRatio"in e&&o(100,pt=e.cropEnableZoomMatchImageAspectRatio),"cropEnableRotateMatchImageAspectRatio"in e&&o(101,mt=e.cropEnableRotateMatchImageAspectRatio),"cropEnableRotationInput"in e&&o(102,gt=e.cropEnableRotationInput),"cropEnableZoom"in e&&o(2,vt=e.cropEnableZoom),"cropEnableZoomInput"in e&&o(103,St=e.cropEnableZoomInput),"cropEnableZoomAutoHide"in e&&o(104,kt=e.cropEnableZoomAutoHide),"cropEnableImageSelection"in e&&o(105,Ct=e.cropEnableImageSelection),"cropEnableInfoIndicator"in e&&o(106,Mt=e.cropEnableInfoIndicator),"cropEnableZoomTowardsWheelPosition"in e&&o(107,Tt=e.cropEnableZoomTowardsWheelPosition),"cropEnableLimitWheelInputToCropSelection"in e&&o(108,Pt=e.cropEnableLimitWheelInputToCropSelection),"cropEnableCenterImageSelection"in e&&o(109,Rt=e.cropEnableCenterImageSelection),"cropEnableButtonRotateLeft"in e&&o(110,It=e.cropEnableButtonRotateLeft),"cropEnableButtonRotateRight"in e&&o(111,At=e.cropEnableButtonRotateRight),"cropEnableButtonFlipHorizontal"in e&&o(112,Et=e.cropEnableButtonFlipHorizontal),"cropEnableButtonFlipVertical"in e&&o(113,Lt=e.cropEnableButtonFlipVertical),"cropSelectPresetOptions"in e&&o(114,Ft=e.cropSelectPresetOptions),"cropEnableSelectPreset"in e&&o(115,zt=e.cropEnableSelectPreset),"cropEnableFilterMatchAspectRatio"in e&&o(116,Dt=e.cropEnableFilterMatchAspectRatio),"cropSelectPresetFilter"in e&&o(95,Ot=e.cropSelectPresetFilter),"cropEnableButtonToggleCropLimit"in e&&o(117,Bt=e.cropEnableButtonToggleCropLimit),"cropWillRenderTools"in e&&o(118,_t=e.cropWillRenderTools),"cropActiveTransformTool"in e&&o(119,Wt=e.cropActiveTransformTool),"cropMinimizeToolbar"in e&&o(120,Vt=e.cropMinimizeToolbar),"cropInteractionFocus"in e&&o(121,Nt=e.cropInteractionFocus),"cropRotationRange"in e&&o(3,Ht=e.cropRotationRange),"cropMaskOpacity"in e&&o(122,jt=e.cropMaskOpacity),"locale"in e&&o(4,Ut=e.locale)},e.$$.update=()=>{4096&e.$$.dirty[0]|268435456&e.$$.dirty[3]&&Yt.set("selection"===Nt&&A),2097152&e.$$.dirty[3]&&o(129,i=Ft&&Array.isArray(Ft)&&Ft.length),2097152&e.$$.dirty[3]|32&e.$$.dirty[4]&&Jt.set(i?Ft:[]),4096&e.$$.dirty[0]&&A&&So.set(1),4096&e.$$.dirty[0]&&fo.set(!A),4096&e.$$.dirty[0]&&yo.set(!A),65536&e.$$.dirty[4]&&o(124,p="overlay"===F.layoutMode),4194304&e.$$.dirty[3]|1&e.$$.dirty[4]&&o(128,v=zt&&!p),83886080&e.$$.dirty[4]&&o(137,l=X&&K&&$t(X,K)),67117056&e.$$.dirty[4]&&o(135,c=!(!K||!l)),67119104&e.$$.dirty[4]&&o(133,d=c&&ut(K,l,(e=>se(e,5)))),16400&e.$$.dirty[0]|52297732&e.$$.dirty[3]|1879114288&e.$$.dirty[4]|31&e.$$.dirty[5]&&o(11,n=ze&&_t([It&&["Button","rotate-left",{label:Ut.cropLabelButtonRotateLeft,labelClass:"PinturaToolbarContentWide",icon:Ut.cropIconButtonRotateLeft,onclick:()=>{ro(-Math.PI/2),ao.write()}}],At&&["Button","rotate-right",{label:Ut.cropLabelButtonRotateRight,labelClass:"PinturaToolbarContentWide",icon:Ut.cropIconButtonRotateRight,onclick:()=>{ro(Math.PI/2),ao.write()}}],Et&&["Button","flip-horizontal",{label:Ut.cropLabelButtonFlipHorizontal,labelClass:"PinturaToolbarContentWide",icon:Ut.cropIconButtonFlipHorizontal,onclick:()=>{q(le)?Qn(Co,Ee=!Ee,Ee):Qn(ko,Le=!Le,Le),ao.write()}}],Lt&&["Button","flip-vertical",{label:Ut.cropLabelButtonFlipVertical,labelClass:"PinturaToolbarContentWide",icon:Ut.cropIconButtonFlipVertical,onclick:()=>{q(le)?Qn(ko,Le=!Le,Le):Qn(Co,Ee=!Ee,Ee),ao.write()}}],v&&i&&[!1===Ot?"Dropdown":$$,"select-preset",{icon:Ud(Ut.cropIconSelectPreset,Ut,ui(Ie,Ae)),label:Ud(Ut.cropLabelSelectPreset,Ut,ui(Ie,Ae)),labelClass:"PinturaToolbarContentWide",options:Ae,filter:Ot,onfilterchange:to,selectedIndex:Ie,onchange:({value:e})=>{Ro(e)?(Qn(Wo,Se=U(e[0],e[1]),Se),Qn(Po,Re=Oe(e),Re)):Qn(Wo,Se=e,Se),d&&ai(),ao.write()},optionMapper:e=>{let t=!1;const o=Ro(e.value)?e.value[0]/e.value[1]:e.value;if(o){const e=Ha(te,le,o);t=e.width<de.width||e.height<de.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=Ro(e)?U(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}}}],Bt&&["Dropdown","select-crop-limit",{icon:Ud(Ut.cropIconCropBoundary,Ut,ce),label:Ut.cropLabelCropBoundary,labelClass:"PinturaToolbarContentWide",onchange:({value:e})=>{Qn(Vo,ce=e,ce),ao.write()},options:[[!0,Ut.cropLabelCropBoundaryEdge,{icon:Ud(Ut.cropIconCropBoundary,Ut,!0)}],[!1,Ut.cropLabelCropBoundaryNone,{icon:Ud(Ut.cropIconCropBoundary,Ut,!1)}]]}]].filter(Boolean),F,(()=>Gt.set({}))).filter(Boolean)),6144&e.$$.dirty[0]|134217728&e.$$.dirty[3]|65537&e.$$.dirty[4]&&Qn(vo,Pe=A&&"never"!==Vt&&("always"===Vt||"short"===F.verticalSpace||p)?n.map((([e,t,o])=>Array.isArray(o)?[e,t,o]:[e,t,{...o,hideLabel:!0}])):[],Pe),536870912&e.$$.dirty[4]&&o(23,r=ce?0:-1),150994944&e.$$.dirty[4]&&o(130,a=X&&ue(-(J.x-X.x),-(J.y-X.y))),524352&e.$$.dirty[4]&&o(131,s=_&&ue(Cd(_.x+.5*_.width+a.x),Cd(_.y+.5*_.height+a.y))),33554432&e.$$.dirty[4]&&o(134,u=null!=G),16785408&e.$$.dirty[4]&&o(136,h=X&&l&&(l.height===X.height||l.width===X.width)),12587008&e.$$.dirty[4]&&o(132,m=!h&&j<1&&H<1),3840&e.$$.dirty[4]&&o(9,g=c&&!u&&(!d||m)),8192&e.$$.dirty[0]|8192&e.$$.dirty[3]|1&e.$$.dirty[4]&&o(22,$=Mt&&!!N&&!p),524352&e.$$.dirty[4]&&o(8,b=_&&a&&{x:_.x+a.x,y:_.y+a.y,width:_.width,height:_.height}),256&e.$$.dirty[0]|4096&e.$$.dirty[3]|1&e.$$.dirty[4]&&o(21,f=Ct&&!!b&&!p),65600&e.$$.dirty[3]|2097280&e.$$.dirty[4]&&o(10,y=Rt&&!!s&&!ct&&!V),512&e.$$.dirty[0]|1073741888&e.$$.dirty[3]|1048576&e.$$.dirty[4]&&g&&ct&&!W&&(clearTimeout(si),o(123,si=setTimeout(ai,ct))),1073741824&e.$$.dirty[3]|1048576&e.$$.dirty[4]&&W&&clearTimeout(si),1536&e.$$.dirty[0]|32768&e.$$.dirty[4]&&li.set(y&&g?1:0,{hard:!1===E}),32896&e.$$.dirty[4]&&ci.set(s,{hard:!1===E}),4096&e.$$.dirty[0]|262144&e.$$.dirty[4]&&(A&&!O?(Qn(wo,B.crop={maskOpacity:jt,maskMarkupOpacity:jt},B),wo.set(B)):(delete B.crop,wo.set(B))),131072&e.$$.dirty[4]&&z&&(()=>{const e=D.filter((e=>!/^image\-selection\-guide/.test(e.id)));Qn(jo,D=A?[...e,...z]:e,D)})(),65536&e.$$.dirty[4]&&o(127,x="short"!==F.verticalSpace),134217728&e.$$.dirty[3]|9&e.$$.dirty[4]&&o(20,w="never"===Vt&&!p||x&&"always"!==Vt),4&e.$$.dirty[0]|1024&e.$$.dirty[3]&&o(126,S=vt&&St),2048&e.$$.dirty[3]|12&e.$$.dirty[4]&&o(125,k=kt?x&&S:S),512&e.$$.dirty[3]|2&e.$$.dirty[4]&&o(19,C=gt||k),2&e.$$.dirty[4]&&(k||o(5,$i=gi)),32&e.$$.dirty[0]&&o(18,M={name:pi,selected:$i}),16&e.$$.dirty[0]|512&e.$$.dirty[3]|2&e.$$.dirty[4]&&o(7,T=[gt&&{id:pi+"-rotation",label:Ut.cropLabelTabRotation},k&&{id:pi+"-zoom",label:Ut.cropLabelTabZoom}].filter(Boolean)),128&e.$$.dirty[0]&&o(17,P=T.map((e=>e.id))),64&e.$$.dirty[0]|1&e.$$.dirty[4]&&mi&&!mi.children.length&&p&&mi.dispatchEvent(new CustomEvent("measure",{detail:mi.rect})),4096&e.$$.dirty[0]|32768&e.$$.dirty[4]&&E&&yi.set(A?0:20),16384&e.$$.dirty[4]&&o(16,R=I?`transform: translateY(${I}px)`:void 0)},[et,ot,vt,Ht,Ut,$i,mi,T,b,g,y,n,A,N,le,fi,R,P,M,C,w,f,$,r,he,Be,We,Ze,Xe,Ge,Ye,Zt,Xt,Gt,Yt,qt,Jt,so,lo,uo,ho,po,go,bo,xo,vo,wo,ko,Co,Mo,To,Po,Io,Ao,Eo,Lo,Fo,zo,Do,Oo,Bo,_o,Wo,Vo,No,Ho,jo,Uo,()=>{Kt="select",Qn(lo,W=!0,W),Qn(Ao,G=Ke(K),G),Xo=V?Go:Yo},({detail:e})=>{const{boundsLimited:t,boundsIntent:o}=Xo(e.direction,e.translation);Qn(uo,Q=!0,Q),Qn(Eo,Te=o,Te),Qn(Io,K=t,K)},({detail:e})=>{const{boundsLimited:t}=Xo(e.direction,e.translation);Qn(uo,Q=!1,Q),Qn(lo,W=!1,W),Qn(Eo,Te=void 0,Te),$e(e.translation)&&(Qn(Io,K=t,K),ao.write()),Qn(Ao,G=void 0,G),Kt=void 0},()=>{Kt="rotate",Qn(lo,W=!0,W),Qn(zo,xe=Ke(N),xe)},e=>{Qn(uo,Q=!0,Q),Qn(Mo,le=e,le)},e=>{Qn(uo,Q=!1,Q),Qn(lo,W=!1,W),Qn(Mo,le=e,le),ao.write(),Qn(zo,xe=void 0,xe)},()=>{Kt="pan",Ko=void 0,Qn(lo,W=!0,W),qo=Ke(N)},({detail:e})=>{Qn(uo,Q=!0,Q),Jo(e)},({detail:e})=>{Qn(uo,Q=!1,Q),Qn(lo,W=!1,W),($e(e.translation)>0||0!==e.scalar)&&(Jo(e),ao.write()),Qn(Fo,ge=void 0,ge),qo=void 0},({detail:{translation:e}})=>{V&&(e=me(pe(e))),Ko=e,Qn(lo,W=!1,W)},Qo,ei,ti,()=>{Kt="zoom",Qn(lo,W=!0,W),qo=Ke(N)},e=>{Qn(uo,Q=!1,Q),oi(e)},e=>{oi(e),ao.write(),Qn(uo,Q=!1,Q),Qn(lo,W=!1,W),qo=void 0},()=>{Kt="zoom",qo||(ii=Ke(N),Qn(lo,W=!0,W))},({detail:e})=>{ii&&(Qn(uo,Q=!0,Q),ni(e))},({detail:e})=>{ii&&(Qn(uo,Q=!1,Q),Qn(lo,W=!1,W),ni(e),Qn(Fo,ge=void 0,ge),ii=void 0,ao.write())},e=>{const t=Lh(e,he,J);if(Pt&&!ft(K,t))return;Kt="zoom",Qn(lo,W=!0,W),Qn(uo,Q=!0,Q),e.preventDefault(),e.stopPropagation();const o=id(e),i=1+o/100,n=Ke(N),r=1===Math.min(N.width/de.width,N.height/de.height);if(pt&&ce){const e=io(N,te,le);if(Qt()&&e&&o>0&&d){Qn(lo,W=!1,W),Qn(uo,Q=!1,Q);const e=q(le)?Qe({height:te.width,width:te.height}):Qe(te);if(ut(n,e))return;if(clearTimeout(ri),ut(ao.state.crop,e))return;return Qn(Do,N=e,N),void ao.write()}}let a=rt(N);if(Tt&&"selection"!==Nt&&o<0&&!r){const e=we(pe(t),K),o=Math.min(K.width/N.width,K.height/N.height),i=st(Ke(K),1.1);a=ft(i,t)?ve(Ke(N),ke(e,1/o)):a}let s=st(Ke(N),i,a);if(je(ee[1],s)||(s=it(rt(s),ee[1])),je(s,ee[0])||(s=it(rt(s),ee[0])),ut(n,s,se))return Qn(lo,W=!1,W),void Qn(uo,Q=!1,Q);Qn(Do,N=wt(s,(e=>se(e,5))),N),Qn(lo,W=!1,W),Qn(uo,Q=!1,Q),clearTimeout(ri),ri=setTimeout((()=>{ao.write()}),500)},ai,li,ci,di,hi,pi,yi,Ot,"crop",tt,lt,ct,pt,mt,gt,St,kt,Ct,Mt,Tt,Pt,Rt,It,At,Et,Lt,Ft,zt,Dt,Bt,_t,Wt,Vt,Nt,jt,si,p,k,S,x,v,i,a,s,m,d,u,c,h,l,I,E,F,z,O,_,W,V,H,j,X,G,K,J,te,ce,de,Ie,Ae,Ee,Le,ze,function(t){Wr.call(this,e,t)},({detail:e})=>o(5,$i=e),function(e){Nr[e?"unshift":"push"]((()=>{mi=e,o(6,mi)}))},e=>Eh(e),function(e){fi=e,o(15,fi)},function(t){Wr.call(this,e,t)}]}var B$={util:["crop",class extends wa{constructor(e){super(),va(this,e,O$,L$,Nn,{name:96,isActive:0,stores:97,cropImageSelectionCornerStyle:1,cropWillRenderImageSelectionGuides:98,cropAutoCenterImageSelectionTimeout:99,cropEnableZoomMatchImageAspectRatio:100,cropEnableRotateMatchImageAspectRatio:101,cropEnableRotationInput:102,cropEnableZoom:2,cropEnableZoomInput:103,cropEnableZoomAutoHide:104,cropEnableImageSelection:105,cropEnableInfoIndicator:106,cropEnableZoomTowardsWheelPosition:107,cropEnableLimitWheelInputToCropSelection:108,cropEnableCenterImageSelection:109,cropEnableButtonRotateLeft:110,cropEnableButtonRotateRight:111,cropEnableButtonFlipHorizontal:112,cropEnableButtonFlipVertical:113,cropSelectPresetOptions:114,cropEnableSelectPreset:115,cropEnableFilterMatchAspectRatio:116,cropSelectPresetFilter:95,cropEnableButtonToggleCropLimit:117,cropWillRenderTools:118,cropActiveTransformTool:119,cropMinimizeToolbar:120,cropInteractionFocus:121,cropRotationRange:3,cropMaskOpacity:122,locale:4},null,[-1,-1,-1,-1,-1,-1,-1,-1])}get name(){return this.$$.ctx[96]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),ea()}get stores(){return this.$$.ctx[97]}set stores(e){this.$$set({stores:e}),ea()}get cropImageSelectionCornerStyle(){return this.$$.ctx[1]}set cropImageSelectionCornerStyle(e){this.$$set({cropImageSelectionCornerStyle:e}),ea()}get cropWillRenderImageSelectionGuides(){return this.$$.ctx[98]}set cropWillRenderImageSelectionGuides(e){this.$$set({cropWillRenderImageSelectionGuides:e}),ea()}get cropAutoCenterImageSelectionTimeout(){return this.$$.ctx[99]}set cropAutoCenterImageSelectionTimeout(e){this.$$set({cropAutoCenterImageSelectionTimeout:e}),ea()}get cropEnableZoomMatchImageAspectRatio(){return this.$$.ctx[100]}set cropEnableZoomMatchImageAspectRatio(e){this.$$set({cropEnableZoomMatchImageAspectRatio:e}),ea()}get cropEnableRotateMatchImageAspectRatio(){return this.$$.ctx[101]}set cropEnableRotateMatchImageAspectRatio(e){this.$$set({cropEnableRotateMatchImageAspectRatio:e}),ea()}get cropEnableRotationInput(){return this.$$.ctx[102]}set cropEnableRotationInput(e){this.$$set({cropEnableRotationInput:e}),ea()}get cropEnableZoom(){return this.$$.ctx[2]}set cropEnableZoom(e){this.$$set({cropEnableZoom:e}),ea()}get cropEnableZoomInput(){return this.$$.ctx[103]}set cropEnableZoomInput(e){this.$$set({cropEnableZoomInput:e}),ea()}get cropEnableZoomAutoHide(){return this.$$.ctx[104]}set cropEnableZoomAutoHide(e){this.$$set({cropEnableZoomAutoHide:e}),ea()}get cropEnableImageSelection(){return this.$$.ctx[105]}set cropEnableImageSelection(e){this.$$set({cropEnableImageSelection:e}),ea()}get cropEnableInfoIndicator(){return this.$$.ctx[106]}set cropEnableInfoIndicator(e){this.$$set({cropEnableInfoIndicator:e}),ea()}get cropEnableZoomTowardsWheelPosition(){return this.$$.ctx[107]}set cropEnableZoomTowardsWheelPosition(e){this.$$set({cropEnableZoomTowardsWheelPosition:e}),ea()}get cropEnableLimitWheelInputToCropSelection(){return this.$$.ctx[108]}set cropEnableLimitWheelInputToCropSelection(e){this.$$set({cropEnableLimitWheelInputToCropSelection:e}),ea()}get cropEnableCenterImageSelection(){return this.$$.ctx[109]}set cropEnableCenterImageSelection(e){this.$$set({cropEnableCenterImageSelection:e}),ea()}get cropEnableButtonRotateLeft(){return this.$$.ctx[110]}set cropEnableButtonRotateLeft(e){this.$$set({cropEnableButtonRotateLeft:e}),ea()}get cropEnableButtonRotateRight(){return this.$$.ctx[111]}set cropEnableButtonRotateRight(e){this.$$set({cropEnableButtonRotateRight:e}),ea()}get cropEnableButtonFlipHorizontal(){return this.$$.ctx[112]}set cropEnableButtonFlipHorizontal(e){this.$$set({cropEnableButtonFlipHorizontal:e}),ea()}get cropEnableButtonFlipVertical(){return this.$$.ctx[113]}set cropEnableButtonFlipVertical(e){this.$$set({cropEnableButtonFlipVertical:e}),ea()}get cropSelectPresetOptions(){return this.$$.ctx[114]}set cropSelectPresetOptions(e){this.$$set({cropSelectPresetOptions:e}),ea()}get cropEnableSelectPreset(){return this.$$.ctx[115]}set cropEnableSelectPreset(e){this.$$set({cropEnableSelectPreset:e}),ea()}get cropEnableFilterMatchAspectRatio(){return this.$$.ctx[116]}set cropEnableFilterMatchAspectRatio(e){this.$$set({cropEnableFilterMatchAspectRatio:e}),ea()}get cropSelectPresetFilter(){return this.$$.ctx[95]}set cropSelectPresetFilter(e){this.$$set({cropSelectPresetFilter:e}),ea()}get cropEnableButtonToggleCropLimit(){return this.$$.ctx[117]}set cropEnableButtonToggleCropLimit(e){this.$$set({cropEnableButtonToggleCropLimit:e}),ea()}get cropWillRenderTools(){return this.$$.ctx[118]}set cropWillRenderTools(e){this.$$set({cropWillRenderTools:e}),ea()}get cropActiveTransformTool(){return this.$$.ctx[119]}set cropActiveTransformTool(e){this.$$set({cropActiveTransformTool:e}),ea()}get cropMinimizeToolbar(){return this.$$.ctx[120]}set cropMinimizeToolbar(e){this.$$set({cropMinimizeToolbar:e}),ea()}get cropInteractionFocus(){return this.$$.ctx[121]}set cropInteractionFocus(e){this.$$set({cropInteractionFocus:e}),ea()}get cropRotationRange(){return this.$$.ctx[3]}set cropRotationRange(e){this.$$set({cropRotationRange:e}),ea()}get cropMaskOpacity(){return this.$$.ctx[122]}set cropMaskOpacity(e){this.$$set({cropMaskOpacity:e}),ea()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),ea()}}]};function _$(e){let t,o,i,n,r,a,s,l=e[76],c=(R(e[76].label)?e[76].label(e[2]):e[76].label)+"";function d(...t){return e[51](e[76],...t)}const u=()=>e[52](o,l),h=()=>e[52](null,l);return{c(){t=hr("div"),o=hr("div"),i=gr(),n=hr("span"),r=mr(c),xr(o,"class",H$),xr(t,"slot","option"),xr(t,"class","PinturaFilterOption")},m(e,l){dr(e,t,l),sr(t,o),u(),sr(t,i),sr(t,n),sr(n,r),a||(s=[fr(o,"measure",d),er(oc.call(null,o))],a=!0)},p(t,o){l!==(e=t)[76]&&(h(),l=e[76],u()),4&o[0]|16384&o[2]&&c!==(c=(R(e[76].label)?e[76].label(e[2]):e[76].label)+"")&&wr(r,c)},d(e){e&&ur(t),h(),a=!1,Wn(s)}}}function W$(e){let t,o;return t=new bu({props:{locale:e[2],layout:"row",options:e[3],selectedIndex:e[12],onchange:e[32],$$slots:{option:[_$,({option:e})=>({76:e}),({option:e})=>[0,0,e?16384:0]]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};4&o[0]&&(i.locale=e[2]),8&o[0]&&(i.options=e[3]),4096&o[0]&&(i.selectedIndex=e[12]),1028&o[0]|49152&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function V$(e){let t,o,i,n,r,a,s,l;function c(t){e[54](t)}function d(t){e[55](t)}function u(t){e[56](t)}let h={elasticity:e[13]*e[19],onscroll:e[53],$$slots:{default:[W$]},$$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 ad({props:h}),Nr.push((()=>fa(o,"maskFeatherStartOpacity",c))),Nr.push((()=>fa(o,"maskFeatherEndOpacity",d))),Nr.push((()=>fa(o,"maskFeatherSize",u))),o.$on("measure",e[57]),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"slot","footer"),xr(t,"style",e[11])},m(i,n){dr(i,t,n),ba(o,t,null),a=!0,s||(l=[fr(t,"transitionend",e[30]),fr(t,"measure",e[58]),er(oc.call(null,t,{observePosition:!0}))],s=!0)},p(e,s){const l={};8192&s[0]&&(l.elasticity=e[13]*e[19]),128&s[0]&&(l.onscroll=e[53]),5132&s[0]|32768&s[2]&&(l.$$scope={dirty:s,ctx:e}),!i&&16&s[0]&&(i=!0,l.maskFeatherStartOpacity=e[4],qr((()=>i=!1))),!n&&32&s[0]&&(n=!0,l.maskFeatherEndOpacity=e[5],qr((()=>n=!1))),!r&&64&s[0]&&(r=!0,l.maskFeatherSize=e[6],qr((()=>r=!1))),o.$set(l),(!a||2048&s[0])&&xr(t,"style",e[11])},i(e){a||(sa(o.$$.fragment,e),a=!0)},o(e){la(o.$$.fragment,e),a=!1},d(e){e&&ur(t),xa(o),s=!1,Wn(l)}}}function N$(e){let t,o;return t=new Wg({props:{$$slots:{footer:[V$]},$$scope:{ctx:e}}}),t.$on("measure",e[59]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};16380&o[0]|32768&o[2]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}let H$="PinturaFilterPreview";function j$(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S=zn,k=()=>(S(),S=Hn(P,(e=>o(43,d=e))),P),C=zn,M=()=>(C(),C=Hn(T,(e=>o(49,b=e))),T);e.$$.on_destroy.push((()=>S())),e.$$.on_destroy.push((()=>C()));let{isActive:T}=t;M();let{isActiveFraction:P}=t;k();let{stores:I}=t,{locale:A}=t,{filterFunctions:E}=t,{filterOptions:L}=t;const F=_r("elasticityMultiplier");Un(e,F,(e=>o(13,w=e)));const{history:z,interfaceImages:D,stageRectBase:O,utilRect:B,animation:_,scrollElasticity:W,imageSize:V,imagePreview:N,imageCropRect:H,imageRotation:j,imageFlipX:U,imageFlipY:Z,imageBackgroundColor:X,imageGamma:G,imageColorMatrix:Y,allowPan:q,allowZoom:K,allowZoomControls:J}=I;Un(e,D,(e=>o(60,u=e))),Un(e,O,(e=>o(48,y=e))),Un(e,B,(e=>o(47,f=e))),Un(e,_,(e=>o(50,x=e))),Un(e,V,(e=>o(62,p=e))),Un(e,N,(e=>o(42,c=e))),Un(e,X,(e=>o(61,h=e))),Un(e,G,(e=>o(44,m=e))),Un(e,Y,(e=>o(40,s=e)));const Q=Ca({});Un(e,Q,(e=>o(46,$=e)));const ee=(e,t)=>Qn(Q,$[e.value]=t,$),te=Ma(Q,(e=>{if(!e[void 0])return;const t=e[void 0];return v&&We(v,t)?v:Fe(t)}));Un(e,te,(e=>o(63,v=e)));const oe=Ma([T,te,H,V,j,U,Z],(([e,t,o,i,n,r,a],s)=>{if(!e||!t||!i)return g;const l=Qe(i),c=rt(l),d=Ua(i,o,n),u=rt(d),h=we(pe(c),u),p=me(pe(h)),m=Math.max(t.width/o.width,t.height/o.height);s({origin:p,translation:h,rotation:{x:a?Math.PI:0,y:r?Math.PI:0,z:n},scale:m})}));Un(e,oe,(e=>o(45,g=e)));const ie=Wl(x?20:0);let ne;Un(e,ie,(e=>o(39,a=e)));const re={};let ae,se,le,ce,de,he,ge={x:0,y:0};const $e=Ca([]);Un(e,$e,(e=>o(41,l=e)));const fe=e=>{const t={...e,data:c,size:p,offset:{...e.offset},mask:{...e.mask},backgroundColor:h};return t.opacity=d,t.offset.y+=a,t.mask.y+=a,t.id="filter",t},ye=()=>u.filter((e=>"filter"!==e.id));Dr((()=>{D.set([])}));return e.$$set=e=>{"isActive"in e&&M(o(0,T=e.isActive)),"isActiveFraction"in e&&k(o(1,P=e.isActiveFraction)),"stores"in e&&o(34,I=e.stores),"locale"in e&&o(2,A=e.locale),"filterFunctions"in e&&o(35,E=e.filterFunctions),"filterOptions"in e&&o(3,L=e.filterOptions)},e.$$.update=()=>{if(262144&e.$$.dirty[1]&&q.set(b),262144&e.$$.dirty[1]&&K.set(b),262144&e.$$.dirty[1]&&J.set(b),8&e.$$.dirty[0]&&o(38,i=Hd(L)),640&e.$$.dirty[1]&&o(12,n=((e,t)=>{if(!e||!e.filter||!t)return 0;const o=e.filter;return t.findIndex((([e])=>{if(!E[e])return!1;const t=E[e]();return Ka(t,o)}))})(s,i)),786432&e.$$.dirty[1]&&x&&ie.set(b?0:20),512&e.$$.dirty[0]|458752&e.$$.dirty[1]&&b&&f&&y&&he&&o(37,de={x:y.x-f.x,y:y.y-f.y+he.y}),496&e.$$.dirty[0]|58096&e.$$.dirty[1]&&g&&de&&ge&&ce&&ne){const e=de.x+ce.x+ge.x,t=de.y,o=ce.x+de.x,n=o+ce.width;$e.set(i.map((([i],r)=>{const a=$[i],l=ge.x+a.x,c=l+a.width;if(c<0||l>ce.width)return!1;const d=e+a.x,u=t+a.y,h=(e=>({origin:pe(e.origin),translation:pe(e.translation),rotation:{...e.rotation},scale:e.scale}))(g);h.offset=ue(.5*a.width+d,.5*a.height+u);h.maskOpacity=1,h.mask=nt(d+0,u,a.width+0,a.height),h.maskFeather=[1,0,1,0,1,n,1,n],l<le&&ae<1&&(h.maskFeather[0]=ae,h.maskFeather[1]=o,h.maskFeather[2]=1,h.maskFeather[3]=o+le),c>ce.width-le&&se<1&&(h.maskFeather[4]=se,h.maskFeather[5]=n-le,h.maskFeather[6]=1,h.maskFeather[7]=n),h.maskCornerRadius=ne[i];let p=s&&Object.keys(s).filter((e=>"filter"!=e)).map((e=>s[e]))||[];return R(E[i])&&p.push(E[i]()),h.colorMatrix=p.length?Ln(p):void 0,h.gamma=m,h})).filter(Boolean))}if(7424&e.$$.dirty[1])if(d>0&&l){const e=[...ye(),...l.map(fe)];D.set(e)}else D.set(ye());256&e.$$.dirty[1]&&o(11,r=a?`transform: translateY(${a}px)`:void 0)},[T,P,A,L,ae,se,le,ge,ce,he,re,r,n,w,F,D,O,B,_,W,V,N,X,G,Y,Q,ee,te,oe,ie,e=>{e.target.className===H$&&o(36,ne=Object.keys(re).reduce(((e,t)=>{const o=re[t],i=getComputedStyle(o),n=["top-left","top-right","bottom-left","bottom-right"].map((e=>i.getPropertyValue(`border-${e}-radius`))).map(od).map((e=>1.25*e));return e[t]=n,e}),{}))},$e,({value:e})=>{Qn(Y,s={...s,filter:R(E[e])?E[e]():void 0},s),z.write()},"filter",I,E,ne,de,i,a,s,l,c,d,m,g,$,f,y,b,x,(e,t)=>ee(e,t.detail),function(e,t){Nr[e?"unshift":"push"]((()=>{re[t.value]=e,o(10,re)}))},e=>o(7,ge=e),function(e){ae=e,o(4,ae)},function(e){se=e,o(5,se)},function(e){le=e,o(6,le)},e=>o(8,ce=e.detail),e=>o(9,he=e.detail),function(t){Wr.call(this,e,t)}]}var U$={util:["filter",class extends wa{constructor(e){super(),va(this,e,j$,N$,Nn,{name:33,isActive:0,isActiveFraction:1,stores:34,locale:2,filterFunctions:35,filterOptions:3},null,[-1,-1,-1])}get name(){return this.$$.ctx[33]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),ea()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),ea()}get stores(){return this.$$.ctx[34]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[2]}set locale(e){this.$$set({locale:e}),ea()}get filterFunctions(){return this.$$.ctx[35]}set filterFunctions(e){this.$$set({filterFunctions:e}),ea()}get filterOptions(){return this.$$.ctx[3]}set filterOptions(e){this.$$set({filterOptions:e}),ea()}}]};function Z$(e){let t,o,i=e[42].label+"";return{c(){t=hr("span"),o=mr(i)},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){2048&t[1]&&i!==(i=e[42].label+"")&&wr(o,i)},d(e){e&&ur(t)}}}function X$(e){let t,o;const i=[{class:"PinturaControlList"},{tabs:e[1]},e[5]];let n={$$slots:{default:[Z$,({tab:e})=>({42:e}),({tab:e})=>[0,e?2048:0]]},$$scope:{ctx:e}};for(let e=0;e<i.length;e+=1)n=On(n,i[e]);return t=new xc({props:n}),t.$on("select",e[24]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const n=34&o[0]?ga(i,[i[0],2&o[0]&&{tabs:e[1]},32&o[0]&&$a(e[5])]):{};6144&o[1]&&(n.$$scope={dirty:o,ctx:e}),t.$set(n)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function G$(e){let t,o;const i=[e[7][e[41]]];let n={};for(let e=0;e<i.length;e+=1)n=On(n,i[e]);return t=new jg({props:n}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const n=128&o[0]|1024&o[1]?ga(i,[$a(e[7][e[41]])]):{};t.$set(n)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Y$(e){let t,o,i,n,r;o=new ad({props:{elasticity:e[6]*e[9],class:"PinturaControlListScroller",$$slots:{default:[X$]},$$scope:{ctx:e}}});const a=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[4]},e[5]];let s={$$slots:{default:[G$,({panel:e})=>({41:e}),({panel:e})=>[0,e?1024:0]]},$$scope:{ctx:e}};for(let e=0;e<a.length;e+=1)s=On(s,a[e]);return n=new Ec({props:s}),{c(){t=hr("div"),ya(o.$$.fragment),i=gr(),ya(n.$$.fragment),xr(t,"slot","footer"),xr(t,"style",e[3])},m(e,a){dr(e,t,a),ba(o,t,null),sr(t,i),ba(n,t,null),r=!0},p(e,i){const s={};64&i[0]&&(s.elasticity=e[6]*e[9]),38&i[0]|4096&i[1]&&(s.$$scope={dirty:i,ctx:e}),o.$set(s);const l=48&i[0]?ga(a,[a[0],a[1],16&i[0]&&{panels:e[4]},32&i[0]&&$a(e[5])]):{};128&i[0]|5120&i[1]&&(l.$$scope={dirty:i,ctx:e}),n.$set(l),(!r||8&i[0])&&xr(t,"style",e[3])},i(e){r||(sa(o.$$.fragment,e),sa(n.$$.fragment,e),r=!0)},o(e){la(o.$$.fragment,e),la(n.$$.fragment,e),r=!1},d(e){e&&ur(t),xa(o),xa(n)}}}function q$(e){let t,o;return t=new Wg({props:{$$slots:{footer:[Y$]},$$scope:{ctx:e}}}),t.$on("measure",e[25]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};254&o[0]|4096&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function K$(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m=zn,g=()=>(m(),m=Hn(f,(e=>o(21,c=e))),f);e.$$.on_destroy.push((()=>m()));let{stores:$}=t,{isActive:f}=t;g();let{locale:y={}}=t,{finetuneControlConfiguration:b}=t,{finetuneOptions:x}=t,{finetuneNudgePrecision:v}=t;const{history:w,animation:S,scrollElasticity:k,rangeInputElasticity:C,imageColorMatrix:M,imageConvolutionMatrix:T,imageGamma:P,imageVignette:I,imageNoise:A,allowPan:E,allowZoom:F,allowZoomControls:z}=$;Un(e,S,(e=>o(22,d=e)));const D={imageColorMatrix:M,imageConvolutionMatrix:T,imageGamma:P,imageVignette:I,imageNoise:A},O=_r("elasticityMultiplier");Un(e,O,(e=>o(6,h=e)));const B="finetune-"+L(),_=Ca({});Un(e,_,(e=>o(23,u=e)));const W=Ca({});Un(e,W,(e=>o(7,p=e)));let V=[];const N=Wl(d?20:0);Un(e,N,(e=>o(20,l=e)));return e.$$set=e=>{"stores"in e&&o(15,$=e.stores),"isActive"in e&&g(o(0,f=e.isActive)),"locale"in e&&o(16,y=e.locale),"finetuneControlConfiguration"in e&&o(17,b=e.finetuneControlConfiguration),"finetuneOptions"in e&&o(18,x=e.finetuneOptions),"finetuneNudgePrecision"in e&&o(19,v=e.finetuneNudgePrecision)},e.$$.update=()=>{var t;2097152&e.$$.dirty[0]&&E.set(c),2097152&e.$$.dirty[0]&&F.set(c),2097152&e.$$.dirty[0]&&z.set(c),327680&e.$$.dirty[0]&&o(1,i=x?x.map((([e,t])=>({id:e,label:R(t)?t(y):t}))):[]),2&e.$$.dirty[0]&&o(2,n=i.length&&i[0].id),4&e.$$.dirty[0]&&o(5,r={name:B,selected:n}),2&e.$$.dirty[0]&&o(4,a=i.map((e=>e.id))),131072&e.$$.dirty[0]&&b&&(t=b,V&&V.forEach((e=>e())),V=a.map((e=>{const{getStore:o,getValue:i=Z}=t[e];return o(D).subscribe((t=>{const o=null!=t?i(t):t;Qn(_,u={...u,[e]:o},u)}))}))),8519680&e.$$.dirty[0]&&b&&u&&Qn(W,p=Object.keys(u).reduce(((e,t)=>{const{base:o,min:i,max:n,getLabel:r,getStore:a,setValue:s=((e,t)=>e.set(t))}=b[t],l=a(D),c=null!=u[t]?u[t]:o;return e[t]={base:o,min:i,max:n,value:c,valueLabel:r?r(c,i,n,n-i):Math.round(100*c),oninputmove:e=>{s(l,e)},oninputend:e=>{s(l,e),w.write()},elasticity:h*C,labelReset:y.labelReset,nudgeMultiplier:v},e}),{}),p),6291456&e.$$.dirty[0]&&d&&N.set(c?0:20),1048576&e.$$.dirty[0]&&o(3,s=l?`transform: translateY(${l}px)`:void 0)},[f,i,n,s,a,r,h,p,S,k,O,_,W,N,"finetune",$,y,b,x,v,l,c,d,u,({detail:e})=>o(2,n=e),function(t){Wr.call(this,e,t)}]}var J$={util:["finetune",class extends wa{constructor(e){super(),va(this,e,K$,q$,Nn,{name:14,stores:15,isActive:0,locale:16,finetuneControlConfiguration:17,finetuneOptions:18,finetuneNudgePrecision:19},null,[-1,-1])}get name(){return this.$$.ctx[14]}get stores(){return this.$$.ctx[15]}set stores(e){this.$$set({stores:e}),ea()}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),ea()}get locale(){return this.$$.ctx[16]}set locale(e){this.$$set({locale:e}),ea()}get finetuneControlConfiguration(){return this.$$.ctx[17]}set finetuneControlConfiguration(e){this.$$set({finetuneControlConfiguration:e}),ea()}get finetuneOptions(){return this.$$.ctx[18]}set finetuneOptions(e){this.$$set({finetuneOptions:e}),ea()}get finetuneNudgePrecision(){return this.$$.ctx[19]}set finetuneNudgePrecision(e){this.$$set({finetuneNudgePrecision:e}),ea()}}]},Q$=(e,t)=>{const o=t.length;return e<0?e%o+o:e>=o?e%o:e};function ef(e,t,o){const i=e.slice();return i[48]=t[o].key,i[49]=t[o].index,i[50]=t[o].translate,i[51]=t[o].scale,i[14]=t[o].rotate,i[52]=t[o].dir,i[53]=t[o].center,i[54]=t[o].type,i[2]=t[o].visible,i}function tf(e){let t,o;return{c(){t=hr("div"),xr(t,"class","PinturaShapeManipulator"),xr(t,"data-control","point"),xr(t,"style",o=`pointer-events:none;transform: translate3d(${e[53].x}px, ${e[53].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[4]}`)},m(e,o){dr(e,t,o)},p(e,i){56&i[0]&&o!==(o=`pointer-events:none;transform: translate3d(${e[53].x}px, ${e[53].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[4]}`)&&xr(t,"style",o)},d(e){e&&ur(t)}}}function of(e,t){let o,i,n,r,a,s,l,c,d;function u(...e){return t[19](t[49],...e)}let h="edge"===t[54]&&t[2]&&tf(t);return{key:e,first:null,c(){o=hr("div"),s=gr(),h&&h.c(),l=$r(),xr(o,"role","button"),xr(o,"aria-label",i=`Drag ${t[54]} ${t[48]}`),xr(o,"tabindex",n="edge"===t[54]?-1:0),xr(o,"class","PinturaShapeManipulator"),xr(o,"data-control",r=t[54]),xr(o,"style",a=`cursor:${t[52]?t[52]+"-resize":"move"};opacity:${t[4]};--tx:${t[50].x};--ty:${t[50].y};--r:${"edge"===t[54]?t[14]:0}rad;--sx:${"point"===t[54]?t[5]:t[51].x};--sy:${"point"===t[54]?t[5]:t[51].y};`),this.first=o},m(e,i){dr(e,o,i),dr(e,s,i),h&&h.m(e,i),dr(e,l,i),c||(d=[fr(o,"keydown",t[7]),fr(o,"keyup",t[8]),fr(o,"nudge",u),er(Jc.call(null,o,{preventDefault:!0})),fr(o,"interactionstart",(function(){Vn(t[11]("start",t[49]))&&t[11]("start",t[49]).apply(this,arguments)})),fr(o,"interactionupdate",(function(){Vn(t[11]("move",t[49]))&&t[11]("move",t[49]).apply(this,arguments)})),fr(o,"interactionend",(function(){Vn(t[11]("end",t[49]))&&t[11]("end",t[49]).apply(this,arguments)})),er(Kc.call(null,o))],c=!0)},p(e,s){t=e,8&s[0]&&i!==(i=`Drag ${t[54]} ${t[48]}`)&&xr(o,"aria-label",i),8&s[0]&&n!==(n="edge"===t[54]?-1:0)&&xr(o,"tabindex",n),8&s[0]&&r!==(r=t[54])&&xr(o,"data-control",r),56&s[0]&&a!==(a=`cursor:${t[52]?t[52]+"-resize":"move"};opacity:${t[4]};--tx:${t[50].x};--ty:${t[50].y};--r:${"edge"===t[54]?t[14]:0}rad;--sx:${"point"===t[54]?t[5]:t[51].x};--sy:${"point"===t[54]?t[5]:t[51].y};`)&&xr(o,"style",a),"edge"===t[54]&&t[2]?h?h.p(t,s):(h=tf(t),h.c(),h.m(l.parentNode,l)):h&&(h.d(1),h=null)},d(e){e&&ur(o),e&&ur(s),h&&h.d(e),e&&ur(l),c=!1,Wn(d)}}}function nf(e){let t,o,i,n;return{c(){t=hr("div"),xr(t,"role","button"),xr(t,"aria-label","Drag rotator"),xr(t,"tabindex","0"),xr(t,"class","PinturaShapeManipulator"),xr(t,"data-control","rotate"),xr(t,"style",o=`transform: translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[4]}`)},m(o,r){dr(o,t,r),i||(n=[fr(t,"keydown",e[7]),fr(t,"keyup",e[8]),fr(t,"nudge",e[13]),er(Jc.call(null,t,{preventDefault:!0})),fr(t,"interactionstart",e[14]("start")),fr(t,"interactionupdate",e[14]("move")),fr(t,"interactionend",e[14]("end")),er(Kc.call(null,t))],i=!0)},p(e,i){49&i[0]&&o!==(o=`transform: translate3d(${e[0].x}px, ${e[0].y}px, 0) scale(${e[5]}, ${e[5]}); opacity: ${e[4]}`)&&xr(t,"style",o)},d(e){e&&ur(t),i=!1,Wn(n)}}}function rf(e){let t,o,i=[],n=new Map,r=e[3];const a=e=>e[48];for(let t=0;t<r.length;t+=1){let o=ef(e,r,t),s=a(o);n.set(s,i[t]=of(s,o))}let s=e[1]&&nf(e);return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=gr(),s&&s.c(),o=$r()},m(e,n){for(let t=0;t<i.length;t+=1)i[t].m(e,n);dr(e,t,n),s&&s.m(e,n),dr(e,o,n)},p(e,l){6584&l[0]&&(r=e[3],i=ma(i,l,a,1,e,r,n,t.parentNode,ha,of,t,ef)),e[1]?s?s.p(e,l):(s=nf(e),s.c(),s.m(o.parentNode,o)):s&&(s.d(1),s=null)},i:zn,o:zn,d(e){for(let t=0;t<i.length;t+=1)i[t].d(e);e&&ur(t),s&&s.d(e),e&&ur(o)}}}function af(e,t,o){let i,n,r,a;const s=Or(),l=.5*Y,c=G-l,d=G+l,u=-G,h=u-l,p=u+l,m=X-l,g=-X+l,$=l,f=-l,y=G-Y,b=y-l,x=y+l,v=X-Y,w=v-l,S=v+l,k=u-Y,C=k+l,M=k-l,T=u+Y,P=T+l,R=T-l;let{visible:I=!1}=t,{points:A=[]}=t,{rotatorPoint:E}=t,{enableDragEdges:L=!0}=t,{enableDragPoints:F=!0}=t,{enableRotatePoints:z=!0}=t;const D=_r("isAnimated");Un(e,D,(e=>o(18,n=e)));let O=!1;const B=Wl(.5,{precision:1e-4,stiffness:.3,damping:.7});Un(e,B,(e=>o(5,a=e)));const _=Wl(0,{precision:.001,stiffness:.3,damping:.7});Un(e,_,(e=>o(4,r=e)));const W=e=>{let t="";return(e<=d&&e>=c||e>=h&&e<=p)&&(t="ns"),(e<=g||e>=m||e>=f&&e<=$)&&(t="ew"),(e>=w&&e<=S||e<=P&&e>=R)&&(t="nesw"),(e>=b&&e<=x||e<=C&&e>=M)&&(t="nwse"),t},V=(e,t)=>{s("resizestart",{indexes:e,translation:de()}),s("resizemove",{indexes:e,translation:t}),s("resizeend",{indexes:e,translation:de()})};return e.$$set=e=>{"visible"in e&&o(2,I=e.visible),"points"in e&&o(15,A=e.points),"rotatorPoint"in e&&o(0,E=e.rotatorPoint),"enableDragEdges"in e&&o(16,L=e.enableDragEdges),"enableDragPoints"in e&&o(17,F=e.enableDragPoints),"enableRotatePoints"in e&&o(1,z=e.enableRotatePoints)},e.$$.update=()=>{262148&e.$$.dirty[0]&&B.set(I?1:.5,{hard:!1===n}),262148&e.$$.dirty[0]&&_.set(I?1:0,{hard:!1===n}),32768&e.$$.dirty[0]&&o(3,i=((e,t)=>{let o=0;const i=Ie(e),n=[],r=e.length;for(;o<r;o++){const t=Q$(o-1,e),r=Q$(o+1,e),a=e[t],s=e[o],l=e[r],c=Math.atan2(l.y-s.y,l.x-s.x);if(F){const e=fe(ue(a.x-s.x,a.y-s.y)),t=fe(ue(l.x-s.x,l.y-s.y)),i=ue(e.x+t.x,e.y+t.y),r=L?F&&W(Math.atan2(i.y,i.x)):void 0;n.push({index:[o],key:"point-"+o,type:"point",scale:{x:1,y:1},translate:{x:s.x,y:s.y},angle:void 0,rotate:z,center:s,dir:r})}if(!L)continue;if(Array.isArray(L)&&!L.some((([e,t])=>o===e&&r===t)))continue;const d=ue(s.x+.5*(l.x-s.x),s.y+.5*(l.y-s.y));n.push({index:[o,r],key:"edge-"+o,type:"edge",scale:{x:Pe(s,l),y:1},translate:{x:s.x,y:s.y},angle:c,rotate:c,center:d,visible:Array.isArray(L),dir:W(Math.atan2(i.y-d.y,i.x-d.x))})}return n})(A))},[E,z,I,i,r,a,D,e=>O=e.shiftKey,e=>O=!1,B,_,(e,t)=>({detail:o})=>{const i=o&&o.translation?o.translation:ue(0,0);s("resize"+e,{...o,indexes:t,translation:i,shiftKey:O})},V,({detail:e})=>{s("rotatestart",{translation:de()}),s("rotatemove",{translation:e}),s("rotateend",{translation:de()})},e=>({detail:t})=>{const o=t&&t.translation?t.translation:ue(0,0);s("rotate"+e,{translation:o,shiftKey:O})},A,L,F,n,(e,{detail:t})=>V(e,t)]}class sf extends wa{constructor(e){super(),va(this,e,af,rf,Nn,{visible:2,points:15,rotatorPoint:0,enableDragEdges:16,enableDragPoints:17,enableRotatePoints:1},null,[-1,-1])}}var lf=(e,t)=>{const o=Eh(e);return we(o,t)};let cf=null;var df=e=>{if(null===cf&&(cf=u()&&"visualViewport"in window),!cf)return!1;const t=visualViewport.height,o=()=>{e(visualViewport.height<t?"visible":"hidden")};return visualViewport.addEventListener("resize",o),()=>visualViewport.removeEventListener("resize",o)};function uf(e){let t,o,i,n,r,a,s,l,c,d;i=new Gc({props:{onclick:e[1],label:e[5],icon:e[7],hideLabel:!e[6]}});const u=e[20].default,h=Zn(u,e,e[19],null);return s=new Gc({props:{onclick:e[0],label:e[2],icon:e[4],hideLabel:!e[3],class:"PinturaInputFormButtonConfirm"}}),{c(){t=hr("div"),o=hr("div"),ya(i.$$.fragment),n=gr(),r=hr("div"),h&&h.c(),a=gr(),ya(s.$$.fragment),xr(r,"class","PinturaInputFormFields"),xr(o,"class","PinturaInputFormInner"),xr(t,"class","PinturaInputForm"),xr(t,"style",e[9])},m(u,p){dr(u,t,p),sr(t,o),ba(i,o,null),sr(o,n),sr(o,r),h&&h.m(r,null),sr(o,a),ba(s,o,null),e[21](t),l=!0,c||(d=[fr(t,"focusin",e[10]),fr(t,"focusout",e[11]),fr(t,"measure",e[12]),er(oc.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&&(!l||524288&o[0])&&Yn(h,u,e,e[19],l?Gn(u,e[19],o,null):qn(e[19]),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])&&xr(t,"style",e[9])},i(e){l||(sa(i.$$.fragment,e),sa(h,e),sa(s.$$.fragment,e),l=!0)},o(e){la(i.$$.fragment,e),la(h,e),la(s.$$.fragment,e),l=!1},d(o){o&&ur(t),xa(i),h&&h.d(o),xa(s),e[21](null),c=!1,Wn(d)}}}function hf(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:$}=t,{labelCancelShow:f=!1}=t,{iconCancel:y}=t,{panelOffset:b=de()}=t,x=!1,w=void 0,S=void 0,k="",C=0;const M=()=>{const e=a.querySelector("input, textarea");e.focus(),C>=1||e.select()},T=()=>{x=!0,R||!uo()&&!v()||o(16,k="top:1em;bottom:auto;"),uo()&&(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,C=1)};let P;const R=df((e=>{n?"hidden"!==e||x?(clearTimeout(S),S=void 0,o(16,k=`top:${visualViewport.height-w-b.y}px`),"visible"===e?(o(8,a.dataset.layout="stick",a),M(),T()):(x=!1,o(17,C=0))):M():o(16,k="top: 4.5em; bottom: auto")}));return Fr((()=>{u&&M()})),Dr((()=>{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,$=e.labelCancel),"labelCancelShow"in e&&o(6,f=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:${C};${k}`)},[c,d,p,m,g,$,f,y,a,r,e=>{var t;(e=>/textarea/i.test(e))(e.target)&&(P=Date.now(),h&&((t=e.target).selectionStart=t.selectionEnd=t.value.length),clearTimeout(S),S=setTimeout(T,200))},e=>{Date.now()-P>50||(e.stopPropagation(),M())},({detail:e})=>{w=e.height},u,h,b,k,C,i,l,s,function(e){Nr[e?"unshift":"push"]((()=>{a=e,o(8,a)}))}]}class pf extends wa{constructor(e){super(),va(this,e,hf,uf,Nn,{onconfirm:0,oncancel:1,autoFocus:13,autoPositionCursor:14,labelConfirm:2,labelConfirmShow:3,iconConfirm:4,labelCancel:5,labelCancelShow:6,iconCancel:7,panelOffset:15},null,[-1,-1])}}var mf=e=>document.createTextNode(e),gf=e=>(Ht()&&e.endsWith("<div><br></div>")?e.replace(/<div><br><\/div>$/,"<br><br>"):e).replace(/<div><br><\/div>/g,"<br>").replace(/<\/div>/g,"").replace(/<div>/g,"<br>");function $f(e){let t,o,i,n;return{c(){t=hr("pre"),xr(t,"class","PinturaContentEditable"),xr(t,"data-wrap-content",o=e[3]||e[4]?"wrap":"nowrap"),xr(t,"contenteditable",""),xr(t,"spellcheck",e[0]),xr(t,"autocorrect",e[1]),xr(t,"autocapitalize",e[2]),xr(t,"style",e[6])},m(o,r){dr(o,t,r),e[24](t),i||(n=[fr(t,"input",e[11]),fr(t,"compositionend",e[10]),fr(t,"paste",e[12]),fr(t,"keydown",e[8]),fr(t,"keyup",e[9]),fr(t,"blur",e[7])],i=!0)},p(e,i){24&i[0]&&o!==(o=e[3]||e[4]?"wrap":"nowrap")&&xr(t,"data-wrap-content",o),1&i[0]&&xr(t,"spellcheck",e[0]),2&i[0]&&xr(t,"autocorrect",e[1]),4&i[0]&&xr(t,"autocapitalize",e[2]),64&i[0]&&xr(t,"style",e[6])},i:zn,o:zn,d(o){o&&ur(t),e[24](null),i=!1,Wn(n)}}}function ff(e,t,o){let i,{spellcheck:n="false"}=t,{autocorrect:r="off"}=t,{autocapitalize:s="off"}=t,{wrapLines:l=!0}=t,{allowNewline:c=!0}=t,{textFormat:d="text"}=t,{formatInput:u=Z}=t,{formatPaste:h=Z}=t,{style:p}=t,{innerHTML:m}=t,{oninput:$=a}=t,{enableTextStyleShortcuts:f=!1}=t;const y=()=>{if(!x)return;const e=document.createRange();e.selectNodeContents(x);const t=T();t.removeAllRanges(),t.addRange(e)},b=Or();let x;document.execCommand("defaultParagraphSeparator",!1,"br");const v=e=>e.replace(/<\/?(?:i|b|em|u|s|strike|strong|font)>/,"").replace(/style=".*?"/g,"").replace(/\n/gim,"<br>"),w=()=>{o(13,m=x.innerHTML);const e=gf(m);b("input",e),$(e),requestAnimationFrame((()=>x&&x.scrollTo(0,0)))},S=()=>{P(x);const e="html"===d?x.innerHTML:v(x.innerHTML);o(5,x.innerHTML=u(e),x),R(x),w()},k={b:"bold",i:"italic",u:"underline",s:"strikethrough"},C=e=>{const t=g("span");return t.dataset.bookmark=e,t},M=(e,t,o)=>{const i=C(o);if(e.nodeType===Node.TEXT_NODE){const n=e.textContent;if("start"===o){const o=mf(n.substr(0,t)),r=mf(n.substr(t));e.replaceWith(o,i,r)}else{const o=mf(n.substr(0,t)),r=mf(n.substr(t));e.replaceWith(o,i,r)}}else e.nodeType===Node.ELEMENT_NODE&&e.insertBefore(i,e.childNodes[t])},T=()=>{const e=x.getRootNode();return"getSelection"in e?e.getSelection():document.getSelection()},P=e=>{const t=T();if(!t.getRangeAt||!t.rangeCount)return;const o=t.getRangeAt(0),{startOffset:i,endOffset:n,startContainer:r,endContainer:a}=o;if(e.contains(o.startContainer)&&e.contains(o.endContainer))if(r.nodeType===Node.TEXT_NODE&&r===a){const e=r.textContent,t=e.substr(0,i),o=C("start"),a=n-i>0?e.substr(i,n):"",s=C("end"),l=e.substr(n);r.replaceWith(t,o,a,s,l)}else M(r,i,"start"),M(a,n+(r===a?1:0),"end")},R=e=>{const t=I(e,"start"),o=I(e,"end");if(!t||!o)return;const i=document.createRange();i.setStart(t,0),i.setEnd(o,0);const n=T();n.removeAllRanges(),n.addRange(i),t.remove(),o.remove()},I=(e,t)=>{const o=e.children;for(let e=0;e<o.length;e++){const i=o[e];if(i.dataset.bookmark===t)return i;if(i.children.length){const e=I(i,t);if(e)return e}}};let A;return e.$$set=e=>{"spellcheck"in e&&o(0,n=e.spellcheck),"autocorrect"in e&&o(1,r=e.autocorrect),"autocapitalize"in e&&o(2,s=e.autocapitalize),"wrapLines"in e&&o(3,l=e.wrapLines),"allowNewline"in e&&o(4,c=e.allowNewline),"textFormat"in e&&o(14,d=e.textFormat),"formatInput"in e&&o(15,u=e.formatInput),"formatPaste"in e&&o(16,h=e.formatPaste),"style"in e&&o(17,p=e.style),"innerHTML"in e&&o(13,m=e.innerHTML),"oninput"in e&&o(18,$=e.oninput),"enableTextStyleShortcuts"in e&&o(19,f=e.enableTextStyleShortcuts)},e.$$.update=()=>{var t;if(32&e.$$.dirty[0]&&o(23,i=!!x),8396800&e.$$.dirty[0]&&i&&m&&(t=m)!==x.innerHTML&&(o(5,x.innerHTML=t,x),x===document.activeElement&&y()),131096&e.$$.dirty[0])if(!l&&c){const e=p.includes(":right")?"text-indent:-100px!important":p.includes(":center")?"":"min-width:calc(100% + 100px)!important";o(6,A=p+";overflow:visible;"+e)}else o(6,A=p)},[n,r,s,l,c,x,A,()=>{b("blur")},e=>{if(/escape/i.test(e.code))return e.stopPropagation(),void b("cancel");const t=e.ctrlKey||e.metaKey;if("html"===d&&t&&/b|i|u|s/.test(e.key))return f&&(e=>{const t=k[e];t&&document.execCommand(t)})(e.key),void e.preventDefault();/enter/i.test(e.code)&&(e.stopPropagation(),t?b("confirm"):(c||e.preventDefault(),document.execCommand("insertLineBreak"),e.preventDefault()))},()=>{},e=>{""!==e.data&&S()},e=>{const{inputType:t}=e;"insertCompositionText"!==t&&"deleteCompositionText"!==t&&S()},e=>{e.preventDefault();const t=e.clipboardData.getData("text/plain"),o="html"===d?t:v(t),i=h(o);if(!i.length)return;const n=T().getRangeAt(0);n.deleteContents(),n.insertNode(document.createTextNode(i)),w()},m,d,u,h,p,$,f,()=>S(),()=>x&&x.focus(),y,i,function(e){Nr[e?"unshift":"push"]((()=>{x=e,o(5,x)}))}]}class yf extends wa{constructor(e){super(),va(this,e,ff,$f,Nn,{spellcheck:0,autocorrect:1,autocapitalize:2,wrapLines:3,allowNewline:4,textFormat:14,formatInput:15,formatPaste:16,style:17,innerHTML:13,oninput:18,enableTextStyleShortcuts:19,confirm:20,focus:21,select:22},null,[-1,-1])}get spellcheck(){return this.$$.ctx[0]}set spellcheck(e){this.$$set({spellcheck:e}),ea()}get autocorrect(){return this.$$.ctx[1]}set autocorrect(e){this.$$set({autocorrect:e}),ea()}get autocapitalize(){return this.$$.ctx[2]}set autocapitalize(e){this.$$set({autocapitalize:e}),ea()}get wrapLines(){return this.$$.ctx[3]}set wrapLines(e){this.$$set({wrapLines:e}),ea()}get allowNewline(){return this.$$.ctx[4]}set allowNewline(e){this.$$set({allowNewline:e}),ea()}get textFormat(){return this.$$.ctx[14]}set textFormat(e){this.$$set({textFormat:e}),ea()}get formatInput(){return this.$$.ctx[15]}set formatInput(e){this.$$set({formatInput:e}),ea()}get formatPaste(){return this.$$.ctx[16]}set formatPaste(e){this.$$set({formatPaste:e}),ea()}get style(){return this.$$.ctx[17]}set style(e){this.$$set({style:e}),ea()}get innerHTML(){return this.$$.ctx[13]}set innerHTML(e){this.$$set({innerHTML:e}),ea()}get oninput(){return this.$$.ctx[18]}set oninput(e){this.$$set({oninput:e}),ea()}get enableTextStyleShortcuts(){return this.$$.ctx[19]}set enableTextStyleShortcuts(e){this.$$set({enableTextStyleShortcuts:e}),ea()}get confirm(){return this.$$.ctx[20]}get focus(){return this.$$.ctx[21]}get select(){return this.$$.ctx[22]}}const bf=["i","b","u","strike"].map((e=>({tag:e,tagOpen:new RegExp(`<${e}>`,"g"),tagClose:new RegExp(`</${e}>`,"g"),placeholderOpen:new RegExp(`___${e}O___`,"g"),placeholderClose:new RegExp(`___${e}C___`,"g")})));var xf=e=>e=((e,t=bf)=>(t.forEach((({tag:t,placeholderOpen:o,placeholderClose:i})=>{e=e.replace(o,`<${t}>`).replace(i,`</${t}>`)})),e))(e=(e=((e,t=bf)=>(t.forEach((({tag:t,tagOpen:o,tagClose:i})=>{e=e.replace(o,`___${t}O___`).replace(i,`___${t}C___`)})),e))(e)).replace(/ {2,}/g," ").replace(/\u00a0/g,"&nbsp;").split("\n").join("<br>")),vf=(e,t)=>P(e)?parseFloat(e)/100*t:e,wf=(e,t)=>({x:Do(e.x,t.width),y:Do(e.y,t.height)});function Sf(e,t,o){const i=e.slice();return i[224]=t[o],i[226]=o,i}function kf(e,t){let o,i,n,r,a,s,l,c,d,u,h,p=t[224].name+"";function m(){return t[152](t[226])}return n=new ym({props:{color:t[224].color}}),{key:e,first:null,c(){o=hr("li"),i=hr("button"),ya(n.$$.fragment),r=gr(),a=hr("span"),s=mr(p),c=gr(),xr(i,"class","PinturaShapeListItem"),xr(i,"type","button"),xr(i,"aria-label",l="Select shape "+t[224].name),this.first=o},m(e,t){dr(e,o,t),sr(o,i),ba(n,i,null),sr(i,r),sr(i,a),sr(a,s),sr(o,c),d=!0,u||(h=fr(i,"click",m),u=!0)},p(e,o){t=e;const r={};1048576&o[0]&&(r.color=t[224].color),n.$set(r),(!d||1048576&o[0])&&p!==(p=t[224].name+"")&&wr(s,p),(!d||1048576&o[0]&&l!==(l="Select shape "+t[224].name))&&xr(i,"aria-label",l)},i(e){d||(sa(n.$$.fragment,e),d=!0)},o(e){la(n.$$.fragment,e),d=!1},d(e){e&&ur(o),xa(n),u=!1,h()}}}function Cf(e){let t,o;return t=new sf({props:{visible:!0,points:e[12],rotatorPoint:e[26],enableDragEdges:e[16],enableDragPoints:e[28],enableRotatePoints:e[14]}}),t.$on("resizestart",e[36]),t.$on("resizemove",e[37]),t.$on("resizeend",e[38]),t.$on("rotatestart",e[39]),t.$on("rotatemove",e[40]),t.$on("rotateend",e[41]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};4096&o[0]&&(i.points=e[12]),67108864&o[0]&&(i.rotatorPoint=e[26]),65536&o[0]&&(i.enableDragEdges=e[16]),268435456&o[0]&&(i.enableDragPoints=e[28]),16384&o[0]&&(i.enableRotatePoints=e[14]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Mf(e){let t,o,i,n;const r=[Pf,Tf],a=[];function s(e,t){return"modal"===e[4]?0:"inline"===e[4]?1:-1}return~(t=s(e))&&(o=a[t]=r[t](e)),{c(){o&&o.c(),i=$r()},m(e,o){~t&&a[t].m(e,o),dr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?~t&&a[t].p(e,n):(o&&(ra(),la(a[l],1,1,(()=>{a[l]=null})),aa()),~t?(o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sa(o,1),o.m(i.parentNode,i)):o=null)},i(e){n||(sa(o),n=!0)},o(e){la(o),n=!1},d(e){~t&&a[t].d(e),e&&ur(i)}}}function Tf(e){let t,o,i,n,r,a={formatInput:e[43],wrapLines:!!e[13].width,textFormat:e[13].format,enableTextStyleShortcuts:e[5],allowNewline:e[27],style:e[25]};return o=new yf({props:a}),e[155](o),o.$on("input",e[44]),o.$on("keyup",e[47]),o.$on("cancel",e[49]),o.$on("confirm",e[48]),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"class","PinturaInlineInput"),xr(t,"style",e[24])},m(a,s){dr(a,t,s),ba(o,t,null),i=!0,n||(r=fr(t,"focusout",e[156]),n=!0)},p(e,n){const r={};8192&n[0]&&(r.wrapLines=!!e[13].width),8192&n[0]&&(r.textFormat=e[13].format),32&n[0]&&(r.enableTextStyleShortcuts=e[5]),134217728&n[0]&&(r.allowNewline=e[27]),33554432&n[0]&&(r.style=e[25]),o.$set(r),(!i||16777216&n[0])&&xr(t,"style",e[24])},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(i){i&&ur(t),e[155](null),xa(o),n=!1,r()}}}function Pf(e){let t,o;return t=new pf({props:{panelOffset:e[2],onconfirm:e[48],oncancel:e[49],labelCancel:e[6].shapeLabelInputCancel,iconCancel:e[6].shapeIconInputCancel,labelConfirm:e[6].shapeLabelInputConfirm,iconConfirm:e[6].shapeIconInputConfirm,$$slots:{default:[Rf]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};4&o[0]&&(i.panelOffset=e[2]),64&o[0]&&(i.labelCancel=e[6].shapeLabelInputCancel),64&o[0]&&(i.iconCancel=e[6].shapeIconInputCancel),64&o[0]&&(i.labelConfirm=e[6].shapeLabelInputConfirm),64&o[0]&&(i.iconConfirm=e[6].shapeIconInputConfirm),41943296&o[0]|1024&o[7]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Rf(e){let t,o,i;return{c(){t=hr("textarea"),xr(t,"spellcheck","false"),xr(t,"autocorrect","off"),xr(t,"autocapitalize","off"),xr(t,"style",e[25])},m(n,r){dr(n,t,r),e[153](t),Sr(t,e[23]),o||(i=[fr(t,"keydown",e[46]),fr(t,"keypress",e[45]),fr(t,"keyup",e[47]),fr(t,"input",e[44]),fr(t,"input",e[154])],o=!0)},p(e,o){33554432&o[0]&&xr(t,"style",e[25]),8388608&o[0]&&Sr(t,e[23])},d(n){n&&ur(t),e[153](null),o=!1,Wn(i)}}}function If(e){let t,o,i,n,r;return o=new dh({props:{items:e[21],key:e[10]}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"class","PinturaShapeControls"),xr(t,"style",e[22])},m(a,s){dr(a,t,s),ba(o,t,null),i=!0,n||(r=[fr(t,"measure",e[157]),er(oc.call(null,t))],n=!0)},p(e,n){const r={};2097152&n[0]&&(r.items=e[21]),1024&n[0]&&(r.key=e[10]),o.$set(r),(!i||4194304&n[0])&&xr(t,"style",e[22])},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o),n=!1,Wn(r)}}}function Af(e){let t,o,i,n,r,s,l,c,d,u,h=[],p=new Map,m=e[20];const g=e=>e[224].id;for(let t=0;t<m.length;t+=1){let o=Sf(e,m,t),i=g(o);p.set(i,h[t]=kf(i,o))}let $=e[15]&&Cf(e),f=e[11]&&Mf(e),y=e[17]>0&&If(e);return{c(){t=hr("div"),o=hr("nav"),i=hr("ul");for(let e=0;e<h.length;e+=1)h[e].c();n=gr(),$&&$.c(),r=gr(),f&&f.c(),s=gr(),y&&y.c(),xr(o,"class","PinturaShapeList"),xr(o,"data-visible",e[18]),xr(t,"class","PinturaShapeEditor"),xr(t,"tabindex","0")},m(p,m){dr(p,t,m),sr(t,o),sr(o,i);for(let e=0;e<h.length;e+=1)h[e].m(i,null);sr(t,n),$&&$.m(t,null),sr(t,r),f&&f.m(t,null),sr(t,s),y&&y.m(t,null),e[158](t),c=!0,d||(u=[fr(o,"focusin",e[52]),fr(o,"focusout",e[53]),fr(t,"keydown",(function(){Vn(e[1]?a:e[42])&&(e[1]?a:e[42]).apply(this,arguments)})),fr(t,"nudge",(function(){Vn(e[1]?a:e[51])&&(e[1]?a:e[51]).apply(this,arguments)})),fr(t,"measure",e[151]),fr(t,"pointermove",(function(){Vn(e[1]?a:e[54])&&(e[1]?a:e[54]).apply(this,arguments)})),fr(t,"interactionstart",(function(){Vn(e[1]?a:e[31])&&(e[1]?a:e[31]).apply(this,arguments)})),fr(t,"interactionupdate",(function(){Vn(e[1]?a:e[33])&&(e[1]?a:e[33]).apply(this,arguments)})),fr(t,"interactioncancel",(function(){Vn(e[1]?a:e[32])&&(e[1]?a:e[32]).apply(this,arguments)})),fr(t,"interactionrelease",(function(){Vn(e[1]?a:e[34])&&(e[1]?a:e[34]).apply(this,arguments)})),fr(t,"interactionend",(function(){Vn(e[1]?a:e[35])&&(e[1]?a:e[35]).apply(this,arguments)})),er(oc.call(null,t)),er(Jc.call(null,t)),er(l=Kc.call(null,t,{drag:!0,inertia:!0,multiTouch:!1,shouldStartInteraction:Ff,getEventPosition:e[159]}))],d=!0)},p(n,a){e=n,1048705&a[0]&&(m=e[20],ra(),h=ma(h,a,g,1,e,m,p,i,pa,kf,null,Sf),aa()),(!c||262144&a[0])&&xr(o,"data-visible",e[18]),e[15]?$?($.p(e,a),32768&a[0]&&sa($,1)):($=Cf(e),$.c(),sa($,1),$.m(t,r)):$&&(ra(),la($,1,1,(()=>{$=null})),aa()),e[11]?f?(f.p(e,a),2048&a[0]&&sa(f,1)):(f=Mf(e),f.c(),sa(f,1),f.m(t,s)):f&&(ra(),la(f,1,1,(()=>{f=null})),aa()),e[17]>0?y?(y.p(e,a),131072&a[0]&&sa(y,1)):(y=If(e),y.c(),sa(y,1),y.m(t,null)):y&&(ra(),la(y,1,1,(()=>{y=null})),aa()),l&&Vn(l.update)&&8&a[0]&&l.update.call(null,{drag:!0,inertia:!0,multiTouch:!1,shouldStartInteraction:Ff,getEventPosition:e[159]})},i(e){if(!c){for(let e=0;e<m.length;e+=1)sa(h[e]);sa($),sa(f),sa(y),c=!0}},o(e){for(let e=0;e<h.length;e+=1)la(h[e]);la($),la(f),la(y),c=!1},d(o){o&&ur(t);for(let e=0;e<h.length;e+=1)h[e].d();$&&$.d(),f&&f.d(),y&&y.d(),e[158](null),d=!1,Wn(u)}}}const Ef=256,Lf="markup-hover",Ff=(e,t)=>e.target===t;function zf(e,t,o){let i,n,r,s,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,k,C,M,T,R,I,A,E,F,z,D,O,B,_,W,V,N,H,j,U,X,G,Y,q,K,J,Q,{uid:ee=L()}=t,{ui:te}=t,{disabled:oe=!1}=t,{markup:ie}=t,{offset:ne}=t,{contextRotation:re=0}=t,{contextFlipX:ae=!1}=t,{contextFlipY:le=!1}=t,{contextZoom:he=1}=t,{active:me=!1}=t,{opacity:$e=1}=t,{parentRect:Se}=t,{rootRect:Me}=t,{utilRect:Re}=t,{hoverColor:Le}=t,{textInputMode:Fe="inline"}=t,{oninteractionstart:De=a}=t,{oninteractionupdate:Oe=a}=t,{oninteractionrelease:Be=a}=t,{oninteractionend:We=a}=t,{oninteractioncancel:Ve=a}=t,{onaddshape:Ne=a}=t,{onupdateshape:He=a}=t,{onselectshape:je=a}=t,{onremoveshape:Xe=a}=t,{ontapshape:Ye=a}=t,{onhovershape:qe=a}=t,{onhovercanvas:Ke=a}=t,{ontapcanvas:Je=a}=t,{beforeSelectShape:Qe=(()=>!0)}=t,{beforeDeselectShape:it=(()=>!0)}=t,{beforeRemoveShape:at=(()=>!0)}=t,{beforeUpdateShape:st=((e,t)=>t)}=t,{willRenderShapeControls:lt=Z}=t,{willRenderShapeTextControls:ct=Z}=t,{willStartInteraction:dt=((e,t)=>!0)}=t,{mapEditorPointToImagePoint:ut}=t,{mapImagePointToEditorPoint:ht}=t,{eraseRadius:pt}=t,{selectRadius:mt}=t,{enableButtonFlipVertical:$t=!1}=t,{enableTapToAddText:ft=!0}=t,{enableTextStyleControls:yt=!0}=t,{locale:wt}=t;const St=_r("isAnimated");Un(e,St,(e=>o(150,J=e)));const kt=(e,t,o)=>{let i=st({...e},t,{...o});ln(e,i,o)},Ct=(e,t)=>{const o=Pe(e,t),i=ye(e,t),n=Math.PI/8,r=n*Math.round(i/n)-re%n;t.x=e.x+o*Math.cos(r),t.y=e.y+o*Math.sin(r)},Mt=(e,t,o,i)=>{const n=ue(e.x-o.x,e.y-o.y),r=ue(i.x-o.x,i.y-o.y),a=Ce(r,r);let s=Ce(n,r)/a;s=s<0?0:s,s=s>1?1:s;const l=ue(r.x*s+o.x-e.x,r.y*s+o.y-e.y);return Ce(l,l)<=t*t},Tt=(e,t,o)=>{const i=o.length;for(let n=0;n<i-1;n++)if(Mt(e,t,o[n],o[n+1]))return!0;return!1},It=(e,t,o)=>!!Rt(e,o)||(!!Tt(e,t,o)||Mt(e,t,o[0],o[o.length-1])),At=(e,t,o,i,n)=>It(e,t,gt(o,i,n||rt(o))),Lt=_r("keysPressed");Un(e,Lt,(e=>o(172,Q=e)));const Ft=(e,t,o)=>0===e||t&&o?e:t||o?-e:e,zt=(e,t)=>{const o=ht(e);return ut(ve(o,t))},Dt=(e,t,o)=>{if(Si(e)){const i=zt($i(t),o),n=zt(fi(t),o);kt(e,{x1:i.x,y1:i.y,x2:n.x,y2:n.y},Se)}else if(e.points)kt(e,{points:t.points.map((e=>zt(e,o)))},Se);else if(vi(e)||yi(e)||wi(e)){const i=zt(t,o);kt(e,i,Se)}Ut()},Ot={0:1,1:0,2:3,3:2},Bt={0:3,1:2,2:1,3:0};let _t;const Wt=()=>{if(ie.length)return ie.find(Ri)},Vt=()=>{if(ie.length)return ie.findIndex(Ri)},Nt=(e,t=!0)=>{if(!Wt())return Fi(e),Zt(e,t)},Ht=()=>{const e=Wt();if(e)return e._isDraft=!1,Ut(),e},jt=()=>{Wt()&&(ie.splice(Vt(),1),Ut())},Ut=()=>o(0,ie),Zt=(e,t=!0)=>(ie.push(e),t&&Ut(),e),Xt=(e,t=[],o=!0)=>{t.filter(Boolean).forEach((t=>delete e[t])),o&&Ut()},Gt=(e,t,o=!0)=>{e=Object.assign(e,t),o&&Ut()},Yt=(e,t,o,i=!0)=>{e[t]=o,i&&Ut()},qt=(e,t=!0)=>{ie.forEach((t=>Gt(t,e,!1))),t&&Ut()},Kt=()=>[...ie].reverse().find(Ti),Jt=()=>!!Kt(),Qt=e=>{if(!at(e))return!1;o(0,ie=ie.filter((t=>t!==e))),Xe(e)},eo=()=>{const e=Kt();if(!e)return;const t=ie.filter((e=>Oi(e)&&Di(e))),o=t.findIndex((t=>t===e));if(!1===Qt(e))return;if(to=e,t.length-1<=0)return oo();const i=o-1<0?t.length-1:o-1;no(t[i])};let to=void 0;const oo=(e={})=>{const{storePrevious:t=!0}=e;Object.keys(No).forEach((e=>No[e]={})),t&&(to=io()),qt({isSelected:!1,isEditing:!1,_prerender:!1})},io=()=>ie.find(Ti),no=(e,t=!0)=>{if(Ri(e))return;const o=io()||to,i=Ti(e);to=void 0,Qe(o,e)&&(oo(),(e=>{e.isSelected=!0})(e),!i&&je(e),t&&Ut())},ro=e=>{Eo&&Eo.confirm&&e.isEditing&&Eo.confirm(),Gt(e,{isSelected:!1,isEditing:!1,_prerender:!1})},ao=e=>{Gt(e,{isSelected:!0,isEditing:!0,_prerender:"inline"===Fe})},so=e=>{Gt(e,{isSelected:!0,isEditing:!1,_prerender:!1})},lo=e=>{if(!e.length)return[];const t=e.filter(at);return o(0,ie=ie.filter((e=>!t.includes(e)))),t},co=e=>{const t=Qo(e.text,e);return nt(e.x,e.y,e.width?Math.min(e.width,t.width):t.width,e.height?Math.min(e.height,t.height):t.height)},uo=e=>{if(Ii(e))return et(e);if(wi(e))return ot(e);const t=co(e);return t.width=Math.max(10,e.width||t.width),t},ho=(e,t=0,o=(()=>!0))=>[...ie].reverse().filter(o).map((e=>({shape:e,priority:1}))).filter((o=>{const{shape:i}=o,n=nn(ui(i),Se),r=t+(n.strokeWidth||0);if(vi(n))return At(e,r,n,i.rotation);if(yi(n)){const t=uo(n),a=At(e,r,t,i.rotation);let s=!1;if(a&&!Ti(i)){const a=co(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=At(e,r,a,i.rotation,rt(t)),s||(o.priority=-1)}return a}return wi(n)?((e,t,o,i,n,r)=>{const a=Et(ue(o.x,o.y),o.rx,o.ry,i,n,r,12);return It(e,t,a)})(e,r,n,i.rotation,i.flipX,i.flipY):Si(n)?Mt(e,Math.max(16,r),$i(n),fi(n)):ki(n)&&n.pathClose?It(e,r,n.points):!!ki(n)&&Tt(e,Math.max(16,r),n.points)})).sort(((e,t)=>e.priority<t.priority?1:e.priority>t.priority?-1:0)).map((e=>e.shape)),po=(e,t,o,i=0)=>{const n=Math.abs(i),r=Ze(t,o),a=Ge(r,n),s=(({start:e,end:t},o)=>{if(0===o)return[ue(e.x,e.y),ue(e.x,e.y),ue(t.x,t.y),ue(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[ue(n+e.x,-r+e.y),ue(-n+e.x,r+e.y),ue(-n+t.x,r+t.y),ue(n+t.x,-r+t.y)]})(a,n);return e.filter((e=>{const t=nn(ui(e),Se);if(Si(t)||ki(t)){const e=t.points?[...t.points]:[$i(t),fi(t)];return!!Pt(a,e)}return((e,t)=>!!e.find((e=>Rt(e,t)))||!!t.find((t=>Rt(t,e))))(s,((e,t=12)=>{if(vi(e))return gt(e,e.rotation,rt(e));if(yi(e)){const t=uo(e);return gt(t,e.rotation,rt(t))}return wi(e)?Et(ue(e.x,e.y),e.rx,e.ry,e.rotation,e.flipX,e.flipY,t):[]})(t))}))};let mo=void 0,go=void 0,$o=void 0,fo=void 0,yo=void 0,bo=void 0,xo=!1,vo=!1;const wo=()=>{clearTimeout(go),go=void 0,o(120,vo=!1)},So=e=>{if(vi(e)){if(e.width<1&&e.height<1)return;const t=rt(e),o=vt(e);return(e.flipX||e.flipY)&&Ae(o,e.flipX,e.flipY,t.x,t.y),Ee(o,e.rotation,t.x,t.y)}if(wi(e)){if(e.rx<1&&e.ry<1)return;const t=e,o=vt(ot(e));return(e.flipX||e.flipY)&&Ae(o,e.flipX,e.flipY,t.x,t.y),Ee(o,e.rotation,t.x,t.y)}if(Si(e))return[$i(e),fi(e)];if(ki(e))return[...e.points];if(yi(e)){if(e.width<5&&e.height<5)return;const t=uo(e);t.width=Math.max(10,t.width);const o=rt(t),i=vt(t);return(e.flipX||e.flipY)&&Ae(i,e.flipX,e.flipY,o.x,o.y),Ee(i,e.rotation,o.x,o.y)}return[]},ko=e=>{const t=So(e);let o,i;return e.flipY?(o=Ie([t[0],t[1]]),i=fe(ue(t[1].x-t[2].x,t[1].y-t[2].y))):(o=Ie([t[2],t[3]]),i=fe(ue(t[2].x-t[1].x,t[2].y-t[1].y))),ke(i,20/he),{origin:o,dir:i}},Co=()=>{const e=te.filter((e=>e.id!==Lf));e.length!==te.length&&o(55,te=e)};let To;const Ro="markup-manipulator-segment-"+ee,Io=()=>{o(55,te=te.filter((e=>e.id!==Ro)))},Ao=e=>e.isContentEditable||/input|textarea/i.test(e.nodeName);let Eo;const Lo=e=>{o(8,Eo.innerHTML=xf(e),Eo)},Fo=e=>{const t=void 0===e.value?e.innerHTML:e.value,o="text"===i.format?gf(t).split(/<br>|<br\/>/g).join("\n").replace(/&nbsp;/g,String.fromCharCode(160)).replace(/&amp;/g,"&"):t;return bi(i)&&!1!==i.disableNewline?(e=>{const t=e.split(/[\n\r]/g);return t.length>1?t.map((e=>e.trim())).filter((e=>e.length)).join(" "):t[0]})(o):o},zo=()=>{const e=Fo(Eo),t=_i(i,e),o=!0===t?e:t;let n=C.x,r=C.y;if(!i.height){const e=gt({...T},i.rotation),t=Qo(o,l),a=gt({x:n,y:r,...t},i.rotation),[s,,c]=e,[d,,u]=a;let h=s,p=d;i.flipX&&(h=c,p=u);const m=we(pe(h),p);n+=m.x,r+=m.y}Gt(i,{x:P(k.x)?Do(n,Se.width):n,y:P(k.y)?Do(r,Se.height):r,text:o})},Bo=()=>{let e=r;r&&Ht(),Eo&&Eo.confirm&&Eo.confirm(),zo(),so(i),e?Ne(i):He(i)},_o=()=>{r?jt():(Gt(i,{text:k.text,x:k.x,y:k.y}),so(i))},Wo=(e,t,{flipX:o,flipY:i,rotation:n},r="top left")=>{let a,s;const[l,c,d,u]=gt(e,n),[h,p,m,g]=gt(t,n);if("top center"===r){a=Ie(i?[u,d]:[l,c]),s=Ie(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 we(pe(a),s)},Vo=(e,t,o)=>ue(P(e.x)?Do(t.x+o.x,Se.width):t.x+o.x,P(e.y)?Do(t.y+o.y,Se.height):t.y+o.y),No={},Ho=()=>ao(i),Uo=()=>{const e=Ue(Qo(i.text,l),(e=>Math.ceil(e))),t=Po(i,"height"),o=!t&&Po(i,"width"),n=i.id;let r=No[n];r||(No[n]={},r=No[n]);const a=e=>{const{width:t,...o}=l,n=Qo(i.text,o),r=Wo(nt(l.x,l.y,e.width,e.height),nt(l.x,l.y,n.width,n.height),l,"top "+i.textAlign),a=!1!==l.disableNewline;Xt(i,["width","height",a&&"textAlign"]),Gt(i,{...Vo(i,l,r)})},s=t=>{const o=_e(r.width||l.width||e.width,e.height),n=r.textAlign||"left",a=Wo(nt(l.x,l.y,t.width,t.height),nt(l.x,l.y,o.width,o.height),l,"top "+n);Xt(i,["height"]),Gt(i,{...Vo(i,l,a),width:P(i.width)?Do(o.width,Se.width):o.width,textAlign:n})},c=t=>{const o=_e(r.width||e.width,r.height||e.height),n=r.textAlign||"left",a=Wo(nt(l.x,l.y,t.width,t.height),nt(l.x,l.y,o.width,o.height),l,"top "+n);Gt(i,{...Vo(i,l,a),width:P(i.width)?Do(o.width,Se.width):o.width,height:P(i.width)?Do(o.height,Se.height):o.height,textAlign:n})};if(t){r.textAlign=i.textAlign,r.width=l.width,r.height=l.height;const e=_e(l.width,l.height);Wi(i,"auto-height")?s(e):Wi(i,"auto-width")&&a(e)}else if(o){r.textAlign=i.textAlign,r.width=l.width;const t=_e(l.width,e.height);Wi(i,"auto-width")?a(t):Wi(i,"fixed-size")&&c(t)}else{r.textAlign=i.textAlign;const t=_e(Math.ceil(e.width),Math.ceil(e.height));Wi(i,"fixed-size")?c(t):Wi(i,"auto-height")&&s(t)}},Zo=e=>{e.stopPropagation();const t=i.flipX||!1;Yt(i,"flipX",!t),He(i)},Xo=e=>{e.stopPropagation();const t=i.flipY||!1;Yt(i,"flipY",!t),He(i)},Go=e=>{Yt(i,"opacity",e)},Yo=e=>{Go(e),He(i)},qo=e=>{e.stopPropagation(),e.target.blur(),eo()},Ko=e=>{e.stopPropagation();ie.findIndex((e=>e===i))!==ie.length-1&&(o(0,ie=ie.filter((e=>e!==i)).concat([i])),He(i))},Jo=e=>{e.stopPropagation(),ei()},ei=()=>{const e=ui(i);e.id=L();const t=ue(50,-50);if(Po(e,"points")){const o=sn(e,["points"],Se);o.points.forEach((e=>{e.x+=t.x,e.y+=t.y})),ln(e,o,Se)}else if(Si(e)){const o=sn(e,["x1","y1","x2","y2"],Se);o.x1+=t.x,o.y1+=t.y,o.x2+=t.x,o.y2+=t.y,ln(e,o,Se)}else{const t=sn(e,["x","y"],Se);t.x+=50,t.y-=50,ln(e,t,Se)}ie.push(e),Ne(e),no(e)},ti=Wl(0,{stiffness:.2,damping:.7});let oi;Un(e,ti,(e=>o(17,K=e)));const ii=(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},ni=(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 ri=!1;let ai=de(),si=void 0;const li=e=>{qe(e),o(121,To=e)};let ci;Dr((()=>{Io(),Co()}));return e.$$set=e=>{"uid"in e&&o(56,ee=e.uid),"ui"in e&&o(55,te=e.ui),"disabled"in e&&o(1,oe=e.disabled),"markup"in e&&o(0,ie=e.markup),"offset"in e&&o(2,ne=e.offset),"contextRotation"in e&&o(57,re=e.contextRotation),"contextFlipX"in e&&o(58,ae=e.contextFlipX),"contextFlipY"in e&&o(59,le=e.contextFlipY),"contextZoom"in e&&o(60,he=e.contextZoom),"active"in e&&o(61,me=e.active),"opacity"in e&&o(62,$e=e.opacity),"parentRect"in e&&o(63,Se=e.parentRect),"rootRect"in e&&o(3,Me=e.rootRect),"utilRect"in e&&o(64,Re=e.utilRect),"hoverColor"in e&&o(65,Le=e.hoverColor),"textInputMode"in e&&o(4,Fe=e.textInputMode),"oninteractionstart"in e&&o(66,De=e.oninteractionstart),"oninteractionupdate"in e&&o(67,Oe=e.oninteractionupdate),"oninteractionrelease"in e&&o(68,Be=e.oninteractionrelease),"oninteractionend"in e&&o(69,We=e.oninteractionend),"oninteractioncancel"in e&&o(70,Ve=e.oninteractioncancel),"onaddshape"in e&&o(71,Ne=e.onaddshape),"onupdateshape"in e&&o(72,He=e.onupdateshape),"onselectshape"in e&&o(73,je=e.onselectshape),"onremoveshape"in e&&o(74,Xe=e.onremoveshape),"ontapshape"in e&&o(75,Ye=e.ontapshape),"onhovershape"in e&&o(76,qe=e.onhovershape),"onhovercanvas"in e&&o(77,Ke=e.onhovercanvas),"ontapcanvas"in e&&o(78,Je=e.ontapcanvas),"beforeSelectShape"in e&&o(79,Qe=e.beforeSelectShape),"beforeDeselectShape"in e&&o(80,it=e.beforeDeselectShape),"beforeRemoveShape"in e&&o(81,at=e.beforeRemoveShape),"beforeUpdateShape"in e&&o(82,st=e.beforeUpdateShape),"willRenderShapeControls"in e&&o(83,lt=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(84,ct=e.willRenderShapeTextControls),"willStartInteraction"in e&&o(85,dt=e.willStartInteraction),"mapEditorPointToImagePoint"in e&&o(86,ut=e.mapEditorPointToImagePoint),"mapImagePointToEditorPoint"in e&&o(87,ht=e.mapImagePointToEditorPoint),"eraseRadius"in e&&o(88,pt=e.eraseRadius),"selectRadius"in e&&o(89,mt=e.selectRadius),"enableButtonFlipVertical"in e&&o(90,$t=e.enableButtonFlipVertical),"enableTapToAddText"in e&&o(91,ft=e.enableTapToAddText),"enableTextStyleControls"in e&&o(5,yt=e.enableTextStyleControls),"locale"in e&&o(6,wt=e.locale)},e.$$.update=()=>{var t,a;3&e.$$.dirty[0]&&o(125,i=!oe&&ie&&(Wt()||Kt())),2&e.$$.dirty[4]&&o(148,n=!!i),2&e.$$.dirty[4]&&o(139,r=i&&Ri(i)),32770&e.$$.dirty[4]&&o(10,s=i&&!r?i.id:void 0),8&e.$$.dirty[0]|2&e.$$.dirty[2]|2&e.$$.dirty[4]&&o(13,l=Me&&i&&nn(ui(i),Se)),32770&e.$$.dirty[4]&&o(123,c=!(!i||!r)),8192&e.$$.dirty[0]|1&e.$$.dirty[2]|2&e.$$.dirty[4]&&o(147,d=i&&$e&&So(l)||[]),2&e.$$.dirty[4]&&o(149,u=i&&(Vi(t=i)&&Ni(t)&&!0!==t.disableResize&&(Ii(t)||xi(t)||wi(t)||Si(t)||ki(t)&&Po(t,"pathClose")))&&!Ci(i)),2&e.$$.dirty[4]&&o(14,h=i&&(e=>Vi(e)&&!0!==e.disableRotate&&(Ii(e)||Po(e,"text")||wi(e)))(i)&&!Ci(i)),33554434&e.$$.dirty[4]&&o(16,p=u&&Po(i,"text")&&!i.height?[[1,2],[3,0]]:(!i||!Si(i)&&!ki(i))&&u),65536&e.$$.dirty[0]|33554434&e.$$.dirty[4]&&o(28,m=!!i&&(!Array.isArray(p)&&u)),8388610&e.$$.dirty[4]&&o(15,g=i&&d.length>1),33554432&e.$$.dirty[2]|8388608&e.$$.dirty[4]&&o(145,$=d.map(ht)),4&e.$$.dirty[0]|2097152&e.$$.dirty[4]&&o(12,f=$.map((e=>ue(e.x-ne.x,e.y-ne.y)))),16777218&e.$$.dirty[4]&&o(27,y=n&&(xi(i)?!Po(i,"disableNewline")||!i.disableNewline:!1===i.disableNewline)),33554432&e.$$.dirty[2]|268435456&e.$$.dirty[3]&&(To&&ht&&!Ti(To)&&Di(To)?(e=>{const t=So(nn(ui(e),Se));if(!t)return;const i=t.map(ht),n=!!e.pathClose||!ki(e)&&!Si(e),r={id:Lf,points:i.map((e=>ue(e.x+1,e.y+1))),strokeColor:[0,0,0,.1],strokeWidth:2,pathClose:n},a={id:Lf,points:i,strokeColor:Le,strokeWidth:2,pathClose:n},s=te.filter((e=>e.id!==Lf));o(55,te=[...s,r,a])})(To):Co()),61440&e.$$.dirty[0]|1&e.$$.dirty[2]&&o(146,b=g&&h&&$e&&f&&(e=>{const t=ko(e),o=ht({x:t.origin.x+t.dir.x,y:t.origin.y+t.dir.y});return{origin:ht(t.origin),position:o}})(l)),4&e.$$.dirty[0]|4194304&e.$$.dirty[4]&&o(26,x=b&&ue(b.position.x-ne.x,b.position.y-ne.y)),536870912&e.$$.dirty[3]|32770&e.$$.dirty[4]&&o(144,v=r&&ki(i)&&si),1&e.$$.dirty[2]|3145730&e.$$.dirty[4]&&i&&$&&$e>0&&((e,t,i)=>{const n=ki(t),r=n&&Po(t,"pathClose"),a=r&&(e=>e.strokeWidth&&((e,t)=>{const o=e.strokeColor;return!!o&&(3===o.length||o[3]>0)})(e))(t),s=Ri(t),l=Ci(t);if(s&&n&&!r)return;const c=[],u=[...$],h=u[u.length-1],p=u[0],m=(l?.05:.1)*e,g=(l?.5:1)*e,f=[0,0,0],y=[1,1,1],x=l?1:1.5;Q.includes(16)&&h&&i&&Ct(h,i);const v=u.length&&r&&s&&i?Te(p,i):1/0,w=u.length&&r&&s&&i?Te(h,i):1/0,S=v<=Ef,k=w<=Ef;!S&&i&&u.push(i);const C=u.length>1,M=!!t.pathClose||!ki(t)&&!Si(t)||u.length>2&&S;C&&c.push({id:Ro,points:u.map((e=>ue(e.x+1,e.y+1))),pathClose:M,strokeColor:f,strokeWidth:2,opacity:m}),r&&c.push(...u.map((e=>({id:Ro,...e,rx:2*x,ry:2*x,backgroundColor:f,opacity:m})))),b&&c.push({id:Ro,points:[ue(b.origin.x+1,b.origin.y+1),ue(b.position.x+1,b.position.y+1)],strokeColor:f,strokeWidth:2,opacity:m}),C&&c.push({id:Ro,points:u,pathClose:M,strokeColor:y,strokeWidth:x,backgroundColor:s&&r&&t.backgroundColor&&t.backgroundColor[3]>0?t.backgroundColor:[0,0,0,0],opacity:g}),r&&c.push(...u.map((e=>({id:Ro,...e,rx:3*x,ry:3*x,backgroundColor:[.5,.5,.5],strokeWidth:x,strokeColor:y})))),r&&s&&$.length>=3&&c.push({...p,id:Ro,rx:x*(S?5:4),ry:x*(S?5:4),backgroundColor:S?Le:[.5,.5,.5],strokeWidth:x,strokeColor:y}),r&&s&&a&&!S&&d.length>=2&&c.push({...h,id:Ro,rx:x*(k?5:4),ry:x*(k?5:4),backgroundColor:k?Le:[.5,.5,.5],strokeWidth:x,strokeColor:y}),b&&c.push({id:Ro,points:[{x:b.origin.x,y:b.origin.y},{x:b.position.x,y:b.position.y}],strokeColor:y,strokeWidth:x,opacity:g}),o(55,te=te.filter((e=>e.id!==Ro)).concat(c))})($e,i,v),2&e.$$.dirty[4]&&(i||Io()),1073741824&e.$$.dirty[1]&&(e=>{if(!e)return qt({_prerender:!1});const t=ie.find((e=>e.isEditing));t&&Gt(t,{_prerender:"inline"===Fe})})(me),272&e.$$.dirty[0]&&Eo&&"inline"===Fe&&Eo.focus(),2&e.$$.dirty[4]&&o(143,w=i&&yi(i)),524290&e.$$.dirty[4]&&o(11,S=w&&!1!==_i(i)&&Ci(i)),2048&e.$$.dirty[0]&&o(138,k=S?{...i}:void 0),2&e.$$.dirty[2]|16384&e.$$.dirty[4]&&o(140,C=k&&nn({...k},Se)),65536&e.$$.dirty[4]&&o(142,M=C&&Qo(C.text,C)),327680&e.$$.dirty[4]&&(T=C&&nt(C.x,C.y,M.width,M.height)),2048&e.$$.dirty[0]|2&e.$$.dirty[4]&&o(23,R=S?i.text:""),2056&e.$$.dirty[0]|2&e.$$.dirty[2]|2&e.$$.dirty[4]&&o(141,I=Me&&i&&S&&nn({...ui(i),width:Mo(i.width)?Math.floor(i.width):void 0,height:Mo(i.height)?Math.floor(i.height):void 0},Se)),2064&e.$$.dirty[0]|131072&e.$$.dirty[4]&&o(25,A=S&&((e,t)=>{const{textAlign:o="left",fontFamily:i="sans-serif",fontWeight:n="normal",fontStyle:r="normal"}=e,a="!important",s=`text-align:${o}${a};font-family:${i}${a};font-weight:${n}${a};font-style:${r}${a};`;if("modal"===t)return s;let l=e.fontSize,c=1,d="";l>1e3&&jo()&&(c=l/1e3,d=`transform-origin:0 0;transform:scale(${c})`,l=1e3);let u=e.lineHeight/c;const h=Oo(e.color),p=.5*Math.max(0,l-u);return`--font-scalar:${c};--bottom-inset:${p}px;padding:${p}px 0 0${a};color:${h}${a};font-size:${l}px${a};line-height:${u}px${a};${s};${d}`})(I,Fe)),2052&e.$$.dirty[0]|603979776&e.$$.dirty[1]|131072&e.$$.dirty[4]&&o(24,E=S&&((e,t,o,n)=>{let r,a;e.width&&e.height?(r=rt(e),a=ze(e)):(a=Qo(i.text,l),a.width=l.width||a.width,r=ue(e.x+.5*a.width,e.y+.5*a.height));const s=Math.max(0,e.fontSize-e.lineHeight)+e.lineHeight,c=ht(r);let d=c.x-t.x-.5*a.width,u=c.y-t.y-.5*a.height,h=e.flipX,p=e.flipY,m=e.rotation;ae&&le?(h=!h,p=!p):ae?(h=!h,m=-m):le&&(p=!p,m=-m),m+=n;const g=o*(h?-1:1),$=o*(p?-1:1);return`--line-height:${s}px;width:${a.width}px;height:${a.height}px;transform:translate(${d}px,${u}px) rotate(${m}rad) scale(${g}, ${$})`})(I,ne,he,re)),2320&e.$$.dirty[0]&&S&&Eo&&"inline"===Fe&&Lo(R),1073741824&e.$$.dirty[3]|34&e.$$.dirty[4]&&o(129,F=i&&!c?i:F),32&e.$$.dirty[4]&&o(131,z=F&&Bi(F)),32&e.$$.dirty[4]&&o(126,D=F&&Wi(F)),32&e.$$.dirty[4]&&o(128,O=F&&(e=>!0!==e.disableDuplicate&&Ni(e))(F)),32&e.$$.dirty[4]&&o(127,B=F&&Oi(F)),32&e.$$.dirty[4]&&o(130,_=F&&(e=>!0!==e.disableReorder)(F)),32&e.$$.dirty[4]&&o(124,W=F&&!1!==_i(F)),32&e.$$.dirty[4]&&o(132,V=F&&Po(F,"backgroundImage")&&zi(F,"opacity")),2&e.$$.dirty[4]&&o(134,N=i&&"html"===i.format),1073741824&e.$$.dirty[3]|1026&e.$$.dirty[4]&&o(137,H=i&&(!c||N)),134217728&e.$$.dirty[3]|67117056&e.$$.dirty[4]&&ti.set(H&&!vo?1:0,{hard:!1===J}),4096&e.$$.dirty[0]|12288&e.$$.dirty[4]&&o(136,j=H&&f.length?(a=tt(f),xe(ue(a.x+.5*a.width,a.y),Cd)):j),512&e.$$.dirty[0]|4&e.$$.dirty[2]|4096&e.$$.dirty[4]&&o(135,U=j&&oi&&Re&&(e=>{const t=Re.x,o=Re.y,i=t+Re.width;let n=Math.max(e.x-.5*oi.width,t),r=Math.max(e.y-oi.height-16,o);return n+oi.width>i&&(n=i-oi.width),ue(n,r)})(j)),131072&e.$$.dirty[0]|2048&e.$$.dirty[4]&&o(22,X=U&&`transform: translate(${U.x}px, ${U.y}px);opacity:${K}`),2048&e.$$.dirty[0]&&o(133,G=S?"text":"shape"),1089&e.$$.dirty[0]|274726912&e.$$.dirty[2]|2047&e.$$.dirty[4]&&o(21,Y="text"===G&&ct&&N?Rh((()=>ct([["div","text-styles",{class:"PinturaShapeControlsGroup"},[...[["bold",{label:"B",style:"font-weight:900;",title:"Bold",shortcut:["CMD","B"]}],["italic",{label:"I",style:"font-family:Times New Roman;font-style:italic;",title:"Italic",shortcut:["CMD","I"]}],["underline",{label:"U",style:"text-decoration:underline;",title:"Underline",shortcut:["CMD","U"]}],["strikeThrough",{label:"S",style:"text-decoration:line-through;",title:"Strikethrough",shortcut:["CMD","S"]}]].map((([e,t])=>["Button","style-"+e,{onclick:()=>document.execCommand(e),...t,style:"font-size:1.25em;text-underline-offset:1px;text-decoration-thickness:1.5px;font-weight:400;"+t.style}]))]],["div","text-reset",{class:"PinturaShapeControlsGroup"},[["Button","style-reset",{onclick:()=>document.execCommand("removeFormat"),style:"font-weight:400;",label:'<span style="font-size:1.25em;font-style:italic;font-family:Times New Roman;text-decoration:underline;">T</span><span style="position:relative;top:.175rem;">&times;</span>',title:"Remove styles"}]]]],s))):"shape"===G&&lt&&s?Rh((()=>lt([V&&["div","alpha",{class:"PinturaShapeControlsGroup"},[["Slider","adjust-opacity",{onrelease:Yo,onchange:Go,step:.01,value:Po(i,"opacity")?i.opacity:1,label:(e,t,o)=>Math.round(e/o*100)+"%",min:0,max:1,direction:"x"}]]],["div","beta",{class:"PinturaShapeControlsGroup"},[z&&["Button","flip-horizontal",{onclick:Zo,label:wt.shapeTitleButtonFlipHorizontal,icon:wt.shapeIconButtonFlipHorizontal,hideLabel:!0}],z&&$t&&["Button","flip-vertical",{onclick:Xo,label:wt.shapeTitleButtonFlipVertical,icon:wt.shapeIconButtonFlipVertical,hideLabel:!0}],_&&["Button","to-front",{onclick:Ko,label:wt.shapeTitleButtonMoveToFront,icon:wt.shapeIconButtonMoveToFront,hideLabel:!0,disabled:ie[ie.length-1]===F}],O&&["Button","duplicate",{onclick:Jo,label:wt.shapeTitleButtonDuplicate,icon:wt.shapeIconButtonDuplicate,shortcut:["CMD","D"],hideLabel:!0}],B&&["Button","remove",{onclick:qo,label:wt.shapeTitleButtonRemove,icon:wt.shapeIconButtonRemove,shortcut:["Backspace"],hideLabel:!0}]].filter(Boolean)],W&&D&&["div","gamma",{class:"PinturaShapeControlsGroup"},[["Button","text-layout",{onclick:Uo,label:Ud(ni,wt,i),icon:Ud(ii,wt,i),hideLabel:!0}]]],W&&["div","delta",{class:"PinturaShapeControlsGroup"},[["Button","edit-text",{label:wt.shapeLabelInputText,onclick:Ho}]]]].filter(Boolean),s))):[]),65&e.$$.dirty[0]&&o(20,q=ie.filter(Di).filter((e=>!Ri(e))).map((e=>({id:e.id,color:yi(e)?e.color:Si(e)?e.strokeColor:e.backgroundColor,name:e.name||wt["shapeLabelTool"+Da(Ji(e))]}))))},[ie,oe,ne,Me,Fe,yt,wt,no,Eo,oi,s,S,f,l,h,g,p,K,ri,ci,q,Y,X,R,E,A,x,y,m,St,Lt,e=>{const{origin:t}=e.detail;fo=void 0,yo=void 0,bo=void 0,xo=!1,$o=void 0,clearTimeout(go),go=setTimeout((()=>o(120,vo=!0)),250);const n=Wt();!n||ki(n)&&Po(n,"pathClose")||Ht(),mo=ut(pe(t));const r=ho(mo,mt,(e=>Di(e))),a=r.length&&r.shift();if(i&&Ci(i)&&Bo(),!a&&i&&Ci(i)&&ro(i),!dt(t))return;if(a&&Ti(a))return xo=!0,fo=a,yo=ui(fo),void(bo=nn(ui(fo),Se));$o=a||void 0;!De(e)&&a&&(no(a),fo=a,yo=ui(fo),bo=nn(ui(fo),Se))},e=>{wo(),Ve(e)},e=>{const{translation:t}=e.detail;if(fo){if(!Ni(fo))return;if(Ci(fo))return;return Dt(fo,bo,t)}Oe(e)},e=>{wo(),fo?Ci(fo)?_o():e.detail.isTap&&xo&&yi(fo)&&!1!==_i(fo)&&ao(fo):Be(e)},e=>{const t=$o&&e.detail.isTap;if(e.detail.isTap&&Je({target:fo||$o,position:mo}),fo)return Ye(fo),o=fo,i=yo,JSON.stringify(o)!==JSON.stringify(i)&&He(fo),void(fo=void 0);var o,i;const n=io(),r=!n||it(n,$o||void 0);r&&oo({storePrevious:!1}),We(e),r&&t&&no($o)},e=>{o(120,vo=!0),fo=i,bo=l},e=>{if(!fo)return void o(120,vo=!1);const{translation:t,indexes:i,shiftKey:n}=e.detail;((e,t,o,i,n)=>{if(Si(e)||ki(e)&&Po(e,"pathClose")){const[n]=o,r=Q.includes(16)?Ct:(e,t)=>t;let a,s,l;if(Si(e))0===n?(a=()=>$i(t),s=e=>r(fi(t),e),l=(e,t)=>{e.x1=t.x,e.y1=t.y}):1===n&&(a=()=>fi(t),s=e=>r($i(t),e),l=(e,t)=>{e.x2=t.x,e.y2=t.y});else{const e=t.points;a=()=>e[n],s=t=>{const o=e[Q$(n-1,e)],i=e[Q$(n+1,e)];r(o,t),r(i,t)},l=(e,t)=>e.points[n]=t}const c=zt(a(),i);s(c),l(e,c)}else if(Ii(e)||wi(e)||xi(e)){let r,a,s=!1;if(wi(e))r=ot(t);else if(Ii(e))r=et(t);else{s=!0,r=et(t);const e=Qo(t.text,t);r.height=e.height}e.aspectRatio?a=e.aspectRatio:n.shiftKey&&!s&&(a=r.width/r.height);const l=et(r),c=rt(l),d=e.rotation,u=vt(l),h=gt(l,d);if(1===o.length){let t=o[0];e.flipX&&(t=Ot[t]),e.flipY&&(t=Bt[t]);const[n,r,s,l]=u,p=ht(h[t]);ve(p,i);const m=ut(p),g=ue(m.x-h[t].x,m.y-h[t].y),$=ge(pe(g),-d),f=ue(u[t].x+$.x,u[t].y+$.y);let y;0===t&&(y=s),1===t&&(y=l),2===t&&(y=n),3===t&&(y=r);const b=tt([y,f]);if(a){const{width:e,height:t}=bt(b,a),[o,i,n,r]=xt(b);b.width=e,b.height=t,f.y<y.y&&(b.y=n-t),f.x<y.x&&(b.x=i-e)}const x=gt(b,d,c),v=Ie(x),w=ge(x[0],-d,v),S=ge(x[2],-d,v),k=tt([w,S]);kt(e,wi(e)?ce(k):k,Se)}else{o=o.map((t=>(e.flipX&&(t=Ot[t]),e.flipY&&(t=Bt[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]})),$={x:m.x+.5*(g.x-m.x),y:m.y+.5*(g.y-m.y)},f=ht(r);ve(f,i);const y=ut(f),b=ue(y.x-r.x,y.y-r.y),x=ge(pe(b),-d),v=we(pe(l),p),w=xe(v,(e=>1-Math.abs(Math.sign(e)))),S=ue(x.x*w.x,x.y*w.y);ve(l,S),ve(p,S);const k=tt(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=$.y-.5*t:k.x=$.x-.5*e}const C=gt(k,d,c),M=Ie(C),T=ge(C[0],-d,M),P=ge(C[2],-d,M),R=tt([T,P]);let I;wi(e)?I=ce(R):Ii(e)?I=R:s&&(I={x:R.x,y:R.y,width:R.width}),kt(e,I,Se)}}Ut()})(fo,bo,i,t,{shiftKey:n})},e=>{if(!fo)return void o(120,vo=!1);no(fo);const{isTap:t}=e.detail;t&&Ye(fo),fo=void 0,o(120,vo=!1),He(i)},e=>{_t=ko(l).origin,o(120,vo=!0),fo=i,bo=l},e=>{if(!fo)return void o(120,vo=!1);const{translation:t,shiftKey:i}=e.detail;((e,t,o,i)=>{const n=uo(nn(ui(e),Se)),r=rt(n),a=zt(_t,o);let s=ye(a,r)+Math.PI/2;if(i.shiftKey){const e=Math.PI/16;s=e*Math.round(s/e)-re%e}kt(e,{rotation:s},Se),Ut()})(fo,0,t,{shiftKey:i})},()=>{fo?(no(fo),fo=void 0,o(120,vo=!1),He(i)):o(120,vo=!1)},e=>{const{key:t}=e,o=/escape/i.test(t);if(Jt()){if(o)return e.preventDefault(),e.stopPropagation(),ro(i);/backspace|delete/i.test(t)&&!Ao(e.target)&&(e.preventDefault(),eo()),O&&"d"===t&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),ei())}},e=>{const t=_i(i,e);return!0===t?e:t},zo,e=>{const{target:t,key:o}=e,n=t.value||t.innerText,r=t.selectionStart||0,a=t.selectionEnd||n.length,s=n.substring(0,r)+o+n.substring(a);if(_i(i,s)!==s)return e.preventDefault()},e=>bi(i)&&/enter/i.test(e.code)&&!1!==i.disableNewline?e.preventDefault():/arrow/i.test(e.code)?e.stopPropagation():/escape/i.test(e.key)?_o():void 0,e=>{const{key:t,ctrlKey:o,altKey:i}=e;if(/enter/i.test(t)&&(o||i))return Bo()},Bo,_o,ti,e=>{const t=Kt();t&&(Ci(t)||Ni(t)&&(fo=t,bo=nn(ui(fo),Se),Dt(fo,bo,e.detail)))},e=>{o(18,ri=!0)},({relatedTarget:e})=>{e&&e.classList.contains("shape-selector__button")||o(18,ri=!1)},e=>{if("touch"===e.pointerType)return;(vo||go)&&li(void 0);const t=lf(e,Me),i=xe(ut(t),(e=>Math.round(e)));if(be(i,ai))return;if(ai=pe(i),o(122,si=t),vo||go)return;if(Ke(t,i),c)return;const[n]=ho(i,0,Di);n&&Ri(n)||li(n)},te,ee,re,ae,le,he,me,$e,Se,Re,Le,De,Oe,Be,We,Ve,Ne,He,je,Xe,Ye,qe,Ke,Je,Qe,it,at,st,lt,ct,dt,ut,ht,pt,mt,$t,ft,(e,t={})=>{let o,i,n,r=wi(e),a=yi(e),s="relative"===t.position;const l="step"===t.inputMode;if(ki(e)){if(l){let t=!1;const r=(e,o)=>{const i=Wt(),n=e&&ue(vf(e.x,Se.width),vf(e.y,Se.height)),r=n&&ht(n);Q.includes(16)&&r&&Ct(r,o);const a=ut(o),l=i.points.length?i.points[0]:a,c=ue(vf(l.x,Se.width),vf(l.y,Se.height)),d=ht(c),u=Te(d,o);if(!t&&1===i.points.length&&u<36)return jt();if(i.points.length>2&&u<=Ef){i.pathClose=!0,no(i);const e=Ht();return void Ne(e)}const h=i.strokeWidth&&i.strokeColor&&(void 0===i.strokeColor[3]||i.strokeColor[3]>0),p=Te(r,o);if(h&&i.points.length>1&&p<Ef){i.pathClose=!1,i.backgroundColor=[0,0,0,0],no(i);const e=Ht();Ne(e)}else if(!(i.points.length>0&&p<100))return s?wf(a,Se):a};return{start:e=>{const{origin:a}=e.detail;i=4,o=pe(a),n=pe(a);const s=Wt();if(s){const e=s.points[s.points.length-1],t=r(e,o);return t&&(s.points=[...s.points,t]),Ut()}t=!0},update:e=>{if(!t)return;const i=Wt();if(!i)return;const n=i.points[0],a=r(n,ue(o.x+e.detail.translation.x,o.y+e.detail.translation.y));a&&(i.points[1]=a,Ut())},release:e=>e.detail.preventInertia(),cancel:e=>jt(),end:i=>{if(!t)return;const n=ut(o),r=s?wf(n,Se):n,{isTap:a}=i.detail;if(a){if(ho(n,0,Di).length)return jt()}Nt({...e,points:[r]})}}}return{start:t=>{const{origin:r}=t.detail;i=4,o=pe(r),n=pe(r);const a=ut(r),l=s?wf(a,Se):a;Nt({...e,points:[l]})},update:e=>{const t=Wt(),{translation:r}=e.detail,a=ue(o.x+r.x,o.y+r.y),l=Pe(n,a);if(se(l,5)<=i)return;const c=ye(a,n),d=i-l;n.x+=d*Math.cos(c),n.y+=d*Math.sin(c);const u=ut(n),h=s?wf(u,Se):u;t.points=t.points.concat(h),Ut()},release:e=>e.detail.preventInertia(),cancel:()=>{jt()},end:e=>{if(e.detail.isTap)return jt();const t=Ht();Ne(t)}}}return r||a||vi(e)?{start:t=>{const{origin:i}=t.detail;o=pe(i);const n=ut(o),a=s?wf(n,Se):n,l=-1*Ft(re,ae,le),c={...e,rotation:l,...a};c.flipX=ae,c.flipY=le,delete c.position,c.opacity=0;(r?["rx","ry"]:["width","height"]).forEach((e=>{c[e]=s?"0%":0})),Nt(c)},update:e=>{const t=Wt();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=ue(o.x+n.x,o.y+n.y),s=ut(o),l=ut(a),c={x:s.x+.5*(l.x-s.x),y:s.y+.5*(l.y-s.y)},d=Ft(re,ae,le);ge(s,d,c),ge(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),kt(t,g,Se),Ut()},release:e=>{e.detail.preventInertia()},cancel:e=>{jt()},end:e=>{const t=Wt();if(e.detail.isTap){if(!yi(t)||!ft||$o)return jt();delete t.width,delete t.height,!1!==t.disableNewline&&delete t.textAlign;const e=nn({...t},Se),i=Qo(t.text,e),n=ut({x:o.x,y:o.y-.5*i.height}),r=ut({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=Ft(re,ae,le);ge(n,s,a),ge(r,s,a);let l=Math.min(n.x,r.x),c=Math.min(n.y,r.y);l<0&&(l=0),c<0&&(c=0),l+i.width>Se.width&&(l=Se.width-i.width),c+i.height>Se.height&&(c=Se.height-i.height),t.x=P(t.x)?Do(l,Se.width):l,t.y=P(t.y)?Do(c,Se.height):c}if(t.opacity=1,!yi(t)){const e=Ht();Ne(e)}no(t),yi(t)&&ao(t)}}:Si(e)?{start:t=>{const{origin:i}=t.detail,n=ut(i),r=xe(n,Cd);o=pe(i),Nt({...e,x1:s?Do(r.x,Se.width):r.x,y1:s?Do(r.y,Se.height):r.y,x2:s?Do(r.x,Se.width):r.x,y2:s?Do(r.y,Se.height):r.y,opacity:0})},update:e=>{const t=Wt(),{translation:i}=e.detail,n=ve(pe(o),i);if(Q.includes(16)){const e=Pe(o,n),t=ye(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=ut(n);Gt(t,{x2:s?Do(r.x,Se.width):r.x,y2:s?Do(r.y,Se.height):r.y,opacity:1}),Ut()},release:e=>e.detail.preventInertia(),cancel:e=>{jt()},end:e=>{const t=Wt();if(e.detail.isTap)return jt();t.opacity=1;const o=Ht();Ne(o),no(o)}}:void 0},()=>{let e,t;const o=pt*pt,i=(e,t,i=!1)=>{const n=Te(e,t);if(!i&&n<2)return!1;const r=ie.filter((e=>!e.disableErase));let a;a=n<o?ho(ut(t),pt):po(r,ut(e),ut(t),pt);return lo(a).forEach(Xe),!0};return{start:o=>{e=ue(Math.round(o.detail.origin.x),Math.round(o.detail.origin.y)),i(e,e,!0),t=e},update:o=>{const{translation:n}=o.detail,r=ue(Math.round(e.x+n.x),Math.round(e.y+n.y));i(t,r)&&(t=pe(r))},release:e=>e.detail.preventInertia(),end:()=>{}}},Wt,Vt,Nt,Ht,jt,(e={})=>({id:L(),...e}),Ut,Zt,Xt,Gt,Yt,(e,t,o=!0)=>{ie.forEach((o=>Yt(o,e,t,!1))),o&&Ut()},qt,Kt,Jt,Qt,eo,oo,ro,ao,so,lo,co,uo,ho,po,vo,To,si,c,W,i,D,B,O,F,_,z,V,G,N,U,j,H,k,r,C,I,M,w,v,$,b,d,n,u,J,function(t){Wr.call(this,e,t)},e=>no(ie[e]),function(e){Nr[e?"unshift":"push"]((()=>{Eo=e,o(8,Eo)}))},function(){R=this.value,o(23,R),o(11,S),o(125,i),o(143,w),o(1,oe),o(0,ie)},function(e){Nr[e?"unshift":"push"]((()=>{Eo=e,o(8,Eo)}))},()=>{ci&&ci.focus()},e=>o(9,oi=e.detail),function(e){Nr[e?"unshift":"push"]((()=>{ci=e,o(19,ci)}))},e=>lf(e,Me)]}class Df extends wa{constructor(e){super(),va(this,e,zf,Af,Nn,{uid:56,ui:55,disabled:1,markup:0,offset:2,contextRotation:57,contextFlipX:58,contextFlipY:59,contextZoom:60,active:61,opacity:62,parentRect:63,rootRect:3,utilRect:64,hoverColor:65,textInputMode:4,oninteractionstart:66,oninteractionupdate:67,oninteractionrelease:68,oninteractionend:69,oninteractioncancel:70,onaddshape:71,onupdateshape:72,onselectshape:73,onremoveshape:74,ontapshape:75,onhovershape:76,onhovercanvas:77,ontapcanvas:78,beforeSelectShape:79,beforeDeselectShape:80,beforeRemoveShape:81,beforeUpdateShape:82,willRenderShapeControls:83,willRenderShapeTextControls:84,willStartInteraction:85,mapEditorPointToImagePoint:86,mapImagePointToEditorPoint:87,eraseRadius:88,selectRadius:89,enableButtonFlipVertical:90,enableTapToAddText:91,enableTextStyleControls:5,locale:6,createShape:92,eraseShape:93,getMarkupItemDraft:94,getMarkupItemDraftIndex:95,addMarkupItemDraft:96,confirmMarkupItemDraft:97,discardMarkupItemDraft:98,createMarkupItem:99,syncShapes:100,addShape:101,removeMarkupShapeProps:102,updateMarkupShape:103,updateMarkupShapeProperty:104,updateMarkupItemsShapeProperty:105,updateMarkupShapeItems:106,getActiveMarkupItem:107,hasActiveMarkupItem:108,removeShape:109,removeActiveMarkupItem:110,blurShapes:111,selectShape:7,deselectMarkupItem:112,editMarkupItem:113,finishEditMarkupItem:114,removeMarkupItems:115,getTextShapeRect:116,getMarkupShapeRect:117,getShapesNearPosition:118,getShapesBetweenPoints:119},null,[-1,-1,-1,-1,-1,-1,-1,-1])}get createShape(){return this.$$.ctx[92]}get eraseShape(){return this.$$.ctx[93]}get getMarkupItemDraft(){return this.$$.ctx[94]}get getMarkupItemDraftIndex(){return this.$$.ctx[95]}get addMarkupItemDraft(){return this.$$.ctx[96]}get confirmMarkupItemDraft(){return this.$$.ctx[97]}get discardMarkupItemDraft(){return this.$$.ctx[98]}get createMarkupItem(){return this.$$.ctx[99]}get syncShapes(){return this.$$.ctx[100]}get addShape(){return this.$$.ctx[101]}get removeMarkupShapeProps(){return this.$$.ctx[102]}get updateMarkupShape(){return this.$$.ctx[103]}get updateMarkupShapeProperty(){return this.$$.ctx[104]}get updateMarkupItemsShapeProperty(){return this.$$.ctx[105]}get updateMarkupShapeItems(){return this.$$.ctx[106]}get getActiveMarkupItem(){return this.$$.ctx[107]}get hasActiveMarkupItem(){return this.$$.ctx[108]}get removeShape(){return this.$$.ctx[109]}get removeActiveMarkupItem(){return this.$$.ctx[110]}get blurShapes(){return this.$$.ctx[111]}get selectShape(){return this.$$.ctx[7]}get deselectMarkupItem(){return this.$$.ctx[112]}get editMarkupItem(){return this.$$.ctx[113]}get finishEditMarkupItem(){return this.$$.ctx[114]}get removeMarkupItems(){return this.$$.ctx[115]}get getTextShapeRect(){return this.$$.ctx[116]}get getMarkupShapeRect(){return this.$$.ctx[117]}get getShapesNearPosition(){return this.$$.ctx[118]}get getShapesBetweenPoints(){return this.$$.ctx[119]}}function Of(e,t,o){const i=e.slice();return i[9]=t[o],i}function Bf(e,t){let o,i,n,r,a,s,l,c=Ud(t[9].componentProps.title,t[1])+"";const d=[t[9].componentProps];var u=t[9].component;function h(e){let t={};for(let e=0;e<d.length;e+=1)t=On(t,d[e]);return{props:t}}return u&&(a=Mr(u,h())),{key:e,first:null,c(){o=hr("li"),i=hr("span"),n=mr(c),r=gr(),a&&ya(a.$$.fragment),s=gr(),xr(i,"class","PinturaShapeStyleLabel"),xr(o,"class","PinturaShapeStyle"),this.first=o},m(e,t){dr(e,o,t),sr(o,i),sr(i,n),sr(o,r),a&&ba(a,o,null),sr(o,s),l=!0},p(e,i){t=e,(!l||3&i)&&c!==(c=Ud(t[9].componentProps.title,t[1])+"")&&wr(n,c);const r=1&i?ga(d,[$a(t[9].componentProps)]):{};if(u!==(u=t[9].component)){if(a){ra();const e=a;la(e.$$.fragment,1,0,(()=>{xa(e,1)})),aa()}u?(a=Mr(u,h()),ya(a.$$.fragment),sa(a.$$.fragment,1),ba(a,o,s)):a=null}else u&&a.$set(r)},i(e){l||(a&&sa(a.$$.fragment,e),l=!0)},o(e){a&&la(a.$$.fragment,e),l=!1},d(e){e&&ur(o),a&&xa(a)}}}function _f(e){let t,o,i=[],n=new Map,r=e[0];const a=e=>e[9].id;for(let t=0;t<r.length;t+=1){let o=Of(e,r,t),s=a(o);n.set(s,i[t]=Bf(s,o))}return{c(){t=hr("ul");for(let e=0;e<i.length;e+=1)i[e].c();xr(t,"class","PinturaShapeStyleList")},m(e,n){dr(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],ra(),i=ma(i,o,a,1,e,r,n,t,pa,Bf,null,Of),aa())},i(e){if(!o){for(let e=0;e<r.length;e+=1)sa(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)la(i[e]);o=!1},d(e){e&&ur(t);for(let e=0;e<i.length;e+=1)i[e].d()}}}function Wf(e){let t,o,i;return o=new ad({props:{class:"PinturaShapeStyles",elasticity:e[2],$$slots:{default:[_f]},$$scope:{ctx:e}}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"style",e[3])},m(e,n){dr(e,t,n),ba(o,t,null),i=!0},p(e,[n]){const r={};4&n&&(r.elasticity=e[2]),4099&n&&(r.$$scope={dirty:n,ctx:e}),o.$set(r),(!i||8&n)&&xr(t,"style",e[3])},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o)}}}function Vf(e,t,o){let i,n,r,{isActive:a=!1}=t,{controls:s=[]}=t,{locale:l}=t,{scrollElasticity:c}=t;const d=_r("isAnimated");Un(e,d,(e=>o(8,r=e)));const u=Wl(0,{stiffness:.25,damping:.9});return Un(e,u,(e=>o(7,n=e))),e.$$set=e=>{"isActive"in e&&o(6,a=e.isActive),"controls"in e&&o(0,s=e.controls),"locale"in e&&o(1,l=e.locale),"scrollElasticity"in e&&o(2,c=e.scrollElasticity)},e.$$.update=()=>{320&e.$$.dirty&&u.set(a?1:0,{hard:!1===r}),192&e.$$.dirty&&o(3,i=`opacity:${n};${a?"":"pointer-events:none;"}${n<=0?"visibility:hidden":""}`)},[s,l,c,i,d,u,a,n,r]}class Nf extends wa{constructor(e){super(),va(this,e,Vf,Wf,Nn,{isActive:6,controls:0,locale:1,scrollElasticity:2})}}function Hf(e,t,o){const i=e.slice();return i[12]=t[o].key,i[3]=t[o].controls,i[13]=t[o].isActive,i}function jf(e,t){let o,i,n;return i=new Nf({props:{isActive:t[13],controls:t[3],locale:t[1],scrollElasticity:t[2]}}),{key:e,first:null,c(){o=$r(),ya(i.$$.fragment),this.first=o},m(e,t){dr(e,o,t),ba(i,e,t),n=!0},p(e,o){t=e;const n={};16&o&&(n.isActive=t[13]),16&o&&(n.controls=t[3]),2&o&&(n.locale=t[1]),4&o&&(n.scrollElasticity=t[2]),i.$set(n)},i(e){n||(sa(i.$$.fragment,e),n=!0)},o(e){la(i.$$.fragment,e),n=!1},d(e){e&&ur(o),xa(i,e)}}}function Uf(e){let t,o,i,n=[],r=new Map,a=e[4];const s=e=>e[12];for(let t=0;t<a.length;t+=1){let o=Hf(e,a,t),i=s(o);r.set(i,n[t]=jf(i,o))}return{c(){t=hr("div");for(let e=0;e<n.length;e+=1)n[e].c();xr(t,"class",o=hc(["PinturaShapeStyleEditor",e[0]]))},m(e,o){dr(e,t,o);for(let e=0;e<n.length;e+=1)n[e].m(t,null);i=!0},p(e,[l]){22&l&&(a=e[4],ra(),n=ma(n,l,s,1,e,a,r,t,pa,jf,null,Hf),aa()),(!i||1&l&&o!==(o=hc(["PinturaShapeStyleEditor",e[0]])))&&xr(t,"class",o)},i(e){if(!i){for(let e=0;e<a.length;e+=1)sa(n[e]);i=!0}},o(e){for(let e=0;e<n.length;e+=1)la(n[e]);i=!1},d(e){e&&ur(t);for(let e=0;e<n.length;e+=1)n[e].d()}}}function Zf(e,t,o){let i,n,r,{class:a}=t,{controls:s={}}=t,{shape:l}=t,{onchange:c}=t,{locale:d}=t,{scrollElasticity:u}=t;const h=[];return e.$$set=e=>{"class"in e&&o(0,a=e.class),"controls"in e&&o(3,s=e.controls),"shape"in e&&o(5,l=e.shape),"onchange"in e&&o(6,c=e.onchange),"locale"in e&&o(1,d=e.locale),"scrollElasticity"in e&&o(2,u=e.scrollElasticity)},e.$$.update=()=>{8&e.$$.dirty&&o(8,i=Object.keys(s).filter((e=>s[e]))),288&e.$$.dirty&&o(7,n=l&&Object.keys(l).length&&i&&zi(l)?(e=>i.filter((t=>t.split("_").every((t=>Po(e,t)&&zi(e,t))))).map((t=>{const o=t.split("_"),i=o.length>1?o.map((t=>e[t])):e[t];let[n,r]=s[t];if(P(n))if(s[n]){const e={...r};[n,r]=s[n],r={...r,...e}}else{if("Dropdown"!==n)return;n=Lu}const a=R(r.options)?r.options(e):r.options;return{id:t,component:n,componentProps:{...r,options:a,locale:d,value:i,optionLabelClass:"PinturaButtonLabel",onchange:i=>{const n=C(i)&&!Ro(i)?i.value:i;r.onchange&&r.onchange(n,e);const a=o.length>1?o.reduce(((e,t,o)=>({...e,[t]:Array.isArray(n)?n[o]:n})),{}):{[t]:n};c(a)}}}})).filter(Boolean))(l):[]),160&e.$$.dirty&&o(4,r=((e,t)=>{let o=h.find((t=>t.key===e));return o||(o={key:e,controls:t},h.push(o)),h.forEach((e=>e.isActive=!1)),o.controls=t,o.isActive=!0,h})(l&&Object.keys(l).length?Object.keys(l).join("_"):"none",n||[]))},[a,d,u,s,r,l,c,n,i]}class Xf extends wa{constructor(e){super(),va(this,e,Zf,Uf,Nn,{class:0,controls:3,shape:5,onchange:6,locale:1,scrollElasticity:2})}}const{document:Gf}=ua;function Yf(e){let t,o,i,n;return{c(){t=gr(),o=hr("button"),xr(o,"class","PinturaDragButton"),xr(o,"type","button"),xr(o,"title",e[1]),o.disabled=e[2]},m(r,a){dr(r,t,a),dr(r,o,a),o.innerHTML=e[0],e[11](o),i||(n=[fr(Gf.body,"load",e[5],!0),fr(Gf.body,"error",e[6],!0),fr(o,"pointerdown",e[4])],i=!0)},p(e,[t]){1&t&&(o.innerHTML=e[0]),2&t&&xr(o,"title",e[1]),4&t&&(o.disabled=e[2])},i:zn,o:zn,d(r){r&&ur(t),r&&ur(o),e[11](null),i=!1,Wn(n)}}}function qf(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=>Te(p,ue(e.pageX,e.pageY))<256;let p;const m=e=>{document.documentElement.removeEventListener("pointermove",g),document.documentElement.removeEventListener("pointerup",m);const t=ue(e.pageX,e.pageY);if(Te(p,t)<32)return s(e);h(e)||u(e)},g=e=>{h(e)||d(e)},$=e=>i&&i.contains(e)&&"IMG"===e.nodeName;return e.$$set=e=>{"html"in e&&o(0,n=e.html),"title"in e&&o(1,r=e.title),"onclick"in e&&o(7,s=e.onclick),"disabled"in e&&o(2,l=e.disabled),"ongrab"in e&&o(8,c=e.ongrab),"ondrag"in e&&o(9,d=e.ondrag),"ondrop"in e&&o(10,u=e.ondrop)},e.$$.update=()=>{8&e.$$.dirty&&i&&i.querySelector("img")&&o(3,i.dataset.loader=!0,i)},[n,r,l,i,e=>{p=ue(e.pageX,e.pageY),c(e),document.documentElement.addEventListener("pointermove",g),document.documentElement.addEventListener("pointerup",m)},({target:e})=>{$(e)&&o(3,i.dataset.load=!0,i)},({target:e})=>{$(e)&&o(3,i.dataset.error=!0,i)},s,c,d,u,function(e){Nr[e?"unshift":"push"]((()=>{i=e,o(3,i)}))}]}class Kf extends wa{constructor(e){super(),va(this,e,qf,Yf,Nn,{html:0,title:1,onclick:7,disabled:2,ongrab:8,ondrag:9,ondrop:10})}}function Jf(e,t,o){const i=e.slice();return i[14]=t[o],i}function Qf(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 Kf({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=hr("li"),ya(i.$$.fragment),n=gr(),xr(o,"class","PinturaShapePreset"),xr(o,"style",t[6]),this.first=o},m(e,c){dr(e,o,c),ba(i,o,null),sr(o,n),a=!0,s||(l=er(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)&&xr(o,"style",t[6]),r&&Vn(r.update)&&1&n&&r.update.call(null,t[14])},i(e){a||(sa(i.$$.fragment,e),a=!0)},o(e){la(i.$$.fragment,e),a=!1},d(e){e&&ur(o),xa(i),s=!1,l()}}}function ey(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=Jf(e,r,t),s=a(o);n.set(s,i[t]=Qf(s,o))}return{c(){t=hr("ul");for(let e=0;e<i.length;e+=1)i[e].c();xr(t,"class","PinturaShapePresetsList")},m(e,n){dr(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],ra(),i=ma(i,o,a,1,e,r,n,t,pa,Qf,null,Jf),aa())},i(e){if(!o){for(let e=0;e<r.length;e+=1)sa(i[e]);o=!0}},o(e){for(let e=0;e<i.length;e+=1)la(i[e]);o=!1},d(e){e&&ur(t);for(let e=0;e<i.length;e+=1)i[e].d()}}}function ty(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=Wl(0,{stiffness:.25,damping:.9});Un(e,u,(e=>o(9,n=e)));Fr((()=>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 oy extends wa{constructor(e){super(),va(this,e,ty,ey,Nn,{presets:0,disabled:1,onclickpreset:2,ongrabpreset:3,ondragpreset:4,ondroppreset:5})}}var iy=e=>/<svg /.test(e);function ny(e){let t,o;return t=new dh({props:{items:e[10]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function ry(e){let t,o,i,n;const r=[sy,ay],a=[];function s(e,t){return e[8]?0:1}return t=s(e),o=a[t]=r[t](e),{c(){o.c(),i=$r()},m(e,o){a[t].m(e,o),dr(e,i,o),n=!0},p(e,n){let l=t;t=s(e),t===l?a[t].p(e,n):(ra(),la(a[l],1,1,(()=>{a[l]=null})),aa(),o=a[t],o?o.p(e,n):(o=a[t]=r[t](e),o.c()),sa(o,1),o.m(i.parentNode,i))},i(e){n||(sa(o),n=!0)},o(e){la(o),n=!1},d(e){a[t].d(e),e&&ur(i)}}}function ay(e){let t,o,i,n,r=e[10]&&ly(e);return i=new ad({props:{scrollAutoCancel:e[9],elasticity:e[0],$$slots:{default:[cy]},$$scope:{ctx:e}}}),{c(){t=hr("div"),r&&r.c(),o=gr(),ya(i.$$.fragment),xr(t,"class","PinturaShapePresetsFlat")},m(e,a){dr(e,t,a),r&&r.m(t,null),sr(t,o),ba(i,t,null),n=!0},p(e,n){e[10]?r?(r.p(e,n),1024&n&&sa(r,1)):(r=ly(e),r.c(),sa(r,1),r.m(t,o)):r&&(ra(),la(r,1,1,(()=>{r=null})),aa());const a={};512&n&&(a.scrollAutoCancel=e[9]),1&n&&(a.elasticity=e[0]),536871070&n&&(a.$$scope={dirty:n,ctx:e}),i.$set(a)},i(e){n||(sa(r),sa(i.$$.fragment,e),n=!0)},o(e){la(r),la(i.$$.fragment,e),n=!1},d(e){e&&ur(t),r&&r.d(),xa(i)}}}function sy(e){let t,o,i,n,r;o=new ad({props:{elasticity:e[0],class:"PinturaShapePresetsGroups",$$slots:{default:[gy]},$$scope:{ctx:e}}});const a=[{class:"PinturaControlPanels"},{panelClass:"PinturaControlPanel"},{panels:e[11]},e[12]];let s={$$slots:{default:[fy,({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<a.length;e+=1)s=On(s,a[e]);return n=new Ec({props:s}),{c(){t=hr("div"),ya(o.$$.fragment),i=gr(),ya(n.$$.fragment),xr(t,"class","PinturaShapePresetsGrouped")},m(e,a){dr(e,t,a),ba(o,t,null),sr(t,i),ba(n,t,null),r=!0},p(e,t){const i={};1&t&&(i.elasticity=e[0]),536876128&t&&(i.$$scope={dirty:t,ctx:e}),o.$set(i);const r=6144&t?ga(a,[a[0],a[1],2048&t&&{panels:e[11]},4096&t&&$a(e[12])]):{};738206239&t&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(sa(o.$$.fragment,e),sa(n.$$.fragment,e),r=!0)},o(e){la(o.$$.fragment,e),la(n.$$.fragment,e),r=!1},d(e){e&&ur(t),xa(o),xa(n)}}}function ly(e){let t,o;return t=new dh({props:{items:e[10]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function cy(e){let t,o;return t=new oy({props:{presets:e[7],onclickpreset:e[1],ongrabpreset:e[2],ondragpreset:e[3],ondroppreset:e[4]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};128&o&&(i.presets=e[7]),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||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function dy(e){let t,o;return t=new dh({props:{items:e[10]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};1024&o&&(i.items=e[10]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function uy(e){let t,o;return t=new Wc({props:{$$slots:{default:[hy]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};805306368&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function hy(e){let t,o=e[28].icon+"";return{c(){t=pr("g")},m(e,i){dr(e,t,i),t.innerHTML=o},p(e,i){268435456&i&&o!==(o=e[28].icon+"")&&(t.innerHTML=o)},d(e){e&&ur(t)}}}function py(e){let t,o,i=e[28].label+"";return{c(){t=hr("span"),o=mr(i)},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){268435456&t&&i!==(i=e[28].label+"")&&wr(o,i)},d(e){e&&ur(t)}}}function my(e){let t,o,i,n=e[28].icon&&uy(e),r=!e[28].hideLabel&&py(e);return{c(){n&&n.c(),t=gr(),r&&r.c(),o=$r()},m(e,a){n&&n.m(e,a),dr(e,t,a),r&&r.m(e,a),dr(e,o,a),i=!0},p(e,i){e[28].icon?n?(n.p(e,i),268435456&i&&sa(n,1)):(n=uy(e),n.c(),sa(n,1),n.m(t.parentNode,t)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa()),e[28].hideLabel?r&&(r.d(1),r=null):r?r.p(e,i):(r=py(e),r.c(),r.m(o.parentNode,o))},i(e){i||(sa(n),i=!0)},o(e){la(n),i=!1},d(e){n&&n.d(e),e&&ur(t),r&&r.d(e),e&&ur(o)}}}function gy(e){let t,o,i,n=e[10]&&dy(e);const r=[{class:"PinturaControlList"},{tabs:e[5]},e[12],{layout:"compact"}];let a={$$slots:{default:[my,({tab:e})=>({28:e}),({tab:e})=>e?268435456:0]},$$scope:{ctx:e}};for(let e=0;e<r.length;e+=1)a=On(a,r[e]);return o=new xc({props:a}),o.$on("select",e[18]),{c(){n&&n.c(),t=gr(),ya(o.$$.fragment)},m(e,r){n&&n.m(e,r),dr(e,t,r),ba(o,e,r),i=!0},p(e,i){e[10]?n?(n.p(e,i),1024&i&&sa(n,1)):(n=dy(e),n.c(),sa(n,1),n.m(t.parentNode,t)):n&&(ra(),la(n,1,1,(()=>{n=null})),aa());const a=4128&i?ga(r,[r[0],32&i&&{tabs:e[5]},4096&i&&$a(e[12]),r[3]]):{};805306368&i&&(a.$$scope={dirty:i,ctx:e}),o.$set(a)},i(e){i||(sa(n),sa(o.$$.fragment,e),i=!0)},o(e){la(n),la(o.$$.fragment,e),i=!1},d(e){n&&n.d(e),e&&ur(t),xa(o,e)}}}function $y(e){let t,o;return t=new oy({props:{presets:e[13][e[26]].items,disabled:e[13][e[26]].disabled,onclickpreset:e[1],ongrabpreset:e[2],ondragpreset:e[3],ondroppreset:e[4]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};67117056&o&&(i.presets=e[13][e[26]].items),67117056&o&&(i.disabled=e[13][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||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function fy(e){let t,o;return t=new ad({props:{scroll:e[27]?{scrollOffset:0,animate:!1}:void 0,scrollAutoCancel:e[9],elasticity:e[0],$$slots:{default:[$y]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};134217728&o&&(i.scroll=e[27]?{scrollOffset:0,animate:!1}:void 0),512&o&&(i.scrollAutoCancel=e[9]),1&o&&(i.elasticity=e[0]),603987998&o&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function yy(e){let t,o,i,n;const r=[ry,ny],a=[];function s(e,t){return e[9]?0:e[10]?1:-1}return~(o=s(e))&&(i=a[o]=r[o](e)),{c(){t=hr("div"),i&&i.c(),xr(t,"class","PinturaShapePresetsPalette")},m(e,i){dr(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&&(ra(),la(a[l],1,1,(()=>{a[l]=null})),aa()),~o?(i=a[o],i?i.p(e,n):(i=a[o]=r[o](e),i.c()),sa(i,1),i.m(t,null)):i=null)},i(e){n||(sa(i),n=!0)},o(e){la(i),n=!1},d(e){e&&ur(t),~o&&a[o].d()}}}function by(e,t,o){let i,n,r,s,l,c,d,u,h,{locale:p}=t,{presets:m}=t,{scrollElasticity:g}=t,{enableSelectImage:$=!0}=t,{willRenderPresetToolbar:f=Z}=t,{onaddpreset:y=a}=t,{ongrabpreset:b}=t,{ondragpreset:x}=t,{ondroppreset:v}=t;const w="presets-"+L(),S=(e,t="")=>iy(e)?e:To(e)?Fo(e,t):`<img src="${e}" alt="${t}"/>`,k=e=>V(Ot(e)),C=["src","alt","thumb","shape","id","mount","disabled"],M=e=>e.map((e=>(e=>Ro(e)&&P(e[0])&&Ro(e[1]))(e)?{...e[2],id:`${w}-${e[0].toLowerCase()}`,label:e[0],items:M(e[1])}:(e=>{let t,o,i,n,r,a,s,l=e;return P(e)?To(e)?(t=e,r=e,n=S(t,r)):(t=e,r=k(t),n=S(t,r)):(t=e.src,r=e.alt||(P(t)?k(t):P(e.thumb)?k(e.thumb):void 0),n=S(e.thumb||t,r),o=e.shape,a=e.mount,s=e.disabled,i=Object.keys(e).reduce(((t,o)=>(C.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,g=e.scrollElasticity),"enableSelectImage"in e&&o(16,$=e.enableSelectImage),"willRenderPresetToolbar"in e&&o(17,f=e.willRenderPresetToolbar),"onaddpreset"in e&&o(1,y=e.onaddpreset),"ongrabpreset"in e&&o(2,b=e.ongrabpreset),"ondragpreset"in e&&o(3,x=e.ondragpreset),"ondroppreset"in e&&o(4,v=e.ondroppreset)},e.$$.update=()=>{32768&e.$$.dirty&&o(7,i=M(m)),128&e.$$.dirty&&o(9,n=i.length),640&e.$$.dirty&&o(8,r=n&&i.some((e=>!!e.items))),384&e.$$.dirty&&o(5,s=r&&i),384&e.$$.dirty&&o(13,l=r&&i.reduce(((e,t)=>(e[t.id]=t,e)),{})),96&e.$$.dirty&&o(6,c=c||s&&(s.find((e=>!e.disabled))||{}).id),64&e.$$.dirty&&o(12,d={name:w,selected:c}),32&e.$$.dirty&&o(11,u=s&&s.map((e=>e.id))),212994&e.$$.dirty&&o(10,h=p&&f([$&&["Button","browse",{label:p.shapeLabelButtonSelectSticker,icon:p.shapeIconButtonSelectSticker,onclick:()=>{Ph().then((e=>{e&&y(e)}))}}]]))},[g,y,b,x,v,s,c,i,r,n,h,u,d,l,p,m,$,f,({detail:e})=>o(6,c=e)]}class xy extends wa{constructor(e){super(),va(this,e,by,yy,Nn,{locale:14,presets:15,scrollElasticity:0,enableSelectImage:16,willRenderPresetToolbar:17,onaddpreset:1,ongrabpreset:2,ondragpreset:3,ondroppreset:4})}}function vy(e){let t,o,i,n;const r=[{locale:e[4]},{uid:e[14]},{parentRect:e[29]},{rootRect:e[43]},{utilRect:e[30]},{offset:e[38]},{disabled:e[28]},{contextRotation:e[17]},{contextFlipX:e[18]},{contextFlipY:e[19]},{contextZoom:e[42]},{active:e[26]},{opacity:e[45]},{hoverColor:e[46]},{eraseRadius:e[37]},{selectRadius:e[6]},{enableButtonFlipVertical:e[9]},{mapEditorPointToImagePoint:e[15]},{mapImagePointToEditorPoint:e[16]},{enableTapToAddText:e[12]},{textInputMode:e[7]},{willStartInteraction:e[80]},{oninteractionstart:e[66]},{oninteractionupdate:e[67]},{oninteractionrelease:e[68]},{oninteractionend:e[70]},{oninteractioncancel:e[69]},{onhovershape:e[74]},{ontapcanvas:e[73]},{onaddshape:e[123]},{onselectshape:e[124]},{ontapshape:e[125]},{onupdateshape:e[126]},{onremoveshape:e[127]},e[32]];function a(t){e[129](t)}function s(t){e[130](t)}let l={};for(let e=0;e<r.length;e+=1)l=On(l,r[e]);return void 0!==e[27]&&(l.markup=e[27]),void 0!==e[44]&&(l.ui=e[44]),t=new Df({props:l}),e[128](t),Nr.push((()=>fa(t,"markup",a))),Nr.push((()=>fa(t,"ui",s))),{c(){ya(t.$$.fragment)},m(e,o){ba(t,e,o),n=!0},p(e,n){const a=1955582672&n[0]|55490&n[1]|793072&n[2]?ga(r,[16&n[0]&&{locale:e[4]},16384&n[0]&&{uid:e[14]},536870912&n[0]&&{parentRect:e[29]},4096&n[1]&&{rootRect:e[43]},1073741824&n[0]&&{utilRect:e[30]},128&n[1]&&{offset:e[38]},268435456&n[0]&&{disabled:e[28]},131072&n[0]&&{contextRotation:e[17]},262144&n[0]&&{contextFlipX:e[18]},524288&n[0]&&{contextFlipY:e[19]},2048&n[1]&&{contextZoom:e[42]},67108864&n[0]&&{active:e[26]},16384&n[1]&&{opacity:e[45]},32768&n[1]&&{hoverColor:e[46]},64&n[1]&&{eraseRadius:e[37]},64&n[0]&&{selectRadius:e[6]},512&n[0]&&{enableButtonFlipVertical:e[9]},32768&n[0]&&{mapEditorPointToImagePoint:e[15]},65536&n[0]&&{mapImagePointToEditorPoint:e[16]},4096&n[0]&&{enableTapToAddText:e[12]},128&n[0]&&{textInputMode:e[7]},262144&n[2]&&{willStartInteraction:e[80]},16&n[2]&&{oninteractionstart:e[66]},32&n[2]&&{oninteractionupdate:e[67]},64&n[2]&&{oninteractionrelease:e[68]},256&n[2]&&{oninteractionend:e[70]},128&n[2]&&{oninteractioncancel:e[69]},4096&n[2]&&{onhovershape:e[74]},2048&n[2]&&{ontapcanvas:e[73]},8388608&n[0]|524288&n[2]&&{onaddshape:e[123]},8388608&n[0]&&{onselectshape:e[124]},8388608&n[0]&&{ontapshape:e[125]},8388608&n[0]|524288&n[2]&&{onupdateshape:e[126]},8388608&n[0]|524288&n[2]&&{onremoveshape:e[127]},2&n[1]&&$a(e[32])]):{};!o&&134217728&n[0]&&(o=!0,a.markup=e[27],qr((()=>o=!1))),!i&&8192&n[1]&&(i=!0,a.ui=e[44],qr((()=>i=!1))),t.$set(a)},i(e){n||(sa(t.$$.fragment,e),n=!0)},o(e){la(t.$$.fragment,e),n=!1},d(o){e[128](null),xa(t,o)}}}function wy(e){let t,o,i,n,r,s=e[39]&&vy(e);return{c(){t=hr("div"),s&&s.c(),xr(t,"slot","main"),xr(t,"style",o="cursor:"+e[35])},m(o,l){dr(o,t,l),s&&s.m(t,null),e[131](t),i=!0,n||(r=[fr(t,"keydown",e[71]),er(rc.call(null,t)),fr(t,"dropfiles",(function(){Vn(e[11]?e[79]:a)&&(e[11]?e[79]:a).apply(this,arguments)})),er(oc.call(null,t)),fr(t,"measure",e[121])],n=!0)},p(n,r){(e=n)[39]?s?(s.p(e,r),256&r[1]&&sa(s,1)):(s=vy(e),s.c(),sa(s,1),s.m(t,null)):s&&(ra(),la(s,1,1,(()=>{s=null})),aa()),(!i||16&r[1]&&o!==(o="cursor:"+e[35]))&&xr(t,"style",o)},i(e){i||(sa(s),i=!0)},o(e){la(s),i=!1},d(o){o&&ur(t),s&&s.d(),e[131](null),n=!1,Wn(r)}}}function Sy(e){let t,o;return t=new xy({props:{locale:e[4],presets:e[13],enableSelectImage:e[10],willRenderPresetToolbar:e[33],onaddpreset:e[78],ongrabpreset:e[75],ondragpreset:e[76],ondroppreset:e[77],scrollElasticity:e[34]}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),8192&o[0]&&(i.presets=e[13]),1024&o[0]&&(i.enableSelectImage=e[10]),4&o[1]&&(i.willRenderPresetToolbar=e[33]),8&o[1]&&(i.scrollElasticity=e[34]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function ky(e){let t,o,i,n,r,a;const s=[My,Cy],l=[];function c(e,t){return e[36]?0:1}o=c(e),i=l[o]=s[o](e);let d=e[41]&&Ty(e);return{c(){t=hr("div"),i.c(),n=gr(),d&&d.c(),r=$r(),xr(t,"class","PinturaControlPanels")},m(e,i){dr(e,t,i),l[o].m(t,null),dr(e,n,i),d&&d.m(e,i),dr(e,r,i),a=!0},p(e,n){let a=o;o=c(e),o===a?l[o].p(e,n):(ra(),la(l[a],1,1,(()=>{l[a]=null})),aa(),i=l[o],i?i.p(e,n):(i=l[o]=s[o](e),i.c()),sa(i,1),i.m(t,null)),e[41]?d?(d.p(e,n),1024&n[1]&&sa(d,1)):(d=Ty(e),d.c(),sa(d,1),d.m(r.parentNode,r)):d&&(ra(),la(d,1,1,(()=>{d=null})),aa())},i(e){a||(sa(i),sa(d),a=!0)},o(e){la(i),la(d),a=!1},d(e){e&&ur(t),l[o].d(),e&&ur(n),d&&d.d(e),e&&ur(r)}}}function Cy(e){let t,o,i;return o=new Xf({props:{locale:e[4],shape:e[24],onchange:e[72],controls:e[8],scrollElasticity:e[34]}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"class","PinturaControlPanel")},m(e,n){dr(e,t,n),ba(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),16777216&t[0]&&(i.shape=e[24]),256&t[0]&&(i.controls=e[8]),8&t[1]&&(i.scrollElasticity=e[34]),o.$set(i)},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o)}}}function My(e){let t,o,i;return o=new xy({props:{locale:e[4],presets:e[13],enableSelectImage:e[10],willRenderPresetToolbar:e[33],onaddpreset:e[78],ongrabpreset:e[75],ondragpreset:e[76],ondroppreset:e[77],scrollElasticity:e[34]}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"class","PinturaControlPanel")},m(e,n){dr(e,t,n),ba(o,t,null),i=!0},p(e,t){const i={};16&t[0]&&(i.locale=e[4]),8192&t[0]&&(i.presets=e[13]),1024&t[0]&&(i.enableSelectImage=e[10]),4&t[1]&&(i.willRenderPresetToolbar=e[33]),8&t[1]&&(i.scrollElasticity=e[34]),o.$set(i)},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o)}}}function Ty(e){let t,o;return t=new ad({props:{class:"PinturaControlListScroller",elasticity:e[34],$$slots:{default:[Ay]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};8&o[1]&&(i.elasticity=e[34]),33554449&o[0]|1024&o[5]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Py(e){let t,o;return t=new Wc({props:{$$slots:{default:[Ry]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};16&o[0]|1536&o[5]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Ry(e){let t,o=(R(e[164].icon)?e[164].icon(e[4]):e[164].icon)+"";return{c(){t=pr("g")},m(e,i){dr(e,t,i),t.innerHTML=o},p(e,i){16&i[0]|512&i[5]&&o!==(o=(R(e[164].icon)?e[164].icon(e[4]):e[164].icon)+"")&&(t.innerHTML=o)},d(e){e&&ur(t)}}}function Iy(e){let t,o,i,n,r,a=(R(e[164].label)?e[164].label(e[4]):e[164].label)+"",s=e[164].icon&&Py(e);return{c(){t=hr("div"),s&&s.c(),o=gr(),i=hr("span"),n=mr(a),xr(t,"slot","option")},m(e,a){dr(e,t,a),s&&s.m(t,null),sr(t,o),sr(t,i),sr(i,n),r=!0},p(e,i){e[164].icon?s?(s.p(e,i),512&i[5]&&sa(s,1)):(s=Py(e),s.c(),sa(s,1),s.m(t,o)):s&&(ra(),la(s,1,1,(()=>{s=null})),aa()),(!r||16&i[0]|512&i[5])&&a!==(a=(R(e[164].label)?e[164].label(e[4]):e[164].label)+"")&&wr(n,a)},i(e){r||(sa(s),r=!0)},o(e){la(s),r=!1},d(e){e&&ur(t),s&&s.d()}}}function Ay(e){let t,o;return t=new bu({props:{locale:e[4],class:"PinturaControlList",optionClass:"PinturaControlListOption",layout:"row",options:e[25],selectedIndex:e[25].findIndex(e[122]),onchange:e[65],$$slots:{option:[Iy,({option:e})=>({164:e}),({option:e})=>[0,0,0,0,0,e?512:0]]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};16&o[0]&&(i.locale=e[4]),33554432&o[0]&&(i.options=e[25]),33554433&o[0]&&(i.selectedIndex=e[25].findIndex(e[122])),16&o[0]|1536&o[5]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Ey(e){let t,o,i,n;const r=[ky,Sy],a=[];function s(e,t){return e[40]?0:e[36]?1:-1}return~(o=s(e))&&(i=a[o]=r[o](e)),{c(){t=hr("div"),i&&i.c(),xr(t,"slot","footer"),xr(t,"style",e[31])},m(e,i){dr(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&&(ra(),la(a[c],1,1,(()=>{a[c]=null})),aa()),~o?(i=a[o],i?i.p(e,l):(i=a[o]=r[o](e),i.c()),sa(i,1),i.m(t,null)):i=null),(!n||1&l[1])&&xr(t,"style",e[31])},i(e){n||(sa(i),n=!0)},o(e){la(i),n=!1},d(e){e&&ur(t),~o&&a[o].d()}}}function Ly(e){let t,o;return t=new Wg({props:{$$slots:{footer:[Ey],main:[wy]},$$scope:{ctx:e}}}),t.$on("measure",e[132]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};2146435025&o[0]|65535&o[1]|1024&o[5]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Fy(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,R,I,A,E,L,F,z,D,O,B,_,W,V,N,H,j,U,X,G,Y,q,K,J,Q,ee,te,oe,ie=zn,ne=()=>(ie(),ie=Hn(me,(e=>o(26,E=e))),me),re=zn,ae=()=>(re(),re=Hn(be,(e=>o(27,F=e))),be),se=zn,le=()=>(se(),se=Hn(Xe,(e=>o(29,U=e))),Xe),ce=zn,de=()=>(ce(),ce=Hn($e,(e=>o(119,K=e))),$e),he=zn,pe=()=>(he(),he=Hn(ge,(e=>o(45,te=e))),ge);e.$$.on_destroy.push((()=>ie())),e.$$.on_destroy.push((()=>re())),e.$$.on_destroy.push((()=>se())),e.$$.on_destroy.push((()=>ce())),e.$$.on_destroy.push((()=>he()));let{isActive:me}=t;ne();let{isActiveFraction:ge}=t;pe();let{isVisible:$e}=t;de();let{stores:fe}=t,{locale:ye={}}=t,{shapes:be}=t;ae();let{toolbar:xe=[]}=t,{toolShapes:ve={}}=t,{toolActive:we}=t,{toolSelectRadius:Se}=t,{toolRetainStyles:ke=!1}=t,{textInputMode:Ce}=t,{shapeControls:Me={}}=t,{enableButtonFlipVertical:Te=!1}=t,{enablePresetSelectImage:Re=!0}=t,{enablePresetDropImage:Ae=!0}=t,{enableSelectToolToAddShape:Ee=!1}=t,{enableAutoSelectMoveTool:Le=["line","arrow","path","rectangle","ellipse","text"]}=t,{enableTapToAddText:Fe=!1}=t,{enableMoveTool:ze=!1}=t,{enableViewTool:De=!1}=t,{enableToolShareStyles:Oe=!0}=t,{willRenderPresetToolbar:Be}=t,{willStartInteraction:_e}=t,{shapePresets:We=[]}=t,{utilKey:Ve}=t,{mapScreenPointToImagePoint:Ne}=t,{mapImagePointToScreenPoint:He}=t,{imageRotation:je=0}=t,{imageFlipX:Ue=!1}=t,{imageFlipY:Ze=!1}=t,{parentRect:Xe}=t;le();let{hooks:Ge={}}=t;const Ye=_r("isAnimated");Un(e,Ye,(e=>o(112,L=e)));const qe=_r("elasticityMultiplier");Un(e,qe,(e=>o(115,O=e)));const Ke=_r("ui");let Je;Un(e,Ke,(e=>o(141,Y=e)));const{env:Qe,history:et,rootRect:tt,rootColorSecondary:ot,enablePanInput:it,enablePanInputStatus:nt,enableZoomInput:at,stageRect:st,utilRectPadded:lt,scrollElasticity:ct,imageOverlayMarkup:dt,imagePreviewModifiers:ut,imageCropRect:ht,shapePreprocessor:pt,stageScalar:mt,imageSelectionRect:gt,imageSelectionZoomCurrent:$t,imageSelectionPan:yt,allowPan:bt,allowZoom:xt,allowZoomControls:vt}=fe;Un(e,Qe,(e=>o(113,z=e))),Un(e,tt,(e=>o(43,Q=e))),Un(e,ot,(e=>o(46,oe=e))),Un(e,nt,(e=>o(28,H=e))),Un(e,st,(e=>o(116,B=e))),Un(e,lt,(e=>o(30,q=e))),Un(e,dt,(e=>o(44,ee=e))),Un(e,ut,(e=>o(120,J=e))),Un(e,ht,(e=>o(140,X=e))),Un(e,pt,(e=>o(118,G=e))),Un(e,mt,(e=>o(138,V=e))),Un(e,gt,(e=>o(139,N=e))),Un(e,$t,(e=>o(42,_=e))),Un(e,yt,(e=>o(137,W=e)));const wt=_r("keysPressed");Un(e,wt,(e=>o(117,j=e)));const St=e=>{const[t,o]=Je[e];let i,n,r="relative"===o.position;const a=r?"0%":0,s=r?"0%":0;vi(t)||yi(t)?(n=r?"20%":.2*U.width,i=ui(t),i.x=a,i.y=s,ln(i,{width:n,height:n},U)):wi(t)?(n=r?"10%":.1*U.width,i=ui(t),i.x=a,i.y=s,ln(i,{rx:n,ry:n},U)):Si(t)&&(n=r?"10%":.1*U.width,i=ui(t),i.x1=a,i.y1=s,i.x2=a,i.y2=s),i&&Promise.resolve().then((()=>{Lt(At(i,void 0,n))}))},kt=e=>Ne(lf(e,Q));let Ct,Mt,Tt={};const Pt=e=>{if(!(ki(e)&&Po(e,"pathClose")))return;const t=[...e.strokeColor];t[3]=1,Ct.updateMarkupShape(e,{pathClose:!1,strokeColor:t},!1),Ct.removeMarkupShapeProps(e,["backgroundColor"],!1),Ct.confirmMarkupItemDraft(),Ct.selectShape(e)};let Rt,It;const At=(e,t,o)=>{let i=!1;t||(i=!0,t=b?Ne(rt(B)):rt(X)),t.x-=U.x||0,t.y-=U.y||0,(Ue||Ze)&&(e.flipX=Ue,e.flipY=Ze);const n=Ct.getShapesNearPosition(t);if(i&&n.length){const e=.1*Math.min(X.width,X.height);t.x+=Math.round(-e+Math.random()*e*2),t.y+=Math.round(-e+Math.random()*e*2)}if(0!==je&&(e.rotation=Ue&&Ze?-je:Ue||Ze?je:-je),Po(e,"width")&&Po(e,"height")){const{width:o,height:i}=sn(e,["width","height"],U);ln(e,{x:t.x-.5*o,y:t.y-.5*i},U)}else if(wi(e))ln(e,{x:t.x,y:t.y},U);else if(Si(e)){const{x1:i,y1:n,x2:r,y2:a}=sn(e,["x1","y1","x2","y2"],U),s=Pe(ue(i,n),ue(r,a)),l=P(o)?Qi(o,U.width):s;ln(e,{x1:t.x-l,y1:t.y+l,x2:t.x+l,y2:t.y-l},U)}else if(ki(e)){const{points:o}=sn(e,["points"],U),i=Ie(o);ln(e,{points:o.map((e=>({x:e.x+t.x-i.x,y:e.y+t.y-i.y})))},U)}return e},Et=(e,t)=>{const o=At(gi(e,X),t);return e.shape&&(Po(e.shape,"x")&&(o.x=e.shape.x),Po(e.shape,"y")&&(o.y=e.shape.y)),Lt(o)},Lt=e=>{const{beforeAddShape:t=(()=>!0)}=Ge;if(t(e))return Ct.addShape(e),Ct.selectShape(e),et.write(),C("addshape",e),e};let Ft=!1;const zt=()=>{et.write()};let Dt;const Ot=_r("redrawTrigger");Un(e,Ot,(e=>o(114,D=e)));const Bt=Wl(L?20:0);Un(e,Bt,(e=>o(111,A=e)));return e.$$set=e=>{"isActive"in e&&ne(o(1,me=e.isActive)),"isActiveFraction"in e&&pe(o(2,ge=e.isActiveFraction)),"isVisible"in e&&de(o(3,$e=e.isVisible)),"stores"in e&&o(84,fe=e.stores),"locale"in e&&o(4,ye=e.locale),"shapes"in e&&ae(o(5,be=e.shapes)),"toolbar"in e&&o(85,xe=e.toolbar),"toolShapes"in e&&o(86,ve=e.toolShapes),"toolActive"in e&&o(0,we=e.toolActive),"toolSelectRadius"in e&&o(6,Se=e.toolSelectRadius),"toolRetainStyles"in e&&o(87,ke=e.toolRetainStyles),"textInputMode"in e&&o(7,Ce=e.textInputMode),"shapeControls"in e&&o(8,Me=e.shapeControls),"enableButtonFlipVertical"in e&&o(9,Te=e.enableButtonFlipVertical),"enablePresetSelectImage"in e&&o(10,Re=e.enablePresetSelectImage),"enablePresetDropImage"in e&&o(11,Ae=e.enablePresetDropImage),"enableSelectToolToAddShape"in e&&o(88,Ee=e.enableSelectToolToAddShape),"enableAutoSelectMoveTool"in e&&o(89,Le=e.enableAutoSelectMoveTool),"enableTapToAddText"in e&&o(12,Fe=e.enableTapToAddText),"enableMoveTool"in e&&o(90,ze=e.enableMoveTool),"enableViewTool"in e&&o(91,De=e.enableViewTool),"enableToolShareStyles"in e&&o(92,Oe=e.enableToolShareStyles),"willRenderPresetToolbar"in e&&o(93,Be=e.willRenderPresetToolbar),"willStartInteraction"in e&&o(94,_e=e.willStartInteraction),"shapePresets"in e&&o(13,We=e.shapePresets),"utilKey"in e&&o(14,Ve=e.utilKey),"mapScreenPointToImagePoint"in e&&o(15,Ne=e.mapScreenPointToImagePoint),"mapImagePointToScreenPoint"in e&&o(16,He=e.mapImagePointToScreenPoint),"imageRotation"in e&&o(17,je=e.imageRotation),"imageFlipX"in e&&o(18,Ue=e.imageFlipX),"imageFlipY"in e&&o(19,Ze=e.imageFlipY),"parentRect"in e&&le(o(20,Xe=e.parentRect)),"hooks"in e&&o(95,Ge=e.hooks)},e.$$.update=()=>{var t,P;if(16777216&e.$$.dirty[2]|8&e.$$.dirty[3]&&(Je&&ve===Je||o(96,Je=ve)),67108864&e.$$.dirty[0]&&bt.set(E),67108864&e.$$.dirty[0]&&xt.set(E),67108864&e.$$.dirty[0]&&vt.set(E),8192&e.$$.dirty[0]|813694976&e.$$.dirty[2]|1&e.$$.dirty[3]&&o(25,i=((e,{willRenderPresetToolbar:t,shapePresets:o,enableViewTool:i,enableMoveTool:n})=>{let r=0!==o.length||t?e:e.filter((e=>"preset"!==e[0]));return r=n?r:r.filter((e=>"move"!==e[0])),i?r:r.filter((e=>"view"!==e[0]))})(xe,{willRenderPresetToolbar:Be,shapePresets:We,enableMoveTool:ze,enableViewTool:De})),256&e.$$.dirty[0]&&o(108,n=Object.keys(Me).length),33554432&e.$$.dirty[0]&&o(41,r=i.length>1),33554432&e.$$.dirty[0]&&o(109,a=!!i.length),33554433&e.$$.dirty[0]|65536&e.$$.dirty[3]&&a&&void 0===we&&o(0,we=i[0][0]),1&e.$$.dirty[0]&&o(110,s=void 0!==we),229376&e.$$.dirty[3]&&o(40,l=(!s||a)&&n),4194304&e.$$.dirty[0]&&o(23,C=Dt&&(t=Dt,(e,o)=>{t.dispatchEvent(ph(e,o))})),75497473&e.$$.dirty[0]&&E&&C&&C("selectcontrol",we),67125248&e.$$.dirty[0]|134217728&e.$$.dirty[3]&&(E?Qn(ut,J[Ve]={maskMarkupOpacity:.85},J):delete J[Ve]),2097153&e.$$.dirty[0]&&we&&Ct){const e=Ct.getMarkupItemDraft();e&&Pt(e)}1&e.$$.dirty[0]&&we&&Ct&&"move"!==we&&Ct.blurShapes(),67108864&e.$$.dirty[0]|67108864&e.$$.dirty[3]&&o(39,c=E&&K),1073741824&e.$$.dirty[0]|8388608&e.$$.dirty[3]&&o(38,d=q&&ue(B.x-q.x,B.y-q.y)),256&e.$$.dirty[0]&&o(107,u=Object.keys(Me)),201326592&e.$$.dirty[0]&&o(99,h=E&&F.filter(Ti)[0]),201326592&e.$$.dirty[0]&&o(102,p=E&&F.find((e=>Pi(e)))),67108865&e.$$.dirty[0]|8&e.$$.dirty[3]&&o(105,m=E&&Je[we]?Ki(ui({...Je[we][0],...Y[Ve]?Y[Ve][we]:{}})):{}),8&e.$$.dirty[3]&&Je&&o(97,Tt={}),1&e.$$.dirty[0]|1073741824&e.$$.dirty[2]|20496&e.$$.dirty[3]&&o(106,g=m&&Object.keys(m).reduce(((e,t)=>{const o="disableStyle"===t,i=u.find((e=>e.split("_").includes(t)));if(!o&&!i)return e;if(void 0===m[t])return e;if(!0===m.disableStyle)return e;if(m.disableStyle&&m.disableStyle.includes(t))return e;const n=Oe?Tt:Tt[we]||{};return e[t]=Po(n,t)?n[t]:m[t],e}),{})),16385&e.$$.dirty[0]|33554432&e.$$.dirty[2]|8192&e.$$.dirty[3]&&(ke?((e,t,o)=>{const i=Y[e],n=i?i[t]:{};Ke.set({...Y,[e]:{...i,[t]:{...n,...o}}})})(Ve,we,g):(P=Ve,Ke.set({[P]:{}}))),67108864&e.$$.dirty[0]|8256&e.$$.dirty[3]&&o(24,$=E?h||g:void 0),16777216&e.$$.dirty[0]|33554432&e.$$.dirty[3]&&$&&$.lineEnd&&!G&&console.warn("Set shapePreprocessor property to draw lineStart and lineEnd styles.\nhttps://pqina.nl/pintura/docs/v8/api/exports/#createshapepreprocessor"),12288&e.$$.dirty[3]&&o(37,f=m&&Mo(m.eraseRadius)?(g||m).eraseRadius:void 0),9217&e.$$.dirty[0]|1&e.$$.dirty[3]&&o(36,y="preset"===we&&(We.length>0||Re||Be)),536870912&e.$$.dirty[0]&&(b=!Po(U,"x")&&!Po(U,"y")),67108864&e.$$.dirty[0]|16777216&e.$$.dirty[3]&&o(103,x=E&&j&&32===j[0]),67108865&e.$$.dirty[0]&&o(104,v=E&&"view"===we),3072&e.$$.dirty[3]&&o(101,w=v||x),512&e.$$.dirty[3]&&o(100,S=!!p),67108864&e.$$.dirty[0]|384&e.$$.dirty[3]&&it.set(!E||w&&!S),67108864&e.$$.dirty[0]|128&e.$$.dirty[3]&&at.set(!E||!S),268435457&e.$$.dirty[0]|96&e.$$.dirty[3]&&o(35,k=((e,t,o,i,n)=>{if(o)return i?"grabbing":"grab";if(!e)return"move"===n?"default":"crosshair";let r=e||t;return Ti(r)?Pi(r)?"modal"===Ce?"default":"text":Ni(r)?"move":"default":"default"})(It,h,H,false,we)),4194304&e.$$.dirty[3]&&o(34,M=O*ct),3145729&e.$$.dirty[3]&&o(33,T=D&&Be?e=>Rh((()=>Be(e,Et,{...z},(()=>Ot.set({}))))):Z),4&e.$$.dirty[3]&&o(32,R=Object.keys(Ge).reduce(((e,t)=>("beforeAddShape"===t||void 0===Ge[t]||(e[t]=Ge[t]),e)),{})),67108864&e.$$.dirty[0]&&(e=>{be&&be.set(F.map((t=>(t._prerender=!!e&&Pi(t),t))))})(E),67108864&e.$$.dirty[0]|524288&e.$$.dirty[3]&&L&&Bt.set(E?0:20),262144&e.$$.dirty[3]&&o(31,I=A?`transform: translateY(${A}px)`:void 0)},[we,me,ge,$e,ye,be,Se,Ce,Me,Te,Re,Ae,Fe,We,Ve,Ne,He,je,Ue,Ze,Xe,Ct,Dt,C,$,i,E,F,H,U,q,I,R,T,M,k,y,f,d,c,l,r,_,Q,ee,te,oe,Ye,qe,Ke,Qe,tt,ot,nt,st,lt,dt,ut,ht,pt,mt,gt,$t,yt,wt,({value:e},t)=>{o(0,we=e),(Ee||/enter/i.test(t.key))&&St(e)},e=>{if("eraser"===we)Mt=Ct.eraseShape();else if(we&&Je[we]){const[e,t]=Je[we];Mt=Ct.createShape({...e,...g},t)}else Mt=void 0;return!!Mt&&(Mt.start(e),!0)},e=>!!Mt&&(Mt.update(e),!0),e=>!!Mt&&(Mt.release(e),!0),e=>!!Mt&&(Mt.cancel(e),Mt=void 0,!0),e=>{if(!Mt)return!1;Mt.end(e),Mt=void 0;const t=Ct.getMarkupItemDraft(),i=ze&&(!0===Le||Array.isArray(Le)&&Le.includes(we));return t&&!t.isEditing||!i||o(0,we="move"),!0},e=>{const{key:t}=e,o=Ct.getMarkupItemDraft();/escape/i.test(t)&&o&&(e.preventDefault(),e.stopPropagation(),Ct.discardMarkupItemDraft(),Mt=void 0),/enter/i.test(t)&&o&&(e.preventDefault(),e.stopPropagation(),Pt(o),Mt=void 0)},function(e){Object.keys(e).forEach((t=>{Oe?o(97,Tt[t]=e[t],Tt):(Tt[we]||o(97,Tt[we]={},Tt),o(97,Tt[we][t]=e[t],Tt))})),C("selectstyle",e),h&&(Ct.updateMarkupShape(h,e),clearTimeout(Rt),Rt=setTimeout((()=>{zt()}),200))},e=>C("markuptap",e),e=>o(98,It=e),()=>{Ft=!1},(e,t)=>{if(Ft)return;const{beforeAddShape:o=(()=>!0)}=Ge,i=kt(t),n=Ct.getMarkupItemDraft(),r=ft(X,{x:i.x+(U.x||0),y:i.y+(U.y||0)});if(n&&!r&&Ct.discardMarkupItemDraft(),r){if(!n){const n=gi(e,X),r=At(n,i);return o(r)?(Fi(r),void Ct.addShape(r)):(Ft=!0,void t.preventDefault())}vi(n)&&(i.x-=.5*n.width,i.y-=.5*n.height),e.shape&&(Po(e.shape,"x")&&(i.x=e.shape.x),Po(e.shape,"y")&&(i.y=e.shape.y)),Ct.updateMarkupShape(n,i)}},(e,t)=>{if(Ft)return;const o=kt(t);if(!ft(X,{x:o.x+(U.x||0),y:o.y+(U.y||0)}))return void Ct.discardMarkupItemDraft();const i=Ct.confirmMarkupItemDraft();Ct.selectShape(i),C("addshape",i),et.write()},e=>Et(e),e=>{return t=e.detail.resources,o=kt(e.detail.event),t.forEach((e=>Et(e,o)));var t,o},e=>{if(!_e)return!0;const t=rectClone(N);return rectScale(t,1/V),rectTranslate(t,W),rectScale(t,_),_e(e,{...t,x:t.x+B.x,y:t.y+B.y})},zt,Ot,Bt,fe,xe,ve,ke,Ee,Le,ze,De,Oe,Be,_e,Ge,Je,Tt,It,h,S,w,p,x,v,m,g,u,n,a,s,A,L,z,D,O,B,j,G,K,J,function(t){Wr.call(this,e,t)},e=>e[0]===we,e=>{C("addshape",e),zt()},e=>{C("selectshape",e)},e=>{C("tapshape",e)},e=>{C("updateshape",e),zt()},e=>{C("removeshape",e),zt()},function(e){Nr[e?"unshift":"push"]((()=>{Ct=e,o(21,Ct)}))},function(e){F=e,be.set(F)},function(e){ee=e,dt.set(ee)},function(e){Nr[e?"unshift":"push"]((()=>{Dt=e,o(22,Dt)}))},function(t){Wr.call(this,e,t)}]}class zy extends wa{constructor(e){super(),va(this,e,Fy,Ly,Nn,{isActive:1,isActiveFraction:2,isVisible:3,stores:84,locale:4,shapes:5,toolbar:85,toolShapes:86,toolActive:0,toolSelectRadius:6,toolRetainStyles:87,textInputMode:7,shapeControls:8,enableButtonFlipVertical:9,enablePresetSelectImage:10,enablePresetDropImage:11,enableSelectToolToAddShape:88,enableAutoSelectMoveTool:89,enableTapToAddText:12,enableMoveTool:90,enableViewTool:91,enableToolShareStyles:92,willRenderPresetToolbar:93,willStartInteraction:94,shapePresets:13,utilKey:14,mapScreenPointToImagePoint:15,mapImagePointToScreenPoint:16,imageRotation:17,imageFlipX:18,imageFlipY:19,parentRect:20,hooks:95},null,[-1,-1,-1,-1,-1,-1])}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),ea()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),ea()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),ea()}get stores(){return this.$$.ctx[84]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),ea()}get shapes(){return this.$$.ctx[5]}set shapes(e){this.$$set({shapes:e}),ea()}get toolbar(){return this.$$.ctx[85]}set toolbar(e){this.$$set({toolbar:e}),ea()}get toolShapes(){return this.$$.ctx[86]}set toolShapes(e){this.$$set({toolShapes:e}),ea()}get toolActive(){return this.$$.ctx[0]}set toolActive(e){this.$$set({toolActive:e}),ea()}get toolSelectRadius(){return this.$$.ctx[6]}set toolSelectRadius(e){this.$$set({toolSelectRadius:e}),ea()}get toolRetainStyles(){return this.$$.ctx[87]}set toolRetainStyles(e){this.$$set({toolRetainStyles:e}),ea()}get textInputMode(){return this.$$.ctx[7]}set textInputMode(e){this.$$set({textInputMode:e}),ea()}get shapeControls(){return this.$$.ctx[8]}set shapeControls(e){this.$$set({shapeControls:e}),ea()}get enableButtonFlipVertical(){return this.$$.ctx[9]}set enableButtonFlipVertical(e){this.$$set({enableButtonFlipVertical:e}),ea()}get enablePresetSelectImage(){return this.$$.ctx[10]}set enablePresetSelectImage(e){this.$$set({enablePresetSelectImage:e}),ea()}get enablePresetDropImage(){return this.$$.ctx[11]}set enablePresetDropImage(e){this.$$set({enablePresetDropImage:e}),ea()}get enableSelectToolToAddShape(){return this.$$.ctx[88]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),ea()}get enableAutoSelectMoveTool(){return this.$$.ctx[89]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),ea()}get enableTapToAddText(){return this.$$.ctx[12]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),ea()}get enableMoveTool(){return this.$$.ctx[90]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),ea()}get enableViewTool(){return this.$$.ctx[91]}set enableViewTool(e){this.$$set({enableViewTool:e}),ea()}get enableToolShareStyles(){return this.$$.ctx[92]}set enableToolShareStyles(e){this.$$set({enableToolShareStyles:e}),ea()}get willRenderPresetToolbar(){return this.$$.ctx[93]}set willRenderPresetToolbar(e){this.$$set({willRenderPresetToolbar:e}),ea()}get willStartInteraction(){return this.$$.ctx[94]}set willStartInteraction(e){this.$$set({willStartInteraction:e}),ea()}get shapePresets(){return this.$$.ctx[13]}set shapePresets(e){this.$$set({shapePresets:e}),ea()}get utilKey(){return this.$$.ctx[14]}set utilKey(e){this.$$set({utilKey:e}),ea()}get mapScreenPointToImagePoint(){return this.$$.ctx[15]}set mapScreenPointToImagePoint(e){this.$$set({mapScreenPointToImagePoint:e}),ea()}get mapImagePointToScreenPoint(){return this.$$.ctx[16]}set mapImagePointToScreenPoint(e){this.$$set({mapImagePointToScreenPoint:e}),ea()}get imageRotation(){return this.$$.ctx[17]}set imageRotation(e){this.$$set({imageRotation:e}),ea()}get imageFlipX(){return this.$$.ctx[18]}set imageFlipX(e){this.$$set({imageFlipX:e}),ea()}get imageFlipY(){return this.$$.ctx[19]}set imageFlipY(e){this.$$set({imageFlipY:e}),ea()}get parentRect(){return this.$$.ctx[20]}set parentRect(e){this.$$set({parentRect:e}),ea()}get hooks(){return this.$$.ctx[95]}set hooks(e){this.$$set({hooks:e}),ea()}}var Dy=(e,t,o,i,n,r,a,s,l)=>{const c=pe(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 $=Math.cos(r),f=Math.sin(r);c.x-=d,c.y-=u;const y=c.x*$-c.y*f,b=c.x*f+c.y*$;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*$-v*f,S=x*f+v*$;return c.x+=w,c.y+=S,c},Oy=(e,t,o,i,n,r,a,s,l)=>{const c=pe(e),d=Ne(o),u=Ne(t),h=ue(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,$=(n.y-h.y)*a,f=g*p-$*m,y=g*m+$*p;c.x-=f,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 By(e){let t,o,i;function n(t){e[53](t)}let r={utilKey:"annotate",stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[38],mapImagePointToScreenPoint:e[37],imageRotation:e[39],imageFlipX:e[36],imageFlipY:e[35],shapes:e[41],toolbar:e[14]||e[6],toolShapes:e[15]||e[7],toolRetainStyles:e[8],enableSelectToolToAddShape:e[24],enableTapToAddText:e[25],enableViewTool:e[23],enableMoveTool:e[27],enableAutoSelectMoveTool:e[26],enableToolShareStyles:e[12],shapeControls:e[16]||e[9],shapePresets:e[20],enableButtonFlipVertical:e[17],parentRect:e[42],enablePresetDropImage:e[19],enablePresetSelectImage:e[18],toolSelectRadius:e[10],textInputMode:e[11],willStartInteraction:e[22],willRenderPresetToolbar:e[21]||e[13],hooks:{willRenderShapeControls:e[28],willRenderShapeTextControls:e[29],beforeAddShape:e[30],beforeRemoveShape:e[31],beforeDeselectShape:e[32],beforeSelectShape:e[33],beforeUpdateShape:e[34]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new zy({props:r}),Nr.push((()=>fa(t,"toolActive",n))),t.$on("measure",e[54]),{c(){ya(t.$$.fragment)},m(e,o){ba(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]),128&i[1]&&(n.mapScreenPointToImagePoint=e[38]),64&i[1]&&(n.mapImagePointToScreenPoint=e[37]),256&i[1]&&(n.imageRotation=e[39]),32&i[1]&&(n.imageFlipX=e[36]),16&i[1]&&(n.imageFlipY=e[35]),16448&i[0]&&(n.toolbar=e[14]||e[6]),32896&i[0]&&(n.toolShapes=e[15]||e[7]),256&i[0]&&(n.toolRetainStyles=e[8]),16777216&i[0]&&(n.enableSelectToolToAddShape=e[24]),33554432&i[0]&&(n.enableTapToAddText=e[25]),8388608&i[0]&&(n.enableViewTool=e[23]),134217728&i[0]&&(n.enableMoveTool=e[27]),67108864&i[0]&&(n.enableAutoSelectMoveTool=e[26]),4096&i[0]&&(n.enableToolShareStyles=e[12]),66048&i[0]&&(n.shapeControls=e[16]||e[9]),1048576&i[0]&&(n.shapePresets=e[20]),131072&i[0]&&(n.enableButtonFlipVertical=e[17]),524288&i[0]&&(n.enablePresetDropImage=e[19]),262144&i[0]&&(n.enablePresetSelectImage=e[18]),1024&i[0]&&(n.toolSelectRadius=e[10]),2048&i[0]&&(n.textInputMode=e[11]),4194304&i[0]&&(n.willStartInteraction=e[22]),2105344&i[0]&&(n.willRenderPresetToolbar=e[21]||e[13]),1879048192&i[0]|15&i[1]&&(n.hooks={willRenderShapeControls:e[28],willRenderShapeTextControls:e[29],beforeAddShape:e[30],beforeRemoveShape:e[31],beforeDeselectShape:e[32],beforeSelectShape:e[33],beforeUpdateShape:e[34]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],qr((()=>o=!1))),t.$set(n)},i(e){i||(sa(t.$$.fragment,e),i=!0)},o(e){la(t.$$.fragment,e),i=!1},d(e){xa(t,e)}}}function _y(e,t,o){let i,n,r,a,s,l,c,d,u;let{isActive:h}=t,{isActiveFraction:p}=t,{isVisible:m}=t,{stores:g}=t,{locale:$={}}=t,{markupEditorToolbar:f}=t,{markupEditorToolStyles:y}=t,{markupEditorToolRetainStyles:b}=t,{markupEditorShapeStyleControls:x}=t,{markupEditorToolSelectRadius:v}=t,{markupEditorTextInputMode:w}=t,{markupEditorToolShareStyles:S}=t,{willRenderShapePresetToolbar:k}=t,{annotateTools:C}=t,{annotateToolShapes:M}=t,{annotateShapeControls:T}=t,{annotateActiveTool:P}=t,{annotateEnableButtonFlipVertical:R=!1}=t,{annotateEnableSelectImagePreset:I=!1}=t,{annotateEnableDropImagePreset:A=!0}=t,{annotatePresets:E=[]}=t,{annotateWillRenderShapePresetToolbar:L}=t,{markupEditorWillStartInteraction:F}=t,{enableViewTool:z}=t,{enableSelectToolToAddShape:D}=t,{enableTapToAddText:O}=t,{enableAutoSelectMoveTool:B}=t,{enableMoveTool:_}=t,{willRenderShapeControls:W}=t,{willRenderShapeTextControls:V}=t,{beforeAddShape:N}=t,{beforeRemoveShape:H}=t,{beforeDeselectShape:j}=t,{beforeSelectShape:U}=t,{beforeUpdateShape:Z}=t;const{rootRect:X,imageAnnotation:G,imageSize:Y,imageRotation:q,imageFlipX:K,imageFlipY:J,imageTransforms:Q,imageTransformsInterpolated:ee}=g;return Un(e,X,(e=>o(52,d=e))),Un(e,Y,(e=>o(51,c=e))),Un(e,q,(e=>o(39,u=e))),Un(e,K,(e=>o(36,a=e))),Un(e,J,(e=>o(35,r=e))),Un(e,Q,(e=>o(50,l=e))),Un(e,ee,(e=>o(49,s=e))),e.$$set=e=>{"isActive"in e&&o(1,h=e.isActive),"isActiveFraction"in e&&o(2,p=e.isActiveFraction),"isVisible"in e&&o(3,m=e.isVisible),"stores"in e&&o(4,g=e.stores),"locale"in e&&o(5,$=e.locale),"markupEditorToolbar"in e&&o(6,f=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(7,y=e.markupEditorToolStyles),"markupEditorToolRetainStyles"in e&&o(8,b=e.markupEditorToolRetainStyles),"markupEditorShapeStyleControls"in e&&o(9,x=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(10,v=e.markupEditorToolSelectRadius),"markupEditorTextInputMode"in e&&o(11,w=e.markupEditorTextInputMode),"markupEditorToolShareStyles"in e&&o(12,S=e.markupEditorToolShareStyles),"willRenderShapePresetToolbar"in e&&o(13,k=e.willRenderShapePresetToolbar),"annotateTools"in e&&o(14,C=e.annotateTools),"annotateToolShapes"in e&&o(15,M=e.annotateToolShapes),"annotateShapeControls"in e&&o(16,T=e.annotateShapeControls),"annotateActiveTool"in e&&o(0,P=e.annotateActiveTool),"annotateEnableButtonFlipVertical"in e&&o(17,R=e.annotateEnableButtonFlipVertical),"annotateEnableSelectImagePreset"in e&&o(18,I=e.annotateEnableSelectImagePreset),"annotateEnableDropImagePreset"in e&&o(19,A=e.annotateEnableDropImagePreset),"annotatePresets"in e&&o(20,E=e.annotatePresets),"annotateWillRenderShapePresetToolbar"in e&&o(21,L=e.annotateWillRenderShapePresetToolbar),"markupEditorWillStartInteraction"in e&&o(22,F=e.markupEditorWillStartInteraction),"enableViewTool"in e&&o(23,z=e.enableViewTool),"enableSelectToolToAddShape"in e&&o(24,D=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(25,O=e.enableTapToAddText),"enableAutoSelectMoveTool"in e&&o(26,B=e.enableAutoSelectMoveTool),"enableMoveTool"in e&&o(27,_=e.enableMoveTool),"willRenderShapeControls"in e&&o(28,W=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(29,V=e.willRenderShapeTextControls),"beforeAddShape"in e&&o(30,N=e.beforeAddShape),"beforeRemoveShape"in e&&o(31,H=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(32,j=e.beforeDeselectShape),"beforeSelectShape"in e&&o(33,U=e.beforeSelectShape),"beforeUpdateShape"in e&&o(34,Z=e.beforeUpdateShape)},e.$$.update=()=>{3932208&e.$$.dirty[1]&&o(38,i=e=>Oy(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,r)),3932208&e.$$.dirty[1]&&o(37,n=e=>Dy(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,r))},[P,h,p,m,g,$,f,y,b,x,v,w,S,k,C,M,T,R,I,A,E,L,F,z,D,O,B,_,W,V,N,H,j,U,Z,r,a,n,i,u,X,G,Y,q,K,J,Q,ee,"annotate",s,l,c,d,function(e){P=e,o(0,P)},function(t){Wr.call(this,e,t)}]}var Wy={util:["annotate",class extends wa{constructor(e){super(),va(this,e,_y,By,Nn,{name:48,isActive:1,isActiveFraction:2,isVisible:3,stores:4,locale:5,markupEditorToolbar:6,markupEditorToolStyles:7,markupEditorToolRetainStyles:8,markupEditorShapeStyleControls:9,markupEditorToolSelectRadius:10,markupEditorTextInputMode:11,markupEditorToolShareStyles:12,willRenderShapePresetToolbar:13,annotateTools:14,annotateToolShapes:15,annotateShapeControls:16,annotateActiveTool:0,annotateEnableButtonFlipVertical:17,annotateEnableSelectImagePreset:18,annotateEnableDropImagePreset:19,annotatePresets:20,annotateWillRenderShapePresetToolbar:21,markupEditorWillStartInteraction:22,enableViewTool:23,enableSelectToolToAddShape:24,enableTapToAddText:25,enableAutoSelectMoveTool:26,enableMoveTool:27,willRenderShapeControls:28,willRenderShapeTextControls:29,beforeAddShape:30,beforeRemoveShape:31,beforeDeselectShape:32,beforeSelectShape:33,beforeUpdateShape:34},null,[-1,-1])}get name(){return this.$$.ctx[48]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),ea()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),ea()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),ea()}get stores(){return this.$$.ctx[4]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[5]}set locale(e){this.$$set({locale:e}),ea()}get markupEditorToolbar(){return this.$$.ctx[6]}set markupEditorToolbar(e){this.$$set({markupEditorToolbar:e}),ea()}get markupEditorToolStyles(){return this.$$.ctx[7]}set markupEditorToolStyles(e){this.$$set({markupEditorToolStyles:e}),ea()}get markupEditorToolRetainStyles(){return this.$$.ctx[8]}set markupEditorToolRetainStyles(e){this.$$set({markupEditorToolRetainStyles:e}),ea()}get markupEditorShapeStyleControls(){return this.$$.ctx[9]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),ea()}get markupEditorToolSelectRadius(){return this.$$.ctx[10]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),ea()}get markupEditorTextInputMode(){return this.$$.ctx[11]}set markupEditorTextInputMode(e){this.$$set({markupEditorTextInputMode:e}),ea()}get markupEditorToolShareStyles(){return this.$$.ctx[12]}set markupEditorToolShareStyles(e){this.$$set({markupEditorToolShareStyles:e}),ea()}get willRenderShapePresetToolbar(){return this.$$.ctx[13]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),ea()}get annotateTools(){return this.$$.ctx[14]}set annotateTools(e){this.$$set({annotateTools:e}),ea()}get annotateToolShapes(){return this.$$.ctx[15]}set annotateToolShapes(e){this.$$set({annotateToolShapes:e}),ea()}get annotateShapeControls(){return this.$$.ctx[16]}set annotateShapeControls(e){this.$$set({annotateShapeControls:e}),ea()}get annotateActiveTool(){return this.$$.ctx[0]}set annotateActiveTool(e){this.$$set({annotateActiveTool:e}),ea()}get annotateEnableButtonFlipVertical(){return this.$$.ctx[17]}set annotateEnableButtonFlipVertical(e){this.$$set({annotateEnableButtonFlipVertical:e}),ea()}get annotateEnableSelectImagePreset(){return this.$$.ctx[18]}set annotateEnableSelectImagePreset(e){this.$$set({annotateEnableSelectImagePreset:e}),ea()}get annotateEnableDropImagePreset(){return this.$$.ctx[19]}set annotateEnableDropImagePreset(e){this.$$set({annotateEnableDropImagePreset:e}),ea()}get annotatePresets(){return this.$$.ctx[20]}set annotatePresets(e){this.$$set({annotatePresets:e}),ea()}get annotateWillRenderShapePresetToolbar(){return this.$$.ctx[21]}set annotateWillRenderShapePresetToolbar(e){this.$$set({annotateWillRenderShapePresetToolbar:e}),ea()}get markupEditorWillStartInteraction(){return this.$$.ctx[22]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),ea()}get enableViewTool(){return this.$$.ctx[23]}set enableViewTool(e){this.$$set({enableViewTool:e}),ea()}get enableSelectToolToAddShape(){return this.$$.ctx[24]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),ea()}get enableTapToAddText(){return this.$$.ctx[25]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),ea()}get enableAutoSelectMoveTool(){return this.$$.ctx[26]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),ea()}get enableMoveTool(){return this.$$.ctx[27]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),ea()}get willRenderShapeControls(){return this.$$.ctx[28]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),ea()}get willRenderShapeTextControls(){return this.$$.ctx[29]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),ea()}get beforeAddShape(){return this.$$.ctx[30]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),ea()}get beforeRemoveShape(){return this.$$.ctx[31]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),ea()}get beforeDeselectShape(){return this.$$.ctx[32]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),ea()}get beforeSelectShape(){return this.$$.ctx[33]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),ea()}get beforeUpdateShape(){return this.$$.ctx[34]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),ea()}}]};function Vy(e){let t,o,i;function n(t){e[45](t)}let r={stores:e[4],locale:e[5],isActive:e[1],isActiveFraction:e[2],isVisible:e[3],mapScreenPointToImagePoint:e[36],mapImagePointToScreenPoint:e[35],utilKey:"decorate",shapes:e[38],toolbar:e[14]||e[6],toolShapes:e[15]||e[7],toolRetainStyles:e[8],shapeControls:e[16]||e[9],shapePresets:e[20],enableSelectToolToAddShape:e[22],enableTapToAddText:e[23],enableViewTool:e[24],enableMoveTool:e[25],enableAutoSelectMoveTool:e[26],enableToolShareStyles:e[12],enablePresetSelectImage:e[18],enablePresetDropImage:e[19],enableButtonFlipVertical:e[17],parentRect:e[37],toolSelectRadius:e[10],textInputMode:e[11],willStartInteraction:e[34],willRenderPresetToolbar:e[21]||e[13],hooks:{willRenderShapeControls:e[27],willRenderShapeTextControls:e[28],beforeAddShape:e[29],beforeRemoveShape:e[30],beforeDeselectShape:e[31],beforeSelectShape:e[32],beforeUpdateShape:e[33]}};return void 0!==e[0]&&(r.toolActive=e[0]),t=new zy({props:r}),Nr.push((()=>fa(t,"toolActive",n))),t.$on("measure",e[46]),{c(){ya(t.$$.fragment)},m(e,o){ba(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]),32&i[1]&&(n.mapScreenPointToImagePoint=e[36]),16&i[1]&&(n.mapImagePointToScreenPoint=e[35]),16448&i[0]&&(n.toolbar=e[14]||e[6]),32896&i[0]&&(n.toolShapes=e[15]||e[7]),256&i[0]&&(n.toolRetainStyles=e[8]),66048&i[0]&&(n.shapeControls=e[16]||e[9]),1048576&i[0]&&(n.shapePresets=e[20]),4194304&i[0]&&(n.enableSelectToolToAddShape=e[22]),8388608&i[0]&&(n.enableTapToAddText=e[23]),16777216&i[0]&&(n.enableViewTool=e[24]),33554432&i[0]&&(n.enableMoveTool=e[25]),67108864&i[0]&&(n.enableAutoSelectMoveTool=e[26]),4096&i[0]&&(n.enableToolShareStyles=e[12]),262144&i[0]&&(n.enablePresetSelectImage=e[18]),524288&i[0]&&(n.enablePresetDropImage=e[19]),131072&i[0]&&(n.enableButtonFlipVertical=e[17]),1024&i[0]&&(n.toolSelectRadius=e[10]),2048&i[0]&&(n.textInputMode=e[11]),8&i[1]&&(n.willStartInteraction=e[34]),2105344&i[0]&&(n.willRenderPresetToolbar=e[21]||e[13]),2013265920&i[0]|7&i[1]&&(n.hooks={willRenderShapeControls:e[27],willRenderShapeTextControls:e[28],beforeAddShape:e[29],beforeRemoveShape:e[30],beforeDeselectShape:e[31],beforeSelectShape:e[32],beforeUpdateShape:e[33]}),!o&&1&i[0]&&(o=!0,n.toolActive=e[0],qr((()=>o=!1))),t.$set(n)},i(e){i||(sa(t.$$.fragment,e),i=!0)},o(e){la(t.$$.fragment,e),i=!1},d(e){xa(t,e)}}}function Ny(e,t,o){let i,n,r,a,s;let{isActive:l}=t,{isActiveFraction:c}=t,{isVisible:d}=t,{stores:u}=t,{locale:h={}}=t,{markupEditorToolbar:p}=t,{markupEditorToolStyles:m}=t,{markupEditorToolRetainStyles:g}=t,{markupEditorShapeStyleControls:$}=t,{markupEditorToolSelectRadius:f}=t,{markupEditorTextInputMode:y}=t,{markupEditorToolShareStyles:b}=t,{willRenderShapePresetToolbar:x}=t,{decorateTools:v}=t,{decorateToolShapes:w}=t,{decorateShapeControls:S}=t,{decorateActiveTool:k}=t,{decorateEnableButtonFlipVertical:C=!1}=t,{decorateEnableSelectImagePreset:M=!1}=t,{decorateEnableDropImagePreset:T=!0}=t,{decoratePresets:P=[]}=t,{decorateWillRenderShapePresetToolbar:R}=t,{enableSelectToolToAddShape:I}=t,{enableTapToAddText:A}=t,{enableViewTool:E}=t,{enableMoveTool:L}=t,{enableAutoSelectMoveTool:F}=t,{willRenderShapeControls:z}=t,{willRenderShapeTextControls:D}=t,{beforeAddShape:O}=t,{beforeRemoveShape:B}=t,{beforeDeselectShape:_}=t,{beforeSelectShape:W}=t,{beforeUpdateShape:V}=t,{markupEditorWillStartInteraction:N}=t;const{imageCropRect:H,imageDecoration:j,imageSelectionRectPresentation:U,imageTransformsInterpolated:Z}=u;return Un(e,U,(e=>o(43,a=e))),Un(e,Z,(e=>o(44,s=e))),e.$$set=e=>{"isActive"in e&&o(1,l=e.isActive),"isActiveFraction"in e&&o(2,c=e.isActiveFraction),"isVisible"in e&&o(3,d=e.isVisible),"stores"in e&&o(4,u=e.stores),"locale"in e&&o(5,h=e.locale),"markupEditorToolbar"in e&&o(6,p=e.markupEditorToolbar),"markupEditorToolStyles"in e&&o(7,m=e.markupEditorToolStyles),"markupEditorToolRetainStyles"in e&&o(8,g=e.markupEditorToolRetainStyles),"markupEditorShapeStyleControls"in e&&o(9,$=e.markupEditorShapeStyleControls),"markupEditorToolSelectRadius"in e&&o(10,f=e.markupEditorToolSelectRadius),"markupEditorTextInputMode"in e&&o(11,y=e.markupEditorTextInputMode),"markupEditorToolShareStyles"in e&&o(12,b=e.markupEditorToolShareStyles),"willRenderShapePresetToolbar"in e&&o(13,x=e.willRenderShapePresetToolbar),"decorateTools"in e&&o(14,v=e.decorateTools),"decorateToolShapes"in e&&o(15,w=e.decorateToolShapes),"decorateShapeControls"in e&&o(16,S=e.decorateShapeControls),"decorateActiveTool"in e&&o(0,k=e.decorateActiveTool),"decorateEnableButtonFlipVertical"in e&&o(17,C=e.decorateEnableButtonFlipVertical),"decorateEnableSelectImagePreset"in e&&o(18,M=e.decorateEnableSelectImagePreset),"decorateEnableDropImagePreset"in e&&o(19,T=e.decorateEnableDropImagePreset),"decoratePresets"in e&&o(20,P=e.decoratePresets),"decorateWillRenderShapePresetToolbar"in e&&o(21,R=e.decorateWillRenderShapePresetToolbar),"enableSelectToolToAddShape"in e&&o(22,I=e.enableSelectToolToAddShape),"enableTapToAddText"in e&&o(23,A=e.enableTapToAddText),"enableViewTool"in e&&o(24,E=e.enableViewTool),"enableMoveTool"in e&&o(25,L=e.enableMoveTool),"enableAutoSelectMoveTool"in e&&o(26,F=e.enableAutoSelectMoveTool),"willRenderShapeControls"in e&&o(27,z=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(28,D=e.willRenderShapeTextControls),"beforeAddShape"in e&&o(29,O=e.beforeAddShape),"beforeRemoveShape"in e&&o(30,B=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(31,_=e.beforeDeselectShape),"beforeSelectShape"in e&&o(32,W=e.beforeSelectShape),"beforeUpdateShape"in e&&o(33,V=e.beforeUpdateShape),"markupEditorWillStartInteraction"in e&&o(34,N=e.markupEditorWillStartInteraction)},e.$$.update=()=>{8192&e.$$.dirty[1]&&o(42,i=s?s.scale:1),6144&e.$$.dirty[1]&&o(36,n=e=>{const t=pe(e);return t.x-=a.x,t.y-=a.y,t.x/=i,t.y/=i,t}),6144&e.$$.dirty[1]&&o(35,r=e=>{const t=pe(e);return t.x*=i,t.y*=i,t.x+=a.x,t.y+=a.y,t})},[k,l,c,d,u,h,p,m,g,$,f,y,b,x,v,w,S,C,M,T,P,R,I,A,E,L,F,z,D,O,B,_,W,V,N,r,n,H,j,U,Z,"decorate",i,a,s,function(e){k=e,o(0,k)},function(t){Wr.call(this,e,t)}]}var Hy={util:["decorate",class extends wa{constructor(e){super(),va(this,e,Ny,Vy,Nn,{name:41,isActive:1,isActiveFraction:2,isVisible:3,stores:4,locale:5,markupEditorToolbar:6,markupEditorToolStyles:7,markupEditorToolRetainStyles:8,markupEditorShapeStyleControls:9,markupEditorToolSelectRadius:10,markupEditorTextInputMode:11,markupEditorToolShareStyles:12,willRenderShapePresetToolbar:13,decorateTools:14,decorateToolShapes:15,decorateShapeControls:16,decorateActiveTool:0,decorateEnableButtonFlipVertical:17,decorateEnableSelectImagePreset:18,decorateEnableDropImagePreset:19,decoratePresets:20,decorateWillRenderShapePresetToolbar:21,enableSelectToolToAddShape:22,enableTapToAddText:23,enableViewTool:24,enableMoveTool:25,enableAutoSelectMoveTool:26,willRenderShapeControls:27,willRenderShapeTextControls:28,beforeAddShape:29,beforeRemoveShape:30,beforeDeselectShape:31,beforeSelectShape:32,beforeUpdateShape:33,markupEditorWillStartInteraction:34},null,[-1,-1])}get name(){return this.$$.ctx[41]}get isActive(){return this.$$.ctx[1]}set isActive(e){this.$$set({isActive:e}),ea()}get isActiveFraction(){return this.$$.ctx[2]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),ea()}get isVisible(){return this.$$.ctx[3]}set isVisible(e){this.$$set({isVisible:e}),ea()}get stores(){return this.$$.ctx[4]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[5]}set locale(e){this.$$set({locale:e}),ea()}get markupEditorToolbar(){return this.$$.ctx[6]}set markupEditorToolbar(e){this.$$set({markupEditorToolbar:e}),ea()}get markupEditorToolStyles(){return this.$$.ctx[7]}set markupEditorToolStyles(e){this.$$set({markupEditorToolStyles:e}),ea()}get markupEditorToolRetainStyles(){return this.$$.ctx[8]}set markupEditorToolRetainStyles(e){this.$$set({markupEditorToolRetainStyles:e}),ea()}get markupEditorShapeStyleControls(){return this.$$.ctx[9]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),ea()}get markupEditorToolSelectRadius(){return this.$$.ctx[10]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),ea()}get markupEditorTextInputMode(){return this.$$.ctx[11]}set markupEditorTextInputMode(e){this.$$set({markupEditorTextInputMode:e}),ea()}get markupEditorToolShareStyles(){return this.$$.ctx[12]}set markupEditorToolShareStyles(e){this.$$set({markupEditorToolShareStyles:e}),ea()}get willRenderShapePresetToolbar(){return this.$$.ctx[13]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),ea()}get decorateTools(){return this.$$.ctx[14]}set decorateTools(e){this.$$set({decorateTools:e}),ea()}get decorateToolShapes(){return this.$$.ctx[15]}set decorateToolShapes(e){this.$$set({decorateToolShapes:e}),ea()}get decorateShapeControls(){return this.$$.ctx[16]}set decorateShapeControls(e){this.$$set({decorateShapeControls:e}),ea()}get decorateActiveTool(){return this.$$.ctx[0]}set decorateActiveTool(e){this.$$set({decorateActiveTool:e}),ea()}get decorateEnableButtonFlipVertical(){return this.$$.ctx[17]}set decorateEnableButtonFlipVertical(e){this.$$set({decorateEnableButtonFlipVertical:e}),ea()}get decorateEnableSelectImagePreset(){return this.$$.ctx[18]}set decorateEnableSelectImagePreset(e){this.$$set({decorateEnableSelectImagePreset:e}),ea()}get decorateEnableDropImagePreset(){return this.$$.ctx[19]}set decorateEnableDropImagePreset(e){this.$$set({decorateEnableDropImagePreset:e}),ea()}get decoratePresets(){return this.$$.ctx[20]}set decoratePresets(e){this.$$set({decoratePresets:e}),ea()}get decorateWillRenderShapePresetToolbar(){return this.$$.ctx[21]}set decorateWillRenderShapePresetToolbar(e){this.$$set({decorateWillRenderShapePresetToolbar:e}),ea()}get enableSelectToolToAddShape(){return this.$$.ctx[22]}set enableSelectToolToAddShape(e){this.$$set({enableSelectToolToAddShape:e}),ea()}get enableTapToAddText(){return this.$$.ctx[23]}set enableTapToAddText(e){this.$$set({enableTapToAddText:e}),ea()}get enableViewTool(){return this.$$.ctx[24]}set enableViewTool(e){this.$$set({enableViewTool:e}),ea()}get enableMoveTool(){return this.$$.ctx[25]}set enableMoveTool(e){this.$$set({enableMoveTool:e}),ea()}get enableAutoSelectMoveTool(){return this.$$.ctx[26]}set enableAutoSelectMoveTool(e){this.$$set({enableAutoSelectMoveTool:e}),ea()}get willRenderShapeControls(){return this.$$.ctx[27]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),ea()}get willRenderShapeTextControls(){return this.$$.ctx[28]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),ea()}get beforeAddShape(){return this.$$.ctx[29]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),ea()}get beforeRemoveShape(){return this.$$.ctx[30]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),ea()}get beforeDeselectShape(){return this.$$.ctx[31]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),ea()}get beforeSelectShape(){return this.$$.ctx[32]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),ea()}get beforeUpdateShape(){return this.$$.ctx[33]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),ea()}get markupEditorWillStartInteraction(){return this.$$.ctx[34]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),ea()}}]};function jy(e){let t,o;return t=new zy({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[25],mapImagePointToScreenPoint:e[24],utilKey:"sticker",shapePresets:e[5],shapes:e[6]?e[31]:e[32],toolActive:"preset",imageFlipX:!!e[6]&&e[23],imageFlipY:!!e[6]&&e[22],imageRotation:e[6]?e[27]:0,parentRect:e[6]?e[33]:e[29],enablePresetDropImage:e[7],enablePresetSelectImage:e[26],enableButtonFlipVertical:e[10]||e[8],toolSelectRadius:e[14],willStartInteraction:e[21],willRenderPresetToolbar:e[11]||e[9]||e[15],hooks:{willRenderShapeControls:e[12],willRenderShapeTextControls:e[13],beforeAddShape:e[16],beforeRemoveShape:e[17],beforeDeselectShape:e[18],beforeSelectShape:e[19],beforeUpdateShape:e[20]}}}),t.$on("measure",e[48]),{c(){ya(t.$$.fragment)},m(e,i){ba(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]),33554432&o[0]&&(i.mapScreenPointToImagePoint=e[25]),16777216&o[0]&&(i.mapImagePointToScreenPoint=e[24]),32&o[0]&&(i.shapePresets=e[5]),64&o[0]&&(i.shapes=e[6]?e[31]:e[32]),8388672&o[0]&&(i.imageFlipX=!!e[6]&&e[23]),4194368&o[0]&&(i.imageFlipY=!!e[6]&&e[22]),134217792&o[0]&&(i.imageRotation=e[6]?e[27]:0),64&o[0]&&(i.parentRect=e[6]?e[33]:e[29]),128&o[0]&&(i.enablePresetDropImage=e[7]),67108864&o[0]&&(i.enablePresetSelectImage=e[26]),1280&o[0]&&(i.enableButtonFlipVertical=e[10]||e[8]),16384&o[0]&&(i.toolSelectRadius=e[14]),2097152&o[0]&&(i.willStartInteraction=e[21]),35328&o[0]&&(i.willRenderPresetToolbar=e[11]||e[9]||e[15]),2043904&o[0]&&(i.hooks={willRenderShapeControls:e[12],willRenderShapeTextControls:e[13],beforeAddShape:e[16],beforeRemoveShape:e[17],beforeDeselectShape:e[18],beforeSelectShape:e[19],beforeUpdateShape:e[20]}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Uy(e,t,o){let i,n,r,a,s,l,c,d,u,h,p,m;let{isActive:g}=t,{isActiveFraction:$}=t,{isVisible:f}=t,{stores:y}=t,{locale:b={}}=t,{stickers:x=[]}=t,{stickerStickToImage:v=!1}=t,{stickerEnableSelectImagePreset:w=!0}=t,{stickerEnableDropImagePreset:S=!0}=t,{stickerEnableButtonFlipVertical:k=!1}=t,{stickerWillRenderShapePresetToolbar:C}=t,{stickerEnableSelectImage:M=!0}=t,{stickersEnableButtonFlipVertical:T=!1}=t,{stickersWillRenderShapePresetToolbar:P}=t,{willRenderShapeControls:R}=t,{willRenderShapeTextControls:I}=t,{markupEditorToolSelectRadius:A}=t,{willRenderShapePresetToolbar:E}=t,{beforeAddShape:L}=t,{beforeRemoveShape:F}=t,{beforeDeselectShape:z}=t,{beforeSelectShape:D}=t,{beforeUpdateShape:O}=t,{markupEditorWillStartInteraction:B}=t;const{rootRect:_,imageCropRect:W,imageSelectionRectPresentation:V,imageAnnotation:N,imageDecoration:H,imageSize:j,imageTransforms:U,imageTransformsInterpolated:Z,imageRotation:X,imageFlipX:G,imageFlipY:Y}=y;return Un(e,_,(e=>o(47,p=e))),Un(e,V,(e=>o(43,s=e))),Un(e,j,(e=>o(46,h=e))),Un(e,U,(e=>o(45,u=e))),Un(e,Z,(e=>o(44,d=e))),Un(e,X,(e=>o(27,m=e))),Un(e,G,(e=>o(23,c=e))),Un(e,Y,(e=>o(22,l=e))),e.$$set=e=>{"isActive"in e&&o(0,g=e.isActive),"isActiveFraction"in e&&o(1,$=e.isActiveFraction),"isVisible"in e&&o(2,f=e.isVisible),"stores"in e&&o(3,y=e.stores),"locale"in e&&o(4,b=e.locale),"stickers"in e&&o(5,x=e.stickers),"stickerStickToImage"in e&&o(6,v=e.stickerStickToImage),"stickerEnableSelectImagePreset"in e&&o(40,w=e.stickerEnableSelectImagePreset),"stickerEnableDropImagePreset"in e&&o(7,S=e.stickerEnableDropImagePreset),"stickerEnableButtonFlipVertical"in e&&o(8,k=e.stickerEnableButtonFlipVertical),"stickerWillRenderShapePresetToolbar"in e&&o(9,C=e.stickerWillRenderShapePresetToolbar),"stickerEnableSelectImage"in e&&o(41,M=e.stickerEnableSelectImage),"stickersEnableButtonFlipVertical"in e&&o(10,T=e.stickersEnableButtonFlipVertical),"stickersWillRenderShapePresetToolbar"in e&&o(11,P=e.stickersWillRenderShapePresetToolbar),"willRenderShapeControls"in e&&o(12,R=e.willRenderShapeControls),"willRenderShapeTextControls"in e&&o(13,I=e.willRenderShapeTextControls),"markupEditorToolSelectRadius"in e&&o(14,A=e.markupEditorToolSelectRadius),"willRenderShapePresetToolbar"in e&&o(15,E=e.willRenderShapePresetToolbar),"beforeAddShape"in e&&o(16,L=e.beforeAddShape),"beforeRemoveShape"in e&&o(17,F=e.beforeRemoveShape),"beforeDeselectShape"in e&&o(18,z=e.beforeDeselectShape),"beforeSelectShape"in e&&o(19,D=e.beforeSelectShape),"beforeUpdateShape"in e&&o(20,O=e.beforeUpdateShape),"markupEditorWillStartInteraction"in e&&o(21,B=e.markupEditorWillStartInteraction)},e.$$.update=()=>{8192&e.$$.dirty[1]&&o(42,i=d?d.scale:1),1536&e.$$.dirty[1]&&o(26,n=!1!==w&&M),12582976&e.$$.dirty[0]|129024&e.$$.dirty[1]&&o(25,r=v?e=>Oy(e,p,h,d.origin,d.translation,u.rotation.z,d.scale,c,l):e=>{const t=pe(e);return t.x-=s.x,t.y-=s.y,t.x/=i,t.y/=i,t}),12582976&e.$$.dirty[0]|129024&e.$$.dirty[1]&&o(24,a=v?e=>Dy(e,p,h,d.origin,d.translation,u.rotation.z,d.scale,c,l):e=>{const t=pe(e);return t.x*=i,t.y*=i,t.x+=s.x,t.y+=s.y,t})},[g,$,f,y,b,x,v,S,k,C,T,P,R,I,A,E,L,F,z,D,O,B,l,c,a,r,n,m,_,W,V,N,H,j,U,Z,X,G,Y,"sticker",w,M,i,s,d,u,h,p,function(t){Wr.call(this,e,t)}]}var Zy={util:["sticker",class extends wa{constructor(e){super(),va(this,e,Uy,jy,Nn,{name:39,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,stickers:5,stickerStickToImage:6,stickerEnableSelectImagePreset:40,stickerEnableDropImagePreset:7,stickerEnableButtonFlipVertical:8,stickerWillRenderShapePresetToolbar:9,stickerEnableSelectImage:41,stickersEnableButtonFlipVertical:10,stickersWillRenderShapePresetToolbar:11,willRenderShapeControls:12,willRenderShapeTextControls:13,markupEditorToolSelectRadius:14,willRenderShapePresetToolbar:15,beforeAddShape:16,beforeRemoveShape:17,beforeDeselectShape:18,beforeSelectShape:19,beforeUpdateShape:20,markupEditorWillStartInteraction:21},null,[-1,-1])}get name(){return this.$$.ctx[39]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),ea()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),ea()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),ea()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),ea()}get stickers(){return this.$$.ctx[5]}set stickers(e){this.$$set({stickers:e}),ea()}get stickerStickToImage(){return this.$$.ctx[6]}set stickerStickToImage(e){this.$$set({stickerStickToImage:e}),ea()}get stickerEnableSelectImagePreset(){return this.$$.ctx[40]}set stickerEnableSelectImagePreset(e){this.$$set({stickerEnableSelectImagePreset:e}),ea()}get stickerEnableDropImagePreset(){return this.$$.ctx[7]}set stickerEnableDropImagePreset(e){this.$$set({stickerEnableDropImagePreset:e}),ea()}get stickerEnableButtonFlipVertical(){return this.$$.ctx[8]}set stickerEnableButtonFlipVertical(e){this.$$set({stickerEnableButtonFlipVertical:e}),ea()}get stickerWillRenderShapePresetToolbar(){return this.$$.ctx[9]}set stickerWillRenderShapePresetToolbar(e){this.$$set({stickerWillRenderShapePresetToolbar:e}),ea()}get stickerEnableSelectImage(){return this.$$.ctx[41]}set stickerEnableSelectImage(e){this.$$set({stickerEnableSelectImage:e}),ea()}get stickersEnableButtonFlipVertical(){return this.$$.ctx[10]}set stickersEnableButtonFlipVertical(e){this.$$set({stickersEnableButtonFlipVertical:e}),ea()}get stickersWillRenderShapePresetToolbar(){return this.$$.ctx[11]}set stickersWillRenderShapePresetToolbar(e){this.$$set({stickersWillRenderShapePresetToolbar:e}),ea()}get willRenderShapeControls(){return this.$$.ctx[12]}set willRenderShapeControls(e){this.$$set({willRenderShapeControls:e}),ea()}get willRenderShapeTextControls(){return this.$$.ctx[13]}set willRenderShapeTextControls(e){this.$$set({willRenderShapeTextControls:e}),ea()}get markupEditorToolSelectRadius(){return this.$$.ctx[14]}set markupEditorToolSelectRadius(e){this.$$set({markupEditorToolSelectRadius:e}),ea()}get willRenderShapePresetToolbar(){return this.$$.ctx[15]}set willRenderShapePresetToolbar(e){this.$$set({willRenderShapePresetToolbar:e}),ea()}get beforeAddShape(){return this.$$.ctx[16]}set beforeAddShape(e){this.$$set({beforeAddShape:e}),ea()}get beforeRemoveShape(){return this.$$.ctx[17]}set beforeRemoveShape(e){this.$$set({beforeRemoveShape:e}),ea()}get beforeDeselectShape(){return this.$$.ctx[18]}set beforeDeselectShape(e){this.$$set({beforeDeselectShape:e}),ea()}get beforeSelectShape(){return this.$$.ctx[19]}set beforeSelectShape(e){this.$$set({beforeSelectShape:e}),ea()}get beforeUpdateShape(){return this.$$.ctx[20]}set beforeUpdateShape(e){this.$$set({beforeUpdateShape:e}),ea()}get markupEditorWillStartInteraction(){return this.$$.ctx[21]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),ea()}},({stickers:e,stickerEnableSelectImagePreset:t,stickerEnableDropImagePreset:o})=>e&&e.length||t||o]};function Xy(e){let t,o,i,n,r,a=(e[14](e[33].value)||"")+"",s=(R(e[33].label)?e[33].label(e[1]):e[33].label)+"";return{c(){t=hr("div"),o=new Cr(!1),i=gr(),n=hr("span"),r=mr(s),o.a=i,xr(t,"slot","option")},m(e,s){dr(e,t,s),o.m(a,t),sr(t,i),sr(t,n),sr(n,r)},p(e,t){4&t[1]&&a!==(a=(e[14](e[33].value)||"")+"")&&o.p(a),2&t[0]|4&t[1]&&s!==(s=(R(e[33].label)?e[33].label(e[1]):e[33].label)+"")&&wr(r,s)},d(e){e&&ur(t)}}}function Gy(e){let t,o;return t=new bu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[6],onchange:e[12],$$slots:{option:[Xy,({option:e})=>({33:e}),({option:e})=>[0,e?4:0]]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};2&o[0]&&(i.locale=e[1]),4&o[0]&&(i.options=e[2]),64&o[0]&&(i.selectedIndex=e[6]),2&o[0]|12&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Yy(e){let t,o,i,n,r;return o=new Xf({props:{locale:e[1],class:"PinturaControlPanels",shape:e[4],onchange:e[13],controls:e[3],scrollElasticity:e[7]}}),n=new ad({props:{elasticity:e[10],$$slots:{default:[Gy]},$$scope:{ctx:e}}}),{c(){t=hr("div"),ya(o.$$.fragment),i=gr(),ya(n.$$.fragment),xr(t,"slot","footer"),xr(t,"style",e[5])},m(e,a){dr(e,t,a),ba(o,t,null),sr(t,i),ba(n,t,null),r=!0},p(e,i){const a={};2&i[0]&&(a.locale=e[1]),16&i[0]&&(a.shape=e[4]),8&i[0]&&(a.controls=e[3]),128&i[0]&&(a.scrollElasticity=e[7]),o.$set(a);const s={};70&i[0]|8&i[1]&&(s.$$scope={dirty:i,ctx:e}),n.$set(s),(!r||32&i[0])&&xr(t,"style",e[5])},i(e){r||(sa(o.$$.fragment,e),sa(n.$$.fragment,e),r=!0)},o(e){la(o.$$.fragment,e),la(n.$$.fragment,e),r=!1},d(e){e&&ur(t),xa(o),xa(n)}}}function qy(e){let t,o;return t=new Wg({props:{$$slots:{footer:[Yy]},$$scope:{ctx:e}}}),t.$on("measure",e[23]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};254&o[0]|8&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function Ky(e,t,o){let i,n,r,a,s,l,c,d,u=zn,h=()=>(u(),u=Hn(p,(e=>o(20,s=e))),p);e.$$.on_destroy.push((()=>u()));let{isActive:p}=t;h();let{stores:m}=t,{locale:g={}}=t,{frameStyles:$={}}=t,{frameOptions:f=[]}=t,{markupEditorShapeStyleControls:y}=t;const b=_r("elasticityMultiplier");Un(e,b,(e=>o(22,d=e)));const{history:x,animation:v,scrollElasticity:w,imageFrame:S,allowPan:k,allowZoom:C,allowZoomControls:M}=m;Un(e,v,(e=>o(21,l=e))),Un(e,S,(e=>o(4,c=e)));let T={};let P;const R=Wl(l?20:0);return Un(e,R,(e=>o(19,a=e))),e.$$set=e=>{"isActive"in e&&h(o(0,p=e.isActive)),"stores"in e&&o(17,m=e.stores),"locale"in e&&o(1,g=e.locale),"frameStyles"in e&&o(18,$=e.frameStyles),"frameOptions"in e&&o(2,f=e.frameOptions),"markupEditorShapeStyleControls"in e&&o(3,y=e.markupEditorShapeStyleControls)},e.$$.update=()=>{1048576&e.$$.dirty[0]&&k.set(s),1048576&e.$$.dirty[0]&&C.set(s),1048576&e.$$.dirty[0]&&M.set(s),4194304&e.$$.dirty[0]&&o(7,i=d*w),20&e.$$.dirty[0]&&o(6,n=c?f.findIndex((([e])=>e===c.id)):0),3145728&e.$$.dirty[0]&&l&&R.set(s?0:20),524288&e.$$.dirty[0]&&o(5,r=a?`transform: translateY(${a}px)`:void 0)},[p,g,f,y,c,r,n,i,b,v,w,S,({value:e})=>{const t=$[e];if(!t||!t.shape)return S.set(void 0),void x.write();const{shape:o}=t,i={id:e,...ui(o),...Object.keys(T).reduce(((e,t)=>o[t]?(e[t]=T[t],e):e),{})};S.set(i),x.write()},function(e){Po(e,"frameColor")&&(T.frameColor=e.frameColor),c&&(ln(c,e),S.set(c),clearTimeout(P),P=setTimeout((()=>{x.write()}),200))},e=>{const t=$[e];var o;if(t&&t.thumb)return o=t.thumb,/div/i.test(o)||iy(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=""/>`},R,"frame",m,$,a,s,l,d,function(t){Wr.call(this,e,t)}]}var Jy={util:["frame",class extends wa{constructor(e){super(),va(this,e,Ky,qy,Nn,{name:16,isActive:0,stores:17,locale:1,frameStyles:18,frameOptions:2,markupEditorShapeStyleControls:3},null,[-1,-1])}get name(){return this.$$.ctx[16]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),ea()}get stores(){return this.$$.ctx[17]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),ea()}get frameStyles(){return this.$$.ctx[18]}set frameStyles(e){this.$$set({frameStyles:e}),ea()}get frameOptions(){return this.$$.ctx[2]}set frameOptions(e){this.$$set({frameOptions:e}),ea()}get markupEditorShapeStyleControls(){return this.$$.ctx[3]}set markupEditorShapeStyleControls(e){this.$$set({markupEditorShapeStyleControls:e}),ea()}},({src:e})=>e&&!fh(e)]};function Qy(e){let t,o,i,n,r,a,s,l;return{c(){t=hr("div"),o=hr("input"),n=gr(),r=hr("label"),a=mr(e[1]),xr(o,"id",e[0]),xr(o,"type","number"),xr(o,"min","1"),xr(o,"inputmode","numeric"),xr(o,"pattern","[0-9]*"),xr(o,"data-state",e[3]),xr(o,"autocomplete","off"),xr(o,"placeholder",e[4]),o.value=i=void 0===e[5]?"":e[7](e[5]+""),xr(r,"for",e[0]),xr(r,"title",e[2]),xr(r,"aria-label",e[2]),xr(t,"class","PinturaInputDimension")},m(i,c){dr(i,t,c),sr(t,o),sr(t,n),sr(t,r),sr(r,a),s||(l=fr(o,"input",e[8]),s=!0)},p(e,[t]){1&t&&xr(o,"id",e[0]),8&t&&xr(o,"data-state",e[3]),16&t&&xr(o,"placeholder",e[4]),160&t&&i!==(i=void 0===e[5]?"":e[7](e[5]+""))&&o.value!==i&&(o.value=i),2&t&&wr(a,e[1]),1&t&&xr(r,"for",e[0]),4&t&&xr(r,"title",e[2]),4&t&&xr(r,"aria-label",e[2])},i:zn,o:zn,d(e){e&&ur(t),s=!1,l()}}}function eb(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 tb extends wa{constructor(e){super(),va(this,e,eb,Qy,Nn,{id:0,label:1,title:2,state:3,placeholder:4,value:5,onchange:6,format:7})}}function ob(e){let t;return{c(){t=pr("g")},m(o,i){dr(o,t,i),t.innerHTML=e[2]},p(e,o){4&o&&(t.innerHTML=e[2])},d(e){e&&ur(t)}}}function ib(e){let t,o,i,n,r,a,s,l;return r=new Wc({props:{$$slots:{default:[ob]},$$scope:{ctx:e}}}),{c(){t=hr("div"),o=hr("input"),i=gr(),n=hr("label"),ya(r.$$.fragment),xr(o,"id",e[0]),xr(o,"class","implicit"),xr(o,"type","checkbox"),o.checked=e[1],xr(n,"for",e[0]),xr(n,"title",e[3])},m(c,d){dr(c,t,d),sr(t,o),sr(t,i),sr(t,n),ba(r,n,null),a=!0,s||(l=fr(o,"change",e[5]),s=!0)},p(e,[t]){(!a||1&t)&&xr(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)&&xr(n,"for",e[0]),(!a||8&t)&&xr(n,"title",e[3])},i(e){a||(sa(r.$$.fragment,e),a=!0)},o(e){la(r.$$.fragment,e),a=!1},d(e){e&&ur(t),xa(r),s=!1,l()}}}function nb(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 rb extends wa{constructor(e){super(),va(this,e,nb,ib,Nn,{id:0,locked:1,icon:2,title:3,onchange:4})}}function ab(e){let t;return{c(){t=mr("Save")},m(e,o){dr(e,t,o)},d(e){e&&ur(t)}}}function sb(e){let t,o,i,n,r,a,s,l,c,d,u,h,p,m=e[1].resizeLabelFormCaption+"";return l=new dh({props:{items:e[4]}}),d=new Gc({props:{type:"submit",class:"implicit",$$slots:{default:[ab]},$$scope:{ctx:e}}}),{c(){t=hr("form"),o=hr("div"),i=hr("fieldset"),n=hr("legend"),r=mr(m),a=gr(),s=hr("div"),ya(l.$$.fragment),c=gr(),ya(d.$$.fragment),xr(n,"class","implicit"),xr(s,"class","PinturaFieldsetInner"),xr(o,"class","PinturaFormInner"),xr(t,"slot","footer"),xr(t,"style",e[3])},m(m,g){dr(m,t,g),sr(t,o),sr(o,i),sr(i,n),sr(n,r),sr(i,a),sr(i,s),ba(l,s,null),e[64](s),sr(o,c),ba(d,o,null),u=!0,h||(p=[fr(s,"focusin",e[15]),fr(s,"focusout",e[16]),fr(t,"submit",yr(e[17]))],h=!0)},p(e,o){(!u||2&o[0])&&m!==(m=e[1].resizeLabelFormCaption+"")&&wr(r,m);const i={};16&o[0]&&(i.items=e[4]),l.$set(i);const n={};4&o[3]&&(n.$$scope={dirty:o,ctx:e}),d.$set(n),(!u||8&o[0])&&xr(t,"style",e[3])},i(e){u||(sa(l.$$.fragment,e),sa(d.$$.fragment,e),u=!0)},o(e){la(l.$$.fragment,e),la(d.$$.fragment,e),u=!1},d(o){o&&ur(t),xa(l),e[64](null),xa(d),h=!1,Wn(p)}}}function lb(e){let t,o;return t=new Wg({props:{$$slots:{footer:[sb]},$$scope:{ctx:e}}}),t.$on("measure",e[65]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};30&o[0]|4&o[3]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function cb(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,R,I,A,E,F,z=zn,D=()=>(z(),z=Hn(B,(e=>o(48,p=e))),B);e.$$.on_destroy.push((()=>z()));const O=(e,t=0,o=9999)=>{if(P(e)&&!(e=e.replace(/\D/g,"")).length)return;const i=Math.round(e);return Number.isNaN(i)?void 0:Za(i,t,o)};let{isActive:B}=t;D();let{stores:_}=t,{locale:W={}}=t,{resizeMinSize:V=_e(1,1)}=t,{resizeMaxSize:N=_e(9999,9999)}=t,{resizeSizePresetOptions:H}=t,{resizeWidthPresetOptions:j}=t,{resizeHeightPresetOptions:X}=t,{resizeWillRenderFooter:G=Z}=t;const Y=Wl(0,{stiffness:.15,damping:.3});Un(e,Y,(e=>o(53,y=e)));const{animation:q,imageSize:K,imageCropRect:J,imageCropRectAspectRatio:Q,imageCropAspectRatio:ee,imageOutputSize:te,imageSelectionZoom:oe,imageSelectionPan:ie,history:ne,env:re,allowPan:ae,allowZoom:se,allowZoomControls:le}=_;Un(e,q,(e=>o(49,m=e))),Un(e,K,(e=>o(72,A=e))),Un(e,J,(e=>o(51,$=e))),Un(e,Q,(e=>o(52,f=e))),Un(e,ee,(e=>o(71,M=e))),Un(e,te,(e=>o(60,C=e))),Un(e,oe,(e=>o(73,E=e))),Un(e,ie,(e=>o(74,F=e))),Un(e,re,(e=>o(50,g=e)));const ce=L();let ue,he,pe,me,ge,$e,fe=!1,ye=de();const be=(e,t,o,i,n)=>null!=e&&o!==t?e>=i[t]&&e<=n[t]?"valid":"invalid":"undetermined",xe=(e,t,o)=>Math.round(null!=e?e/t:o.height),ve=()=>{fe&&he&&pe&&("width"===me?o(38,pe=Math.round(he/f)):"height"===me?o(37,he=Math.round(pe*f)):("width"===ge?o(38,pe=Math.round(he/f)):"height"===ge&&o(37,he=Math.round(pe*f)),we()))},we=e=>{let t=O(he),i=O(pe),n=t,r=i,a=n&&r,s=e||f;if(!n&&!r)return;n&&!r?r=Math.round(n/s):r&&!n&&(n=Math.round(r*s)),s=e||a?U(n,r):f;let l=_e(n,r);je(N,l)||(l=bt(N,s)),je(l,V)||(l=yt(V,s)),o(37,he=null!=t?Math.round(l.width):void 0),o(38,pe=null!=i?Math.round(l.height):void 0)},Se=()=>{we();const{width:e,height:t}=C||{};e===he&&t===pe||(he||pe?(he&&pe&&Qn(ee,M=he/pe,M),Qn(te,C=_e(he,pe),C)):(Qn(ee,M=A.width/A.height,M),Qn(ee,M=void 0,M),Qn(te,C=void 0,C)),ne.write())},ke=te.subscribe((e=>{if(!e)return o(37,he=void 0),void o(38,pe=void 0);o(37,he=e.width),o(38,pe=e.height),we()})),Ce=ee.subscribe((e=>{(he||pe)&&e&&(he&&pe&&U(he,pe)!==e?(o(38,pe=he/e),we(e)):we())})),Me=e=>P(e[0])?(e[1]=e[1].map(Me),e):Mo(e)?[e,""+e]:e,Te=e=>{if(P(e[0]))return e[1]=e[1].map(Te),e;let[t,o]=e;if(Mo(t)&&Mo(o)){const[e,i]=[t,o];o=`${e} &times; ${i}`,t=[e,i]}return[t,o]},Pe=Ca();Un(e,Pe,(e=>o(59,k=e)));const Re=Ca();Un(e,Re,(e=>o(63,I=e)));const Ie=Ca();Un(e,Ie,(e=>o(57,w=e)));const Ae=Ca();Un(e,Ae,(e=>o(62,R=e)));const Ee=Ca();Un(e,Ee,(e=>o(55,x=e)));const Le=Ca();Un(e,Le,(e=>o(61,T=e)));const Fe=Ma([te,Re],(([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)}));Un(e,Fe,(e=>o(58,S=e)));const ze=Ma([te,Ae],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>!t&&!e||!!t&&e.width===t));o(i<0?0:i)}));Un(e,ze,(e=>o(56,v=e)));const De=Ma([te,Le],(([e,t],o)=>{if(!t)return o(-1);const i=t.findIndex((([t])=>!t&&!e||!!t&&e.height===t));o(i<0?0:i)}));Un(e,De,(e=>o(54,b=e)));let Be=void 0,We=void 0;const Ve=_r("redrawTrigger"),Ne=Wl(m?20:0);return Un(e,Ne,(e=>o(47,h=e))),Dr((()=>{ke(),Ce()})),e.$$set=e=>{"isActive"in e&&D(o(0,B=e.isActive)),"stores"in e&&o(29,_=e.stores),"locale"in e&&o(1,W=e.locale),"resizeMinSize"in e&&o(30,V=e.resizeMinSize),"resizeMaxSize"in e&&o(31,N=e.resizeMaxSize),"resizeSizePresetOptions"in e&&o(32,H=e.resizeSizePresetOptions),"resizeWidthPresetOptions"in e&&o(33,j=e.resizeWidthPresetOptions),"resizeHeightPresetOptions"in e&&o(34,X=e.resizeHeightPresetOptions),"resizeWillRenderFooter"in e&&o(35,G=e.resizeWillRenderFooter)},e.$$.update=()=>{var t;131072&e.$$.dirty[1]&&ae.set(!p),131072&e.$$.dirty[1]&&se.set(!p),131072&e.$$.dirty[1]&&le.set(!p),268435458&e.$$.dirty[1]&&H&&(Qn(Pe,k=H.map(Te),k),Qn(Re,I=Hd(k),I)),268435456&e.$$.dirty[1]&&o(46,a=!!k),134217728&e.$$.dirty[1]|2&e.$$.dirty[2]&&o(45,i=S>-1&&I[S][1]),67108868&e.$$.dirty[1]&&j&&(Qn(Ie,w=j.map(Me),w),Qn(Ae,R=Hd(w),R)),67141632&e.$$.dirty[1]&&o(43,s=!a&&w),33554432&e.$$.dirty[1]|1&e.$$.dirty[2]&&o(44,n=v>-1&&R[v][1]),16777224&e.$$.dirty[1]&&X&&(Qn(Ee,x=X.map(Me),x),Qn(Le,T=Hd(x),T)),16809984&e.$$.dirty[1]&&o(42,l=!a&&x),1082130432&e.$$.dirty[1]&&o(41,r=b>-1&&T[b][1]),38912&e.$$.dirty[1]&&o(40,c=!a&&!s&&!l),1073741826&e.$$.dirty[0]|536412145&e.$$.dirty[1]&&o(4,d=Ve&&Rh((()=>{return G([a&&["Dropdown","size-presets",{label:i,options:k,onchange:e=>{return(t=e.value)&&!Be&&(Be={...$},We=M),t?(Qn(ee,M=U(t[0],t[1]),M),Qn(te,C=Oe(t),C)):(Qn(J,$=Be,$),Qn(ee,M=We,M),Qn(te,C=void 0,C),Be=void 0,We=void 0),void ne.write();var t},selectedIndex:S}],s&&["Dropdown","width-presets",{label:n,options:w,onchange:e=>{o(37,he=e.value),Se()},selectedIndex:v}],s&&l&&["span","times",{class:"PinturaResizeLabel",innerHTML:"&times;"}],l&&["Dropdown","height-presets",{label:r,options:x,onchange:e=>{o(38,pe=e.value),Se()},selectedIndex:b}],c&&[tb,"width-input",{id:"width-"+ce,title:W.resizeTitleInputWidth,label:W.resizeLabelInputWidth,placeholder:(e=O(pe),t=f,d=$,Math.round(null!=e?e*t:d.width)),value:he,state:be(O(he),"width",me,V,N),onchange:e=>{o(37,he=e),ve()}}],c&&[rb,"aspect-ratio-lock",{id:"aspect-ratio-lock-"+ce,title:W.resizeTitleButtonMaintainAspectRatio,icon:P(W.resizeIconButtonMaintainAspectRatio)?W.resizeIconButtonMaintainAspectRatio:W.resizeIconButtonMaintainAspectRatio(fe,y),locked:fe,onchange:e=>{o(36,fe=e),ve()}}],c&&[tb,"height-input",{id:"height-"+ce,title:W.resizeTitleInputHeight,label:W.resizeLabelInputHeight,placeholder:xe(O(he),f,$),value:pe,state:be(O(pe),"height",me,V,N),onchange:e=>{o(38,pe=e),ve()}}]].filter(Boolean),{...g},(()=>Ve.set({})));var e,t,d})).filter(Boolean)),32&e.$$.dirty[1]&&Y.set(fe?1:0),256&e.$$.dirty[1]&&me&&(ge=me),131072&e.$$.dirty[1]&&p&&(ye=F,$e=E),537001984&e.$$.dirty[1]&&(p?(t=C,Qn(ie,F=de(),F),Qn(oe,E=t&&$?t.width/$.width||t.height/$.height:1,E)):(Qn(ie,F=ye,F),Qn(oe,E=$e,E))),393216&e.$$.dirty[1]&&m&&Ne.set(p?0:20),65536&e.$$.dirty[1]&&o(3,u=h?`transform: translateY(${h}px)`:void 0)},[B,W,ue,u,d,Y,q,K,J,Q,ee,te,oe,ie,re,e=>{const t=e.target.id;/width/.test(t)?o(39,me="width"):/height/.test(t)?o(39,me="height"):/aspectRatio/i.test(t)?o(39,me="lock"):o(39,me=void 0)},e=>{ue.contains(e.relatedTarget)||Se(),o(39,me=void 0)},Se,Pe,Re,Ie,Ae,Ee,Le,Fe,ze,De,Ne,"resize",_,V,N,H,j,X,G,fe,he,pe,me,c,r,l,s,n,i,a,h,p,m,g,$,f,y,b,x,v,w,S,k,C,T,R,I,function(e){Nr[e?"unshift":"push"]((()=>{ue=e,o(2,ue)}))},function(t){Wr.call(this,e,t)}]}var db={util:["resize",class extends wa{constructor(e){super(),va(this,e,cb,lb,Nn,{name:28,isActive:0,stores:29,locale:1,resizeMinSize:30,resizeMaxSize:31,resizeSizePresetOptions:32,resizeWidthPresetOptions:33,resizeHeightPresetOptions:34,resizeWillRenderFooter:35},null,[-1,-1,-1,-1])}get name(){return this.$$.ctx[28]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),ea()}get stores(){return this.$$.ctx[29]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),ea()}get resizeMinSize(){return this.$$.ctx[30]}set resizeMinSize(e){this.$$set({resizeMinSize:e}),ea()}get resizeMaxSize(){return this.$$.ctx[31]}set resizeMaxSize(e){this.$$set({resizeMaxSize:e}),ea()}get resizeSizePresetOptions(){return this.$$.ctx[32]}set resizeSizePresetOptions(e){this.$$set({resizeSizePresetOptions:e}),ea()}get resizeWidthPresetOptions(){return this.$$.ctx[33]}set resizeWidthPresetOptions(e){this.$$set({resizeWidthPresetOptions:e}),ea()}get resizeHeightPresetOptions(){return this.$$.ctx[34]}set resizeHeightPresetOptions(e){this.$$set({resizeHeightPresetOptions:e}),ea()}get resizeWillRenderFooter(){return this.$$.ctx[35]}set resizeWillRenderFooter(e){this.$$set({resizeWillRenderFooter:e}),ea()}},({src:e})=>e&&!fh(e)]};function ub(e){let t,o;return t=new zy({props:{stores:e[3],locale:e[4],isActive:e[0],isActiveFraction:e[1],isVisible:e[2],mapScreenPointToImagePoint:e[9],mapImagePointToScreenPoint:e[8],utilKey:"redact",imageRotation:e[10],imageFlipX:e[7],imageFlipY:e[6],shapes:e[11],toolbar:["rect"],toolShapes:{rectangle:[{x:0,y:0,width:0,height:0}]},toolActive:"rectangle",parentRect:e[13],enablePresetDropImage:!1,enablePresetSelectImage:!1,willStartInteraction:e[5],hooks:{willRenderShapeControls:e[24]}}}),t.$on("measure",e[25]),{c(){ya(t.$$.fragment)},m(e,i){ba(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]),512&o&&(i.mapScreenPointToImagePoint=e[9]),256&o&&(i.mapImagePointToScreenPoint=e[8]),1024&o&&(i.imageRotation=e[10]),128&o&&(i.imageFlipX=e[7]),64&o&&(i.imageFlipY=e[6]),32&o&&(i.willStartInteraction=e[5]),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function hb(e,t,o){let i,n,r,a,s,l,c,d,u;let{isActive:h}=t,{isActiveFraction:p}=t,{isVisible:m}=t,{stores:g}=t,{locale:$={}}=t,{markupEditorWillStartInteraction:f}=t;const{imageRedaction:y,rootRect:b,imageSize:x,imageRotation:v,imageFlipX:w,imageFlipY:S,imageTransforms:k,imageTransformsInterpolated:C}=g;Un(e,b,(e=>o(23,d=e))),Un(e,x,(e=>o(22,c=e))),Un(e,v,(e=>o(10,u=e))),Un(e,w,(e=>o(7,a=e))),Un(e,S,(e=>o(6,r=e))),Un(e,k,(e=>o(21,l=e))),Un(e,C,(e=>o(20,s=e)));return e.$$set=e=>{"isActive"in e&&o(0,h=e.isActive),"isActiveFraction"in e&&o(1,p=e.isActiveFraction),"isVisible"in e&&o(2,m=e.isVisible),"stores"in e&&o(3,g=e.stores),"locale"in e&&o(4,$=e.locale),"markupEditorWillStartInteraction"in e&&o(5,f=e.markupEditorWillStartInteraction)},e.$$.update=()=>{15728832&e.$$.dirty&&o(9,i=e=>Oy(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,r)),15728832&e.$$.dirty&&o(8,n=e=>Dy(e,d,c,s.origin,s.translation,l.rotation.z,s.scale,a,r))},[h,p,m,g,$,f,r,a,n,i,u,y,b,x,v,w,S,k,C,"redact",s,l,c,d,e=>{const t=kp(e[0]);return Mp("to-front",t),e},function(t){Wr.call(this,e,t)}]}var pb={util:["redact",class extends wa{constructor(e){super(),va(this,e,hb,ub,Nn,{name:19,isActive:0,isActiveFraction:1,isVisible:2,stores:3,locale:4,markupEditorWillStartInteraction:5})}get name(){return this.$$.ctx[19]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),ea()}get isActiveFraction(){return this.$$.ctx[1]}set isActiveFraction(e){this.$$set({isActiveFraction:e}),ea()}get isVisible(){return this.$$.ctx[2]}set isVisible(e){this.$$set({isVisible:e}),ea()}get stores(){return this.$$.ctx[3]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[4]}set locale(e){this.$$set({locale:e}),ea()}get markupEditorWillStartInteraction(){return this.$$.ctx[5]}set markupEditorWillStartInteraction(e){this.$$set({markupEditorWillStartInteraction:e}),ea()}},({src:e})=>e&&!fh(e)]};function mb(e){let t,o,i=(R(e[31].label)?e[31].label(e[1]):e[31].label)+"";return{c(){t=hr("span"),o=mr(i)},m(e,i){dr(e,t,i),sr(t,o)},p(e,t){2&t[0]|1&t[1]&&i!==(i=(R(e[31].label)?e[31].label(e[1]):e[31].label)+"")&&wr(o,i)},d(e){e&&ur(t)}}}function gb(e){let t,o,i,n=(e[11](e[31].value)||"")+"",r=e[31].label&&mb(e);return{c(){t=hr("div"),o=new Cr(!1),i=gr(),r&&r.c(),o.a=i,xr(t,"slot","option")},m(e,a){dr(e,t,a),o.m(n,t),sr(t,i),r&&r.m(t,null)},p(e,i){1&i[1]&&n!==(n=(e[11](e[31].value)||"")+"")&&o.p(n),e[31].label?r?r.p(e,i):(r=mb(e),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},d(e){e&&ur(t),r&&r.d()}}}function $b(e){let t,o;return t=new bu({props:{locale:e[1],class:"PinturaControlList",layout:"row",options:e[2],selectedIndex:e[4],onchange:e[10],$$slots:{option:[gb,({option:e})=>({31:e}),({option:e})=>[0,e?1:0]]},$$scope:{ctx:e}}}),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};2&o[0]&&(i.locale=e[1]),4&o[0]&&(i.options=e[2]),16&o[0]&&(i.selectedIndex=e[4]),2&o[0]|3&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function fb(e){let t,o,i;return o=new ad({props:{elasticity:e[5],$$slots:{default:[$b]},$$scope:{ctx:e}}}),{c(){t=hr("div"),ya(o.$$.fragment),xr(t,"slot","footer"),xr(t,"style",e[3])},m(e,n){dr(e,t,n),ba(o,t,null),i=!0},p(e,n){const r={};32&n[0]&&(r.elasticity=e[5]),22&n[0]|2&n[1]&&(r.$$scope={dirty:n,ctx:e}),o.$set(r),(!i||8&n[0])&&xr(t,"style",e[3])},i(e){i||(sa(o.$$.fragment,e),i=!0)},o(e){la(o.$$.fragment,e),i=!1},d(e){e&&ur(t),xa(o)}}}function yb(e){let t,o;return t=new Wg({props:{$$slots:{footer:[fb]},$$scope:{ctx:e}}}),t.$on("measure",e[22]),{c(){ya(t.$$.fragment)},m(e,i){ba(t,e,i),o=!0},p(e,o){const i={};62&o[0]|2&o[1]&&(i.$$scope={dirty:o,ctx:e}),t.$set(i)},i(e){o||(sa(t.$$.fragment,e),o=!0)},o(e){la(t.$$.fragment,e),o=!1},d(e){xa(t,e)}}}function bb(e,t,o){let i,n,r,a,s,l,c,d,u,h,p=zn,m=()=>(p(),p=Hn(g,(e=>o(17,l=e))),g);e.$$.on_destroy.push((()=>p()));let{isActive:g}=t;m();let{stores:$}=t,{locale:f={}}=t,{fillOptions:y=[]}=t;const b=e=>e.map((e=>(e=>Ro(e)&&P(e[0])&&Ro(e[1]))(e)?[e[0],b(e[1]),e[2]]:(e=>[Array.isArray(e)&&3===e.length?[...e,1]:e,void 0,{disabled:!1}])(e))),x=_r("elasticityMultiplier");Un(e,x,(e=>o(21,h=e)));const{history:v,animation:w,scrollElasticity:S,imageBackgroundColor:k,imageBackgroundImage:C,allowPan:M,allowZoom:T,allowZoomControls:R}=$;Un(e,w,(e=>o(18,c=e))),Un(e,k,(e=>o(20,u=e))),Un(e,C,(e=>o(19,d=e)));const I=Wl(c?20:0);return Un(e,I,(e=>o(16,s=e))),e.$$set=e=>{"isActive"in e&&m(o(0,g=e.isActive)),"stores"in e&&o(14,$=e.stores),"locale"in e&&o(1,f=e.locale),"fillOptions"in e&&o(15,y=e.fillOptions)},e.$$.update=()=>{32768&e.$$.dirty[0]&&o(2,i=b(y)),131072&e.$$.dirty[0]&&M.set(l),131072&e.$$.dirty[0]&&T.set(l),131072&e.$$.dirty[0]&&R.set(l),2097152&e.$$.dirty[0]&&o(5,n=h*S),1572868&e.$$.dirty[0]&&o(4,r=i.findIndex((([e])=>d?e===d:Array.isArray(e)?Ka(e,u):void 0))||0),393216&e.$$.dirty[0]&&c&&I.set(l?0:20),65536&e.$$.dirty[0]&&o(3,a=s?`transform: translateY(${s}px)`:void 0)},[g,f,i,a,r,n,x,w,k,C,({value:e})=>{P(e)&&(Qn(k,u=void 0,u),Qn(C,d=e,d)),Ro(e)&&(Qn(k,u=e,u),Qn(C,d=void 0,d)),v.write()},e=>{if(P(e))return`<div class="PinturaFillTile"><img src="${e}" alt="" width="48" height="64"/></div>`;if(Ro(e)){const[t,o,i,n]=e.map(((e,t)=>t<3?Math.round(255*e):e));return`<div class="PinturaFillTile" data-transparent="${n<1}"><div style="background-color:rgba(${t},${o},${i},${n})"></div></div>`}return"<div></div>"},I,"fill",$,y,s,l,c,d,u,h,function(t){Wr.call(this,e,t)}]}var xb={util:["fill",class extends wa{constructor(e){super(),va(this,e,bb,yb,Nn,{name:13,isActive:0,stores:14,locale:1,fillOptions:15},null,[-1,-1])}get name(){return this.$$.ctx[13]}get isActive(){return this.$$.ctx[0]}set isActive(e){this.$$set({isActive:e}),ea()}get stores(){return this.$$.ctx[14]}set stores(e){this.$$set({stores:e}),ea()}get locale(){return this.$$.ctx[1]}set locale(e){this.$$set({locale:e}),ea()}get fillOptions(){return this.$$.ctx[15]}set fillOptions(e){this.$$set({fillOptions:e}),ea()}},({src:e,fillOptions:t})=>e&&!fh(e)&&t&&t.length]};const vb='<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>',wb='<path fill="none" d="M9 15 L12 9 L15 15 M10 13.5 h3" stroke="currentColor" stroke-width=".125em"/>';var Sb={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",labelColorPalette:"Color palette",labelSizeExtraSmall:"Extra small",labelSizeSmall:"Small",labelSizeMediumSmall:"Medium small",labelSizeMedium:"Medium",labelSizeMediumLarge:"Medium large",labelSizeLarge:"Large",labelSizeExtraLarge:"Extra large",labelButtonCancel:"Cancel",labelButtonUndo:"Undo",labelButtonRedo:"Redo",labelButtonRevert:"Revert",labelButtonExport:"Done",labelZoomIn:"Zoom in",labelZoomOut:"Zoom out",labelZoomFit:"Fit to view",labelZoomActual:"Actual size",iconZoomIn:'<path stroke="currentColor" stroke-width=".125em" d="M8 12 h8 M12 8 v8" />',iconZoomOut:'<path stroke="currentColor" stroke-width=".125em" d="M9 12 h6" />',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:vb,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:vb,statusLabelLoadImage:e=>e&&e.task?e.error?"IMAGE_TOO_SMALL"===e.error.code?"Minimum image size is {minWidth} &times; {minHeight}":"Error loading image":"blob-to-bitmap"===e.task?"Preparing image&hellip;":"Loading image&hellip;":"Waiting for image",statusLabelProcessImage:e=>{if(e&&e.task)return"store"===e.task?e.error?"Error uploading image":"Uploading image&hellip;":e.error?"Error processing image":"Processing image&hellip;"}};const kb={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:""+wb,shapeIconButtonTextLayoutAutoHeight:'<g fill="currentColor"><circle cx="4" cy="12" r="1.5"/><circle cx="20" cy="12" r="1.5"/></g>'+wb,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>'+wb,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",shapeTitleCornerRadius:"Corner radius",shapeTitleFontFamily:"Font",shapeTitleFontSize:"Font size",shapeTitleFontStyle:"Font style",shapeTitleLineHeight:"Line height",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>',shapeLabelToolMove:"Move",shapeLabelToolView:"View",shapeLabelToolSharpie:"Sharpie",shapeLabelToolEraser:"Eraser",shapeLabelToolPath:"Path",shapeLabelToolRectangle:"Rectangle",shapeLabelToolEllipse:"Ellipse",shapeLabelToolArrow:"Arrow",shapeLabelToolLine:"Line",shapeLabelToolText:"Text",shapeLabelToolPreset:"Stickers",shapeIconToolView:'<g stroke-width=".125em" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M10.98 9.703V2.567c0-1.19 1.19-1.785 1.784-1.785.595 0 1.784.595 1.784 1.785v3.568"/><path d="M14.548 9.703V4.35c0-1.19 1.19-1.784 1.784-1.784.595 0 1.784.594 1.784 1.784v2.973"/><path d="M18.116 10.244V7.271c0-1.19 1.19-1.784 1.784-1.784.595 0 1.785.595 1.785 1.784 0 1.19 0 8.92-1.19 12.488-1.19 3.569-10.704 4.758-13.678 0-2.973-4.757-2.973-4.757-4.163-6.541-1.189-1.784-1.153-2.974-.594-3.568.558-.595 1.784-1.19 2.973.594 1.277 1.916 2.07 2.907 2.379 2.974V5.487c0-1.19 1.19-1.784 1.784-1.784.595 0 1.784.595 1.784 1.784V8.46"/></g>',shapeIconToolMove:'<g stroke-width=".125em" stroke="currentColor" fill="none"><path d="M6 2 L6 19 L18 13 Z M13 18 L16 24" stroke="currentColor" stroke-width=".125em" fill="none" fill-rule="evenodd" stroke-linejoin="round"/></g>',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>',shapeIconToolPath:'<g stroke-width=".125em" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" fill="none"><circle cx="21" cy="3" r="2"/><circle cx="9" cy="9" r="2"/><circle cx="3" cy="21" r="2"/><path d="M19 4 11 8 M8 11 4 19"/></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 6 L21.5 1 L20 13.5" 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 Cb={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:"Scale"},Mb={fillLabel:"Fill",fillIcon:'\n    <g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em">\n        <g transform="rotate(60, 12, 12)">\n            <rect x="4" y="4" width="14" height="16" rx="3"/>\n        </g>\n        <path d="M21 13 L21 21"></path>\n        <path d="M4.5 12.5 L19 12.5"></path>\n    </g>\n    '},Tb={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"},Pb={redactLabel:"Redact",redactIcon:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor" stroke-width=".125em"><path d="M 4 5 l 1 -1"/><path d="M 4 10 l 6 -6"/><path d="M 4 15 l 11 -11"/><path d="M 4 20 l 16 -16"/><path d="M 9 20 l 11 -11"/><path d="M 14 20 l 6 -6"/><path d="M 19 20 l 1 -1"/></g>'},Rb=(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]}))},Ib=e=>{const t={},{sub:o,pub:i}=No();u()&&null!==document.doctype||console.warn("Browser is in quirks mode, add <!DOCTYPE html> to page to fix render issues");const n=cs();Rb(n,t);const r=((e,t)=>{const o={},i=new dp({target:e,props:{stores:t,pluginComponents:Array.from(fp)}});let n=!1;const r=()=>{n||(u()&&window.removeEventListener("pagehide",r),i&&(n=!0,i.$destroy()))};mp||(mp=new Set(Lc(dp).filter((e=>!hp.includes(e))))),mp.forEach((e=>{Object.defineProperty(o,e,{get:()=>i[e],set:pp.includes(e)?t=>{i[e]={...i[e],...t}}:t=>i[e]=t})})),Object.defineProperty(o,"previewImageData",{get:()=>i.imagePreviewCurrent}),gp.forEach((e=>{const t=$p[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 Oa(o,{on:(e,t)=>{if(n)return()=>{};if(/undo|redo|revert|writehistory/.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(),getCollapsed:()=>a.get().splice(0,a.index+1),set:e=>a.set(e),write:e=>a.write(e),get length(){return a.length()},get index(){return a.index},set index(e){a.index=e}})}),u()&&window.addEventListener("pagehide",r),o})(e,n.stores);Rb(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(a)})))),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=bp.map((e=>l(e,(o=>t.handleEvent(e,o)))));return Oa(t,{on:l,updateImage:e=>new Promise(((o,i)=>{const r=t.history.get(),a=t.history.index,s=t.imageState;n.loadImage(e).then((e=>{t.history.set(r),t.history.index=a,t.imageState=s,o(e)})).catch(i)})),close:()=>{i("close")},destroy:()=>{[...s,...c].forEach((e=>e())),r.destroy(),n.destroy(),i("destroy")}}),setTimeout((()=>i("init",t)),0),t};const Ab="pintura-editor";var Eb=()=>new Promise((e=>{if(!Lb)return e([]);var t;t=Ab,document.createElement(t).constructor===HTMLElement&&customElements.define(Ab,Lb),customElements.whenDefined(Ab).then((()=>e(document.querySelectorAll(Ab))))}));const Lb=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=Ib(this),Rb(this._editor,this),this._editor.src=this.getAttribute("src"),this._unsubs=xp(this._editor,this)}disconnectedCallback(){this._editor.destroy(),this._unsubs.forEach((e=>e()))}},Fb="pintura-editor";var zb=(e,t={})=>{const o=P(e)?document.querySelector(e):e;if(!Ft(o))return;t.class=t.class?"pintura-editor "+t.class:Fb;const i=Ib(o);return Object.assign(i,t)};const{document:Db,window:Ob}=ua;function Bb(e){let t,o,i,n;return Yr(e[27]),{c(){t=gr(),o=hr("div"),xr(o,"class",e[4]),xr(o,"style",e[5])},m(r,a){dr(r,t,a),dr(r,o,a),e[28](o),i||(n=[fr(Ob,"keydown",e[10]),fr(Ob,"orientationchange",e[11]),fr(Ob,"resize",e[27]),fr(Db.body,"focusin",(function(){Vn(!e[1]&&e[7])&&(!e[1]&&e[7]).apply(this,arguments)})),fr(Db.body,"focusout",(function(){Vn(e[2]&&e[8])&&(e[2]&&e[8]).apply(this,arguments)})),fr(o,"wheel",e[9],{passive:!1})],i=!0)},p(t,i){e=t,16&i[0]&&xr(o,"class",e[4]),32&i[0]&&xr(o,"style",e[5])},i:zn,o:zn,d(r){r&&ur(t),r&&ur(o),e[28](null),i=!1,Wn(n)}}}function _b(e,t,o){let i,n,r,a,s,l,c,d;const h=Or();let{root:p}=t,{preventZoomViewport:m=!0}=t,{preventScrollBodyIfNeeded:$=!0}=t,{preventFooterOverlapIfNeeded:f=!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=Wl(0,{precision:.001,damping:.5});Un(e,C,(e=>o(26,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"))}));let T=!1,P=void 0,R=void 0,I=void 0;const A=()=>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 z,D,O=0,B=void 0;const _=()=>{D||(D=g("div",{style:"position:fixed;height:100vh;top:0"}),S.append(D))};Fr((()=>{f&&uo()&&_()})),zr((()=>{D&&(o(21,B=D.offsetHeight),D.remove(),D=void 0)}));let W=void 0;const V=()=>w.style.setProperty("--pintura-document-height",window.innerHeight+"px");return Dr((()=>{w.classList.remove("PinturaModalBodyLock"),M()})),e.$$set=e=>{"root"in e&&o(0,p=e.root),"preventZoomViewport"in e&&o(12,m=e.preventZoomViewport),"preventScrollBodyIfNeeded"in e&&o(13,$=e.preventScrollBodyIfNeeded),"preventFooterOverlapIfNeeded"in e&&o(14,f=e.preventFooterOverlapIfNeeded),"class"in e&&o(15,y=e.class)},e.$$.update=()=>{67895298&e.$$.dirty[0]&&o(25,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(22,r=!v&&!b&&!x),12&e.$$.dirty[0]&&(T||o(20,z=O)),2097160&e.$$.dirty[0]&&o(24,a=Mo(B)?"--viewport-pad-footer:"+(B>O?0:1):""),51380224&e.$$.dirty[0]&&o(5,s=`opacity:${i};height:${z}px;--editor-modal:1;${a}`),32768&e.$$.dirty[0]&&o(4,l=hc(["pintura-editor","PinturaModal",y])),8192&e.$$.dirty[0]&&o(23,c=$&&uo()&&/15_/.test(navigator.userAgent)),12582912&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"),Mo(W)&&window.scrollTo(0,W),W=void 0)})(r)},[p,b,T,O,l,s,C,e=>{mh(e.target)&&(o(2,T=!0),L=O)},e=>{if(mh(e.target))if(clearTimeout(undefined),L===O)o(2,T=!1);else{const e=O;F((()=>O!==e),(()=>o(2,T=!1)))}},e=>{e.target&&/PinturaStage/.test(e.target.className)&&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=A()||g("meta",{name:"viewport"});P=!P&&e.getAttribute("content"),e.setAttribute("content",n+(/cover/.test(P)?",viewport-fit=cover":"")),e.parentNode||k.append(e);const t=getComputedStyle(p).getPropertyValue("--color-background"),i=E();if(i.length)R=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(I),I=setTimeout((()=>C.set(1)),250)},()=>{if(x||b)return;clearTimeout(I),o(18,x=!0);const e=A();P?e.setAttribute("content",P):e.remove();const t=E();R?t.forEach(((e,t)=>{e.setAttribute("content",R[t])})):t.forEach((e=>e.remove())),C.set(0)},x,v,z,B,r,c,a,i,d,function(){o(3,O=Ob.innerHeight)},function(e){Nr[e?"unshift":"push"]((()=>{p=e,o(0,p)}))}]}class Wb extends wa{constructor(e){super(),va(this,e,_b,Bb,Nn,{root:0,preventZoomViewport:12,preventScrollBodyIfNeeded:13,preventFooterOverlapIfNeeded:14,class:15,show:16,hide:17},null,[-1,-1])}get root(){return this.$$.ctx[0]}set root(e){this.$$set({root:e}),ea()}get preventZoomViewport(){return this.$$.ctx[12]}set preventZoomViewport(e){this.$$set({preventZoomViewport:e}),ea()}get preventScrollBodyIfNeeded(){return this.$$.ctx[13]}set preventScrollBodyIfNeeded(e){this.$$set({preventScrollBodyIfNeeded:e}),ea()}get preventFooterOverlapIfNeeded(){return this.$$.ctx[14]}set preventFooterOverlapIfNeeded(e){this.$$set({preventFooterOverlapIfNeeded:e}),ea()}get class(){return this.$$.ctx[15]}set class(e){this.$$set({class:e}),ea()}get show(){return this.$$.ctx[16]}get hide(){return this.$$.ctx[17]}}const Vb=(e,t,o,i)=>{const n=ue(t.x-e.x,t.y-e.y),r=fe(n),a=5*o;let s;s=i?.5*a:Math.ceil(.5*(a-1));const l=ke(pe(r),s);return{anchor:pe(e),offset:l,normal:r,solid:i,size:a,sizeHalf:s}},Nb=({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=ke(pe(o),n),h=ue(c+u.x,d+u.y);if(ke(u,.55),t){ve(l,i);const e=ke(pe(o),.5*r);return[{points:[ue(c-e.x,d-e.y),ue(h.x-u.y,h.y+u.x),ue(h.x+u.y,h.y-u.x)],pathClose:!0,backgroundColor:s}]}{const e=ke((e=>{const t=e.x;return e.x=-e.y,e.y=t,e})(pe(o)),.5),t=ue(c-e.x,d-e.y),i=ue(c+e.x,d+e.y);return[{points:[ue(h.x+u.y,h.y-u.x),t,ue(c,d),i,ue(h.x-u.y,h.y+u.x)],pathClose:!1,strokeWidth:a,strokeColor:s}]}},Hb=({anchor:e,solid:t,offset:o,normal:i,sizeHalf:n,strokeWidth:r,strokeColor:a},s)=>(ve(s,o),t&&ve(s,me(pe(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}]),jb=({anchor:e,offset:t,strokeWidth:o,strokeColor:i})=>[{points:[ue(e.x-t.y,e.y+t.x),ue(e.x+t.y,e.y-t.x)],strokeWidth:o,strokeColor:i}],Ub=({anchor:e,solid:t,offset:o,normal:i,sizeHalf:n,strokeWidth:r,strokeColor:a},s)=>{return ve(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},Zb=(e={})=>t=>{if(!Po(t,"lineStart")&&!Po(t,"lineEnd"))return;const o=[],{lineStart:i,lineEnd:n,strokeWidth:r,strokeColor:a}=t,s=ue(t.x1,t.y1),l=ue(t.x2,t.y2),c=[s,l];if(i){const[t,n]=i.split("-"),c=e[t];if(c){const e=Vb(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=Vb(l,s,r,!!i);o.push(...c({...e,strokeColor:a,strokeWidth:r},l))}}return[{points:c,strokeWidth:r,strokeColor:a},...o]},Xb=()=>({arrow:Nb,circle:Hb,square:Ub,bar:jb}),Gb=(e,t)=>{const o=parseFloat(e)*t;return P(e)?o+"%":o},Yb=(e,t)=>P(e)?Qi(e,t):e,qb=e=>[{...e,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:e.frameSize?Gb(e.frameSize,2):"2.5%",frameRadius:e.frameRound?Gb(e.frameSize,2):0}],Kb=({width:e,height:t,frameImage:o,frameSize:i="15%",frameOutset:n=0,frameSlices:r={x1:.15,y1:.15,x2:.85,y2:.85}},{isPreview:a})=>{if(!o)return[];const s=Math.sqrt(e*t),l=Yb(i,s),c=a?l:Math.round(l),d=c,u=Yb(n,s),h=2*u,{x1:p,x2:m,y1:g,y2:$}=r,f={x0:0,y0:0,x1:c,y1:d,x2:e-c,y2:t-d,x3:e,y3:t,cw:c,ch:d,ew:e-c-c,eh:t-d-d},y=a?1:0,b=2*y,x=u>0,v={expandsCanvas:x,width:f.cw,height:f.ch,backgroundImage:o};return[{expandsCanvas:x,x:f.x1-y-u,y:f.y0-u,width:f.ew+b+h,height:f.ch,backgroundCorners:[{x:p,y:0},{x:m,y:0},{x:m,y:g},{x:p,y:g}],backgroundImage:o},{expandsCanvas:x,x:f.x1-y-u,y:f.y2+u,width:f.ew+b+h,height:f.ch,backgroundCorners:[{x:p,y:$},{x:m,y:$},{x:m,y:1},{x:p,y:1}],backgroundImage:o},{expandsCanvas:x,x:f.x0-u,y:f.y1-y-u,width:f.cw,height:f.eh+b+h,backgroundCorners:[{x:0,y:g},{x:p,y:g},{x:p,y:$},{x:0,y:$}],backgroundImage:o},{expandsCanvas:x,x:f.x2+u,y:f.y1-y-u,width:f.cw,height:f.eh+b+h,backgroundCorners:[{x:m,y:g},{x:1,y:g},{x:1,y:$},{x:m,y:$}],backgroundImage:o},{...v,x:f.x0-u,y:f.y0-u,backgroundCorners:[{x:0,y:0},{x:p,y:0},{x:p,y:g},{x:0,y:g}]},{...v,x:f.x2+u,y:f.y0-u,backgroundCorners:[{x:m,y:0},{x:1,y:0},{x:1,y:g},{x:m,y:g}]},{...v,x:f.x2+u,y:f.y2+u,backgroundCorners:[{x:m,y:$},{x:1,y:$},{x:1,y:1},{x:m,y:1}]},{...v,x:f.x0-u,y:f.y2+u,backgroundCorners:[{x:0,y:$},{x:p,y:$},{x:p,y:1},{x:0,y:1}]}]},Jb=({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=Yb(r,h);const m=Yb(n,h),g=Yb(s,h);let $=0;u||(p=Math.max(1,Math.round(p)),$=p%2==0?0:.5);const f=Yb(Gb(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+$,y:c+$,width:h-l,height:y-c,cornerRadius:f>0?f-s:0,strokeWidth:p,strokeColor:a,expandsCanvas:d}}))},Qb=({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=Yb(n,c),u=Yb(a,c),h=Yb(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,$=t+u+p,f=e+o-u-p,y=t+i-u-p;return[{points:[ue(g+m,$),ue(f-m,$)]},{points:[ue(f,$+m),ue(f,y-m)]},{points:[ue(f-m,y),ue(g+m,y)]},{points:[ue(g,y-m),ue(g,$+m)]}].map((e=>(e.strokeWidth=d,e.strokeColor=s,e)))},ex=({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=Yb(n,c),u=Yb(r,c),h=Yb(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,$=e+o-u-p,f=t+i-u-p;return[{points:[ue(m,g+h),ue(m,g),ue(m+h,g)]},{points:[ue($-h,g),ue($,g),ue($,g+h)]},{points:[ue($,f-h),ue($,f),ue($-h,f)]},{points:[ue(m+h,f),ue(m,f),ue(m,f-h)]}].map((e=>(e.strokeWidth=d,e.strokeColor=s,e)))},tx=({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,c=0;const d=.5*s;return r?c=1:l=Math.ceil(l),n.length=3,[{id:"border",x:e-d+c,y:t-d+c,width:o+s-2*c,height:i+l-2*c,frameStyle:"line",frameInset:0,frameOffset:0,frameSize:s,frameColor:n,expandsCanvas:!0},{id:"chin",x:e-d,y:i-c,width:o+s,height:l,backgroundColor:n,expandsCanvas:!0}].filter(Boolean)},ox=(e={})=>(t,o)=>{if(!Po(t,"frameStyle"))return;const i=t.frameStyle,n=e[i];if(!n)return;const{frameStyle:r,...a}=t;return n(a,o)},ix=()=>({solid:qb,hook:ex,line:Jb,edge:Qb,polaroid:tx,nine:Kb}),nx=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};"undefined"!=typeof window&&(e=>{if(!e)return;const[t,o,i,n]=[[108,111,99,97,116,105,111,110],[82,101,103,69,120,112],[116,101,115,116],[112,113,105,110,97,92,46,110,108]].map((e=>e.map((e=>String.fromCharCode(e))).join("")));e._uahonds=new e[o](n)[i](e[t])})(window);const rx=Hs,ax=Us,sx=(e,...t)=>(o,i)=>{var n;n=e,(Array.isArray(n)||R(n))&&(t=[e,...t]);const r=C(e)?e:{};t=Array.isArray(t)?t.reduce(((e,t)=>[...e,...Array.isArray(t)?[...t]:[t]]),[]):t;for(let e=0;e<t.length;e++){const n=t[e](o,i,r);if(Array.isArray(n))return n}},lx=()=>({read:c,apply:k}),cx=(e={})=>{const{blurAmount:t,dataSizeScalar:o,scrambleAmount: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}),$=m.getContext("2d",{willReadFrequently:!0});if(c.length=3,$.fillStyle=Oo(c),$.fillRect(0,0,h,p),y(e)){const t=g("canvas",{width:o,height:i});t.getContext("2d",{willReadFrequently:!0}).putImageData(e,0,0),$.drawImage(t,0,0,h,p),f(t)}else $.drawImage(e,0,0,h,p);const b=$.getImageData(0,0,h,p),x=[];if(a>0&&x.push([Ll,{amount:a}]),s>0)for(let e=0;e<s;e++)x.push([vo,{matrix:Fl}]);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) {\nconst filterInstructions = options.filterInstructions;\nconst imageData = options.imageData;\n(${e(x,0)})(null, imageData)\n}`,o=await z(t,[{imageData:b,filterInstructions:x.map((e=>e[1]))}],[b.data.buffer]);v=yo(o)}else v=b;return"canvas"===l?($.putImageData(v,0,0),m):v})(e,{blurAmount:t,scrambleAmount:i,backgroundColor:n,...r,dataSizeScalar:o||r.dataSizeScalar})},dx=cs,ux=jm,hx=Nm,px=Mg,mx={markupEditorToolbar:jm(),markupEditorToolStyles:Nm(),markupEditorShapeStyleControls:Mg()},gx=yp,$x=B$,fx=U$,yx=J$,bx=Wy,xx=Hy,vx=Zy,wx=Jy,Sx=pb,kx=db,Cx=xb,Mx=nm,Tx=Hp,Px=mm,Rx=Sb,Ix=kb,Ax=Cb,Ex=Mb,Lx={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"},Fx={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"},zx={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)=>`<defs><mask id="mask1" x="0" y="0" width="24" height="24" ><rect x="0" y="0" width="24" height="10" fill="#fff" stroke="none"/></mask></defs><g fill="none" fill-rule="evenodd"><g  mask="url(#mask1)"><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"/></g><rect fill="currentColor" x="7" y="10" width="10" height="7" rx="1.5"/></g>`},Dx={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>'},Ox={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>'},Bx={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>'},_x=Tb,Wx=Pb,Vx=(e,t,o={})=>(P(t)?Array.from(document.querySelectorAll(t)):t).filter(Boolean).map((t=>e(t,T(o)))),Nx=zb,Hx=(e={},t)=>{const{sub:o,pub:i}=No(),n={},r=((e={},t)=>new Wb({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=Ib(r.root);Rb(c,n),n.handleEvent=a,c.handleEvent=(e,t)=>{if("init"===e)return n.handleEvent(e,n);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 Oa(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},jx=(e,t)=>zb(e,{...t,layout:"overlay"}),Ux=nx,Zx=(e=[])=>nx([ox(ix()),Zb(Xb()),...e]),Xx=(e={})=>{let t,o=void 0;Array.isArray(e.imageReader)||(o=e.imageReader,delete e.imageReader),Array.isArray(e.imageWriter)?t=ax():(t=R(e.imageWriter)?e.imageWriter:ax(e.imageWriter),delete e.imageWriter);let i=void 0;return R(e.imageScrambler)||(i=e.imageScrambler,delete e.imageScrambler),{imageReader:rx(o),imageWriter:t,imageOrienter:lx(),imageScrambler:cx(i)}},Gx=(e={})=>{yp($x,fx,yx,bx,xx,vx,wx,Sx,kx,Cx);const t=Xx(e),o={...Rx,...Ix,...Ax,...Ex,...Lx,...Fx,..._x,...Wx,...zx,...Dx,...Ox,...Bx,...e.locale};delete e.locale;const i="function"==typeof e.shapePreprocessor?e.shapePreprocessor:Zx(e.shapePreprocessor);return delete e.shapePreprocessor,Ta([{...t,shapePreprocessor:i,utils:["trim","crop","filter","finetune","annotate","decorate","sticker","fill","frame","redact","resize"],...Mx,...Tx,...Px,...mx,stickerStickToImage:!0,locale:o},e])},Yx=async(e={})=>{const t=await Eb();return t.forEach((t=>Object.assign(t,T(e)))),t},qx=(e,t)=>Nx(e,Gx(t));e.appendDefaultEditor=qx,e.appendDefaultEditors=(e,t)=>Vx(qx,e,t),e.appendEditor=Nx,e.appendEditors=(e,t)=>Vx(Nx,e,t),e.appendNode=(e,t)=>{if(wp(t))return t.push(e);t[3]=[...kp(t),e]},e.blobToFile=j,e.colorStringToColorArray=xh,e.createDefaultColorOptions=Um,e.createDefaultFontFamilyOptions=Jm,e.createDefaultFontScaleOptions=Gm,e.createDefaultFontSizeOptions=Zm,e.createDefaultFontStyleOptions=eg,e.createDefaultFrameStyles=ix,e.createDefaultImageOrienter=lx,e.createDefaultImageReader=rx,e.createDefaultImageScrambler=cx,e.createDefaultImageWriter=ax,e.createDefaultLineEndStyleOptions=Km,e.createDefaultLineEndStyles=Xb,e.createDefaultLineHeightOptions=Xm,e.createDefaultLineHeightScaleOptions=Ym,e.createDefaultMediaWriter=sx,e.createDefaultShapePreprocessor=Zx,e.createDefaultStrokeScaleOptions=qm,e.createDefaultStrokeWidthOptions=()=>[1,2,3,4,6,8,12,16,20,24,32,48,64],e.createDefaultTextAlignOptions=Qm,e.createEditor=dx,e.createFrameStyleProcessor=ox,e.createLineEndProcessor=Zb,e.createMarkupEditorBackgroundColorControl=gg,e.createMarkupEditorColorControl=ug,e.createMarkupEditorColorOptions=tg,e.createMarkupEditorFontColorControl=vg,e.createMarkupEditorFontFamilyControl=mg,e.createMarkupEditorFontFamilyOptions=rg,e.createMarkupEditorFontScaleOptions=og,e.createMarkupEditorFontSizeControl=Sg,e.createMarkupEditorFontSizeOptions=e=>e.map(zm),e.createMarkupEditorFontStyleControl=wg,e.createMarkupEditorFontStyleOptions=ag,e.createMarkupEditorLineEndStyleControl=xg,e.createMarkupEditorLineEndStyleOptions=sg,e.createMarkupEditorLineHeightControl=Cg,e.createMarkupEditorLineHeightOptions=e=>e.map(zm),e.createMarkupEditorLineHeightScaleOptions=ig,e.createMarkupEditorLineStartStyleControl=bg,e.createMarkupEditorOptionsControl=(e,t={})=>[Lu,{...t,options:e}],e.createMarkupEditorShapeStyleControls=px,e.createMarkupEditorStrokeColorControl=$g,e.createMarkupEditorStrokeScaleOptions=ng,e.createMarkupEditorStrokeWidthControl=fg,e.createMarkupEditorStrokeWidthOptions=e=>e.map(zm),e.createMarkupEditorTextAlignControl=kg,e.createMarkupEditorToolStyle=Vm,e.createMarkupEditorToolStyles=hx,e.createMarkupEditorToolbar=ux,e.createNode=function(e,t,o,i){return Array.isArray(o)&&(i=o,o={}),[e,t,o||{},i||[]]},e.createShapePreprocessor=Ux,e.defineCustomElements=Yx,e.defineDefaultCustomElements=e=>Yx(Gx(e)),e.degToRad=ul,e.dispatchEditorEvents=xp,e.effectBrightness=qp,e.effectClarity=om,e.effectContrast=Kp,e.effectExposure=Qp,e.effectGamma=em,e.effectSaturation=Jp,e.effectTemperature=im,e.effectVignette=tm,e.filterChrome=Ip,e.filterCold=Lp,e.filterFade=Ap,e.filterInvert=()=>[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e.filterMonoDefault=Fp,e.filterMonoNoir=zp,e.filterMonoStark=Op,e.filterMonoWash=Dp,e.filterPastel=Rp,e.filterSepiaBlues=_p,e.filterSepiaColor=Vp,e.filterSepiaDefault=Bp,e.filterSepiaRust=Wp,e.filterWarm=Ep,e.findNode=Tp,e.frameEdgeCross=dm,e.frameEdgeOverlap=um,e.frameEdgeSeparate=cm,e.frameHook=hm,e.frameLineMultiple=lm,e.frameLineSingle=sm,e.framePolaroid=pm,e.frameSolidRound=am,e.frameSolidSharp=rm,e.getEditorDefaults=Gx,e.getEditorProps=()=>(()=>{const e=as.map(ss),t=za.map((([e])=>e)).filter((e=>!rs.includes(e)));return e.concat(t)})().concat((mp=new Set(Lc(dp).filter((e=>!hp.includes(e)))),[...mp,...gp])),e.imageStateToCanvas=(e,t,o)=>{const{targetCanvas:i,targetSize:n,disableDraw:r=!1,shapePreprocessor:a}=o||{},s=i||document.createElement("canvas"),{crop:l,colorMatrix:c,convolutionMatrix:d}=t,u=Gt(e),h={width:u?e.videoWidth:e.width,height:u?e.videoHeight:e.height},{upscale:p=!1,fit:m="contain",width:$,height:f}=n||{};let y=1;"contain"===m?y=Math.min(($||Number.MAX_SAFE_INTEGER)/l.width,(f||Number.MAX_SAFE_INTEGER)/l.height):"cover"===m&&(y=Math.max(($||l.width)/l.width,(f||l.height)/l.height)),p||(y=Math.min(y,1));const b=Math.floor(l.width*y),x=Math.floor(l.height*y),v=u?El(b):b,w=u?El(x):x,S=Al(s,{alpha:!0});S.resize(v,w,1);const k=S.textureCreate();let C;S.setCanvasColor([0,0,0,0]),S.drawToCanvas(),S.disableMask(),S.disablePreviewStencil();{const e=Object.values(c||{}).filter(Boolean);e.length&&(C=Ln(e))}const M={x:0,y:0,width:v,height:w},{origin:T,translation:P,rotation:R,scale:I}=Zs(M,M,h,l,{x:0,y:0,width:v,height:w},y,{x:0,y:0},1,t.rotation,t.flipX,t.flipY),A=[h,T.x,T.y,P.x,P.y,R.x,R.y,R.z,I,C,1,d&&d.clarity,Mo(t.gamma)?t.gamma:1,t.vignette||0,[1,0,1,0,1,w,1,v],void 0,void 0,void 0,void 0,!1];let E=!1;const L=t.decoration.length||t.annotation.length,F=L&&S.textureCreate(),z=()=>{S.textureUpdate(k,e,{filterParam:S.textureFilterLinear,wrapParam:S.textureClamp})},D=()=>{z(),S.drawImage(k,...A),L&&E&&S.drawRect(M,0,!1,!1,[0,0,0,0],void 0,F)};return z(),!r&&D(),{canvas:s,prepare:async()=>{if(!L)return;const{dest:e}=await ds(g("canvas",h),{shapePreprocessor:a,imageReader:[[async(e,t,o)=>{const{src:i}=e,n=parseInt(i.width,10),r=parseInt(i.height,10),a=await O(i);return{...e,dest:a,size:{width:n,height:r}}},"read-canvas"]],imageWriter:Us({format:"canvas"}),imageState:{...t,redaction:[],frame:void 0,gamma:void 0,convolutionMatrix:void 0,colorMatrix:void 0,backgroundColor:[0,0,0,0],backgroundImage:void 0,trim:void 0,vignette:void 0,volume:void 0}});S.textureUpdate(F,e,{filterParam:S.textureFilterLinear,wrapParam:S.textureClamp}),E=!0,!r&&D()},redraw:D,destroy:()=>{S.release()}}},e.insertNodeAfter=(e,t,o)=>Cp(e,t,o,(e=>e+1)),e.insertNodeBefore=(e,t,o)=>Cp(e,t,o),e.isSupported=()=>(null===Yp&&(Yp=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),Yp),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,Gp(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(((t,i)=>{let n=o[i];return i=jp[i]||i,/px$/.test(n)?n=Up(n):/^(?:x|y|left|right|top|bottom|width|height|fontSize|borderWidth|strokeWidth)$/.test(i)&&"number"==typeof n&&("strokeWidth"!==i&&"borderWidth"!==i&&"fontSize"!==i||(n=Math.min(e.width,e.height)*n+"px"),n=Up(n)),/color/i.test(i)&&n&&(n=xh(n)),null===n&&(n=void 0),t[i]=n,t}),{});if("line"===t&&(i.lineDecoration.length>=1&&(i.lineEnd="arrow"),2===i.lineDecoration.length&&(i.lineStart="arrow"),i.x1=i.x,i.y1=i.y,i.x2=Zp(i.x,i.width),i.y2=Zp(i.y,i.height),delete i.x,delete i.y,delete i.width,delete i.height,delete i.lineDecoration,delete i.lineStyle),"text"===t){if(!Mo(i.y)){const t=Math.min(e.width,e.height);i.y=t*(parseFloat(i.y)/100)}i.y=i.y-i.fontSize,delete i.width,delete i.height,delete i.borderStyle,i.lineHeight=i.lineHeight||"120%"}if("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=Zp(i.x,i.rx),i.y=Zp(i.y,i.ry),delete i.width,delete i.height,delete i.borderStyle}if("rect"===t&&delete i.borderStyle,"path"===t){let e,t=[];for(const o of i.points)e?Te(e,o)<1e-9||(t.push(o),e=o,e=o):(t.push(o),e=o);i.points=t.map((e=>({x:Up(e.x),y:Up(e.y)})))}return i})(i.crop||t,e[0],e[1])))}if(o.color||o.colors){const e=o.color||o.colors;Object.keys(e).filter((t=>e[t])).map((t=>[t,Array.isArray(e[t].matrix)?e[t].matrix:Object.values(e[t].matrix)])).forEach((([e,t])=>{i.colorMatrix||(i.colorMatrix={}),i.colorMatrix[e]=t}))}if(o.filter||o.filters){const t=o.filters||o.filter;i.colorMatrix||(i.colorMatrix={});const n=e?e.filterFunctions:Np;i.colorMatrix.filter="string"==typeof t&&n[t]?n[t]():t.matrix}const n=o.size?o.size:!!o.resize&&o.resize.size;return n&&n.width&&n.height&&(i.targetSize={width:n.width,height:n.height}),i},e.locale_en_gb=Rx,e.markup_editor_defaults=mx,e.markup_editor_locale_en_gb=Ix,e.naturalAspectRatioToNumber=e=>{if(void 0===e||Mo(e))return e;if(!P(e))return!1;const t=e;if(!t.length)return;const[o,i]=t.split(/\/|:/g).map((e=>parseFloat(e.replace(/,/,".")))).filter(Boolean);return!!o&&(i?Math.abs(o/i):o)},e.openDefaultEditor=(e,t)=>Hx(Gx(e),t),e.openEditor=Hx,e.overlayDefaultEditor=(e,t)=>jx(e,Gx(t)),e.overlayEditor=jx,e.plugin_annotate=bx,e.plugin_annotate_locale_en_gb=Ox,e.plugin_crop=$x,e.plugin_crop_locale_en_gb=Ax,e.plugin_decorate=xx,e.plugin_decorate_locale_en_gb=Dx,e.plugin_fill=Cx,e.plugin_fill_locale_en_gb=Ex,e.plugin_filter=fx,e.plugin_filter_defaults=Tx,e.plugin_filter_locale_en_gb=Lx,e.plugin_finetune=yx,e.plugin_finetune_defaults=Mx,e.plugin_finetune_locale_en_gb=Fx,e.plugin_frame=wx,e.plugin_frame_defaults=Px,e.plugin_frame_locale_en_gb=_x,e.plugin_redact=Sx,e.plugin_redact_locale_en_gb=Wx,e.plugin_resize=kx,e.plugin_resize_locale_en_gb=zx,e.plugin_sticker=vx,e.plugin_sticker_locale_en_gb=Bx,e.processDefaultImage=(e,t={})=>{const o=Xx(t),i="function"==typeof t.shapePreprocessor?t.shapePreprocessor:Zx(t.shapePreprocessor);return delete t.shapePreprocessor,t=Ta([{...o,shapePreprocessor:i,stickerStickToImage:!0},t]),ds(e,t)},e.processImage=ds,e.removeNode=Mp,e.setPlugins=gx,e.shapeGetCenter=pn,e.shapeGetLength=e=>{if(e.x1)return Pe(ue(e.x1,e.y1),ue(e.x2,e.y2))},e.shapeGetLevel=(e,t)=>{let o=!1;t.flipX&&e.flipX?o=!0:!t.flipX&&e.flipX?o=!1:t.flipX&&!e.flipX&&(o=!0);let i=!1;t.flipY&&e.flipY?i=!0:!t.flipY&&e.flipY?i=!1:t.flipY&&!e.flipY&&(i=!0);let n=-t.rotation;return!o&&!i||o&&i||(n=-n),{flipX:o,flipY:i,rotation:n}},e.supportsWebGL=wh,e.updateNode=(e,t)=>{const[,,o]=e;Object.assign(o,t)},Object.defineProperty(e,"__esModule",{value:!0})}));
