diff --git a/CHANGELOG.md b/CHANGELOG.md index 85a2e85..1852c0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ ### Fixed +## 5.19.3 + +### Changed + +### Added + +### Fixed + ## 5.19.2 ### Changed diff --git a/cjs/index.js b/cjs/index.js index 2b69995..1f7f4d7 100644 --- a/cjs/index.js +++ b/cjs/index.js @@ -1551,7 +1551,7 @@ ${e}`}_compile(){const e=this._renderer.getContext();const t=this._compileShader 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.20)`,inactiveOpacity:f},textInput:{foreground:i,hoverBorderColor:i,background:"transparent",borderColor:a,inactiveOpacity:f},slider:{trackColor:s,activeTrackColor:r,thumbBackground:u,thumbBorderColor:r,inactiveOpacity:f,hoverOpacity:"0.7"},selectColor:{activeBorderColor:r,inactiveOpacity:f},toolbar:{foreground:i,background:a,activeBackground:"transparent",activeForeground:r,borderColor:"transparent"},tooltip:{background:s,foreground:i},toolControlBar:{background:"rgba(238, 238, 238, 0.9)",borderColor:u,shadow:"none",separatorColor:a,titleForeground:o,inputLabelForeground:o,inputLabelInactiveOpacity:f},mainCanvasActionBar:{background:"transparent",foreground:i,borderColor:"none"},canvasActionBar:{background:s,foreground:i,separatorColor:n},canvas:{background:c,controlsOutline:"rgba(255, 255, 255, 0.6)",controlsColor:"#ffffff",cropBackdrop:"rgba(255, 255, 255, 0.3)"},colorPicker:{listBackground:a,listShadow:`0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), - 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:t,background:c},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};LM=mKe});var Lb,Bw,ko;var zb=p(()=>{Mb();ype();bpe();Lb=Pw();Bw=Fw();ko={...Lb,measurements:Bw}});var fKe,_pe;var vpe=p(()=>{tc();zb();fKe=r=>{if(r==="light"){return LM}return Pw};_pe=(r,e)=>{const t=fKe(r);if(e&&e[r]){const{primary:i,background:o,foreground:n}=e[r];const s={primary:i,background:o,foreground:n};const a=Object.keys(s).reduce((l,u)=>{if(s[u]){return{...l,[u]:s[u]}}return l},{});return ti([t(a),e[r]])}return t()||Lb}});var gKe,xpe;var Cpe=p(()=>{tc();Mb();gKe=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];xpe=r=>{const e=Fw();if(r){const t={};Object.keys(r).forEach(i=>{if(gKe.indexOf(i)!==-1){t[i]=r[i]}});return ti([e,t])}return e}});var Spe=p(()=>{gpe();vpe();Cpe()});var yKe,Ii;var Mw=p(()=>{Le();P();$s();H();tc();FM();dpe();sM();Bb();Spe();zb();yKe={config:Qu,locale:ap,theme:Lb,measurements:Bw,initialMeasurements:Bw};Ii=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(e,t)=>{return t.indexOf(e)!==-1};this.state=se(yKe);this.events=new AM;this.licenseChecker=null}saveConfig(e){if(e.mainCanvasActions&&e.mainCanvasActions.length!==4){e.mainCanvasActions.length=4}const t=e.layout&&e.layout==="basic"?PM:Qu;const i=ti([t,e],{clone:true});this.licenseChecker=new Sw(i.license);if(!this.licenseChecker.areCustomAssetsAllowed()){i.sticker.enableCustomUpload=false}const o=fpe(i.language,i.custom.languages);const n=_pe(i.theme,i.custom.themes);const s=xpe(i.custom.measurements);const{provider:a}=i.library;const l=[];i.adjustment.categories=i.adjustment.categories.reduce((d,m)=>{d.push({...m,items:m.items.filter(h=>{if(!vO[h.identifier]){l.push(h.identifier);return false}return true})});return d},[]);if(l.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${l.join(", ")}`)}delete i.language;delete i.custom.languages;delete i.custom.themes;delete i.library.provider;let u=i.tools.reduce((d,m)=>{if(typeof m==="object"){return[...d,...m]}return[...d,m]},[]);if(!u.length){console.error(`Empty list input for tools`);u=ww.reduce((d,m)=>{if(typeof m==="object"){return[...d,...m]}return[...d,m]},[])}u=u.filter(d=>this.licenseChecker.isToolAllowed(d));if(i.defaultTool){const d=this.checkDefaultToolAvailability(i.defaultTool,u);if(!d){[i.defaultTool]=u}}i.tools=u;this.state.config=i;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;const c=this.buildCustomAssetsConfig();this.assetProvider=new oy(c,this.licenseChecker.areCustomAssetsAllowed(),i.assetResolver);this.loadThemeFont();return a}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((e,t)=>{if(typeof t==="string"){return[...e,t]}return[...e,"",...t]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:e}=this.theme;if(!e.skipLoading){this.assetProvider.getFontManager().injectFonts([e])}}buildCustomAssetsConfig(){const e=this.tools;const t=_e(this.state.config);const i=this.state.config.assetBaseUrl;const{theme:o}=this.state;const n=e.indexOf("filter")!==-1?t["filter"]:void 0;const s=e.indexOf("focus")!==-1?t["focus"]:void 0;const a=e.indexOf("adjustment")!==-1?t["adjustment"]:void 0;const l=e.indexOf("sticker")!==-1?t["sticker"]:void 0;const u=e.indexOf("frame")!==-1?t["frame"]:void 0;const c=e.indexOf("overlay")!==-1?t["overlay"]:void 0;const d=e.indexOf("transform")!==-1?t["transform"]:void 0;const m=e.indexOf("text")!==-1?t["text"]:void 0;const h=e.indexOf("textdesign")!==-1?t["textdesign"]:void 0;return{basePath:i,theme:o,filter:n,focus:s,sticker:l,frame:u,overlay:c,transform:d,text:m,adjustment:a,textdesign:h}}};g([C],Ii.prototype,"saveConfig",1);g([C],Ii.prototype,"dispose",2);g([S],Ii.prototype,"config",1);g([S],Ii.prototype,"locale",1);g([S],Ii.prototype,"theme",1);g([S],Ii.prototype,"measurements",1);g([S],Ii.prototype,"initialMeasurements",1);g([S],Ii.prototype,"tools",1);g([S],Ii.prototype,"defaultTool",1);g([S],Ii.prototype,"isOrderDefault",1);g([S],Ii.prototype,"isLayoutAdvanced",1);g([S],Ii.prototype,"displayCloseButton",1)});var zM;var UM=p(()=>{P();bO();zM=class{constructor(e){this.editor=e}setBackgroundImage(e){if(!this.container){this.container=this.engine.addImage({image:e,originalImage:e,blendMode:"normal",opacity:1})}else{this.container.setData({image:e,originalImage:e})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((e,t)=>{const{image:i}=this.editor.activeStore;if(IK(i)){this.setBackgroundImage(i);e()}else{const o=this.editor.libraryStore.getRawUrl(i);this.getImageElement(o).then(n=>{this.setBackgroundImage(n);e()}).catch(n=>{t({identifier:"imageLoading",message:n.message})})}})}getImageElement(e){return new Promise((t,i)=>{const o=new Image;o.addEventListener("load",()=>{t(o)});o.addEventListener("error",n=>{i(n)});o.crossOrigin=this.editor.configStore.config.engine.crossOrigin;o.src=e})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}}});var NM;var qM=p(()=>{H();NM=class{constructor(e){this.applyNewImageTransform=()=>{const{size:e,width:t,height:i}=this.editor.engineMediator.image.container.getBounds();const o=this.container;o.setTransform(yt.IDENTITY);o.setResolution(e);o.setPivot(.5,.5);o.setPosition({x:t/2,y:i/2})};this.editor=e}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}}});function Ub(r,e){const t=r.width/r.height;const i=e.width/e.height;if(t>i){return r.height/e.height}return r.width/e.width}var wpe=p(()=>{});var bKe,Cl;var HM=p(()=>{Le();H();wpe();bKe={transform:yt.IDENTITY};Cl=class{constructor(e){this.initialTransform=yt.IDENTITY;this.editor=e;this.state=se(bKe)}createPreview(e){this.container=this.editor.engine.createPreview(e)}updateTransform(e=0,t=true){const i=this.calculateTransform(e);if(i.scale.x){if(t){this.saveInitialTransform(i)}else{this.savePreviewTransform(i)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(e){this.initialTransform=e;this.savePreviewTransform(e)}savePreviewTransform(e){ar(()=>{this.state.transform.position=e.position;this.state.transform.scale=e.scale;this.state.transform.rotation=e.rotation;const t=En();const i=new A(e.scale).divide(t);this.previewTransformWithoutDpr={position:new A(e.position).divide(t),scale:i,rotation:e.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(e=0){const t=En();const{scaleImageToFit:i}=this.editor.configStore.config;const{width:o,height:n}=this.editor.canvasStore.canvasSize;const s=this.editor.engine.getOutputDimensions();const a=Ub({width:o,height:n},s);let l=i?a:Math.min(1,a);const u=n-s.height*l;const c=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(un*d){l=Ub({width:o,height:n*d},s)}if(s.width*l>o*d){l=Ub({width:o*d,height:n},s)}l*=t;const m={x:o*t/2,y:n*t/2};const h={x:l,y:l};return new yt(m,h,e)}};g([C],Cl.prototype,"updateTransform",1);g([C],Cl.prototype,"savePreviewTransform",1);g([S],Cl.prototype,"transform",1);g([S],Cl.prototype,"position",1);g([S],Cl.prototype,"scale",1);g([S],Cl.prototype,"rotation",1)});var rc,Lw;var WM=p(()=>{P();rc=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(e){if(["sticker","text","textdesign","brush"].indexOf(e)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(e,t){const i=t.findIndex(o=>o===e);if(i!==-1){t.splice(i,1)}return void 0}static indexForOrder(e,t,i){const o=e[i];const n=t.findIndex(a=>a===i);if(n!==-1){return{index:n,order:t}}const{length:s}=t;if(s){let a;for(a=0;ao===e);if(i!==-1){this.spriteContainerOrder[i]=t}}bringToFront(e){const t=this.spriteContainerOrder.findIndex(i=>i===e);if(t!==-1){this.spriteContainerOrder.splice(t,1);this.spriteContainerOrder.push(e)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:e}=this.spriteContainerOrder;return this.spriteContainerOrder[e-1]}getSpriteIndex(e){const t=this.spriteContainerOrder.findIndex(i=>i===e);return t+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};Lw=rc;Lw.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3}});var GM;var VM=p(()=>{$s();H();UM();qM();HM();WM();GM=class{constructor(e){this.orderHelper=new Lw;this.init=()=>{const e=this.editor.configStore.config.engine;this.engine=new Jh({...e,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new zM(this.editor);this.output=new NM(this.editor);this.preview=new Cl(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=e}render(e){return this.engine.render(e)}previewSpaceToWorldSpace(e,t){const i=this.preview.previewTransformWithoutDpr;if(Ho(e)){const o=this.editor.engine.convertPointFromPreviewIntoWorldSpace(A.ZERO,i,t);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:e,y:0},i,t);return A.distance(new A(o),new A(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(e,i,t)}worldSpaceToPreviewSpace(e){const t=this.preview.previewTransformWithoutDpr;if(Ho(e)){const i=this.editor.engine.convertPointFromWorldIntoPreviewSpace(A.ZERO,t);const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:e,y:0},t);return A.distance(new A(i),new A(o))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(e,t)}outputSpaceToWorldSpace(e){if(Ho(e)){return ge.getScalarInWorldSpace(e,this.editor.engine.getOutputContainer())}return ge.getPointInWorldSpace(e,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(e){const t=this.preview.previewTransformWithoutDpr;if(Ho(e)){const i=this.editor.engine.convertPointFromPreviewIntoOutputSpace(A.ZERO,t);const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:e,y:0},t);return A.distance(new A(i),new A(o))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(e,t)}previewSpaceToFlippedPreviewSpace(e){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(e)}}});var rf;var Tpe=p(()=>{Le();rf=class{constructor(){this.snapshots=[];this.observeIndex=se.box(-1)}addSnapshot(e){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(e))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(e)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(e){if(e>0&&e0}get canRedo(){return this.snapshots.length-1>this.index}};g([S],rf.prototype,"index",1);g([S],rf.prototype,"canUndo",1);g([S],rf.prototype,"canRedo",1)});var lp;var zw=p(()=>{Le();P();Tpe();Ti();lp=class{constructor(e){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const e=this.appHistoryManager.undo();await this.applyState(e);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const e=this.appHistoryManager.redo();await this.applyState(e);this.awaitHistoryChange=false}};this.editor=e;this.appHistoryManager=new rf}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const e=_e(this.editor.adjustmentsToolStore.state);const t=_e(this.editor.filterToolStore.state);const i=this.editor.focusToolStore.getFocusStateForHistory();const o=_e(this.editor.overlayToolStore.state);const n=_e(this.editor.frameToolStore.state);const{strokes:s}=this.editor.brushToolStore;const a=this.editor.spriteStore.getSpriteHistoryState();const l=this.editor.transformToolStore.serializableState;return{["adjustment"]:e,["filter"]:t,["focus"]:i,["overlay"]:o,["frame"]:n,["brush"]:s,sprite:a,["transform"]:l}}addInitialSnapshot(){const e=this.getHistoryState();this.appHistoryManager.addSnapshot({state:e,type:"add",description:"Initial State"})}addSnapshot(e,t,i){let o;if(!e){o=this.getHistoryState()}else if(e.sprite||e.transform){o={...this.getHistoryState(),...e}}else{o=e}this.appHistoryManager.addSnapshot({state:o,type:t,description:i});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:e}){try{if(e){const t=Object.keys(e);for(const i of t){switch(i){case"filter":await this.editor.filterToolStore.updateStateFromHistory(e[i]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(e[i]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(e[i]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(e[i]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(e[i],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(e[i]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(e[i]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(e[i]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(t){console.error(t);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:t,handleConfirm:()=>{this.applyState({state:e})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var e,t;return(t=(e=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:e.state)==null?void 0:t.sprite}};g([C],lp.prototype,"undo",2);g([C],lp.prototype,"redo",2);g([S],lp.prototype,"canUndo",1);g([S],lp.prototype,"canRedo",1)});var _Ke,Ipe,vKe,jM;var Epe=p(()=>{_Ke=(r,e)=>new Promise((t,i)=>{const o=new XMLHttpRequest;o.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){t(n.result)}else{i(new Error(`The image could not be loaded from ${r}`))}};n.onerror=s=>{i(s)};n.readAsDataURL(o.response)};o.open("GET",r);o.responseType="blob";o.withCredentials=e==="use-credentials";o.send()});Ipe=(r,e)=>{return new Promise((t,i)=>{const o=new Image;o.onload=()=>{t(o)};o.onerror=()=>{i(new Error(`Failed to load image with src:${r}`))};o.crossOrigin=e;o.src=r})};vKe=(r,e)=>new Promise((t,i)=>{_Ke(r,e).then(o=>{const n=new Image;n.addEventListener("load",()=>{t(n)});n.src=o}).catch(()=>{Ipe(r,e).then(o=>t(o)).catch(o=>{i(o)})})});jM=async({url:r,image:e,crossOrigin:t="anonymous"})=>{try{if(e&&e.src&&e.src.substr(0,5)==="data:"||e&&e.src&&e.src.includes(".svg")){return e}if(typeof r==="string"&&r.substr(0,5)==="data:"||typeof r==="string"&&r.includes(".svg")){return Ipe(r,t)}return vKe(r||e.src,t)}catch(i){throw new Error(i)}}});var xKe,Ki;var Uw=p(()=>{Le();P();H();Epe();xKe={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};Ki=class{constructor(e){this.setImage=async e=>{try{const{crossOrigin:t}=this.editor.configStore.config.engine;if(typeof e==="string"&&!e.trim()||e===void 0||e===null){this.state.image=null}else if(typeof e==="string"){this.state.image=await jM({url:bs(e)?e:this.editor.assetProvider.getPath(e),crossOrigin:t})}else if(e instanceof HTMLImageElement){this.state.image=await jM({image:e,crossOrigin:t})}if(this.isWebcam){this.state.isWebcam=false}}catch(t){throw new Error(t)}};this.setImageLoadedToEngine=e=>{this.state.imageLoadedToEngine=e};this.newImage=e=>{this.editor.init(e)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=e;this.state=se(xKe)}selectTool(e){var i,o,n;const{licenseChecker:t}=this.editor.configStore;if(this.state.tool!==e&&(t==null?void 0:t.isToolAllowed(e))&&(this.image||e==="library"||e==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const s=(n=(o=(i=this.editor.configStore.state.config["customTool"])==null?void 0:i.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(e==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,e);this.state.tool=e;this.editor.configStore.events.onToolChanged(e);switch(e){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(e){this.state.isWebcam=e}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};g([C],Ki.prototype,"selectTool",1);g([C],Ki.prototype,"selectWebcam",1);g([C],Ki.prototype,"setImage",2);g([C],Ki.prototype,"setImageLoadedToEngine",2);g([C],Ki.prototype,"newImage",2);g([C],Ki.prototype,"dispose",2);g([S],Ki.prototype,"webcamLabel",1);g([S],Ki.prototype,"tool",1);g([S],Ki.prototype,"isWebcam",1);g([S],Ki.prototype,"image",1);g([S],Ki.prototype,"imageLoadedToEngine",1)});var CKe,$M,KM,ri;var Nw=p(()=>{Le();P();H();CKe={height:150,width:150};$M={height:0,width:0};KM=class{constructor(e){this.canvasClickDisabled=se.box(false);this.resizeCanvas=(e=null)=>{const t=this.editor.activeStore.tool;const i=e==="transform"||!e&&t==="transform";const{isLayoutAdvanced:o,measurements:n}=this.editor.configStore;const{storedSize:s}=this.editor.canvasStore;let a=0;if(!o&&i){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(e==="transform"&&t==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:s.width,height:s.height+a})};this.setCanvasSize=e=>{this.state.canvasSize=e};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=e;this.state=se(KM.initialState)}setCanvasElement(e){this.canvas=e;this.editor.engineMediator.preview.createPreview(e);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:e,width:t,render:i}){const{imageLoadedToEngine:o}=this.editor.activeStore;if(e>$M.height&&t>$M.width){this.state.storedSize={width:t,height:e};if(this.state.canvasSize.height===0){this.state.canvasSize={width:t,height:e}}if(i&&o){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return A.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(e){const t=this.editor.engine.getContainersAtPreviewPoint(e,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(i=>i.getID()).filter(i=>i!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(t)}};ri=KM;ri.initialState={canvasSize:$M,storedSize:CKe};g([C],ri.prototype,"setCanvasElement",1);g([C],ri.prototype,"saveDimensions",1);g([C],ri.prototype,"resizeCanvas",2);g([C],ri.prototype,"disableCanvasClick",1);g([C],ri.prototype,"enableCanvasClick",1);g([C],ri.prototype,"setCanvasSize",2);g([C],ri.prototype,"dispose",2);g([S],ri.prototype,"isCanvasClickable",1);g([S],ri.prototype,"canvasSize",1);g([S],ri.prototype,"storedSize",1);g([S],ri.prototype,"sizeVector",1);g([S],ri.prototype,"sizeVectorMagnitude",1)});var SKe,Do;var qw=p(()=>{Le();P();SKe={type:null,identifier:null,isVisible:false,error:""};Do=class{constructor(e){this.showActionModal=({type:e,identifier:t,error:i,handleConfirm:o,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=t;this.state.type=e;this.state.error=i||"";this.handleConfirm=o;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=e.configStore;this.state=se(SKe)}showInfoModal(e){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=e;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:e}=this.state;const t=this.getModalLocale();if(t){const{bodyLabel:i,headerLabel:o,buttonYes:n,buttonNo:s}=t;return{headerLabel:o,bodyLabel:i,confirmLabel:n,dismissLabel:s,isVisible:e,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:e,measurements:{basicCanvasOffset:t,advancedUIToolControlBar:i,advancedUIToolbar:o},isOrderDefault:n}=this.configStore;const s=(i.width+o.width)*(!n?-1:1);const a=t;return e?{x:s/2,y:0}:{x:0,y:-a}}getModalLocale(){const{identifier:e,error:t,type:i}=this.state;const{locale:o}=this.configStore;if(!i||!e||i==="textEdit")return null;if(i&&e&&o[`${i}Modals`]&&o[`${i}Modals`][e]){const n=o[`${i}Modals`][e];let{body:s}=n;if(s&&typeof t==="object"){Object.keys(t).forEach(l=>{s=s.replace(`\${${l}}`,t[l])})}else if(s){s=s.replace("${error}",t)}let a=n.heading;if(i==="error"||i==="warning"){const l={error:o.common.error,warning:o.common.warning};const u=i==="error"?l.error:l.warning;a=`${u}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};g([C],Do.prototype,"showActionModal",2);g([C],Do.prototype,"showInfoModal",1);g([C],Do.prototype,"showTextEditModal",1);g([C],Do.prototype,"hideModal",2);g([C],Do.prototype,"dispose",2);g([S],Do.prototype,"modalProps",1);g([S],Do.prototype,"isVisible",1);g([S],Do.prototype,"type",1);g([S],Do.prototype,"identifier",1);g([S],Do.prototype,"positionOffset",1)});var _r;var Hw=p(()=>{Le();H();_r=class{constructor(e){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(e=>e/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:e,maxOffsetY:t}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=t}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=e}this.savePosition();this.scaleRender()}};this.setOffset=e=>{const{canDragX:t,canDragY:i}=this.checkOffset(e);if(t){this.offset.x=e.x}if(i){this.offset.y=e.y}this.scaleRender()};this.editor=e}setInitialTransform(e=0){const t=En();const{scaleImageToFit:i}=this.editor.configStore.config;const{transform:o}=this.editor.engineMediator.preview;ar(()=>{const n=Math.abs(e||o.scale.x);this.setDefaultScale(i?n:Math.min(1*t,n));this.setPosition(o.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:e,height:t}=this.editor.canvasStore.canvas;this.setPosition({x:e/2,y:t/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(e){this.state.position.x=e.x;this.state.position.y=e.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(e){if(this.defaultScale!==1){const i=this.SCALE_LEVELS.findIndex(o=>o===this.defaultScale);if(i!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,i),...this.SCALE_LEVELS.slice(i+1)]}}const t=this.SCALE_LEVELS.findIndex(i=>i===e);if(t!==-1){this.state.scaleIndex=t}else{const i=this.SCALE_LEVELS.findIndex((o,n)=>{if(n===0){return e0;const f=c>0;const b=d-a;const _=m-l;return{canDragX:b<0,canDragY:_<0,maxOffsetX:h?-b:b,maxOffsetY:f?-_:_}}calculateScale(e=0,t=this.previewSize,i=this.defaultScale){const{width:o,height:n}=t;const s=new A({x:o,y:n});const a=new A(Math.abs(s.x*Math.cos(e))+Math.abs(s.y*Math.sin(e)),Math.abs(s.x*Math.sin(e))+Math.abs(s.y*Math.cos(e)));const l=s.subtract(a).divide(2).multiply(i).abs;if(l.y>l.x){return l.y*2/s.y+i}return l.x*2/s.x+i}get defaultIndex(){return this.SCALE_LEVELS.findIndex(e=>e===this.defaultScale)}getPositionWithOffset(e=this.offset){const{position:t}=this;return{x:t.x-e.x,y:t.y-e.y}}scaleRender(e=false){const t=this.editor.scale.getPositionWithOffset();const i=e?this.defaultScale:this.scale;const o={x:i,y:i};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(t);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:t,rotation:0});if(!e){this.editor.render()}}get scale(){const e=this.state.scaleIndex;return e!==-1?this.SCALE_LEVELS[e]:this.defaultScale}get zoomLevel(){const e=En();return(this.scale/e*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const e=this.state.scaleIndex;const t=e!==-1?this.SCALE_LEVELS[e]:this.defaultScale;const{previewSize:i}=this;return{width:i.width*t/this.defaultScale,height:i.height*t/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};g([se],_r.prototype,"state",2);g([C],_r.prototype,"in",2);g([C],_r.prototype,"out",2);g([C],_r.prototype,"setInitialTransform",1);g([C],_r.prototype,"resetScale",1);g([C],_r.prototype,"resetPosition",1);g([C],_r.prototype,"setPosition",1);g([C],_r.prototype,"savePosition",1);g([C],_r.prototype,"setDefaultScale",1);g([C],_r.prototype,"setScaleToDefault",1);g([S],_r.prototype,"scale",1);g([S],_r.prototype,"zoomLevel",1);g([S],_r.prototype,"canDrag",1);g([S],_r.prototype,"canZoomOut",1);g([S],_r.prototype,"canZoomIn",1);g([S],_r.prototype,"position",1);g([S],_r.prototype,"scaledSize",1)});var kpe,wKe,Zs,tr;var XM=p(()=>{Le();H();kpe=[[0,0],[0,1],[1,0],[1,1]];wKe=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];Zs=class{constructor(e,t,i="center",o=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=t;this.m=i==="center"?Zs.movePivotTo([.5,.5]):kpe;this.considerRotation=o;this.considerFlip=n;this.configStore=e.configStore}static getFlippedEdgeIndex(e,t,i){return wKe[(t?1:0)+(i?2:0)][e]}static movePivotTo(e){return kpe.map(t=>[t[0]-e[0],t[1]-e[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(e,t,i){const o=Zs.getFlippedEdgeIndex(e,t,i);const n=this.m[o][0]*this.size.width;const s=this.m[o][1]*this.size.height;return{width:n,height:s}}get leftTop(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(0,t,i);return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftBottom(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(1,t,i);return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightTop(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(2,t,i);return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightBottom(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(3,t,i);return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftBottomHandle(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(1,t,i);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightBottomHandle(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(3,t,i);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftMid(){const e=new A(this.leftTop);const t=new A(this.leftBottom);return e.add(t).divide(2)}get rightMid(){const e=new A(this.rightTop);const t=new A(this.rightBottom);return e.add(t).divide(2)}};tr=Zs;tr.coordinatesWithRotation=({width:e,height:t},i,o,n,s,a)=>{let l=e*Math.cos(i)-t*Math.sin(i)+a.x;let u=e*Math.sin(i)+t*Math.cos(i)+a.y;if(o){l=s.x*2-l}if(n){u=s.y*2-u}return new A({x:l,y:u}).rounded};g([S],tr.prototype,"position",1);g([S],tr.prototype,"size",1);g([S],tr.prototype,"rotation",1);g([S],tr.prototype,"flipHorizontally",1);g([S],tr.prototype,"flipVertically",1);g([S],tr.prototype,"flipCenter",1);g([S],tr.prototype,"leftTop",1);g([S],tr.prototype,"leftBottom",1);g([S],tr.prototype,"rightTop",1);g([S],tr.prototype,"rightBottom",1);g([S],tr.prototype,"leftBottomHandle",1);g([S],tr.prototype,"rightBottomHandle",1);g([S],tr.prototype,"leftMid",1);g([S],tr.prototype,"rightMid",1)});var YM=p(()=>{Mw();Bb();zb();Mb();VM();WM();UM();qM();HM();zw();Uw();Nw();qw();Hw();XM()});var qe;var Dpe=p(()=>{Le();H();kM();qe=class{constructor(e,t){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:se.map({})};this.configStore=e.configStore;this.id=We();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=t}changeIdentifier(e){this.state.identifier=e;const t=this.state.cropState.get(`${this.id}-${e}`);if(!t){this.state.cropState.set(`${this.id}-${e}`,{...Wn})}}changeRatio(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){this.state.cropState.set(`${this.id}-${this.identifier}`,{...t,ratio:e})}}changeSize(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e.width&&e.width>0){t.size.width=Math.round(e.width)}if(e.height&&e.height>0){t.size.height=Math.round(e.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}changeHeight(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e){t.size.height=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}}changeWidth(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e){t.size.width=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}}changePositionX(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i&&e<=t-this.minCropSize&&e>=0){i.position.x=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}return false}changePositionY(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i&&e<=t-this.minCropSize&&e>=0){i.position.y=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}return false}changePosition(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i){if(e.x<=t.width-this.minCropSize&&e.x>=0&&e.y<=t.height-this.minCropSize&&e.y>=0){i.position.x=Math.round(e.x);i.position.y=Math.round(e.y);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}}return false}changeLockResolution(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){t.lockResolution=e!==void 0?e:!t.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}changeForceDimensions(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){t.forceDimensions=e;this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}clearState(){this.state.cropState.forEach((e,t)=>t.startsWith(this.id)&&this.state.cropState.delete(t))}setRotation(e){this.state.rotationInDegrees=e}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:e,flipVertically:t}){this.state.flipHorizontally=e;this.state.flipVertically=t}setOutputRotation(e){this.state.outputRotation=e}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:e,height:t}=this.defaults.maxCropMaskSize;return new A(e/2,t/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:Wn.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:Wn.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:Wn.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:Wn.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:Wn.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:Wn.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:Wn.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:Wn.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:Wn.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};g([se],qe.prototype,"state",2);g([C],qe.prototype,"changeIdentifier",1);g([C],qe.prototype,"changeRatio",1);g([C],qe.prototype,"changeSize",1);g([C],qe.prototype,"changeHeight",1);g([C],qe.prototype,"changeWidth",1);g([C],qe.prototype,"changePositionX",1);g([C],qe.prototype,"changePositionY",1);g([C],qe.prototype,"changePosition",1);g([C],qe.prototype,"changeLockResolution",1);g([C],qe.prototype,"changeForceDimensions",1);g([C],qe.prototype,"clearState",1);g([C],qe.prototype,"setRotation",1);g([C],qe.prototype,"resetRotation",1);g([C],qe.prototype,"resetOutputRotation",1);g([C],qe.prototype,"resetFlip",1);g([C],qe.prototype,"updateFlip",1);g([C],qe.prototype,"setOutputRotation",1);g([C],qe.prototype,"flipHorizontally",1);g([C],qe.prototype,"flipVertically",1);g([C],qe.prototype,"dispose",2);g([S],qe.prototype,"flipCenter",1);g([S],qe.prototype,"isFlippedHorizontal",1);g([S],qe.prototype,"isFlippedVertical",1);g([S],qe.prototype,"identifier",1);g([S],qe.prototype,"height",1);g([S],qe.prototype,"width",1);g([S],qe.prototype,"position",1);g([S],qe.prototype,"ratio",1);g([S],qe.prototype,"size",1);g([S],qe.prototype,"x",1);g([S],qe.prototype,"y",1);g([S],qe.prototype,"lockResolution",1);g([S],qe.prototype,"forceDimensions",1);g([S],qe.prototype,"selectedCrop",1);g([S],qe.prototype,"rotationInDegrees",1);g([S],qe.prototype,"outputRotation",1)});var JM;var Ope=p(()=>{Le();H();Yh();JM=class{constructor(e){this.transforms={output:JSON.stringify(yt.IDENTITY),preview:JSON.stringify(yt.IDENTITY)};this.setFrameOpacity=e=>{this.frameOpacity=e;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=e=>{this.overlayOpacity=e;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=e;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:e,flipVertically:t,rotation:i,outputRotation:o}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new A(this.transformToolStore.leftTopRespectFlip).add(new A(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new A(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const s=this.engineMediator.preview.container;const{outputContainer:a}=this.editor;a.setResolution(_e(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:t,flipHorizontally:e});const l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let u=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:f,defaultImageSize:b}=this.transformToolStore;const _=this.transformToolStore.maxCropMaskSize;const y={height:f.height*b.height/_.height,width:f.width*b.width/_.width};u=y.width/this.transformToolStore.localOutputImageSize.width}const c=Math.abs(l.x);const d=u/(c/this.transformToolStore.defaultScale);const m={x:d,y:d};const h=-(i-o);a.setTransform({scale:m,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(e){this.transforms=e}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const e=this.engineMediator.preview.container;const{outputContainer:t}=this.editor;const i=JSON.parse(this.transforms.preview);t.setResolution(_e(this.transformToolStore.defaultImageSize));e.setTransform(i);t.setTransform(JSON.parse(this.transforms.output));const o=i.scale;t.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(i);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(e,t=true){const{width:i,height:o}=this.editor.engineMediator.image.container.getBounds();const n=vJ(e)?{width:o,height:i}:{width:i,height:o};this.editor.outputContainer.rotate(e,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:s}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(s);ar(()=>{this.editor.scale.setInitialTransform();const a=this.getScaleWithFlip(s);this.engineMediator.preview.container.setScale(a);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(t){this.editor.render()}}applyPreviewTransform(){const{rotation:e,flipHorizontally:t,flipVertically:i}=this.transformToolStore.rotateFlipState;const o=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let s=e;if(t){s=Xh(s)}if(i){s=Xh(s)}const a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a)}getScaleWithFlip(e=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:t,flipVertically:i}=this.transformToolStore.rotateFlipState;const o=t?-1:1;const n=i?-1:1;const s=this.editor.scale.calculateScale(e);return{x:s*o,y:s*n}}saveTransforms(){const e=JSON.stringify(this.engineMediator.preview.container.getTransform());const t=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:e,output:t}}saveTransformsBasedOnFlip(){const e=this.engineMediator.preview.container.getTransform();const{scale:t}=e;const{flipVertically:i,flipHorizontally:o}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...e,scale:{x:o?-t.x:t.x,y:i?-t.y:t.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}}});var ZM;var Rpe=p(()=>{H();ZM=class{constructor(e){this.store=e;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,fr.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}}});var Ape,up,ae;var QM=p(()=>{Le();P();H();YM();Ti();Xs();Dpe();Ope();Rpe();Ape="identity";up=class{constructor(e){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=se.box(false);this.minCropSize=0;this.transformHistory=new ZM(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=e=>{if(!e.trim())return false;let t=this.editor.configStore.config.assetBaseUrl;const{length:i}=t;if(t[i-1]!=="/"){t+="/"}if(`${t}transform`===e){return false}const o=new Image;try{o.src=e;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const e=this.editor.outputContainer.getRotation();if(e!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=e=>{this.localOutputSize.height=Math.round(e.height);this.localOutputSize.width=Math.round(e.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(e.width),height:Math.round(e.height)})};this.changeDefaultScale=e=>{this.defaults.scale=e};this.changeLocalOutputHeight=e=>{this.localOutputSize.height=Math.round(e)};this.changeLocalOutputWidth=e=>{this.localOutputSize.width=Math.round(e)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const e=this.editor.outputContainer.getRotation();const t=this.isFlippedVertical?dR:pR;this.rotateOutputContainer(t(e))};this.rotateAntiClockwise=()=>{const e=this.editor.outputContainer.getRotation();const t=this.isFlippedVertical?pR:dR;this.rotateOutputContainer(t(e))};this.flipHorizontally=(e=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(e);if(e){this.trackChanges()}};this.flipVertically=(e=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(e);if(e){this.trackChanges()}};this.applyDefaultCrop=(e=false)=>{if(this.identifier==="identity"){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,e)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:e,y:t})=>{const i=this.getRatio();const o=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,e),o.x-n.width);const l=Math.min(Math.max(0,t),o.y-n.height);const u=o.x-a;const c=o.y-l;const d={width:Math.max(this.minCropSize,Math.min(u,s.width-a)),height:Math.max(this.minCropSize,Math.min(c,s.height-l))};if(i==="*"){if(this.changePosition({x:a,y:l})){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);const h=new A(o).subtract({x:m.width,y:m.height});if(this.changePosition(h)){this.changeCropAndOutputSize(m,i)}}};this.onLeftBottom=({x:e,y:t})=>{const i=this.getRatio();const o=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,e),o.x-n.width);const l=Math.max(0,t,o.y+n.height);const u=o.x-a;const c=l-o.y;const d={width:Math.max(1,Math.min(u,s.width-a)),height:Math.max(1,Math.min(c,s.height-o.y))};if(i==="*"){if(this.changePositionX(a)){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);if(this.changePositionX(o.x-m.width)){this.changeCropAndOutputSize(m,i)}}};this.onRightTop=({x:e,y:t})=>{const i=this.getRatio();const o=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,e,o.x+n.width);const l=Math.min(Math.max(0,t),o.y-n.height);const u=a-o.x;const c=o.y-l;const d={width:Math.max(1,Math.min(u,s.width-o.x)),height:Math.max(1,Math.min(c,s.height-l))};if(i==="*"){if(this.changePositionY(l)){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);if(this.changePositionY(o.y-m.height)){this.changeCropAndOutputSize(m,i)}}};this.onRightBottom=({x:e,y:t})=>{const i=this.getRatio();const o=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,e,o.x+n.width);const l=Math.max(0,t,o.y+n.height);const u=a-o.x;const c=l-o.y;const d={width:Math.max(1,Math.min(u,s.width-o.x)),height:Math.max(1,Math.min(c,s.height-o.y))};if(i==="*"){this.changeCropAndOutputSize(d)}else{const m=this.proportionalSize(i,d);this.changeCropAndOutputSize(m,i)}};this.onPixelWidth=e=>{const t=JSON.stringify(_e(this.localOutputSize));const i=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(i&&i.ratio){let n=e;let s=this.localOutputSize.height;let{ratio:a}=i;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(e,o.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(s)})}else{const l=up.placeCropMask(a,o);n=Math.max(Math.min(n,l.width),this.minCropSize);s=n/a;this.changeLocalOutputSize({height:s,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(t));return Math.round(n)}return e};this.onPixelHeight=e=>{const t=JSON.stringify(_e(this.localOutputSize));const i=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(i&&i.ratio){let n=e;let s=this.localOutputSize.width;let{ratio:a}=i;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(e,o.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(n)})}else{const l=up.placeCropMask(a,o);n=Math.max(Math.min(n,l.height),this.minCropSize);s=n*a;this.changeLocalOutputSize({height:n,width:s})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(t));return Math.round(n)}return e};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=e=>{this.transformations.setFrameOpacity(e)};this.setOverlayOpacity=e=>{this.transformations.setOverlayOpacity(e)};this.closestRatioReducer=e=>(t,i)=>{if(i===null)return-1;return Math.abs(e-t.ratio)(t,i)=>{if(i===null)return-1;const o=Math.abs(t.dimensions.x/t.dimensions.y);const n=Math.abs(i.dimensions.x/i.dimensions.y);if(o===n){return t.dimensions.x*t.dimensions.y>i.dimensions.x*i.dimensions.y?-1:1}return Math.abs(e-o){const e=this.entityManager.items.findIndex(l=>l.identifier==="imgly_transform_common_custom");if(e!==-1)return this.entityManager.items[e];const t=this.entityManager.items.findIndex(l=>l.ratio==="*");if(t!==-1)return this.entityManager.items[t];const i=_e(this.editor.outputContainer.getResolution());const o=Math.abs(i.width/i.height);const[n]=this.entityManager.items.filter(l=>l.ratio&&typeof l.ratio==="number").sort(this.closestRatioReducer(o));const[s]=this.entityManager.items.filter(l=>l.dimensions&&!l.ratio).sort(this.closestDimensionsReducer(o));if(!n||!s||!n.ratio&&!s.dimensions){return this.entityManager.items[0]}if(!s||!s.dimensions)return n;if(!n||!n.ratio)return s;const a=Math.abs(s.dimensions.x/s.dimensions.y);if(a===n.ratio)return n;return Math.abs(o-n.ratio){let t=this.entityManager.items.find(i=>i.identifier===e);if(!t){t=this.getMatchingItem()}return t};this.editor=e;this.selectedCategory=Ape;this.transformStore=new qe(e,this.defaults);this.transformations=new JM(e);const{enableRotation:t,enableFlip:i,...o}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new ir(n,{...o,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new tr(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new tr(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(e){return e*Math.PI/180}static placeCropMask(e,t){if(t.height*e>t.width){const o=t.width/e;return{height:o,width:t.width,yChanged:true}}const i=t.height*e;return{height:t.height,width:i,yChanged:false}}changeIdentifier(e,t=false){this.transformStore.changeIdentifier(e);const i=this.getCropMask(e,this.defaults.imageSize);if(i){this.transformStore.changeRatio(i.ratio);this.changeLocalOutputSize(i);this.updatePreviewSizeWRTImageSize();if(i.yChanged!==void 0){this.updateInitialCropMaskPosition(i.yChanged)}if(i.dimensions){this.changeLocalOutputSize({width:i.dimensions.x,height:i.dimensions.y})}if(t){this.trackChanges()}}}setDragMode(e){this.dragMode.set(e)}getCropMask(e,t){const i=this.getTransform(e);if(i){const{ratio:o,forceDimensions:n,lockDimensions:s,dimensions:a=null}=i;if(n){this.transformStore.changeForceDimensions(n)}if(s){this.transformStore.changeLockResolution(s)}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return{...t,yChanged:void 0,ratio:"*",dimensions:a};default:return{...up.placeCropMask(i.ratio,t),ratio:i.ratio,dimensions:a}}}else{const{x:l,y:u}=i.dimensions;return{...up.placeCropMask(l/u,t),ratio:null,dimensions:a}}}return null}setCropDefaults(e=false){const t=this.editor.outputContainer.getResolution();this.setDefaultImageSize(t);const i=this.editor.getPreviewSize();const{position:o}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(i);this.setDefaultCropPosition({x:o.x-i.width/2,y:o.y-i.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!e){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(e){this.defaults.imageSize={..._e(e)};if(!this.lockResolution){this.localOutputSize={..._e(e)}}}setMaxCropSize(e){this.defaults.maxCropMaskSize.height=e.height;this.defaults.maxCropMaskSize.width=e.width}setDefaultCropPosition(e){this.defaults.cropMaskPosition.x=e.x;this.defaults.cropMaskPosition.y=e.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(e){this.selectedCategory=this.selectedCategory===e?Ape:e}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=JSON.stringify(this.engineMediator.preview.container.getTransform());const t=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:e,output:t})}changePosition(e){return this.transformStore.changePosition(e,this.defaults.maxCropMaskSize)}changePositionX(e){return this.transformStore.changePositionX(e,this.defaults.maxCropMaskSize.width)}changePositionY(e){return this.transformStore.changePositionY(e,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:e,height:t},i,o=true){this.transformStore.changeWidth(e);this.transformStore.changeHeight(t);if(!this.lockResolution){const{height:n,width:s}=this.defaults.maxCropMaskSize;const{height:a,width:l}=this.defaults.imageSize;let u=a/n*t;const c=l/s*e;if(i){u=c/i}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(c),height:Math.round(u)})}if(t>=this.minCropSize){this.changeLocalOutputHeight(u)}if(e>=this.minCropSize){this.changeLocalOutputWidth(c)}}}transformRender(e=true){this.transformations.applyPreviewTransform();if(e){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:e,flipVertically:t}=this.rotateFlipState;const{identifier:i,rotationInDegrees:o}=this;const n=Nc(o);const s=cR(V0(this.editor.engineMediator.output.container.getRotation())+o);const{start:a,end:l}=this.convertUIToOperationOptions(n,s);return{flipHorizontally:e,flipVertically:t,rotation:n,start:a,end:l,identifier:i,outputRotation:s}}getStartEndForOperation(e){const{leftTop:t,rightBottom:i,maxCropMaskSize:o}=this;const n=t.y;const s=t.x;const a=i.x;const l=i.y;switch(e){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}getStartEndForUI(e,t,i){const{maxCropMaskSize:o}=this;const n=t.y;const s=t.x;const a=i.x;const l=i.y;switch(e){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}convertOperationOptionsToUI({start:e,end:t,rotation:i,outputRotation:o}){const n=o===90||o===270;const s=n?A.fromSize(this.defaultImageSize).swapped:A.fromSize(this.defaultImageSize);const a=Math.cos(i);const l=Math.sin(i);const u=this.calculateScale(i);const c=new A(Math.min(e.x,t.x),Math.min(e.y,t.y));const d=new A(Math.max(e.x,t.x),Math.max(e.y,t.y));const m=d.subtract(c).divide(2);const h=c.add(m).multiply(s);const f=h.subtract(s.multiply(.5));const b=new A(f.x*a-f.y*l,f.x*l+f.y*a).multiply(u);const _=s.multiply(.5).add(b);const y=_.divide(s);const T=y.subtract(m.multiply(u));const w=y.add(m.multiply(u));const k=n?A.fromSize(this.maxCropMaskSize).swapped:A.fromSize(this.maxCropMaskSize);const F=T.multiply(k);const E=w.multiply(k);const{leftTop:R,rightBottom:Z}=this.getStartEndForUI(o,F,E);return{start:new A(R),end:new A(Z)}}convertUIToOperationOptions(e,t){const i=t===90||t===270;const o=i?A.fromSize(this.defaultImageSize).swapped:A.fromSize(this.defaultImageSize);const n=i?A.fromSize(this.maxCropMaskSize).swapped:A.fromSize(this.maxCropMaskSize);const s=Math.cos(-e);const a=Math.sin(-e);const l=this.calculateScale(e,i);const{leftTop:u,rightBottom:c}=this.getStartEndForOperation(t);const d=new A(u).divide(n);const m=new A(c).divide(n);const h=m.subtract(d).divide(2);const f=d.add(h).multiply(o);const b=f.subtract(o.multiply(.5));const _=new A(b.x*s-b.y*a,b.x*a+b.y*s).divide(l);const y=o.multiply(.5).add(_);const T=y.divide(o);const w=T.subtract(h.divide(l));const k=T.add(h.divide(l));return{start:w,end:k}}calculateScale(e,t=false){const i=t?A.fromSize(this.defaultImageSize).swapped:A.fromSize(this.defaultImageSize);const o=new A(Math.abs(i.x*Math.cos(e))+Math.abs(i.y*Math.sin(e)),Math.abs(i.x*Math.sin(e))+Math.abs(i.y*Math.cos(e)));const n=i.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/i.y+1:n.x*2/i.x+1}updateStateFromSerialization(e){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=Math.round(V0(e.rotation));this.transformStore.setRotation(t>180?t-360:t);this.transformations.rotateOutputContainer(Nc(cR(e.outputRotation||0)));if(e.identifier){this.transformStore.changeIdentifier(e.identifier)}if(e.start&&e.end){if(e.end.x===0||e.end.y===0){e.end.x=1;e.end.y=1}const{start:i,end:o}=this.convertOperationOptionsToUI({start:new A(e.start),end:new A(e.end),rotation:e.rotation,outputRotation:e.outputRotation});this.changePositionX(i.x);this.changePositionY(i.y);const n=o.x-i.x;const s=o.y-i.y;this.transformStore.changeSize({width:n,height:s});const{maxCropMaskSize:a,imageSize:l}=this.defaults;const u={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(u)}if(e.flipHorizontally){this.flipHorizontally(false)}if(e.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(e){this.defaultAngle=e}updateCanvasControls(e){const t=_e(this.cropMaskPosition);const i=_e(this.cropMaskSize);const o=_e(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*i.height/e.height,width:o.width*i.width/e.width},void 0,false);this.changePosition({y:o.height*t.y/e.height,x:o.width*t.x/e.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(e){this.transformStore.setRotation(e);this.transformRender()}async rotateOutputContainer(e,t=true){this.setDragMode(true);this.transformations.rotateOutputContainer(e,t);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,false)}clickableCanvas(e){this.editor.clickableCanvas(e)}proportionalSize(e,t,i=this.defaults.maxCropMaskSize,o=this.minCropSize){let n=t.height*e;let{height:s}=t;if(n>i.width||n1){return{width:this.minCropSize*e,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*e}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const e=this.getTransform(this.identifier);if(e){if(Object.prototype.hasOwnProperty.call(e,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return e.ratio}const{x:t,y:i}=e.dimensions;return t/i}return"*"}};ae=up;g([se],ae.prototype,"selectedCategory",2);g([se],ae.prototype,"defaults",2);g([se],ae.prototype,"localOutputSize",2);g([C],ae.prototype,"changeIdentifier",1);g([C],ae.prototype,"setDragMode",1);g([C],ae.prototype,"setCropDefaults",1);g([C],ae.prototype,"setDefaultImageSize",1);g([C],ae.prototype,"setMaxCropSize",1);g([C],ae.prototype,"setDefaultCropPosition",1);g([C],ae.prototype,"resetCrop",1);g([C],ae.prototype,"toggleCategorySelection",1);g([C],ae.prototype,"pureReset",1);g([C],ae.prototype,"reset",2);g([C],ae.prototype,"changePosition",1);g([C],ae.prototype,"changePositionX",1);g([C],ae.prototype,"changePositionY",1);g([C],ae.prototype,"changeCropAndOutputSize",1);g([C],ae.prototype,"onLeave",1);g([C],ae.prototype,"onEnter",1);g([C],ae.prototype,"changeLocalOutputSize",2);g([C],ae.prototype,"changeDefaultScale",2);g([C],ae.prototype,"changeLocalOutputHeight",2);g([C],ae.prototype,"changeLocalOutputWidth",2);g([C],ae.prototype,"changeLockResolution",2);g([C],ae.prototype,"setRotation",1);g([C],ae.prototype,"rotateClockwise",2);g([C],ae.prototype,"rotateAntiClockwise",2);g([C],ae.prototype,"rotateOutputContainer",1);g([C],ae.prototype,"flipHorizontally",2);g([C],ae.prototype,"flipVertically",2);g([C],ae.prototype,"applyDefaultCrop",2);g([C],ae.prototype,"applyInitialCrop",1);g([C],ae.prototype,"updateCropMask",2);g([C],ae.prototype,"clickableCanvas",1);g([C],ae.prototype,"onLeftTop",2);g([C],ae.prototype,"onLeftBottom",2);g([C],ae.prototype,"onRightTop",2);g([C],ae.prototype,"onRightBottom",2);g([C],ae.prototype,"proportionalSize",1);g([C],ae.prototype,"onPixelWidth",2);g([C],ae.prototype,"onPixelHeight",2);g([C],ae.prototype,"updateInitialCropMaskPosition",1);g([C],ae.prototype,"updatePreviewSizeWRTImageSize",1);g([C],ae.prototype,"dispose",2);g([S],ae.prototype,"cropState",1);g([S],ae.prototype,"identifier",1);g([S],ae.prototype,"ratio",1);g([S],ae.prototype,"height",1);g([S],ae.prototype,"width",1);g([S],ae.prototype,"localOutputImageSize",1);g([S],ae.prototype,"localOutputHeight",1);g([S],ae.prototype,"localOutputWidth",1);g([S],ae.prototype,"lockResolution",1);g([S],ae.prototype,"forceDimensions",1);g([S],ae.prototype,"rotationInDegrees",1);g([S],ae.prototype,"outputRotation",1);g([S],ae.prototype,"isDragMode",1);g([S],ae.prototype,"rotateFlipState",1);g([S],ae.prototype,"selectedCategoryIdentifier",1);g([S],ae.prototype,"categories",1);g([S],ae.prototype,"items",1);g([S],ae.prototype,"config",1);g([S],ae.prototype,"locale",1);g([S],ae.prototype,"isOptionSelected",1);g([S],ae.prototype,"leftTop",1);g([S],ae.prototype,"leftBottom",1);g([S],ae.prototype,"rightTop",1);g([S],ae.prototype,"rightBottom",1);g([S],ae.prototype,"isFlippedHorizontal",1);g([S],ae.prototype,"isFlippedVertical",1);g([S],ae.prototype,"leftTopRespectFlip",1);g([S],ae.prototype,"leftBottomRespectFlip",1);g([S],ae.prototype,"rightTopRespectFlip",1);g([S],ae.prototype,"rightBottomRespectFlip",1);g([S],ae.prototype,"cropMaskPosition",1);g([S],ae.prototype,"cropMaskSize",1);g([S],ae.prototype,"state",1);g([S],ae.prototype,"defaultImageSize",1);g([S],ae.prototype,"maxCropMaskSize",1);g([S],ae.prototype,"minCropMaskSize",1);g([S],ae.prototype,"defaultCropMaskPosition",1);g([S],ae.prototype,"defaultScale",1)});var Fpe=p(()=>{kM();QM()});var Ppe,TKe,e5,IKe,Nb,he;var t5=p(()=>{Le();Ppe=v(Fm());P();H();Ti();XM();Yh();fM();yM();vM();wM();TKe={};e5="none";IKe={position:{x:0,y:0},rotation:0};Nb=class{constructor(e){this.state=se.map(TKe);this.selectedId=se.box(e5);this.editMode=se.box(false);this.dragMode=se.box(false);this.minLength=0;this.counter=0;this.addSticker=async(e,t=true)=>{await this.addStickerAsync(e,t)};this.addStickerAsync=async({spriteId:e,state:t,transform:i},o=true)=>{return new Promise((n,s)=>{i=this.getInitialTransform(i);const{identifier:a}=t;const l=this.editor.orderHelper.addSprite(a);this.editor.engine.addStickerFromAssets(a,this.editor.engineMediator.image.container,l).then(async u=>{if(e){u.setData({id:e})}const c=u.getID();this.container[c]=u;this.editor.orderHelper.renameSprite(a,c);const d=this.getSize(c);d.width*=u.getScale().x;d.height*=u.getScale().y;u.setPivot(.5,.5);let m;if(i.scale){m=i.scale}else if(i.size){m={x:i.size.width/d.width,y:i.size.height/d.height}}else{const _=this.editor.shortestOutputSide*.4;const y=Nb.magnitude(_)/Nb.sizeMagnitude(u.getSizeInWorldSpace());m={x:y,y}}const{flipHorizontally:h,flipVertically:f}=this.editor.outputContainer.getData();u.setFlipHorizontally(h);u.setFlipVertically(f);u.setTransform({position:i.position,scale:m,rotation:i.rotation});if(t.flipHorizontally!==void 0){u.setFlipHorizontally(t.flipHorizontally!==h)}if(t.flipVertically!==void 0){u.setFlipVertically(t.flipVertically!==f)}this.setContainerProperties(c,{...t});const b=u.getData();this.setInitialSpriteState(c,"sticker");this.stickerToolStore.setState(c,{...b,identifier:a});await this.editor.renderPromise();if(o){this.setId(c);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(u=>{console.error(u);s()})})};this.addText=async(e,t=true)=>{await this.addTextAsync(e,t)};this.addTextAsync=({spriteId:e,state:t,transform:i},o=true)=>{return new Promise((n,s)=>{i=this.getInitialTransform(i);const a=this.editor.orderHelper.addSprite(t.identifier);const l=this.editor.shortestOutputSide;const u={fontIdentifier:t.identifier,text:t.text,width:t.width||l*.6,fontSize:t.fontSize||l*.1,lineHeight:t.lineHeight,alignment:t.alignment,textColor:t.textColor,backgroundColor:t.backgroundColor};this.editor.engine.addTextWithFontLoading(u,this.editor.engineMediator.image.container,a).then(async c=>{if(e){c.setData({id:e})}const d=c.getID();this.container[d]=c;this.editor.orderHelper.renameSprite(t.identifier,d);const{flipHorizontally:m,flipVertically:h}=this.editor.outputContainer.getData();c.setFlipHorizontally(m);c.setFlipVertically(h);c.setPivot(.5,.5);c.setPosition(i.position);c.setRotation(i.rotation);this.setInitialSpriteState(d,"text");const f=c.getData();this.textToolStore.setState(d,{...f});await this.editor.renderPromise();if(o){this.setId(d);this.addSnapshot("add",this.textLocale.add)}n()}).catch(c=>{console.error(c);s()})})};this.addTextDesign=async(e,t=true,i=false)=>{try{await this.addTextDesignAsync(e,t,i)}catch(o){console.warn(o)}};this.addTextDesignAsync=({spriteId:e,state:t,transform:i},o=true,n=false)=>{return new Promise((s,a)=>{i=this.getInitialTransform(i);const l=this.editor.orderHelper.addSprite(t.identifier);const u=this.editor.shortestOutputSide;const c={width:t.width||u*.6,text:t.text,color:t.color,inverted:t.isInverted,seed:t.seed,padding:t.padding};this.editor.engine.addTextDesignAsync(t.identifier,c,this.editor.engineMediator.image.container,l).then(async d=>{if(e){if(n){this.pureRemoveSprite(e);this.textDesignToolStore.state.delete(e)}d.setData({id:e})}const m=d.getID();this.container[m]=d;this.editor.orderHelper.renameSprite(t.identifier,m);const{flipHorizontally:h,flipVertically:f}=this.editor.outputContainer.getData();d.setFlipHorizontally(h);d.setFlipVertically(f);d.setPivot(.5,.5);d.setPosition(i.position);d.setRotation(i.rotation);this.setInitialSpriteState(m,"textdesign");const b=d.getData();this.textDesignToolStore.setState(m,{...b,identifier:t.identifier});await this.editor.renderPromise();if(o){this.setId(m);this.addSnapshot("add",this.textDesignLocale.add)}s()}).catch(d=>{a(d)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=e=>{this.editor.clickableCanvas(e)};this.setContainerProperties=(e,t,i=false)=>{this.container[e].setData(t);if(i){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(e,t)=>{this.container[e].setPosition(t)};this.pureRemoveSprite=e=>{this.editor.engine.removeContainer(this.container[e]);const t=this.container[e].getIndexInParent();if(t===-1){delete this.container[e];this.state.delete(e);this.editor.orderHelper.removeSprite(e);return true}return false};this.deleteSprite=(e=this.id)=>{const t=this.state.get(e);if(t.tool==="sticker"){this.stickerToolStore.delete()}else if(t.tool==="text"){this.textToolStore.delete()}else if(t.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=e=>{const t=this.pureRemoveSprite(e);if(t){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(e,t)=>{this.editor.addSnapshot(void 0,e,t)};this.spriteSnapshot=e=>{this.addSnapshot("edit",this.historyLocale[e])};this.addNewText=async(e,t)=>{if(this.textToolStore.doesTextAssetExist(t.identifier)){await this.addTextAsync({...e,state:t},false)}else{throw new In(t.identifier)}};this.addNewTextDesign=async(e,t)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(t.identifier)){await this.addTextDesignAsync({...e,state:t},false)}else{throw new In(t.identifier)}};this.addNewSticker=async(e,t)=>{if(this.stickerToolStore.doesStickerAssetExist(t.identifier)){await this.addStickerAsync({...e,state:t},false)}else{throw new In(t.identifier)}};this.getSpriteHistoryState=()=>{const e=_e(this.textToolStore.state);const t=_e(this.textDesignToolStore.state);const i={common:_e(this.state),["sticker"]:_e(this.stickerToolStore.state),["text"]:e,["textdesign"]:t,spriteIdList:Object.keys(this.container)};Object.keys(i.common).forEach(o=>{i.common[o].size=this.container[o].getSizeInWorldSpace();i.common[o].position=this.container[o].getPosition();i.common[o].order=this.container[o].getIndexInParent()});return i};this.updateStateFromSerialization=async(e,t,i)=>{if(t&&t.length){try{const o=await Promise.all(t.map(async({svg:n,raster:s,name:a,identifier:l})=>{const u=(n==null?void 0:n.data)?"image/svg+xml":s.type;const c=`data:${u};base64,${(n==null?void 0:n.data)||s.data}`;const d=await Rw(c,150);return{stickerURI:c,thumbnailURI:d,name:a,type:u,identifier:l}}));await this.stickerToolStore.addCustomStickerAsset(o)}catch(o){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(e.text){await this.textToolStore.loadFonts()}if(e.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(e.spriteIdList,e,i)};this.updateStateFromHistory=async e=>{const t=Object.keys(this.container);const i=t.filter(o=>e.spriteIdList.indexOf(o)===-1);i.forEach(o=>{this.pureRemoveSprite(o)});await this.updateStateByHistoryState(e.spriteIdList,e,0)};this.serializableState=async()=>{const e=this.editor.spriteStore.getSpriteHistoryState();Object.keys(e.common).forEach(i=>{const{flipHorizontally:o,flipVertically:n}=this.editor.outputContainer.getData();const s=this.editor.outputContainer.getRotation();const a=n!==o?-e.common[i].rotation:e.common[i].rotation;e.common[i].rotation=n!==o?a+s:a-s});const t=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:i,type:o,stickerURI:n,name:s})=>{const a={identifier:i,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]}}if(o==="image/jpeg"||o==="image/png"||o==="image/gif"){[,a.raster.data]=n.split(",");a.raster.type=o}else{const l=await Rw(n);[,a.raster.data]=l.split(",");a.raster.type="image/png"}return a}));return{sprite:e,customStickers:t}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(e=>{this.updatePositionAndSize(e,true);const t=this.state.get(e);if(t){if(t.tool==="text"){const i=this.getContainerProperties(e);this.textToolStore.changeSize(e,i)}else if(t.tool==="textdesign"){const i=this.getContainerProperties(e);this.textToolStore.changeWidth(i.width)}}})};this.setEditMode=e=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(e){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(e)}}};this.setDragMode=e=>{this.dragMode.set(e)};this.setPosition=e=>{const t=this.currentSprite;const i=this.container[this.id];if(t&&i){i.setPosition(this.editor.previewToWorld(e));const{position:o}=this.getSizePositionFromContainer();t.position.x=o.x;t.position.y=o.y;this.state.set(this.id,t);this.editor.render()}};this.setSize=e=>{const t=this.currentSprite;if(t){t.size.width=e.width;t.size.height=e.height;this.state.set(this.id,t)}};this.setRotation=e=>{const t=this.currentSprite;if(t){const{flipHorizontally:i,flipVertically:o}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const s=Rb({rotation:e,outputRotation:n,flipHorizontally:i,flipVertically:o});this.container[this.id].setRotation(s);t.rotation=this.container[this.id].getRotation();this.state.set(this.id,t);this.editor.render()}};this.onCanvasClick=e=>{if(!this.isEditMode){this.selectHighestOrderSprite(e)}};this.select=e=>{const t=this.state.get(e);if(t){const i=this.editor.activeStore.tool;if(i!==t.tool){this.editor.activeStore.selectTool(t.tool)}this.setId(e)}};this.selectLast=()=>{const e=this.editor.orderHelper.getLastSpriteId();if(e){this.select(e)}};this.selectNext=()=>{if(this.currentSprite){const e=this.container[this.id];const t=e.getIndexInParent();if(t){const i=Object.keys(this.container).find(o=>this.container[o].getIndexInParent()===t-1);if(i){this.select(i)}}}};this.deselect=()=>{this.setId(e5)};this.bringToFront=async e=>{const t=this.editor.orderHelper.bringToFront(e);this.container[e].setIndexInParent(t);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=e=>{const t=this.state.get(e);const i=this.container[e];i.setFlipHorizontally(!i.getFlipHorizontally());t.flipHorizontally=i.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(e,t);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(e=>{this.pureRemoveSprite(e)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=e=>{const t=this.editor.brushToolStore.containerId();e=e.filter(n=>n!==t);if(e.length<1){this.deselect();return}let i="";let o=0;e.forEach(n=>{const s=this.container[n];const a=s&&s.getIndexInParent()||0;if(a>=o){o=a;i=n}});this.select(i)};this.onCornerDrag=({x:e,y:t})=>{if(this.currentSprite){const i=new A(this.currentSprite.position);const o=new A(e,t);const n=o.subtract(i).magnitude;const s=this.getSize();const a=n*2/Nb.sizeMagnitude(s);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:s.width*a,height:s.height*a})}else{const l=this.rotationWRTOutputRotation;const u=o.subtract(i);const c=Math.cos(l);const d=Math.sin(l);const m=Math.max(Math.abs(u.x*c*2+u.y*d*2),this.minLength);const h=Math.max(Math.abs(u.x*-d*2+u.y*c*2),this.minLength);this.setStickerSize({width:m,height:h})}}else if(this.isSpriteText){this.setTextSize(s.width*a)}else if(this.isSpriteTextDesign){this.setTextDesignScale(a)}}this.editor.render()}};this.onWidthDrag=({x:e,y:t})=>{const i=new A(this.currentSprite.position);const o=new A(e,t);const n=o.subtract(i).magnitude;const s=this.editor.previewToWorld(2*n);if(s>this.minLength){this.setContainerProperties(this.id,{width:s},true);if(this.isSpriteText){const a=this.getContainerProperties(this.id);this.textToolStore.changeWidth(a.width)}}};this.onPaddingDrag=({x:e,y:t})=>{if(this.isSpriteTextDesign){let i=this.getContainerProperties(this.id);const o=new A(this.currentSprite.position);const n=new A(e,t);const s=n.subtract(o).magnitude;const a=Math.max(this.editor.previewToWorld(s)-i.width/2,0);this.setContainerProperties(this.id,{padding:a},true);if(this.isSpriteTextDesign){i=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(i.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:e,flipVertically:t}=this.editor.outputContainer.getData();Object.values(this.container).forEach(i=>{if(i.type==="text"||i.type==="text-design"){i.setFlipHorizontally(e);i.setFlipVertically(t)}})};this.reverseTextHorizontally=e=>{Object.values(this.container).forEach(t=>{if(t.type==="text"||t.type==="text-design"){t.setFlipHorizontally(e)}})};this.reverseTextVertically=e=>{Object.values(this.container).forEach(t=>{if(t.type==="text"||t.type==="text-design"){t.setFlipVertically(e)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=e=>{return this.container[e].getData()};this.getContainerTransform=e=>{return this.container[e].getTransform()};this.getDuplicateContainerTransform=e=>{const t=this.container[e].getTransform();const i=this.editor.shortestOutputSide*.1;const o=new A(t.position).add(new A(i,i));return{...t,position:o}};this.getDuplicateContainerFlip=e=>{const t=this.container[e].getFlipHorizontally();const i=this.container[e].getFlipVertically();return{flipHorizontally:t,flipVertically:i}};this.updatePositionAndSize=(e=this.id,t=false)=>{const{position:i,size:o}=this.getSizePositionFromContainer(e);const n=this.state.get(e);if(n){n.position.x=i.x;n.position.y=i.y;n.size.width=o.width;n.size.height=o.height;if(t){const s=this.container[e].getRotation();this.container[e].setRotation(s);n.rotation=this.container[e].getRotation()}this.state.set(e,n)}};this.getInitialTransform=e=>{const t=this.editor.outputToWorld(IKe.position);if(!e){const i=this.editor.outputContainer.getRotation();return{rotation:i,position:t}}return{position:t,...e}};this.setInitialSpriteState=(e,t)=>{const i=this.container[e];const{position:o,size:n}=this.getSizePositionFromContainer(e);const s=i.getRotation();const a=t!=="sticker"?false:i.getFlipHorizontally();const l=t!=="sticker"?false:i.getFlipVertically();this.state.set(e,{tool:t,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l})};this.setStickerSize=e=>{const t=this.container[this.id];t.setSizeInWorldSpace(this.editor.previewSizeToWorld(e));const i=this.currentSprite;if(i){i.size=this.editor.worldSizeToPreview(t.getSizeInWorldSpace());this.state.set(this.id,i)}};this.setTextSize=e=>{let t=this.getContainerProperties(this.id);const i={width:this.editor.previewToWorld(e)};const o=i.width/t.width;const n={fontSize:Math.round(t.fontSize*o)};const s=this.isSpriteText?{...i,...n}:i;if(i.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,s,true);t=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(t.fontSize,true);this.textToolStore.changeWidth(t.width)}};this.setTextDesignScale=e=>{let t=this.getContainerProperties(this.id);const i=t.width*e;if(i>this.minLength){this.setContainerProperties(this.id,{width:i},true);const{width:o}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(o);t=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(t.padding)}};this.getSizePositionFromContainer=(e=this.id)=>{const t=this.container[e];if(t){const i=this.editor.worldToPreview(t.getPosition());const o=this.editor.worldSizeToPreview(t.getSizeInWorldSpace());return{position:i,size:o}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(e=this.id)=>{const t=this.container[e];if(t){return this.editor.worldSizeToPreview(t.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=e;this.container={};this.stickerToolStore=new Ve(e);this.textToolStore=new Ie(e);this.textDesignToolStore=new je(e);this.rect=new tr(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(e,t){return new A(e,t||e).magnitude}static sizeMagnitude(e){return Math.sqrt(e.width*e.width+e.height*e.height)}async updateStateByHistoryState(e,t,i){await(0,Ppe.default)(e,async o=>{const n=t.common[o];if(!n)return;if(this.state.get(o)){this.updateExistingItem(o,t)}else{await this.addNewItem(o,t)}});e.forEach(o=>{const n=t.common[o];const s=this.container[o];if(!n||!s)return;s.setIndexInParent(n.order+i)});this.counter+=1}async addNewItem(e,t){const i=t.common[e];const o=i.size?{width:this.editor.worldToPreview(i.size.width),height:this.editor.worldToPreview(i.size.height)}:void 0;const{flipHorizontally:n,flipVertically:s}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=s!==n?i.rotation-a:i.rotation+a;const u=s!==n?-l:l;const c={spriteId:e,transform:{size:o,position:new A(i.position),rotation:u}};if(t.text[e]){const d=t.text[e];const m=this.textToolStore.validFontWithConfig(d.identifier);d.identifier=m==null?void 0:m.identifier;await this.addNewText(c,d);return}if(t.textdesign[e]){await this.addNewTextDesign(c,t.textdesign[e]);return}if(t.sticker[e]){const d=this.stickerToolStore.items.find(m=>m.identifier===t.sticker[e].identifier);await this.addNewSticker(c,{...t.sticker[e],flipHorizontally:i.flipHorizontally,flipVertically:i.flipVertically,resizeMode:t.sticker[e].resizeMode||(d==null?void 0:d.resizeMode)||"keepAspect"})}}updateExistingItem(e,t){const i=t.common[e];const o=this.state.get(e);this.state.set(e,o);const n=this.container[e];n.setPosition(new A(i.position));n.setRotation(i.rotation);o.rotation=n.getRotation();if(i.flipHorizontally!==void 0){n.setFlipHorizontally(i.flipHorizontally)}if(i.flipVertically!==void 0){n.setFlipVertically(i.flipVertically)}if(t.text[e]){const s=t.text[e];this.textToolStore.updateStateFromHistory(e,{...s,fontIdentifier:s.identifier})}if(t.textdesign[e]){const s=t.textdesign[e];this.textDesignToolStore.updateStateFromHistory(e,{...s,inverted:s.isInverted})}if(t.sticker[e]){n.setSizeInWorldSpace(i.size);this.stickerToolStore.updateStateFromHistory(e,t.sticker[e])}this.updatePositionAndSize(e)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==e5}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:e,flipVertically:t}=this.editor.outputContainer.getData();const i=this.editor.outputContainer.getRotation();return Rb({rotation:this.currentSprite.rotation-i,flipHorizontally:e,flipVertically:t})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const e=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:e,y:t}=this.currentSprite.position;const{height:i,width:o}=this.currentSprite.size;return{x:Math.round(e-o/2),y:Math.round(t-i/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:e}=this.rect;return{x:e.x-this.editor.worldToPreview(this.padding),y:e.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:e}=this.rect;return{x:e.x+this.editor.worldToPreview(this.padding),y:e.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(e){this.selectedId.set(e)}};he=Nb;g([se],he.prototype,"counter",2);g([C],he.prototype,"addSticker",2);g([C],he.prototype,"addStickerAsync",2);g([C],he.prototype,"addText",2);g([C],he.prototype,"addTextAsync",2);g([C],he.prototype,"addTextDesign",2);g([C],he.prototype,"addTextDesignAsync",2);g([C],he.prototype,"clickableCanvas",2);g([C],he.prototype,"setContainerProperties",2);g([C],he.prototype,"setContainerPosition",2);g([C],he.prototype,"pureRemoveSprite",2);g([C],he.prototype,"deleteSprite",2);g([C],he.prototype,"removeSprite",2);g([C],he.prototype,"addSnapshot",2);g([C],he.prototype,"addNewText",2);g([C],he.prototype,"addNewTextDesign",2);g([C],he.prototype,"addNewSticker",2);g([C],he.prototype,"updateStateFromSerialization",2);g([C],he.prototype,"updateStateFromHistory",2);g([C],he.prototype,"updateCanvasControls",2);g([C],he.prototype,"setEditMode",2);g([C],he.prototype,"setDragMode",2);g([C],he.prototype,"setPosition",2);g([C],he.prototype,"setSize",2);g([C],he.prototype,"setRotation",2);g([C],he.prototype,"onCanvasClick",2);g([C],he.prototype,"select",2);g([C],he.prototype,"selectLast",2);g([C],he.prototype,"selectNext",2);g([C],he.prototype,"deselect",2);g([C],he.prototype,"bringToFront",2);g([C],he.prototype,"flipHorizontally",2);g([C],he.prototype,"pureReset",2);g([C],he.prototype,"onCornerDrag",2);g([C],he.prototype,"onWidthDrag",2);g([C],he.prototype,"onPaddingDrag",2);g([C],he.prototype,"correctTextFlip",2);g([C],he.prototype,"reverseTextHorizontally",2);g([C],he.prototype,"reverseTextVertically",2);g([C],he.prototype,"dispose",2);g([S],he.prototype,"currentSprite",1);g([S],he.prototype,"padding",1);g([S],he.prototype,"isEditMode",1);g([S],he.prototype,"isDragMode",1);g([S],he.prototype,"id",1);g([S],he.prototype,"isSpriteSelected",1);g([S],he.prototype,"position",1);g([S],he.prototype,"tool",1);g([S],he.prototype,"size",1);g([S],he.prototype,"rotation",1);g([S],he.prototype,"rotationWRTOutputRotation",1);g([S],he.prototype,"flipHorizontal",1);g([S],he.prototype,"isSpriteSticker",1);g([S],he.prototype,"isSpriteText",1);g([S],he.prototype,"isSpriteTextDesign",1);g([S],he.prototype,"isOnTop",1);g([S],he.prototype,"spritePosition",1);g([S],he.prototype,"currentRect",1);g([S],he.prototype,"leftTopPosition",1);g([S],he.prototype,"leftBottomPosition",1);g([S],he.prototype,"leftMidPosition",1);g([S],he.prototype,"leftMidPadPosition",1);g([S],he.prototype,"rightTopPosition",1);g([S],he.prototype,"rightBottomPosition",1);g([S],he.prototype,"rightMidPosition",1);g([S],he.prototype,"rightMidPadPosition",1);g([S],he.prototype,"leftBottomHandlePosition",1);g([S],he.prototype,"rightBottomHandlePosition",1);g([S],he.prototype,"historyLocale",1);g([S],he.prototype,"stickerLocale",1);g([S],he.prototype,"textLocale",1);g([S],he.prototype,"textDesignLocale",1)});var Bpe=p(()=>{t5()});var EKe,Xi;var r5=p(()=>{Le();P();EKe={categories:[],query:""};Xi=class{constructor(e){this.initProvider=e=>{if(e){this.libraryProvider=new e}};this.fetchImages=async(e="")=>{if(this.libraryProvider){let t=null;try{const i=await this.libraryProvider.getCategories();const o=await this.libraryProvider.searchImages(e);t=i.map((n,s)=>{const a=o.filter(l=>l.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(l=>({name:l.title||`image${s}`,identifier:`${n.name}-${l.title}-${s}`,thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar}))}}).filter(n=>n.items.length)}catch(i){console.log(i)}ar(()=>{this.state.query=e;this.state.categories=t})}};this.toggleCategorySelection=e=>{this.selectedCategory=this.selectedCategory!==e?e:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=e=>{const t=this.items.findIndex(i=>i.identifier===e);if(t!==-1){return this.items[t].rawUrl}return e};this.configStore=e.configStore;this.state=se(EKe);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(e=>e.items).reduce((e,t)=>[...e,...t],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};g([se],Xi.prototype,"selectedCategory",2);g([C],Xi.prototype,"initProvider",2);g([C],Xi.prototype,"fetchImages",2);g([C],Xi.prototype,"toggleCategorySelection",2);g([C],Xi.prototype,"dispose",2);g([S],Xi.prototype,"selectedCategoryIdentifier",1);g([S],Xi.prototype,"categories",1);g([S],Xi.prototype,"items",1);g([S],Xi.prototype,"query",1);g([S],Xi.prototype,"config",1);g([S],Xi.prototype,"locale",1)});var Mpe=p(()=>{r5()});var Lpe,ii;var zpe=p(()=>{P();$s();H();Lpe=(r="image/png")=>`data:${r};base64,`;ii=class{constructor(e){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const t=ge.relativeToAbsolutePoint(e,this.cropSpace,false);return ge.pointFromSpaceToSpace(t,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,t=>t.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:ii.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const t={};if(e.image){t.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(Lpe(),""):""};t.image.data=t.image.data?Lpe()+t.image.data:""}return t}deserializeTransformation(e){const t={};const i=e.operations.find(s=>s.type==="orientation");const o=e.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;t.transform=ii.initializeEmptyTransform();if(i!=null){t.transform.outputRotation=i.options.rotation;t.transform.flipHorizontally=i.options.flipHorizontally||false;t.transform.flipVertically=i.options.flipVertically||false}if(o){t.transform.start=o.options.start;t.transform.end=o.options.end;t.transform.rotation=o.options.rotation||0;t.transform.identifier=o.options.meta?o.options.meta.identifier:""}return t}deserialize(e){var n,s;const t={};if(e.meta?!ii.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const i=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=i;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(a=>{switch(a.type){case"filter":t.filter=ii.deserializeFilter(a.options);break;case"adjustments":t.adjustment=ii.deserializeAdjustments(a.options);break;case"focus":t.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(u=>{switch(u.type){case"frame":t.frame=this.deserializeFrame(u.options);break;case"overlay":t.overlay=ii.deserializeOverlay(u.options);break;case"brush":if(!t.brush){t.brush=this.deserializeBrush(u.options)}else{t.brush.strokes.push(...this.deserializeBrush(u.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!t.sprite){t.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const c=We();t.sprite.spriteIdList.push(c);t.sprite.common[c]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(u.options.position),tool:"sticker",rotation:u.options.rotation||0,flipHorizontally:u.options.flipHorizontally,flipVertically:u.options.flipVertically};this.spriteOrder+=1;if(u.type==="sticker"){t.sprite.common[c].tool="sticker";t.sprite.common[c].size={width:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.y)};t.sprite.sticker[c]=ii.deserializeStickers(u.options)}else if(u.type==="text"){t.sprite.common[c].tool="text";t.sprite.text[c]=this.deserializeTexts(u.options)}else if(u.type==="textdesign"){t.sprite.common[c].tool="textdesign";t.sprite.textdesign[c]=this.deserializeTextDesign(u.options)}break;default:break}});break;default:break}});if(e.assetLibrary){t.customStickers=((s=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return t}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:ii.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:break}return void 0}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new A(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new A(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const t=new A(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new A(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new A(this.mapRelativeCropPointToImageSpace(e.start)).add(new A(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(t.y,t.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:Ss(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:ii.deserialzeColor(e.color),backgroundColor:ii.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:ii.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(t=>{return{path:{controlPoints:t.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:ii.deserialzeColor(t.brush.color),size:t.brush.size,hardness:t.brush.hardness}}})}}}});var Upe,oi;var Npe=p(()=>{P();$s();H();Upe=(r="image/png")=>`data:${r};base64,`;oi=class{constructor(e){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const t=ge.relativeToAbsolutePoint(e,this.cropSpace,false);return ge.pointFromSpaceToSpace(t,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,t=>t.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:oi.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const t={};if(e.image){t.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(Upe(),""):""};t.image.data=t.image.data?Upe()+t.image.data:""}return t}deserializeTransformation(e){const t={};const i=e.operations.find(s=>s.type==="orientation");const o=e.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;t.transform=oi.initializeEmptyTransform();if(i!=null){t.transform.outputRotation=i.options.rotation;t.transform.flipHorizontally=i.options.flipHorizontally||false;t.transform.flipVertically=i.options.flipVertically||false}if(o){t.transform.start=o.options.start;t.transform.end=o.options.end;t.transform.rotation=o.options.rotation||0;t.transform.identifier=o.options.meta?o.options.meta.identifier:""}return t}deserialize(e){var n,s;const t={};if(e.meta?!oi.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const i=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=i;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(a=>{switch(a.type){case"filter":t.filter=oi.deserializeFilter(a.options);break;case"adjustments":t.adjustment=oi.deserializeAdjustments(a.options);break;case"focus":t.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(u=>{switch(u.type){case"frame":t.frame=this.deserializeFrame(u.options);break;case"overlay":t.overlay=oi.deserializeOverlay(u.options);break;case"brush":if(!t.brush){t.brush=this.deserializeBrush(u.options)}else{t.brush.strokes.push(...this.deserializeBrush(u.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!t.sprite){t.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const c=We();t.sprite.spriteIdList.push(c);t.sprite.common[c]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(u.options.position),tool:"sticker",rotation:u.options.rotation||0,flipHorizontally:u.options.flipHorizontally,flipVertically:u.options.flipVertically};this.spriteOrder+=1;if(u.type==="sticker"){t.sprite.common[c].tool="sticker";t.sprite.common[c].size={width:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.y)};t.sprite.sticker[c]=oi.deserializeStickers(u.options)}else if(u.type==="text"){t.sprite.common[c].tool="text";t.sprite.text[c]=this.deserializeTexts(u.options)}else if(u.type==="textdesign"){t.sprite.common[c].tool="textdesign";t.sprite.textdesign[c]=this.deserializeTextDesign(u.options)}break;default:break}});break;default:break}});if(e.assetLibrary){t.customStickers=((s=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return t}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:oi.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:return void 0}}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new A(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new A(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const t=new A(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new A(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new A(this.mapRelativeCropPointToImageSpace(e.start)).add(new A(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(t.y,t.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:Ss(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:oi.deserialzeColor(e.color),backgroundColor:oi.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:oi.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(t=>{return{path:{controlPoints:t.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:oi.deserialzeColor(t.brush.color),size:t.brush.size,hardness:t.brush.hardness}}})}}}});var kKe,DKe,OKe,RKe,AKe,FKe,PKe,BKe,MKe,LKe,zKe,UKe,NKe,qKe,HKe,Hpe;var qpe=p(()=>{kKe="@photoeditorsdk/root";DKe="5.19.2";OKe="The most comprehensive photo editor SDK for HTML5";RKe="http://github.com/imgly/pesdk-html5";AKe="PhotoEditorSDK (img.ly GmbH) ";FKe="SEE LICENSE IN LICENSE.md";PKe=true;BKe={};MKe={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};LKe={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};zKe={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};UKe={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};NKe={eslint:"7.10.0"};qKe=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];HKe={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};Hpe={name:kKe,version:DKe,description:OKe,repository:RKe,author:AKe,license:FKe,private:PKe,bin:BKe,scripts:MKe,devDependencies:LKe,dependencies:zKe,devEngines:UKe,resolutions:NKe,workspaces:qKe,husky:HKe}});var cp;var Wpe=p(()=>{P();$s();qpe();cp=class{constructor(e,t,i,o,n,s){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=e=>{const t=ge.pointFromSpaceToSpace(e,this.imageSpace,this.cropSpace,false);return ge.absoluteToRelativePoint(t,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=e=>{return e/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=e=>{return e/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(e,t=0,i=3)=>{const o=Math.tan(t);const n=Math.sqrt(o**2+1);return{x:e.x+i/n,y:e.y+i*o/n}};this.previewPosition=e;this.previewSize=t;this.outputSize=i;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale()}static serializeFilters(e){return{type:"filter",options:{intensity:e.intensity,identifier:e.identifier}}}static serializeAdjustments(e){return{type:"adjustments",options:e}}static serializeOverlay(e){return{type:"overlay",options:{identifier:e.identifier,intensity:e.opacity,blendMode:e.blendMode.replace(/[A-Z]/g,t=>` ${t.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:Hpe.version,createdAt:new Date().toISOString()}}serialise(e,t,i){const o=cp.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(t){n.type=i;n.data=t}const s=[];const a=[];const{adjustment:l}=e;if(Object.keys(l).map(b=>l[b]).filter(Boolean).length){s.push(cp.serializeAdjustments(l))}const{filter:u}=e;if(u.identifier!=="identity"){s.push(cp.serializeFilters(u))}const{overlay:c}=e;if(c.identifier!=="identity"){a.push(cp.serializeOverlay(c))}if(e.transform){const{transform:b,orientation:_}=this.serializeTransform(e.transform);const y=[b.options.start.x!==0,b.options.start.y!==0,b.options.end.x!==1,b.options.end.y!==1,b.options.rotation!==0];const T=[_.options.rotation!==0,_.options.flipVertically!==false,_.options.flipHorizontally!==false];if(y.some(w=>w)){s.push(b)}if(T.some(w=>w)){s.push(_)}}const{frame:d}=e;if(d.identifier!=="identity"){a.push(this.serialzeFrame(d))}const{focus:m}=e;if(m.identifier!=="identity"){s.push(this.serializeFocus(m))}if(e.sprite){e.sprite.spriteIdList.forEach(b=>{const _=e.sprite.common[b];switch(_.tool){case"sticker":const y=e.sprite.sticker[b];a.push(this.serializeSticker(y,_,e.transform));break;case"text":const T=e.sprite.text[b];a.push(this.serializeText(T,_));break;case"textdesign":const w=e.sprite.textdesign[b];a.push(this.serializeTextDesign(w,_));break;default:break}})}if(e.brush.strokes.length){a.push({type:"brush",options:{paths:e.brush.strokes.map(b=>{return{points:b.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:b.brush.color},size:b.brush.size,hardness:b.brush.hardness}}})}})}if(a.length){const b={type:"sprite",options:{sprites:a}};s.push(b)}const h=e.customStickers;const f={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:f}}serialzeFrame(e){return{type:"frame",options:{identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.color},size:this.mapSizeToRelativeUnscaledCropSize(e.width)}}}serializeFocus(e){const t=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(e.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(e.linear.start),end:this.mapImagePointToRelativeCropPoint(e.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(e.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(e.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(e.radial.center,0,e.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(e.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:i}=e;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(i.origin,i.rotation,t/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(i.origin,i.rotation,-t/2)),size:this.mapSizeToRelativeScaledCropSize(e.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(e.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(e.gaussian.blurRadius)}}}}}serializeSticker(e,t,i){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(t.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(t.size.width),y:this.mapSizeToRelativeScaledCropSize(t.size.height)},rotation:t.rotation,flipVertically:(t.flipVertically||false)!==(i.flipVertically||false),flipHorizontally:(t.flipHorizontally||false)!==(i.flipHorizontally||false),identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.tintColor},tintMode:e.tintMode}}}serializeText(e,t){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(t.position),rotation:t.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:e.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(e.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(e.width),text:e.text,lineHeight:e.lineHeight,color:{rgba:e.textColor},backgroundColor:{rgba:e.backgroundColor},alignment:e.alignment}}}serializeTextDesign(e,t){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(t.position),rotation:t.rotation,flipVertically:false,flipHorizontally:false,identifier:e.identifier,inverted:e.isInverted,text:e.text,seed:e.seed,width:this.mapSizeToRelativeScaledCropSize(e.width),padding:this.mapSizeToRelativeScaledCropSize(e.padding),color:{rgba:e.color}}}}serializeTransform(e){const{start:t,end:i}=e;const o={type:"transform",options:{start:t,end:i,rotation:e.rotation,meta:{identifier:e.identifier}}};const n={type:"orientation",options:{rotation:e.outputRotation,flipHorizontally:e.flipHorizontally,flipVertically:e.flipVertically}};return{transform:o,orientation:n}}}});var i5={};St(i5,{Deserializers:()=>WKe,Serializer:()=>cp});var WKe;var o5=p(()=>{zpe();Npe();Wpe();WKe={"3.9.0":oi,"3.12.0":ii}});var Gpe,GKe,VKe,jKe,qb;var Vpe=p(()=>{Le();P();H();Gpe=/^data:image\/(.+?);base64,/;GKe=r=>Gpe.test(r);VKe=r=>r.match(/^data:([^;]+)/)[1];jKe=r=>r.replace(Gpe,"");qb=class{constructor(e){this.applySerialization=async(e,t,i,o)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const s="Unexpected error occured";const a=t.deserializeImage(e);if(a.image&&a.image.data){const c=a.image.data;await this.editor.setImage(c);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(c);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const l=t.deserializeTransformation(e);if(!l){o(s);return}await this.applyStateOnUI(l);const u=t.deserialize(e);if(!u){o(s);return}await this.applyStateOnUI(u);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}i()};this.editor=e}serialize({image:e}={image:false}){const t=this.editor.activeStore.tool==="transform";const{displaySerializationModal:i}=this.editor.configStore.config;if(i){this.editor.modalStore.showInfoModal("saving")}return new Promise((o,n)=>{Promise.resolve().then(()=>(o5(),i5)).then(async({Serializer:s})=>{try{if(t){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:a}=this.editor.imageContainer.getData();const l=this.editor.engineMediator.output.container.getResolution();const u={width:a.width,height:a.height};const c=new s(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,l,u,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const d={["adjustment"]:_e(this.editor.adjustmentsToolStore.state),["filter"]:_e(this.editor.filterToolStore.state),["focus"]:_e(this.editor.focusToolStore.serializableState),["overlay"]:_e(this.editor.overlayToolStore.state),["frame"]:_e(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:m,customStickers:h}=await this.editor.spriteStore.serializableState();m.spriteIdList=m.spriteIdList.sort((_,y)=>{const T=m.common[_].order;const w=m.common[y].order;return T-w});d.sprite=m;d.customStickers=h;d.transform=this.editor.transformToolStore.serializableState;let f;let b;if(e){const _=qb.getDataURL(a);b=VKe(_);f=jKe(_)}if(i){this.editor.modalStore.hideModal()}o(c.serialise(d,f,b));if(t){this.editor.transformToolStore.onEnter()}}catch(a){if(i){this.editor.modalStore.hideModal()}n(a)}})})}deserialize(e){this.editor.modalStore.showInfoModal("loading");return new Promise((t,i)=>{try{Promise.resolve().then(()=>(o5(),i5)).then(({Deserializers:o})=>{const n=e.version.match(/[0-3].[0-8].[0-9]/i);let s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](this.editor)}else if(o[e.version]){s=new o[e.version](this.editor)}else{s=new o["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(e,s,t,i)})}else{this.applySerialization(e,s,t,i)}})}catch(o){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}i(o)}})}static getDataURL(e){if(e instanceof HTMLImageElement){const{src:n}=e;if(GKe(n)){return n}}if(e instanceof HTMLCanvasElement){return e.toDataURL("image/png")}const t=document.createElement("canvas");t.width=e.width;t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0);const o=t.toDataURL("image/png");nt(t);return o}async applyStateOnUI(e){const t=this.editor.activeStore.tool==="transform";try{if(e.transform){if(!t){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(e.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!t){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(e.filter){await this.editor.filterToolStore.updateStateFromSerialization(e.filter)}if(e.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(e.adjustment)}if(e.focus){await this.editor.focusToolStore.updateStateFromSerialization(e.focus)}if(e.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(e.overlay)}if(e.sprite){let i=Object.keys(e).length-1;if(e.customStickers){i-=1}e.sprite.spriteIdList=e.sprite.spriteIdList.sort((o,n)=>{const s=e.sprite.common[o].order;const a=e.sprite.common[n].order;return s-a});await this.editor.spriteStore.updateStateFromSerialization(e.sprite,e.customStickers,Math.max(0,i))}if(e.brush){this.editor.brushToolStore.updateStateFromHistory(e.brush)}if(e.frame){await this.editor.frameToolStore.updateStateFromSerialization(e.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(i){if(i.name==="AssetNotFoundError"){console.error(i)}else{console.error(i);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:i.message,handleConfirm:()=>{this.applyStateOnUI(e)}})}}}}});var $Ke,n5;var jpe=p(()=>{$Ke=r=>{const e=atob(r.split(",")[1]);const t=r.split(",")[0].split(":")[1].split(";")[0];const i=new ArrayBuffer(e.length);const o=new Uint8Array(i);for(let n=0;n{P();$pe=r=>r.split(",")[0].split(":")[1].split(";")[0];Kpe=r=>{if(typeof r==="string"){return $pe(r)}if(r.src.includes(".svg")){return"image/svg+xml"}if(r.src){return $pe(r.src)}return"image/jpeg"}});var Ww,Hb;var Ype=p(()=>{Db();Ww=v(Fm());P();$s();Hb=class{static isImageElement(e){return e instanceof HTMLImageElement}constructor({license:e,assetProvider:t,crossOrigin:i,backgroundColor:o}){this.crossOrigin=i;this.engine=new Jh({license:e,crossOrigin:i,assetProvider:t,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:o})}getAllFilterPreviewThumbnails(e){return new Promise((t,i)=>{const o=[];const n=[];e.forEach(s=>{if(s.isDuotone)o.push(s.identifier);else n.push(s.identifier)});this.getAllDuotonePreview(o).then(s=>{this.getAllLutPreview(n).then(a=>{t(Object.assign(s,a))}).catch(a=>{i(a)})}).catch(s=>{i(s)})})}async getAllDuotonePreview(e){const t={};if(!e.length)return t;const i=await this.engine.addDuoToneFilterFromAssets(e[0],this.container);await(0,Ww.default)(e,async o=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(o);const s=i.filterOperation.getFilter();s.set({intensity:.5,lightColor:fe.Color.fromHex(n.lightColor),darkColor:fe.Color.fromHex(n.darkColor)});const a=await this.engine.export("data-url","image/jpeg",.8,false,true);t[o]=a},{concurrency:1});this.engine.removeEffect(i);return t}async loadLutAssets(e){const t={};await(0,Ww.default)(e,async i=>{t[i]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",i))});return t}async getAllLutPreview(e){const t={};if(!e.length)return t;const i=await this.loadLutAssets(e);const o=await this.engine.addLUTFilterFromAssets(e[0],this.container);await(0,Ww.default)(e,async n=>{const s=this.engine.assetProvider.getLUTFilterAsset(n);const a=o.filterOperation.getFilter();const l={horizontalTileCount:s.horizontalTileCount||5,verticalTileCount:s.verticalTileCount||5,image:i[n]};a.set({...l,intensity:s.defaultIntensity||1});o.setProperties({intensity:1});a._lutPrimitive.set(l);const u=await this.engine.export("data-url","image/jpeg",.8,false,true);t[n]=u},{concurrency:1});this.engine.removeEffect(o);return t}addImageToContainer(e){return new Promise((t,i)=>{let o;if(Hb.isImageElement(e)){o=e;this.setBackgroundImage(o);t()}else{this.getImageElement(e).then(n=>{o=n;this.setBackgroundImage(o);t()}).catch(n=>{i({identifier:"imageLoading",message:n.message})})}})}getImageElement(e){return new Promise((t,i)=>{const o=new Image;o.addEventListener("load",()=>{t(o)});o.addEventListener("error",n=>{i(n)});o.crossOrigin=this.crossOrigin;o.src=e})}setBackgroundImage(e){if(!this.container){this.container=this.engine.addImage({image:e,blendMode:"normal",opacity:1})}else{this.container.setData({image:e})}const{size:t}=this.container.getBounds();const i=this.engine.getOutputContainer();i.setResolution(t)}}});var KKe,Gn;var s5=p(()=>{Le();H();KKe={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};Gn=class{constructor(e){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(e,t)=>{const{height:i,width:o}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:s,snapToTop:a,snapToBottom:l}=this.configStore.config.snapping.position;const u=Math.min(i,o);let c=0;if(t==="bottom"){c=Math.round(i-u*l)}else if(t==="top"){c=Math.round(u*a)}else if(t==="right"){c=Math.round(o-u*s)}else if(t==="left"){c=Math.round(u*n)}else if(e==="vertical"&&t==="center"){c=Math.round(o/2)}else if(e==="horizontal"&&t==="center"){c=Math.round(i/2)}return c};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:e,snapToLeft:t,snapToRight:i}=this.configStore.config.snapping.position;const o=[];if(e){o.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(t){o.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(i){o.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return o};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:e,snapToTop:t,snapToBottom:i}=this.configStore.config.snapping.position;const o=[];if(e){o.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(t){o.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(i){o.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return o};this.getRotationGuidesFromConfig=()=>{const{angles:e}=this.configStore.config.snapping.rotation;const t=[];e.forEach(o=>{t.push(o);t.push(o+360);t.push(o-360)});const i=t.filter((o,n)=>t.indexOf(o)===n);return i.map(o=>({value:o*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:e,leftBottom:t,rightTop:i,rightBottom:o})=>{const n=Math.min(e.y,i.y,t.y,o.y);const s=Math.max(e.y,i.y,t.y,o.y);const a=Math.min(e.x,i.x,t.x,o.x);const l=Math.max(e.x,i.x,t.x,o.x);return{height:Math.round(s-n),width:Math.round(l-a)}};this.mapRange=({value:e,fromMin:t,fromLength:i,toMin:o,toLength:n})=>{return(e-t)*n/i+o};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(e,t,i,o)=>{if(t.length===0){return e}if(t[0]>e){return e-i}for(let n=0;n=a-d){return a+c+(o?i*2:0)}return this.mapRange({value:e,fromMin:s,fromLength:a-s,toMin:l,toLength:u-l})}}if(o){return e+(t.length-1)*i*2+i}return e};this.mapFromSnapSystem=(e,t,i,o)=>{if(t.length===0){return e}if(t[0]>e){if(e>=t[0]-i){return t[0]}return e+i}let n=e;for(let a=0;a{const i=t*.5;const{value:o,edge:n}=e;let s=o;if(n==="leading"){s+=i}else if(n==="trailing"){s-=i}return s};this.mapSnappingGuidesToCenter=(e,t)=>{const i=[];e.forEach(o=>{i.push(this.centerSnapValue(o,t))});return i};this.calcSnapThresholdInRadians=(e,t)=>{if(e===0){return 0}return t/e};this.calculatePreviewTopLeftPosition=()=>{const e=this.editor.engineMediator.preview.container.getPosition();const t=this.editor.getPreviewSize();const i=En();this.previewTopLeftPosition={x:e.x/i-t.width/2,y:e.y/i-t.height/2}};this.snapToRotation=(e,t,i)=>{const{rotationGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.rotation;const{x:a,y:l}=this.previewTopLeftPosition;const{width:u}=this.editor.getPreviewSize();let c=(e+Math.PI*2)%(Math.PI*2);if(n){const d=new A(t).magnitude;const m=o.map(b=>b.value).sort((b,_)=>b-_);const h=this.calcSnapThresholdInRadians(d,s);if(!this.rotationOffset){const b=this.mapToSnapSystem(e,m,h,false);this.rotationOffset=b-c}c=this.mapFromSnapSystem(c+this.rotationOffset,m,h,false);const f={x:i.position.x-a-u,y:i.position.y-l};o.forEach(b=>{b.isVisible=b.value===c;b.position=f});return c}return e};this.snapToPosition=(e,t)=>{const{horizontalGuides:i,verticalGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.position;const a=new A(this.previewTopLeftPosition);const{height:l,width:u}=this.getSpriteDimensions(t);const{x:c,y:d}=new A(e).subtract(a);if(n){const m=this.mapSnappingGuidesToCenter(i,l).sort((_,y)=>_-y);const h=this.mapSnappingGuidesToCenter(o,u).sort((_,y)=>_-y);if(!this.positionOffset){const _=this.mapToSnapSystem(c,h,s,true);const y=this.mapToSnapSystem(d,m,s,true);this.positionOffset=new A(_,y).subtract(new A(c,d))}let f=this.mapFromSnapSystem(c+this.positionOffset.x,h,s,true);let b=this.mapFromSnapSystem(d+this.positionOffset.y,m,s,true);f=Math.round(f);b=Math.round(b);i.forEach(_=>{const y=Math.round(this.centerSnapValue(_,l));_.isVisible=y===b});o.forEach(_=>{const y=Math.round(this.centerSnapValue(_,u));_.isVisible=y===f});return new A(f,b).add(a)}return{x:c,y:d}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=e;this.configStore=e.configStore;this.state=se(KKe);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(e=>({...e,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(e=>({...e,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(e=>({...e,isVisible:false}))}get positionGuides(){const{verticalGuides:e,horizontalGuides:t}=this.state;return[...e,...t]}get rotationGuides(){return this.state.rotationGuides}};g([se],Gn.prototype,"state",2);g([C],Gn.prototype,"snapToRotation",2);g([C],Gn.prototype,"snapToPosition",2);g([C],Gn.prototype,"hidePositionGuides",1);g([C],Gn.prototype,"hideRotationGuides",1);g([C],Gn.prototype,"dispose",2);g([S],Gn.prototype,"positionGuides",1);g([S],Gn.prototype,"rotationGuides",1)});var ic;var Jpe=p(()=>{Le();P();$s();H();Uw();Nw();Mw();VM();zw();qw();Hw();Vpe();aM();uM();cM();TM();r5();pM();jpe();Xpe();Ype();EM();s5();t5();QM();ic=class{constructor(e,t){this.initWithImage=async e=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(e);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const t=this.configStore.config.engine;this.previewThumbnails=new Hb({...t,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(t){this.configStore.events.onErrorImageLoading(t);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:t.identifier?t.identifier:"rendering",error:t,handleConfirm:()=>{this.initWithImage(e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:e,height:t})=>{const{maxMegaPixels:i}=this.configStore.config.engine.downscaleOptions;const o=Jg.isMobile()?i.mobile:i.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${o}`,width:`${e}`,height:`${t}`}})})};this.init=e=>{var o,n;if(!((o=this.activeStore)==null?void 0:o.image)){this.initWithImage(e);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const t=this.historyStore.isDirty();const{displayDiscardChangesWarning:i}=this.configStore.config;if(t&&i){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(e);this.resetToolStates()},handleDismiss:()=>{this.setImage(e,true)}});return}if(t&&!i){this.setImage(e,true);return}this.historyStore.reset();this.setImage(e,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:s,displayCanvasRendererWarning:a}=this.configStore.config;if(s.preferredRenderer==="canvas"&&a){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(e,t=false)=>{try{if(!this.activeStore.image){this.initWithImage(e)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(e);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:i,flipVertically:o,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:o,flipHorizontally:i});await this.transformToolStore.rotateOutputContainer(ny(n),false);if(t){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const s=this.activeStore.tool;if(!s){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(i){this.configStore.events.onErrorImageLoading(i);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:i.identifier?i.identifier:"rendering",error:i,handleConfirm:()=>{this.setImage(e,t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(i)}};this.onToolChange=(e,t=null,i=true)=>{var o,n;if(e===t){return}if((n=(o=this.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([e,t].indexOf("transform")!==-1){if(e==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(t==="transform"){this.transformToolStore.onEnter()}this.resize(t)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(i){this.render()}}};this.resize=(e=null)=>{if(!this.engineMediator)return;try{const t=this.activeStore.tool;const i=e==="transform"||!e&&t==="transform";this.canvasStore.resizeCanvas(e);this.transformToolStore.applyDefaultCrop();const o=_e(this.transformToolStore.maxCropMaskSize);if(!i){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const s=this.engineMediator.preview.updateTransform(n);if(s){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(o);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const a=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(a);if(!i){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(t){this.configStore.events.onErrorImageLoading(t);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:e,...t}={})=>{const i=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(i){this.transformToolStore.onLeave()}const{config:o}=this.configStore;const n={...o.export.image,...t};const{exportType:s,format:a,quality:l,enableDownload:u,transparent:c}=n;const d=await this.engineMediator.engine.export(s,a,l,c);if(i&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(u){this.triggerFileDownload(o.export.filename,a,s,d)}if(!e){this.configStore.events.onExport(d)}return d}catch(o){if(this.modalStore){this.modalStore.hideModal()}if(i&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(o)}};this.serialize=({image:e}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:e})}return Promise.resolve({})};this.deserialize=e=>{if(this.serializationMediator){return this.serializationMediator.deserialize(e)}return Promise.resolve()};this.close=()=>{var e,t,i,o,n,s;if((((e=this.historyStore)==null?void 0:e.isDirtySinceSave)||((i=(t=this.transformToolStore)==null?void 0:t.transformHistory)==null?void 0:i.hasChanges()))&&((n=(o=this.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var a;if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}}})}else if((s=this.configStore)==null?void 0:s.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:e,height:t}=this.engine.getOutputDimensions();return{width:e,height:t}}return{width:0,height:0}};this.wait=(e=0)=>new Promise(t=>setTimeout(t,e));this.clickableCanvas=async e=>{if(e){await new Promise(t=>setTimeout(t,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:e}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(e){const t=this.transformToolStore.localOutputImageSize;const i=t.width/t.height;const o=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(o.indexOf(parseFloat(i.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(e,t,i)=>{this.historyStore.addSnapshot(e,t,i)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=e=>this.assetProvider.getPathForCategory(e);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=e=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(e)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:e,height:t}=this.engine.getOutputDimensions();if(e&&t){return{width:Math.round(this.worldToPreview(this.outputToWorld(e))),height:Math.round(this.worldToPreview(this.outputToWorld(t)))}}return{height:t,width:e}};this.getImageMimeType=()=>{return Kpe(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var e,t,i;(i=(t=(e=this.engineMediator)==null?void 0:e.image)==null?void 0:t.container)==null?void 0:i.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(e,t,i,o)=>{const n=t==="image/jpeg"&&i!=="ms-blob"?".jpeg":".png";const s=e+n;const a=this.blobFromExportData(o);this.triggerBlobDownload(s,a)};this.triggerBlobDownload=(e,t)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(t,e)}else{const i=document.createElement("a");const o=URL.createObjectURL(t);i.href=o;i.download=e;document.body.appendChild(i);i.click();document.body.removeChild(i);if(!CK()){URL.revokeObjectURL(o)}}};this.blobFromExportData=e=>{if(typeof e==="string"){return n5(e)}if(e instanceof HTMLImageElement){return n5(e.src)}return e};this.configStore=new Ii;if(t){Object.entries(t).forEach(([o,n])=>{this.configStore.events.on(o,n)})}const i=this.configStore.saveConfig(e);this.engineMediator=new GM(this);this.serializationMediator=new qb(this);this.spriteStore=new he(this);this.scale=new _r(this);this.filterToolStore=new or(this);this.adjustmentsToolStore=new dt(this);this.focusToolStore=new Ge(this);this.overlayToolStore=new yr(this);this.frameToolStore=new Xt(this);this.brushToolStore=new qt(this);this.transformToolStore=new ae(this);this.libraryStore=new Xi(this);this.modalStore=new Do(this);this.snappingStore=new Gn(this);this.activeStore=new Ki(this);this.canvasStore=new ri(this);this.historyStore=new lp(this);this.libraryStore.initProvider(i);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const e=this.outputContainer.getBounds();return Math.min(e.width,e.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(e,t){if(!this.engineMediator)return{x:0,y:0};if(Ho(e)){return this.engineMediator.previewSpaceToWorldSpace(e,t)}return this.engineMediator.previewSpaceToWorldSpace(e,t)}worldToPreview(e){if(!this.engineMediator)return{x:0,y:0};if(Ho(e)){return this.engineMediator.worldSpaceToPreviewSpace(e)}return this.engineMediator.worldSpaceToPreviewSpace(e)}worldSizeToPreview(e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(e.width),height:this.engineMediator.worldSpaceToPreviewSpace(e.height)}}previewSizeToWorld(e,t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(e.width,t),height:this.engineMediator.previewSpaceToWorldSpace(e.height,t)}}outputToWorld(e){if(!this.engineMediator)return{x:0,y:0};if(Ho(e)){return this.engineMediator.outputSpaceToWorldSpace(e)}return this.engineMediator.outputSpaceToWorldSpace(e)}previewToOutput(e){if(!this.engineMediator)return{x:0,y:0};if(Ho(e)){return this.engineMediator.previewSpaceToOutputSpace(e)}return this.engineMediator.previewSpaceToOutputSpace(e)}get outputContainer(){return this.engineMediator.output.container}};g([C],ic.prototype,"resize",2);g([C],ic.prototype,"export",2);g([C],ic.prototype,"clickableCanvas",2)});var at=p(()=>{H();$i();Tw();Ude();aM();uM();cM();pM();epe();ope();npe();TM();upe();Fpe();Bpe();Mpe();Hw();zw();Jpe();FM();Mw();Uw();Nw();qw();s5();Bb();zb();Mb();tc();Xs();Yh()});var Wb,Gb,Zpe,Qpe,XKe,YKe,eme;var tme=p(()=>{Wb=v(require("react"));M();Gb=v(require("styled-components"));P();at();H();ur();Zpe=Se.Button.TextSecondary;Qpe=Gb.default.span` + 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:t,background:c},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};LM=mKe});var Lb,Bw,ko;var zb=p(()=>{Mb();ype();bpe();Lb=Pw();Bw=Fw();ko={...Lb,measurements:Bw}});var fKe,_pe;var vpe=p(()=>{tc();zb();fKe=r=>{if(r==="light"){return LM}return Pw};_pe=(r,e)=>{const t=fKe(r);if(e&&e[r]){const{primary:i,background:o,foreground:n}=e[r];const s={primary:i,background:o,foreground:n};const a=Object.keys(s).reduce((l,u)=>{if(s[u]){return{...l,[u]:s[u]}}return l},{});return ti([t(a),e[r]])}return t()||Lb}});var gKe,xpe;var Cpe=p(()=>{tc();Mb();gKe=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];xpe=r=>{const e=Fw();if(r){const t={};Object.keys(r).forEach(i=>{if(gKe.indexOf(i)!==-1){t[i]=r[i]}});return ti([e,t])}return e}});var Spe=p(()=>{gpe();vpe();Cpe()});var yKe,Ii;var Mw=p(()=>{Le();P();$s();H();tc();FM();dpe();sM();Bb();Spe();zb();yKe={config:Qu,locale:ap,theme:Lb,measurements:Bw,initialMeasurements:Bw};Ii=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(e,t)=>{return t.indexOf(e)!==-1};this.state=se(yKe);this.events=new AM;this.licenseChecker=null}saveConfig(e){if(e.mainCanvasActions&&e.mainCanvasActions.length!==4){e.mainCanvasActions.length=4}const t=e.layout&&e.layout==="basic"?PM:Qu;const i=ti([t,e],{clone:true});this.licenseChecker=new Sw(i.license);if(!this.licenseChecker.areCustomAssetsAllowed()){i.sticker.enableCustomUpload=false}const o=fpe(i.language,i.custom.languages);const n=_pe(i.theme,i.custom.themes);const s=xpe(i.custom.measurements);const{provider:a}=i.library;const l=[];i.adjustment.categories=i.adjustment.categories.reduce((d,m)=>{d.push({...m,items:m.items.filter(h=>{if(!vO[h.identifier]){l.push(h.identifier);return false}return true})});return d},[]);if(l.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${l.join(", ")}`)}delete i.language;delete i.custom.languages;delete i.custom.themes;delete i.library.provider;let u=i.tools.reduce((d,m)=>{if(typeof m==="object"){return[...d,...m]}return[...d,m]},[]);if(!u.length){console.error(`Empty list input for tools`);u=ww.reduce((d,m)=>{if(typeof m==="object"){return[...d,...m]}return[...d,m]},[])}u=u.filter(d=>this.licenseChecker.isToolAllowed(d));if(i.defaultTool){const d=this.checkDefaultToolAvailability(i.defaultTool,u);if(!d){[i.defaultTool]=u}}i.tools=u;this.state.config=i;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;const c=this.buildCustomAssetsConfig();this.assetProvider=new oy(c,this.licenseChecker.areCustomAssetsAllowed(),i.assetResolver);this.loadThemeFont();return a}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((e,t)=>{if(typeof t==="string"){return[...e,t]}return[...e,"",...t]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:e}=this.theme;if(!e.skipLoading){this.assetProvider.getFontManager().injectFonts([e])}}buildCustomAssetsConfig(){const e=this.tools;const t=_e(this.state.config);const i=this.state.config.assetBaseUrl;const{theme:o}=this.state;const n=e.indexOf("filter")!==-1?t["filter"]:void 0;const s=e.indexOf("focus")!==-1?t["focus"]:void 0;const a=e.indexOf("adjustment")!==-1?t["adjustment"]:void 0;const l=e.indexOf("sticker")!==-1?t["sticker"]:void 0;const u=e.indexOf("frame")!==-1?t["frame"]:void 0;const c=e.indexOf("overlay")!==-1?t["overlay"]:void 0;const d=e.indexOf("transform")!==-1?t["transform"]:void 0;const m=e.indexOf("text")!==-1?t["text"]:void 0;const h=e.indexOf("textdesign")!==-1?t["textdesign"]:void 0;return{basePath:i,theme:o,filter:n,focus:s,sticker:l,frame:u,overlay:c,transform:d,text:m,adjustment:a,textdesign:h}}};g([C],Ii.prototype,"saveConfig",1);g([C],Ii.prototype,"dispose",2);g([S],Ii.prototype,"config",1);g([S],Ii.prototype,"locale",1);g([S],Ii.prototype,"theme",1);g([S],Ii.prototype,"measurements",1);g([S],Ii.prototype,"initialMeasurements",1);g([S],Ii.prototype,"tools",1);g([S],Ii.prototype,"defaultTool",1);g([S],Ii.prototype,"isOrderDefault",1);g([S],Ii.prototype,"isLayoutAdvanced",1);g([S],Ii.prototype,"displayCloseButton",1)});var zM;var UM=p(()=>{P();bO();zM=class{constructor(e){this.editor=e}setBackgroundImage(e){if(!this.container){this.container=this.engine.addImage({image:e,originalImage:e,blendMode:"normal",opacity:1})}else{this.container.setData({image:e,originalImage:e})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((e,t)=>{const{image:i}=this.editor.activeStore;if(IK(i)){this.setBackgroundImage(i);e()}else{const o=this.editor.libraryStore.getRawUrl(i);this.getImageElement(o).then(n=>{this.setBackgroundImage(n);e()}).catch(n=>{t({identifier:"imageLoading",message:n.message})})}})}getImageElement(e){return new Promise((t,i)=>{const o=new Image;o.addEventListener("load",()=>{t(o)});o.addEventListener("error",n=>{i(n)});o.crossOrigin=this.editor.configStore.config.engine.crossOrigin;o.src=e})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}}});var NM;var qM=p(()=>{H();NM=class{constructor(e){this.applyNewImageTransform=()=>{const{size:e,width:t,height:i}=this.editor.engineMediator.image.container.getBounds();const o=this.container;o.setTransform(yt.IDENTITY);o.setResolution(e);o.setPivot(.5,.5);o.setPosition({x:t/2,y:i/2})};this.editor=e}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}}});function Ub(r,e){const t=r.width/r.height;const i=e.width/e.height;if(t>i){return r.height/e.height}return r.width/e.width}var wpe=p(()=>{});var bKe,Cl;var HM=p(()=>{Le();H();wpe();bKe={transform:yt.IDENTITY};Cl=class{constructor(e){this.initialTransform=yt.IDENTITY;this.editor=e;this.state=se(bKe)}createPreview(e){this.container=this.editor.engine.createPreview(e)}updateTransform(e=0,t=true){const i=this.calculateTransform(e);if(i.scale.x){if(t){this.saveInitialTransform(i)}else{this.savePreviewTransform(i)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(e){this.initialTransform=e;this.savePreviewTransform(e)}savePreviewTransform(e){ar(()=>{this.state.transform.position=e.position;this.state.transform.scale=e.scale;this.state.transform.rotation=e.rotation;const t=En();const i=new A(e.scale).divide(t);this.previewTransformWithoutDpr={position:new A(e.position).divide(t),scale:i,rotation:e.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(e=0){const t=En();const{scaleImageToFit:i}=this.editor.configStore.config;const{width:o,height:n}=this.editor.canvasStore.canvasSize;const s=this.editor.engine.getOutputDimensions();const a=Ub({width:o,height:n},s);let l=i?a:Math.min(1,a);const u=n-s.height*l;const c=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(un*d){l=Ub({width:o,height:n*d},s)}if(s.width*l>o*d){l=Ub({width:o*d,height:n},s)}l*=t;const m={x:o*t/2,y:n*t/2};const h={x:l,y:l};return new yt(m,h,e)}};g([C],Cl.prototype,"updateTransform",1);g([C],Cl.prototype,"savePreviewTransform",1);g([S],Cl.prototype,"transform",1);g([S],Cl.prototype,"position",1);g([S],Cl.prototype,"scale",1);g([S],Cl.prototype,"rotation",1)});var rc,Lw;var WM=p(()=>{P();rc=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(e){if(["sticker","text","textdesign","brush"].indexOf(e)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(e,t){const i=t.findIndex(o=>o===e);if(i!==-1){t.splice(i,1)}return void 0}static indexForOrder(e,t,i){const o=e[i];const n=t.findIndex(a=>a===i);if(n!==-1){return{index:n,order:t}}const{length:s}=t;if(s){let a;for(a=0;ao===e);if(i!==-1){this.spriteContainerOrder[i]=t}}bringToFront(e){const t=this.spriteContainerOrder.findIndex(i=>i===e);if(t!==-1){this.spriteContainerOrder.splice(t,1);this.spriteContainerOrder.push(e)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:e}=this.spriteContainerOrder;return this.spriteContainerOrder[e-1]}getSpriteIndex(e){const t=this.spriteContainerOrder.findIndex(i=>i===e);return t+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};Lw=rc;Lw.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3}});var GM;var VM=p(()=>{$s();H();UM();qM();HM();WM();GM=class{constructor(e){this.orderHelper=new Lw;this.init=()=>{const e=this.editor.configStore.config.engine;this.engine=new Jh({...e,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new zM(this.editor);this.output=new NM(this.editor);this.preview=new Cl(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=e}render(e){return this.engine.render(e)}previewSpaceToWorldSpace(e,t){const i=this.preview.previewTransformWithoutDpr;if(Ho(e)){const o=this.editor.engine.convertPointFromPreviewIntoWorldSpace(A.ZERO,i,t);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:e,y:0},i,t);return A.distance(new A(o),new A(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(e,i,t)}worldSpaceToPreviewSpace(e){const t=this.preview.previewTransformWithoutDpr;if(Ho(e)){const i=this.editor.engine.convertPointFromWorldIntoPreviewSpace(A.ZERO,t);const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:e,y:0},t);return A.distance(new A(i),new A(o))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(e,t)}outputSpaceToWorldSpace(e){if(Ho(e)){return ge.getScalarInWorldSpace(e,this.editor.engine.getOutputContainer())}return ge.getPointInWorldSpace(e,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(e){const t=this.preview.previewTransformWithoutDpr;if(Ho(e)){const i=this.editor.engine.convertPointFromPreviewIntoOutputSpace(A.ZERO,t);const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:e,y:0},t);return A.distance(new A(i),new A(o))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(e,t)}previewSpaceToFlippedPreviewSpace(e){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(e)}}});var rf;var Tpe=p(()=>{Le();rf=class{constructor(){this.snapshots=[];this.observeIndex=se.box(-1)}addSnapshot(e){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(e))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(e)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(e){if(e>0&&e0}get canRedo(){return this.snapshots.length-1>this.index}};g([S],rf.prototype,"index",1);g([S],rf.prototype,"canUndo",1);g([S],rf.prototype,"canRedo",1)});var lp;var zw=p(()=>{Le();P();Tpe();Ti();lp=class{constructor(e){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const e=this.appHistoryManager.undo();await this.applyState(e);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const e=this.appHistoryManager.redo();await this.applyState(e);this.awaitHistoryChange=false}};this.editor=e;this.appHistoryManager=new rf}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const e=_e(this.editor.adjustmentsToolStore.state);const t=_e(this.editor.filterToolStore.state);const i=this.editor.focusToolStore.getFocusStateForHistory();const o=_e(this.editor.overlayToolStore.state);const n=_e(this.editor.frameToolStore.state);const{strokes:s}=this.editor.brushToolStore;const a=this.editor.spriteStore.getSpriteHistoryState();const l=this.editor.transformToolStore.serializableState;return{["adjustment"]:e,["filter"]:t,["focus"]:i,["overlay"]:o,["frame"]:n,["brush"]:s,sprite:a,["transform"]:l}}addInitialSnapshot(){const e=this.getHistoryState();this.appHistoryManager.addSnapshot({state:e,type:"add",description:"Initial State"})}addSnapshot(e,t,i){let o;if(!e){o=this.getHistoryState()}else if(e.sprite||e.transform){o={...this.getHistoryState(),...e}}else{o=e}this.appHistoryManager.addSnapshot({state:o,type:t,description:i});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:e}){try{if(e){const t=Object.keys(e);for(const i of t){switch(i){case"filter":await this.editor.filterToolStore.updateStateFromHistory(e[i]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(e[i]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(e[i]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(e[i]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(e[i],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(e[i]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(e[i]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(e[i]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(t){console.error(t);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:t,handleConfirm:()=>{this.applyState({state:e})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var e,t;return(t=(e=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:e.state)==null?void 0:t.sprite}};g([C],lp.prototype,"undo",2);g([C],lp.prototype,"redo",2);g([S],lp.prototype,"canUndo",1);g([S],lp.prototype,"canRedo",1)});var _Ke,Ipe,vKe,jM;var Epe=p(()=>{_Ke=(r,e)=>new Promise((t,i)=>{const o=new XMLHttpRequest;o.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){t(n.result)}else{i(new Error(`The image could not be loaded from ${r}`))}};n.onerror=s=>{i(s)};n.readAsDataURL(o.response)};o.open("GET",r);o.responseType="blob";o.withCredentials=e==="use-credentials";o.send()});Ipe=(r,e)=>{return new Promise((t,i)=>{const o=new Image;o.onload=()=>{t(o)};o.onerror=()=>{i(new Error(`Failed to load image with src:${r}`))};o.crossOrigin=e;o.src=r})};vKe=(r,e)=>new Promise((t,i)=>{_Ke(r,e).then(o=>{const n=new Image;n.addEventListener("load",()=>{t(n)});n.src=o}).catch(()=>{Ipe(r,e).then(o=>t(o)).catch(o=>{i(o)})})});jM=async({url:r,image:e,crossOrigin:t="anonymous"})=>{try{if(e&&e.src&&e.src.substr(0,5)==="data:"||e&&e.src&&e.src.includes(".svg")){return e}if(typeof r==="string"&&r.substr(0,5)==="data:"||typeof r==="string"&&r.includes(".svg")){return Ipe(r,t)}return vKe(r||e.src,t)}catch(i){throw new Error(i)}}});var xKe,Ki;var Uw=p(()=>{Le();P();H();Epe();xKe={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};Ki=class{constructor(e){this.setImage=async e=>{try{const{crossOrigin:t}=this.editor.configStore.config.engine;if(typeof e==="string"&&!e.trim()||e===void 0||e===null){this.state.image=null}else if(typeof e==="string"){this.state.image=await jM({url:bs(e)?e:this.editor.assetProvider.getPath(e),crossOrigin:t})}else if(e instanceof HTMLImageElement){this.state.image=await jM({image:e,crossOrigin:t})}if(this.isWebcam){this.state.isWebcam=false}}catch(t){throw new Error(t)}};this.setImageLoadedToEngine=e=>{this.state.imageLoadedToEngine=e};this.newImage=e=>{this.editor.init(e)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=e;this.state=se(xKe)}selectTool(e){var i,o,n;const{licenseChecker:t}=this.editor.configStore;if(this.state.tool!==e&&(t==null?void 0:t.isToolAllowed(e))&&(this.image||e==="library"||e==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const s=(n=(o=(i=this.editor.configStore.state.config["customTool"])==null?void 0:i.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(e==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,e);this.state.tool=e;this.editor.configStore.events.onToolChanged(e);switch(e){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(e){this.state.isWebcam=e}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};g([C],Ki.prototype,"selectTool",1);g([C],Ki.prototype,"selectWebcam",1);g([C],Ki.prototype,"setImage",2);g([C],Ki.prototype,"setImageLoadedToEngine",2);g([C],Ki.prototype,"newImage",2);g([C],Ki.prototype,"dispose",2);g([S],Ki.prototype,"webcamLabel",1);g([S],Ki.prototype,"tool",1);g([S],Ki.prototype,"isWebcam",1);g([S],Ki.prototype,"image",1);g([S],Ki.prototype,"imageLoadedToEngine",1)});var CKe,$M,KM,ri;var Nw=p(()=>{Le();P();H();CKe={height:150,width:150};$M={height:0,width:0};KM=class{constructor(e){this.canvasClickDisabled=se.box(false);this.resizeCanvas=(e=null)=>{const t=this.editor.activeStore.tool;const i=e==="transform"||!e&&t==="transform";const{isLayoutAdvanced:o,measurements:n}=this.editor.configStore;const{storedSize:s}=this.editor.canvasStore;let a=0;if(!o&&i){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(e==="transform"&&t==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:s.width,height:s.height+a})};this.setCanvasSize=e=>{this.state.canvasSize=e};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=e;this.state=se(KM.initialState)}setCanvasElement(e){this.canvas=e;this.editor.engineMediator.preview.createPreview(e);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:e,width:t,render:i}){const{imageLoadedToEngine:o}=this.editor.activeStore;if(e>$M.height&&t>$M.width){this.state.storedSize={width:t,height:e};if(this.state.canvasSize.height===0){this.state.canvasSize={width:t,height:e}}if(i&&o){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return A.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(e){const t=this.editor.engine.getContainersAtPreviewPoint(e,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(i=>i.getID()).filter(i=>i!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(t)}};ri=KM;ri.initialState={canvasSize:$M,storedSize:CKe};g([C],ri.prototype,"setCanvasElement",1);g([C],ri.prototype,"saveDimensions",1);g([C],ri.prototype,"resizeCanvas",2);g([C],ri.prototype,"disableCanvasClick",1);g([C],ri.prototype,"enableCanvasClick",1);g([C],ri.prototype,"setCanvasSize",2);g([C],ri.prototype,"dispose",2);g([S],ri.prototype,"isCanvasClickable",1);g([S],ri.prototype,"canvasSize",1);g([S],ri.prototype,"storedSize",1);g([S],ri.prototype,"sizeVector",1);g([S],ri.prototype,"sizeVectorMagnitude",1)});var SKe,Do;var qw=p(()=>{Le();P();SKe={type:null,identifier:null,isVisible:false,error:""};Do=class{constructor(e){this.showActionModal=({type:e,identifier:t,error:i,handleConfirm:o,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=t;this.state.type=e;this.state.error=i||"";this.handleConfirm=o;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=e.configStore;this.state=se(SKe)}showInfoModal(e){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=e;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:e}=this.state;const t=this.getModalLocale();if(t){const{bodyLabel:i,headerLabel:o,buttonYes:n,buttonNo:s}=t;return{headerLabel:o,bodyLabel:i,confirmLabel:n,dismissLabel:s,isVisible:e,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:e,measurements:{basicCanvasOffset:t,advancedUIToolControlBar:i,advancedUIToolbar:o},isOrderDefault:n}=this.configStore;const s=(i.width+o.width)*(!n?-1:1);const a=t;return e?{x:s/2,y:0}:{x:0,y:-a}}getModalLocale(){const{identifier:e,error:t,type:i}=this.state;const{locale:o}=this.configStore;if(!i||!e||i==="textEdit")return null;if(i&&e&&o[`${i}Modals`]&&o[`${i}Modals`][e]){const n=o[`${i}Modals`][e];let{body:s}=n;if(s&&typeof t==="object"){Object.keys(t).forEach(l=>{s=s.replace(`\${${l}}`,t[l])})}else if(s){s=s.replace("${error}",t)}let a=n.heading;if(i==="error"||i==="warning"){const l={error:o.common.error,warning:o.common.warning};const u=i==="error"?l.error:l.warning;a=`${u}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};g([C],Do.prototype,"showActionModal",2);g([C],Do.prototype,"showInfoModal",1);g([C],Do.prototype,"showTextEditModal",1);g([C],Do.prototype,"hideModal",2);g([C],Do.prototype,"dispose",2);g([S],Do.prototype,"modalProps",1);g([S],Do.prototype,"isVisible",1);g([S],Do.prototype,"type",1);g([S],Do.prototype,"identifier",1);g([S],Do.prototype,"positionOffset",1)});var _r;var Hw=p(()=>{Le();H();_r=class{constructor(e){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(e=>e/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:e,maxOffsetY:t}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=t}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=e}this.savePosition();this.scaleRender()}};this.setOffset=e=>{const{canDragX:t,canDragY:i}=this.checkOffset(e);if(t){this.offset.x=e.x}if(i){this.offset.y=e.y}this.scaleRender()};this.editor=e}setInitialTransform(e=0){const t=En();const{scaleImageToFit:i}=this.editor.configStore.config;const{transform:o}=this.editor.engineMediator.preview;ar(()=>{const n=Math.abs(e||o.scale.x);this.setDefaultScale(i?n:Math.min(1*t,n));this.setPosition(o.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:e,height:t}=this.editor.canvasStore.canvas;this.setPosition({x:e/2,y:t/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(e){this.state.position.x=e.x;this.state.position.y=e.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(e){if(this.defaultScale!==1){const i=this.SCALE_LEVELS.findIndex(o=>o===this.defaultScale);if(i!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,i),...this.SCALE_LEVELS.slice(i+1)]}}const t=this.SCALE_LEVELS.findIndex(i=>i===e);if(t!==-1){this.state.scaleIndex=t}else{const i=this.SCALE_LEVELS.findIndex((o,n)=>{if(n===0){return e0;const f=c>0;const b=d-a;const _=m-l;return{canDragX:b<0,canDragY:_<0,maxOffsetX:h?-b:b,maxOffsetY:f?-_:_}}calculateScale(e=0,t=this.previewSize,i=this.defaultScale){const{width:o,height:n}=t;const s=new A({x:o,y:n});const a=new A(Math.abs(s.x*Math.cos(e))+Math.abs(s.y*Math.sin(e)),Math.abs(s.x*Math.sin(e))+Math.abs(s.y*Math.cos(e)));const l=s.subtract(a).divide(2).multiply(i).abs;if(l.y>l.x){return l.y*2/s.y+i}return l.x*2/s.x+i}get defaultIndex(){return this.SCALE_LEVELS.findIndex(e=>e===this.defaultScale)}getPositionWithOffset(e=this.offset){const{position:t}=this;return{x:t.x-e.x,y:t.y-e.y}}scaleRender(e=false){const t=this.editor.scale.getPositionWithOffset();const i=e?this.defaultScale:this.scale;const o={x:i,y:i};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(t);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:t,rotation:0});if(!e){this.editor.render()}}get scale(){const e=this.state.scaleIndex;return e!==-1?this.SCALE_LEVELS[e]:this.defaultScale}get zoomLevel(){const e=En();return(this.scale/e*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const e=this.state.scaleIndex;const t=e!==-1?this.SCALE_LEVELS[e]:this.defaultScale;const{previewSize:i}=this;return{width:i.width*t/this.defaultScale,height:i.height*t/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};g([se],_r.prototype,"state",2);g([C],_r.prototype,"in",2);g([C],_r.prototype,"out",2);g([C],_r.prototype,"setInitialTransform",1);g([C],_r.prototype,"resetScale",1);g([C],_r.prototype,"resetPosition",1);g([C],_r.prototype,"setPosition",1);g([C],_r.prototype,"savePosition",1);g([C],_r.prototype,"setDefaultScale",1);g([C],_r.prototype,"setScaleToDefault",1);g([S],_r.prototype,"scale",1);g([S],_r.prototype,"zoomLevel",1);g([S],_r.prototype,"canDrag",1);g([S],_r.prototype,"canZoomOut",1);g([S],_r.prototype,"canZoomIn",1);g([S],_r.prototype,"position",1);g([S],_r.prototype,"scaledSize",1)});var kpe,wKe,Zs,tr;var XM=p(()=>{Le();H();kpe=[[0,0],[0,1],[1,0],[1,1]];wKe=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];Zs=class{constructor(e,t,i="center",o=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=t;this.m=i==="center"?Zs.movePivotTo([.5,.5]):kpe;this.considerRotation=o;this.considerFlip=n;this.configStore=e.configStore}static getFlippedEdgeIndex(e,t,i){return wKe[(t?1:0)+(i?2:0)][e]}static movePivotTo(e){return kpe.map(t=>[t[0]-e[0],t[1]-e[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(e,t,i){const o=Zs.getFlippedEdgeIndex(e,t,i);const n=this.m[o][0]*this.size.width;const s=this.m[o][1]*this.size.height;return{width:n,height:s}}get leftTop(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(0,t,i);return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftBottom(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(1,t,i);return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightTop(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(2,t,i);return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightBottom(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(3,t,i);return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftBottomHandle(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(1,t,i);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightBottomHandle(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(3,t,i);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Zs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftMid(){const e=new A(this.leftTop);const t=new A(this.leftBottom);return e.add(t).divide(2)}get rightMid(){const e=new A(this.rightTop);const t=new A(this.rightBottom);return e.add(t).divide(2)}};tr=Zs;tr.coordinatesWithRotation=({width:e,height:t},i,o,n,s,a)=>{let l=e*Math.cos(i)-t*Math.sin(i)+a.x;let u=e*Math.sin(i)+t*Math.cos(i)+a.y;if(o){l=s.x*2-l}if(n){u=s.y*2-u}return new A({x:l,y:u}).rounded};g([S],tr.prototype,"position",1);g([S],tr.prototype,"size",1);g([S],tr.prototype,"rotation",1);g([S],tr.prototype,"flipHorizontally",1);g([S],tr.prototype,"flipVertically",1);g([S],tr.prototype,"flipCenter",1);g([S],tr.prototype,"leftTop",1);g([S],tr.prototype,"leftBottom",1);g([S],tr.prototype,"rightTop",1);g([S],tr.prototype,"rightBottom",1);g([S],tr.prototype,"leftBottomHandle",1);g([S],tr.prototype,"rightBottomHandle",1);g([S],tr.prototype,"leftMid",1);g([S],tr.prototype,"rightMid",1)});var YM=p(()=>{Mw();Bb();zb();Mb();VM();WM();UM();qM();HM();zw();Uw();Nw();qw();Hw();XM()});var qe;var Dpe=p(()=>{Le();H();kM();qe=class{constructor(e,t){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:se.map({})};this.configStore=e.configStore;this.id=We();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=t}changeIdentifier(e){this.state.identifier=e;const t=this.state.cropState.get(`${this.id}-${e}`);if(!t){this.state.cropState.set(`${this.id}-${e}`,{...Wn})}}changeRatio(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){this.state.cropState.set(`${this.id}-${this.identifier}`,{...t,ratio:e})}}changeSize(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e.width&&e.width>0){t.size.width=Math.round(e.width)}if(e.height&&e.height>0){t.size.height=Math.round(e.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}changeHeight(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e){t.size.height=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}}changeWidth(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e){t.size.width=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}}changePositionX(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i&&e<=t-this.minCropSize&&e>=0){i.position.x=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}return false}changePositionY(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i&&e<=t-this.minCropSize&&e>=0){i.position.y=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}return false}changePosition(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i){if(e.x<=t.width-this.minCropSize&&e.x>=0&&e.y<=t.height-this.minCropSize&&e.y>=0){i.position.x=Math.round(e.x);i.position.y=Math.round(e.y);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}}return false}changeLockResolution(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){t.lockResolution=e!==void 0?e:!t.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}changeForceDimensions(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){t.forceDimensions=e;this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}clearState(){this.state.cropState.forEach((e,t)=>t.startsWith(this.id)&&this.state.cropState.delete(t))}setRotation(e){this.state.rotationInDegrees=e}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:e,flipVertically:t}){this.state.flipHorizontally=e;this.state.flipVertically=t}setOutputRotation(e){this.state.outputRotation=e}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:e,height:t}=this.defaults.maxCropMaskSize;return new A(e/2,t/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:Wn.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:Wn.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:Wn.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:Wn.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:Wn.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:Wn.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:Wn.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:Wn.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:Wn.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};g([se],qe.prototype,"state",2);g([C],qe.prototype,"changeIdentifier",1);g([C],qe.prototype,"changeRatio",1);g([C],qe.prototype,"changeSize",1);g([C],qe.prototype,"changeHeight",1);g([C],qe.prototype,"changeWidth",1);g([C],qe.prototype,"changePositionX",1);g([C],qe.prototype,"changePositionY",1);g([C],qe.prototype,"changePosition",1);g([C],qe.prototype,"changeLockResolution",1);g([C],qe.prototype,"changeForceDimensions",1);g([C],qe.prototype,"clearState",1);g([C],qe.prototype,"setRotation",1);g([C],qe.prototype,"resetRotation",1);g([C],qe.prototype,"resetOutputRotation",1);g([C],qe.prototype,"resetFlip",1);g([C],qe.prototype,"updateFlip",1);g([C],qe.prototype,"setOutputRotation",1);g([C],qe.prototype,"flipHorizontally",1);g([C],qe.prototype,"flipVertically",1);g([C],qe.prototype,"dispose",2);g([S],qe.prototype,"flipCenter",1);g([S],qe.prototype,"isFlippedHorizontal",1);g([S],qe.prototype,"isFlippedVertical",1);g([S],qe.prototype,"identifier",1);g([S],qe.prototype,"height",1);g([S],qe.prototype,"width",1);g([S],qe.prototype,"position",1);g([S],qe.prototype,"ratio",1);g([S],qe.prototype,"size",1);g([S],qe.prototype,"x",1);g([S],qe.prototype,"y",1);g([S],qe.prototype,"lockResolution",1);g([S],qe.prototype,"forceDimensions",1);g([S],qe.prototype,"selectedCrop",1);g([S],qe.prototype,"rotationInDegrees",1);g([S],qe.prototype,"outputRotation",1)});var JM;var Ope=p(()=>{Le();H();Yh();JM=class{constructor(e){this.transforms={output:JSON.stringify(yt.IDENTITY),preview:JSON.stringify(yt.IDENTITY)};this.setFrameOpacity=e=>{this.frameOpacity=e;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=e=>{this.overlayOpacity=e;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=e;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:e,flipVertically:t,rotation:i,outputRotation:o}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new A(this.transformToolStore.leftTopRespectFlip).add(new A(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new A(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const s=this.engineMediator.preview.container;const{outputContainer:a}=this.editor;a.setResolution(_e(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:t,flipHorizontally:e});const l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let u=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:f,defaultImageSize:b}=this.transformToolStore;const _=this.transformToolStore.maxCropMaskSize;const y={height:f.height*b.height/_.height,width:f.width*b.width/_.width};u=y.width/this.transformToolStore.localOutputImageSize.width}const c=Math.abs(l.x);const d=u/(c/this.transformToolStore.defaultScale);const m={x:d,y:d};const h=-(i-o);a.setTransform({scale:m,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(e){this.transforms=e}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const e=this.engineMediator.preview.container;const{outputContainer:t}=this.editor;const i=JSON.parse(this.transforms.preview);t.setResolution(_e(this.transformToolStore.defaultImageSize));e.setTransform(i);t.setTransform(JSON.parse(this.transforms.output));const o=i.scale;t.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(i);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(e,t=true){const{width:i,height:o}=this.editor.engineMediator.image.container.getBounds();const n=vJ(e)?{width:o,height:i}:{width:i,height:o};this.editor.outputContainer.rotate(e,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:s}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(s);ar(()=>{this.editor.scale.setInitialTransform();const a=this.getScaleWithFlip(s);this.engineMediator.preview.container.setScale(a);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(t){this.editor.render()}}applyPreviewTransform(){const{rotation:e,flipHorizontally:t,flipVertically:i}=this.transformToolStore.rotateFlipState;const o=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let s=e;if(t){s=Xh(s)}if(i){s=Xh(s)}const a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a)}getScaleWithFlip(e=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:t,flipVertically:i}=this.transformToolStore.rotateFlipState;const o=t?-1:1;const n=i?-1:1;const s=this.editor.scale.calculateScale(e);return{x:s*o,y:s*n}}saveTransforms(){const e=JSON.stringify(this.engineMediator.preview.container.getTransform());const t=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:e,output:t}}saveTransformsBasedOnFlip(){const e=this.engineMediator.preview.container.getTransform();const{scale:t}=e;const{flipVertically:i,flipHorizontally:o}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...e,scale:{x:o?-t.x:t.x,y:i?-t.y:t.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}}});var ZM;var Rpe=p(()=>{H();ZM=class{constructor(e){this.store=e;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,fr.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}}});var Ape,up,ae;var QM=p(()=>{Le();P();H();YM();Ti();Xs();Dpe();Ope();Rpe();Ape="identity";up=class{constructor(e){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=se.box(false);this.minCropSize=0;this.transformHistory=new ZM(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=e=>{if(!e.trim())return false;let t=this.editor.configStore.config.assetBaseUrl;const{length:i}=t;if(t[i-1]!=="/"){t+="/"}if(`${t}transform`===e){return false}const o=new Image;try{o.src=e;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const e=this.editor.outputContainer.getRotation();if(e!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=e=>{this.localOutputSize.height=Math.round(e.height);this.localOutputSize.width=Math.round(e.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(e.width),height:Math.round(e.height)})};this.changeDefaultScale=e=>{this.defaults.scale=e};this.changeLocalOutputHeight=e=>{this.localOutputSize.height=Math.round(e)};this.changeLocalOutputWidth=e=>{this.localOutputSize.width=Math.round(e)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const e=this.editor.outputContainer.getRotation();const t=this.isFlippedVertical?dR:pR;this.rotateOutputContainer(t(e))};this.rotateAntiClockwise=()=>{const e=this.editor.outputContainer.getRotation();const t=this.isFlippedVertical?pR:dR;this.rotateOutputContainer(t(e))};this.flipHorizontally=(e=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(e);if(e){this.trackChanges()}};this.flipVertically=(e=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(e);if(e){this.trackChanges()}};this.applyDefaultCrop=(e=false)=>{if(this.identifier==="identity"){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,e)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:e,y:t})=>{const i=this.getRatio();const o=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,e),o.x-n.width);const l=Math.min(Math.max(0,t),o.y-n.height);const u=o.x-a;const c=o.y-l;const d={width:Math.max(this.minCropSize,Math.min(u,s.width-a)),height:Math.max(this.minCropSize,Math.min(c,s.height-l))};if(i==="*"){if(this.changePosition({x:a,y:l})){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);const h=new A(o).subtract({x:m.width,y:m.height});if(this.changePosition(h)){this.changeCropAndOutputSize(m,i)}}};this.onLeftBottom=({x:e,y:t})=>{const i=this.getRatio();const o=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,e),o.x-n.width);const l=Math.max(0,t,o.y+n.height);const u=o.x-a;const c=l-o.y;const d={width:Math.max(1,Math.min(u,s.width-a)),height:Math.max(1,Math.min(c,s.height-o.y))};if(i==="*"){if(this.changePositionX(a)){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);if(this.changePositionX(o.x-m.width)){this.changeCropAndOutputSize(m,i)}}};this.onRightTop=({x:e,y:t})=>{const i=this.getRatio();const o=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,e,o.x+n.width);const l=Math.min(Math.max(0,t),o.y-n.height);const u=a-o.x;const c=o.y-l;const d={width:Math.max(1,Math.min(u,s.width-o.x)),height:Math.max(1,Math.min(c,s.height-l))};if(i==="*"){if(this.changePositionY(l)){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);if(this.changePositionY(o.y-m.height)){this.changeCropAndOutputSize(m,i)}}};this.onRightBottom=({x:e,y:t})=>{const i=this.getRatio();const o=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,e,o.x+n.width);const l=Math.max(0,t,o.y+n.height);const u=a-o.x;const c=l-o.y;const d={width:Math.max(1,Math.min(u,s.width-o.x)),height:Math.max(1,Math.min(c,s.height-o.y))};if(i==="*"){this.changeCropAndOutputSize(d)}else{const m=this.proportionalSize(i,d);this.changeCropAndOutputSize(m,i)}};this.onPixelWidth=e=>{const t=JSON.stringify(_e(this.localOutputSize));const i=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(i&&i.ratio){let n=e;let s=this.localOutputSize.height;let{ratio:a}=i;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(e,o.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(s)})}else{const l=up.placeCropMask(a,o);n=Math.max(Math.min(n,l.width),this.minCropSize);s=n/a;this.changeLocalOutputSize({height:s,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(t));return Math.round(n)}return e};this.onPixelHeight=e=>{const t=JSON.stringify(_e(this.localOutputSize));const i=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(i&&i.ratio){let n=e;let s=this.localOutputSize.width;let{ratio:a}=i;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(e,o.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(n)})}else{const l=up.placeCropMask(a,o);n=Math.max(Math.min(n,l.height),this.minCropSize);s=n*a;this.changeLocalOutputSize({height:n,width:s})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(t));return Math.round(n)}return e};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=e=>{this.transformations.setFrameOpacity(e)};this.setOverlayOpacity=e=>{this.transformations.setOverlayOpacity(e)};this.closestRatioReducer=e=>(t,i)=>{if(i===null)return-1;return Math.abs(e-t.ratio)(t,i)=>{if(i===null)return-1;const o=Math.abs(t.dimensions.x/t.dimensions.y);const n=Math.abs(i.dimensions.x/i.dimensions.y);if(o===n){return t.dimensions.x*t.dimensions.y>i.dimensions.x*i.dimensions.y?-1:1}return Math.abs(e-o){const e=this.entityManager.items.findIndex(l=>l.identifier==="imgly_transform_common_custom");if(e!==-1)return this.entityManager.items[e];const t=this.entityManager.items.findIndex(l=>l.ratio==="*");if(t!==-1)return this.entityManager.items[t];const i=_e(this.editor.outputContainer.getResolution());const o=Math.abs(i.width/i.height);const[n]=this.entityManager.items.filter(l=>l.ratio&&typeof l.ratio==="number").sort(this.closestRatioReducer(o));const[s]=this.entityManager.items.filter(l=>l.dimensions&&!l.ratio).sort(this.closestDimensionsReducer(o));if(!n||!s||!n.ratio&&!s.dimensions){return this.entityManager.items[0]}if(!s||!s.dimensions)return n;if(!n||!n.ratio)return s;const a=Math.abs(s.dimensions.x/s.dimensions.y);if(a===n.ratio)return n;return Math.abs(o-n.ratio){let t=this.entityManager.items.find(i=>i.identifier===e);if(!t){t=this.getMatchingItem()}return t};this.editor=e;this.selectedCategory=Ape;this.transformStore=new qe(e,this.defaults);this.transformations=new JM(e);const{enableRotation:t,enableFlip:i,...o}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new ir(n,{...o,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new tr(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new tr(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(e){return e*Math.PI/180}static placeCropMask(e,t){if(t.height*e>t.width){const o=t.width/e;return{height:o,width:t.width,yChanged:true}}const i=t.height*e;return{height:t.height,width:i,yChanged:false}}changeIdentifier(e,t=false){this.transformStore.changeIdentifier(e);const i=this.getCropMask(e,this.defaults.imageSize);if(i){this.transformStore.changeRatio(i.ratio);this.changeLocalOutputSize(i);this.updatePreviewSizeWRTImageSize();if(i.yChanged!==void 0){this.updateInitialCropMaskPosition(i.yChanged)}if(i.dimensions){this.changeLocalOutputSize({width:i.dimensions.x,height:i.dimensions.y})}if(t){this.trackChanges()}}}setDragMode(e){this.dragMode.set(e)}getCropMask(e,t){const i=this.getTransform(e);if(i){const{ratio:o,forceDimensions:n,lockDimensions:s,dimensions:a=null}=i;if(n){this.transformStore.changeForceDimensions(n)}if(s){this.transformStore.changeLockResolution(s)}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return{...t,yChanged:void 0,ratio:"*",dimensions:a};default:return{...up.placeCropMask(i.ratio,t),ratio:i.ratio,dimensions:a}}}else{const{x:l,y:u}=i.dimensions;return{...up.placeCropMask(l/u,t),ratio:null,dimensions:a}}}return null}setCropDefaults(e=false){const t=this.editor.outputContainer.getResolution();this.setDefaultImageSize(t);const i=this.editor.getPreviewSize();const{position:o}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(i);this.setDefaultCropPosition({x:o.x-i.width/2,y:o.y-i.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!e){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(e){this.defaults.imageSize={..._e(e)};if(!this.lockResolution){this.localOutputSize={..._e(e)}}}setMaxCropSize(e){this.defaults.maxCropMaskSize.height=e.height;this.defaults.maxCropMaskSize.width=e.width}setDefaultCropPosition(e){this.defaults.cropMaskPosition.x=e.x;this.defaults.cropMaskPosition.y=e.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(e){this.selectedCategory=this.selectedCategory===e?Ape:e}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=JSON.stringify(this.engineMediator.preview.container.getTransform());const t=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:e,output:t})}changePosition(e){return this.transformStore.changePosition(e,this.defaults.maxCropMaskSize)}changePositionX(e){return this.transformStore.changePositionX(e,this.defaults.maxCropMaskSize.width)}changePositionY(e){return this.transformStore.changePositionY(e,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:e,height:t},i,o=true){this.transformStore.changeWidth(e);this.transformStore.changeHeight(t);if(!this.lockResolution){const{height:n,width:s}=this.defaults.maxCropMaskSize;const{height:a,width:l}=this.defaults.imageSize;let u=a/n*t;const c=l/s*e;if(i){u=c/i}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(c),height:Math.round(u)})}if(t>=this.minCropSize){this.changeLocalOutputHeight(u)}if(e>=this.minCropSize){this.changeLocalOutputWidth(c)}}}transformRender(e=true){this.transformations.applyPreviewTransform();if(e){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:e,flipVertically:t}=this.rotateFlipState;const{identifier:i,rotationInDegrees:o}=this;const n=Nc(o);const s=cR(V0(this.editor.engineMediator.output.container.getRotation())+o);const{start:a,end:l}=this.convertUIToOperationOptions(n,s);return{flipHorizontally:e,flipVertically:t,rotation:n,start:a,end:l,identifier:i,outputRotation:s}}getStartEndForOperation(e){const{leftTop:t,rightBottom:i,maxCropMaskSize:o}=this;const n=t.y;const s=t.x;const a=i.x;const l=i.y;switch(e){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}getStartEndForUI(e,t,i){const{maxCropMaskSize:o}=this;const n=t.y;const s=t.x;const a=i.x;const l=i.y;switch(e){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}convertOperationOptionsToUI({start:e,end:t,rotation:i,outputRotation:o}){const n=o===90||o===270;const s=n?A.fromSize(this.defaultImageSize).swapped:A.fromSize(this.defaultImageSize);const a=Math.cos(i);const l=Math.sin(i);const u=this.calculateScale(i);const c=new A(Math.min(e.x,t.x),Math.min(e.y,t.y));const d=new A(Math.max(e.x,t.x),Math.max(e.y,t.y));const m=d.subtract(c).divide(2);const h=c.add(m).multiply(s);const f=h.subtract(s.multiply(.5));const b=new A(f.x*a-f.y*l,f.x*l+f.y*a).multiply(u);const _=s.multiply(.5).add(b);const y=_.divide(s);const T=y.subtract(m.multiply(u));const w=y.add(m.multiply(u));const k=n?A.fromSize(this.maxCropMaskSize).swapped:A.fromSize(this.maxCropMaskSize);const F=T.multiply(k);const E=w.multiply(k);const{leftTop:R,rightBottom:Z}=this.getStartEndForUI(o,F,E);return{start:new A(R),end:new A(Z)}}convertUIToOperationOptions(e,t){const i=t===90||t===270;const o=i?A.fromSize(this.defaultImageSize).swapped:A.fromSize(this.defaultImageSize);const n=i?A.fromSize(this.maxCropMaskSize).swapped:A.fromSize(this.maxCropMaskSize);const s=Math.cos(-e);const a=Math.sin(-e);const l=this.calculateScale(e,i);const{leftTop:u,rightBottom:c}=this.getStartEndForOperation(t);const d=new A(u).divide(n);const m=new A(c).divide(n);const h=m.subtract(d).divide(2);const f=d.add(h).multiply(o);const b=f.subtract(o.multiply(.5));const _=new A(b.x*s-b.y*a,b.x*a+b.y*s).divide(l);const y=o.multiply(.5).add(_);const T=y.divide(o);const w=T.subtract(h.divide(l));const k=T.add(h.divide(l));return{start:w,end:k}}calculateScale(e,t=false){const i=t?A.fromSize(this.defaultImageSize).swapped:A.fromSize(this.defaultImageSize);const o=new A(Math.abs(i.x*Math.cos(e))+Math.abs(i.y*Math.sin(e)),Math.abs(i.x*Math.sin(e))+Math.abs(i.y*Math.cos(e)));const n=i.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/i.y+1:n.x*2/i.x+1}updateStateFromSerialization(e){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=Math.round(V0(e.rotation));this.transformStore.setRotation(t>180?t-360:t);this.transformations.rotateOutputContainer(Nc(cR(e.outputRotation||0)));if(e.identifier){this.transformStore.changeIdentifier(e.identifier)}if(e.start&&e.end){if(e.end.x===0||e.end.y===0){e.end.x=1;e.end.y=1}const{start:i,end:o}=this.convertOperationOptionsToUI({start:new A(e.start),end:new A(e.end),rotation:e.rotation,outputRotation:e.outputRotation});this.changePositionX(i.x);this.changePositionY(i.y);const n=o.x-i.x;const s=o.y-i.y;this.transformStore.changeSize({width:n,height:s});const{maxCropMaskSize:a,imageSize:l}=this.defaults;const u={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(u)}if(e.flipHorizontally){this.flipHorizontally(false)}if(e.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(e){this.defaultAngle=e}updateCanvasControls(e){const t=_e(this.cropMaskPosition);const i=_e(this.cropMaskSize);const o=_e(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*i.height/e.height,width:o.width*i.width/e.width},void 0,false);this.changePosition({y:o.height*t.y/e.height,x:o.width*t.x/e.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(e){this.transformStore.setRotation(e);this.transformRender()}async rotateOutputContainer(e,t=true){this.setDragMode(true);this.transformations.rotateOutputContainer(e,t);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,false)}clickableCanvas(e){this.editor.clickableCanvas(e)}proportionalSize(e,t,i=this.defaults.maxCropMaskSize,o=this.minCropSize){let n=t.height*e;let{height:s}=t;if(n>i.width||n1){return{width:this.minCropSize*e,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*e}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const e=this.getTransform(this.identifier);if(e){if(Object.prototype.hasOwnProperty.call(e,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return e.ratio}const{x:t,y:i}=e.dimensions;return t/i}return"*"}};ae=up;g([se],ae.prototype,"selectedCategory",2);g([se],ae.prototype,"defaults",2);g([se],ae.prototype,"localOutputSize",2);g([C],ae.prototype,"changeIdentifier",1);g([C],ae.prototype,"setDragMode",1);g([C],ae.prototype,"setCropDefaults",1);g([C],ae.prototype,"setDefaultImageSize",1);g([C],ae.prototype,"setMaxCropSize",1);g([C],ae.prototype,"setDefaultCropPosition",1);g([C],ae.prototype,"resetCrop",1);g([C],ae.prototype,"toggleCategorySelection",1);g([C],ae.prototype,"pureReset",1);g([C],ae.prototype,"reset",2);g([C],ae.prototype,"changePosition",1);g([C],ae.prototype,"changePositionX",1);g([C],ae.prototype,"changePositionY",1);g([C],ae.prototype,"changeCropAndOutputSize",1);g([C],ae.prototype,"onLeave",1);g([C],ae.prototype,"onEnter",1);g([C],ae.prototype,"changeLocalOutputSize",2);g([C],ae.prototype,"changeDefaultScale",2);g([C],ae.prototype,"changeLocalOutputHeight",2);g([C],ae.prototype,"changeLocalOutputWidth",2);g([C],ae.prototype,"changeLockResolution",2);g([C],ae.prototype,"setRotation",1);g([C],ae.prototype,"rotateClockwise",2);g([C],ae.prototype,"rotateAntiClockwise",2);g([C],ae.prototype,"rotateOutputContainer",1);g([C],ae.prototype,"flipHorizontally",2);g([C],ae.prototype,"flipVertically",2);g([C],ae.prototype,"applyDefaultCrop",2);g([C],ae.prototype,"applyInitialCrop",1);g([C],ae.prototype,"updateCropMask",2);g([C],ae.prototype,"clickableCanvas",1);g([C],ae.prototype,"onLeftTop",2);g([C],ae.prototype,"onLeftBottom",2);g([C],ae.prototype,"onRightTop",2);g([C],ae.prototype,"onRightBottom",2);g([C],ae.prototype,"proportionalSize",1);g([C],ae.prototype,"onPixelWidth",2);g([C],ae.prototype,"onPixelHeight",2);g([C],ae.prototype,"updateInitialCropMaskPosition",1);g([C],ae.prototype,"updatePreviewSizeWRTImageSize",1);g([C],ae.prototype,"dispose",2);g([S],ae.prototype,"cropState",1);g([S],ae.prototype,"identifier",1);g([S],ae.prototype,"ratio",1);g([S],ae.prototype,"height",1);g([S],ae.prototype,"width",1);g([S],ae.prototype,"localOutputImageSize",1);g([S],ae.prototype,"localOutputHeight",1);g([S],ae.prototype,"localOutputWidth",1);g([S],ae.prototype,"lockResolution",1);g([S],ae.prototype,"forceDimensions",1);g([S],ae.prototype,"rotationInDegrees",1);g([S],ae.prototype,"outputRotation",1);g([S],ae.prototype,"isDragMode",1);g([S],ae.prototype,"rotateFlipState",1);g([S],ae.prototype,"selectedCategoryIdentifier",1);g([S],ae.prototype,"categories",1);g([S],ae.prototype,"items",1);g([S],ae.prototype,"config",1);g([S],ae.prototype,"locale",1);g([S],ae.prototype,"isOptionSelected",1);g([S],ae.prototype,"leftTop",1);g([S],ae.prototype,"leftBottom",1);g([S],ae.prototype,"rightTop",1);g([S],ae.prototype,"rightBottom",1);g([S],ae.prototype,"isFlippedHorizontal",1);g([S],ae.prototype,"isFlippedVertical",1);g([S],ae.prototype,"leftTopRespectFlip",1);g([S],ae.prototype,"leftBottomRespectFlip",1);g([S],ae.prototype,"rightTopRespectFlip",1);g([S],ae.prototype,"rightBottomRespectFlip",1);g([S],ae.prototype,"cropMaskPosition",1);g([S],ae.prototype,"cropMaskSize",1);g([S],ae.prototype,"state",1);g([S],ae.prototype,"defaultImageSize",1);g([S],ae.prototype,"maxCropMaskSize",1);g([S],ae.prototype,"minCropMaskSize",1);g([S],ae.prototype,"defaultCropMaskPosition",1);g([S],ae.prototype,"defaultScale",1)});var Fpe=p(()=>{kM();QM()});var Ppe,TKe,e5,IKe,Nb,he;var t5=p(()=>{Le();Ppe=v(Fm());P();H();Ti();XM();Yh();fM();yM();vM();wM();TKe={};e5="none";IKe={position:{x:0,y:0},rotation:0};Nb=class{constructor(e){this.state=se.map(TKe);this.selectedId=se.box(e5);this.editMode=se.box(false);this.dragMode=se.box(false);this.minLength=0;this.counter=0;this.addSticker=async(e,t=true)=>{await this.addStickerAsync(e,t)};this.addStickerAsync=async({spriteId:e,state:t,transform:i},o=true)=>{return new Promise((n,s)=>{i=this.getInitialTransform(i);const{identifier:a}=t;const l=this.editor.orderHelper.addSprite(a);this.editor.engine.addStickerFromAssets(a,this.editor.engineMediator.image.container,l).then(async u=>{if(e){u.setData({id:e})}const c=u.getID();this.container[c]=u;this.editor.orderHelper.renameSprite(a,c);const d=this.getSize(c);d.width*=u.getScale().x;d.height*=u.getScale().y;u.setPivot(.5,.5);let m;if(i.scale){m=i.scale}else if(i.size){m={x:i.size.width/d.width,y:i.size.height/d.height}}else{const _=this.editor.shortestOutputSide*.4;const y=Nb.magnitude(_)/Nb.sizeMagnitude(u.getSizeInWorldSpace());m={x:y,y}}const{flipHorizontally:h,flipVertically:f}=this.editor.outputContainer.getData();u.setFlipHorizontally(h);u.setFlipVertically(f);u.setTransform({position:i.position,scale:m,rotation:i.rotation});if(t.flipHorizontally!==void 0){u.setFlipHorizontally(t.flipHorizontally!==h)}if(t.flipVertically!==void 0){u.setFlipVertically(t.flipVertically!==f)}this.setContainerProperties(c,{...t});const b=u.getData();this.setInitialSpriteState(c,"sticker");this.stickerToolStore.setState(c,{...b,identifier:a});await this.editor.renderPromise();if(o){this.setId(c);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(u=>{console.error(u);s()})})};this.addText=async(e,t=true)=>{await this.addTextAsync(e,t)};this.addTextAsync=({spriteId:e,state:t,transform:i},o=true)=>{return new Promise((n,s)=>{i=this.getInitialTransform(i);const a=this.editor.orderHelper.addSprite(t.identifier);const l=this.editor.shortestOutputSide;const u={fontIdentifier:t.identifier,text:t.text,width:t.width||l*.6,fontSize:t.fontSize||l*.1,lineHeight:t.lineHeight,alignment:t.alignment,textColor:t.textColor,backgroundColor:t.backgroundColor};this.editor.engine.addTextWithFontLoading(u,this.editor.engineMediator.image.container,a).then(async c=>{if(e){c.setData({id:e})}const d=c.getID();this.container[d]=c;this.editor.orderHelper.renameSprite(t.identifier,d);const{flipHorizontally:m,flipVertically:h}=this.editor.outputContainer.getData();c.setFlipHorizontally(m);c.setFlipVertically(h);c.setPivot(.5,.5);c.setPosition(i.position);c.setRotation(i.rotation);this.setInitialSpriteState(d,"text");const f=c.getData();this.textToolStore.setState(d,{...f});await this.editor.renderPromise();if(o){this.setId(d);this.addSnapshot("add",this.textLocale.add)}n()}).catch(c=>{console.error(c);s()})})};this.addTextDesign=async(e,t=true,i=false)=>{try{await this.addTextDesignAsync(e,t,i)}catch(o){console.warn(o)}};this.addTextDesignAsync=({spriteId:e,state:t,transform:i},o=true,n=false)=>{return new Promise((s,a)=>{i=this.getInitialTransform(i);const l=this.editor.orderHelper.addSprite(t.identifier);const u=this.editor.shortestOutputSide;const c={width:t.width||u*.6,text:t.text,color:t.color,inverted:t.isInverted,seed:t.seed,padding:t.padding};this.editor.engine.addTextDesignAsync(t.identifier,c,this.editor.engineMediator.image.container,l).then(async d=>{if(e){if(n){this.pureRemoveSprite(e);this.textDesignToolStore.state.delete(e)}d.setData({id:e})}const m=d.getID();this.container[m]=d;this.editor.orderHelper.renameSprite(t.identifier,m);const{flipHorizontally:h,flipVertically:f}=this.editor.outputContainer.getData();d.setFlipHorizontally(h);d.setFlipVertically(f);d.setPivot(.5,.5);d.setPosition(i.position);d.setRotation(i.rotation);this.setInitialSpriteState(m,"textdesign");const b=d.getData();this.textDesignToolStore.setState(m,{...b,identifier:t.identifier});await this.editor.renderPromise();if(o){this.setId(m);this.addSnapshot("add",this.textDesignLocale.add)}s()}).catch(d=>{a(d)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=e=>{this.editor.clickableCanvas(e)};this.setContainerProperties=(e,t,i=false)=>{this.container[e].setData(t);if(i){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(e,t)=>{this.container[e].setPosition(t)};this.pureRemoveSprite=e=>{this.editor.engine.removeContainer(this.container[e]);const t=this.container[e].getIndexInParent();if(t===-1){delete this.container[e];this.state.delete(e);this.editor.orderHelper.removeSprite(e);return true}return false};this.deleteSprite=(e=this.id)=>{const t=this.state.get(e);if(t.tool==="sticker"){this.stickerToolStore.delete()}else if(t.tool==="text"){this.textToolStore.delete()}else if(t.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=e=>{const t=this.pureRemoveSprite(e);if(t){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(e,t)=>{this.editor.addSnapshot(void 0,e,t)};this.spriteSnapshot=e=>{this.addSnapshot("edit",this.historyLocale[e])};this.addNewText=async(e,t)=>{if(this.textToolStore.doesTextAssetExist(t.identifier)){await this.addTextAsync({...e,state:t},false)}else{throw new In(t.identifier)}};this.addNewTextDesign=async(e,t)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(t.identifier)){await this.addTextDesignAsync({...e,state:t},false)}else{throw new In(t.identifier)}};this.addNewSticker=async(e,t)=>{if(this.stickerToolStore.doesStickerAssetExist(t.identifier)){await this.addStickerAsync({...e,state:t},false)}else{throw new In(t.identifier)}};this.getSpriteHistoryState=()=>{const e=_e(this.textToolStore.state);const t=_e(this.textDesignToolStore.state);const i={common:_e(this.state),["sticker"]:_e(this.stickerToolStore.state),["text"]:e,["textdesign"]:t,spriteIdList:Object.keys(this.container)};Object.keys(i.common).forEach(o=>{i.common[o].size=this.container[o].getSizeInWorldSpace();i.common[o].position=this.container[o].getPosition();i.common[o].order=this.container[o].getIndexInParent()});return i};this.updateStateFromSerialization=async(e,t,i)=>{if(t&&t.length){try{const o=await Promise.all(t.map(async({svg:n,raster:s,name:a,identifier:l})=>{const u=(n==null?void 0:n.data)?"image/svg+xml":s.type;const c=`data:${u};base64,${(n==null?void 0:n.data)||s.data}`;const d=await Rw(c,150);return{stickerURI:c,thumbnailURI:d,name:a,type:u,identifier:l}}));await this.stickerToolStore.addCustomStickerAsset(o)}catch(o){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(e.text){await this.textToolStore.loadFonts()}if(e.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(e.spriteIdList,e,i)};this.updateStateFromHistory=async e=>{const t=Object.keys(this.container);const i=t.filter(o=>e.spriteIdList.indexOf(o)===-1);i.forEach(o=>{this.pureRemoveSprite(o)});await this.updateStateByHistoryState(e.spriteIdList,e,0)};this.serializableState=async()=>{const e=this.editor.spriteStore.getSpriteHistoryState();Object.keys(e.common).forEach(i=>{const{flipHorizontally:o,flipVertically:n}=this.editor.outputContainer.getData();const s=this.editor.outputContainer.getRotation();const a=n!==o?-e.common[i].rotation:e.common[i].rotation;e.common[i].rotation=n!==o?a+s:a-s});const t=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:i,type:o,stickerURI:n,name:s})=>{const a={identifier:i,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]}}if(o==="image/jpeg"||o==="image/png"||o==="image/gif"){[,a.raster.data]=n.split(",");a.raster.type=o}else{const l=await Rw(n);[,a.raster.data]=l.split(",");a.raster.type="image/png"}return a}));return{sprite:e,customStickers:t}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(e=>{this.updatePositionAndSize(e,true);const t=this.state.get(e);if(t){if(t.tool==="text"){const i=this.getContainerProperties(e);this.textToolStore.changeSize(e,i)}else if(t.tool==="textdesign"){const i=this.getContainerProperties(e);this.textToolStore.changeWidth(i.width)}}})};this.setEditMode=e=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(e){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(e)}}};this.setDragMode=e=>{this.dragMode.set(e)};this.setPosition=e=>{const t=this.currentSprite;const i=this.container[this.id];if(t&&i){i.setPosition(this.editor.previewToWorld(e));const{position:o}=this.getSizePositionFromContainer();t.position.x=o.x;t.position.y=o.y;this.state.set(this.id,t);this.editor.render()}};this.setSize=e=>{const t=this.currentSprite;if(t){t.size.width=e.width;t.size.height=e.height;this.state.set(this.id,t)}};this.setRotation=e=>{const t=this.currentSprite;if(t){const{flipHorizontally:i,flipVertically:o}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const s=Rb({rotation:e,outputRotation:n,flipHorizontally:i,flipVertically:o});this.container[this.id].setRotation(s);t.rotation=this.container[this.id].getRotation();this.state.set(this.id,t);this.editor.render()}};this.onCanvasClick=e=>{if(!this.isEditMode){this.selectHighestOrderSprite(e)}};this.select=e=>{const t=this.state.get(e);if(t){const i=this.editor.activeStore.tool;if(i!==t.tool){this.editor.activeStore.selectTool(t.tool)}this.setId(e)}};this.selectLast=()=>{const e=this.editor.orderHelper.getLastSpriteId();if(e){this.select(e)}};this.selectNext=()=>{if(this.currentSprite){const e=this.container[this.id];const t=e.getIndexInParent();if(t){const i=Object.keys(this.container).find(o=>this.container[o].getIndexInParent()===t-1);if(i){this.select(i)}}}};this.deselect=()=>{this.setId(e5)};this.bringToFront=async e=>{const t=this.editor.orderHelper.bringToFront(e);this.container[e].setIndexInParent(t);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=e=>{const t=this.state.get(e);const i=this.container[e];i.setFlipHorizontally(!i.getFlipHorizontally());t.flipHorizontally=i.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(e,t);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(e=>{this.pureRemoveSprite(e)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=e=>{const t=this.editor.brushToolStore.containerId();e=e.filter(n=>n!==t);if(e.length<1){this.deselect();return}let i="";let o=0;e.forEach(n=>{const s=this.container[n];const a=s&&s.getIndexInParent()||0;if(a>=o){o=a;i=n}});this.select(i)};this.onCornerDrag=({x:e,y:t})=>{if(this.currentSprite){const i=new A(this.currentSprite.position);const o=new A(e,t);const n=o.subtract(i).magnitude;const s=this.getSize();const a=n*2/Nb.sizeMagnitude(s);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:s.width*a,height:s.height*a})}else{const l=this.rotationWRTOutputRotation;const u=o.subtract(i);const c=Math.cos(l);const d=Math.sin(l);const m=Math.max(Math.abs(u.x*c*2+u.y*d*2),this.minLength);const h=Math.max(Math.abs(u.x*-d*2+u.y*c*2),this.minLength);this.setStickerSize({width:m,height:h})}}else if(this.isSpriteText){this.setTextSize(s.width*a)}else if(this.isSpriteTextDesign){this.setTextDesignScale(a)}}this.editor.render()}};this.onWidthDrag=({x:e,y:t})=>{const i=new A(this.currentSprite.position);const o=new A(e,t);const n=o.subtract(i).magnitude;const s=this.editor.previewToWorld(2*n);if(s>this.minLength){this.setContainerProperties(this.id,{width:s},true);if(this.isSpriteText){const a=this.getContainerProperties(this.id);this.textToolStore.changeWidth(a.width)}}};this.onPaddingDrag=({x:e,y:t})=>{if(this.isSpriteTextDesign){let i=this.getContainerProperties(this.id);const o=new A(this.currentSprite.position);const n=new A(e,t);const s=n.subtract(o).magnitude;const a=Math.max(this.editor.previewToWorld(s)-i.width/2,0);this.setContainerProperties(this.id,{padding:a},true);if(this.isSpriteTextDesign){i=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(i.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:e,flipVertically:t}=this.editor.outputContainer.getData();Object.values(this.container).forEach(i=>{if(i.type==="text"||i.type==="text-design"){i.setFlipHorizontally(e);i.setFlipVertically(t)}})};this.reverseTextHorizontally=e=>{Object.values(this.container).forEach(t=>{if(t.type==="text"||t.type==="text-design"){t.setFlipHorizontally(e)}})};this.reverseTextVertically=e=>{Object.values(this.container).forEach(t=>{if(t.type==="text"||t.type==="text-design"){t.setFlipVertically(e)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=e=>{return this.container[e].getData()};this.getContainerTransform=e=>{return this.container[e].getTransform()};this.getDuplicateContainerTransform=e=>{const t=this.container[e].getTransform();const i=this.editor.shortestOutputSide*.1;const o=new A(t.position).add(new A(i,i));return{...t,position:o}};this.getDuplicateContainerFlip=e=>{const t=this.container[e].getFlipHorizontally();const i=this.container[e].getFlipVertically();return{flipHorizontally:t,flipVertically:i}};this.updatePositionAndSize=(e=this.id,t=false)=>{const{position:i,size:o}=this.getSizePositionFromContainer(e);const n=this.state.get(e);if(n){n.position.x=i.x;n.position.y=i.y;n.size.width=o.width;n.size.height=o.height;if(t){const s=this.container[e].getRotation();this.container[e].setRotation(s);n.rotation=this.container[e].getRotation()}this.state.set(e,n)}};this.getInitialTransform=e=>{const t=this.editor.outputToWorld(IKe.position);if(!e){const i=this.editor.outputContainer.getRotation();return{rotation:i,position:t}}return{position:t,...e}};this.setInitialSpriteState=(e,t)=>{const i=this.container[e];const{position:o,size:n}=this.getSizePositionFromContainer(e);const s=i.getRotation();const a=t!=="sticker"?false:i.getFlipHorizontally();const l=t!=="sticker"?false:i.getFlipVertically();this.state.set(e,{tool:t,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l})};this.setStickerSize=e=>{const t=this.container[this.id];t.setSizeInWorldSpace(this.editor.previewSizeToWorld(e));const i=this.currentSprite;if(i){i.size=this.editor.worldSizeToPreview(t.getSizeInWorldSpace());this.state.set(this.id,i)}};this.setTextSize=e=>{let t=this.getContainerProperties(this.id);const i={width:this.editor.previewToWorld(e)};const o=i.width/t.width;const n={fontSize:Math.round(t.fontSize*o)};const s=this.isSpriteText?{...i,...n}:i;if(i.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,s,true);t=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(t.fontSize,true);this.textToolStore.changeWidth(t.width)}};this.setTextDesignScale=e=>{let t=this.getContainerProperties(this.id);const i=t.width*e;if(i>this.minLength){this.setContainerProperties(this.id,{width:i},true);const{width:o}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(o);t=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(t.padding)}};this.getSizePositionFromContainer=(e=this.id)=>{const t=this.container[e];if(t){const i=this.editor.worldToPreview(t.getPosition());const o=this.editor.worldSizeToPreview(t.getSizeInWorldSpace());return{position:i,size:o}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(e=this.id)=>{const t=this.container[e];if(t){return this.editor.worldSizeToPreview(t.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=e;this.container={};this.stickerToolStore=new Ve(e);this.textToolStore=new Ie(e);this.textDesignToolStore=new je(e);this.rect=new tr(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(e,t){return new A(e,t||e).magnitude}static sizeMagnitude(e){return Math.sqrt(e.width*e.width+e.height*e.height)}async updateStateByHistoryState(e,t,i){await(0,Ppe.default)(e,async o=>{const n=t.common[o];if(!n)return;if(this.state.get(o)){this.updateExistingItem(o,t)}else{await this.addNewItem(o,t)}});e.forEach(o=>{const n=t.common[o];const s=this.container[o];if(!n||!s)return;s.setIndexInParent(n.order+i)});this.counter+=1}async addNewItem(e,t){const i=t.common[e];const o=i.size?{width:this.editor.worldToPreview(i.size.width),height:this.editor.worldToPreview(i.size.height)}:void 0;const{flipHorizontally:n,flipVertically:s}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=s!==n?i.rotation-a:i.rotation+a;const u=s!==n?-l:l;const c={spriteId:e,transform:{size:o,position:new A(i.position),rotation:u}};if(t.text[e]){const d=t.text[e];const m=this.textToolStore.validFontWithConfig(d.identifier);d.identifier=m==null?void 0:m.identifier;await this.addNewText(c,d);return}if(t.textdesign[e]){await this.addNewTextDesign(c,t.textdesign[e]);return}if(t.sticker[e]){const d=this.stickerToolStore.items.find(m=>m.identifier===t.sticker[e].identifier);await this.addNewSticker(c,{...t.sticker[e],flipHorizontally:i.flipHorizontally,flipVertically:i.flipVertically,resizeMode:t.sticker[e].resizeMode||(d==null?void 0:d.resizeMode)||"keepAspect"})}}updateExistingItem(e,t){const i=t.common[e];const o=this.state.get(e);this.state.set(e,o);const n=this.container[e];n.setPosition(new A(i.position));n.setRotation(i.rotation);o.rotation=n.getRotation();if(i.flipHorizontally!==void 0){n.setFlipHorizontally(i.flipHorizontally)}if(i.flipVertically!==void 0){n.setFlipVertically(i.flipVertically)}if(t.text[e]){const s=t.text[e];this.textToolStore.updateStateFromHistory(e,{...s,fontIdentifier:s.identifier})}if(t.textdesign[e]){const s=t.textdesign[e];this.textDesignToolStore.updateStateFromHistory(e,{...s,inverted:s.isInverted})}if(t.sticker[e]){n.setSizeInWorldSpace(i.size);this.stickerToolStore.updateStateFromHistory(e,t.sticker[e])}this.updatePositionAndSize(e)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==e5}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:e,flipVertically:t}=this.editor.outputContainer.getData();const i=this.editor.outputContainer.getRotation();return Rb({rotation:this.currentSprite.rotation-i,flipHorizontally:e,flipVertically:t})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const e=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:e,y:t}=this.currentSprite.position;const{height:i,width:o}=this.currentSprite.size;return{x:Math.round(e-o/2),y:Math.round(t-i/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:e}=this.rect;return{x:e.x-this.editor.worldToPreview(this.padding),y:e.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:e}=this.rect;return{x:e.x+this.editor.worldToPreview(this.padding),y:e.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(e){this.selectedId.set(e)}};he=Nb;g([se],he.prototype,"counter",2);g([C],he.prototype,"addSticker",2);g([C],he.prototype,"addStickerAsync",2);g([C],he.prototype,"addText",2);g([C],he.prototype,"addTextAsync",2);g([C],he.prototype,"addTextDesign",2);g([C],he.prototype,"addTextDesignAsync",2);g([C],he.prototype,"clickableCanvas",2);g([C],he.prototype,"setContainerProperties",2);g([C],he.prototype,"setContainerPosition",2);g([C],he.prototype,"pureRemoveSprite",2);g([C],he.prototype,"deleteSprite",2);g([C],he.prototype,"removeSprite",2);g([C],he.prototype,"addSnapshot",2);g([C],he.prototype,"addNewText",2);g([C],he.prototype,"addNewTextDesign",2);g([C],he.prototype,"addNewSticker",2);g([C],he.prototype,"updateStateFromSerialization",2);g([C],he.prototype,"updateStateFromHistory",2);g([C],he.prototype,"updateCanvasControls",2);g([C],he.prototype,"setEditMode",2);g([C],he.prototype,"setDragMode",2);g([C],he.prototype,"setPosition",2);g([C],he.prototype,"setSize",2);g([C],he.prototype,"setRotation",2);g([C],he.prototype,"onCanvasClick",2);g([C],he.prototype,"select",2);g([C],he.prototype,"selectLast",2);g([C],he.prototype,"selectNext",2);g([C],he.prototype,"deselect",2);g([C],he.prototype,"bringToFront",2);g([C],he.prototype,"flipHorizontally",2);g([C],he.prototype,"pureReset",2);g([C],he.prototype,"onCornerDrag",2);g([C],he.prototype,"onWidthDrag",2);g([C],he.prototype,"onPaddingDrag",2);g([C],he.prototype,"correctTextFlip",2);g([C],he.prototype,"reverseTextHorizontally",2);g([C],he.prototype,"reverseTextVertically",2);g([C],he.prototype,"dispose",2);g([S],he.prototype,"currentSprite",1);g([S],he.prototype,"padding",1);g([S],he.prototype,"isEditMode",1);g([S],he.prototype,"isDragMode",1);g([S],he.prototype,"id",1);g([S],he.prototype,"isSpriteSelected",1);g([S],he.prototype,"position",1);g([S],he.prototype,"tool",1);g([S],he.prototype,"size",1);g([S],he.prototype,"rotation",1);g([S],he.prototype,"rotationWRTOutputRotation",1);g([S],he.prototype,"flipHorizontal",1);g([S],he.prototype,"isSpriteSticker",1);g([S],he.prototype,"isSpriteText",1);g([S],he.prototype,"isSpriteTextDesign",1);g([S],he.prototype,"isOnTop",1);g([S],he.prototype,"spritePosition",1);g([S],he.prototype,"currentRect",1);g([S],he.prototype,"leftTopPosition",1);g([S],he.prototype,"leftBottomPosition",1);g([S],he.prototype,"leftMidPosition",1);g([S],he.prototype,"leftMidPadPosition",1);g([S],he.prototype,"rightTopPosition",1);g([S],he.prototype,"rightBottomPosition",1);g([S],he.prototype,"rightMidPosition",1);g([S],he.prototype,"rightMidPadPosition",1);g([S],he.prototype,"leftBottomHandlePosition",1);g([S],he.prototype,"rightBottomHandlePosition",1);g([S],he.prototype,"historyLocale",1);g([S],he.prototype,"stickerLocale",1);g([S],he.prototype,"textLocale",1);g([S],he.prototype,"textDesignLocale",1)});var Bpe=p(()=>{t5()});var EKe,Xi;var r5=p(()=>{Le();P();EKe={categories:[],query:""};Xi=class{constructor(e){this.initProvider=e=>{if(e){this.libraryProvider=new e}};this.fetchImages=async(e="")=>{if(this.libraryProvider){let t=null;try{const i=await this.libraryProvider.getCategories();const o=await this.libraryProvider.searchImages(e);t=i.map((n,s)=>{const a=o.filter(l=>l.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(l=>({name:l.title||`image${s}`,identifier:`${n.name}-${l.title}-${s}`,thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar}))}}).filter(n=>n.items.length)}catch(i){console.log(i)}ar(()=>{this.state.query=e;this.state.categories=t})}};this.toggleCategorySelection=e=>{this.selectedCategory=this.selectedCategory!==e?e:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=e=>{const t=this.items.findIndex(i=>i.identifier===e);if(t!==-1){return this.items[t].rawUrl}return e};this.configStore=e.configStore;this.state=se(EKe);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(e=>e.items).reduce((e,t)=>[...e,...t],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};g([se],Xi.prototype,"selectedCategory",2);g([C],Xi.prototype,"initProvider",2);g([C],Xi.prototype,"fetchImages",2);g([C],Xi.prototype,"toggleCategorySelection",2);g([C],Xi.prototype,"dispose",2);g([S],Xi.prototype,"selectedCategoryIdentifier",1);g([S],Xi.prototype,"categories",1);g([S],Xi.prototype,"items",1);g([S],Xi.prototype,"query",1);g([S],Xi.prototype,"config",1);g([S],Xi.prototype,"locale",1)});var Mpe=p(()=>{r5()});var Lpe,ii;var zpe=p(()=>{P();$s();H();Lpe=(r="image/png")=>`data:${r};base64,`;ii=class{constructor(e){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const t=ge.relativeToAbsolutePoint(e,this.cropSpace,false);return ge.pointFromSpaceToSpace(t,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,t=>t.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:ii.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const t={};if(e.image){t.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(Lpe(),""):""};t.image.data=t.image.data?Lpe()+t.image.data:""}return t}deserializeTransformation(e){const t={};const i=e.operations.find(s=>s.type==="orientation");const o=e.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;t.transform=ii.initializeEmptyTransform();if(i!=null){t.transform.outputRotation=i.options.rotation;t.transform.flipHorizontally=i.options.flipHorizontally||false;t.transform.flipVertically=i.options.flipVertically||false}if(o){t.transform.start=o.options.start;t.transform.end=o.options.end;t.transform.rotation=o.options.rotation||0;t.transform.identifier=o.options.meta?o.options.meta.identifier:""}return t}deserialize(e){var n,s;const t={};if(e.meta?!ii.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const i=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=i;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(a=>{switch(a.type){case"filter":t.filter=ii.deserializeFilter(a.options);break;case"adjustments":t.adjustment=ii.deserializeAdjustments(a.options);break;case"focus":t.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(u=>{switch(u.type){case"frame":t.frame=this.deserializeFrame(u.options);break;case"overlay":t.overlay=ii.deserializeOverlay(u.options);break;case"brush":if(!t.brush){t.brush=this.deserializeBrush(u.options)}else{t.brush.strokes.push(...this.deserializeBrush(u.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!t.sprite){t.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const c=We();t.sprite.spriteIdList.push(c);t.sprite.common[c]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(u.options.position),tool:"sticker",rotation:u.options.rotation||0,flipHorizontally:u.options.flipHorizontally,flipVertically:u.options.flipVertically};this.spriteOrder+=1;if(u.type==="sticker"){t.sprite.common[c].tool="sticker";t.sprite.common[c].size={width:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.y)};t.sprite.sticker[c]=ii.deserializeStickers(u.options)}else if(u.type==="text"){t.sprite.common[c].tool="text";t.sprite.text[c]=this.deserializeTexts(u.options)}else if(u.type==="textdesign"){t.sprite.common[c].tool="textdesign";t.sprite.textdesign[c]=this.deserializeTextDesign(u.options)}break;default:break}});break;default:break}});if(e.assetLibrary){t.customStickers=((s=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return t}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:ii.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:break}return void 0}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new A(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new A(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const t=new A(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new A(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new A(this.mapRelativeCropPointToImageSpace(e.start)).add(new A(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(t.y,t.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:Ss(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:ii.deserialzeColor(e.color),backgroundColor:ii.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:ii.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(t=>{return{path:{controlPoints:t.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:ii.deserialzeColor(t.brush.color),size:t.brush.size,hardness:t.brush.hardness}}})}}}});var Upe,oi;var Npe=p(()=>{P();$s();H();Upe=(r="image/png")=>`data:${r};base64,`;oi=class{constructor(e){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const t=ge.relativeToAbsolutePoint(e,this.cropSpace,false);return ge.pointFromSpaceToSpace(t,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,t=>t.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:oi.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const t={};if(e.image){t.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(Upe(),""):""};t.image.data=t.image.data?Upe()+t.image.data:""}return t}deserializeTransformation(e){const t={};const i=e.operations.find(s=>s.type==="orientation");const o=e.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;t.transform=oi.initializeEmptyTransform();if(i!=null){t.transform.outputRotation=i.options.rotation;t.transform.flipHorizontally=i.options.flipHorizontally||false;t.transform.flipVertically=i.options.flipVertically||false}if(o){t.transform.start=o.options.start;t.transform.end=o.options.end;t.transform.rotation=o.options.rotation||0;t.transform.identifier=o.options.meta?o.options.meta.identifier:""}return t}deserialize(e){var n,s;const t={};if(e.meta?!oi.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const i=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=i;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(a=>{switch(a.type){case"filter":t.filter=oi.deserializeFilter(a.options);break;case"adjustments":t.adjustment=oi.deserializeAdjustments(a.options);break;case"focus":t.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(u=>{switch(u.type){case"frame":t.frame=this.deserializeFrame(u.options);break;case"overlay":t.overlay=oi.deserializeOverlay(u.options);break;case"brush":if(!t.brush){t.brush=this.deserializeBrush(u.options)}else{t.brush.strokes.push(...this.deserializeBrush(u.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!t.sprite){t.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const c=We();t.sprite.spriteIdList.push(c);t.sprite.common[c]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(u.options.position),tool:"sticker",rotation:u.options.rotation||0,flipHorizontally:u.options.flipHorizontally,flipVertically:u.options.flipVertically};this.spriteOrder+=1;if(u.type==="sticker"){t.sprite.common[c].tool="sticker";t.sprite.common[c].size={width:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.y)};t.sprite.sticker[c]=oi.deserializeStickers(u.options)}else if(u.type==="text"){t.sprite.common[c].tool="text";t.sprite.text[c]=this.deserializeTexts(u.options)}else if(u.type==="textdesign"){t.sprite.common[c].tool="textdesign";t.sprite.textdesign[c]=this.deserializeTextDesign(u.options)}break;default:break}});break;default:break}});if(e.assetLibrary){t.customStickers=((s=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return t}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:oi.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:return void 0}}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new A(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new A(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const t=new A(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new A(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new A(this.mapRelativeCropPointToImageSpace(e.start)).add(new A(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(t.y,t.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:Ss(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:oi.deserialzeColor(e.color),backgroundColor:oi.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:oi.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(t=>{return{path:{controlPoints:t.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:oi.deserialzeColor(t.brush.color),size:t.brush.size,hardness:t.brush.hardness}}})}}}});var kKe,DKe,OKe,RKe,AKe,FKe,PKe,BKe,MKe,LKe,zKe,UKe,NKe,qKe,HKe,Hpe;var qpe=p(()=>{kKe="@photoeditorsdk/root";DKe="5.19.3";OKe="The most comprehensive photo editor SDK for HTML5";RKe="http://github.com/imgly/pesdk-html5";AKe="PhotoEditorSDK (img.ly GmbH) ";FKe="SEE LICENSE IN LICENSE.md";PKe=true;BKe={};MKe={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};LKe={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};zKe={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};UKe={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};NKe={eslint:"7.10.0"};qKe=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];HKe={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};Hpe={name:kKe,version:DKe,description:OKe,repository:RKe,author:AKe,license:FKe,private:PKe,bin:BKe,scripts:MKe,devDependencies:LKe,dependencies:zKe,devEngines:UKe,resolutions:NKe,workspaces:qKe,husky:HKe}});var cp;var Wpe=p(()=>{P();$s();qpe();cp=class{constructor(e,t,i,o,n,s){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=e=>{const t=ge.pointFromSpaceToSpace(e,this.imageSpace,this.cropSpace,false);return ge.absoluteToRelativePoint(t,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=e=>{return e/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=e=>{return e/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(e,t=0,i=3)=>{const o=Math.tan(t);const n=Math.sqrt(o**2+1);return{x:e.x+i/n,y:e.y+i*o/n}};this.previewPosition=e;this.previewSize=t;this.outputSize=i;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale()}static serializeFilters(e){return{type:"filter",options:{intensity:e.intensity,identifier:e.identifier}}}static serializeAdjustments(e){return{type:"adjustments",options:e}}static serializeOverlay(e){return{type:"overlay",options:{identifier:e.identifier,intensity:e.opacity,blendMode:e.blendMode.replace(/[A-Z]/g,t=>` ${t.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:Hpe.version,createdAt:new Date().toISOString()}}serialise(e,t,i){const o=cp.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(t){n.type=i;n.data=t}const s=[];const a=[];const{adjustment:l}=e;if(Object.keys(l).map(b=>l[b]).filter(Boolean).length){s.push(cp.serializeAdjustments(l))}const{filter:u}=e;if(u.identifier!=="identity"){s.push(cp.serializeFilters(u))}const{overlay:c}=e;if(c.identifier!=="identity"){a.push(cp.serializeOverlay(c))}if(e.transform){const{transform:b,orientation:_}=this.serializeTransform(e.transform);const y=[b.options.start.x!==0,b.options.start.y!==0,b.options.end.x!==1,b.options.end.y!==1,b.options.rotation!==0];const T=[_.options.rotation!==0,_.options.flipVertically!==false,_.options.flipHorizontally!==false];if(y.some(w=>w)){s.push(b)}if(T.some(w=>w)){s.push(_)}}const{frame:d}=e;if(d.identifier!=="identity"){a.push(this.serialzeFrame(d))}const{focus:m}=e;if(m.identifier!=="identity"){s.push(this.serializeFocus(m))}if(e.sprite){e.sprite.spriteIdList.forEach(b=>{const _=e.sprite.common[b];switch(_.tool){case"sticker":const y=e.sprite.sticker[b];a.push(this.serializeSticker(y,_,e.transform));break;case"text":const T=e.sprite.text[b];a.push(this.serializeText(T,_));break;case"textdesign":const w=e.sprite.textdesign[b];a.push(this.serializeTextDesign(w,_));break;default:break}})}if(e.brush.strokes.length){a.push({type:"brush",options:{paths:e.brush.strokes.map(b=>{return{points:b.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:b.brush.color},size:b.brush.size,hardness:b.brush.hardness}}})}})}if(a.length){const b={type:"sprite",options:{sprites:a}};s.push(b)}const h=e.customStickers;const f={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:f}}serialzeFrame(e){return{type:"frame",options:{identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.color},size:this.mapSizeToRelativeUnscaledCropSize(e.width)}}}serializeFocus(e){const t=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(e.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(e.linear.start),end:this.mapImagePointToRelativeCropPoint(e.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(e.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(e.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(e.radial.center,0,e.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(e.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:i}=e;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(i.origin,i.rotation,t/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(i.origin,i.rotation,-t/2)),size:this.mapSizeToRelativeScaledCropSize(e.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(e.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(e.gaussian.blurRadius)}}}}}serializeSticker(e,t,i){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(t.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(t.size.width),y:this.mapSizeToRelativeScaledCropSize(t.size.height)},rotation:t.rotation,flipVertically:(t.flipVertically||false)!==(i.flipVertically||false),flipHorizontally:(t.flipHorizontally||false)!==(i.flipHorizontally||false),identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.tintColor},tintMode:e.tintMode}}}serializeText(e,t){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(t.position),rotation:t.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:e.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(e.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(e.width),text:e.text,lineHeight:e.lineHeight,color:{rgba:e.textColor},backgroundColor:{rgba:e.backgroundColor},alignment:e.alignment}}}serializeTextDesign(e,t){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(t.position),rotation:t.rotation,flipVertically:false,flipHorizontally:false,identifier:e.identifier,inverted:e.isInverted,text:e.text,seed:e.seed,width:this.mapSizeToRelativeScaledCropSize(e.width),padding:this.mapSizeToRelativeScaledCropSize(e.padding),color:{rgba:e.color}}}}serializeTransform(e){const{start:t,end:i}=e;const o={type:"transform",options:{start:t,end:i,rotation:e.rotation,meta:{identifier:e.identifier}}};const n={type:"orientation",options:{rotation:e.outputRotation,flipHorizontally:e.flipHorizontally,flipVertically:e.flipVertically}};return{transform:o,orientation:n}}}});var i5={};St(i5,{Deserializers:()=>WKe,Serializer:()=>cp});var WKe;var o5=p(()=>{zpe();Npe();Wpe();WKe={"3.9.0":oi,"3.12.0":ii}});var Gpe,GKe,VKe,jKe,qb;var Vpe=p(()=>{Le();P();H();Gpe=/^data:image\/(.+?);base64,/;GKe=r=>Gpe.test(r);VKe=r=>r.match(/^data:([^;]+)/)[1];jKe=r=>r.replace(Gpe,"");qb=class{constructor(e){this.applySerialization=async(e,t,i,o)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const s="Unexpected error occured";const a=t.deserializeImage(e);if(a.image&&a.image.data){const c=a.image.data;await this.editor.setImage(c);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(c);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const l=t.deserializeTransformation(e);if(!l){o(s);return}await this.applyStateOnUI(l);const u=t.deserialize(e);if(!u){o(s);return}await this.applyStateOnUI(u);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}i()};this.editor=e}serialize({image:e}={image:false}){const t=this.editor.activeStore.tool==="transform";const{displaySerializationModal:i}=this.editor.configStore.config;if(i){this.editor.modalStore.showInfoModal("saving")}return new Promise((o,n)=>{Promise.resolve().then(()=>(o5(),i5)).then(async({Serializer:s})=>{try{if(t){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:a}=this.editor.imageContainer.getData();const l=this.editor.engineMediator.output.container.getResolution();const u={width:a.width,height:a.height};const c=new s(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,l,u,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const d={["adjustment"]:_e(this.editor.adjustmentsToolStore.state),["filter"]:_e(this.editor.filterToolStore.state),["focus"]:_e(this.editor.focusToolStore.serializableState),["overlay"]:_e(this.editor.overlayToolStore.state),["frame"]:_e(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:m,customStickers:h}=await this.editor.spriteStore.serializableState();m.spriteIdList=m.spriteIdList.sort((_,y)=>{const T=m.common[_].order;const w=m.common[y].order;return T-w});d.sprite=m;d.customStickers=h;d.transform=this.editor.transformToolStore.serializableState;let f;let b;if(e){const _=qb.getDataURL(a);b=VKe(_);f=jKe(_)}if(i){this.editor.modalStore.hideModal()}o(c.serialise(d,f,b));if(t){this.editor.transformToolStore.onEnter()}}catch(a){if(i){this.editor.modalStore.hideModal()}n(a)}})})}deserialize(e){this.editor.modalStore.showInfoModal("loading");return new Promise((t,i)=>{try{Promise.resolve().then(()=>(o5(),i5)).then(({Deserializers:o})=>{const n=e.version.match(/[0-3].[0-8].[0-9]/i);let s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](this.editor)}else if(o[e.version]){s=new o[e.version](this.editor)}else{s=new o["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(e,s,t,i)})}else{this.applySerialization(e,s,t,i)}})}catch(o){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}i(o)}})}static getDataURL(e){if(e instanceof HTMLImageElement){const{src:n}=e;if(GKe(n)){return n}}if(e instanceof HTMLCanvasElement){return e.toDataURL("image/png")}const t=document.createElement("canvas");t.width=e.width;t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0);const o=t.toDataURL("image/png");nt(t);return o}async applyStateOnUI(e){const t=this.editor.activeStore.tool==="transform";try{if(e.transform){if(!t){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(e.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!t){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(e.filter){await this.editor.filterToolStore.updateStateFromSerialization(e.filter)}if(e.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(e.adjustment)}if(e.focus){await this.editor.focusToolStore.updateStateFromSerialization(e.focus)}if(e.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(e.overlay)}if(e.sprite){let i=Object.keys(e).length-1;if(e.customStickers){i-=1}e.sprite.spriteIdList=e.sprite.spriteIdList.sort((o,n)=>{const s=e.sprite.common[o].order;const a=e.sprite.common[n].order;return s-a});await this.editor.spriteStore.updateStateFromSerialization(e.sprite,e.customStickers,Math.max(0,i))}if(e.brush){this.editor.brushToolStore.updateStateFromHistory(e.brush)}if(e.frame){await this.editor.frameToolStore.updateStateFromSerialization(e.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(i){if(i.name==="AssetNotFoundError"){console.error(i)}else{console.error(i);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:i.message,handleConfirm:()=>{this.applyStateOnUI(e)}})}}}}});var $Ke,n5;var jpe=p(()=>{$Ke=r=>{const e=atob(r.split(",")[1]);const t=r.split(",")[0].split(":")[1].split(";")[0];const i=new ArrayBuffer(e.length);const o=new Uint8Array(i);for(let n=0;n{P();$pe=r=>r.split(",")[0].split(":")[1].split(";")[0];Kpe=r=>{if(typeof r==="string"){return $pe(r)}if(r.src.includes(".svg")){return"image/svg+xml"}if(r.src){return $pe(r.src)}return"image/jpeg"}});var Ww,Hb;var Ype=p(()=>{Db();Ww=v(Fm());P();$s();Hb=class{static isImageElement(e){return e instanceof HTMLImageElement}constructor({license:e,assetProvider:t,crossOrigin:i,backgroundColor:o}){this.crossOrigin=i;this.engine=new Jh({license:e,crossOrigin:i,assetProvider:t,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:o})}getAllFilterPreviewThumbnails(e){return new Promise((t,i)=>{const o=[];const n=[];e.forEach(s=>{if(s.isDuotone)o.push(s.identifier);else n.push(s.identifier)});this.getAllDuotonePreview(o).then(s=>{this.getAllLutPreview(n).then(a=>{t(Object.assign(s,a))}).catch(a=>{i(a)})}).catch(s=>{i(s)})})}async getAllDuotonePreview(e){const t={};if(!e.length)return t;const i=await this.engine.addDuoToneFilterFromAssets(e[0],this.container);await(0,Ww.default)(e,async o=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(o);const s=i.filterOperation.getFilter();s.set({intensity:.5,lightColor:fe.Color.fromHex(n.lightColor),darkColor:fe.Color.fromHex(n.darkColor)});const a=await this.engine.export("data-url","image/jpeg",.8,false,true);t[o]=a},{concurrency:1});this.engine.removeEffect(i);return t}async loadLutAssets(e){const t={};await(0,Ww.default)(e,async i=>{t[i]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",i))});return t}async getAllLutPreview(e){const t={};if(!e.length)return t;const i=await this.loadLutAssets(e);const o=await this.engine.addLUTFilterFromAssets(e[0],this.container);await(0,Ww.default)(e,async n=>{const s=this.engine.assetProvider.getLUTFilterAsset(n);const a=o.filterOperation.getFilter();const l={horizontalTileCount:s.horizontalTileCount||5,verticalTileCount:s.verticalTileCount||5,image:i[n]};a.set({...l,intensity:s.defaultIntensity||1});o.setProperties({intensity:1});a._lutPrimitive.set(l);const u=await this.engine.export("data-url","image/jpeg",.8,false,true);t[n]=u},{concurrency:1});this.engine.removeEffect(o);return t}addImageToContainer(e){return new Promise((t,i)=>{let o;if(Hb.isImageElement(e)){o=e;this.setBackgroundImage(o);t()}else{this.getImageElement(e).then(n=>{o=n;this.setBackgroundImage(o);t()}).catch(n=>{i({identifier:"imageLoading",message:n.message})})}})}getImageElement(e){return new Promise((t,i)=>{const o=new Image;o.addEventListener("load",()=>{t(o)});o.addEventListener("error",n=>{i(n)});o.crossOrigin=this.crossOrigin;o.src=e})}setBackgroundImage(e){if(!this.container){this.container=this.engine.addImage({image:e,blendMode:"normal",opacity:1})}else{this.container.setData({image:e})}const{size:t}=this.container.getBounds();const i=this.engine.getOutputContainer();i.setResolution(t)}}});var KKe,Gn;var s5=p(()=>{Le();H();KKe={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};Gn=class{constructor(e){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(e,t)=>{const{height:i,width:o}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:s,snapToTop:a,snapToBottom:l}=this.configStore.config.snapping.position;const u=Math.min(i,o);let c=0;if(t==="bottom"){c=Math.round(i-u*l)}else if(t==="top"){c=Math.round(u*a)}else if(t==="right"){c=Math.round(o-u*s)}else if(t==="left"){c=Math.round(u*n)}else if(e==="vertical"&&t==="center"){c=Math.round(o/2)}else if(e==="horizontal"&&t==="center"){c=Math.round(i/2)}return c};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:e,snapToLeft:t,snapToRight:i}=this.configStore.config.snapping.position;const o=[];if(e){o.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(t){o.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(i){o.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return o};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:e,snapToTop:t,snapToBottom:i}=this.configStore.config.snapping.position;const o=[];if(e){o.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(t){o.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(i){o.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return o};this.getRotationGuidesFromConfig=()=>{const{angles:e}=this.configStore.config.snapping.rotation;const t=[];e.forEach(o=>{t.push(o);t.push(o+360);t.push(o-360)});const i=t.filter((o,n)=>t.indexOf(o)===n);return i.map(o=>({value:o*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:e,leftBottom:t,rightTop:i,rightBottom:o})=>{const n=Math.min(e.y,i.y,t.y,o.y);const s=Math.max(e.y,i.y,t.y,o.y);const a=Math.min(e.x,i.x,t.x,o.x);const l=Math.max(e.x,i.x,t.x,o.x);return{height:Math.round(s-n),width:Math.round(l-a)}};this.mapRange=({value:e,fromMin:t,fromLength:i,toMin:o,toLength:n})=>{return(e-t)*n/i+o};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(e,t,i,o)=>{if(t.length===0){return e}if(t[0]>e){return e-i}for(let n=0;n=a-d){return a+c+(o?i*2:0)}return this.mapRange({value:e,fromMin:s,fromLength:a-s,toMin:l,toLength:u-l})}}if(o){return e+(t.length-1)*i*2+i}return e};this.mapFromSnapSystem=(e,t,i,o)=>{if(t.length===0){return e}if(t[0]>e){if(e>=t[0]-i){return t[0]}return e+i}let n=e;for(let a=0;a{const i=t*.5;const{value:o,edge:n}=e;let s=o;if(n==="leading"){s+=i}else if(n==="trailing"){s-=i}return s};this.mapSnappingGuidesToCenter=(e,t)=>{const i=[];e.forEach(o=>{i.push(this.centerSnapValue(o,t))});return i};this.calcSnapThresholdInRadians=(e,t)=>{if(e===0){return 0}return t/e};this.calculatePreviewTopLeftPosition=()=>{const e=this.editor.engineMediator.preview.container.getPosition();const t=this.editor.getPreviewSize();const i=En();this.previewTopLeftPosition={x:e.x/i-t.width/2,y:e.y/i-t.height/2}};this.snapToRotation=(e,t,i)=>{const{rotationGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.rotation;const{x:a,y:l}=this.previewTopLeftPosition;const{width:u}=this.editor.getPreviewSize();let c=(e+Math.PI*2)%(Math.PI*2);if(n){const d=new A(t).magnitude;const m=o.map(b=>b.value).sort((b,_)=>b-_);const h=this.calcSnapThresholdInRadians(d,s);if(!this.rotationOffset){const b=this.mapToSnapSystem(e,m,h,false);this.rotationOffset=b-c}c=this.mapFromSnapSystem(c+this.rotationOffset,m,h,false);const f={x:i.position.x-a-u,y:i.position.y-l};o.forEach(b=>{b.isVisible=b.value===c;b.position=f});return c}return e};this.snapToPosition=(e,t)=>{const{horizontalGuides:i,verticalGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.position;const a=new A(this.previewTopLeftPosition);const{height:l,width:u}=this.getSpriteDimensions(t);const{x:c,y:d}=new A(e).subtract(a);if(n){const m=this.mapSnappingGuidesToCenter(i,l).sort((_,y)=>_-y);const h=this.mapSnappingGuidesToCenter(o,u).sort((_,y)=>_-y);if(!this.positionOffset){const _=this.mapToSnapSystem(c,h,s,true);const y=this.mapToSnapSystem(d,m,s,true);this.positionOffset=new A(_,y).subtract(new A(c,d))}let f=this.mapFromSnapSystem(c+this.positionOffset.x,h,s,true);let b=this.mapFromSnapSystem(d+this.positionOffset.y,m,s,true);f=Math.round(f);b=Math.round(b);i.forEach(_=>{const y=Math.round(this.centerSnapValue(_,l));_.isVisible=y===b});o.forEach(_=>{const y=Math.round(this.centerSnapValue(_,u));_.isVisible=y===f});return new A(f,b).add(a)}return{x:c,y:d}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=e;this.configStore=e.configStore;this.state=se(KKe);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(e=>({...e,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(e=>({...e,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(e=>({...e,isVisible:false}))}get positionGuides(){const{verticalGuides:e,horizontalGuides:t}=this.state;return[...e,...t]}get rotationGuides(){return this.state.rotationGuides}};g([se],Gn.prototype,"state",2);g([C],Gn.prototype,"snapToRotation",2);g([C],Gn.prototype,"snapToPosition",2);g([C],Gn.prototype,"hidePositionGuides",1);g([C],Gn.prototype,"hideRotationGuides",1);g([C],Gn.prototype,"dispose",2);g([S],Gn.prototype,"positionGuides",1);g([S],Gn.prototype,"rotationGuides",1)});var ic;var Jpe=p(()=>{Le();P();$s();H();Uw();Nw();Mw();VM();zw();qw();Hw();Vpe();aM();uM();cM();TM();r5();pM();jpe();Xpe();Ype();EM();s5();t5();QM();ic=class{constructor(e,t){this.initWithImage=async e=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(e);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const t=this.configStore.config.engine;this.previewThumbnails=new Hb({...t,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(t){this.configStore.events.onErrorImageLoading(t);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:t.identifier?t.identifier:"rendering",error:t,handleConfirm:()=>{this.initWithImage(e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:e,height:t})=>{const{maxMegaPixels:i}=this.configStore.config.engine.downscaleOptions;const o=Jg.isMobile()?i.mobile:i.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${o}`,width:`${e}`,height:`${t}`}})})};this.init=e=>{var o,n;if(!((o=this.activeStore)==null?void 0:o.image)){this.initWithImage(e);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const t=this.historyStore.isDirty();const{displayDiscardChangesWarning:i}=this.configStore.config;if(t&&i){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(e);this.resetToolStates()},handleDismiss:()=>{this.setImage(e,true)}});return}if(t&&!i){this.setImage(e,true);return}this.historyStore.reset();this.setImage(e,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:s,displayCanvasRendererWarning:a}=this.configStore.config;if(s.preferredRenderer==="canvas"&&a){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(e,t=false)=>{try{if(!this.activeStore.image){this.initWithImage(e)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(e);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:i,flipVertically:o,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:o,flipHorizontally:i});await this.transformToolStore.rotateOutputContainer(ny(n),false);if(t){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const s=this.activeStore.tool;if(!s){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(i){this.configStore.events.onErrorImageLoading(i);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:i.identifier?i.identifier:"rendering",error:i,handleConfirm:()=>{this.setImage(e,t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(i)}};this.onToolChange=(e,t=null,i=true)=>{var o,n;if(e===t){return}if((n=(o=this.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([e,t].indexOf("transform")!==-1){if(e==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(t==="transform"){this.transformToolStore.onEnter()}this.resize(t)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(i){this.render()}}};this.resize=(e=null)=>{if(!this.engineMediator)return;try{const t=this.activeStore.tool;const i=e==="transform"||!e&&t==="transform";this.canvasStore.resizeCanvas(e);this.transformToolStore.applyDefaultCrop();const o=_e(this.transformToolStore.maxCropMaskSize);if(!i){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const s=this.engineMediator.preview.updateTransform(n);if(s){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(o);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const a=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(a);if(!i){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(t){this.configStore.events.onErrorImageLoading(t);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:e,...t}={})=>{const i=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(i){this.transformToolStore.onLeave()}const{config:o}=this.configStore;const n={...o.export.image,...t};const{exportType:s,format:a,quality:l,enableDownload:u,transparent:c}=n;const d=await this.engineMediator.engine.export(s,a,l,c);if(i&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(u){this.triggerFileDownload(o.export.filename,a,s,d)}if(!e){this.configStore.events.onExport(d)}return d}catch(o){if(this.modalStore){this.modalStore.hideModal()}if(i&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(o)}};this.serialize=({image:e}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:e})}return Promise.resolve({})};this.deserialize=e=>{if(this.serializationMediator){return this.serializationMediator.deserialize(e)}return Promise.resolve()};this.close=()=>{var e,t,i,o,n,s;if((((e=this.historyStore)==null?void 0:e.isDirtySinceSave)||((i=(t=this.transformToolStore)==null?void 0:t.transformHistory)==null?void 0:i.hasChanges()))&&((n=(o=this.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var a;if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}}})}else if((s=this.configStore)==null?void 0:s.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:e,height:t}=this.engine.getOutputDimensions();return{width:e,height:t}}return{width:0,height:0}};this.wait=(e=0)=>new Promise(t=>setTimeout(t,e));this.clickableCanvas=async e=>{if(e){await new Promise(t=>setTimeout(t,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:e}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(e){const t=this.transformToolStore.localOutputImageSize;const i=t.width/t.height;const o=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(o.indexOf(parseFloat(i.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(e,t,i)=>{this.historyStore.addSnapshot(e,t,i)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=e=>this.assetProvider.getPathForCategory(e);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=e=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(e)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:e,height:t}=this.engine.getOutputDimensions();if(e&&t){return{width:Math.round(this.worldToPreview(this.outputToWorld(e))),height:Math.round(this.worldToPreview(this.outputToWorld(t)))}}return{height:t,width:e}};this.getImageMimeType=()=>{return Kpe(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var e,t,i;(i=(t=(e=this.engineMediator)==null?void 0:e.image)==null?void 0:t.container)==null?void 0:i.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(e,t,i,o)=>{const n=t==="image/jpeg"&&i!=="ms-blob"?".jpeg":".png";const s=e+n;const a=this.blobFromExportData(o);this.triggerBlobDownload(s,a)};this.triggerBlobDownload=(e,t)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(t,e)}else{const i=document.createElement("a");const o=URL.createObjectURL(t);i.href=o;i.download=e;document.body.appendChild(i);i.click();document.body.removeChild(i);if(!CK()){URL.revokeObjectURL(o)}}};this.blobFromExportData=e=>{if(typeof e==="string"){return n5(e)}if(e instanceof HTMLImageElement){return n5(e.src)}return e};this.configStore=new Ii;if(t){Object.entries(t).forEach(([o,n])=>{this.configStore.events.on(o,n)})}const i=this.configStore.saveConfig(e);this.engineMediator=new GM(this);this.serializationMediator=new qb(this);this.spriteStore=new he(this);this.scale=new _r(this);this.filterToolStore=new or(this);this.adjustmentsToolStore=new dt(this);this.focusToolStore=new Ge(this);this.overlayToolStore=new yr(this);this.frameToolStore=new Xt(this);this.brushToolStore=new qt(this);this.transformToolStore=new ae(this);this.libraryStore=new Xi(this);this.modalStore=new Do(this);this.snappingStore=new Gn(this);this.activeStore=new Ki(this);this.canvasStore=new ri(this);this.historyStore=new lp(this);this.libraryStore.initProvider(i);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const e=this.outputContainer.getBounds();return Math.min(e.width,e.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(e,t){if(!this.engineMediator)return{x:0,y:0};if(Ho(e)){return this.engineMediator.previewSpaceToWorldSpace(e,t)}return this.engineMediator.previewSpaceToWorldSpace(e,t)}worldToPreview(e){if(!this.engineMediator)return{x:0,y:0};if(Ho(e)){return this.engineMediator.worldSpaceToPreviewSpace(e)}return this.engineMediator.worldSpaceToPreviewSpace(e)}worldSizeToPreview(e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(e.width),height:this.engineMediator.worldSpaceToPreviewSpace(e.height)}}previewSizeToWorld(e,t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(e.width,t),height:this.engineMediator.previewSpaceToWorldSpace(e.height,t)}}outputToWorld(e){if(!this.engineMediator)return{x:0,y:0};if(Ho(e)){return this.engineMediator.outputSpaceToWorldSpace(e)}return this.engineMediator.outputSpaceToWorldSpace(e)}previewToOutput(e){if(!this.engineMediator)return{x:0,y:0};if(Ho(e)){return this.engineMediator.previewSpaceToOutputSpace(e)}return this.engineMediator.previewSpaceToOutputSpace(e)}get outputContainer(){return this.engineMediator.output.container}};g([C],ic.prototype,"resize",2);g([C],ic.prototype,"export",2);g([C],ic.prototype,"clickableCanvas",2)});var at=p(()=>{H();$i();Tw();Ude();aM();uM();cM();pM();epe();ope();npe();TM();upe();Fpe();Bpe();Mpe();Hw();zw();Jpe();FM();Mw();Uw();Nw();qw();s5();Bb();zb();Mb();tc();Xs();Yh()});var Wb,Gb,Zpe,Qpe,XKe,YKe,eme;var tme=p(()=>{Wb=v(require("react"));M();Gb=v(require("styled-components"));P();at();H();ur();Zpe=Se.Button.TextSecondary;Qpe=Gb.default.span` font-size: 14px; padding: 3px 1px 2px; color: ${r=>r.theme.canvasActionBar.foreground}; diff --git a/cjs/no-polyfills.js b/cjs/no-polyfills.js index 04c85c3..51902e9 100644 --- a/cjs/no-polyfills.js +++ b/cjs/no-polyfills.js @@ -1551,7 +1551,7 @@ ${t}`}_compile(){const t=this._renderer.getContext();const e=this._compileShader 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.20)`,inactiveOpacity:g},textInput:{foreground:r,hoverBorderColor:r,background:"transparent",borderColor:a,inactiveOpacity:g},slider:{trackColor:s,activeTrackColor:i,thumbBackground:c,thumbBorderColor:i,inactiveOpacity:g,hoverOpacity:"0.7"},selectColor:{activeBorderColor:i,inactiveOpacity:g},toolbar:{foreground:r,background:a,activeBackground:"transparent",activeForeground:i,borderColor:"transparent"},tooltip:{background:s,foreground:r},toolControlBar:{background:"rgba(238, 238, 238, 0.9)",borderColor:c,shadow:"none",separatorColor:a,titleForeground:o,inputLabelForeground:o,inputLabelInactiveOpacity:g},mainCanvasActionBar:{background:"transparent",foreground:r,borderColor:"none"},canvasActionBar:{background:s,foreground:r,separatorColor:n},canvas:{background:u,controlsOutline:"rgba(255, 255, 255, 0.6)",controlsColor:"#ffffff",cropBackdrop:"rgba(255, 255, 255, 0.3)"},colorPicker:{listBackground:a,listShadow:`0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), - 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};Mk=Vlt});var Jh,cv,Nr;var Zh=d(()=>{Yh();BH();PH();Jh=lv();cv=av();Nr={...Jh,measurements:cv}});var $lt,MH;var LH=d(()=>{xl();Zh();$lt=i=>{if(i==="light"){return Mk}return lv};MH=(i,t)=>{const e=$lt(i);if(t&&t[i]){const{primary:r,background:o,foreground:n}=t[i];const s={primary:r,background:o,foreground:n};const a=Object.keys(s).reduce((l,c)=>{if(s[c]){return{...l,[c]:s[c]}}return l},{});return Ei([e(a),t[i]])}return e()||Jh}});var Klt,zH;var UH=d(()=>{xl();Yh();Klt=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];zH=i=>{const t=av();if(i){const e={};Object.keys(i).forEach(r=>{if(Klt.indexOf(r)!==-1){e[r]=i[r]}});return Ei([t,e])}return t}});var NH=d(()=>{AH();LH();UH()});var Xlt,Zi;var uv=d(()=>{wt();R();Ln();z();xl();Ok();DH();nk();qh();NH();Zh();Xlt={config:yl,locale:cu,theme:Jh,measurements:cv,initialMeasurements:cv};Zi=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(t,e)=>{return e.indexOf(t)!==-1};this.state=Z(Xlt);this.events=new Rk;this.licenseChecker=null}saveConfig(t){if(t.mainCanvasActions&&t.mainCanvasActions.length!==4){t.mainCanvasActions.length=4}const e=t.layout&&t.layout==="basic"?Ak:yl;const r=Ei([e,t],{clone:true});this.licenseChecker=new Jx(r.license);if(!this.licenseChecker.areCustomAssetsAllowed()){r.sticker.enableCustomUpload=false}const o=OH(r.language,r.custom.languages);const n=MH(r.theme,r.custom.themes);const s=zH(r.custom.measurements);const{provider:a}=r.library;const l=[];r.adjustment.categories=r.adjustment.categories.reduce((m,p)=>{m.push({...p,items:p.items.filter(h=>{if(!_C[h.identifier]){l.push(h.identifier);return false}return true})});return m},[]);if(l.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${l.join(", ")}`)}delete r.language;delete r.custom.languages;delete r.custom.themes;delete r.library.provider;let c=r.tools.reduce((m,p)=>{if(typeof p==="object"){return[...m,...p]}return[...m,p]},[]);if(!c.length){console.error(`Empty list input for tools`);c=Zx.reduce((m,p)=>{if(typeof p==="object"){return[...m,...p]}return[...m,p]},[])}c=c.filter(m=>this.licenseChecker.isToolAllowed(m));if(r.defaultTool){const m=this.checkDefaultToolAvailability(r.defaultTool,c);if(!m){[r.defaultTool]=c}}r.tools=c;this.state.config=r;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;const u=this.buildCustomAssetsConfig();this.assetProvider=new yp(u,this.licenseChecker.areCustomAssetsAllowed(),r.assetResolver);this.loadThemeFont();return a}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((t,e)=>{if(typeof e==="string"){return[...t,e]}return[...t,"",...e]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:t}=this.theme;if(!t.skipLoading){this.assetProvider.getFontManager().injectFonts([t])}}buildCustomAssetsConfig(){const t=this.tools;const e=lt(this.state.config);const r=this.state.config.assetBaseUrl;const{theme:o}=this.state;const n=t.indexOf("filter")!==-1?e["filter"]:void 0;const s=t.indexOf("focus")!==-1?e["focus"]:void 0;const a=t.indexOf("adjustment")!==-1?e["adjustment"]:void 0;const l=t.indexOf("sticker")!==-1?e["sticker"]:void 0;const c=t.indexOf("frame")!==-1?e["frame"]:void 0;const u=t.indexOf("overlay")!==-1?e["overlay"]:void 0;const m=t.indexOf("transform")!==-1?e["transform"]:void 0;const p=t.indexOf("text")!==-1?e["text"]:void 0;const h=t.indexOf("textdesign")!==-1?e["textdesign"]:void 0;return{basePath:r,theme:o,filter:n,focus:s,sticker:l,frame:c,overlay:u,transform:m,text:p,adjustment:a,textdesign:h}}};f([v],Zi.prototype,"saveConfig",1);f([v],Zi.prototype,"dispose",2);f([C],Zi.prototype,"config",1);f([C],Zi.prototype,"locale",1);f([C],Zi.prototype,"theme",1);f([C],Zi.prototype,"measurements",1);f([C],Zi.prototype,"initialMeasurements",1);f([C],Zi.prototype,"tools",1);f([C],Zi.prototype,"defaultTool",1);f([C],Zi.prototype,"isOrderDefault",1);f([C],Zi.prototype,"isLayoutAdvanced",1);f([C],Zi.prototype,"displayCloseButton",1)});var Lk;var zk=d(()=>{R();bC();Lk=class{constructor(t){this.editor=t}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,originalImage:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t,originalImage:t})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((t,e)=>{const{image:r}=this.editor.activeStore;if(GF(r)){this.setBackgroundImage(r);t()}else{const o=this.editor.libraryStore.getRawUrl(r);this.getImageElement(o).then(n=>{this.setBackgroundImage(n);t()}).catch(n=>{e({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,r)=>{const o=new Image;o.addEventListener("load",()=>{e(o)});o.addEventListener("error",n=>{r(n)});o.crossOrigin=this.editor.configStore.config.engine.crossOrigin;o.src=t})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}}});var Uk;var Nk=d(()=>{z();Uk=class{constructor(t){this.applyNewImageTransform=()=>{const{size:t,width:e,height:r}=this.editor.engineMediator.image.container.getBounds();const o=this.container;o.setTransform(ie.IDENTITY);o.setResolution(t);o.setPivot(.5,.5);o.setPosition({x:e/2,y:r/2})};this.editor=t}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}}});function Qh(i,t){const e=i.width/i.height;const r=t.width/t.height;if(e>r){return i.height/t.height}return i.width/t.width}var HH=d(()=>{});var qlt,Qs;var Hk=d(()=>{wt();z();HH();qlt={transform:ie.IDENTITY};Qs=class{constructor(t){this.initialTransform=ie.IDENTITY;this.editor=t;this.state=Z(qlt)}createPreview(t){this.container=this.editor.engine.createPreview(t)}updateTransform(t=0,e=true){const r=this.calculateTransform(t);if(r.scale.x){if(e){this.saveInitialTransform(r)}else{this.savePreviewTransform(r)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(t){this.initialTransform=t;this.savePreviewTransform(t)}savePreviewTransform(t){Ge(()=>{this.state.transform.position=t.position;this.state.transform.scale=t.scale;this.state.transform.rotation=t.rotation;const e=Do();const r=new F(t.scale).divide(e);this.previewTransformWithoutDpr={position:new F(t.position).divide(e),scale:r,rotation:t.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(t=0){const e=Do();const{scaleImageToFit:r}=this.editor.configStore.config;const{width:o,height:n}=this.editor.canvasStore.canvasSize;const s=this.editor.engine.getOutputDimensions();const a=Qh({width:o,height:n},s);let l=r?a:Math.min(1,a);const c=n-s.height*l;const u=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(cn*m){l=Qh({width:o,height:n*m},s)}if(s.width*l>o*m){l=Qh({width:o*m,height:n},s)}l*=e;const p={x:o*e/2,y:n*e/2};const h={x:l,y:l};return new ie(p,h,t)}};f([v],Qs.prototype,"updateTransform",1);f([v],Qs.prototype,"savePreviewTransform",1);f([C],Qs.prototype,"transform",1);f([C],Qs.prototype,"position",1);f([C],Qs.prototype,"scale",1);f([C],Qs.prototype,"rotation",1)});var vl,dv;var Wk=d(()=>{R();vl=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(t){if(["sticker","text","textdesign","brush"].indexOf(t)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(t,e){const r=e.findIndex(o=>o===t);if(r!==-1){e.splice(r,1)}return void 0}static indexForOrder(t,e,r){const o=t[r];const n=e.findIndex(a=>a===r);if(n!==-1){return{index:n,order:e}}const{length:s}=e;if(s){let a;for(a=0;ao===t);if(r!==-1){this.spriteContainerOrder[r]=e}}bringToFront(t){const e=this.spriteContainerOrder.findIndex(r=>r===t);if(e!==-1){this.spriteContainerOrder.splice(e,1);this.spriteContainerOrder.push(t)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:t}=this.spriteContainerOrder;return this.spriteContainerOrder[t-1]}getSpriteIndex(t){const e=this.spriteContainerOrder.findIndex(r=>r===t);return e+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};dv=vl;dv.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3}});var Gk;var Vk=d(()=>{Ln();z();zk();Nk();Hk();Wk();Gk=class{constructor(t){this.orderHelper=new dv;this.init=()=>{const t=this.editor.configStore.config.engine;this.engine=new hm({...t,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new Lk(this.editor);this.output=new Uk(this.editor);this.preview=new Qs(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=t}render(t){return this.engine.render(t)}previewSpaceToWorldSpace(t,e){const r=this.preview.previewTransformWithoutDpr;if(qr(t)){const o=this.editor.engine.convertPointFromPreviewIntoWorldSpace(F.ZERO,r,e);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:t,y:0},r,e);return F.distance(new F(o),new F(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(t,r,e)}worldSpaceToPreviewSpace(t){const e=this.preview.previewTransformWithoutDpr;if(qr(t)){const r=this.editor.engine.convertPointFromWorldIntoPreviewSpace(F.ZERO,e);const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:t,y:0},e);return F.distance(new F(r),new F(o))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(t,e)}outputSpaceToWorldSpace(t){if(qr(t)){return st.getScalarInWorldSpace(t,this.editor.engine.getOutputContainer())}return st.getPointInWorldSpace(t,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(t){const e=this.preview.previewTransformWithoutDpr;if(qr(t)){const r=this.editor.engine.convertPointFromPreviewIntoOutputSpace(F.ZERO,e);const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:t,y:0},e);return F.distance(new F(r),new F(o))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(t,e)}previewSpaceToFlippedPreviewSpace(t){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(t)}}});var _m;var WH=d(()=>{wt();_m=class{constructor(){this.snapshots=[];this.observeIndex=Z.box(-1)}addSnapshot(t){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(t))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(t)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(t){if(t>0&&t0}get canRedo(){return this.snapshots.length-1>this.index}};f([C],_m.prototype,"index",1);f([C],_m.prototype,"canUndo",1);f([C],_m.prototype,"canRedo",1)});var uu;var mv=d(()=>{wt();R();WH();Ji();uu=class{constructor(t){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const t=this.appHistoryManager.undo();await this.applyState(t);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const t=this.appHistoryManager.redo();await this.applyState(t);this.awaitHistoryChange=false}};this.editor=t;this.appHistoryManager=new _m}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const t=lt(this.editor.adjustmentsToolStore.state);const e=lt(this.editor.filterToolStore.state);const r=this.editor.focusToolStore.getFocusStateForHistory();const o=lt(this.editor.overlayToolStore.state);const n=lt(this.editor.frameToolStore.state);const{strokes:s}=this.editor.brushToolStore;const a=this.editor.spriteStore.getSpriteHistoryState();const l=this.editor.transformToolStore.serializableState;return{["adjustment"]:t,["filter"]:e,["focus"]:r,["overlay"]:o,["frame"]:n,["brush"]:s,sprite:a,["transform"]:l}}addInitialSnapshot(){const t=this.getHistoryState();this.appHistoryManager.addSnapshot({state:t,type:"add",description:"Initial State"})}addSnapshot(t,e,r){let o;if(!t){o=this.getHistoryState()}else if(t.sprite||t.transform){o={...this.getHistoryState(),...t}}else{o=t}this.appHistoryManager.addSnapshot({state:o,type:e,description:r});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:t}){try{if(t){const e=Object.keys(t);for(const r of e){switch(r){case"filter":await this.editor.filterToolStore.updateStateFromHistory(t[r]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(t[r]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(t[r]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(t[r]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(t[r],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(t[r]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(t[r]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(t[r]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(e){console.error(e);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:e,handleConfirm:()=>{this.applyState({state:t})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var t,e;return(e=(t=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:t.state)==null?void 0:e.sprite}};f([v],uu.prototype,"undo",2);f([v],uu.prototype,"redo",2);f([C],uu.prototype,"canUndo",1);f([C],uu.prototype,"canRedo",1)});var Ylt,GH,Jlt,jk;var VH=d(()=>{Ylt=(i,t)=>new Promise((e,r)=>{const o=new XMLHttpRequest;o.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){e(n.result)}else{r(new Error(`The image could not be loaded from ${i}`))}};n.onerror=s=>{r(s)};n.readAsDataURL(o.response)};o.open("GET",i);o.responseType="blob";o.withCredentials=t==="use-credentials";o.send()});GH=(i,t)=>{return new Promise((e,r)=>{const o=new Image;o.onload=()=>{e(o)};o.onerror=()=>{r(new Error(`Failed to load image with src:${i}`))};o.crossOrigin=t;o.src=i})};Jlt=(i,t)=>new Promise((e,r)=>{Ylt(i,t).then(o=>{const n=new Image;n.addEventListener("load",()=>{e(n)});n.src=o}).catch(()=>{GH(i,t).then(o=>e(o)).catch(o=>{r(o)})})});jk=async({url:i,image:t,crossOrigin:e="anonymous"})=>{try{if(t&&t.src&&t.src.substr(0,5)==="data:"||t&&t.src&&t.src.includes(".svg")){return t}if(typeof i==="string"&&i.substr(0,5)==="data:"||typeof i==="string"&&i.includes(".svg")){return GH(i,e)}return Jlt(i||t.src,e)}catch(r){throw new Error(r)}}});var Zlt,pr;var pv=d(()=>{wt();R();z();VH();Zlt={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};pr=class{constructor(t){this.setImage=async t=>{try{const{crossOrigin:e}=this.editor.configStore.config.engine;if(typeof t==="string"&&!t.trim()||t===void 0||t===null){this.state.image=null}else if(typeof t==="string"){this.state.image=await jk({url:ln(t)?t:this.editor.assetProvider.getPath(t),crossOrigin:e})}else if(t instanceof HTMLImageElement){this.state.image=await jk({image:t,crossOrigin:e})}if(this.isWebcam){this.state.isWebcam=false}}catch(e){throw new Error(e)}};this.setImageLoadedToEngine=t=>{this.state.imageLoadedToEngine=t};this.newImage=t=>{this.editor.init(t)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=t;this.state=Z(Zlt)}selectTool(t){var r,o,n;const{licenseChecker:e}=this.editor.configStore;if(this.state.tool!==t&&(e==null?void 0:e.isToolAllowed(t))&&(this.image||t==="library"||t==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const s=(n=(o=(r=this.editor.configStore.state.config["customTool"])==null?void 0:r.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(t==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,t);this.state.tool=t;this.editor.configStore.events.onToolChanged(t);switch(t){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(t){this.state.isWebcam=t}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};f([v],pr.prototype,"selectTool",1);f([v],pr.prototype,"selectWebcam",1);f([v],pr.prototype,"setImage",2);f([v],pr.prototype,"setImageLoadedToEngine",2);f([v],pr.prototype,"newImage",2);f([v],pr.prototype,"dispose",2);f([C],pr.prototype,"webcamLabel",1);f([C],pr.prototype,"tool",1);f([C],pr.prototype,"isWebcam",1);f([C],pr.prototype,"image",1);f([C],pr.prototype,"imageLoadedToEngine",1)});var Qlt,$k,Kk,Fi;var hv=d(()=>{wt();R();z();Qlt={height:150,width:150};$k={height:0,width:0};Kk=class{constructor(t){this.canvasClickDisabled=Z.box(false);this.resizeCanvas=(t=null)=>{const e=this.editor.activeStore.tool;const r=t==="transform"||!t&&e==="transform";const{isLayoutAdvanced:o,measurements:n}=this.editor.configStore;const{storedSize:s}=this.editor.canvasStore;let a=0;if(!o&&r){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(t==="transform"&&e==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:s.width,height:s.height+a})};this.setCanvasSize=t=>{this.state.canvasSize=t};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=t;this.state=Z(Kk.initialState)}setCanvasElement(t){this.canvas=t;this.editor.engineMediator.preview.createPreview(t);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:t,width:e,render:r}){const{imageLoadedToEngine:o}=this.editor.activeStore;if(t>$k.height&&e>$k.width){this.state.storedSize={width:e,height:t};if(this.state.canvasSize.height===0){this.state.canvasSize={width:e,height:t}}if(r&&o){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return F.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(t){const e=this.editor.engine.getContainersAtPreviewPoint(t,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(r=>r.getID()).filter(r=>r!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(e)}};Fi=Kk;Fi.initialState={canvasSize:$k,storedSize:Qlt};f([v],Fi.prototype,"setCanvasElement",1);f([v],Fi.prototype,"saveDimensions",1);f([v],Fi.prototype,"resizeCanvas",2);f([v],Fi.prototype,"disableCanvasClick",1);f([v],Fi.prototype,"enableCanvasClick",1);f([v],Fi.prototype,"setCanvasSize",2);f([v],Fi.prototype,"dispose",2);f([C],Fi.prototype,"isCanvasClickable",1);f([C],Fi.prototype,"canvasSize",1);f([C],Fi.prototype,"storedSize",1);f([C],Fi.prototype,"sizeVector",1);f([C],Fi.prototype,"sizeVectorMagnitude",1)});var tct,Hr;var fv=d(()=>{wt();R();tct={type:null,identifier:null,isVisible:false,error:""};Hr=class{constructor(t){this.showActionModal=({type:t,identifier:e,error:r,handleConfirm:o,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=e;this.state.type=t;this.state.error=r||"";this.handleConfirm=o;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=t.configStore;this.state=Z(tct)}showInfoModal(t){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=t;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:t}=this.state;const e=this.getModalLocale();if(e){const{bodyLabel:r,headerLabel:o,buttonYes:n,buttonNo:s}=e;return{headerLabel:o,bodyLabel:r,confirmLabel:n,dismissLabel:s,isVisible:t,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:t,measurements:{basicCanvasOffset:e,advancedUIToolControlBar:r,advancedUIToolbar:o},isOrderDefault:n}=this.configStore;const s=(r.width+o.width)*(!n?-1:1);const a=e;return t?{x:s/2,y:0}:{x:0,y:-a}}getModalLocale(){const{identifier:t,error:e,type:r}=this.state;const{locale:o}=this.configStore;if(!r||!t||r==="textEdit")return null;if(r&&t&&o[`${r}Modals`]&&o[`${r}Modals`][t]){const n=o[`${r}Modals`][t];let{body:s}=n;if(s&&typeof e==="object"){Object.keys(e).forEach(l=>{s=s.replace(`\${${l}}`,e[l])})}else if(s){s=s.replace("${error}",e)}let a=n.heading;if(r==="error"||r==="warning"){const l={error:o.common.error,warning:o.common.warning};const c=r==="error"?l.error:l.warning;a=`${c}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};f([v],Hr.prototype,"showActionModal",2);f([v],Hr.prototype,"showInfoModal",1);f([v],Hr.prototype,"showTextEditModal",1);f([v],Hr.prototype,"hideModal",2);f([v],Hr.prototype,"dispose",2);f([C],Hr.prototype,"modalProps",1);f([C],Hr.prototype,"isVisible",1);f([C],Hr.prototype,"type",1);f([C],Hr.prototype,"identifier",1);f([C],Hr.prototype,"positionOffset",1)});var Qe;var gv=d(()=>{wt();z();Qe=class{constructor(t){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(t=>t/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:t,maxOffsetY:e}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=e}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=t}this.savePosition();this.scaleRender()}};this.setOffset=t=>{const{canDragX:e,canDragY:r}=this.checkOffset(t);if(e){this.offset.x=t.x}if(r){this.offset.y=t.y}this.scaleRender()};this.editor=t}setInitialTransform(t=0){const e=Do();const{scaleImageToFit:r}=this.editor.configStore.config;const{transform:o}=this.editor.engineMediator.preview;Ge(()=>{const n=Math.abs(t||o.scale.x);this.setDefaultScale(r?n:Math.min(1*e,n));this.setPosition(o.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:t,height:e}=this.editor.canvasStore.canvas;this.setPosition({x:t/2,y:e/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(t){this.state.position.x=t.x;this.state.position.y=t.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(t){if(this.defaultScale!==1){const r=this.SCALE_LEVELS.findIndex(o=>o===this.defaultScale);if(r!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,r),...this.SCALE_LEVELS.slice(r+1)]}}const e=this.SCALE_LEVELS.findIndex(r=>r===t);if(e!==-1){this.state.scaleIndex=e}else{const r=this.SCALE_LEVELS.findIndex((o,n)=>{if(n===0){return t0;const g=u>0;const _=m-a;const x=p-l;return{canDragX:_<0,canDragY:x<0,maxOffsetX:h?-_:_,maxOffsetY:g?-x:x}}calculateScale(t=0,e=this.previewSize,r=this.defaultScale){const{width:o,height:n}=e;const s=new F({x:o,y:n});const a=new F(Math.abs(s.x*Math.cos(t))+Math.abs(s.y*Math.sin(t)),Math.abs(s.x*Math.sin(t))+Math.abs(s.y*Math.cos(t)));const l=s.subtract(a).divide(2).multiply(r).abs;if(l.y>l.x){return l.y*2/s.y+r}return l.x*2/s.x+r}get defaultIndex(){return this.SCALE_LEVELS.findIndex(t=>t===this.defaultScale)}getPositionWithOffset(t=this.offset){const{position:e}=this;return{x:e.x-t.x,y:e.y-t.y}}scaleRender(t=false){const e=this.editor.scale.getPositionWithOffset();const r=t?this.defaultScale:this.scale;const o={x:r,y:r};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(e);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:e,rotation:0});if(!t){this.editor.render()}}get scale(){const t=this.state.scaleIndex;return t!==-1?this.SCALE_LEVELS[t]:this.defaultScale}get zoomLevel(){const t=Do();return(this.scale/t*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const t=this.state.scaleIndex;const e=t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;const{previewSize:r}=this;return{width:r.width*e/this.defaultScale,height:r.height*e/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};f([Z],Qe.prototype,"state",2);f([v],Qe.prototype,"in",2);f([v],Qe.prototype,"out",2);f([v],Qe.prototype,"setInitialTransform",1);f([v],Qe.prototype,"resetScale",1);f([v],Qe.prototype,"resetPosition",1);f([v],Qe.prototype,"setPosition",1);f([v],Qe.prototype,"savePosition",1);f([v],Qe.prototype,"setDefaultScale",1);f([v],Qe.prototype,"setScaleToDefault",1);f([C],Qe.prototype,"scale",1);f([C],Qe.prototype,"zoomLevel",1);f([C],Qe.prototype,"canDrag",1);f([C],Qe.prototype,"canZoomOut",1);f([C],Qe.prototype,"canZoomIn",1);f([C],Qe.prototype,"position",1);f([C],Qe.prototype,"scaledSize",1)});var jH,ect,Wn,Le;var Xk=d(()=>{wt();z();jH=[[0,0],[0,1],[1,0],[1,1]];ect=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];Wn=class{constructor(t,e,r="center",o=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=e;this.m=r==="center"?Wn.movePivotTo([.5,.5]):jH;this.considerRotation=o;this.considerFlip=n;this.configStore=t.configStore}static getFlippedEdgeIndex(t,e,r){return ect[(e?1:0)+(r?2:0)][t]}static movePivotTo(t){return jH.map(e=>[e[0]-t[0],e[1]-t[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(t,e,r){const o=Wn.getFlippedEdgeIndex(t,e,r);const n=this.m[o][0]*this.size.width;const s=this.m[o][1]*this.size.height;return{width:n,height:s}}get leftTop(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(0,e,r);return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottom(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(1,e,r);return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightTop(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(2,e,r);return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottom(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(3,e,r);return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(1,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(3,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftMid(){const t=new F(this.leftTop);const e=new F(this.leftBottom);return t.add(e).divide(2)}get rightMid(){const t=new F(this.rightTop);const e=new F(this.rightBottom);return t.add(e).divide(2)}};Le=Wn;Le.coordinatesWithRotation=({width:t,height:e},r,o,n,s,a)=>{let l=t*Math.cos(r)-e*Math.sin(r)+a.x;let c=t*Math.sin(r)+e*Math.cos(r)+a.y;if(o){l=s.x*2-l}if(n){c=s.y*2-c}return new F({x:l,y:c}).rounded};f([C],Le.prototype,"position",1);f([C],Le.prototype,"size",1);f([C],Le.prototype,"rotation",1);f([C],Le.prototype,"flipHorizontally",1);f([C],Le.prototype,"flipVertically",1);f([C],Le.prototype,"flipCenter",1);f([C],Le.prototype,"leftTop",1);f([C],Le.prototype,"leftBottom",1);f([C],Le.prototype,"rightTop",1);f([C],Le.prototype,"rightBottom",1);f([C],Le.prototype,"leftBottomHandle",1);f([C],Le.prototype,"rightBottomHandle",1);f([C],Le.prototype,"leftMid",1);f([C],Le.prototype,"rightMid",1)});var qk=d(()=>{uv();qh();Zh();Yh();Vk();Wk();zk();Nk();Hk();mv();pv();hv();fv();gv();Xk()});var Et;var $H=d(()=>{wt();z();Ik();Et=class{constructor(t,e){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:Z.map({})};this.configStore=t.configStore;this.id=Ot();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=e}changeIdentifier(t){this.state.identifier=t;const e=this.state.cropState.get(`${this.id}-${t}`);if(!e){this.state.cropState.set(`${this.id}-${t}`,{...Vo})}}changeRatio(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){this.state.cropState.set(`${this.id}-${this.identifier}`,{...e,ratio:t})}}changeSize(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t.width&&t.width>0){e.size.width=Math.round(t.width)}if(t.height&&t.height>0){e.size.height=Math.round(t.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeHeight(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.height=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changeWidth(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.width=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changePositionX(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r&&t<=e-this.minCropSize&&t>=0){r.position.x=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}return false}changePositionY(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r&&t<=e-this.minCropSize&&t>=0){r.position.y=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}return false}changePosition(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r){if(t.x<=e.width-this.minCropSize&&t.x>=0&&t.y<=e.height-this.minCropSize&&t.y>=0){r.position.x=Math.round(t.x);r.position.y=Math.round(t.y);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}}return false}changeLockResolution(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.lockResolution=t!==void 0?t:!e.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeForceDimensions(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.forceDimensions=t;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}clearState(){this.state.cropState.forEach((t,e)=>e.startsWith(this.id)&&this.state.cropState.delete(e))}setRotation(t){this.state.rotationInDegrees=t}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:t,flipVertically:e}){this.state.flipHorizontally=t;this.state.flipVertically=e}setOutputRotation(t){this.state.outputRotation=t}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:t,height:e}=this.defaults.maxCropMaskSize;return new F(t/2,e/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:Vo.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:Vo.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:Vo.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:Vo.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:Vo.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:Vo.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:Vo.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:Vo.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:Vo.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};f([Z],Et.prototype,"state",2);f([v],Et.prototype,"changeIdentifier",1);f([v],Et.prototype,"changeRatio",1);f([v],Et.prototype,"changeSize",1);f([v],Et.prototype,"changeHeight",1);f([v],Et.prototype,"changeWidth",1);f([v],Et.prototype,"changePositionX",1);f([v],Et.prototype,"changePositionY",1);f([v],Et.prototype,"changePosition",1);f([v],Et.prototype,"changeLockResolution",1);f([v],Et.prototype,"changeForceDimensions",1);f([v],Et.prototype,"clearState",1);f([v],Et.prototype,"setRotation",1);f([v],Et.prototype,"resetRotation",1);f([v],Et.prototype,"resetOutputRotation",1);f([v],Et.prototype,"resetFlip",1);f([v],Et.prototype,"updateFlip",1);f([v],Et.prototype,"setOutputRotation",1);f([v],Et.prototype,"flipHorizontally",1);f([v],Et.prototype,"flipVertically",1);f([v],Et.prototype,"dispose",2);f([C],Et.prototype,"flipCenter",1);f([C],Et.prototype,"isFlippedHorizontal",1);f([C],Et.prototype,"isFlippedVertical",1);f([C],Et.prototype,"identifier",1);f([C],Et.prototype,"height",1);f([C],Et.prototype,"width",1);f([C],Et.prototype,"position",1);f([C],Et.prototype,"ratio",1);f([C],Et.prototype,"size",1);f([C],Et.prototype,"x",1);f([C],Et.prototype,"y",1);f([C],Et.prototype,"lockResolution",1);f([C],Et.prototype,"forceDimensions",1);f([C],Et.prototype,"selectedCrop",1);f([C],Et.prototype,"rotationInDegrees",1);f([C],Et.prototype,"outputRotation",1)});var Yk;var KH=d(()=>{wt();z();pm();Yk=class{constructor(t){this.transforms={output:JSON.stringify(ie.IDENTITY),preview:JSON.stringify(ie.IDENTITY)};this.setFrameOpacity=t=>{this.frameOpacity=t;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=t=>{this.overlayOpacity=t;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=t;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:t,flipVertically:e,rotation:r,outputRotation:o}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new F(this.transformToolStore.leftTopRespectFlip).add(new F(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new F(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const s=this.engineMediator.preview.container;const{outputContainer:a}=this.editor;a.setResolution(lt(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:e,flipHorizontally:t});const l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let c=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:g,defaultImageSize:_}=this.transformToolStore;const x=this.transformToolStore.maxCropMaskSize;const b={height:g.height*_.height/x.height,width:g.width*_.width/x.width};c=b.width/this.transformToolStore.localOutputImageSize.width}const u=Math.abs(l.x);const m=c/(u/this.transformToolStore.defaultScale);const p={x:m,y:m};const h=-(r-o);a.setTransform({scale:p,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(t){this.transforms=t}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const t=this.engineMediator.preview.container;const{outputContainer:e}=this.editor;const r=JSON.parse(this.transforms.preview);e.setResolution(lt(this.transformToolStore.defaultImageSize));t.setTransform(r);e.setTransform(JSON.parse(this.transforms.output));const o=r.scale;e.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(r);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(t,e=true){const{width:r,height:o}=this.editor.engineMediator.image.container.getBounds();const n=LA(t)?{width:o,height:r}:{width:r,height:o};this.editor.outputContainer.rotate(t,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:s}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(s);Ge(()=>{this.editor.scale.setInitialTransform();const a=this.getScaleWithFlip(s);this.engineMediator.preview.container.setScale(a);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(e){this.editor.render()}}applyPreviewTransform(){const{rotation:t,flipHorizontally:e,flipVertically:r}=this.transformToolStore.rotateFlipState;const o=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let s=t;if(e){s=mm(s)}if(r){s=mm(s)}const a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a)}getScaleWithFlip(t=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:e,flipVertically:r}=this.transformToolStore.rotateFlipState;const o=e?-1:1;const n=r?-1:1;const s=this.editor.scale.calculateScale(t);return{x:s*o,y:s*n}}saveTransforms(){const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:t,output:e}}saveTransformsBasedOnFlip(){const t=this.engineMediator.preview.container.getTransform();const{scale:e}=t;const{flipVertically:r,flipHorizontally:o}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...t,scale:{x:o?-e.x:e.x,y:r?-e.y:e.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}}});var Jk;var XH=d(()=>{z();Jk=class{constructor(t){this.store=t;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,qe.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}}});var qH,du,Q;var Zk=d(()=>{wt();R();z();qk();Ji();Un();$H();KH();XH();qH="identity";du=class{constructor(t){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=Z.box(false);this.minCropSize=0;this.transformHistory=new Jk(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=t=>{if(!t.trim())return false;let e=this.editor.configStore.config.assetBaseUrl;const{length:r}=e;if(e[r-1]!=="/"){e+="/"}if(`${e}transform`===t){return false}const o=new Image;try{o.src=t;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const t=this.editor.outputContainer.getRotation();if(t!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=t=>{this.localOutputSize.height=Math.round(t.height);this.localOutputSize.width=Math.round(t.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(t.width),height:Math.round(t.height)})};this.changeDefaultScale=t=>{this.defaults.scale=t};this.changeLocalOutputHeight=t=>{this.localOutputSize.height=Math.round(t)};this.changeLocalOutputWidth=t=>{this.localOutputSize.width=Math.round(t)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?uS:dS;this.rotateOutputContainer(e(t))};this.rotateAntiClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?dS:uS;this.rotateOutputContainer(e(t))};this.flipHorizontally=(t=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(t);if(t){this.trackChanges()}};this.flipVertically=(t=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(t);if(t){this.trackChanges()}};this.applyDefaultCrop=(t=false)=>{if(this.identifier==="identity"){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,t)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:t,y:e})=>{const r=this.getRatio();const o=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,t),o.x-n.width);const l=Math.min(Math.max(0,e),o.y-n.height);const c=o.x-a;const u=o.y-l;const m={width:Math.max(this.minCropSize,Math.min(c,s.width-a)),height:Math.max(this.minCropSize,Math.min(u,s.height-l))};if(r==="*"){if(this.changePosition({x:a,y:l})){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);const h=new F(o).subtract({x:p.width,y:p.height});if(this.changePosition(h)){this.changeCropAndOutputSize(p,r)}}};this.onLeftBottom=({x:t,y:e})=>{const r=this.getRatio();const o=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,t),o.x-n.width);const l=Math.max(0,e,o.y+n.height);const c=o.x-a;const u=l-o.y;const m={width:Math.max(1,Math.min(c,s.width-a)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){if(this.changePositionX(a)){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);if(this.changePositionX(o.x-p.width)){this.changeCropAndOutputSize(p,r)}}};this.onRightTop=({x:t,y:e})=>{const r=this.getRatio();const o=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,t,o.x+n.width);const l=Math.min(Math.max(0,e),o.y-n.height);const c=a-o.x;const u=o.y-l;const m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-l))};if(r==="*"){if(this.changePositionY(l)){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);if(this.changePositionY(o.y-p.height)){this.changeCropAndOutputSize(p,r)}}};this.onRightBottom=({x:t,y:e})=>{const r=this.getRatio();const o=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,t,o.x+n.width);const l=Math.max(0,e,o.y+n.height);const c=a-o.x;const u=l-o.y;const m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){this.changeCropAndOutputSize(m)}else{const p=this.proportionalSize(r,m);this.changeCropAndOutputSize(p,r)}};this.onPixelWidth=t=>{const e=JSON.stringify(lt(this.localOutputSize));const r=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(r&&r.ratio){let n=t;let s=this.localOutputSize.height;let{ratio:a}=r;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(t,o.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(s)})}else{const l=du.placeCropMask(a,o);n=Math.max(Math.min(n,l.width),this.minCropSize);s=n/a;this.changeLocalOutputSize({height:s,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.onPixelHeight=t=>{const e=JSON.stringify(lt(this.localOutputSize));const r=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(r&&r.ratio){let n=t;let s=this.localOutputSize.width;let{ratio:a}=r;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(t,o.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(n)})}else{const l=du.placeCropMask(a,o);n=Math.max(Math.min(n,l.height),this.minCropSize);s=n*a;this.changeLocalOutputSize({height:n,width:s})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=t=>{this.transformations.setFrameOpacity(t)};this.setOverlayOpacity=t=>{this.transformations.setOverlayOpacity(t)};this.closestRatioReducer=t=>(e,r)=>{if(r===null)return-1;return Math.abs(t-e.ratio)(e,r)=>{if(r===null)return-1;const o=Math.abs(e.dimensions.x/e.dimensions.y);const n=Math.abs(r.dimensions.x/r.dimensions.y);if(o===n){return e.dimensions.x*e.dimensions.y>r.dimensions.x*r.dimensions.y?-1:1}return Math.abs(t-o){const t=this.entityManager.items.findIndex(l=>l.identifier==="imgly_transform_common_custom");if(t!==-1)return this.entityManager.items[t];const e=this.entityManager.items.findIndex(l=>l.ratio==="*");if(e!==-1)return this.entityManager.items[e];const r=lt(this.editor.outputContainer.getResolution());const o=Math.abs(r.width/r.height);const[n]=this.entityManager.items.filter(l=>l.ratio&&typeof l.ratio==="number").sort(this.closestRatioReducer(o));const[s]=this.entityManager.items.filter(l=>l.dimensions&&!l.ratio).sort(this.closestDimensionsReducer(o));if(!n||!s||!n.ratio&&!s.dimensions){return this.entityManager.items[0]}if(!s||!s.dimensions)return n;if(!n||!n.ratio)return s;const a=Math.abs(s.dimensions.x/s.dimensions.y);if(a===n.ratio)return n;return Math.abs(o-n.ratio){let e=this.entityManager.items.find(r=>r.identifier===t);if(!e){e=this.getMatchingItem()}return e};this.editor=t;this.selectedCategory=qH;this.transformStore=new Et(t,this.defaults);this.transformations=new Yk(t);const{enableRotation:e,enableFlip:r,...o}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new Ue(n,{...o,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new Le(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new Le(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(t){return t*Math.PI/180}static placeCropMask(t,e){if(e.height*t>e.width){const o=e.width/t;return{height:o,width:e.width,yChanged:true}}const r=e.height*t;return{height:e.height,width:r,yChanged:false}}changeIdentifier(t,e=false){this.transformStore.changeIdentifier(t);const r=this.getCropMask(t,this.defaults.imageSize);if(r){this.transformStore.changeRatio(r.ratio);this.changeLocalOutputSize(r);this.updatePreviewSizeWRTImageSize();if(r.yChanged!==void 0){this.updateInitialCropMaskPosition(r.yChanged)}if(r.dimensions){this.changeLocalOutputSize({width:r.dimensions.x,height:r.dimensions.y})}if(e){this.trackChanges()}}}setDragMode(t){this.dragMode.set(t)}getCropMask(t,e){const r=this.getTransform(t);if(r){const{ratio:o,forceDimensions:n,lockDimensions:s,dimensions:a=null}=r;if(n){this.transformStore.changeForceDimensions(n)}if(s){this.transformStore.changeLockResolution(s)}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return{...e,yChanged:void 0,ratio:"*",dimensions:a};default:return{...du.placeCropMask(r.ratio,e),ratio:r.ratio,dimensions:a}}}else{const{x:l,y:c}=r.dimensions;return{...du.placeCropMask(l/c,e),ratio:null,dimensions:a}}}return null}setCropDefaults(t=false){const e=this.editor.outputContainer.getResolution();this.setDefaultImageSize(e);const r=this.editor.getPreviewSize();const{position:o}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(r);this.setDefaultCropPosition({x:o.x-r.width/2,y:o.y-r.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!t){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(t){this.defaults.imageSize={...lt(t)};if(!this.lockResolution){this.localOutputSize={...lt(t)}}}setMaxCropSize(t){this.defaults.maxCropMaskSize.height=t.height;this.defaults.maxCropMaskSize.width=t.width}setDefaultCropPosition(t){this.defaults.cropMaskPosition.x=t.x;this.defaults.cropMaskPosition.y=t.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(t){this.selectedCategory=this.selectedCategory===t?qH:t}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:t,output:e})}changePosition(t){return this.transformStore.changePosition(t,this.defaults.maxCropMaskSize)}changePositionX(t){return this.transformStore.changePositionX(t,this.defaults.maxCropMaskSize.width)}changePositionY(t){return this.transformStore.changePositionY(t,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:t,height:e},r,o=true){this.transformStore.changeWidth(t);this.transformStore.changeHeight(e);if(!this.lockResolution){const{height:n,width:s}=this.defaults.maxCropMaskSize;const{height:a,width:l}=this.defaults.imageSize;let c=a/n*e;const u=l/s*t;if(r){c=u/r}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(u),height:Math.round(c)})}if(e>=this.minCropSize){this.changeLocalOutputHeight(c)}if(t>=this.minCropSize){this.changeLocalOutputWidth(u)}}}transformRender(t=true){this.transformations.applyPreviewTransform();if(t){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:t,flipVertically:e}=this.rotateFlipState;const{identifier:r,rotationInDegrees:o}=this;const n=Wl(o);const s=cS(_b(this.editor.engineMediator.output.container.getRotation())+o);const{start:a,end:l}=this.convertUIToOperationOptions(n,s);return{flipHorizontally:t,flipVertically:e,rotation:n,start:a,end:l,identifier:r,outputRotation:s}}getStartEndForOperation(t){const{leftTop:e,rightBottom:r,maxCropMaskSize:o}=this;const n=e.y;const s=e.x;const a=r.x;const l=r.y;switch(t){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}getStartEndForUI(t,e,r){const{maxCropMaskSize:o}=this;const n=e.y;const s=e.x;const a=r.x;const l=r.y;switch(t){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}convertOperationOptionsToUI({start:t,end:e,rotation:r,outputRotation:o}){const n=o===90||o===270;const s=n?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const a=Math.cos(r);const l=Math.sin(r);const c=this.calculateScale(r);const u=new F(Math.min(t.x,e.x),Math.min(t.y,e.y));const m=new F(Math.max(t.x,e.x),Math.max(t.y,e.y));const p=m.subtract(u).divide(2);const h=u.add(p).multiply(s);const g=h.subtract(s.multiply(.5));const _=new F(g.x*a-g.y*l,g.x*l+g.y*a).multiply(c);const x=s.multiply(.5).add(_);const b=x.divide(s);const w=b.subtract(p.multiply(c));const T=b.add(p.multiply(c));const D=n?F.fromSize(this.maxCropMaskSize).swapped:F.fromSize(this.maxCropMaskSize);const O=w.multiply(D);const k=T.multiply(D);const{leftTop:E,rightBottom:J}=this.getStartEndForUI(o,O,k);return{start:new F(E),end:new F(J)}}convertUIToOperationOptions(t,e){const r=e===90||e===270;const o=r?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const n=r?F.fromSize(this.maxCropMaskSize).swapped:F.fromSize(this.maxCropMaskSize);const s=Math.cos(-t);const a=Math.sin(-t);const l=this.calculateScale(t,r);const{leftTop:c,rightBottom:u}=this.getStartEndForOperation(e);const m=new F(c).divide(n);const p=new F(u).divide(n);const h=p.subtract(m).divide(2);const g=m.add(h).multiply(o);const _=g.subtract(o.multiply(.5));const x=new F(_.x*s-_.y*a,_.x*a+_.y*s).divide(l);const b=o.multiply(.5).add(x);const w=b.divide(o);const T=w.subtract(h.divide(l));const D=w.add(h.divide(l));return{start:T,end:D}}calculateScale(t,e=false){const r=e?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const o=new F(Math.abs(r.x*Math.cos(t))+Math.abs(r.y*Math.sin(t)),Math.abs(r.x*Math.sin(t))+Math.abs(r.y*Math.cos(t)));const n=r.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/r.y+1:n.x*2/r.x+1}updateStateFromSerialization(t){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=Math.round(_b(t.rotation));this.transformStore.setRotation(e>180?e-360:e);this.transformations.rotateOutputContainer(Wl(cS(t.outputRotation||0)));if(t.identifier){this.transformStore.changeIdentifier(t.identifier)}if(t.start&&t.end){if(t.end.x===0||t.end.y===0){t.end.x=1;t.end.y=1}const{start:r,end:o}=this.convertOperationOptionsToUI({start:new F(t.start),end:new F(t.end),rotation:t.rotation,outputRotation:t.outputRotation});this.changePositionX(r.x);this.changePositionY(r.y);const n=o.x-r.x;const s=o.y-r.y;this.transformStore.changeSize({width:n,height:s});const{maxCropMaskSize:a,imageSize:l}=this.defaults;const c={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(c)}if(t.flipHorizontally){this.flipHorizontally(false)}if(t.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(t){this.defaultAngle=t}updateCanvasControls(t){const e=lt(this.cropMaskPosition);const r=lt(this.cropMaskSize);const o=lt(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*r.height/t.height,width:o.width*r.width/t.width},void 0,false);this.changePosition({y:o.height*e.y/t.height,x:o.width*e.x/t.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(t){this.transformStore.setRotation(t);this.transformRender()}async rotateOutputContainer(t,e=true){this.setDragMode(true);this.transformations.rotateOutputContainer(t,e);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,false)}clickableCanvas(t){this.editor.clickableCanvas(t)}proportionalSize(t,e,r=this.defaults.maxCropMaskSize,o=this.minCropSize){let n=e.height*t;let{height:s}=e;if(n>r.width||n1){return{width:this.minCropSize*t,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*t}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const t=this.getTransform(this.identifier);if(t){if(Object.prototype.hasOwnProperty.call(t,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return t.ratio}const{x:e,y:r}=t.dimensions;return e/r}return"*"}};Q=du;f([Z],Q.prototype,"selectedCategory",2);f([Z],Q.prototype,"defaults",2);f([Z],Q.prototype,"localOutputSize",2);f([v],Q.prototype,"changeIdentifier",1);f([v],Q.prototype,"setDragMode",1);f([v],Q.prototype,"setCropDefaults",1);f([v],Q.prototype,"setDefaultImageSize",1);f([v],Q.prototype,"setMaxCropSize",1);f([v],Q.prototype,"setDefaultCropPosition",1);f([v],Q.prototype,"resetCrop",1);f([v],Q.prototype,"toggleCategorySelection",1);f([v],Q.prototype,"pureReset",1);f([v],Q.prototype,"reset",2);f([v],Q.prototype,"changePosition",1);f([v],Q.prototype,"changePositionX",1);f([v],Q.prototype,"changePositionY",1);f([v],Q.prototype,"changeCropAndOutputSize",1);f([v],Q.prototype,"onLeave",1);f([v],Q.prototype,"onEnter",1);f([v],Q.prototype,"changeLocalOutputSize",2);f([v],Q.prototype,"changeDefaultScale",2);f([v],Q.prototype,"changeLocalOutputHeight",2);f([v],Q.prototype,"changeLocalOutputWidth",2);f([v],Q.prototype,"changeLockResolution",2);f([v],Q.prototype,"setRotation",1);f([v],Q.prototype,"rotateClockwise",2);f([v],Q.prototype,"rotateAntiClockwise",2);f([v],Q.prototype,"rotateOutputContainer",1);f([v],Q.prototype,"flipHorizontally",2);f([v],Q.prototype,"flipVertically",2);f([v],Q.prototype,"applyDefaultCrop",2);f([v],Q.prototype,"applyInitialCrop",1);f([v],Q.prototype,"updateCropMask",2);f([v],Q.prototype,"clickableCanvas",1);f([v],Q.prototype,"onLeftTop",2);f([v],Q.prototype,"onLeftBottom",2);f([v],Q.prototype,"onRightTop",2);f([v],Q.prototype,"onRightBottom",2);f([v],Q.prototype,"proportionalSize",1);f([v],Q.prototype,"onPixelWidth",2);f([v],Q.prototype,"onPixelHeight",2);f([v],Q.prototype,"updateInitialCropMaskPosition",1);f([v],Q.prototype,"updatePreviewSizeWRTImageSize",1);f([v],Q.prototype,"dispose",2);f([C],Q.prototype,"cropState",1);f([C],Q.prototype,"identifier",1);f([C],Q.prototype,"ratio",1);f([C],Q.prototype,"height",1);f([C],Q.prototype,"width",1);f([C],Q.prototype,"localOutputImageSize",1);f([C],Q.prototype,"localOutputHeight",1);f([C],Q.prototype,"localOutputWidth",1);f([C],Q.prototype,"lockResolution",1);f([C],Q.prototype,"forceDimensions",1);f([C],Q.prototype,"rotationInDegrees",1);f([C],Q.prototype,"outputRotation",1);f([C],Q.prototype,"isDragMode",1);f([C],Q.prototype,"rotateFlipState",1);f([C],Q.prototype,"selectedCategoryIdentifier",1);f([C],Q.prototype,"categories",1);f([C],Q.prototype,"items",1);f([C],Q.prototype,"config",1);f([C],Q.prototype,"locale",1);f([C],Q.prototype,"isOptionSelected",1);f([C],Q.prototype,"leftTop",1);f([C],Q.prototype,"leftBottom",1);f([C],Q.prototype,"rightTop",1);f([C],Q.prototype,"rightBottom",1);f([C],Q.prototype,"isFlippedHorizontal",1);f([C],Q.prototype,"isFlippedVertical",1);f([C],Q.prototype,"leftTopRespectFlip",1);f([C],Q.prototype,"leftBottomRespectFlip",1);f([C],Q.prototype,"rightTopRespectFlip",1);f([C],Q.prototype,"rightBottomRespectFlip",1);f([C],Q.prototype,"cropMaskPosition",1);f([C],Q.prototype,"cropMaskSize",1);f([C],Q.prototype,"state",1);f([C],Q.prototype,"defaultImageSize",1);f([C],Q.prototype,"maxCropMaskSize",1);f([C],Q.prototype,"minCropMaskSize",1);f([C],Q.prototype,"defaultCropMaskPosition",1);f([C],Q.prototype,"defaultScale",1)});var YH=d(()=>{Ik();Zk()});var JH,ict,Qk,rct,tf,ot;var tI=d(()=>{wt();JH=y(Yu());R();z();Ji();Xk();pm();hk();gk();_k();Sk();ict={};Qk="none";rct={position:{x:0,y:0},rotation:0};tf=class{constructor(t){this.state=Z.map(ict);this.selectedId=Z.box(Qk);this.editMode=Z.box(false);this.dragMode=Z.box(false);this.minLength=0;this.counter=0;this.addSticker=async(t,e=true)=>{await this.addStickerAsync(t,e)};this.addStickerAsync=async({spriteId:t,state:e,transform:r},o=true)=>{return new Promise((n,s)=>{r=this.getInitialTransform(r);const{identifier:a}=e;const l=this.editor.orderHelper.addSprite(a);this.editor.engine.addStickerFromAssets(a,this.editor.engineMediator.image.container,l).then(async c=>{if(t){c.setData({id:t})}const u=c.getID();this.container[u]=c;this.editor.orderHelper.renameSprite(a,u);const m=this.getSize(u);m.width*=c.getScale().x;m.height*=c.getScale().y;c.setPivot(.5,.5);let p;if(r.scale){p=r.scale}else if(r.size){p={x:r.size.width/m.width,y:r.size.height/m.height}}else{const x=this.editor.shortestOutputSide*.4;const b=tf.magnitude(x)/tf.sizeMagnitude(c.getSizeInWorldSpace());p={x:b,y:b}}const{flipHorizontally:h,flipVertically:g}=this.editor.outputContainer.getData();c.setFlipHorizontally(h);c.setFlipVertically(g);c.setTransform({position:r.position,scale:p,rotation:r.rotation});if(e.flipHorizontally!==void 0){c.setFlipHorizontally(e.flipHorizontally!==h)}if(e.flipVertically!==void 0){c.setFlipVertically(e.flipVertically!==g)}this.setContainerProperties(u,{...e});const _=c.getData();this.setInitialSpriteState(u,"sticker");this.stickerToolStore.setState(u,{..._,identifier:a});await this.editor.renderPromise();if(o){this.setId(u);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(c=>{console.error(c);s()})})};this.addText=async(t,e=true)=>{await this.addTextAsync(t,e)};this.addTextAsync=({spriteId:t,state:e,transform:r},o=true)=>{return new Promise((n,s)=>{r=this.getInitialTransform(r);const a=this.editor.orderHelper.addSprite(e.identifier);const l=this.editor.shortestOutputSide;const c={fontIdentifier:e.identifier,text:e.text,width:e.width||l*.6,fontSize:e.fontSize||l*.1,lineHeight:e.lineHeight,alignment:e.alignment,textColor:e.textColor,backgroundColor:e.backgroundColor};this.editor.engine.addTextWithFontLoading(c,this.editor.engineMediator.image.container,a).then(async u=>{if(t){u.setData({id:t})}const m=u.getID();this.container[m]=u;this.editor.orderHelper.renameSprite(e.identifier,m);const{flipHorizontally:p,flipVertically:h}=this.editor.outputContainer.getData();u.setFlipHorizontally(p);u.setFlipVertically(h);u.setPivot(.5,.5);u.setPosition(r.position);u.setRotation(r.rotation);this.setInitialSpriteState(m,"text");const g=u.getData();this.textToolStore.setState(m,{...g});await this.editor.renderPromise();if(o){this.setId(m);this.addSnapshot("add",this.textLocale.add)}n()}).catch(u=>{console.error(u);s()})})};this.addTextDesign=async(t,e=true,r=false)=>{try{await this.addTextDesignAsync(t,e,r)}catch(o){console.warn(o)}};this.addTextDesignAsync=({spriteId:t,state:e,transform:r},o=true,n=false)=>{return new Promise((s,a)=>{r=this.getInitialTransform(r);const l=this.editor.orderHelper.addSprite(e.identifier);const c=this.editor.shortestOutputSide;const u={width:e.width||c*.6,text:e.text,color:e.color,inverted:e.isInverted,seed:e.seed,padding:e.padding};this.editor.engine.addTextDesignAsync(e.identifier,u,this.editor.engineMediator.image.container,l).then(async m=>{if(t){if(n){this.pureRemoveSprite(t);this.textDesignToolStore.state.delete(t)}m.setData({id:t})}const p=m.getID();this.container[p]=m;this.editor.orderHelper.renameSprite(e.identifier,p);const{flipHorizontally:h,flipVertically:g}=this.editor.outputContainer.getData();m.setFlipHorizontally(h);m.setFlipVertically(g);m.setPivot(.5,.5);m.setPosition(r.position);m.setRotation(r.rotation);this.setInitialSpriteState(p,"textdesign");const _=m.getData();this.textDesignToolStore.setState(p,{..._,identifier:e.identifier});await this.editor.renderPromise();if(o){this.setId(p);this.addSnapshot("add",this.textDesignLocale.add)}s()}).catch(m=>{a(m)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=t=>{this.editor.clickableCanvas(t)};this.setContainerProperties=(t,e,r=false)=>{this.container[t].setData(e);if(r){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(t,e)=>{this.container[t].setPosition(e)};this.pureRemoveSprite=t=>{this.editor.engine.removeContainer(this.container[t]);const e=this.container[t].getIndexInParent();if(e===-1){delete this.container[t];this.state.delete(t);this.editor.orderHelper.removeSprite(t);return true}return false};this.deleteSprite=(t=this.id)=>{const e=this.state.get(t);if(e.tool==="sticker"){this.stickerToolStore.delete()}else if(e.tool==="text"){this.textToolStore.delete()}else if(e.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=t=>{const e=this.pureRemoveSprite(t);if(e){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(t,e)=>{this.editor.addSnapshot(void 0,t,e)};this.spriteSnapshot=t=>{this.addSnapshot("edit",this.historyLocale[t])};this.addNewText=async(t,e)=>{if(this.textToolStore.doesTextAssetExist(e.identifier)){await this.addTextAsync({...t,state:e},false)}else{throw new Io(e.identifier)}};this.addNewTextDesign=async(t,e)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(e.identifier)){await this.addTextDesignAsync({...t,state:e},false)}else{throw new Io(e.identifier)}};this.addNewSticker=async(t,e)=>{if(this.stickerToolStore.doesStickerAssetExist(e.identifier)){await this.addStickerAsync({...t,state:e},false)}else{throw new Io(e.identifier)}};this.getSpriteHistoryState=()=>{const t=lt(this.textToolStore.state);const e=lt(this.textDesignToolStore.state);const r={common:lt(this.state),["sticker"]:lt(this.stickerToolStore.state),["text"]:t,["textdesign"]:e,spriteIdList:Object.keys(this.container)};Object.keys(r.common).forEach(o=>{r.common[o].size=this.container[o].getSizeInWorldSpace();r.common[o].position=this.container[o].getPosition();r.common[o].order=this.container[o].getIndexInParent()});return r};this.updateStateFromSerialization=async(t,e,r)=>{if(e&&e.length){try{const o=await Promise.all(e.map(async({svg:n,raster:s,name:a,identifier:l})=>{const c=(n==null?void 0:n.data)?"image/svg+xml":s.type;const u=`data:${c};base64,${(n==null?void 0:n.data)||s.data}`;const m=await nv(u,150);return{stickerURI:u,thumbnailURI:m,name:a,type:c,identifier:l}}));await this.stickerToolStore.addCustomStickerAsset(o)}catch(o){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(t.text){await this.textToolStore.loadFonts()}if(t.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(t.spriteIdList,t,r)};this.updateStateFromHistory=async t=>{const e=Object.keys(this.container);const r=e.filter(o=>t.spriteIdList.indexOf(o)===-1);r.forEach(o=>{this.pureRemoveSprite(o)});await this.updateStateByHistoryState(t.spriteIdList,t,0)};this.serializableState=async()=>{const t=this.editor.spriteStore.getSpriteHistoryState();Object.keys(t.common).forEach(r=>{const{flipHorizontally:o,flipVertically:n}=this.editor.outputContainer.getData();const s=this.editor.outputContainer.getRotation();const a=n!==o?-t.common[r].rotation:t.common[r].rotation;t.common[r].rotation=n!==o?a+s:a-s});const e=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:r,type:o,stickerURI:n,name:s})=>{const a={identifier:r,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]}}if(o==="image/jpeg"||o==="image/png"||o==="image/gif"){[,a.raster.data]=n.split(",");a.raster.type=o}else{const l=await nv(n);[,a.raster.data]=l.split(",");a.raster.type="image/png"}return a}));return{sprite:t,customStickers:e}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(t=>{this.updatePositionAndSize(t,true);const e=this.state.get(t);if(e){if(e.tool==="text"){const r=this.getContainerProperties(t);this.textToolStore.changeSize(t,r)}else if(e.tool==="textdesign"){const r=this.getContainerProperties(t);this.textToolStore.changeWidth(r.width)}}})};this.setEditMode=t=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(t){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(t)}}};this.setDragMode=t=>{this.dragMode.set(t)};this.setPosition=t=>{const e=this.currentSprite;const r=this.container[this.id];if(e&&r){r.setPosition(this.editor.previewToWorld(t));const{position:o}=this.getSizePositionFromContainer();e.position.x=o.x;e.position.y=o.y;this.state.set(this.id,e);this.editor.render()}};this.setSize=t=>{const e=this.currentSprite;if(e){e.size.width=t.width;e.size.height=t.height;this.state.set(this.id,e)}};this.setRotation=t=>{const e=this.currentSprite;if(e){const{flipHorizontally:r,flipVertically:o}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const s=jh({rotation:t,outputRotation:n,flipHorizontally:r,flipVertically:o});this.container[this.id].setRotation(s);e.rotation=this.container[this.id].getRotation();this.state.set(this.id,e);this.editor.render()}};this.onCanvasClick=t=>{if(!this.isEditMode){this.selectHighestOrderSprite(t)}};this.select=t=>{const e=this.state.get(t);if(e){const r=this.editor.activeStore.tool;if(r!==e.tool){this.editor.activeStore.selectTool(e.tool)}this.setId(t)}};this.selectLast=()=>{const t=this.editor.orderHelper.getLastSpriteId();if(t){this.select(t)}};this.selectNext=()=>{if(this.currentSprite){const t=this.container[this.id];const e=t.getIndexInParent();if(e){const r=Object.keys(this.container).find(o=>this.container[o].getIndexInParent()===e-1);if(r){this.select(r)}}}};this.deselect=()=>{this.setId(Qk)};this.bringToFront=async t=>{const e=this.editor.orderHelper.bringToFront(t);this.container[t].setIndexInParent(e);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=t=>{const e=this.state.get(t);const r=this.container[t];r.setFlipHorizontally(!r.getFlipHorizontally());e.flipHorizontally=r.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(t,e);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(t=>{this.pureRemoveSprite(t)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=t=>{const e=this.editor.brushToolStore.containerId();t=t.filter(n=>n!==e);if(t.length<1){this.deselect();return}let r="";let o=0;t.forEach(n=>{const s=this.container[n];const a=s&&s.getIndexInParent()||0;if(a>=o){o=a;r=n}});this.select(r)};this.onCornerDrag=({x:t,y:e})=>{if(this.currentSprite){const r=new F(this.currentSprite.position);const o=new F(t,e);const n=o.subtract(r).magnitude;const s=this.getSize();const a=n*2/tf.sizeMagnitude(s);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:s.width*a,height:s.height*a})}else{const l=this.rotationWRTOutputRotation;const c=o.subtract(r);const u=Math.cos(l);const m=Math.sin(l);const p=Math.max(Math.abs(c.x*u*2+c.y*m*2),this.minLength);const h=Math.max(Math.abs(c.x*-m*2+c.y*u*2),this.minLength);this.setStickerSize({width:p,height:h})}}else if(this.isSpriteText){this.setTextSize(s.width*a)}else if(this.isSpriteTextDesign){this.setTextDesignScale(a)}}this.editor.render()}};this.onWidthDrag=({x:t,y:e})=>{const r=new F(this.currentSprite.position);const o=new F(t,e);const n=o.subtract(r).magnitude;const s=this.editor.previewToWorld(2*n);if(s>this.minLength){this.setContainerProperties(this.id,{width:s},true);if(this.isSpriteText){const a=this.getContainerProperties(this.id);this.textToolStore.changeWidth(a.width)}}};this.onPaddingDrag=({x:t,y:e})=>{if(this.isSpriteTextDesign){let r=this.getContainerProperties(this.id);const o=new F(this.currentSprite.position);const n=new F(t,e);const s=n.subtract(o).magnitude;const a=Math.max(this.editor.previewToWorld(s)-r.width/2,0);this.setContainerProperties(this.id,{padding:a},true);if(this.isSpriteTextDesign){r=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(r.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();Object.values(this.container).forEach(r=>{if(r.type==="text"||r.type==="text-design"){r.setFlipHorizontally(t);r.setFlipVertically(e)}})};this.reverseTextHorizontally=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipHorizontally(t)}})};this.reverseTextVertically=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipVertically(t)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=t=>{return this.container[t].getData()};this.getContainerTransform=t=>{return this.container[t].getTransform()};this.getDuplicateContainerTransform=t=>{const e=this.container[t].getTransform();const r=this.editor.shortestOutputSide*.1;const o=new F(e.position).add(new F(r,r));return{...e,position:o}};this.getDuplicateContainerFlip=t=>{const e=this.container[t].getFlipHorizontally();const r=this.container[t].getFlipVertically();return{flipHorizontally:e,flipVertically:r}};this.updatePositionAndSize=(t=this.id,e=false)=>{const{position:r,size:o}=this.getSizePositionFromContainer(t);const n=this.state.get(t);if(n){n.position.x=r.x;n.position.y=r.y;n.size.width=o.width;n.size.height=o.height;if(e){const s=this.container[t].getRotation();this.container[t].setRotation(s);n.rotation=this.container[t].getRotation()}this.state.set(t,n)}};this.getInitialTransform=t=>{const e=this.editor.outputToWorld(rct.position);if(!t){const r=this.editor.outputContainer.getRotation();return{rotation:r,position:e}}return{position:e,...t}};this.setInitialSpriteState=(t,e)=>{const r=this.container[t];const{position:o,size:n}=this.getSizePositionFromContainer(t);const s=r.getRotation();const a=e!=="sticker"?false:r.getFlipHorizontally();const l=e!=="sticker"?false:r.getFlipVertically();this.state.set(t,{tool:e,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l})};this.setStickerSize=t=>{const e=this.container[this.id];e.setSizeInWorldSpace(this.editor.previewSizeToWorld(t));const r=this.currentSprite;if(r){r.size=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());this.state.set(this.id,r)}};this.setTextSize=t=>{let e=this.getContainerProperties(this.id);const r={width:this.editor.previewToWorld(t)};const o=r.width/e.width;const n={fontSize:Math.round(e.fontSize*o)};const s=this.isSpriteText?{...r,...n}:r;if(r.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,s,true);e=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(e.fontSize,true);this.textToolStore.changeWidth(e.width)}};this.setTextDesignScale=t=>{let e=this.getContainerProperties(this.id);const r=e.width*t;if(r>this.minLength){this.setContainerProperties(this.id,{width:r},true);const{width:o}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(o);e=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(e.padding)}};this.getSizePositionFromContainer=(t=this.id)=>{const e=this.container[t];if(e){const r=this.editor.worldToPreview(e.getPosition());const o=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());return{position:r,size:o}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(t=this.id)=>{const e=this.container[t];if(e){return this.editor.worldSizeToPreview(e.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=t;this.container={};this.stickerToolStore=new Bt(t);this.textToolStore=new ft(t);this.textDesignToolStore=new Pt(t);this.rect=new Le(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(t,e){return new F(t,e||t).magnitude}static sizeMagnitude(t){return Math.sqrt(t.width*t.width+t.height*t.height)}async updateStateByHistoryState(t,e,r){await(0,JH.default)(t,async o=>{const n=e.common[o];if(!n)return;if(this.state.get(o)){this.updateExistingItem(o,e)}else{await this.addNewItem(o,e)}});t.forEach(o=>{const n=e.common[o];const s=this.container[o];if(!n||!s)return;s.setIndexInParent(n.order+r)});this.counter+=1}async addNewItem(t,e){const r=e.common[t];const o=r.size?{width:this.editor.worldToPreview(r.size.width),height:this.editor.worldToPreview(r.size.height)}:void 0;const{flipHorizontally:n,flipVertically:s}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=s!==n?r.rotation-a:r.rotation+a;const c=s!==n?-l:l;const u={spriteId:t,transform:{size:o,position:new F(r.position),rotation:c}};if(e.text[t]){const m=e.text[t];const p=this.textToolStore.validFontWithConfig(m.identifier);m.identifier=p==null?void 0:p.identifier;await this.addNewText(u,m);return}if(e.textdesign[t]){await this.addNewTextDesign(u,e.textdesign[t]);return}if(e.sticker[t]){const m=this.stickerToolStore.items.find(p=>p.identifier===e.sticker[t].identifier);await this.addNewSticker(u,{...e.sticker[t],flipHorizontally:r.flipHorizontally,flipVertically:r.flipVertically,resizeMode:e.sticker[t].resizeMode||(m==null?void 0:m.resizeMode)||"keepAspect"})}}updateExistingItem(t,e){const r=e.common[t];const o=this.state.get(t);this.state.set(t,o);const n=this.container[t];n.setPosition(new F(r.position));n.setRotation(r.rotation);o.rotation=n.getRotation();if(r.flipHorizontally!==void 0){n.setFlipHorizontally(r.flipHorizontally)}if(r.flipVertically!==void 0){n.setFlipVertically(r.flipVertically)}if(e.text[t]){const s=e.text[t];this.textToolStore.updateStateFromHistory(t,{...s,fontIdentifier:s.identifier})}if(e.textdesign[t]){const s=e.textdesign[t];this.textDesignToolStore.updateStateFromHistory(t,{...s,inverted:s.isInverted})}if(e.sticker[t]){n.setSizeInWorldSpace(r.size);this.stickerToolStore.updateStateFromHistory(t,e.sticker[t])}this.updatePositionAndSize(t)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==Qk}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();const r=this.editor.outputContainer.getRotation();return jh({rotation:this.currentSprite.rotation-r,flipHorizontally:t,flipVertically:e})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const t=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:t,y:e}=this.currentSprite.position;const{height:r,width:o}=this.currentSprite.size;return{x:Math.round(t-o/2),y:Math.round(e-r/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:t}=this.rect;return{x:t.x-this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:t}=this.rect;return{x:t.x+this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(t){this.selectedId.set(t)}};ot=tf;f([Z],ot.prototype,"counter",2);f([v],ot.prototype,"addSticker",2);f([v],ot.prototype,"addStickerAsync",2);f([v],ot.prototype,"addText",2);f([v],ot.prototype,"addTextAsync",2);f([v],ot.prototype,"addTextDesign",2);f([v],ot.prototype,"addTextDesignAsync",2);f([v],ot.prototype,"clickableCanvas",2);f([v],ot.prototype,"setContainerProperties",2);f([v],ot.prototype,"setContainerPosition",2);f([v],ot.prototype,"pureRemoveSprite",2);f([v],ot.prototype,"deleteSprite",2);f([v],ot.prototype,"removeSprite",2);f([v],ot.prototype,"addSnapshot",2);f([v],ot.prototype,"addNewText",2);f([v],ot.prototype,"addNewTextDesign",2);f([v],ot.prototype,"addNewSticker",2);f([v],ot.prototype,"updateStateFromSerialization",2);f([v],ot.prototype,"updateStateFromHistory",2);f([v],ot.prototype,"updateCanvasControls",2);f([v],ot.prototype,"setEditMode",2);f([v],ot.prototype,"setDragMode",2);f([v],ot.prototype,"setPosition",2);f([v],ot.prototype,"setSize",2);f([v],ot.prototype,"setRotation",2);f([v],ot.prototype,"onCanvasClick",2);f([v],ot.prototype,"select",2);f([v],ot.prototype,"selectLast",2);f([v],ot.prototype,"selectNext",2);f([v],ot.prototype,"deselect",2);f([v],ot.prototype,"bringToFront",2);f([v],ot.prototype,"flipHorizontally",2);f([v],ot.prototype,"pureReset",2);f([v],ot.prototype,"onCornerDrag",2);f([v],ot.prototype,"onWidthDrag",2);f([v],ot.prototype,"onPaddingDrag",2);f([v],ot.prototype,"correctTextFlip",2);f([v],ot.prototype,"reverseTextHorizontally",2);f([v],ot.prototype,"reverseTextVertically",2);f([v],ot.prototype,"dispose",2);f([C],ot.prototype,"currentSprite",1);f([C],ot.prototype,"padding",1);f([C],ot.prototype,"isEditMode",1);f([C],ot.prototype,"isDragMode",1);f([C],ot.prototype,"id",1);f([C],ot.prototype,"isSpriteSelected",1);f([C],ot.prototype,"position",1);f([C],ot.prototype,"tool",1);f([C],ot.prototype,"size",1);f([C],ot.prototype,"rotation",1);f([C],ot.prototype,"rotationWRTOutputRotation",1);f([C],ot.prototype,"flipHorizontal",1);f([C],ot.prototype,"isSpriteSticker",1);f([C],ot.prototype,"isSpriteText",1);f([C],ot.prototype,"isSpriteTextDesign",1);f([C],ot.prototype,"isOnTop",1);f([C],ot.prototype,"spritePosition",1);f([C],ot.prototype,"currentRect",1);f([C],ot.prototype,"leftTopPosition",1);f([C],ot.prototype,"leftBottomPosition",1);f([C],ot.prototype,"leftMidPosition",1);f([C],ot.prototype,"leftMidPadPosition",1);f([C],ot.prototype,"rightTopPosition",1);f([C],ot.prototype,"rightBottomPosition",1);f([C],ot.prototype,"rightMidPosition",1);f([C],ot.prototype,"rightMidPadPosition",1);f([C],ot.prototype,"leftBottomHandlePosition",1);f([C],ot.prototype,"rightBottomHandlePosition",1);f([C],ot.prototype,"historyLocale",1);f([C],ot.prototype,"stickerLocale",1);f([C],ot.prototype,"textLocale",1);f([C],ot.prototype,"textDesignLocale",1)});var ZH=d(()=>{tI()});var oct,hr;var eI=d(()=>{wt();R();oct={categories:[],query:""};hr=class{constructor(t){this.initProvider=t=>{if(t){this.libraryProvider=new t}};this.fetchImages=async(t="")=>{if(this.libraryProvider){let e=null;try{const r=await this.libraryProvider.getCategories();const o=await this.libraryProvider.searchImages(t);e=r.map((n,s)=>{const a=o.filter(l=>l.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(l=>({name:l.title||`image${s}`,identifier:`${n.name}-${l.title}-${s}`,thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar}))}}).filter(n=>n.items.length)}catch(r){console.log(r)}Ge(()=>{this.state.query=t;this.state.categories=e})}};this.toggleCategorySelection=t=>{this.selectedCategory=this.selectedCategory!==t?t:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=t=>{const e=this.items.findIndex(r=>r.identifier===t);if(e!==-1){return this.items[e].rawUrl}return t};this.configStore=t.configStore;this.state=Z(oct);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(t=>t.items).reduce((t,e)=>[...t,...e],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};f([Z],hr.prototype,"selectedCategory",2);f([v],hr.prototype,"initProvider",2);f([v],hr.prototype,"fetchImages",2);f([v],hr.prototype,"toggleCategorySelection",2);f([v],hr.prototype,"dispose",2);f([C],hr.prototype,"selectedCategoryIdentifier",1);f([C],hr.prototype,"categories",1);f([C],hr.prototype,"items",1);f([C],hr.prototype,"query",1);f([C],hr.prototype,"config",1);f([C],hr.prototype,"locale",1)});var QH=d(()=>{eI()});var tW,Ri;var eW=d(()=>{R();Ln();z();tW=(i="image/png")=>`data:${i};base64,`;Ri=class{constructor(t){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=t=>{const e=st.relativeToAbsolutePoint(t,this.cropSpace,false);return st.pointFromSpaceToSpace(e,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=t=>{return t*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=t=>{return t*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=t}static deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier}}static deserializeAdjustments(t){return{...t}}static deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,e=>e.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(t){if(t){if(t.rgba){return t.rgba}}return[0,0,0,0]}validateVersion(t){return this.version===t}static checkIfPlatformHTML(t){return t==="html5"}static deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:Ri.deserialzeColor(t.tintColor)}}checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(t){const e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(tW(),""):""};e.image.data=e.image.data?tW()+e.image.data:""}return e}deserializeTransformation(t){const e={};const r=t.operations.find(s=>s.type==="orientation");const o=t.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=Ri.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:""}return e}deserialize(t){var n,s;const e={};if(t.meta?!Ri.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform")}const r=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(a=>{switch(a.type){case"filter":e.filter=Ri.deserializeFilter(a.options);break;case"adjustments":e.adjustment=Ri.deserializeAdjustments(a.options);break;case"focus":e.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(c=>{switch(c.type){case"frame":e.frame=this.deserializeFrame(c.options);break;case"overlay":e.overlay=Ri.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=this.deserializeBrush(c.options)}else{e.brush.strokes.push(...this.deserializeBrush(c.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const u=Ot();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};this.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=Ri.deserializeStickers(c.options)}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=this.deserializeTexts(c.options)}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=this.deserializeTextDesign(c.options)}break;default:break}});break;default:break}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return e}deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:Ri.deserialzeColor(t.tintColor)}}deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:break}return void 0}deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new F(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeMirroredFocus(t){const e=new F(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new F(this.mapRelativeCropPointToImageSpace(t.start)).add(new F(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeTexts(t){return{identifier:pn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:Ri.deserialzeColor(t.color),backgroundColor:Ri.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text}}deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:Ri.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted}}deserializeBrush(t){return{strokes:t.paths.map(e=>{return{path:{controlPoints:e.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:Ri.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}}})}}}});var iW,Oi;var rW=d(()=>{R();Ln();z();iW=(i="image/png")=>`data:${i};base64,`;Oi=class{constructor(t){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=t=>{const e=st.relativeToAbsolutePoint(t,this.cropSpace,false);return st.pointFromSpaceToSpace(e,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=t=>{return t*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=t=>{return t*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=t}static deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier}}static deserializeAdjustments(t){return{...t}}static deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,e=>e.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(t){if(t){if(t.rgba){return t.rgba}}return[0,0,0,0]}validateVersion(t){return this.version===t}static checkIfPlatformHTML(t){return t==="html5"}static deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:Oi.deserialzeColor(t.tintColor)}}checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(t){const e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(iW(),""):""};e.image.data=e.image.data?iW()+e.image.data:""}return e}deserializeTransformation(t){const e={};const r=t.operations.find(s=>s.type==="orientation");const o=t.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=Oi.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:""}return e}deserialize(t){var n,s;const e={};if(t.meta?!Oi.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform")}const r=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(a=>{switch(a.type){case"filter":e.filter=Oi.deserializeFilter(a.options);break;case"adjustments":e.adjustment=Oi.deserializeAdjustments(a.options);break;case"focus":e.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(c=>{switch(c.type){case"frame":e.frame=this.deserializeFrame(c.options);break;case"overlay":e.overlay=Oi.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=this.deserializeBrush(c.options)}else{e.brush.strokes.push(...this.deserializeBrush(c.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const u=Ot();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};this.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=Oi.deserializeStickers(c.options)}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=this.deserializeTexts(c.options)}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=this.deserializeTextDesign(c.options)}break;default:break}});break;default:break}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return e}deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:Oi.deserialzeColor(t.tintColor)}}deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:return void 0}}deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new F(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeMirroredFocus(t){const e=new F(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new F(this.mapRelativeCropPointToImageSpace(t.start)).add(new F(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeTexts(t){return{identifier:pn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:Oi.deserialzeColor(t.color),backgroundColor:Oi.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text}}deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:Oi.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted}}deserializeBrush(t){return{strokes:t.paths.map(e=>{return{path:{controlPoints:e.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:Oi.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}}})}}}});var nct,sct,act,lct,cct,uct,dct,mct,pct,hct,fct,gct,bct,yct,_ct,nW;var oW=d(()=>{nct="@photoeditorsdk/root";sct="5.19.2";act="The most comprehensive photo editor SDK for HTML5";lct="http://github.com/imgly/pesdk-html5";cct="PhotoEditorSDK (img.ly GmbH) ";uct="SEE LICENSE IN LICENSE.md";dct=true;mct={};pct={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};hct={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};fct={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};gct={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};bct={eslint:"7.10.0"};yct=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];_ct={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};nW={name:nct,version:sct,description:act,repository:lct,author:cct,license:uct,private:dct,bin:mct,scripts:pct,devDependencies:hct,dependencies:fct,devEngines:gct,resolutions:bct,workspaces:yct,husky:_ct}});var mu;var sW=d(()=>{R();Ln();oW();mu=class{constructor(t,e,r,o,n,s){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=t=>{const e=st.pointFromSpaceToSpace(t,this.imageSpace,this.cropSpace,false);return st.absoluteToRelativePoint(e,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=t=>{return t/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=t=>{return t/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(t,e=0,r=3)=>{const o=Math.tan(e);const n=Math.sqrt(o**2+1);return{x:t.x+r/n,y:t.y+r*o/n}};this.previewPosition=t;this.previewSize=e;this.outputSize=r;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale()}static serializeFilters(t){return{type:"filter",options:{intensity:t.intensity,identifier:t.identifier}}}static serializeAdjustments(t){return{type:"adjustments",options:t}}static serializeOverlay(t){return{type:"overlay",options:{identifier:t.identifier,intensity:t.opacity,blendMode:t.blendMode.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:nW.version,createdAt:new Date().toISOString()}}serialise(t,e,r){const o=mu.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(e){n.type=r;n.data=e}const s=[];const a=[];const{adjustment:l}=t;if(Object.keys(l).map(_=>l[_]).filter(Boolean).length){s.push(mu.serializeAdjustments(l))}const{filter:c}=t;if(c.identifier!=="identity"){s.push(mu.serializeFilters(c))}const{overlay:u}=t;if(u.identifier!=="identity"){a.push(mu.serializeOverlay(u))}if(t.transform){const{transform:_,orientation:x}=this.serializeTransform(t.transform);const b=[_.options.start.x!==0,_.options.start.y!==0,_.options.end.x!==1,_.options.end.y!==1,_.options.rotation!==0];const w=[x.options.rotation!==0,x.options.flipVertically!==false,x.options.flipHorizontally!==false];if(b.some(T=>T)){s.push(_)}if(w.some(T=>T)){s.push(x)}}const{frame:m}=t;if(m.identifier!=="identity"){a.push(this.serialzeFrame(m))}const{focus:p}=t;if(p.identifier!=="identity"){s.push(this.serializeFocus(p))}if(t.sprite){t.sprite.spriteIdList.forEach(_=>{const x=t.sprite.common[_];switch(x.tool){case"sticker":const b=t.sprite.sticker[_];a.push(this.serializeSticker(b,x,t.transform));break;case"text":const w=t.sprite.text[_];a.push(this.serializeText(w,x));break;case"textdesign":const T=t.sprite.textdesign[_];a.push(this.serializeTextDesign(T,x));break;default:break}})}if(t.brush.strokes.length){a.push({type:"brush",options:{paths:t.brush.strokes.map(_=>{return{points:_.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:_.brush.color},size:_.brush.size,hardness:_.brush.hardness}}})}})}if(a.length){const _={type:"sprite",options:{sprites:a}};s.push(_)}const h=t.customStickers;const g={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:g}}serialzeFrame(t){return{type:"frame",options:{identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.color},size:this.mapSizeToRelativeUnscaledCropSize(t.width)}}}serializeFocus(t){const e=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(t.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(t.linear.start),end:this.mapImagePointToRelativeCropPoint(t.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(t.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(t.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(t.radial.center,0,t.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(t.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:r}=t;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,e/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,-e/2)),size:this.mapSizeToRelativeScaledCropSize(t.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(t.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(t.gaussian.blurRadius)}}}}}serializeSticker(t,e,r){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(e.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(e.size.width),y:this.mapSizeToRelativeScaledCropSize(e.size.height)},rotation:e.rotation,flipVertically:(e.flipVertically||false)!==(r.flipVertically||false),flipHorizontally:(e.flipHorizontally||false)!==(r.flipHorizontally||false),identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.tintColor},tintMode:t.tintMode}}}serializeText(t,e){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:t.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(t.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(t.width),text:t.text,lineHeight:t.lineHeight,color:{rgba:t.textColor},backgroundColor:{rgba:t.backgroundColor},alignment:t.alignment}}}serializeTextDesign(t,e){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,identifier:t.identifier,inverted:t.isInverted,text:t.text,seed:t.seed,width:this.mapSizeToRelativeScaledCropSize(t.width),padding:this.mapSizeToRelativeScaledCropSize(t.padding),color:{rgba:t.color}}}}serializeTransform(t){const{start:e,end:r}=t;const o={type:"transform",options:{start:e,end:r,rotation:t.rotation,meta:{identifier:t.identifier}}};const n={type:"orientation",options:{rotation:t.outputRotation,flipHorizontally:t.flipHorizontally,flipVertically:t.flipVertically}};return{transform:o,orientation:n}}}});var iI={};ue(iI,{Deserializers:()=>xct,Serializer:()=>mu});var xct;var rI=d(()=>{eW();rW();sW();xct={"3.9.0":Oi,"3.12.0":Ri}});var aW,vct,Cct,Sct,ef;var lW=d(()=>{wt();R();z();aW=/^data:image\/(.+?);base64,/;vct=i=>aW.test(i);Cct=i=>i.match(/^data:([^;]+)/)[1];Sct=i=>i.replace(aW,"");ef=class{constructor(t){this.applySerialization=async(t,e,r,o)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const s="Unexpected error occured";const a=e.deserializeImage(t);if(a.image&&a.image.data){const u=a.image.data;await this.editor.setImage(u);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(u);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const l=e.deserializeTransformation(t);if(!l){o(s);return}await this.applyStateOnUI(l);const c=e.deserialize(t);if(!c){o(s);return}await this.applyStateOnUI(c);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}r()};this.editor=t}serialize({image:t}={image:false}){const e=this.editor.activeStore.tool==="transform";const{displaySerializationModal:r}=this.editor.configStore.config;if(r){this.editor.modalStore.showInfoModal("saving")}return new Promise((o,n)=>{Promise.resolve().then(()=>(rI(),iI)).then(async({Serializer:s})=>{try{if(e){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:a}=this.editor.imageContainer.getData();const l=this.editor.engineMediator.output.container.getResolution();const c={width:a.width,height:a.height};const u=new s(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,l,c,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const m={["adjustment"]:lt(this.editor.adjustmentsToolStore.state),["filter"]:lt(this.editor.filterToolStore.state),["focus"]:lt(this.editor.focusToolStore.serializableState),["overlay"]:lt(this.editor.overlayToolStore.state),["frame"]:lt(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:p,customStickers:h}=await this.editor.spriteStore.serializableState();p.spriteIdList=p.spriteIdList.sort((x,b)=>{const w=p.common[x].order;const T=p.common[b].order;return w-T});m.sprite=p;m.customStickers=h;m.transform=this.editor.transformToolStore.serializableState;let g;let _;if(t){const x=ef.getDataURL(a);_=Cct(x);g=Sct(x)}if(r){this.editor.modalStore.hideModal()}o(u.serialise(m,g,_));if(e){this.editor.transformToolStore.onEnter()}}catch(a){if(r){this.editor.modalStore.hideModal()}n(a)}})})}deserialize(t){this.editor.modalStore.showInfoModal("loading");return new Promise((e,r)=>{try{Promise.resolve().then(()=>(rI(),iI)).then(({Deserializers:o})=>{const n=t.version.match(/[0-3].[0-8].[0-9]/i);let s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](this.editor)}else if(o[t.version]){s=new o[t.version](this.editor)}else{s=new o["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(t,s,e,r)})}else{this.applySerialization(t,s,e,r)}})}catch(o){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}r(o)}})}static getDataURL(t){if(t instanceof HTMLImageElement){const{src:n}=t;if(vct(n)){return n}}if(t instanceof HTMLCanvasElement){return t.toDataURL("image/png")}const e=document.createElement("canvas");e.width=t.width;e.height=t.height;const r=e.getContext("2d");r.drawImage(t,0,0);const o=e.toDataURL("image/png");jt(e);return o}async applyStateOnUI(t){const e=this.editor.activeStore.tool==="transform";try{if(t.transform){if(!e){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(t.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!e){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(t.filter){await this.editor.filterToolStore.updateStateFromSerialization(t.filter)}if(t.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(t.adjustment)}if(t.focus){await this.editor.focusToolStore.updateStateFromSerialization(t.focus)}if(t.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(t.overlay)}if(t.sprite){let r=Object.keys(t).length-1;if(t.customStickers){r-=1}t.sprite.spriteIdList=t.sprite.spriteIdList.sort((o,n)=>{const s=t.sprite.common[o].order;const a=t.sprite.common[n].order;return s-a});await this.editor.spriteStore.updateStateFromSerialization(t.sprite,t.customStickers,Math.max(0,r))}if(t.brush){this.editor.brushToolStore.updateStateFromHistory(t.brush)}if(t.frame){await this.editor.frameToolStore.updateStateFromSerialization(t.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(r){if(r.name==="AssetNotFoundError"){console.error(r)}else{console.error(r);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:r.message,handleConfirm:()=>{this.applyStateOnUI(t)}})}}}}});var wct,oI;var cW=d(()=>{wct=i=>{const t=atob(i.split(",")[1]);const e=i.split(",")[0].split(":")[1].split(";")[0];const r=new ArrayBuffer(t.length);const o=new Uint8Array(r);for(let n=0;n{R();uW=i=>i.split(",")[0].split(":")[1].split(";")[0];dW=i=>{if(typeof i==="string"){return uW(i)}if(i.src.includes(".svg")){return"image/svg+xml"}if(i.src){return uW(i.src)}return"image/jpeg"}});var bv,rf;var pW=d(()=>{Gh();bv=y(Yu());R();Ln();rf=class{static isImageElement(t){return t instanceof HTMLImageElement}constructor({license:t,assetProvider:e,crossOrigin:r,backgroundColor:o}){this.crossOrigin=r;this.engine=new hm({license:t,crossOrigin:r,assetProvider:e,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:o})}getAllFilterPreviewThumbnails(t){return new Promise((e,r)=>{const o=[];const n=[];t.forEach(s=>{if(s.isDuotone)o.push(s.identifier);else n.push(s.identifier)});this.getAllDuotonePreview(o).then(s=>{this.getAllLutPreview(n).then(a=>{e(Object.assign(s,a))}).catch(a=>{r(a)})}).catch(s=>{r(s)})})}async getAllDuotonePreview(t){const e={};if(!t.length)return e;const r=await this.engine.addDuoToneFilterFromAssets(t[0],this.container);await(0,bv.default)(t,async o=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(o);const s=r.filterOperation.getFilter();s.set({intensity:.5,lightColor:nt.Color.fromHex(n.lightColor),darkColor:nt.Color.fromHex(n.darkColor)});const a=await this.engine.export("data-url","image/jpeg",.8,false,true);e[o]=a},{concurrency:1});this.engine.removeEffect(r);return e}async loadLutAssets(t){const e={};await(0,bv.default)(t,async r=>{e[r]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",r))});return e}async getAllLutPreview(t){const e={};if(!t.length)return e;const r=await this.loadLutAssets(t);const o=await this.engine.addLUTFilterFromAssets(t[0],this.container);await(0,bv.default)(t,async n=>{const s=this.engine.assetProvider.getLUTFilterAsset(n);const a=o.filterOperation.getFilter();const l={horizontalTileCount:s.horizontalTileCount||5,verticalTileCount:s.verticalTileCount||5,image:r[n]};a.set({...l,intensity:s.defaultIntensity||1});o.setProperties({intensity:1});a._lutPrimitive.set(l);const c=await this.engine.export("data-url","image/jpeg",.8,false,true);e[n]=c},{concurrency:1});this.engine.removeEffect(o);return e}addImageToContainer(t){return new Promise((e,r)=>{let o;if(rf.isImageElement(t)){o=t;this.setBackgroundImage(o);e()}else{this.getImageElement(t).then(n=>{o=n;this.setBackgroundImage(o);e()}).catch(n=>{r({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,r)=>{const o=new Image;o.addEventListener("load",()=>{e(o)});o.addEventListener("error",n=>{r(n)});o.crossOrigin=this.crossOrigin;o.src=t})}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t})}const{size:e}=this.container.getBounds();const r=this.engine.getOutputContainer();r.setResolution(e)}}});var Tct,jo;var nI=d(()=>{wt();z();Tct={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};jo=class{constructor(t){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(t,e)=>{const{height:r,width:o}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:s,snapToTop:a,snapToBottom:l}=this.configStore.config.snapping.position;const c=Math.min(r,o);let u=0;if(e==="bottom"){u=Math.round(r-c*l)}else if(e==="top"){u=Math.round(c*a)}else if(e==="right"){u=Math.round(o-c*s)}else if(e==="left"){u=Math.round(c*n)}else if(t==="vertical"&&e==="center"){u=Math.round(o/2)}else if(t==="horizontal"&&e==="center"){u=Math.round(r/2)}return u};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:t,snapToLeft:e,snapToRight:r}=this.configStore.config.snapping.position;const o=[];if(t){o.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(e){o.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(r){o.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return o};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:t,snapToTop:e,snapToBottom:r}=this.configStore.config.snapping.position;const o=[];if(t){o.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(e){o.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(r){o.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return o};this.getRotationGuidesFromConfig=()=>{const{angles:t}=this.configStore.config.snapping.rotation;const e=[];t.forEach(o=>{e.push(o);e.push(o+360);e.push(o-360)});const r=e.filter((o,n)=>e.indexOf(o)===n);return r.map(o=>({value:o*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:t,leftBottom:e,rightTop:r,rightBottom:o})=>{const n=Math.min(t.y,r.y,e.y,o.y);const s=Math.max(t.y,r.y,e.y,o.y);const a=Math.min(t.x,r.x,e.x,o.x);const l=Math.max(t.x,r.x,e.x,o.x);return{height:Math.round(s-n),width:Math.round(l-a)}};this.mapRange=({value:t,fromMin:e,fromLength:r,toMin:o,toLength:n})=>{return(t-e)*n/r+o};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(t,e,r,o)=>{if(e.length===0){return t}if(e[0]>t){return t-r}for(let n=0;n=a-m){return a+u+(o?r*2:0)}return this.mapRange({value:t,fromMin:s,fromLength:a-s,toMin:l,toLength:c-l})}}if(o){return t+(e.length-1)*r*2+r}return t};this.mapFromSnapSystem=(t,e,r,o)=>{if(e.length===0){return t}if(e[0]>t){if(t>=e[0]-r){return e[0]}return t+r}let n=t;for(let a=0;a{const r=e*.5;const{value:o,edge:n}=t;let s=o;if(n==="leading"){s+=r}else if(n==="trailing"){s-=r}return s};this.mapSnappingGuidesToCenter=(t,e)=>{const r=[];t.forEach(o=>{r.push(this.centerSnapValue(o,e))});return r};this.calcSnapThresholdInRadians=(t,e)=>{if(t===0){return 0}return e/t};this.calculatePreviewTopLeftPosition=()=>{const t=this.editor.engineMediator.preview.container.getPosition();const e=this.editor.getPreviewSize();const r=Do();this.previewTopLeftPosition={x:t.x/r-e.width/2,y:t.y/r-e.height/2}};this.snapToRotation=(t,e,r)=>{const{rotationGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.rotation;const{x:a,y:l}=this.previewTopLeftPosition;const{width:c}=this.editor.getPreviewSize();let u=(t+Math.PI*2)%(Math.PI*2);if(n){const m=new F(e).magnitude;const p=o.map(_=>_.value).sort((_,x)=>_-x);const h=this.calcSnapThresholdInRadians(m,s);if(!this.rotationOffset){const _=this.mapToSnapSystem(t,p,h,false);this.rotationOffset=_-u}u=this.mapFromSnapSystem(u+this.rotationOffset,p,h,false);const g={x:r.position.x-a-c,y:r.position.y-l};o.forEach(_=>{_.isVisible=_.value===u;_.position=g});return u}return t};this.snapToPosition=(t,e)=>{const{horizontalGuides:r,verticalGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.position;const a=new F(this.previewTopLeftPosition);const{height:l,width:c}=this.getSpriteDimensions(e);const{x:u,y:m}=new F(t).subtract(a);if(n){const p=this.mapSnappingGuidesToCenter(r,l).sort((x,b)=>x-b);const h=this.mapSnappingGuidesToCenter(o,c).sort((x,b)=>x-b);if(!this.positionOffset){const x=this.mapToSnapSystem(u,h,s,true);const b=this.mapToSnapSystem(m,p,s,true);this.positionOffset=new F(x,b).subtract(new F(u,m))}let g=this.mapFromSnapSystem(u+this.positionOffset.x,h,s,true);let _=this.mapFromSnapSystem(m+this.positionOffset.y,p,s,true);g=Math.round(g);_=Math.round(_);r.forEach(x=>{const b=Math.round(this.centerSnapValue(x,l));x.isVisible=b===_});o.forEach(x=>{const b=Math.round(this.centerSnapValue(x,c));x.isVisible=b===g});return new F(g,_).add(a)}return{x:u,y:m}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=t;this.configStore=t.configStore;this.state=Z(Tct);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(t=>({...t,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(t=>({...t,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(t=>({...t,isVisible:false}))}get positionGuides(){const{verticalGuides:t,horizontalGuides:e}=this.state;return[...t,...e]}get rotationGuides(){return this.state.rotationGuides}};f([Z],jo.prototype,"state",2);f([v],jo.prototype,"snapToRotation",2);f([v],jo.prototype,"snapToPosition",2);f([v],jo.prototype,"hidePositionGuides",1);f([v],jo.prototype,"hideRotationGuides",1);f([v],jo.prototype,"dispose",2);f([C],jo.prototype,"positionGuides",1);f([C],jo.prototype,"rotationGuides",1)});var Cl;var hW=d(()=>{wt();R();Ln();z();pv();hv();uv();Vk();mv();fv();gv();lW();sk();lk();ck();wk();eI();dk();cW();mW();pW();kk();nI();tI();Zk();Cl=class{constructor(t,e){this.initWithImage=async t=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(t);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const e=this.configStore.config.engine;this.previewThumbnails=new rf({...e,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:e.identifier?e.identifier:"rendering",error:e,handleConfirm:()=>{this.initWithImage(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:t,height:e})=>{const{maxMegaPixels:r}=this.configStore.config.engine.downscaleOptions;const o=dp.isMobile()?r.mobile:r.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${o}`,width:`${t}`,height:`${e}`}})})};this.init=t=>{var o,n;if(!((o=this.activeStore)==null?void 0:o.image)){this.initWithImage(t);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const e=this.historyStore.isDirty();const{displayDiscardChangesWarning:r}=this.configStore.config;if(e&&r){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(t);this.resetToolStates()},handleDismiss:()=>{this.setImage(t,true)}});return}if(e&&!r){this.setImage(t,true);return}this.historyStore.reset();this.setImage(t,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:s,displayCanvasRendererWarning:a}=this.configStore.config;if(s.preferredRenderer==="canvas"&&a){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(t,e=false)=>{try{if(!this.activeStore.image){this.initWithImage(t)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(t);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:r,flipVertically:o,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:o,flipHorizontally:r});await this.transformToolStore.rotateOutputContainer(_p(n),false);if(e){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const s=this.activeStore.tool;if(!s){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(r){this.configStore.events.onErrorImageLoading(r);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:r.identifier?r.identifier:"rendering",error:r,handleConfirm:()=>{this.setImage(t,e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(r)}};this.onToolChange=(t,e=null,r=true)=>{var o,n;if(t===e){return}if((n=(o=this.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([t,e].indexOf("transform")!==-1){if(t==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(e==="transform"){this.transformToolStore.onEnter()}this.resize(e)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(r){this.render()}}};this.resize=(t=null)=>{if(!this.engineMediator)return;try{const e=this.activeStore.tool;const r=t==="transform"||!t&&e==="transform";this.canvasStore.resizeCanvas(t);this.transformToolStore.applyDefaultCrop();const o=lt(this.transformToolStore.maxCropMaskSize);if(!r){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const s=this.engineMediator.preview.updateTransform(n);if(s){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(o);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const a=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(a);if(!r){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:t,...e}={})=>{const r=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(r){this.transformToolStore.onLeave()}const{config:o}=this.configStore;const n={...o.export.image,...e};const{exportType:s,format:a,quality:l,enableDownload:c,transparent:u}=n;const m=await this.engineMediator.engine.export(s,a,l,u);if(r&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(c){this.triggerFileDownload(o.export.filename,a,s,m)}if(!t){this.configStore.events.onExport(m)}return m}catch(o){if(this.modalStore){this.modalStore.hideModal()}if(r&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(o)}};this.serialize=({image:t}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:t})}return Promise.resolve({})};this.deserialize=t=>{if(this.serializationMediator){return this.serializationMediator.deserialize(t)}return Promise.resolve()};this.close=()=>{var t,e,r,o,n,s;if((((t=this.historyStore)==null?void 0:t.isDirtySinceSave)||((r=(e=this.transformToolStore)==null?void 0:e.transformHistory)==null?void 0:r.hasChanges()))&&((n=(o=this.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var a;if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}}})}else if((s=this.configStore)==null?void 0:s.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:t,height:e}=this.engine.getOutputDimensions();return{width:t,height:e}}return{width:0,height:0}};this.wait=(t=0)=>new Promise(e=>setTimeout(e,t));this.clickableCanvas=async t=>{if(t){await new Promise(e=>setTimeout(e,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:t}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(t){const e=this.transformToolStore.localOutputImageSize;const r=e.width/e.height;const o=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(o.indexOf(parseFloat(r.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(t,e,r)=>{this.historyStore.addSnapshot(t,e,r)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=t=>this.assetProvider.getPathForCategory(t);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=t=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(t)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:t,height:e}=this.engine.getOutputDimensions();if(t&&e){return{width:Math.round(this.worldToPreview(this.outputToWorld(t))),height:Math.round(this.worldToPreview(this.outputToWorld(e)))}}return{height:e,width:t}};this.getImageMimeType=()=>{return dW(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var t,e,r;(r=(e=(t=this.engineMediator)==null?void 0:t.image)==null?void 0:e.container)==null?void 0:r.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(t,e,r,o)=>{const n=e==="image/jpeg"&&r!=="ms-blob"?".jpeg":".png";const s=t+n;const a=this.blobFromExportData(o);this.triggerBlobDownload(s,a)};this.triggerBlobDownload=(t,e)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(e,t)}else{const r=document.createElement("a");const o=URL.createObjectURL(e);r.href=o;r.download=t;document.body.appendChild(r);r.click();document.body.removeChild(r);if(!UF()){URL.revokeObjectURL(o)}}};this.blobFromExportData=t=>{if(typeof t==="string"){return oI(t)}if(t instanceof HTMLImageElement){return oI(t.src)}return t};this.configStore=new Zi;if(e){Object.entries(e).forEach(([o,n])=>{this.configStore.events.on(o,n)})}const r=this.configStore.saveConfig(t);this.engineMediator=new Gk(this);this.serializationMediator=new ef(this);this.spriteStore=new ot(this);this.scale=new Qe(this);this.filterToolStore=new Ne(this);this.adjustmentsToolStore=new Jt(this);this.focusToolStore=new At(this);this.overlayToolStore=new Je(this);this.frameToolStore=new Ae(this);this.brushToolStore=new ke(this);this.transformToolStore=new Q(this);this.libraryStore=new hr(this);this.modalStore=new Hr(this);this.snappingStore=new jo(this);this.activeStore=new pr(this);this.canvasStore=new Fi(this);this.historyStore=new uu(this);this.libraryStore.initProvider(r);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const t=this.outputContainer.getBounds();return Math.min(t.width,t.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(t,e){if(!this.engineMediator)return{x:0,y:0};if(qr(t)){return this.engineMediator.previewSpaceToWorldSpace(t,e)}return this.engineMediator.previewSpaceToWorldSpace(t,e)}worldToPreview(t){if(!this.engineMediator)return{x:0,y:0};if(qr(t)){return this.engineMediator.worldSpaceToPreviewSpace(t)}return this.engineMediator.worldSpaceToPreviewSpace(t)}worldSizeToPreview(t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(t.width),height:this.engineMediator.worldSpaceToPreviewSpace(t.height)}}previewSizeToWorld(t,e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(t.width,e),height:this.engineMediator.previewSpaceToWorldSpace(t.height,e)}}outputToWorld(t){if(!this.engineMediator)return{x:0,y:0};if(qr(t)){return this.engineMediator.outputSpaceToWorldSpace(t)}return this.engineMediator.outputSpaceToWorldSpace(t)}previewToOutput(t){if(!this.engineMediator)return{x:0,y:0};if(qr(t)){return this.engineMediator.previewSpaceToOutputSpace(t)}return this.engineMediator.previewSpaceToOutputSpace(t)}get outputContainer(){return this.engineMediator.output.container}};f([v],Cl.prototype,"resize",2);f([v],Cl.prototype,"export",2);f([v],Cl.prototype,"clickableCanvas",2)});var Kt=d(()=>{z();mr();Qx();iH();sk();lk();ck();dk();bH();vH();CH();wk();kH();YH();ZH();QH();gv();mv();hW();Ok();uv();pv();hv();fv();nI();qh();Zh();Yh();xl();Un();pm()});var of,nf,fW,gW,kct,Ict,bW;var yW=d(()=>{of=y(require("react"));A();nf=y(require("styled-components"));R();Kt();z();je();fW=dt.Button.TextSecondary;gW=nf.default.span` + 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};Mk=Vlt});var Jh,cv,Nr;var Zh=d(()=>{Yh();BH();PH();Jh=lv();cv=av();Nr={...Jh,measurements:cv}});var $lt,MH;var LH=d(()=>{xl();Zh();$lt=i=>{if(i==="light"){return Mk}return lv};MH=(i,t)=>{const e=$lt(i);if(t&&t[i]){const{primary:r,background:o,foreground:n}=t[i];const s={primary:r,background:o,foreground:n};const a=Object.keys(s).reduce((l,c)=>{if(s[c]){return{...l,[c]:s[c]}}return l},{});return Ei([e(a),t[i]])}return e()||Jh}});var Klt,zH;var UH=d(()=>{xl();Yh();Klt=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];zH=i=>{const t=av();if(i){const e={};Object.keys(i).forEach(r=>{if(Klt.indexOf(r)!==-1){e[r]=i[r]}});return Ei([t,e])}return t}});var NH=d(()=>{AH();LH();UH()});var Xlt,Zi;var uv=d(()=>{wt();R();Ln();z();xl();Ok();DH();nk();qh();NH();Zh();Xlt={config:yl,locale:cu,theme:Jh,measurements:cv,initialMeasurements:cv};Zi=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(t,e)=>{return e.indexOf(t)!==-1};this.state=Z(Xlt);this.events=new Rk;this.licenseChecker=null}saveConfig(t){if(t.mainCanvasActions&&t.mainCanvasActions.length!==4){t.mainCanvasActions.length=4}const e=t.layout&&t.layout==="basic"?Ak:yl;const r=Ei([e,t],{clone:true});this.licenseChecker=new Jx(r.license);if(!this.licenseChecker.areCustomAssetsAllowed()){r.sticker.enableCustomUpload=false}const o=OH(r.language,r.custom.languages);const n=MH(r.theme,r.custom.themes);const s=zH(r.custom.measurements);const{provider:a}=r.library;const l=[];r.adjustment.categories=r.adjustment.categories.reduce((m,p)=>{m.push({...p,items:p.items.filter(h=>{if(!_C[h.identifier]){l.push(h.identifier);return false}return true})});return m},[]);if(l.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${l.join(", ")}`)}delete r.language;delete r.custom.languages;delete r.custom.themes;delete r.library.provider;let c=r.tools.reduce((m,p)=>{if(typeof p==="object"){return[...m,...p]}return[...m,p]},[]);if(!c.length){console.error(`Empty list input for tools`);c=Zx.reduce((m,p)=>{if(typeof p==="object"){return[...m,...p]}return[...m,p]},[])}c=c.filter(m=>this.licenseChecker.isToolAllowed(m));if(r.defaultTool){const m=this.checkDefaultToolAvailability(r.defaultTool,c);if(!m){[r.defaultTool]=c}}r.tools=c;this.state.config=r;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;const u=this.buildCustomAssetsConfig();this.assetProvider=new yp(u,this.licenseChecker.areCustomAssetsAllowed(),r.assetResolver);this.loadThemeFont();return a}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((t,e)=>{if(typeof e==="string"){return[...t,e]}return[...t,"",...e]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:t}=this.theme;if(!t.skipLoading){this.assetProvider.getFontManager().injectFonts([t])}}buildCustomAssetsConfig(){const t=this.tools;const e=lt(this.state.config);const r=this.state.config.assetBaseUrl;const{theme:o}=this.state;const n=t.indexOf("filter")!==-1?e["filter"]:void 0;const s=t.indexOf("focus")!==-1?e["focus"]:void 0;const a=t.indexOf("adjustment")!==-1?e["adjustment"]:void 0;const l=t.indexOf("sticker")!==-1?e["sticker"]:void 0;const c=t.indexOf("frame")!==-1?e["frame"]:void 0;const u=t.indexOf("overlay")!==-1?e["overlay"]:void 0;const m=t.indexOf("transform")!==-1?e["transform"]:void 0;const p=t.indexOf("text")!==-1?e["text"]:void 0;const h=t.indexOf("textdesign")!==-1?e["textdesign"]:void 0;return{basePath:r,theme:o,filter:n,focus:s,sticker:l,frame:c,overlay:u,transform:m,text:p,adjustment:a,textdesign:h}}};f([v],Zi.prototype,"saveConfig",1);f([v],Zi.prototype,"dispose",2);f([C],Zi.prototype,"config",1);f([C],Zi.prototype,"locale",1);f([C],Zi.prototype,"theme",1);f([C],Zi.prototype,"measurements",1);f([C],Zi.prototype,"initialMeasurements",1);f([C],Zi.prototype,"tools",1);f([C],Zi.prototype,"defaultTool",1);f([C],Zi.prototype,"isOrderDefault",1);f([C],Zi.prototype,"isLayoutAdvanced",1);f([C],Zi.prototype,"displayCloseButton",1)});var Lk;var zk=d(()=>{R();bC();Lk=class{constructor(t){this.editor=t}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,originalImage:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t,originalImage:t})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((t,e)=>{const{image:r}=this.editor.activeStore;if(GF(r)){this.setBackgroundImage(r);t()}else{const o=this.editor.libraryStore.getRawUrl(r);this.getImageElement(o).then(n=>{this.setBackgroundImage(n);t()}).catch(n=>{e({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,r)=>{const o=new Image;o.addEventListener("load",()=>{e(o)});o.addEventListener("error",n=>{r(n)});o.crossOrigin=this.editor.configStore.config.engine.crossOrigin;o.src=t})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}}});var Uk;var Nk=d(()=>{z();Uk=class{constructor(t){this.applyNewImageTransform=()=>{const{size:t,width:e,height:r}=this.editor.engineMediator.image.container.getBounds();const o=this.container;o.setTransform(ie.IDENTITY);o.setResolution(t);o.setPivot(.5,.5);o.setPosition({x:e/2,y:r/2})};this.editor=t}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}}});function Qh(i,t){const e=i.width/i.height;const r=t.width/t.height;if(e>r){return i.height/t.height}return i.width/t.width}var HH=d(()=>{});var qlt,Qs;var Hk=d(()=>{wt();z();HH();qlt={transform:ie.IDENTITY};Qs=class{constructor(t){this.initialTransform=ie.IDENTITY;this.editor=t;this.state=Z(qlt)}createPreview(t){this.container=this.editor.engine.createPreview(t)}updateTransform(t=0,e=true){const r=this.calculateTransform(t);if(r.scale.x){if(e){this.saveInitialTransform(r)}else{this.savePreviewTransform(r)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(t){this.initialTransform=t;this.savePreviewTransform(t)}savePreviewTransform(t){Ge(()=>{this.state.transform.position=t.position;this.state.transform.scale=t.scale;this.state.transform.rotation=t.rotation;const e=Do();const r=new F(t.scale).divide(e);this.previewTransformWithoutDpr={position:new F(t.position).divide(e),scale:r,rotation:t.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(t=0){const e=Do();const{scaleImageToFit:r}=this.editor.configStore.config;const{width:o,height:n}=this.editor.canvasStore.canvasSize;const s=this.editor.engine.getOutputDimensions();const a=Qh({width:o,height:n},s);let l=r?a:Math.min(1,a);const c=n-s.height*l;const u=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(cn*m){l=Qh({width:o,height:n*m},s)}if(s.width*l>o*m){l=Qh({width:o*m,height:n},s)}l*=e;const p={x:o*e/2,y:n*e/2};const h={x:l,y:l};return new ie(p,h,t)}};f([v],Qs.prototype,"updateTransform",1);f([v],Qs.prototype,"savePreviewTransform",1);f([C],Qs.prototype,"transform",1);f([C],Qs.prototype,"position",1);f([C],Qs.prototype,"scale",1);f([C],Qs.prototype,"rotation",1)});var vl,dv;var Wk=d(()=>{R();vl=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(t){if(["sticker","text","textdesign","brush"].indexOf(t)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(t,e){const r=e.findIndex(o=>o===t);if(r!==-1){e.splice(r,1)}return void 0}static indexForOrder(t,e,r){const o=t[r];const n=e.findIndex(a=>a===r);if(n!==-1){return{index:n,order:e}}const{length:s}=e;if(s){let a;for(a=0;ao===t);if(r!==-1){this.spriteContainerOrder[r]=e}}bringToFront(t){const e=this.spriteContainerOrder.findIndex(r=>r===t);if(e!==-1){this.spriteContainerOrder.splice(e,1);this.spriteContainerOrder.push(t)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:t}=this.spriteContainerOrder;return this.spriteContainerOrder[t-1]}getSpriteIndex(t){const e=this.spriteContainerOrder.findIndex(r=>r===t);return e+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};dv=vl;dv.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3}});var Gk;var Vk=d(()=>{Ln();z();zk();Nk();Hk();Wk();Gk=class{constructor(t){this.orderHelper=new dv;this.init=()=>{const t=this.editor.configStore.config.engine;this.engine=new hm({...t,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new Lk(this.editor);this.output=new Uk(this.editor);this.preview=new Qs(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=t}render(t){return this.engine.render(t)}previewSpaceToWorldSpace(t,e){const r=this.preview.previewTransformWithoutDpr;if(qr(t)){const o=this.editor.engine.convertPointFromPreviewIntoWorldSpace(F.ZERO,r,e);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:t,y:0},r,e);return F.distance(new F(o),new F(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(t,r,e)}worldSpaceToPreviewSpace(t){const e=this.preview.previewTransformWithoutDpr;if(qr(t)){const r=this.editor.engine.convertPointFromWorldIntoPreviewSpace(F.ZERO,e);const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:t,y:0},e);return F.distance(new F(r),new F(o))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(t,e)}outputSpaceToWorldSpace(t){if(qr(t)){return st.getScalarInWorldSpace(t,this.editor.engine.getOutputContainer())}return st.getPointInWorldSpace(t,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(t){const e=this.preview.previewTransformWithoutDpr;if(qr(t)){const r=this.editor.engine.convertPointFromPreviewIntoOutputSpace(F.ZERO,e);const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:t,y:0},e);return F.distance(new F(r),new F(o))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(t,e)}previewSpaceToFlippedPreviewSpace(t){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(t)}}});var _m;var WH=d(()=>{wt();_m=class{constructor(){this.snapshots=[];this.observeIndex=Z.box(-1)}addSnapshot(t){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(t))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(t)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(t){if(t>0&&t0}get canRedo(){return this.snapshots.length-1>this.index}};f([C],_m.prototype,"index",1);f([C],_m.prototype,"canUndo",1);f([C],_m.prototype,"canRedo",1)});var uu;var mv=d(()=>{wt();R();WH();Ji();uu=class{constructor(t){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const t=this.appHistoryManager.undo();await this.applyState(t);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const t=this.appHistoryManager.redo();await this.applyState(t);this.awaitHistoryChange=false}};this.editor=t;this.appHistoryManager=new _m}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const t=lt(this.editor.adjustmentsToolStore.state);const e=lt(this.editor.filterToolStore.state);const r=this.editor.focusToolStore.getFocusStateForHistory();const o=lt(this.editor.overlayToolStore.state);const n=lt(this.editor.frameToolStore.state);const{strokes:s}=this.editor.brushToolStore;const a=this.editor.spriteStore.getSpriteHistoryState();const l=this.editor.transformToolStore.serializableState;return{["adjustment"]:t,["filter"]:e,["focus"]:r,["overlay"]:o,["frame"]:n,["brush"]:s,sprite:a,["transform"]:l}}addInitialSnapshot(){const t=this.getHistoryState();this.appHistoryManager.addSnapshot({state:t,type:"add",description:"Initial State"})}addSnapshot(t,e,r){let o;if(!t){o=this.getHistoryState()}else if(t.sprite||t.transform){o={...this.getHistoryState(),...t}}else{o=t}this.appHistoryManager.addSnapshot({state:o,type:e,description:r});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:t}){try{if(t){const e=Object.keys(t);for(const r of e){switch(r){case"filter":await this.editor.filterToolStore.updateStateFromHistory(t[r]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(t[r]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(t[r]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(t[r]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(t[r],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(t[r]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(t[r]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(t[r]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(e){console.error(e);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:e,handleConfirm:()=>{this.applyState({state:t})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var t,e;return(e=(t=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:t.state)==null?void 0:e.sprite}};f([v],uu.prototype,"undo",2);f([v],uu.prototype,"redo",2);f([C],uu.prototype,"canUndo",1);f([C],uu.prototype,"canRedo",1)});var Ylt,GH,Jlt,jk;var VH=d(()=>{Ylt=(i,t)=>new Promise((e,r)=>{const o=new XMLHttpRequest;o.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){e(n.result)}else{r(new Error(`The image could not be loaded from ${i}`))}};n.onerror=s=>{r(s)};n.readAsDataURL(o.response)};o.open("GET",i);o.responseType="blob";o.withCredentials=t==="use-credentials";o.send()});GH=(i,t)=>{return new Promise((e,r)=>{const o=new Image;o.onload=()=>{e(o)};o.onerror=()=>{r(new Error(`Failed to load image with src:${i}`))};o.crossOrigin=t;o.src=i})};Jlt=(i,t)=>new Promise((e,r)=>{Ylt(i,t).then(o=>{const n=new Image;n.addEventListener("load",()=>{e(n)});n.src=o}).catch(()=>{GH(i,t).then(o=>e(o)).catch(o=>{r(o)})})});jk=async({url:i,image:t,crossOrigin:e="anonymous"})=>{try{if(t&&t.src&&t.src.substr(0,5)==="data:"||t&&t.src&&t.src.includes(".svg")){return t}if(typeof i==="string"&&i.substr(0,5)==="data:"||typeof i==="string"&&i.includes(".svg")){return GH(i,e)}return Jlt(i||t.src,e)}catch(r){throw new Error(r)}}});var Zlt,pr;var pv=d(()=>{wt();R();z();VH();Zlt={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};pr=class{constructor(t){this.setImage=async t=>{try{const{crossOrigin:e}=this.editor.configStore.config.engine;if(typeof t==="string"&&!t.trim()||t===void 0||t===null){this.state.image=null}else if(typeof t==="string"){this.state.image=await jk({url:ln(t)?t:this.editor.assetProvider.getPath(t),crossOrigin:e})}else if(t instanceof HTMLImageElement){this.state.image=await jk({image:t,crossOrigin:e})}if(this.isWebcam){this.state.isWebcam=false}}catch(e){throw new Error(e)}};this.setImageLoadedToEngine=t=>{this.state.imageLoadedToEngine=t};this.newImage=t=>{this.editor.init(t)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=t;this.state=Z(Zlt)}selectTool(t){var r,o,n;const{licenseChecker:e}=this.editor.configStore;if(this.state.tool!==t&&(e==null?void 0:e.isToolAllowed(t))&&(this.image||t==="library"||t==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const s=(n=(o=(r=this.editor.configStore.state.config["customTool"])==null?void 0:r.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(t==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,t);this.state.tool=t;this.editor.configStore.events.onToolChanged(t);switch(t){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(t){this.state.isWebcam=t}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};f([v],pr.prototype,"selectTool",1);f([v],pr.prototype,"selectWebcam",1);f([v],pr.prototype,"setImage",2);f([v],pr.prototype,"setImageLoadedToEngine",2);f([v],pr.prototype,"newImage",2);f([v],pr.prototype,"dispose",2);f([C],pr.prototype,"webcamLabel",1);f([C],pr.prototype,"tool",1);f([C],pr.prototype,"isWebcam",1);f([C],pr.prototype,"image",1);f([C],pr.prototype,"imageLoadedToEngine",1)});var Qlt,$k,Kk,Fi;var hv=d(()=>{wt();R();z();Qlt={height:150,width:150};$k={height:0,width:0};Kk=class{constructor(t){this.canvasClickDisabled=Z.box(false);this.resizeCanvas=(t=null)=>{const e=this.editor.activeStore.tool;const r=t==="transform"||!t&&e==="transform";const{isLayoutAdvanced:o,measurements:n}=this.editor.configStore;const{storedSize:s}=this.editor.canvasStore;let a=0;if(!o&&r){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(t==="transform"&&e==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:s.width,height:s.height+a})};this.setCanvasSize=t=>{this.state.canvasSize=t};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=t;this.state=Z(Kk.initialState)}setCanvasElement(t){this.canvas=t;this.editor.engineMediator.preview.createPreview(t);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:t,width:e,render:r}){const{imageLoadedToEngine:o}=this.editor.activeStore;if(t>$k.height&&e>$k.width){this.state.storedSize={width:e,height:t};if(this.state.canvasSize.height===0){this.state.canvasSize={width:e,height:t}}if(r&&o){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return F.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(t){const e=this.editor.engine.getContainersAtPreviewPoint(t,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(r=>r.getID()).filter(r=>r!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(e)}};Fi=Kk;Fi.initialState={canvasSize:$k,storedSize:Qlt};f([v],Fi.prototype,"setCanvasElement",1);f([v],Fi.prototype,"saveDimensions",1);f([v],Fi.prototype,"resizeCanvas",2);f([v],Fi.prototype,"disableCanvasClick",1);f([v],Fi.prototype,"enableCanvasClick",1);f([v],Fi.prototype,"setCanvasSize",2);f([v],Fi.prototype,"dispose",2);f([C],Fi.prototype,"isCanvasClickable",1);f([C],Fi.prototype,"canvasSize",1);f([C],Fi.prototype,"storedSize",1);f([C],Fi.prototype,"sizeVector",1);f([C],Fi.prototype,"sizeVectorMagnitude",1)});var tct,Hr;var fv=d(()=>{wt();R();tct={type:null,identifier:null,isVisible:false,error:""};Hr=class{constructor(t){this.showActionModal=({type:t,identifier:e,error:r,handleConfirm:o,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=e;this.state.type=t;this.state.error=r||"";this.handleConfirm=o;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=t.configStore;this.state=Z(tct)}showInfoModal(t){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=t;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:t}=this.state;const e=this.getModalLocale();if(e){const{bodyLabel:r,headerLabel:o,buttonYes:n,buttonNo:s}=e;return{headerLabel:o,bodyLabel:r,confirmLabel:n,dismissLabel:s,isVisible:t,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:t,measurements:{basicCanvasOffset:e,advancedUIToolControlBar:r,advancedUIToolbar:o},isOrderDefault:n}=this.configStore;const s=(r.width+o.width)*(!n?-1:1);const a=e;return t?{x:s/2,y:0}:{x:0,y:-a}}getModalLocale(){const{identifier:t,error:e,type:r}=this.state;const{locale:o}=this.configStore;if(!r||!t||r==="textEdit")return null;if(r&&t&&o[`${r}Modals`]&&o[`${r}Modals`][t]){const n=o[`${r}Modals`][t];let{body:s}=n;if(s&&typeof e==="object"){Object.keys(e).forEach(l=>{s=s.replace(`\${${l}}`,e[l])})}else if(s){s=s.replace("${error}",e)}let a=n.heading;if(r==="error"||r==="warning"){const l={error:o.common.error,warning:o.common.warning};const c=r==="error"?l.error:l.warning;a=`${c}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};f([v],Hr.prototype,"showActionModal",2);f([v],Hr.prototype,"showInfoModal",1);f([v],Hr.prototype,"showTextEditModal",1);f([v],Hr.prototype,"hideModal",2);f([v],Hr.prototype,"dispose",2);f([C],Hr.prototype,"modalProps",1);f([C],Hr.prototype,"isVisible",1);f([C],Hr.prototype,"type",1);f([C],Hr.prototype,"identifier",1);f([C],Hr.prototype,"positionOffset",1)});var Qe;var gv=d(()=>{wt();z();Qe=class{constructor(t){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(t=>t/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:t,maxOffsetY:e}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=e}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=t}this.savePosition();this.scaleRender()}};this.setOffset=t=>{const{canDragX:e,canDragY:r}=this.checkOffset(t);if(e){this.offset.x=t.x}if(r){this.offset.y=t.y}this.scaleRender()};this.editor=t}setInitialTransform(t=0){const e=Do();const{scaleImageToFit:r}=this.editor.configStore.config;const{transform:o}=this.editor.engineMediator.preview;Ge(()=>{const n=Math.abs(t||o.scale.x);this.setDefaultScale(r?n:Math.min(1*e,n));this.setPosition(o.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:t,height:e}=this.editor.canvasStore.canvas;this.setPosition({x:t/2,y:e/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(t){this.state.position.x=t.x;this.state.position.y=t.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(t){if(this.defaultScale!==1){const r=this.SCALE_LEVELS.findIndex(o=>o===this.defaultScale);if(r!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,r),...this.SCALE_LEVELS.slice(r+1)]}}const e=this.SCALE_LEVELS.findIndex(r=>r===t);if(e!==-1){this.state.scaleIndex=e}else{const r=this.SCALE_LEVELS.findIndex((o,n)=>{if(n===0){return t0;const g=u>0;const _=m-a;const x=p-l;return{canDragX:_<0,canDragY:x<0,maxOffsetX:h?-_:_,maxOffsetY:g?-x:x}}calculateScale(t=0,e=this.previewSize,r=this.defaultScale){const{width:o,height:n}=e;const s=new F({x:o,y:n});const a=new F(Math.abs(s.x*Math.cos(t))+Math.abs(s.y*Math.sin(t)),Math.abs(s.x*Math.sin(t))+Math.abs(s.y*Math.cos(t)));const l=s.subtract(a).divide(2).multiply(r).abs;if(l.y>l.x){return l.y*2/s.y+r}return l.x*2/s.x+r}get defaultIndex(){return this.SCALE_LEVELS.findIndex(t=>t===this.defaultScale)}getPositionWithOffset(t=this.offset){const{position:e}=this;return{x:e.x-t.x,y:e.y-t.y}}scaleRender(t=false){const e=this.editor.scale.getPositionWithOffset();const r=t?this.defaultScale:this.scale;const o={x:r,y:r};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(e);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:e,rotation:0});if(!t){this.editor.render()}}get scale(){const t=this.state.scaleIndex;return t!==-1?this.SCALE_LEVELS[t]:this.defaultScale}get zoomLevel(){const t=Do();return(this.scale/t*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const t=this.state.scaleIndex;const e=t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;const{previewSize:r}=this;return{width:r.width*e/this.defaultScale,height:r.height*e/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};f([Z],Qe.prototype,"state",2);f([v],Qe.prototype,"in",2);f([v],Qe.prototype,"out",2);f([v],Qe.prototype,"setInitialTransform",1);f([v],Qe.prototype,"resetScale",1);f([v],Qe.prototype,"resetPosition",1);f([v],Qe.prototype,"setPosition",1);f([v],Qe.prototype,"savePosition",1);f([v],Qe.prototype,"setDefaultScale",1);f([v],Qe.prototype,"setScaleToDefault",1);f([C],Qe.prototype,"scale",1);f([C],Qe.prototype,"zoomLevel",1);f([C],Qe.prototype,"canDrag",1);f([C],Qe.prototype,"canZoomOut",1);f([C],Qe.prototype,"canZoomIn",1);f([C],Qe.prototype,"position",1);f([C],Qe.prototype,"scaledSize",1)});var jH,ect,Wn,Le;var Xk=d(()=>{wt();z();jH=[[0,0],[0,1],[1,0],[1,1]];ect=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];Wn=class{constructor(t,e,r="center",o=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=e;this.m=r==="center"?Wn.movePivotTo([.5,.5]):jH;this.considerRotation=o;this.considerFlip=n;this.configStore=t.configStore}static getFlippedEdgeIndex(t,e,r){return ect[(e?1:0)+(r?2:0)][t]}static movePivotTo(t){return jH.map(e=>[e[0]-t[0],e[1]-t[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(t,e,r){const o=Wn.getFlippedEdgeIndex(t,e,r);const n=this.m[o][0]*this.size.width;const s=this.m[o][1]*this.size.height;return{width:n,height:s}}get leftTop(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(0,e,r);return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottom(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(1,e,r);return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightTop(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(2,e,r);return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottom(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(3,e,r);return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(1,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(3,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Wn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftMid(){const t=new F(this.leftTop);const e=new F(this.leftBottom);return t.add(e).divide(2)}get rightMid(){const t=new F(this.rightTop);const e=new F(this.rightBottom);return t.add(e).divide(2)}};Le=Wn;Le.coordinatesWithRotation=({width:t,height:e},r,o,n,s,a)=>{let l=t*Math.cos(r)-e*Math.sin(r)+a.x;let c=t*Math.sin(r)+e*Math.cos(r)+a.y;if(o){l=s.x*2-l}if(n){c=s.y*2-c}return new F({x:l,y:c}).rounded};f([C],Le.prototype,"position",1);f([C],Le.prototype,"size",1);f([C],Le.prototype,"rotation",1);f([C],Le.prototype,"flipHorizontally",1);f([C],Le.prototype,"flipVertically",1);f([C],Le.prototype,"flipCenter",1);f([C],Le.prototype,"leftTop",1);f([C],Le.prototype,"leftBottom",1);f([C],Le.prototype,"rightTop",1);f([C],Le.prototype,"rightBottom",1);f([C],Le.prototype,"leftBottomHandle",1);f([C],Le.prototype,"rightBottomHandle",1);f([C],Le.prototype,"leftMid",1);f([C],Le.prototype,"rightMid",1)});var qk=d(()=>{uv();qh();Zh();Yh();Vk();Wk();zk();Nk();Hk();mv();pv();hv();fv();gv();Xk()});var Et;var $H=d(()=>{wt();z();Ik();Et=class{constructor(t,e){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:Z.map({})};this.configStore=t.configStore;this.id=Ot();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=e}changeIdentifier(t){this.state.identifier=t;const e=this.state.cropState.get(`${this.id}-${t}`);if(!e){this.state.cropState.set(`${this.id}-${t}`,{...Vo})}}changeRatio(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){this.state.cropState.set(`${this.id}-${this.identifier}`,{...e,ratio:t})}}changeSize(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t.width&&t.width>0){e.size.width=Math.round(t.width)}if(t.height&&t.height>0){e.size.height=Math.round(t.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeHeight(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.height=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changeWidth(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.width=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changePositionX(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r&&t<=e-this.minCropSize&&t>=0){r.position.x=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}return false}changePositionY(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r&&t<=e-this.minCropSize&&t>=0){r.position.y=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}return false}changePosition(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r){if(t.x<=e.width-this.minCropSize&&t.x>=0&&t.y<=e.height-this.minCropSize&&t.y>=0){r.position.x=Math.round(t.x);r.position.y=Math.round(t.y);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}}return false}changeLockResolution(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.lockResolution=t!==void 0?t:!e.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeForceDimensions(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.forceDimensions=t;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}clearState(){this.state.cropState.forEach((t,e)=>e.startsWith(this.id)&&this.state.cropState.delete(e))}setRotation(t){this.state.rotationInDegrees=t}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:t,flipVertically:e}){this.state.flipHorizontally=t;this.state.flipVertically=e}setOutputRotation(t){this.state.outputRotation=t}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:t,height:e}=this.defaults.maxCropMaskSize;return new F(t/2,e/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:Vo.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:Vo.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:Vo.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:Vo.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:Vo.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:Vo.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:Vo.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:Vo.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:Vo.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};f([Z],Et.prototype,"state",2);f([v],Et.prototype,"changeIdentifier",1);f([v],Et.prototype,"changeRatio",1);f([v],Et.prototype,"changeSize",1);f([v],Et.prototype,"changeHeight",1);f([v],Et.prototype,"changeWidth",1);f([v],Et.prototype,"changePositionX",1);f([v],Et.prototype,"changePositionY",1);f([v],Et.prototype,"changePosition",1);f([v],Et.prototype,"changeLockResolution",1);f([v],Et.prototype,"changeForceDimensions",1);f([v],Et.prototype,"clearState",1);f([v],Et.prototype,"setRotation",1);f([v],Et.prototype,"resetRotation",1);f([v],Et.prototype,"resetOutputRotation",1);f([v],Et.prototype,"resetFlip",1);f([v],Et.prototype,"updateFlip",1);f([v],Et.prototype,"setOutputRotation",1);f([v],Et.prototype,"flipHorizontally",1);f([v],Et.prototype,"flipVertically",1);f([v],Et.prototype,"dispose",2);f([C],Et.prototype,"flipCenter",1);f([C],Et.prototype,"isFlippedHorizontal",1);f([C],Et.prototype,"isFlippedVertical",1);f([C],Et.prototype,"identifier",1);f([C],Et.prototype,"height",1);f([C],Et.prototype,"width",1);f([C],Et.prototype,"position",1);f([C],Et.prototype,"ratio",1);f([C],Et.prototype,"size",1);f([C],Et.prototype,"x",1);f([C],Et.prototype,"y",1);f([C],Et.prototype,"lockResolution",1);f([C],Et.prototype,"forceDimensions",1);f([C],Et.prototype,"selectedCrop",1);f([C],Et.prototype,"rotationInDegrees",1);f([C],Et.prototype,"outputRotation",1)});var Yk;var KH=d(()=>{wt();z();pm();Yk=class{constructor(t){this.transforms={output:JSON.stringify(ie.IDENTITY),preview:JSON.stringify(ie.IDENTITY)};this.setFrameOpacity=t=>{this.frameOpacity=t;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=t=>{this.overlayOpacity=t;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=t;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:t,flipVertically:e,rotation:r,outputRotation:o}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new F(this.transformToolStore.leftTopRespectFlip).add(new F(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new F(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const s=this.engineMediator.preview.container;const{outputContainer:a}=this.editor;a.setResolution(lt(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:e,flipHorizontally:t});const l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let c=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:g,defaultImageSize:_}=this.transformToolStore;const x=this.transformToolStore.maxCropMaskSize;const b={height:g.height*_.height/x.height,width:g.width*_.width/x.width};c=b.width/this.transformToolStore.localOutputImageSize.width}const u=Math.abs(l.x);const m=c/(u/this.transformToolStore.defaultScale);const p={x:m,y:m};const h=-(r-o);a.setTransform({scale:p,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(t){this.transforms=t}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const t=this.engineMediator.preview.container;const{outputContainer:e}=this.editor;const r=JSON.parse(this.transforms.preview);e.setResolution(lt(this.transformToolStore.defaultImageSize));t.setTransform(r);e.setTransform(JSON.parse(this.transforms.output));const o=r.scale;e.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(r);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(t,e=true){const{width:r,height:o}=this.editor.engineMediator.image.container.getBounds();const n=LA(t)?{width:o,height:r}:{width:r,height:o};this.editor.outputContainer.rotate(t,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:s}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(s);Ge(()=>{this.editor.scale.setInitialTransform();const a=this.getScaleWithFlip(s);this.engineMediator.preview.container.setScale(a);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(e){this.editor.render()}}applyPreviewTransform(){const{rotation:t,flipHorizontally:e,flipVertically:r}=this.transformToolStore.rotateFlipState;const o=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let s=t;if(e){s=mm(s)}if(r){s=mm(s)}const a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a)}getScaleWithFlip(t=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:e,flipVertically:r}=this.transformToolStore.rotateFlipState;const o=e?-1:1;const n=r?-1:1;const s=this.editor.scale.calculateScale(t);return{x:s*o,y:s*n}}saveTransforms(){const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:t,output:e}}saveTransformsBasedOnFlip(){const t=this.engineMediator.preview.container.getTransform();const{scale:e}=t;const{flipVertically:r,flipHorizontally:o}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...t,scale:{x:o?-e.x:e.x,y:r?-e.y:e.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}}});var Jk;var XH=d(()=>{z();Jk=class{constructor(t){this.store=t;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,qe.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}}});var qH,du,Q;var Zk=d(()=>{wt();R();z();qk();Ji();Un();$H();KH();XH();qH="identity";du=class{constructor(t){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=Z.box(false);this.minCropSize=0;this.transformHistory=new Jk(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=t=>{if(!t.trim())return false;let e=this.editor.configStore.config.assetBaseUrl;const{length:r}=e;if(e[r-1]!=="/"){e+="/"}if(`${e}transform`===t){return false}const o=new Image;try{o.src=t;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const t=this.editor.outputContainer.getRotation();if(t!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=t=>{this.localOutputSize.height=Math.round(t.height);this.localOutputSize.width=Math.round(t.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(t.width),height:Math.round(t.height)})};this.changeDefaultScale=t=>{this.defaults.scale=t};this.changeLocalOutputHeight=t=>{this.localOutputSize.height=Math.round(t)};this.changeLocalOutputWidth=t=>{this.localOutputSize.width=Math.round(t)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?uS:dS;this.rotateOutputContainer(e(t))};this.rotateAntiClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?dS:uS;this.rotateOutputContainer(e(t))};this.flipHorizontally=(t=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(t);if(t){this.trackChanges()}};this.flipVertically=(t=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(t);if(t){this.trackChanges()}};this.applyDefaultCrop=(t=false)=>{if(this.identifier==="identity"){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,t)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:t,y:e})=>{const r=this.getRatio();const o=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,t),o.x-n.width);const l=Math.min(Math.max(0,e),o.y-n.height);const c=o.x-a;const u=o.y-l;const m={width:Math.max(this.minCropSize,Math.min(c,s.width-a)),height:Math.max(this.minCropSize,Math.min(u,s.height-l))};if(r==="*"){if(this.changePosition({x:a,y:l})){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);const h=new F(o).subtract({x:p.width,y:p.height});if(this.changePosition(h)){this.changeCropAndOutputSize(p,r)}}};this.onLeftBottom=({x:t,y:e})=>{const r=this.getRatio();const o=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,t),o.x-n.width);const l=Math.max(0,e,o.y+n.height);const c=o.x-a;const u=l-o.y;const m={width:Math.max(1,Math.min(c,s.width-a)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){if(this.changePositionX(a)){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);if(this.changePositionX(o.x-p.width)){this.changeCropAndOutputSize(p,r)}}};this.onRightTop=({x:t,y:e})=>{const r=this.getRatio();const o=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,t,o.x+n.width);const l=Math.min(Math.max(0,e),o.y-n.height);const c=a-o.x;const u=o.y-l;const m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-l))};if(r==="*"){if(this.changePositionY(l)){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);if(this.changePositionY(o.y-p.height)){this.changeCropAndOutputSize(p,r)}}};this.onRightBottom=({x:t,y:e})=>{const r=this.getRatio();const o=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,t,o.x+n.width);const l=Math.max(0,e,o.y+n.height);const c=a-o.x;const u=l-o.y;const m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){this.changeCropAndOutputSize(m)}else{const p=this.proportionalSize(r,m);this.changeCropAndOutputSize(p,r)}};this.onPixelWidth=t=>{const e=JSON.stringify(lt(this.localOutputSize));const r=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(r&&r.ratio){let n=t;let s=this.localOutputSize.height;let{ratio:a}=r;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(t,o.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(s)})}else{const l=du.placeCropMask(a,o);n=Math.max(Math.min(n,l.width),this.minCropSize);s=n/a;this.changeLocalOutputSize({height:s,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.onPixelHeight=t=>{const e=JSON.stringify(lt(this.localOutputSize));const r=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(r&&r.ratio){let n=t;let s=this.localOutputSize.width;let{ratio:a}=r;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(t,o.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(n)})}else{const l=du.placeCropMask(a,o);n=Math.max(Math.min(n,l.height),this.minCropSize);s=n*a;this.changeLocalOutputSize({height:n,width:s})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=t=>{this.transformations.setFrameOpacity(t)};this.setOverlayOpacity=t=>{this.transformations.setOverlayOpacity(t)};this.closestRatioReducer=t=>(e,r)=>{if(r===null)return-1;return Math.abs(t-e.ratio)(e,r)=>{if(r===null)return-1;const o=Math.abs(e.dimensions.x/e.dimensions.y);const n=Math.abs(r.dimensions.x/r.dimensions.y);if(o===n){return e.dimensions.x*e.dimensions.y>r.dimensions.x*r.dimensions.y?-1:1}return Math.abs(t-o){const t=this.entityManager.items.findIndex(l=>l.identifier==="imgly_transform_common_custom");if(t!==-1)return this.entityManager.items[t];const e=this.entityManager.items.findIndex(l=>l.ratio==="*");if(e!==-1)return this.entityManager.items[e];const r=lt(this.editor.outputContainer.getResolution());const o=Math.abs(r.width/r.height);const[n]=this.entityManager.items.filter(l=>l.ratio&&typeof l.ratio==="number").sort(this.closestRatioReducer(o));const[s]=this.entityManager.items.filter(l=>l.dimensions&&!l.ratio).sort(this.closestDimensionsReducer(o));if(!n||!s||!n.ratio&&!s.dimensions){return this.entityManager.items[0]}if(!s||!s.dimensions)return n;if(!n||!n.ratio)return s;const a=Math.abs(s.dimensions.x/s.dimensions.y);if(a===n.ratio)return n;return Math.abs(o-n.ratio){let e=this.entityManager.items.find(r=>r.identifier===t);if(!e){e=this.getMatchingItem()}return e};this.editor=t;this.selectedCategory=qH;this.transformStore=new Et(t,this.defaults);this.transformations=new Yk(t);const{enableRotation:e,enableFlip:r,...o}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new Ue(n,{...o,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new Le(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new Le(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(t){return t*Math.PI/180}static placeCropMask(t,e){if(e.height*t>e.width){const o=e.width/t;return{height:o,width:e.width,yChanged:true}}const r=e.height*t;return{height:e.height,width:r,yChanged:false}}changeIdentifier(t,e=false){this.transformStore.changeIdentifier(t);const r=this.getCropMask(t,this.defaults.imageSize);if(r){this.transformStore.changeRatio(r.ratio);this.changeLocalOutputSize(r);this.updatePreviewSizeWRTImageSize();if(r.yChanged!==void 0){this.updateInitialCropMaskPosition(r.yChanged)}if(r.dimensions){this.changeLocalOutputSize({width:r.dimensions.x,height:r.dimensions.y})}if(e){this.trackChanges()}}}setDragMode(t){this.dragMode.set(t)}getCropMask(t,e){const r=this.getTransform(t);if(r){const{ratio:o,forceDimensions:n,lockDimensions:s,dimensions:a=null}=r;if(n){this.transformStore.changeForceDimensions(n)}if(s){this.transformStore.changeLockResolution(s)}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return{...e,yChanged:void 0,ratio:"*",dimensions:a};default:return{...du.placeCropMask(r.ratio,e),ratio:r.ratio,dimensions:a}}}else{const{x:l,y:c}=r.dimensions;return{...du.placeCropMask(l/c,e),ratio:null,dimensions:a}}}return null}setCropDefaults(t=false){const e=this.editor.outputContainer.getResolution();this.setDefaultImageSize(e);const r=this.editor.getPreviewSize();const{position:o}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(r);this.setDefaultCropPosition({x:o.x-r.width/2,y:o.y-r.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!t){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(t){this.defaults.imageSize={...lt(t)};if(!this.lockResolution){this.localOutputSize={...lt(t)}}}setMaxCropSize(t){this.defaults.maxCropMaskSize.height=t.height;this.defaults.maxCropMaskSize.width=t.width}setDefaultCropPosition(t){this.defaults.cropMaskPosition.x=t.x;this.defaults.cropMaskPosition.y=t.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(t){this.selectedCategory=this.selectedCategory===t?qH:t}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:t,output:e})}changePosition(t){return this.transformStore.changePosition(t,this.defaults.maxCropMaskSize)}changePositionX(t){return this.transformStore.changePositionX(t,this.defaults.maxCropMaskSize.width)}changePositionY(t){return this.transformStore.changePositionY(t,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:t,height:e},r,o=true){this.transformStore.changeWidth(t);this.transformStore.changeHeight(e);if(!this.lockResolution){const{height:n,width:s}=this.defaults.maxCropMaskSize;const{height:a,width:l}=this.defaults.imageSize;let c=a/n*e;const u=l/s*t;if(r){c=u/r}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(u),height:Math.round(c)})}if(e>=this.minCropSize){this.changeLocalOutputHeight(c)}if(t>=this.minCropSize){this.changeLocalOutputWidth(u)}}}transformRender(t=true){this.transformations.applyPreviewTransform();if(t){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:t,flipVertically:e}=this.rotateFlipState;const{identifier:r,rotationInDegrees:o}=this;const n=Wl(o);const s=cS(_b(this.editor.engineMediator.output.container.getRotation())+o);const{start:a,end:l}=this.convertUIToOperationOptions(n,s);return{flipHorizontally:t,flipVertically:e,rotation:n,start:a,end:l,identifier:r,outputRotation:s}}getStartEndForOperation(t){const{leftTop:e,rightBottom:r,maxCropMaskSize:o}=this;const n=e.y;const s=e.x;const a=r.x;const l=r.y;switch(t){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}getStartEndForUI(t,e,r){const{maxCropMaskSize:o}=this;const n=e.y;const s=e.x;const a=r.x;const l=r.y;switch(t){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}convertOperationOptionsToUI({start:t,end:e,rotation:r,outputRotation:o}){const n=o===90||o===270;const s=n?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const a=Math.cos(r);const l=Math.sin(r);const c=this.calculateScale(r);const u=new F(Math.min(t.x,e.x),Math.min(t.y,e.y));const m=new F(Math.max(t.x,e.x),Math.max(t.y,e.y));const p=m.subtract(u).divide(2);const h=u.add(p).multiply(s);const g=h.subtract(s.multiply(.5));const _=new F(g.x*a-g.y*l,g.x*l+g.y*a).multiply(c);const x=s.multiply(.5).add(_);const b=x.divide(s);const w=b.subtract(p.multiply(c));const T=b.add(p.multiply(c));const D=n?F.fromSize(this.maxCropMaskSize).swapped:F.fromSize(this.maxCropMaskSize);const O=w.multiply(D);const k=T.multiply(D);const{leftTop:E,rightBottom:J}=this.getStartEndForUI(o,O,k);return{start:new F(E),end:new F(J)}}convertUIToOperationOptions(t,e){const r=e===90||e===270;const o=r?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const n=r?F.fromSize(this.maxCropMaskSize).swapped:F.fromSize(this.maxCropMaskSize);const s=Math.cos(-t);const a=Math.sin(-t);const l=this.calculateScale(t,r);const{leftTop:c,rightBottom:u}=this.getStartEndForOperation(e);const m=new F(c).divide(n);const p=new F(u).divide(n);const h=p.subtract(m).divide(2);const g=m.add(h).multiply(o);const _=g.subtract(o.multiply(.5));const x=new F(_.x*s-_.y*a,_.x*a+_.y*s).divide(l);const b=o.multiply(.5).add(x);const w=b.divide(o);const T=w.subtract(h.divide(l));const D=w.add(h.divide(l));return{start:T,end:D}}calculateScale(t,e=false){const r=e?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const o=new F(Math.abs(r.x*Math.cos(t))+Math.abs(r.y*Math.sin(t)),Math.abs(r.x*Math.sin(t))+Math.abs(r.y*Math.cos(t)));const n=r.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/r.y+1:n.x*2/r.x+1}updateStateFromSerialization(t){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=Math.round(_b(t.rotation));this.transformStore.setRotation(e>180?e-360:e);this.transformations.rotateOutputContainer(Wl(cS(t.outputRotation||0)));if(t.identifier){this.transformStore.changeIdentifier(t.identifier)}if(t.start&&t.end){if(t.end.x===0||t.end.y===0){t.end.x=1;t.end.y=1}const{start:r,end:o}=this.convertOperationOptionsToUI({start:new F(t.start),end:new F(t.end),rotation:t.rotation,outputRotation:t.outputRotation});this.changePositionX(r.x);this.changePositionY(r.y);const n=o.x-r.x;const s=o.y-r.y;this.transformStore.changeSize({width:n,height:s});const{maxCropMaskSize:a,imageSize:l}=this.defaults;const c={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(c)}if(t.flipHorizontally){this.flipHorizontally(false)}if(t.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(t){this.defaultAngle=t}updateCanvasControls(t){const e=lt(this.cropMaskPosition);const r=lt(this.cropMaskSize);const o=lt(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*r.height/t.height,width:o.width*r.width/t.width},void 0,false);this.changePosition({y:o.height*e.y/t.height,x:o.width*e.x/t.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(t){this.transformStore.setRotation(t);this.transformRender()}async rotateOutputContainer(t,e=true){this.setDragMode(true);this.transformations.rotateOutputContainer(t,e);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,false)}clickableCanvas(t){this.editor.clickableCanvas(t)}proportionalSize(t,e,r=this.defaults.maxCropMaskSize,o=this.minCropSize){let n=e.height*t;let{height:s}=e;if(n>r.width||n1){return{width:this.minCropSize*t,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*t}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const t=this.getTransform(this.identifier);if(t){if(Object.prototype.hasOwnProperty.call(t,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return t.ratio}const{x:e,y:r}=t.dimensions;return e/r}return"*"}};Q=du;f([Z],Q.prototype,"selectedCategory",2);f([Z],Q.prototype,"defaults",2);f([Z],Q.prototype,"localOutputSize",2);f([v],Q.prototype,"changeIdentifier",1);f([v],Q.prototype,"setDragMode",1);f([v],Q.prototype,"setCropDefaults",1);f([v],Q.prototype,"setDefaultImageSize",1);f([v],Q.prototype,"setMaxCropSize",1);f([v],Q.prototype,"setDefaultCropPosition",1);f([v],Q.prototype,"resetCrop",1);f([v],Q.prototype,"toggleCategorySelection",1);f([v],Q.prototype,"pureReset",1);f([v],Q.prototype,"reset",2);f([v],Q.prototype,"changePosition",1);f([v],Q.prototype,"changePositionX",1);f([v],Q.prototype,"changePositionY",1);f([v],Q.prototype,"changeCropAndOutputSize",1);f([v],Q.prototype,"onLeave",1);f([v],Q.prototype,"onEnter",1);f([v],Q.prototype,"changeLocalOutputSize",2);f([v],Q.prototype,"changeDefaultScale",2);f([v],Q.prototype,"changeLocalOutputHeight",2);f([v],Q.prototype,"changeLocalOutputWidth",2);f([v],Q.prototype,"changeLockResolution",2);f([v],Q.prototype,"setRotation",1);f([v],Q.prototype,"rotateClockwise",2);f([v],Q.prototype,"rotateAntiClockwise",2);f([v],Q.prototype,"rotateOutputContainer",1);f([v],Q.prototype,"flipHorizontally",2);f([v],Q.prototype,"flipVertically",2);f([v],Q.prototype,"applyDefaultCrop",2);f([v],Q.prototype,"applyInitialCrop",1);f([v],Q.prototype,"updateCropMask",2);f([v],Q.prototype,"clickableCanvas",1);f([v],Q.prototype,"onLeftTop",2);f([v],Q.prototype,"onLeftBottom",2);f([v],Q.prototype,"onRightTop",2);f([v],Q.prototype,"onRightBottom",2);f([v],Q.prototype,"proportionalSize",1);f([v],Q.prototype,"onPixelWidth",2);f([v],Q.prototype,"onPixelHeight",2);f([v],Q.prototype,"updateInitialCropMaskPosition",1);f([v],Q.prototype,"updatePreviewSizeWRTImageSize",1);f([v],Q.prototype,"dispose",2);f([C],Q.prototype,"cropState",1);f([C],Q.prototype,"identifier",1);f([C],Q.prototype,"ratio",1);f([C],Q.prototype,"height",1);f([C],Q.prototype,"width",1);f([C],Q.prototype,"localOutputImageSize",1);f([C],Q.prototype,"localOutputHeight",1);f([C],Q.prototype,"localOutputWidth",1);f([C],Q.prototype,"lockResolution",1);f([C],Q.prototype,"forceDimensions",1);f([C],Q.prototype,"rotationInDegrees",1);f([C],Q.prototype,"outputRotation",1);f([C],Q.prototype,"isDragMode",1);f([C],Q.prototype,"rotateFlipState",1);f([C],Q.prototype,"selectedCategoryIdentifier",1);f([C],Q.prototype,"categories",1);f([C],Q.prototype,"items",1);f([C],Q.prototype,"config",1);f([C],Q.prototype,"locale",1);f([C],Q.prototype,"isOptionSelected",1);f([C],Q.prototype,"leftTop",1);f([C],Q.prototype,"leftBottom",1);f([C],Q.prototype,"rightTop",1);f([C],Q.prototype,"rightBottom",1);f([C],Q.prototype,"isFlippedHorizontal",1);f([C],Q.prototype,"isFlippedVertical",1);f([C],Q.prototype,"leftTopRespectFlip",1);f([C],Q.prototype,"leftBottomRespectFlip",1);f([C],Q.prototype,"rightTopRespectFlip",1);f([C],Q.prototype,"rightBottomRespectFlip",1);f([C],Q.prototype,"cropMaskPosition",1);f([C],Q.prototype,"cropMaskSize",1);f([C],Q.prototype,"state",1);f([C],Q.prototype,"defaultImageSize",1);f([C],Q.prototype,"maxCropMaskSize",1);f([C],Q.prototype,"minCropMaskSize",1);f([C],Q.prototype,"defaultCropMaskPosition",1);f([C],Q.prototype,"defaultScale",1)});var YH=d(()=>{Ik();Zk()});var JH,ict,Qk,rct,tf,ot;var tI=d(()=>{wt();JH=y(Yu());R();z();Ji();Xk();pm();hk();gk();_k();Sk();ict={};Qk="none";rct={position:{x:0,y:0},rotation:0};tf=class{constructor(t){this.state=Z.map(ict);this.selectedId=Z.box(Qk);this.editMode=Z.box(false);this.dragMode=Z.box(false);this.minLength=0;this.counter=0;this.addSticker=async(t,e=true)=>{await this.addStickerAsync(t,e)};this.addStickerAsync=async({spriteId:t,state:e,transform:r},o=true)=>{return new Promise((n,s)=>{r=this.getInitialTransform(r);const{identifier:a}=e;const l=this.editor.orderHelper.addSprite(a);this.editor.engine.addStickerFromAssets(a,this.editor.engineMediator.image.container,l).then(async c=>{if(t){c.setData({id:t})}const u=c.getID();this.container[u]=c;this.editor.orderHelper.renameSprite(a,u);const m=this.getSize(u);m.width*=c.getScale().x;m.height*=c.getScale().y;c.setPivot(.5,.5);let p;if(r.scale){p=r.scale}else if(r.size){p={x:r.size.width/m.width,y:r.size.height/m.height}}else{const x=this.editor.shortestOutputSide*.4;const b=tf.magnitude(x)/tf.sizeMagnitude(c.getSizeInWorldSpace());p={x:b,y:b}}const{flipHorizontally:h,flipVertically:g}=this.editor.outputContainer.getData();c.setFlipHorizontally(h);c.setFlipVertically(g);c.setTransform({position:r.position,scale:p,rotation:r.rotation});if(e.flipHorizontally!==void 0){c.setFlipHorizontally(e.flipHorizontally!==h)}if(e.flipVertically!==void 0){c.setFlipVertically(e.flipVertically!==g)}this.setContainerProperties(u,{...e});const _=c.getData();this.setInitialSpriteState(u,"sticker");this.stickerToolStore.setState(u,{..._,identifier:a});await this.editor.renderPromise();if(o){this.setId(u);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(c=>{console.error(c);s()})})};this.addText=async(t,e=true)=>{await this.addTextAsync(t,e)};this.addTextAsync=({spriteId:t,state:e,transform:r},o=true)=>{return new Promise((n,s)=>{r=this.getInitialTransform(r);const a=this.editor.orderHelper.addSprite(e.identifier);const l=this.editor.shortestOutputSide;const c={fontIdentifier:e.identifier,text:e.text,width:e.width||l*.6,fontSize:e.fontSize||l*.1,lineHeight:e.lineHeight,alignment:e.alignment,textColor:e.textColor,backgroundColor:e.backgroundColor};this.editor.engine.addTextWithFontLoading(c,this.editor.engineMediator.image.container,a).then(async u=>{if(t){u.setData({id:t})}const m=u.getID();this.container[m]=u;this.editor.orderHelper.renameSprite(e.identifier,m);const{flipHorizontally:p,flipVertically:h}=this.editor.outputContainer.getData();u.setFlipHorizontally(p);u.setFlipVertically(h);u.setPivot(.5,.5);u.setPosition(r.position);u.setRotation(r.rotation);this.setInitialSpriteState(m,"text");const g=u.getData();this.textToolStore.setState(m,{...g});await this.editor.renderPromise();if(o){this.setId(m);this.addSnapshot("add",this.textLocale.add)}n()}).catch(u=>{console.error(u);s()})})};this.addTextDesign=async(t,e=true,r=false)=>{try{await this.addTextDesignAsync(t,e,r)}catch(o){console.warn(o)}};this.addTextDesignAsync=({spriteId:t,state:e,transform:r},o=true,n=false)=>{return new Promise((s,a)=>{r=this.getInitialTransform(r);const l=this.editor.orderHelper.addSprite(e.identifier);const c=this.editor.shortestOutputSide;const u={width:e.width||c*.6,text:e.text,color:e.color,inverted:e.isInverted,seed:e.seed,padding:e.padding};this.editor.engine.addTextDesignAsync(e.identifier,u,this.editor.engineMediator.image.container,l).then(async m=>{if(t){if(n){this.pureRemoveSprite(t);this.textDesignToolStore.state.delete(t)}m.setData({id:t})}const p=m.getID();this.container[p]=m;this.editor.orderHelper.renameSprite(e.identifier,p);const{flipHorizontally:h,flipVertically:g}=this.editor.outputContainer.getData();m.setFlipHorizontally(h);m.setFlipVertically(g);m.setPivot(.5,.5);m.setPosition(r.position);m.setRotation(r.rotation);this.setInitialSpriteState(p,"textdesign");const _=m.getData();this.textDesignToolStore.setState(p,{..._,identifier:e.identifier});await this.editor.renderPromise();if(o){this.setId(p);this.addSnapshot("add",this.textDesignLocale.add)}s()}).catch(m=>{a(m)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=t=>{this.editor.clickableCanvas(t)};this.setContainerProperties=(t,e,r=false)=>{this.container[t].setData(e);if(r){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(t,e)=>{this.container[t].setPosition(e)};this.pureRemoveSprite=t=>{this.editor.engine.removeContainer(this.container[t]);const e=this.container[t].getIndexInParent();if(e===-1){delete this.container[t];this.state.delete(t);this.editor.orderHelper.removeSprite(t);return true}return false};this.deleteSprite=(t=this.id)=>{const e=this.state.get(t);if(e.tool==="sticker"){this.stickerToolStore.delete()}else if(e.tool==="text"){this.textToolStore.delete()}else if(e.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=t=>{const e=this.pureRemoveSprite(t);if(e){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(t,e)=>{this.editor.addSnapshot(void 0,t,e)};this.spriteSnapshot=t=>{this.addSnapshot("edit",this.historyLocale[t])};this.addNewText=async(t,e)=>{if(this.textToolStore.doesTextAssetExist(e.identifier)){await this.addTextAsync({...t,state:e},false)}else{throw new Io(e.identifier)}};this.addNewTextDesign=async(t,e)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(e.identifier)){await this.addTextDesignAsync({...t,state:e},false)}else{throw new Io(e.identifier)}};this.addNewSticker=async(t,e)=>{if(this.stickerToolStore.doesStickerAssetExist(e.identifier)){await this.addStickerAsync({...t,state:e},false)}else{throw new Io(e.identifier)}};this.getSpriteHistoryState=()=>{const t=lt(this.textToolStore.state);const e=lt(this.textDesignToolStore.state);const r={common:lt(this.state),["sticker"]:lt(this.stickerToolStore.state),["text"]:t,["textdesign"]:e,spriteIdList:Object.keys(this.container)};Object.keys(r.common).forEach(o=>{r.common[o].size=this.container[o].getSizeInWorldSpace();r.common[o].position=this.container[o].getPosition();r.common[o].order=this.container[o].getIndexInParent()});return r};this.updateStateFromSerialization=async(t,e,r)=>{if(e&&e.length){try{const o=await Promise.all(e.map(async({svg:n,raster:s,name:a,identifier:l})=>{const c=(n==null?void 0:n.data)?"image/svg+xml":s.type;const u=`data:${c};base64,${(n==null?void 0:n.data)||s.data}`;const m=await nv(u,150);return{stickerURI:u,thumbnailURI:m,name:a,type:c,identifier:l}}));await this.stickerToolStore.addCustomStickerAsset(o)}catch(o){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(t.text){await this.textToolStore.loadFonts()}if(t.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(t.spriteIdList,t,r)};this.updateStateFromHistory=async t=>{const e=Object.keys(this.container);const r=e.filter(o=>t.spriteIdList.indexOf(o)===-1);r.forEach(o=>{this.pureRemoveSprite(o)});await this.updateStateByHistoryState(t.spriteIdList,t,0)};this.serializableState=async()=>{const t=this.editor.spriteStore.getSpriteHistoryState();Object.keys(t.common).forEach(r=>{const{flipHorizontally:o,flipVertically:n}=this.editor.outputContainer.getData();const s=this.editor.outputContainer.getRotation();const a=n!==o?-t.common[r].rotation:t.common[r].rotation;t.common[r].rotation=n!==o?a+s:a-s});const e=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:r,type:o,stickerURI:n,name:s})=>{const a={identifier:r,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]}}if(o==="image/jpeg"||o==="image/png"||o==="image/gif"){[,a.raster.data]=n.split(",");a.raster.type=o}else{const l=await nv(n);[,a.raster.data]=l.split(",");a.raster.type="image/png"}return a}));return{sprite:t,customStickers:e}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(t=>{this.updatePositionAndSize(t,true);const e=this.state.get(t);if(e){if(e.tool==="text"){const r=this.getContainerProperties(t);this.textToolStore.changeSize(t,r)}else if(e.tool==="textdesign"){const r=this.getContainerProperties(t);this.textToolStore.changeWidth(r.width)}}})};this.setEditMode=t=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(t){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(t)}}};this.setDragMode=t=>{this.dragMode.set(t)};this.setPosition=t=>{const e=this.currentSprite;const r=this.container[this.id];if(e&&r){r.setPosition(this.editor.previewToWorld(t));const{position:o}=this.getSizePositionFromContainer();e.position.x=o.x;e.position.y=o.y;this.state.set(this.id,e);this.editor.render()}};this.setSize=t=>{const e=this.currentSprite;if(e){e.size.width=t.width;e.size.height=t.height;this.state.set(this.id,e)}};this.setRotation=t=>{const e=this.currentSprite;if(e){const{flipHorizontally:r,flipVertically:o}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const s=jh({rotation:t,outputRotation:n,flipHorizontally:r,flipVertically:o});this.container[this.id].setRotation(s);e.rotation=this.container[this.id].getRotation();this.state.set(this.id,e);this.editor.render()}};this.onCanvasClick=t=>{if(!this.isEditMode){this.selectHighestOrderSprite(t)}};this.select=t=>{const e=this.state.get(t);if(e){const r=this.editor.activeStore.tool;if(r!==e.tool){this.editor.activeStore.selectTool(e.tool)}this.setId(t)}};this.selectLast=()=>{const t=this.editor.orderHelper.getLastSpriteId();if(t){this.select(t)}};this.selectNext=()=>{if(this.currentSprite){const t=this.container[this.id];const e=t.getIndexInParent();if(e){const r=Object.keys(this.container).find(o=>this.container[o].getIndexInParent()===e-1);if(r){this.select(r)}}}};this.deselect=()=>{this.setId(Qk)};this.bringToFront=async t=>{const e=this.editor.orderHelper.bringToFront(t);this.container[t].setIndexInParent(e);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=t=>{const e=this.state.get(t);const r=this.container[t];r.setFlipHorizontally(!r.getFlipHorizontally());e.flipHorizontally=r.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(t,e);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(t=>{this.pureRemoveSprite(t)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=t=>{const e=this.editor.brushToolStore.containerId();t=t.filter(n=>n!==e);if(t.length<1){this.deselect();return}let r="";let o=0;t.forEach(n=>{const s=this.container[n];const a=s&&s.getIndexInParent()||0;if(a>=o){o=a;r=n}});this.select(r)};this.onCornerDrag=({x:t,y:e})=>{if(this.currentSprite){const r=new F(this.currentSprite.position);const o=new F(t,e);const n=o.subtract(r).magnitude;const s=this.getSize();const a=n*2/tf.sizeMagnitude(s);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:s.width*a,height:s.height*a})}else{const l=this.rotationWRTOutputRotation;const c=o.subtract(r);const u=Math.cos(l);const m=Math.sin(l);const p=Math.max(Math.abs(c.x*u*2+c.y*m*2),this.minLength);const h=Math.max(Math.abs(c.x*-m*2+c.y*u*2),this.minLength);this.setStickerSize({width:p,height:h})}}else if(this.isSpriteText){this.setTextSize(s.width*a)}else if(this.isSpriteTextDesign){this.setTextDesignScale(a)}}this.editor.render()}};this.onWidthDrag=({x:t,y:e})=>{const r=new F(this.currentSprite.position);const o=new F(t,e);const n=o.subtract(r).magnitude;const s=this.editor.previewToWorld(2*n);if(s>this.minLength){this.setContainerProperties(this.id,{width:s},true);if(this.isSpriteText){const a=this.getContainerProperties(this.id);this.textToolStore.changeWidth(a.width)}}};this.onPaddingDrag=({x:t,y:e})=>{if(this.isSpriteTextDesign){let r=this.getContainerProperties(this.id);const o=new F(this.currentSprite.position);const n=new F(t,e);const s=n.subtract(o).magnitude;const a=Math.max(this.editor.previewToWorld(s)-r.width/2,0);this.setContainerProperties(this.id,{padding:a},true);if(this.isSpriteTextDesign){r=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(r.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();Object.values(this.container).forEach(r=>{if(r.type==="text"||r.type==="text-design"){r.setFlipHorizontally(t);r.setFlipVertically(e)}})};this.reverseTextHorizontally=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipHorizontally(t)}})};this.reverseTextVertically=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipVertically(t)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=t=>{return this.container[t].getData()};this.getContainerTransform=t=>{return this.container[t].getTransform()};this.getDuplicateContainerTransform=t=>{const e=this.container[t].getTransform();const r=this.editor.shortestOutputSide*.1;const o=new F(e.position).add(new F(r,r));return{...e,position:o}};this.getDuplicateContainerFlip=t=>{const e=this.container[t].getFlipHorizontally();const r=this.container[t].getFlipVertically();return{flipHorizontally:e,flipVertically:r}};this.updatePositionAndSize=(t=this.id,e=false)=>{const{position:r,size:o}=this.getSizePositionFromContainer(t);const n=this.state.get(t);if(n){n.position.x=r.x;n.position.y=r.y;n.size.width=o.width;n.size.height=o.height;if(e){const s=this.container[t].getRotation();this.container[t].setRotation(s);n.rotation=this.container[t].getRotation()}this.state.set(t,n)}};this.getInitialTransform=t=>{const e=this.editor.outputToWorld(rct.position);if(!t){const r=this.editor.outputContainer.getRotation();return{rotation:r,position:e}}return{position:e,...t}};this.setInitialSpriteState=(t,e)=>{const r=this.container[t];const{position:o,size:n}=this.getSizePositionFromContainer(t);const s=r.getRotation();const a=e!=="sticker"?false:r.getFlipHorizontally();const l=e!=="sticker"?false:r.getFlipVertically();this.state.set(t,{tool:e,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l})};this.setStickerSize=t=>{const e=this.container[this.id];e.setSizeInWorldSpace(this.editor.previewSizeToWorld(t));const r=this.currentSprite;if(r){r.size=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());this.state.set(this.id,r)}};this.setTextSize=t=>{let e=this.getContainerProperties(this.id);const r={width:this.editor.previewToWorld(t)};const o=r.width/e.width;const n={fontSize:Math.round(e.fontSize*o)};const s=this.isSpriteText?{...r,...n}:r;if(r.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,s,true);e=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(e.fontSize,true);this.textToolStore.changeWidth(e.width)}};this.setTextDesignScale=t=>{let e=this.getContainerProperties(this.id);const r=e.width*t;if(r>this.minLength){this.setContainerProperties(this.id,{width:r},true);const{width:o}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(o);e=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(e.padding)}};this.getSizePositionFromContainer=(t=this.id)=>{const e=this.container[t];if(e){const r=this.editor.worldToPreview(e.getPosition());const o=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());return{position:r,size:o}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(t=this.id)=>{const e=this.container[t];if(e){return this.editor.worldSizeToPreview(e.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=t;this.container={};this.stickerToolStore=new Bt(t);this.textToolStore=new ft(t);this.textDesignToolStore=new Pt(t);this.rect=new Le(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(t,e){return new F(t,e||t).magnitude}static sizeMagnitude(t){return Math.sqrt(t.width*t.width+t.height*t.height)}async updateStateByHistoryState(t,e,r){await(0,JH.default)(t,async o=>{const n=e.common[o];if(!n)return;if(this.state.get(o)){this.updateExistingItem(o,e)}else{await this.addNewItem(o,e)}});t.forEach(o=>{const n=e.common[o];const s=this.container[o];if(!n||!s)return;s.setIndexInParent(n.order+r)});this.counter+=1}async addNewItem(t,e){const r=e.common[t];const o=r.size?{width:this.editor.worldToPreview(r.size.width),height:this.editor.worldToPreview(r.size.height)}:void 0;const{flipHorizontally:n,flipVertically:s}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=s!==n?r.rotation-a:r.rotation+a;const c=s!==n?-l:l;const u={spriteId:t,transform:{size:o,position:new F(r.position),rotation:c}};if(e.text[t]){const m=e.text[t];const p=this.textToolStore.validFontWithConfig(m.identifier);m.identifier=p==null?void 0:p.identifier;await this.addNewText(u,m);return}if(e.textdesign[t]){await this.addNewTextDesign(u,e.textdesign[t]);return}if(e.sticker[t]){const m=this.stickerToolStore.items.find(p=>p.identifier===e.sticker[t].identifier);await this.addNewSticker(u,{...e.sticker[t],flipHorizontally:r.flipHorizontally,flipVertically:r.flipVertically,resizeMode:e.sticker[t].resizeMode||(m==null?void 0:m.resizeMode)||"keepAspect"})}}updateExistingItem(t,e){const r=e.common[t];const o=this.state.get(t);this.state.set(t,o);const n=this.container[t];n.setPosition(new F(r.position));n.setRotation(r.rotation);o.rotation=n.getRotation();if(r.flipHorizontally!==void 0){n.setFlipHorizontally(r.flipHorizontally)}if(r.flipVertically!==void 0){n.setFlipVertically(r.flipVertically)}if(e.text[t]){const s=e.text[t];this.textToolStore.updateStateFromHistory(t,{...s,fontIdentifier:s.identifier})}if(e.textdesign[t]){const s=e.textdesign[t];this.textDesignToolStore.updateStateFromHistory(t,{...s,inverted:s.isInverted})}if(e.sticker[t]){n.setSizeInWorldSpace(r.size);this.stickerToolStore.updateStateFromHistory(t,e.sticker[t])}this.updatePositionAndSize(t)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==Qk}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();const r=this.editor.outputContainer.getRotation();return jh({rotation:this.currentSprite.rotation-r,flipHorizontally:t,flipVertically:e})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const t=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:t,y:e}=this.currentSprite.position;const{height:r,width:o}=this.currentSprite.size;return{x:Math.round(t-o/2),y:Math.round(e-r/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:t}=this.rect;return{x:t.x-this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:t}=this.rect;return{x:t.x+this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(t){this.selectedId.set(t)}};ot=tf;f([Z],ot.prototype,"counter",2);f([v],ot.prototype,"addSticker",2);f([v],ot.prototype,"addStickerAsync",2);f([v],ot.prototype,"addText",2);f([v],ot.prototype,"addTextAsync",2);f([v],ot.prototype,"addTextDesign",2);f([v],ot.prototype,"addTextDesignAsync",2);f([v],ot.prototype,"clickableCanvas",2);f([v],ot.prototype,"setContainerProperties",2);f([v],ot.prototype,"setContainerPosition",2);f([v],ot.prototype,"pureRemoveSprite",2);f([v],ot.prototype,"deleteSprite",2);f([v],ot.prototype,"removeSprite",2);f([v],ot.prototype,"addSnapshot",2);f([v],ot.prototype,"addNewText",2);f([v],ot.prototype,"addNewTextDesign",2);f([v],ot.prototype,"addNewSticker",2);f([v],ot.prototype,"updateStateFromSerialization",2);f([v],ot.prototype,"updateStateFromHistory",2);f([v],ot.prototype,"updateCanvasControls",2);f([v],ot.prototype,"setEditMode",2);f([v],ot.prototype,"setDragMode",2);f([v],ot.prototype,"setPosition",2);f([v],ot.prototype,"setSize",2);f([v],ot.prototype,"setRotation",2);f([v],ot.prototype,"onCanvasClick",2);f([v],ot.prototype,"select",2);f([v],ot.prototype,"selectLast",2);f([v],ot.prototype,"selectNext",2);f([v],ot.prototype,"deselect",2);f([v],ot.prototype,"bringToFront",2);f([v],ot.prototype,"flipHorizontally",2);f([v],ot.prototype,"pureReset",2);f([v],ot.prototype,"onCornerDrag",2);f([v],ot.prototype,"onWidthDrag",2);f([v],ot.prototype,"onPaddingDrag",2);f([v],ot.prototype,"correctTextFlip",2);f([v],ot.prototype,"reverseTextHorizontally",2);f([v],ot.prototype,"reverseTextVertically",2);f([v],ot.prototype,"dispose",2);f([C],ot.prototype,"currentSprite",1);f([C],ot.prototype,"padding",1);f([C],ot.prototype,"isEditMode",1);f([C],ot.prototype,"isDragMode",1);f([C],ot.prototype,"id",1);f([C],ot.prototype,"isSpriteSelected",1);f([C],ot.prototype,"position",1);f([C],ot.prototype,"tool",1);f([C],ot.prototype,"size",1);f([C],ot.prototype,"rotation",1);f([C],ot.prototype,"rotationWRTOutputRotation",1);f([C],ot.prototype,"flipHorizontal",1);f([C],ot.prototype,"isSpriteSticker",1);f([C],ot.prototype,"isSpriteText",1);f([C],ot.prototype,"isSpriteTextDesign",1);f([C],ot.prototype,"isOnTop",1);f([C],ot.prototype,"spritePosition",1);f([C],ot.prototype,"currentRect",1);f([C],ot.prototype,"leftTopPosition",1);f([C],ot.prototype,"leftBottomPosition",1);f([C],ot.prototype,"leftMidPosition",1);f([C],ot.prototype,"leftMidPadPosition",1);f([C],ot.prototype,"rightTopPosition",1);f([C],ot.prototype,"rightBottomPosition",1);f([C],ot.prototype,"rightMidPosition",1);f([C],ot.prototype,"rightMidPadPosition",1);f([C],ot.prototype,"leftBottomHandlePosition",1);f([C],ot.prototype,"rightBottomHandlePosition",1);f([C],ot.prototype,"historyLocale",1);f([C],ot.prototype,"stickerLocale",1);f([C],ot.prototype,"textLocale",1);f([C],ot.prototype,"textDesignLocale",1)});var ZH=d(()=>{tI()});var oct,hr;var eI=d(()=>{wt();R();oct={categories:[],query:""};hr=class{constructor(t){this.initProvider=t=>{if(t){this.libraryProvider=new t}};this.fetchImages=async(t="")=>{if(this.libraryProvider){let e=null;try{const r=await this.libraryProvider.getCategories();const o=await this.libraryProvider.searchImages(t);e=r.map((n,s)=>{const a=o.filter(l=>l.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(l=>({name:l.title||`image${s}`,identifier:`${n.name}-${l.title}-${s}`,thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar}))}}).filter(n=>n.items.length)}catch(r){console.log(r)}Ge(()=>{this.state.query=t;this.state.categories=e})}};this.toggleCategorySelection=t=>{this.selectedCategory=this.selectedCategory!==t?t:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=t=>{const e=this.items.findIndex(r=>r.identifier===t);if(e!==-1){return this.items[e].rawUrl}return t};this.configStore=t.configStore;this.state=Z(oct);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(t=>t.items).reduce((t,e)=>[...t,...e],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};f([Z],hr.prototype,"selectedCategory",2);f([v],hr.prototype,"initProvider",2);f([v],hr.prototype,"fetchImages",2);f([v],hr.prototype,"toggleCategorySelection",2);f([v],hr.prototype,"dispose",2);f([C],hr.prototype,"selectedCategoryIdentifier",1);f([C],hr.prototype,"categories",1);f([C],hr.prototype,"items",1);f([C],hr.prototype,"query",1);f([C],hr.prototype,"config",1);f([C],hr.prototype,"locale",1)});var QH=d(()=>{eI()});var tW,Ri;var eW=d(()=>{R();Ln();z();tW=(i="image/png")=>`data:${i};base64,`;Ri=class{constructor(t){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=t=>{const e=st.relativeToAbsolutePoint(t,this.cropSpace,false);return st.pointFromSpaceToSpace(e,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=t=>{return t*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=t=>{return t*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=t}static deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier}}static deserializeAdjustments(t){return{...t}}static deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,e=>e.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(t){if(t){if(t.rgba){return t.rgba}}return[0,0,0,0]}validateVersion(t){return this.version===t}static checkIfPlatformHTML(t){return t==="html5"}static deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:Ri.deserialzeColor(t.tintColor)}}checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(t){const e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(tW(),""):""};e.image.data=e.image.data?tW()+e.image.data:""}return e}deserializeTransformation(t){const e={};const r=t.operations.find(s=>s.type==="orientation");const o=t.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=Ri.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:""}return e}deserialize(t){var n,s;const e={};if(t.meta?!Ri.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform")}const r=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(a=>{switch(a.type){case"filter":e.filter=Ri.deserializeFilter(a.options);break;case"adjustments":e.adjustment=Ri.deserializeAdjustments(a.options);break;case"focus":e.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(c=>{switch(c.type){case"frame":e.frame=this.deserializeFrame(c.options);break;case"overlay":e.overlay=Ri.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=this.deserializeBrush(c.options)}else{e.brush.strokes.push(...this.deserializeBrush(c.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const u=Ot();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};this.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=Ri.deserializeStickers(c.options)}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=this.deserializeTexts(c.options)}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=this.deserializeTextDesign(c.options)}break;default:break}});break;default:break}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return e}deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:Ri.deserialzeColor(t.tintColor)}}deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:break}return void 0}deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new F(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeMirroredFocus(t){const e=new F(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new F(this.mapRelativeCropPointToImageSpace(t.start)).add(new F(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeTexts(t){return{identifier:pn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:Ri.deserialzeColor(t.color),backgroundColor:Ri.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text}}deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:Ri.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted}}deserializeBrush(t){return{strokes:t.paths.map(e=>{return{path:{controlPoints:e.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:Ri.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}}})}}}});var iW,Oi;var rW=d(()=>{R();Ln();z();iW=(i="image/png")=>`data:${i};base64,`;Oi=class{constructor(t){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=t=>{const e=st.relativeToAbsolutePoint(t,this.cropSpace,false);return st.pointFromSpaceToSpace(e,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=t=>{return t*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=t=>{return t*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=t}static deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier}}static deserializeAdjustments(t){return{...t}}static deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,e=>e.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(t){if(t){if(t.rgba){return t.rgba}}return[0,0,0,0]}validateVersion(t){return this.version===t}static checkIfPlatformHTML(t){return t==="html5"}static deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:Oi.deserialzeColor(t.tintColor)}}checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(t){const e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(iW(),""):""};e.image.data=e.image.data?iW()+e.image.data:""}return e}deserializeTransformation(t){const e={};const r=t.operations.find(s=>s.type==="orientation");const o=t.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=Oi.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:""}return e}deserialize(t){var n,s;const e={};if(t.meta?!Oi.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform")}const r=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(a=>{switch(a.type){case"filter":e.filter=Oi.deserializeFilter(a.options);break;case"adjustments":e.adjustment=Oi.deserializeAdjustments(a.options);break;case"focus":e.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(c=>{switch(c.type){case"frame":e.frame=this.deserializeFrame(c.options);break;case"overlay":e.overlay=Oi.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=this.deserializeBrush(c.options)}else{e.brush.strokes.push(...this.deserializeBrush(c.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const u=Ot();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};this.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=Oi.deserializeStickers(c.options)}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=this.deserializeTexts(c.options)}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=this.deserializeTextDesign(c.options)}break;default:break}});break;default:break}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return e}deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:Oi.deserialzeColor(t.tintColor)}}deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:return void 0}}deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new F(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeMirroredFocus(t){const e=new F(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new F(this.mapRelativeCropPointToImageSpace(t.start)).add(new F(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeTexts(t){return{identifier:pn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:Oi.deserialzeColor(t.color),backgroundColor:Oi.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text}}deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:Oi.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted}}deserializeBrush(t){return{strokes:t.paths.map(e=>{return{path:{controlPoints:e.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:Oi.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}}})}}}});var nct,sct,act,lct,cct,uct,dct,mct,pct,hct,fct,gct,bct,yct,_ct,nW;var oW=d(()=>{nct="@photoeditorsdk/root";sct="5.19.3";act="The most comprehensive photo editor SDK for HTML5";lct="http://github.com/imgly/pesdk-html5";cct="PhotoEditorSDK (img.ly GmbH) ";uct="SEE LICENSE IN LICENSE.md";dct=true;mct={};pct={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};hct={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};fct={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};gct={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};bct={eslint:"7.10.0"};yct=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];_ct={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};nW={name:nct,version:sct,description:act,repository:lct,author:cct,license:uct,private:dct,bin:mct,scripts:pct,devDependencies:hct,dependencies:fct,devEngines:gct,resolutions:bct,workspaces:yct,husky:_ct}});var mu;var sW=d(()=>{R();Ln();oW();mu=class{constructor(t,e,r,o,n,s){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=t=>{const e=st.pointFromSpaceToSpace(t,this.imageSpace,this.cropSpace,false);return st.absoluteToRelativePoint(e,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=t=>{return t/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=t=>{return t/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(t,e=0,r=3)=>{const o=Math.tan(e);const n=Math.sqrt(o**2+1);return{x:t.x+r/n,y:t.y+r*o/n}};this.previewPosition=t;this.previewSize=e;this.outputSize=r;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale()}static serializeFilters(t){return{type:"filter",options:{intensity:t.intensity,identifier:t.identifier}}}static serializeAdjustments(t){return{type:"adjustments",options:t}}static serializeOverlay(t){return{type:"overlay",options:{identifier:t.identifier,intensity:t.opacity,blendMode:t.blendMode.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:nW.version,createdAt:new Date().toISOString()}}serialise(t,e,r){const o=mu.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(e){n.type=r;n.data=e}const s=[];const a=[];const{adjustment:l}=t;if(Object.keys(l).map(_=>l[_]).filter(Boolean).length){s.push(mu.serializeAdjustments(l))}const{filter:c}=t;if(c.identifier!=="identity"){s.push(mu.serializeFilters(c))}const{overlay:u}=t;if(u.identifier!=="identity"){a.push(mu.serializeOverlay(u))}if(t.transform){const{transform:_,orientation:x}=this.serializeTransform(t.transform);const b=[_.options.start.x!==0,_.options.start.y!==0,_.options.end.x!==1,_.options.end.y!==1,_.options.rotation!==0];const w=[x.options.rotation!==0,x.options.flipVertically!==false,x.options.flipHorizontally!==false];if(b.some(T=>T)){s.push(_)}if(w.some(T=>T)){s.push(x)}}const{frame:m}=t;if(m.identifier!=="identity"){a.push(this.serialzeFrame(m))}const{focus:p}=t;if(p.identifier!=="identity"){s.push(this.serializeFocus(p))}if(t.sprite){t.sprite.spriteIdList.forEach(_=>{const x=t.sprite.common[_];switch(x.tool){case"sticker":const b=t.sprite.sticker[_];a.push(this.serializeSticker(b,x,t.transform));break;case"text":const w=t.sprite.text[_];a.push(this.serializeText(w,x));break;case"textdesign":const T=t.sprite.textdesign[_];a.push(this.serializeTextDesign(T,x));break;default:break}})}if(t.brush.strokes.length){a.push({type:"brush",options:{paths:t.brush.strokes.map(_=>{return{points:_.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:_.brush.color},size:_.brush.size,hardness:_.brush.hardness}}})}})}if(a.length){const _={type:"sprite",options:{sprites:a}};s.push(_)}const h=t.customStickers;const g={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:g}}serialzeFrame(t){return{type:"frame",options:{identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.color},size:this.mapSizeToRelativeUnscaledCropSize(t.width)}}}serializeFocus(t){const e=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(t.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(t.linear.start),end:this.mapImagePointToRelativeCropPoint(t.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(t.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(t.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(t.radial.center,0,t.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(t.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:r}=t;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,e/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,-e/2)),size:this.mapSizeToRelativeScaledCropSize(t.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(t.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(t.gaussian.blurRadius)}}}}}serializeSticker(t,e,r){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(e.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(e.size.width),y:this.mapSizeToRelativeScaledCropSize(e.size.height)},rotation:e.rotation,flipVertically:(e.flipVertically||false)!==(r.flipVertically||false),flipHorizontally:(e.flipHorizontally||false)!==(r.flipHorizontally||false),identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.tintColor},tintMode:t.tintMode}}}serializeText(t,e){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:t.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(t.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(t.width),text:t.text,lineHeight:t.lineHeight,color:{rgba:t.textColor},backgroundColor:{rgba:t.backgroundColor},alignment:t.alignment}}}serializeTextDesign(t,e){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,identifier:t.identifier,inverted:t.isInverted,text:t.text,seed:t.seed,width:this.mapSizeToRelativeScaledCropSize(t.width),padding:this.mapSizeToRelativeScaledCropSize(t.padding),color:{rgba:t.color}}}}serializeTransform(t){const{start:e,end:r}=t;const o={type:"transform",options:{start:e,end:r,rotation:t.rotation,meta:{identifier:t.identifier}}};const n={type:"orientation",options:{rotation:t.outputRotation,flipHorizontally:t.flipHorizontally,flipVertically:t.flipVertically}};return{transform:o,orientation:n}}}});var iI={};ue(iI,{Deserializers:()=>xct,Serializer:()=>mu});var xct;var rI=d(()=>{eW();rW();sW();xct={"3.9.0":Oi,"3.12.0":Ri}});var aW,vct,Cct,Sct,ef;var lW=d(()=>{wt();R();z();aW=/^data:image\/(.+?);base64,/;vct=i=>aW.test(i);Cct=i=>i.match(/^data:([^;]+)/)[1];Sct=i=>i.replace(aW,"");ef=class{constructor(t){this.applySerialization=async(t,e,r,o)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const s="Unexpected error occured";const a=e.deserializeImage(t);if(a.image&&a.image.data){const u=a.image.data;await this.editor.setImage(u);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(u);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const l=e.deserializeTransformation(t);if(!l){o(s);return}await this.applyStateOnUI(l);const c=e.deserialize(t);if(!c){o(s);return}await this.applyStateOnUI(c);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}r()};this.editor=t}serialize({image:t}={image:false}){const e=this.editor.activeStore.tool==="transform";const{displaySerializationModal:r}=this.editor.configStore.config;if(r){this.editor.modalStore.showInfoModal("saving")}return new Promise((o,n)=>{Promise.resolve().then(()=>(rI(),iI)).then(async({Serializer:s})=>{try{if(e){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:a}=this.editor.imageContainer.getData();const l=this.editor.engineMediator.output.container.getResolution();const c={width:a.width,height:a.height};const u=new s(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,l,c,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const m={["adjustment"]:lt(this.editor.adjustmentsToolStore.state),["filter"]:lt(this.editor.filterToolStore.state),["focus"]:lt(this.editor.focusToolStore.serializableState),["overlay"]:lt(this.editor.overlayToolStore.state),["frame"]:lt(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:p,customStickers:h}=await this.editor.spriteStore.serializableState();p.spriteIdList=p.spriteIdList.sort((x,b)=>{const w=p.common[x].order;const T=p.common[b].order;return w-T});m.sprite=p;m.customStickers=h;m.transform=this.editor.transformToolStore.serializableState;let g;let _;if(t){const x=ef.getDataURL(a);_=Cct(x);g=Sct(x)}if(r){this.editor.modalStore.hideModal()}o(u.serialise(m,g,_));if(e){this.editor.transformToolStore.onEnter()}}catch(a){if(r){this.editor.modalStore.hideModal()}n(a)}})})}deserialize(t){this.editor.modalStore.showInfoModal("loading");return new Promise((e,r)=>{try{Promise.resolve().then(()=>(rI(),iI)).then(({Deserializers:o})=>{const n=t.version.match(/[0-3].[0-8].[0-9]/i);let s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](this.editor)}else if(o[t.version]){s=new o[t.version](this.editor)}else{s=new o["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(t,s,e,r)})}else{this.applySerialization(t,s,e,r)}})}catch(o){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}r(o)}})}static getDataURL(t){if(t instanceof HTMLImageElement){const{src:n}=t;if(vct(n)){return n}}if(t instanceof HTMLCanvasElement){return t.toDataURL("image/png")}const e=document.createElement("canvas");e.width=t.width;e.height=t.height;const r=e.getContext("2d");r.drawImage(t,0,0);const o=e.toDataURL("image/png");jt(e);return o}async applyStateOnUI(t){const e=this.editor.activeStore.tool==="transform";try{if(t.transform){if(!e){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(t.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!e){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(t.filter){await this.editor.filterToolStore.updateStateFromSerialization(t.filter)}if(t.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(t.adjustment)}if(t.focus){await this.editor.focusToolStore.updateStateFromSerialization(t.focus)}if(t.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(t.overlay)}if(t.sprite){let r=Object.keys(t).length-1;if(t.customStickers){r-=1}t.sprite.spriteIdList=t.sprite.spriteIdList.sort((o,n)=>{const s=t.sprite.common[o].order;const a=t.sprite.common[n].order;return s-a});await this.editor.spriteStore.updateStateFromSerialization(t.sprite,t.customStickers,Math.max(0,r))}if(t.brush){this.editor.brushToolStore.updateStateFromHistory(t.brush)}if(t.frame){await this.editor.frameToolStore.updateStateFromSerialization(t.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(r){if(r.name==="AssetNotFoundError"){console.error(r)}else{console.error(r);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:r.message,handleConfirm:()=>{this.applyStateOnUI(t)}})}}}}});var wct,oI;var cW=d(()=>{wct=i=>{const t=atob(i.split(",")[1]);const e=i.split(",")[0].split(":")[1].split(";")[0];const r=new ArrayBuffer(t.length);const o=new Uint8Array(r);for(let n=0;n{R();uW=i=>i.split(",")[0].split(":")[1].split(";")[0];dW=i=>{if(typeof i==="string"){return uW(i)}if(i.src.includes(".svg")){return"image/svg+xml"}if(i.src){return uW(i.src)}return"image/jpeg"}});var bv,rf;var pW=d(()=>{Gh();bv=y(Yu());R();Ln();rf=class{static isImageElement(t){return t instanceof HTMLImageElement}constructor({license:t,assetProvider:e,crossOrigin:r,backgroundColor:o}){this.crossOrigin=r;this.engine=new hm({license:t,crossOrigin:r,assetProvider:e,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:o})}getAllFilterPreviewThumbnails(t){return new Promise((e,r)=>{const o=[];const n=[];t.forEach(s=>{if(s.isDuotone)o.push(s.identifier);else n.push(s.identifier)});this.getAllDuotonePreview(o).then(s=>{this.getAllLutPreview(n).then(a=>{e(Object.assign(s,a))}).catch(a=>{r(a)})}).catch(s=>{r(s)})})}async getAllDuotonePreview(t){const e={};if(!t.length)return e;const r=await this.engine.addDuoToneFilterFromAssets(t[0],this.container);await(0,bv.default)(t,async o=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(o);const s=r.filterOperation.getFilter();s.set({intensity:.5,lightColor:nt.Color.fromHex(n.lightColor),darkColor:nt.Color.fromHex(n.darkColor)});const a=await this.engine.export("data-url","image/jpeg",.8,false,true);e[o]=a},{concurrency:1});this.engine.removeEffect(r);return e}async loadLutAssets(t){const e={};await(0,bv.default)(t,async r=>{e[r]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",r))});return e}async getAllLutPreview(t){const e={};if(!t.length)return e;const r=await this.loadLutAssets(t);const o=await this.engine.addLUTFilterFromAssets(t[0],this.container);await(0,bv.default)(t,async n=>{const s=this.engine.assetProvider.getLUTFilterAsset(n);const a=o.filterOperation.getFilter();const l={horizontalTileCount:s.horizontalTileCount||5,verticalTileCount:s.verticalTileCount||5,image:r[n]};a.set({...l,intensity:s.defaultIntensity||1});o.setProperties({intensity:1});a._lutPrimitive.set(l);const c=await this.engine.export("data-url","image/jpeg",.8,false,true);e[n]=c},{concurrency:1});this.engine.removeEffect(o);return e}addImageToContainer(t){return new Promise((e,r)=>{let o;if(rf.isImageElement(t)){o=t;this.setBackgroundImage(o);e()}else{this.getImageElement(t).then(n=>{o=n;this.setBackgroundImage(o);e()}).catch(n=>{r({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,r)=>{const o=new Image;o.addEventListener("load",()=>{e(o)});o.addEventListener("error",n=>{r(n)});o.crossOrigin=this.crossOrigin;o.src=t})}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t})}const{size:e}=this.container.getBounds();const r=this.engine.getOutputContainer();r.setResolution(e)}}});var Tct,jo;var nI=d(()=>{wt();z();Tct={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};jo=class{constructor(t){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(t,e)=>{const{height:r,width:o}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:s,snapToTop:a,snapToBottom:l}=this.configStore.config.snapping.position;const c=Math.min(r,o);let u=0;if(e==="bottom"){u=Math.round(r-c*l)}else if(e==="top"){u=Math.round(c*a)}else if(e==="right"){u=Math.round(o-c*s)}else if(e==="left"){u=Math.round(c*n)}else if(t==="vertical"&&e==="center"){u=Math.round(o/2)}else if(t==="horizontal"&&e==="center"){u=Math.round(r/2)}return u};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:t,snapToLeft:e,snapToRight:r}=this.configStore.config.snapping.position;const o=[];if(t){o.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(e){o.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(r){o.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return o};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:t,snapToTop:e,snapToBottom:r}=this.configStore.config.snapping.position;const o=[];if(t){o.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(e){o.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(r){o.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return o};this.getRotationGuidesFromConfig=()=>{const{angles:t}=this.configStore.config.snapping.rotation;const e=[];t.forEach(o=>{e.push(o);e.push(o+360);e.push(o-360)});const r=e.filter((o,n)=>e.indexOf(o)===n);return r.map(o=>({value:o*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:t,leftBottom:e,rightTop:r,rightBottom:o})=>{const n=Math.min(t.y,r.y,e.y,o.y);const s=Math.max(t.y,r.y,e.y,o.y);const a=Math.min(t.x,r.x,e.x,o.x);const l=Math.max(t.x,r.x,e.x,o.x);return{height:Math.round(s-n),width:Math.round(l-a)}};this.mapRange=({value:t,fromMin:e,fromLength:r,toMin:o,toLength:n})=>{return(t-e)*n/r+o};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(t,e,r,o)=>{if(e.length===0){return t}if(e[0]>t){return t-r}for(let n=0;n=a-m){return a+u+(o?r*2:0)}return this.mapRange({value:t,fromMin:s,fromLength:a-s,toMin:l,toLength:c-l})}}if(o){return t+(e.length-1)*r*2+r}return t};this.mapFromSnapSystem=(t,e,r,o)=>{if(e.length===0){return t}if(e[0]>t){if(t>=e[0]-r){return e[0]}return t+r}let n=t;for(let a=0;a{const r=e*.5;const{value:o,edge:n}=t;let s=o;if(n==="leading"){s+=r}else if(n==="trailing"){s-=r}return s};this.mapSnappingGuidesToCenter=(t,e)=>{const r=[];t.forEach(o=>{r.push(this.centerSnapValue(o,e))});return r};this.calcSnapThresholdInRadians=(t,e)=>{if(t===0){return 0}return e/t};this.calculatePreviewTopLeftPosition=()=>{const t=this.editor.engineMediator.preview.container.getPosition();const e=this.editor.getPreviewSize();const r=Do();this.previewTopLeftPosition={x:t.x/r-e.width/2,y:t.y/r-e.height/2}};this.snapToRotation=(t,e,r)=>{const{rotationGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.rotation;const{x:a,y:l}=this.previewTopLeftPosition;const{width:c}=this.editor.getPreviewSize();let u=(t+Math.PI*2)%(Math.PI*2);if(n){const m=new F(e).magnitude;const p=o.map(_=>_.value).sort((_,x)=>_-x);const h=this.calcSnapThresholdInRadians(m,s);if(!this.rotationOffset){const _=this.mapToSnapSystem(t,p,h,false);this.rotationOffset=_-u}u=this.mapFromSnapSystem(u+this.rotationOffset,p,h,false);const g={x:r.position.x-a-c,y:r.position.y-l};o.forEach(_=>{_.isVisible=_.value===u;_.position=g});return u}return t};this.snapToPosition=(t,e)=>{const{horizontalGuides:r,verticalGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.position;const a=new F(this.previewTopLeftPosition);const{height:l,width:c}=this.getSpriteDimensions(e);const{x:u,y:m}=new F(t).subtract(a);if(n){const p=this.mapSnappingGuidesToCenter(r,l).sort((x,b)=>x-b);const h=this.mapSnappingGuidesToCenter(o,c).sort((x,b)=>x-b);if(!this.positionOffset){const x=this.mapToSnapSystem(u,h,s,true);const b=this.mapToSnapSystem(m,p,s,true);this.positionOffset=new F(x,b).subtract(new F(u,m))}let g=this.mapFromSnapSystem(u+this.positionOffset.x,h,s,true);let _=this.mapFromSnapSystem(m+this.positionOffset.y,p,s,true);g=Math.round(g);_=Math.round(_);r.forEach(x=>{const b=Math.round(this.centerSnapValue(x,l));x.isVisible=b===_});o.forEach(x=>{const b=Math.round(this.centerSnapValue(x,c));x.isVisible=b===g});return new F(g,_).add(a)}return{x:u,y:m}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=t;this.configStore=t.configStore;this.state=Z(Tct);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(t=>({...t,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(t=>({...t,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(t=>({...t,isVisible:false}))}get positionGuides(){const{verticalGuides:t,horizontalGuides:e}=this.state;return[...t,...e]}get rotationGuides(){return this.state.rotationGuides}};f([Z],jo.prototype,"state",2);f([v],jo.prototype,"snapToRotation",2);f([v],jo.prototype,"snapToPosition",2);f([v],jo.prototype,"hidePositionGuides",1);f([v],jo.prototype,"hideRotationGuides",1);f([v],jo.prototype,"dispose",2);f([C],jo.prototype,"positionGuides",1);f([C],jo.prototype,"rotationGuides",1)});var Cl;var hW=d(()=>{wt();R();Ln();z();pv();hv();uv();Vk();mv();fv();gv();lW();sk();lk();ck();wk();eI();dk();cW();mW();pW();kk();nI();tI();Zk();Cl=class{constructor(t,e){this.initWithImage=async t=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(t);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const e=this.configStore.config.engine;this.previewThumbnails=new rf({...e,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:e.identifier?e.identifier:"rendering",error:e,handleConfirm:()=>{this.initWithImage(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:t,height:e})=>{const{maxMegaPixels:r}=this.configStore.config.engine.downscaleOptions;const o=dp.isMobile()?r.mobile:r.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${o}`,width:`${t}`,height:`${e}`}})})};this.init=t=>{var o,n;if(!((o=this.activeStore)==null?void 0:o.image)){this.initWithImage(t);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const e=this.historyStore.isDirty();const{displayDiscardChangesWarning:r}=this.configStore.config;if(e&&r){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(t);this.resetToolStates()},handleDismiss:()=>{this.setImage(t,true)}});return}if(e&&!r){this.setImage(t,true);return}this.historyStore.reset();this.setImage(t,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:s,displayCanvasRendererWarning:a}=this.configStore.config;if(s.preferredRenderer==="canvas"&&a){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(t,e=false)=>{try{if(!this.activeStore.image){this.initWithImage(t)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(t);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:r,flipVertically:o,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:o,flipHorizontally:r});await this.transformToolStore.rotateOutputContainer(_p(n),false);if(e){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const s=this.activeStore.tool;if(!s){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(r){this.configStore.events.onErrorImageLoading(r);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:r.identifier?r.identifier:"rendering",error:r,handleConfirm:()=>{this.setImage(t,e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(r)}};this.onToolChange=(t,e=null,r=true)=>{var o,n;if(t===e){return}if((n=(o=this.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([t,e].indexOf("transform")!==-1){if(t==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(e==="transform"){this.transformToolStore.onEnter()}this.resize(e)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(r){this.render()}}};this.resize=(t=null)=>{if(!this.engineMediator)return;try{const e=this.activeStore.tool;const r=t==="transform"||!t&&e==="transform";this.canvasStore.resizeCanvas(t);this.transformToolStore.applyDefaultCrop();const o=lt(this.transformToolStore.maxCropMaskSize);if(!r){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const s=this.engineMediator.preview.updateTransform(n);if(s){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(o);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const a=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(a);if(!r){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:t,...e}={})=>{const r=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(r){this.transformToolStore.onLeave()}const{config:o}=this.configStore;const n={...o.export.image,...e};const{exportType:s,format:a,quality:l,enableDownload:c,transparent:u}=n;const m=await this.engineMediator.engine.export(s,a,l,u);if(r&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(c){this.triggerFileDownload(o.export.filename,a,s,m)}if(!t){this.configStore.events.onExport(m)}return m}catch(o){if(this.modalStore){this.modalStore.hideModal()}if(r&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(o)}};this.serialize=({image:t}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:t})}return Promise.resolve({})};this.deserialize=t=>{if(this.serializationMediator){return this.serializationMediator.deserialize(t)}return Promise.resolve()};this.close=()=>{var t,e,r,o,n,s;if((((t=this.historyStore)==null?void 0:t.isDirtySinceSave)||((r=(e=this.transformToolStore)==null?void 0:e.transformHistory)==null?void 0:r.hasChanges()))&&((n=(o=this.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var a;if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}}})}else if((s=this.configStore)==null?void 0:s.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:t,height:e}=this.engine.getOutputDimensions();return{width:t,height:e}}return{width:0,height:0}};this.wait=(t=0)=>new Promise(e=>setTimeout(e,t));this.clickableCanvas=async t=>{if(t){await new Promise(e=>setTimeout(e,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:t}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(t){const e=this.transformToolStore.localOutputImageSize;const r=e.width/e.height;const o=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(o.indexOf(parseFloat(r.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(t,e,r)=>{this.historyStore.addSnapshot(t,e,r)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=t=>this.assetProvider.getPathForCategory(t);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=t=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(t)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:t,height:e}=this.engine.getOutputDimensions();if(t&&e){return{width:Math.round(this.worldToPreview(this.outputToWorld(t))),height:Math.round(this.worldToPreview(this.outputToWorld(e)))}}return{height:e,width:t}};this.getImageMimeType=()=>{return dW(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var t,e,r;(r=(e=(t=this.engineMediator)==null?void 0:t.image)==null?void 0:e.container)==null?void 0:r.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(t,e,r,o)=>{const n=e==="image/jpeg"&&r!=="ms-blob"?".jpeg":".png";const s=t+n;const a=this.blobFromExportData(o);this.triggerBlobDownload(s,a)};this.triggerBlobDownload=(t,e)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(e,t)}else{const r=document.createElement("a");const o=URL.createObjectURL(e);r.href=o;r.download=t;document.body.appendChild(r);r.click();document.body.removeChild(r);if(!UF()){URL.revokeObjectURL(o)}}};this.blobFromExportData=t=>{if(typeof t==="string"){return oI(t)}if(t instanceof HTMLImageElement){return oI(t.src)}return t};this.configStore=new Zi;if(e){Object.entries(e).forEach(([o,n])=>{this.configStore.events.on(o,n)})}const r=this.configStore.saveConfig(t);this.engineMediator=new Gk(this);this.serializationMediator=new ef(this);this.spriteStore=new ot(this);this.scale=new Qe(this);this.filterToolStore=new Ne(this);this.adjustmentsToolStore=new Jt(this);this.focusToolStore=new At(this);this.overlayToolStore=new Je(this);this.frameToolStore=new Ae(this);this.brushToolStore=new ke(this);this.transformToolStore=new Q(this);this.libraryStore=new hr(this);this.modalStore=new Hr(this);this.snappingStore=new jo(this);this.activeStore=new pr(this);this.canvasStore=new Fi(this);this.historyStore=new uu(this);this.libraryStore.initProvider(r);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const t=this.outputContainer.getBounds();return Math.min(t.width,t.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(t,e){if(!this.engineMediator)return{x:0,y:0};if(qr(t)){return this.engineMediator.previewSpaceToWorldSpace(t,e)}return this.engineMediator.previewSpaceToWorldSpace(t,e)}worldToPreview(t){if(!this.engineMediator)return{x:0,y:0};if(qr(t)){return this.engineMediator.worldSpaceToPreviewSpace(t)}return this.engineMediator.worldSpaceToPreviewSpace(t)}worldSizeToPreview(t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(t.width),height:this.engineMediator.worldSpaceToPreviewSpace(t.height)}}previewSizeToWorld(t,e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(t.width,e),height:this.engineMediator.previewSpaceToWorldSpace(t.height,e)}}outputToWorld(t){if(!this.engineMediator)return{x:0,y:0};if(qr(t)){return this.engineMediator.outputSpaceToWorldSpace(t)}return this.engineMediator.outputSpaceToWorldSpace(t)}previewToOutput(t){if(!this.engineMediator)return{x:0,y:0};if(qr(t)){return this.engineMediator.previewSpaceToOutputSpace(t)}return this.engineMediator.previewSpaceToOutputSpace(t)}get outputContainer(){return this.engineMediator.output.container}};f([v],Cl.prototype,"resize",2);f([v],Cl.prototype,"export",2);f([v],Cl.prototype,"clickableCanvas",2)});var Kt=d(()=>{z();mr();Qx();iH();sk();lk();ck();dk();bH();vH();CH();wk();kH();YH();ZH();QH();gv();mv();hW();Ok();uv();pv();hv();fv();nI();qh();Zh();Yh();xl();Un();pm()});var of,nf,fW,gW,kct,Ict,bW;var yW=d(()=>{of=y(require("react"));A();nf=y(require("styled-components"));R();Kt();z();je();fW=dt.Button.TextSecondary;gW=nf.default.span` font-size: 14px; padding: 3px 1px 2px; color: ${i=>i.theme.canvasActionBar.foreground}; diff --git a/esm/basic-MI36SGM4.js b/esm/basic-C7DKMWA4.js similarity index 99% rename from esm/basic-MI36SGM4.js rename to esm/basic-C7DKMWA4.js index 25f3a24..e4290d7 100644 --- a/esm/basic-MI36SGM4.js +++ b/esm/basic-C7DKMWA4.js @@ -1,4 +1,4 @@ -import{A as Io,B as go,D as yo,H as vo,I as F,J as xo,K as Uo,M as ko,N as Fo,O as Lo,P as Ao,Q as wo,R as Oo,S as V,T as e,a as l,b as fo,c as u,d as uo,q as To,r as C,u as m,v as ho,w as So,x as Bo,y as T,z as Y}from"./chunk-CYND4KUN.js";import{Ta as k,Xa as S,Ya as bo,c as D}from"./chunk-UDNMGV4K.js";import eo from"react";import{ThemeProvider as zt}from"styled-components";import U from"react";import $t from"styled-components";import G from"react";var Eo=l(function o(){const{config:r,active:t,custom:n}=m();const{tools:i}=r;const a=t.tool;const s=d=>{const I=r.state.config[d];if("icon"in I){const no=I.icon;return G.createElement(no,null)}const j=So[d];return G.createElement(j,null)||null};const c=d=>{return r.locale[d].title};const p=(d,I)=>d&&G.createElement(e.Toolbar.Item,{onClick:()=>t.selectTool(d),key:d,label:c(d),isActive:a===d,isDisabled:!(t.image||d==="library"||d==="customTool")},s(d))||G.createElement(e.Toolbar.Separator,{key:d+I,active:!!a});const b=n.getBasicToolbar();if(!b){return null}return G.createElement(b,{show:!!a},i.map(p))});import h from"react";import P from"react";import wr from"styled-components";var Or=wr(e.ControlsbarContainer)` +import{A as Io,B as go,D as yo,H as vo,I as F,J as xo,K as Uo,M as ko,N as Fo,O as Lo,P as Ao,Q as wo,R as Oo,S as V,T as e,a as l,b as fo,c as u,d as uo,q as To,r as C,u as m,v as ho,w as So,x as Bo,y as T,z as Y}from"./chunk-CV3QEYL2.js";import{Ta as k,Xa as S,Ya as bo,c as D}from"./chunk-UDNMGV4K.js";import eo from"react";import{ThemeProvider as zt}from"styled-components";import U from"react";import $t from"styled-components";import G from"react";var Eo=l(function o(){const{config:r,active:t,custom:n}=m();const{tools:i}=r;const a=t.tool;const s=d=>{const I=r.state.config[d];if("icon"in I){const no=I.icon;return G.createElement(no,null)}const j=So[d];return G.createElement(j,null)||null};const c=d=>{return r.locale[d].title};const p=(d,I)=>d&&G.createElement(e.Toolbar.Item,{onClick:()=>t.selectTool(d),key:d,label:c(d),isActive:a===d,isDisabled:!(t.image||d==="library"||d==="customTool")},s(d))||G.createElement(e.Toolbar.Separator,{key:d+I,active:!!a});const b=n.getBasicToolbar();if(!b){return null}return G.createElement(b,{show:!!a},i.map(p))});import h from"react";import P from"react";import wr from"styled-components";var Or=wr(e.ControlsbarContainer)` > div { grid-template-columns: 1fr 5fr minmax(56px, 1fr); } diff --git a/esm/chunk-CYND4KUN.js b/esm/chunk-CV3QEYL2.js similarity index 99% rename from esm/chunk-CYND4KUN.js rename to esm/chunk-CV3QEYL2.js index bf1fbd0..b6a87b0 100644 --- a/esm/chunk-CYND4KUN.js +++ b/esm/chunk-CV3QEYL2.js @@ -1271,7 +1271,7 @@ to { 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.20)`,inactiveOpacity:y},textInput:{foreground:o,hoverBorderColor:o,background:"transparent",borderColor:l,inactiveOpacity:y},slider:{trackColor:a,activeTrackColor:i,thumbBackground:d,thumbBorderColor:i,inactiveOpacity:y,hoverOpacity:"0.7"},selectColor:{activeBorderColor:i,inactiveOpacity:y},toolbar:{foreground:o,background:l,activeBackground:"transparent",activeForeground:i,borderColor:"transparent"},tooltip:{background:a,foreground:o},toolControlBar:{background:"rgba(238, 238, 238, 0.9)",borderColor:d,shadow:"none",separatorColor:l,titleForeground:r,inputLabelForeground:r,inputLabelInactiveOpacity:y},mainCanvasActionBar:{background:"transparent",foreground:o,borderColor:"none"},canvasActionBar:{background:a,foreground:o,separatorColor:n},canvas:{background:u,controlsOutline:"rgba(255, 255, 255, 0.6)",controlsColor:"#ffffff",cropBackdrop:"rgba(255, 255, 255, 0.3)"},colorPicker:{listBackground:l,listShadow:`0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), - 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:a},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};var Za=By;var hr=Wn();var Nn=Fn();var Lt={...hr,measurements:Nn};var Fy=i=>{if(i==="light"){return Za}return Wn};var ih=(i,t)=>{const e=Fy(i);if(t&&t[i]){const{primary:o,background:r,foreground:n}=t[i];const a={primary:o,background:r,foreground:n};const l=Object.keys(a).reduce((c,d)=>{if(a[d]){return{...c,[d]:a[d]}}return c},{});return kt([e(l),t[i]])}return e()||hr};var Ry=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];var oh=i=>{const t=Fn();if(i){const e={};Object.keys(i).forEach(o=>{if(Ry.indexOf(o)!==-1){e[o]=i[o]}});return kt([t,e])}return t};var Hy={config:wo,locale:Oi,theme:hr,measurements:Nn,initialMeasurements:Nn};var St=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(t,e)=>{return e.indexOf(t)!==-1};this.state=T(Hy);this.events=new Ka;this.licenseChecker=null}saveConfig(t){if(t.mainCanvasActions&&t.mainCanvasActions.length!==4){t.mainCanvasActions.length=4}const e=t.layout&&t.layout==="basic"?qa:wo;const o=kt([e,t],{clone:true});this.licenseChecker=new Fc(o.license);if(!this.licenseChecker.areCustomAssetsAllowed()){o.sticker.enableCustomUpload=false}const r=eh(o.language,o.custom.languages);const n=ih(o.theme,o.custom.themes);const a=oh(o.custom.measurements);const{provider:l}=o.library;const c=[];o.adjustment.categories=o.adjustment.categories.reduce((m,f)=>{m.push({...f,items:f.items.filter(b=>{if(!pc[b.identifier]){c.push(b.identifier);return false}return true})});return m},[]);if(c.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${c.join(", ")}`)}delete o.language;delete o.custom.languages;delete o.custom.themes;delete o.library.provider;let d=o.tools.reduce((m,f)=>{if(typeof f==="object"){return[...m,...f]}return[...m,f]},[]);if(!d.length){console.error(`Empty list input for tools`);d=On.reduce((m,f)=>{if(typeof f==="object"){return[...m,...f]}return[...m,f]},[])}d=d.filter(m=>this.licenseChecker.isToolAllowed(m));if(o.defaultTool){const m=this.checkDefaultToolAvailability(o.defaultTool,d);if(!m){[o.defaultTool]=d}}o.tools=d;this.state.config=o;this.state.locale=r;this.state.theme=n;this.state.measurements=a;this.state.initialMeasurements=a;const u=this.buildCustomAssetsConfig();this.assetProvider=new Ec(u,this.licenseChecker.areCustomAssetsAllowed(),o.assetResolver);this.loadThemeFont();return l}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((t,e)=>{if(typeof e==="string"){return[...t,e]}return[...t,"",...e]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:t}=this.theme;if(!t.skipLoading){this.assetProvider.getFontManager().injectFonts([t])}}buildCustomAssetsConfig(){const t=this.tools;const e=I(this.state.config);const o=this.state.config.assetBaseUrl;const{theme:r}=this.state;const n=t.indexOf("filter")!==-1?e["filter"]:void 0;const a=t.indexOf("focus")!==-1?e["focus"]:void 0;const l=t.indexOf("adjustment")!==-1?e["adjustment"]:void 0;const c=t.indexOf("sticker")!==-1?e["sticker"]:void 0;const d=t.indexOf("frame")!==-1?e["frame"]:void 0;const u=t.indexOf("overlay")!==-1?e["overlay"]:void 0;const m=t.indexOf("transform")!==-1?e["transform"]:void 0;const f=t.indexOf("text")!==-1?e["text"]:void 0;const b=t.indexOf("textdesign")!==-1?e["textdesign"]:void 0;return{basePath:o,theme:r,filter:n,focus:a,sticker:c,frame:d,overlay:u,transform:m,text:f,adjustment:l,textdesign:b}}};s([p],St.prototype,"saveConfig",1);s([p],St.prototype,"dispose",2);s([h],St.prototype,"config",1);s([h],St.prototype,"locale",1);s([h],St.prototype,"theme",1);s([h],St.prototype,"measurements",1);s([h],St.prototype,"initialMeasurements",1);s([h],St.prototype,"tools",1);s([h],St.prototype,"defaultTool",1);s([h],St.prototype,"isOrderDefault",1);s([h],St.prototype,"isLayoutAdvanced",1);s([h],St.prototype,"displayCloseButton",1);var Qa=class{constructor(t){this.editor=t}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,originalImage:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t,originalImage:t})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((t,e)=>{const{image:o}=this.editor.activeStore;if(lc(o)){this.setBackgroundImage(o);t()}else{const r=this.editor.libraryStore.getRawUrl(o);this.getImageElement(r).then(n=>{this.setBackgroundImage(n);t()}).catch(n=>{e({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,o)=>{const r=new Image;r.addEventListener("load",()=>{e(r)});r.addEventListener("error",n=>{o(n)});r.crossOrigin=this.editor.configStore.config.engine.crossOrigin;r.src=t})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}};var tl=class{constructor(t){this.applyNewImageTransform=()=>{const{size:t,width:e,height:o}=this.editor.engineMediator.image.container.getBounds();const r=this.container;r.setTransform(ve.IDENTITY);r.setResolution(t);r.setPivot(.5,.5);r.setPosition({x:e/2,y:o/2})};this.editor=t}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}};function ur(i,t){const e=i.width/i.height;const o=t.width/t.height;if(e>o){return i.height/t.height}return i.width/t.width}var _y={transform:ve.IDENTITY};var Me=class{constructor(t){this.initialTransform=ve.IDENTITY;this.editor=t;this.state=T(_y)}createPreview(t){this.container=this.editor.engine.createPreview(t)}updateTransform(t=0,e=true){const o=this.calculateTransform(t);if(o.scale.x){if(e){this.saveInitialTransform(o)}else{this.savePreviewTransform(o)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(t){this.initialTransform=t;this.savePreviewTransform(t)}savePreviewTransform(t){nt(()=>{this.state.transform.position=t.position;this.state.transform.scale=t.scale;this.state.transform.rotation=t.rotation;const e=Xt();const o=new g(t.scale).divide(e);this.previewTransformWithoutDpr={position:new g(t.position).divide(e),scale:o,rotation:t.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(t=0){const e=Xt();const{scaleImageToFit:o}=this.editor.configStore.config;const{width:r,height:n}=this.editor.canvasStore.canvasSize;const a=this.editor.engine.getOutputDimensions();const l=ur({width:r,height:n},a);let c=o?l:Math.min(1,l);const d=n-a.height*c;const u=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(dn*m){c=ur({width:r,height:n*m},a)}if(a.width*c>r*m){c=ur({width:r*m,height:n},a)}c*=e;const f={x:r*e/2,y:n*e/2};const b={x:c,y:c};return new ve(f,b,t)}};s([p],Me.prototype,"updateTransform",1);s([p],Me.prototype,"savePreviewTransform",1);s([h],Me.prototype,"transform",1);s([h],Me.prototype,"position",1);s([h],Me.prototype,"scale",1);s([h],Me.prototype,"rotation",1);var Ne=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(t){if(["sticker","text","textdesign","brush"].indexOf(t)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(t,e){const o=e.findIndex(r=>r===t);if(o!==-1){e.splice(o,1)}return void 0}static indexForOrder(t,e,o){const r=t[o];const n=e.findIndex(l=>l===o);if(n!==-1){return{index:n,order:e}}const{length:a}=e;if(a){let l;for(l=0;lr===t);if(o!==-1){this.spriteContainerOrder[o]=e}}bringToFront(t){const e=this.spriteContainerOrder.findIndex(o=>o===t);if(e!==-1){this.spriteContainerOrder.splice(e,1);this.spriteContainerOrder.push(t)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:t}=this.spriteContainerOrder;return this.spriteContainerOrder[t-1]}getSpriteIndex(t){const e=this.spriteContainerOrder.findIndex(o=>o===t);return e+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};var Vn=Ne;Vn.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3};var el=class{constructor(t){this.orderHelper=new Vn;this.init=()=>{const t=this.editor.configStore.config.engine;this.engine=new Fr({...t,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new Qa(this.editor);this.output=new tl(this.editor);this.preview=new Me(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=t}render(t){return this.engine.render(t)}previewSpaceToWorldSpace(t,e){const o=this.preview.previewTransformWithoutDpr;if(re(t)){const r=this.editor.engine.convertPointFromPreviewIntoWorldSpace(g.ZERO,o,e);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:t,y:0},o,e);return g.distance(new g(r),new g(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(t,o,e)}worldSpaceToPreviewSpace(t){const e=this.preview.previewTransformWithoutDpr;if(re(t)){const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace(g.ZERO,e);const r=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:t,y:0},e);return g.distance(new g(o),new g(r))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(t,e)}outputSpaceToWorldSpace(t){if(re(t)){return zs.getScalarInWorldSpace(t,this.editor.engine.getOutputContainer())}return zs.getPointInWorldSpace(t,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(t){const e=this.preview.previewTransformWithoutDpr;if(re(t)){const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace(g.ZERO,e);const r=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:t,y:0},e);return g.distance(new g(o),new g(r))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(t,e)}previewSpaceToFlippedPreviewSpace(t){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(t)}};var Mo=class{constructor(){this.snapshots=[];this.observeIndex=T.box(-1)}addSnapshot(t){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(t))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(t)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(t){if(t>0&&t0}get canRedo(){return this.snapshots.length-1>this.index}};s([h],Mo.prototype,"index",1);s([h],Mo.prototype,"canUndo",1);s([h],Mo.prototype,"canRedo",1);var Fi=class{constructor(t){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const t=this.appHistoryManager.undo();await this.applyState(t);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const t=this.appHistoryManager.redo();await this.applyState(t);this.awaitHistoryChange=false}};this.editor=t;this.appHistoryManager=new Mo}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const t=I(this.editor.adjustmentsToolStore.state);const e=I(this.editor.filterToolStore.state);const o=this.editor.focusToolStore.getFocusStateForHistory();const r=I(this.editor.overlayToolStore.state);const n=I(this.editor.frameToolStore.state);const{strokes:a}=this.editor.brushToolStore;const l=this.editor.spriteStore.getSpriteHistoryState();const c=this.editor.transformToolStore.serializableState;return{["adjustment"]:t,["filter"]:e,["focus"]:o,["overlay"]:r,["frame"]:n,["brush"]:a,sprite:l,["transform"]:c}}addInitialSnapshot(){const t=this.getHistoryState();this.appHistoryManager.addSnapshot({state:t,type:"add",description:"Initial State"})}addSnapshot(t,e,o){let r;if(!t){r=this.getHistoryState()}else if(t.sprite||t.transform){r={...this.getHistoryState(),...t}}else{r=t}this.appHistoryManager.addSnapshot({state:r,type:e,description:o});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:t}){try{if(t){const e=Object.keys(t);for(const o of e){switch(o){case"filter":await this.editor.filterToolStore.updateStateFromHistory(t[o]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(t[o]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(t[o]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(t[o]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(t[o],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(t[o]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(t[o]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(t[o]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(e){console.error(e);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:e,handleConfirm:()=>{this.applyState({state:t})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var t,e;return(e=(t=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:t.state)==null?void 0:e.sprite}};s([p],Fi.prototype,"undo",2);s([p],Fi.prototype,"redo",2);s([h],Fi.prototype,"canUndo",1);s([h],Fi.prototype,"canRedo",1);var $y=(i,t)=>new Promise((e,o)=>{const r=new XMLHttpRequest;r.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){e(n.result)}else{o(new Error(`The image could not be loaded from ${i}`))}};n.onerror=a=>{o(a)};n.readAsDataURL(r.response)};r.open("GET",i);r.responseType="blob";r.withCredentials=t==="use-credentials";r.send()});var rh=(i,t)=>{return new Promise((e,o)=>{const r=new Image;r.onload=()=>{e(r)};r.onerror=()=>{o(new Error(`Failed to load image with src:${i}`))};r.crossOrigin=t;r.src=i})};var Wy=(i,t)=>new Promise((e,o)=>{$y(i,t).then(r=>{const n=new Image;n.addEventListener("load",()=>{e(n)});n.src=r}).catch(()=>{rh(i,t).then(r=>e(r)).catch(r=>{o(r)})})});var il=async({url:i,image:t,crossOrigin:e="anonymous"})=>{try{if(t&&t.src&&t.src.substr(0,5)==="data:"||t&&t.src&&t.src.includes(".svg")){return t}if(typeof i==="string"&&i.substr(0,5)==="data:"||typeof i==="string"&&i.includes(".svg")){return rh(i,e)}return Wy(i||t.src,e)}catch(o){throw new Error(o)}};var Ny={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};var It=class{constructor(t){this.setImage=async t=>{try{const{crossOrigin:e}=this.editor.configStore.config.engine;if(typeof t==="string"&&!t.trim()||t===void 0||t===null){this.state.image=null}else if(typeof t==="string"){this.state.image=await il({url:No(t)?t:this.editor.assetProvider.getPath(t),crossOrigin:e})}else if(t instanceof HTMLImageElement){this.state.image=await il({image:t,crossOrigin:e})}if(this.isWebcam){this.state.isWebcam=false}}catch(e){throw new Error(e)}};this.setImageLoadedToEngine=t=>{this.state.imageLoadedToEngine=t};this.newImage=t=>{this.editor.init(t)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=t;this.state=T(Ny)}selectTool(t){var o,r,n;const{licenseChecker:e}=this.editor.configStore;if(this.state.tool!==t&&(e==null?void 0:e.isToolAllowed(t))&&(this.image||t==="library"||t==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const a=(n=(r=(o=this.editor.configStore.state.config["customTool"])==null?void 0:o.measurements)==null?void 0:r.advancedUIToolControlBar)==null?void 0:n.width;if(a){if(t==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=a}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,t);this.state.tool=t;this.editor.configStore.events.onToolChanged(t);switch(t){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(t){this.state.isWebcam=t}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};s([p],It.prototype,"selectTool",1);s([p],It.prototype,"selectWebcam",1);s([p],It.prototype,"setImage",2);s([p],It.prototype,"setImageLoadedToEngine",2);s([p],It.prototype,"newImage",2);s([p],It.prototype,"dispose",2);s([h],It.prototype,"webcamLabel",1);s([h],It.prototype,"tool",1);s([h],It.prototype,"isWebcam",1);s([h],It.prototype,"image",1);s([h],It.prototype,"imageLoadedToEngine",1);var Vy={height:150,width:150};var ol={height:0,width:0};var rl=class{constructor(t){this.canvasClickDisabled=T.box(false);this.resizeCanvas=(t=null)=>{const e=this.editor.activeStore.tool;const o=t==="transform"||!t&&e==="transform";const{isLayoutAdvanced:r,measurements:n}=this.editor.configStore;const{storedSize:a}=this.editor.canvasStore;let l=0;if(!r&&o){l=n.basicUIToolControlBar.controlsBarHeight*-1;if(t==="transform"&&e==="brush"){l-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:a.width,height:a.height+l})};this.setCanvasSize=t=>{this.state.canvasSize=t};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=t;this.state=T(rl.initialState)}setCanvasElement(t){this.canvas=t;this.editor.engineMediator.preview.createPreview(t);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:t,width:e,render:o}){const{imageLoadedToEngine:r}=this.editor.activeStore;if(t>ol.height&&e>ol.width){this.state.storedSize={width:e,height:t};if(this.state.canvasSize.height===0){this.state.canvasSize={width:e,height:t}}if(o&&r){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return g.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(t){const e=this.editor.engine.getContainersAtPreviewPoint(t,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(o=>o.getID()).filter(o=>o!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(e)}};var yt=rl;yt.initialState={canvasSize:ol,storedSize:Vy};s([p],yt.prototype,"setCanvasElement",1);s([p],yt.prototype,"saveDimensions",1);s([p],yt.prototype,"resizeCanvas",2);s([p],yt.prototype,"disableCanvasClick",1);s([p],yt.prototype,"enableCanvasClick",1);s([p],yt.prototype,"setCanvasSize",2);s([p],yt.prototype,"dispose",2);s([h],yt.prototype,"isCanvasClickable",1);s([h],yt.prototype,"canvasSize",1);s([h],yt.prototype,"storedSize",1);s([h],yt.prototype,"sizeVector",1);s([h],yt.prototype,"sizeVectorMagnitude",1);var Uy={type:null,identifier:null,isVisible:false,error:""};var Bt=class{constructor(t){this.showActionModal=({type:t,identifier:e,error:o,handleConfirm:r,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=e;this.state.type=t;this.state.error=o||"";this.handleConfirm=r;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=t.configStore;this.state=T(Uy)}showInfoModal(t){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=t;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:t}=this.state;const e=this.getModalLocale();if(e){const{bodyLabel:o,headerLabel:r,buttonYes:n,buttonNo:a}=e;return{headerLabel:r,bodyLabel:o,confirmLabel:n,dismissLabel:a,isVisible:t,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:t,measurements:{basicCanvasOffset:e,advancedUIToolControlBar:o,advancedUIToolbar:r},isOrderDefault:n}=this.configStore;const a=(o.width+r.width)*(!n?-1:1);const l=e;return t?{x:a/2,y:0}:{x:0,y:-l}}getModalLocale(){const{identifier:t,error:e,type:o}=this.state;const{locale:r}=this.configStore;if(!o||!t||o==="textEdit")return null;if(o&&t&&r[`${o}Modals`]&&r[`${o}Modals`][t]){const n=r[`${o}Modals`][t];let{body:a}=n;if(a&&typeof e==="object"){Object.keys(e).forEach(c=>{a=a.replace(`\${${c}}`,e[c])})}else if(a){a=a.replace("${error}",e)}let l=n.heading;if(o==="error"||o==="warning"){const c={error:r.common.error,warning:r.common.warning};const d=o==="error"?c.error:c.warning;l=`${d}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:a,headerLabel:l,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};s([p],Bt.prototype,"showActionModal",2);s([p],Bt.prototype,"showInfoModal",1);s([p],Bt.prototype,"showTextEditModal",1);s([p],Bt.prototype,"hideModal",2);s([p],Bt.prototype,"dispose",2);s([h],Bt.prototype,"modalProps",1);s([h],Bt.prototype,"isVisible",1);s([h],Bt.prototype,"type",1);s([h],Bt.prototype,"identifier",1);s([h],Bt.prototype,"positionOffset",1);var ct=class{constructor(t){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(t=>t/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:t,maxOffsetY:e}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=e}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=t}this.savePosition();this.scaleRender()}};this.setOffset=t=>{const{canDragX:e,canDragY:o}=this.checkOffset(t);if(e){this.offset.x=t.x}if(o){this.offset.y=t.y}this.scaleRender()};this.editor=t}setInitialTransform(t=0){const e=Xt();const{scaleImageToFit:o}=this.editor.configStore.config;const{transform:r}=this.editor.engineMediator.preview;nt(()=>{const n=Math.abs(t||r.scale.x);this.setDefaultScale(o?n:Math.min(1*e,n));this.setPosition(r.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:t,height:e}=this.editor.canvasStore.canvas;this.setPosition({x:t/2,y:e/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(t){this.state.position.x=t.x;this.state.position.y=t.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(t){if(this.defaultScale!==1){const o=this.SCALE_LEVELS.findIndex(r=>r===this.defaultScale);if(o!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,o),...this.SCALE_LEVELS.slice(o+1)]}}const e=this.SCALE_LEVELS.findIndex(o=>o===t);if(e!==-1){this.state.scaleIndex=e}else{const o=this.SCALE_LEVELS.findIndex((r,n)=>{if(n===0){return t0;const y=u>0;const v=m-l;const x=f-c;return{canDragX:v<0,canDragY:x<0,maxOffsetX:b?-v:v,maxOffsetY:y?-x:x}}calculateScale(t=0,e=this.previewSize,o=this.defaultScale){const{width:r,height:n}=e;const a=new g({x:r,y:n});const l=new g(Math.abs(a.x*Math.cos(t))+Math.abs(a.y*Math.sin(t)),Math.abs(a.x*Math.sin(t))+Math.abs(a.y*Math.cos(t)));const c=a.subtract(l).divide(2).multiply(o).abs;if(c.y>c.x){return c.y*2/a.y+o}return c.x*2/a.x+o}get defaultIndex(){return this.SCALE_LEVELS.findIndex(t=>t===this.defaultScale)}getPositionWithOffset(t=this.offset){const{position:e}=this;return{x:e.x-t.x,y:e.y-t.y}}scaleRender(t=false){const e=this.editor.scale.getPositionWithOffset();const o=t?this.defaultScale:this.scale;const r={x:o,y:o};this.editor.engineMediator.preview.container.setScale(r);this.editor.engineMediator.preview.container.setPosition(e);this.editor.engineMediator.preview.savePreviewTransform({scale:r,position:e,rotation:0});if(!t){this.editor.render()}}get scale(){const t=this.state.scaleIndex;return t!==-1?this.SCALE_LEVELS[t]:this.defaultScale}get zoomLevel(){const t=Xt();return(this.scale/t*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const t=this.state.scaleIndex;const e=t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;const{previewSize:o}=this;return{width:o.width*e/this.defaultScale,height:o.height*e/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};s([T],ct.prototype,"state",2);s([p],ct.prototype,"in",2);s([p],ct.prototype,"out",2);s([p],ct.prototype,"setInitialTransform",1);s([p],ct.prototype,"resetScale",1);s([p],ct.prototype,"resetPosition",1);s([p],ct.prototype,"setPosition",1);s([p],ct.prototype,"savePosition",1);s([p],ct.prototype,"setDefaultScale",1);s([p],ct.prototype,"setScaleToDefault",1);s([h],ct.prototype,"scale",1);s([h],ct.prototype,"zoomLevel",1);s([h],ct.prototype,"canDrag",1);s([h],ct.prototype,"canZoomOut",1);s([h],ct.prototype,"canZoomIn",1);s([h],ct.prototype,"position",1);s([h],ct.prototype,"scaledSize",1);var nh=[[0,0],[0,1],[1,0],[1,1]];var Gy=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];var he=class{constructor(t,e,o="center",r=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=e;this.m=o==="center"?he.movePivotTo([.5,.5]):nh;this.considerRotation=r;this.considerFlip=n;this.configStore=t.configStore}static getFlippedEdgeIndex(t,e,o){return Gy[(e?1:0)+(o?2:0)][t]}static movePivotTo(t){return nh.map(e=>[e[0]-t[0],e[1]-t[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(t,e,o){const r=he.getFlippedEdgeIndex(t,e,o);const n=this.m[r][0]*this.size.width;const a=this.m[r][1]*this.size.height;return{width:n,height:a}}get leftTop(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(0,e,o);return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottom(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(1,e,o);return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightTop(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(2,e,o);return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottom(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(3,e,o);return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(1,e,o);r.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(3,e,o);r.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftMid(){const t=new g(this.leftTop);const e=new g(this.leftBottom);return t.add(e).divide(2)}get rightMid(){const t=new g(this.rightTop);const e=new g(this.rightBottom);return t.add(e).divide(2)}};var tt=he;tt.coordinatesWithRotation=({width:t,height:e},o,r,n,a,l)=>{let c=t*Math.cos(o)-e*Math.sin(o)+l.x;let d=t*Math.sin(o)+e*Math.cos(o)+l.y;if(r){c=a.x*2-c}if(n){d=a.y*2-d}return new g({x:c,y:d}).rounded};s([h],tt.prototype,"position",1);s([h],tt.prototype,"size",1);s([h],tt.prototype,"rotation",1);s([h],tt.prototype,"flipHorizontally",1);s([h],tt.prototype,"flipVertically",1);s([h],tt.prototype,"flipCenter",1);s([h],tt.prototype,"leftTop",1);s([h],tt.prototype,"leftBottom",1);s([h],tt.prototype,"rightTop",1);s([h],tt.prototype,"rightBottom",1);s([h],tt.prototype,"leftBottomHandle",1);s([h],tt.prototype,"rightBottomHandle",1);s([h],tt.prototype,"leftMid",1);s([h],tt.prototype,"rightMid",1);var R=class{constructor(t,e){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:T.map({})};this.configStore=t.configStore;this.id=ye();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=e}changeIdentifier(t){this.state.identifier=t;const e=this.state.cropState.get(`${this.id}-${t}`);if(!e){this.state.cropState.set(`${this.id}-${t}`,{...Zt})}}changeRatio(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){this.state.cropState.set(`${this.id}-${this.identifier}`,{...e,ratio:t})}}changeSize(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t.width&&t.width>0){e.size.width=Math.round(t.width)}if(t.height&&t.height>0){e.size.height=Math.round(t.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeHeight(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.height=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changeWidth(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.width=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changePositionX(t,e){const o=this.state.cropState.get(`${this.id}-${this.identifier}`);if(o&&t<=e-this.minCropSize&&t>=0){o.position.x=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,o);return true}return false}changePositionY(t,e){const o=this.state.cropState.get(`${this.id}-${this.identifier}`);if(o&&t<=e-this.minCropSize&&t>=0){o.position.y=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,o);return true}return false}changePosition(t,e){const o=this.state.cropState.get(`${this.id}-${this.identifier}`);if(o){if(t.x<=e.width-this.minCropSize&&t.x>=0&&t.y<=e.height-this.minCropSize&&t.y>=0){o.position.x=Math.round(t.x);o.position.y=Math.round(t.y);this.state.cropState.set(`${this.id}-${this.identifier}`,o);return true}}return false}changeLockResolution(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.lockResolution=t!==void 0?t:!e.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeForceDimensions(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.forceDimensions=t;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}clearState(){this.state.cropState.forEach((t,e)=>e.startsWith(this.id)&&this.state.cropState.delete(e))}setRotation(t){this.state.rotationInDegrees=t}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:t,flipVertically:e}){this.state.flipHorizontally=t;this.state.flipVertically=e}setOutputRotation(t){this.state.outputRotation=t}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:t,height:e}=this.defaults.maxCropMaskSize;return new g(t/2,e/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:Zt.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:Zt.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:Zt.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:Zt.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:Zt.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:Zt.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:Zt.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:Zt.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:Zt.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};s([T],R.prototype,"state",2);s([p],R.prototype,"changeIdentifier",1);s([p],R.prototype,"changeRatio",1);s([p],R.prototype,"changeSize",1);s([p],R.prototype,"changeHeight",1);s([p],R.prototype,"changeWidth",1);s([p],R.prototype,"changePositionX",1);s([p],R.prototype,"changePositionY",1);s([p],R.prototype,"changePosition",1);s([p],R.prototype,"changeLockResolution",1);s([p],R.prototype,"changeForceDimensions",1);s([p],R.prototype,"clearState",1);s([p],R.prototype,"setRotation",1);s([p],R.prototype,"resetRotation",1);s([p],R.prototype,"resetOutputRotation",1);s([p],R.prototype,"resetFlip",1);s([p],R.prototype,"updateFlip",1);s([p],R.prototype,"setOutputRotation",1);s([p],R.prototype,"flipHorizontally",1);s([p],R.prototype,"flipVertically",1);s([p],R.prototype,"dispose",2);s([h],R.prototype,"flipCenter",1);s([h],R.prototype,"isFlippedHorizontal",1);s([h],R.prototype,"isFlippedVertical",1);s([h],R.prototype,"identifier",1);s([h],R.prototype,"height",1);s([h],R.prototype,"width",1);s([h],R.prototype,"position",1);s([h],R.prototype,"ratio",1);s([h],R.prototype,"size",1);s([h],R.prototype,"x",1);s([h],R.prototype,"y",1);s([h],R.prototype,"lockResolution",1);s([h],R.prototype,"forceDimensions",1);s([h],R.prototype,"selectedCrop",1);s([h],R.prototype,"rotationInDegrees",1);s([h],R.prototype,"outputRotation",1);var nl=class{constructor(t){this.transforms={output:JSON.stringify(ve.IDENTITY),preview:JSON.stringify(ve.IDENTITY)};this.setFrameOpacity=t=>{this.frameOpacity=t;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=t=>{this.overlayOpacity=t;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=t;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:t,flipVertically:e,rotation:o,outputRotation:r}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new g(this.transformToolStore.leftTopRespectFlip).add(new g(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new g(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const a=this.engineMediator.preview.container;const{outputContainer:l}=this.editor;l.setResolution(I(this.transformToolStore.localOutputImageSize));l.setData({flipVertically:e,flipHorizontally:t});const c=a.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let d=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:y,defaultImageSize:v}=this.transformToolStore;const x=this.transformToolStore.maxCropMaskSize;const C={height:y.height*v.height/x.height,width:y.width*v.width/x.width};d=C.width/this.transformToolStore.localOutputImageSize.width}const u=Math.abs(c.x);const m=d/(u/this.transformToolStore.defaultScale);const f={x:m,y:m};const b=-(o-r);l.setTransform({scale:f,position:n,rotation:b});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(t){this.transforms=t}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const t=this.engineMediator.preview.container;const{outputContainer:e}=this.editor;const o=JSON.parse(this.transforms.preview);e.setResolution(I(this.transformToolStore.defaultImageSize));t.setTransform(o);e.setTransform(JSON.parse(this.transforms.output));const r=o.scale;e.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:r.y<0,flipHorizontally:r.x<0});this.engineMediator.preview.savePreviewTransform(o);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(t,e=true){const{width:o,height:r}=this.editor.engineMediator.image.container.getBounds();const n=zc(t)?{width:r,height:o}:{width:o,height:r};this.editor.outputContainer.rotate(t,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:a}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(a);nt(()=>{this.editor.scale.setInitialTransform();const l=this.getScaleWithFlip(a);this.engineMediator.preview.container.setScale(l);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(e){this.editor.render()}}applyPreviewTransform(){const{rotation:t,flipHorizontally:e,flipVertically:o}=this.transformToolStore.rotateFlipState;const r=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let a=t;if(e){a=As(a)}if(o){a=As(a)}const l={position:r,rotation:a,scale:n};this.engineMediator.preview.savePreviewTransform(l);this.engineMediator.preview.container.setTransform(l)}getScaleWithFlip(t=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:e,flipVertically:o}=this.transformToolStore.rotateFlipState;const r=e?-1:1;const n=o?-1:1;const a=this.editor.scale.calculateScale(t);return{x:a*r,y:a*n}}saveTransforms(){const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:t,output:e}}saveTransformsBasedOnFlip(){const t=this.engineMediator.preview.container.getTransform();const{scale:e}=t;const{flipVertically:o,flipHorizontally:r}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...t,scale:{x:r?-e.x:e.x,y:o?-e.y:e.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}};var sl=class{constructor(t){this.store=t;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,dt.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}};var sh="identity";var Ri=class{constructor(t){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=T.box(false);this.minCropSize=0;this.transformHistory=new sl(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=t=>{if(!t.trim())return false;let e=this.editor.configStore.config.assetBaseUrl;const{length:o}=e;if(e[o-1]!=="/"){e+="/"}if(`${e}transform`===t){return false}const r=new Image;try{r.src=t;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const t=this.editor.outputContainer.getRotation();if(t!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=t=>{this.localOutputSize.height=Math.round(t.height);this.localOutputSize.width=Math.round(t.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(t.width),height:Math.round(t.height)})};this.changeDefaultScale=t=>{this.defaults.scale=t};this.changeLocalOutputHeight=t=>{this.localOutputSize.height=Math.round(t)};this.changeLocalOutputWidth=t=>{this.localOutputSize.width=Math.round(t)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?Ds:Es;this.rotateOutputContainer(e(t))};this.rotateAntiClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?Es:Ds;this.rotateOutputContainer(e(t))};this.flipHorizontally=(t=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(t);if(t){this.trackChanges()}};this.flipVertically=(t=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(t);if(t){this.trackChanges()}};this.applyDefaultCrop=(t=false)=>{if(this.identifier==="identity"){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,t)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:t,y:e})=>{const o=this.getRatio();const r=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:a}=this;const l=Math.min(Math.max(0,t),r.x-n.width);const c=Math.min(Math.max(0,e),r.y-n.height);const d=r.x-l;const u=r.y-c;const m={width:Math.max(this.minCropSize,Math.min(d,a.width-l)),height:Math.max(this.minCropSize,Math.min(u,a.height-c))};if(o==="*"){if(this.changePosition({x:l,y:c})){this.changeCropAndOutputSize(m)}}else{const f=this.proportionalSize(o,m);const b=new g(r).subtract({x:f.width,y:f.height});if(this.changePosition(b)){this.changeCropAndOutputSize(f,o)}}};this.onLeftBottom=({x:t,y:e})=>{const o=this.getRatio();const r=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:a}=this;const l=Math.min(Math.max(0,t),r.x-n.width);const c=Math.max(0,e,r.y+n.height);const d=r.x-l;const u=c-r.y;const m={width:Math.max(1,Math.min(d,a.width-l)),height:Math.max(1,Math.min(u,a.height-r.y))};if(o==="*"){if(this.changePositionX(l)){this.changeCropAndOutputSize(m)}}else{const f=this.proportionalSize(o,m);if(this.changePositionX(r.x-f.width)){this.changeCropAndOutputSize(f,o)}}};this.onRightTop=({x:t,y:e})=>{const o=this.getRatio();const r=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:a}=this;const l=Math.max(0,t,r.x+n.width);const c=Math.min(Math.max(0,e),r.y-n.height);const d=l-r.x;const u=r.y-c;const m={width:Math.max(1,Math.min(d,a.width-r.x)),height:Math.max(1,Math.min(u,a.height-c))};if(o==="*"){if(this.changePositionY(c)){this.changeCropAndOutputSize(m)}}else{const f=this.proportionalSize(o,m);if(this.changePositionY(r.y-f.height)){this.changeCropAndOutputSize(f,o)}}};this.onRightBottom=({x:t,y:e})=>{const o=this.getRatio();const r=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:a}=this;const l=Math.max(0,t,r.x+n.width);const c=Math.max(0,e,r.y+n.height);const d=l-r.x;const u=c-r.y;const m={width:Math.max(1,Math.min(d,a.width-r.x)),height:Math.max(1,Math.min(u,a.height-r.y))};if(o==="*"){this.changeCropAndOutputSize(m)}else{const f=this.proportionalSize(o,m);this.changeCropAndOutputSize(f,o)}};this.onPixelWidth=t=>{const e=JSON.stringify(I(this.localOutputSize));const o=this.entityManager.items.find(n=>n.identifier===this.identifier);const r=this.defaults.imageSize;if(o&&o.ratio){let n=t;let a=this.localOutputSize.height;let{ratio:l}=o;if(l==="*"&&this.lockResolution){l=this.localOutputSize.width/this.localOutputSize.height}if(l==="*"&&!this.lockResolution){n=Math.max(Math.min(t,r.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(a)})}else{const c=Ri.placeCropMask(l,r);n=Math.max(Math.min(n,c.width),this.minCropSize);a=n/l;this.changeLocalOutputSize({height:a,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.onPixelHeight=t=>{const e=JSON.stringify(I(this.localOutputSize));const o=this.entityManager.items.find(n=>n.identifier===this.identifier);const r=this.defaults.imageSize;if(o&&o.ratio){let n=t;let a=this.localOutputSize.width;let{ratio:l}=o;if(l==="*"&&this.lockResolution){l=this.localOutputSize.width/this.localOutputSize.height}if(l==="*"&&!this.lockResolution){n=Math.max(Math.min(t,r.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(a),height:Math.round(n)})}else{const c=Ri.placeCropMask(l,r);n=Math.max(Math.min(n,c.height),this.minCropSize);a=n*l;this.changeLocalOutputSize({height:n,width:a})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=t=>{this.transformations.setFrameOpacity(t)};this.setOverlayOpacity=t=>{this.transformations.setOverlayOpacity(t)};this.closestRatioReducer=t=>(e,o)=>{if(o===null)return-1;return Math.abs(t-e.ratio)(e,o)=>{if(o===null)return-1;const r=Math.abs(e.dimensions.x/e.dimensions.y);const n=Math.abs(o.dimensions.x/o.dimensions.y);if(r===n){return e.dimensions.x*e.dimensions.y>o.dimensions.x*o.dimensions.y?-1:1}return Math.abs(t-r){const t=this.entityManager.items.findIndex(c=>c.identifier==="imgly_transform_common_custom");if(t!==-1)return this.entityManager.items[t];const e=this.entityManager.items.findIndex(c=>c.ratio==="*");if(e!==-1)return this.entityManager.items[e];const o=I(this.editor.outputContainer.getResolution());const r=Math.abs(o.width/o.height);const[n]=this.entityManager.items.filter(c=>c.ratio&&typeof c.ratio==="number").sort(this.closestRatioReducer(r));const[a]=this.entityManager.items.filter(c=>c.dimensions&&!c.ratio).sort(this.closestDimensionsReducer(r));if(!n||!a||!n.ratio&&!a.dimensions){return this.entityManager.items[0]}if(!a||!a.dimensions)return n;if(!n||!n.ratio)return a;const l=Math.abs(a.dimensions.x/a.dimensions.y);if(l===n.ratio)return n;return Math.abs(r-n.ratio){let e=this.entityManager.items.find(o=>o.identifier===t);if(!e){e=this.getMatchingItem()}return e};this.editor=t;this.selectedCategory=sh;this.transformStore=new R(t,this.defaults);this.transformations=new nl(t);const{enableRotation:e,enableFlip:o,...r}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new it(n,{...r,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new tt(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new tt(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(t){return t*Math.PI/180}static placeCropMask(t,e){if(e.height*t>e.width){const r=e.width/t;return{height:r,width:e.width,yChanged:true}}const o=e.height*t;return{height:e.height,width:o,yChanged:false}}changeIdentifier(t,e=false){this.transformStore.changeIdentifier(t);const o=this.getCropMask(t,this.defaults.imageSize);if(o){this.transformStore.changeRatio(o.ratio);this.changeLocalOutputSize(o);this.updatePreviewSizeWRTImageSize();if(o.yChanged!==void 0){this.updateInitialCropMaskPosition(o.yChanged)}if(o.dimensions){this.changeLocalOutputSize({width:o.dimensions.x,height:o.dimensions.y})}if(e){this.trackChanges()}}}setDragMode(t){this.dragMode.set(t)}getCropMask(t,e){const o=this.getTransform(t);if(o){const{ratio:r,forceDimensions:n,lockDimensions:a,dimensions:l=null}=o;if(n){this.transformStore.changeForceDimensions(n)}if(a){this.transformStore.changeLockResolution(a)}if(r){switch(r){case"*":this.changePosition({x:0,y:0});return{...e,yChanged:void 0,ratio:"*",dimensions:l};default:return{...Ri.placeCropMask(o.ratio,e),ratio:o.ratio,dimensions:l}}}else{const{x:c,y:d}=o.dimensions;return{...Ri.placeCropMask(c/d,e),ratio:null,dimensions:l}}}return null}setCropDefaults(t=false){const e=this.editor.outputContainer.getResolution();this.setDefaultImageSize(e);const o=this.editor.getPreviewSize();const{position:r}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(o);this.setDefaultCropPosition({x:r.x-o.width/2,y:r.y-o.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!t){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(t){this.defaults.imageSize={...I(t)};if(!this.lockResolution){this.localOutputSize={...I(t)}}}setMaxCropSize(t){this.defaults.maxCropMaskSize.height=t.height;this.defaults.maxCropMaskSize.width=t.width}setDefaultCropPosition(t){this.defaults.cropMaskPosition.x=t.x;this.defaults.cropMaskPosition.y=t.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(t){this.selectedCategory=this.selectedCategory===t?sh:t}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:t,output:e})}changePosition(t){return this.transformStore.changePosition(t,this.defaults.maxCropMaskSize)}changePositionX(t){return this.transformStore.changePositionX(t,this.defaults.maxCropMaskSize.width)}changePositionY(t){return this.transformStore.changePositionY(t,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:t,height:e},o,r=true){this.transformStore.changeWidth(t);this.transformStore.changeHeight(e);if(!this.lockResolution){const{height:n,width:a}=this.defaults.maxCropMaskSize;const{height:l,width:c}=this.defaults.imageSize;let d=l/n*e;const u=c/a*t;if(o){d=u/o}if(r){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(u),height:Math.round(d)})}if(e>=this.minCropSize){this.changeLocalOutputHeight(d)}if(t>=this.minCropSize){this.changeLocalOutputWidth(u)}}}transformRender(t=true){this.transformations.applyPreviewTransform();if(t){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:t,flipVertically:e}=this.rotateFlipState;const{identifier:o,rotationInDegrees:r}=this;const n=Ts(r);const a=Ms(Is(this.editor.engineMediator.output.container.getRotation())+r);const{start:l,end:c}=this.convertUIToOperationOptions(n,a);return{flipHorizontally:t,flipVertically:e,rotation:n,start:l,end:c,identifier:o,outputRotation:a}}getStartEndForOperation(t){const{leftTop:e,rightBottom:o,maxCropMaskSize:r}=this;const n=e.y;const a=e.x;const l=o.x;const c=o.y;switch(t){case 270:return{leftTop:{x:r.height-c,y:a},rightBottom:{x:r.height-n,y:l}};case 180:return{leftTop:{x:r.width-l,y:r.height-c},rightBottom:{x:r.width-a,y:r.height-n}};case 90:return{leftTop:{x:n,y:r.width-l},rightBottom:{x:c,y:r.width-a}};default:return{leftTop:{x:a,y:n},rightBottom:{x:l,y:c}}}}getStartEndForUI(t,e,o){const{maxCropMaskSize:r}=this;const n=e.y;const a=e.x;const l=o.x;const c=o.y;switch(t){case 90:return{leftTop:{x:r.width-c,y:a},rightBottom:{x:r.width-n,y:l}};case 180:return{leftTop:{x:r.width-l,y:r.height-c},rightBottom:{x:r.width-a,y:r.height-n}};case 270:return{leftTop:{x:n,y:r.height-l},rightBottom:{x:c,y:r.height-a}};default:return{leftTop:{x:a,y:n},rightBottom:{x:l,y:c}}}}convertOperationOptionsToUI({start:t,end:e,rotation:o,outputRotation:r}){const n=r===90||r===270;const a=n?g.fromSize(this.defaultImageSize).swapped:g.fromSize(this.defaultImageSize);const l=Math.cos(o);const c=Math.sin(o);const d=this.calculateScale(o);const u=new g(Math.min(t.x,e.x),Math.min(t.y,e.y));const m=new g(Math.max(t.x,e.x),Math.max(t.y,e.y));const f=m.subtract(u).divide(2);const b=u.add(f).multiply(a);const y=b.subtract(a.multiply(.5));const v=new g(y.x*l-y.y*c,y.x*c+y.y*l).multiply(d);const x=a.multiply(.5).add(v);const C=x.divide(a);const D=C.subtract(f.multiply(d));const A=C.add(f.multiply(d));const B=n?g.fromSize(this.maxCropMaskSize).swapped:g.fromSize(this.maxCropMaskSize);const O=D.multiply(B);const P=A.multiply(B);const{leftTop:V,rightBottom:U}=this.getStartEndForUI(r,O,P);return{start:new g(V),end:new g(U)}}convertUIToOperationOptions(t,e){const o=e===90||e===270;const r=o?g.fromSize(this.defaultImageSize).swapped:g.fromSize(this.defaultImageSize);const n=o?g.fromSize(this.maxCropMaskSize).swapped:g.fromSize(this.maxCropMaskSize);const a=Math.cos(-t);const l=Math.sin(-t);const c=this.calculateScale(t,o);const{leftTop:d,rightBottom:u}=this.getStartEndForOperation(e);const m=new g(d).divide(n);const f=new g(u).divide(n);const b=f.subtract(m).divide(2);const y=m.add(b).multiply(r);const v=y.subtract(r.multiply(.5));const x=new g(v.x*a-v.y*l,v.x*l+v.y*a).divide(c);const C=r.multiply(.5).add(x);const D=C.divide(r);const A=D.subtract(b.divide(c));const B=D.add(b.divide(c));return{start:A,end:B}}calculateScale(t,e=false){const o=e?g.fromSize(this.defaultImageSize).swapped:g.fromSize(this.defaultImageSize);const r=new g(Math.abs(o.x*Math.cos(t))+Math.abs(o.y*Math.sin(t)),Math.abs(o.x*Math.sin(t))+Math.abs(o.y*Math.cos(t)));const n=o.subtract(r.clone()).divide(2).abs;return n.y>n.x?n.y*2/o.y+1:n.x*2/o.x+1}updateStateFromSerialization(t){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=Math.round(Is(t.rotation));this.transformStore.setRotation(e>180?e-360:e);this.transformations.rotateOutputContainer(Ts(Ms(t.outputRotation||0)));if(t.identifier){this.transformStore.changeIdentifier(t.identifier)}if(t.start&&t.end){if(t.end.x===0||t.end.y===0){t.end.x=1;t.end.y=1}const{start:o,end:r}=this.convertOperationOptionsToUI({start:new g(t.start),end:new g(t.end),rotation:t.rotation,outputRotation:t.outputRotation});this.changePositionX(o.x);this.changePositionY(o.y);const n=r.x-o.x;const a=r.y-o.y;this.transformStore.changeSize({width:n,height:a});const{maxCropMaskSize:l,imageSize:c}=this.defaults;const d={height:a*c.height/l.height,width:n*c.width/l.width};this.changeLocalOutputSize(d)}if(t.flipHorizontally){this.flipHorizontally(false)}if(t.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(t){this.defaultAngle=t}updateCanvasControls(t){const e=I(this.cropMaskPosition);const o=I(this.cropMaskSize);const r=I(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:r.height*o.height/t.height,width:r.width*o.width/t.width},void 0,false);this.changePosition({y:r.height*e.y/t.height,x:r.width*e.x/t.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(t){this.transformStore.setRotation(t);this.transformRender()}async rotateOutputContainer(t,e=true){this.setDragMode(true);this.transformations.rotateOutputContainer(t,e);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,false)}clickableCanvas(t){this.editor.clickableCanvas(t)}proportionalSize(t,e,o=this.defaults.maxCropMaskSize,r=this.minCropSize){let n=e.height*t;let{height:a}=e;if(n>o.width||n1){return{width:this.minCropSize*t,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*t}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const t=this.getTransform(this.identifier);if(t){if(Object.prototype.hasOwnProperty.call(t,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return t.ratio}const{x:e,y:o}=t.dimensions;return e/o}return"*"}};var w=Ri;s([T],w.prototype,"selectedCategory",2);s([T],w.prototype,"defaults",2);s([T],w.prototype,"localOutputSize",2);s([p],w.prototype,"changeIdentifier",1);s([p],w.prototype,"setDragMode",1);s([p],w.prototype,"setCropDefaults",1);s([p],w.prototype,"setDefaultImageSize",1);s([p],w.prototype,"setMaxCropSize",1);s([p],w.prototype,"setDefaultCropPosition",1);s([p],w.prototype,"resetCrop",1);s([p],w.prototype,"toggleCategorySelection",1);s([p],w.prototype,"pureReset",1);s([p],w.prototype,"reset",2);s([p],w.prototype,"changePosition",1);s([p],w.prototype,"changePositionX",1);s([p],w.prototype,"changePositionY",1);s([p],w.prototype,"changeCropAndOutputSize",1);s([p],w.prototype,"onLeave",1);s([p],w.prototype,"onEnter",1);s([p],w.prototype,"changeLocalOutputSize",2);s([p],w.prototype,"changeDefaultScale",2);s([p],w.prototype,"changeLocalOutputHeight",2);s([p],w.prototype,"changeLocalOutputWidth",2);s([p],w.prototype,"changeLockResolution",2);s([p],w.prototype,"setRotation",1);s([p],w.prototype,"rotateClockwise",2);s([p],w.prototype,"rotateAntiClockwise",2);s([p],w.prototype,"rotateOutputContainer",1);s([p],w.prototype,"flipHorizontally",2);s([p],w.prototype,"flipVertically",2);s([p],w.prototype,"applyDefaultCrop",2);s([p],w.prototype,"applyInitialCrop",1);s([p],w.prototype,"updateCropMask",2);s([p],w.prototype,"clickableCanvas",1);s([p],w.prototype,"onLeftTop",2);s([p],w.prototype,"onLeftBottom",2);s([p],w.prototype,"onRightTop",2);s([p],w.prototype,"onRightBottom",2);s([p],w.prototype,"proportionalSize",1);s([p],w.prototype,"onPixelWidth",2);s([p],w.prototype,"onPixelHeight",2);s([p],w.prototype,"updateInitialCropMaskPosition",1);s([p],w.prototype,"updatePreviewSizeWRTImageSize",1);s([p],w.prototype,"dispose",2);s([h],w.prototype,"cropState",1);s([h],w.prototype,"identifier",1);s([h],w.prototype,"ratio",1);s([h],w.prototype,"height",1);s([h],w.prototype,"width",1);s([h],w.prototype,"localOutputImageSize",1);s([h],w.prototype,"localOutputHeight",1);s([h],w.prototype,"localOutputWidth",1);s([h],w.prototype,"lockResolution",1);s([h],w.prototype,"forceDimensions",1);s([h],w.prototype,"rotationInDegrees",1);s([h],w.prototype,"outputRotation",1);s([h],w.prototype,"isDragMode",1);s([h],w.prototype,"rotateFlipState",1);s([h],w.prototype,"selectedCategoryIdentifier",1);s([h],w.prototype,"categories",1);s([h],w.prototype,"items",1);s([h],w.prototype,"config",1);s([h],w.prototype,"locale",1);s([h],w.prototype,"isOptionSelected",1);s([h],w.prototype,"leftTop",1);s([h],w.prototype,"leftBottom",1);s([h],w.prototype,"rightTop",1);s([h],w.prototype,"rightBottom",1);s([h],w.prototype,"isFlippedHorizontal",1);s([h],w.prototype,"isFlippedVertical",1);s([h],w.prototype,"leftTopRespectFlip",1);s([h],w.prototype,"leftBottomRespectFlip",1);s([h],w.prototype,"rightTopRespectFlip",1);s([h],w.prototype,"rightBottomRespectFlip",1);s([h],w.prototype,"cropMaskPosition",1);s([h],w.prototype,"cropMaskSize",1);s([h],w.prototype,"state",1);s([h],w.prototype,"defaultImageSize",1);s([h],w.prototype,"maxCropMaskSize",1);s([h],w.prototype,"minCropMaskSize",1);s([h],w.prototype,"defaultCropMaskPosition",1);s([h],w.prototype,"defaultScale",1);var ah=Rt(Dc());var jy={};var al="none";var Xy={position:{x:0,y:0},rotation:0};var mr=class{constructor(t){this.state=T.map(jy);this.selectedId=T.box(al);this.editMode=T.box(false);this.dragMode=T.box(false);this.minLength=0;this.counter=0;this.addSticker=async(t,e=true)=>{await this.addStickerAsync(t,e)};this.addStickerAsync=async({spriteId:t,state:e,transform:o},r=true)=>{return new Promise((n,a)=>{o=this.getInitialTransform(o);const{identifier:l}=e;const c=this.editor.orderHelper.addSprite(l);this.editor.engine.addStickerFromAssets(l,this.editor.engineMediator.image.container,c).then(async d=>{if(t){d.setData({id:t})}const u=d.getID();this.container[u]=d;this.editor.orderHelper.renameSprite(l,u);const m=this.getSize(u);m.width*=d.getScale().x;m.height*=d.getScale().y;d.setPivot(.5,.5);let f;if(o.scale){f=o.scale}else if(o.size){f={x:o.size.width/m.width,y:o.size.height/m.height}}else{const x=this.editor.shortestOutputSide*.4;const C=mr.magnitude(x)/mr.sizeMagnitude(d.getSizeInWorldSpace());f={x:C,y:C}}const{flipHorizontally:b,flipVertically:y}=this.editor.outputContainer.getData();d.setFlipHorizontally(b);d.setFlipVertically(y);d.setTransform({position:o.position,scale:f,rotation:o.rotation});if(e.flipHorizontally!==void 0){d.setFlipHorizontally(e.flipHorizontally!==b)}if(e.flipVertically!==void 0){d.setFlipVertically(e.flipVertically!==y)}this.setContainerProperties(u,{...e});const v=d.getData();this.setInitialSpriteState(u,"sticker");this.stickerToolStore.setState(u,{...v,identifier:l});await this.editor.renderPromise();if(r){this.setId(u);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(d=>{console.error(d);a()})})};this.addText=async(t,e=true)=>{await this.addTextAsync(t,e)};this.addTextAsync=({spriteId:t,state:e,transform:o},r=true)=>{return new Promise((n,a)=>{o=this.getInitialTransform(o);const l=this.editor.orderHelper.addSprite(e.identifier);const c=this.editor.shortestOutputSide;const d={fontIdentifier:e.identifier,text:e.text,width:e.width||c*.6,fontSize:e.fontSize||c*.1,lineHeight:e.lineHeight,alignment:e.alignment,textColor:e.textColor,backgroundColor:e.backgroundColor};this.editor.engine.addTextWithFontLoading(d,this.editor.engineMediator.image.container,l).then(async u=>{if(t){u.setData({id:t})}const m=u.getID();this.container[m]=u;this.editor.orderHelper.renameSprite(e.identifier,m);const{flipHorizontally:f,flipVertically:b}=this.editor.outputContainer.getData();u.setFlipHorizontally(f);u.setFlipVertically(b);u.setPivot(.5,.5);u.setPosition(o.position);u.setRotation(o.rotation);this.setInitialSpriteState(m,"text");const y=u.getData();this.textToolStore.setState(m,{...y});await this.editor.renderPromise();if(r){this.setId(m);this.addSnapshot("add",this.textLocale.add)}n()}).catch(u=>{console.error(u);a()})})};this.addTextDesign=async(t,e=true,o=false)=>{try{await this.addTextDesignAsync(t,e,o)}catch(r){console.warn(r)}};this.addTextDesignAsync=({spriteId:t,state:e,transform:o},r=true,n=false)=>{return new Promise((a,l)=>{o=this.getInitialTransform(o);const c=this.editor.orderHelper.addSprite(e.identifier);const d=this.editor.shortestOutputSide;const u={width:e.width||d*.6,text:e.text,color:e.color,inverted:e.isInverted,seed:e.seed,padding:e.padding};this.editor.engine.addTextDesignAsync(e.identifier,u,this.editor.engineMediator.image.container,c).then(async m=>{if(t){if(n){this.pureRemoveSprite(t);this.textDesignToolStore.state.delete(t)}m.setData({id:t})}const f=m.getID();this.container[f]=m;this.editor.orderHelper.renameSprite(e.identifier,f);const{flipHorizontally:b,flipVertically:y}=this.editor.outputContainer.getData();m.setFlipHorizontally(b);m.setFlipVertically(y);m.setPivot(.5,.5);m.setPosition(o.position);m.setRotation(o.rotation);this.setInitialSpriteState(f,"textdesign");const v=m.getData();this.textDesignToolStore.setState(f,{...v,identifier:e.identifier});await this.editor.renderPromise();if(r){this.setId(f);this.addSnapshot("add",this.textDesignLocale.add)}a()}).catch(m=>{l(m)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=t=>{this.editor.clickableCanvas(t)};this.setContainerProperties=(t,e,o=false)=>{this.container[t].setData(e);if(o){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(t,e)=>{this.container[t].setPosition(e)};this.pureRemoveSprite=t=>{this.editor.engine.removeContainer(this.container[t]);const e=this.container[t].getIndexInParent();if(e===-1){delete this.container[t];this.state.delete(t);this.editor.orderHelper.removeSprite(t);return true}return false};this.deleteSprite=(t=this.id)=>{const e=this.state.get(t);if(e.tool==="sticker"){this.stickerToolStore.delete()}else if(e.tool==="text"){this.textToolStore.delete()}else if(e.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=t=>{const e=this.pureRemoveSprite(t);if(e){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(t,e)=>{this.editor.addSnapshot(void 0,t,e)};this.spriteSnapshot=t=>{this.addSnapshot("edit",this.historyLocale[t])};this.addNewText=async(t,e)=>{if(this.textToolStore.doesTextAssetExist(e.identifier)){await this.addTextAsync({...t,state:e},false)}else{throw new oe(e.identifier)}};this.addNewTextDesign=async(t,e)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(e.identifier)){await this.addTextDesignAsync({...t,state:e},false)}else{throw new oe(e.identifier)}};this.addNewSticker=async(t,e)=>{if(this.stickerToolStore.doesStickerAssetExist(e.identifier)){await this.addStickerAsync({...t,state:e},false)}else{throw new oe(e.identifier)}};this.getSpriteHistoryState=()=>{const t=I(this.textToolStore.state);const e=I(this.textDesignToolStore.state);const o={common:I(this.state),["sticker"]:I(this.stickerToolStore.state),["text"]:t,["textdesign"]:e,spriteIdList:Object.keys(this.container)};Object.keys(o.common).forEach(r=>{o.common[r].size=this.container[r].getSizeInWorldSpace();o.common[r].position=this.container[r].getPosition();o.common[r].order=this.container[r].getIndexInParent()});return o};this.updateStateFromSerialization=async(t,e,o)=>{if(e&&e.length){try{const r=await Promise.all(e.map(async({svg:n,raster:a,name:l,identifier:c})=>{const d=(n==null?void 0:n.data)?"image/svg+xml":a.type;const u=`data:${d};base64,${(n==null?void 0:n.data)||a.data}`;const m=await $n(u,150);return{stickerURI:u,thumbnailURI:m,name:l,type:d,identifier:c}}));await this.stickerToolStore.addCustomStickerAsset(r)}catch(r){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(t.text){await this.textToolStore.loadFonts()}if(t.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(t.spriteIdList,t,o)};this.updateStateFromHistory=async t=>{const e=Object.keys(this.container);const o=e.filter(r=>t.spriteIdList.indexOf(r)===-1);o.forEach(r=>{this.pureRemoveSprite(r)});await this.updateStateByHistoryState(t.spriteIdList,t,0)};this.serializableState=async()=>{const t=this.editor.spriteStore.getSpriteHistoryState();Object.keys(t.common).forEach(o=>{const{flipHorizontally:r,flipVertically:n}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=n!==r?-t.common[o].rotation:t.common[o].rotation;t.common[o].rotation=n!==r?l+a:l-a});const e=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:o,type:r,stickerURI:n,name:a})=>{const l={identifier:o,name:a,raster:{data:"",type:"image/jpeg"}};if(r==="image/svg+xml"){l.svg={data:n.split(",")[1]}}if(r==="image/jpeg"||r==="image/png"||r==="image/gif"){[,l.raster.data]=n.split(",");l.raster.type=r}else{const c=await $n(n);[,l.raster.data]=c.split(",");l.raster.type="image/png"}return l}));return{sprite:t,customStickers:e}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(t=>{this.updatePositionAndSize(t,true);const e=this.state.get(t);if(e){if(e.tool==="text"){const o=this.getContainerProperties(t);this.textToolStore.changeSize(t,o)}else if(e.tool==="textdesign"){const o=this.getContainerProperties(t);this.textToolStore.changeWidth(o.width)}}})};this.setEditMode=t=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(t){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(t)}}};this.setDragMode=t=>{this.dragMode.set(t)};this.setPosition=t=>{const e=this.currentSprite;const o=this.container[this.id];if(e&&o){o.setPosition(this.editor.previewToWorld(t));const{position:r}=this.getSizePositionFromContainer();e.position.x=r.x;e.position.y=r.y;this.state.set(this.id,e);this.editor.render()}};this.setSize=t=>{const e=this.currentSprite;if(e){e.size.width=t.width;e.size.height=t.height;this.state.set(this.id,e)}};this.setRotation=t=>{const e=this.currentSprite;if(e){const{flipHorizontally:o,flipVertically:r}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const a=Uo({rotation:t,outputRotation:n,flipHorizontally:o,flipVertically:r});this.container[this.id].setRotation(a);e.rotation=this.container[this.id].getRotation();this.state.set(this.id,e);this.editor.render()}};this.onCanvasClick=t=>{if(!this.isEditMode){this.selectHighestOrderSprite(t)}};this.select=t=>{const e=this.state.get(t);if(e){const o=this.editor.activeStore.tool;if(o!==e.tool){this.editor.activeStore.selectTool(e.tool)}this.setId(t)}};this.selectLast=()=>{const t=this.editor.orderHelper.getLastSpriteId();if(t){this.select(t)}};this.selectNext=()=>{if(this.currentSprite){const t=this.container[this.id];const e=t.getIndexInParent();if(e){const o=Object.keys(this.container).find(r=>this.container[r].getIndexInParent()===e-1);if(o){this.select(o)}}}};this.deselect=()=>{this.setId(al)};this.bringToFront=async t=>{const e=this.editor.orderHelper.bringToFront(t);this.container[t].setIndexInParent(e);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=t=>{const e=this.state.get(t);const o=this.container[t];o.setFlipHorizontally(!o.getFlipHorizontally());e.flipHorizontally=o.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(t,e);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(t=>{this.pureRemoveSprite(t)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=t=>{const e=this.editor.brushToolStore.containerId();t=t.filter(n=>n!==e);if(t.length<1){this.deselect();return}let o="";let r=0;t.forEach(n=>{const a=this.container[n];const l=a&&a.getIndexInParent()||0;if(l>=r){r=l;o=n}});this.select(o)};this.onCornerDrag=({x:t,y:e})=>{if(this.currentSprite){const o=new g(this.currentSprite.position);const r=new g(t,e);const n=r.subtract(o).magnitude;const a=this.getSize();const l=n*2/mr.sizeMagnitude(a);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:a.width*l,height:a.height*l})}else{const c=this.rotationWRTOutputRotation;const d=r.subtract(o);const u=Math.cos(c);const m=Math.sin(c);const f=Math.max(Math.abs(d.x*u*2+d.y*m*2),this.minLength);const b=Math.max(Math.abs(d.x*-m*2+d.y*u*2),this.minLength);this.setStickerSize({width:f,height:b})}}else if(this.isSpriteText){this.setTextSize(a.width*l)}else if(this.isSpriteTextDesign){this.setTextDesignScale(l)}}this.editor.render()}};this.onWidthDrag=({x:t,y:e})=>{const o=new g(this.currentSprite.position);const r=new g(t,e);const n=r.subtract(o).magnitude;const a=this.editor.previewToWorld(2*n);if(a>this.minLength){this.setContainerProperties(this.id,{width:a},true);if(this.isSpriteText){const l=this.getContainerProperties(this.id);this.textToolStore.changeWidth(l.width)}}};this.onPaddingDrag=({x:t,y:e})=>{if(this.isSpriteTextDesign){let o=this.getContainerProperties(this.id);const r=new g(this.currentSprite.position);const n=new g(t,e);const a=n.subtract(r).magnitude;const l=Math.max(this.editor.previewToWorld(a)-o.width/2,0);this.setContainerProperties(this.id,{padding:l},true);if(this.isSpriteTextDesign){o=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(o.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();Object.values(this.container).forEach(o=>{if(o.type==="text"||o.type==="text-design"){o.setFlipHorizontally(t);o.setFlipVertically(e)}})};this.reverseTextHorizontally=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipHorizontally(t)}})};this.reverseTextVertically=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipVertically(t)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=t=>{return this.container[t].getData()};this.getContainerTransform=t=>{return this.container[t].getTransform()};this.getDuplicateContainerTransform=t=>{const e=this.container[t].getTransform();const o=this.editor.shortestOutputSide*.1;const r=new g(e.position).add(new g(o,o));return{...e,position:r}};this.getDuplicateContainerFlip=t=>{const e=this.container[t].getFlipHorizontally();const o=this.container[t].getFlipVertically();return{flipHorizontally:e,flipVertically:o}};this.updatePositionAndSize=(t=this.id,e=false)=>{const{position:o,size:r}=this.getSizePositionFromContainer(t);const n=this.state.get(t);if(n){n.position.x=o.x;n.position.y=o.y;n.size.width=r.width;n.size.height=r.height;if(e){const a=this.container[t].getRotation();this.container[t].setRotation(a);n.rotation=this.container[t].getRotation()}this.state.set(t,n)}};this.getInitialTransform=t=>{const e=this.editor.outputToWorld(Xy.position);if(!t){const o=this.editor.outputContainer.getRotation();return{rotation:o,position:e}}return{position:e,...t}};this.setInitialSpriteState=(t,e)=>{const o=this.container[t];const{position:r,size:n}=this.getSizePositionFromContainer(t);const a=o.getRotation();const l=e!=="sticker"?false:o.getFlipHorizontally();const c=e!=="sticker"?false:o.getFlipVertically();this.state.set(t,{tool:e,position:r,rotation:a,size:n,flipHorizontally:l,flipVertically:c})};this.setStickerSize=t=>{const e=this.container[this.id];e.setSizeInWorldSpace(this.editor.previewSizeToWorld(t));const o=this.currentSprite;if(o){o.size=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());this.state.set(this.id,o)}};this.setTextSize=t=>{let e=this.getContainerProperties(this.id);const o={width:this.editor.previewToWorld(t)};const r=o.width/e.width;const n={fontSize:Math.round(e.fontSize*r)};const a=this.isSpriteText?{...o,...n}:o;if(o.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,a,true);e=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(e.fontSize,true);this.textToolStore.changeWidth(e.width)}};this.setTextDesignScale=t=>{let e=this.getContainerProperties(this.id);const o=e.width*t;if(o>this.minLength){this.setContainerProperties(this.id,{width:o},true);const{width:r}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(r);e=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(e.padding)}};this.getSizePositionFromContainer=(t=this.id)=>{const e=this.container[t];if(e){const o=this.editor.worldToPreview(e.getPosition());const r=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());return{position:o,size:r}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(t=this.id)=>{const e=this.container[t];if(e){return this.editor.worldSizeToPreview(e.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=t;this.container={};this.stickerToolStore=new W(t);this.textToolStore=new L(t);this.textDesignToolStore=new N(t);this.rect=new tt(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(t,e){return new g(t,e||t).magnitude}static sizeMagnitude(t){return Math.sqrt(t.width*t.width+t.height*t.height)}async updateStateByHistoryState(t,e,o){await(0,ah.default)(t,async r=>{const n=e.common[r];if(!n)return;if(this.state.get(r)){this.updateExistingItem(r,e)}else{await this.addNewItem(r,e)}});t.forEach(r=>{const n=e.common[r];const a=this.container[r];if(!n||!a)return;a.setIndexInParent(n.order+o)});this.counter+=1}async addNewItem(t,e){const o=e.common[t];const r=o.size?{width:this.editor.worldToPreview(o.size.width),height:this.editor.worldToPreview(o.size.height)}:void 0;const{flipHorizontally:n,flipVertically:a}=this.editor.outputContainer.getData();const l=this.editor.outputContainer.getRotation();const c=a!==n?o.rotation-l:o.rotation+l;const d=a!==n?-c:c;const u={spriteId:t,transform:{size:r,position:new g(o.position),rotation:d}};if(e.text[t]){const m=e.text[t];const f=this.textToolStore.validFontWithConfig(m.identifier);m.identifier=f==null?void 0:f.identifier;await this.addNewText(u,m);return}if(e.textdesign[t]){await this.addNewTextDesign(u,e.textdesign[t]);return}if(e.sticker[t]){const m=this.stickerToolStore.items.find(f=>f.identifier===e.sticker[t].identifier);await this.addNewSticker(u,{...e.sticker[t],flipHorizontally:o.flipHorizontally,flipVertically:o.flipVertically,resizeMode:e.sticker[t].resizeMode||(m==null?void 0:m.resizeMode)||"keepAspect"})}}updateExistingItem(t,e){const o=e.common[t];const r=this.state.get(t);this.state.set(t,r);const n=this.container[t];n.setPosition(new g(o.position));n.setRotation(o.rotation);r.rotation=n.getRotation();if(o.flipHorizontally!==void 0){n.setFlipHorizontally(o.flipHorizontally)}if(o.flipVertically!==void 0){n.setFlipVertically(o.flipVertically)}if(e.text[t]){const a=e.text[t];this.textToolStore.updateStateFromHistory(t,{...a,fontIdentifier:a.identifier})}if(e.textdesign[t]){const a=e.textdesign[t];this.textDesignToolStore.updateStateFromHistory(t,{...a,inverted:a.isInverted})}if(e.sticker[t]){n.setSizeInWorldSpace(o.size);this.stickerToolStore.updateStateFromHistory(t,e.sticker[t])}this.updatePositionAndSize(t)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==al}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();const o=this.editor.outputContainer.getRotation();return Uo({rotation:this.currentSprite.rotation-o,flipHorizontally:t,flipVertically:e})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const t=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:t,y:e}=this.currentSprite.position;const{height:o,width:r}=this.currentSprite.size;return{x:Math.round(t-r/2),y:Math.round(e-o/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:t}=this.rect;return{x:t.x-this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:t}=this.rect;return{x:t.x+this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(t){this.selectedId.set(t)}};var k=mr;s([T],k.prototype,"counter",2);s([p],k.prototype,"addSticker",2);s([p],k.prototype,"addStickerAsync",2);s([p],k.prototype,"addText",2);s([p],k.prototype,"addTextAsync",2);s([p],k.prototype,"addTextDesign",2);s([p],k.prototype,"addTextDesignAsync",2);s([p],k.prototype,"clickableCanvas",2);s([p],k.prototype,"setContainerProperties",2);s([p],k.prototype,"setContainerPosition",2);s([p],k.prototype,"pureRemoveSprite",2);s([p],k.prototype,"deleteSprite",2);s([p],k.prototype,"removeSprite",2);s([p],k.prototype,"addSnapshot",2);s([p],k.prototype,"addNewText",2);s([p],k.prototype,"addNewTextDesign",2);s([p],k.prototype,"addNewSticker",2);s([p],k.prototype,"updateStateFromSerialization",2);s([p],k.prototype,"updateStateFromHistory",2);s([p],k.prototype,"updateCanvasControls",2);s([p],k.prototype,"setEditMode",2);s([p],k.prototype,"setDragMode",2);s([p],k.prototype,"setPosition",2);s([p],k.prototype,"setSize",2);s([p],k.prototype,"setRotation",2);s([p],k.prototype,"onCanvasClick",2);s([p],k.prototype,"select",2);s([p],k.prototype,"selectLast",2);s([p],k.prototype,"selectNext",2);s([p],k.prototype,"deselect",2);s([p],k.prototype,"bringToFront",2);s([p],k.prototype,"flipHorizontally",2);s([p],k.prototype,"pureReset",2);s([p],k.prototype,"onCornerDrag",2);s([p],k.prototype,"onWidthDrag",2);s([p],k.prototype,"onPaddingDrag",2);s([p],k.prototype,"correctTextFlip",2);s([p],k.prototype,"reverseTextHorizontally",2);s([p],k.prototype,"reverseTextVertically",2);s([p],k.prototype,"dispose",2);s([h],k.prototype,"currentSprite",1);s([h],k.prototype,"padding",1);s([h],k.prototype,"isEditMode",1);s([h],k.prototype,"isDragMode",1);s([h],k.prototype,"id",1);s([h],k.prototype,"isSpriteSelected",1);s([h],k.prototype,"position",1);s([h],k.prototype,"tool",1);s([h],k.prototype,"size",1);s([h],k.prototype,"rotation",1);s([h],k.prototype,"rotationWRTOutputRotation",1);s([h],k.prototype,"flipHorizontal",1);s([h],k.prototype,"isSpriteSticker",1);s([h],k.prototype,"isSpriteText",1);s([h],k.prototype,"isSpriteTextDesign",1);s([h],k.prototype,"isOnTop",1);s([h],k.prototype,"spritePosition",1);s([h],k.prototype,"currentRect",1);s([h],k.prototype,"leftTopPosition",1);s([h],k.prototype,"leftBottomPosition",1);s([h],k.prototype,"leftMidPosition",1);s([h],k.prototype,"leftMidPadPosition",1);s([h],k.prototype,"rightTopPosition",1);s([h],k.prototype,"rightBottomPosition",1);s([h],k.prototype,"rightMidPosition",1);s([h],k.prototype,"rightMidPadPosition",1);s([h],k.prototype,"leftBottomHandlePosition",1);s([h],k.prototype,"rightBottomHandlePosition",1);s([h],k.prototype,"historyLocale",1);s([h],k.prototype,"stickerLocale",1);s([h],k.prototype,"textLocale",1);s([h],k.prototype,"textDesignLocale",1);var Yy={categories:[],query:""};var Mt=class{constructor(t){this.initProvider=t=>{if(t){this.libraryProvider=new t}};this.fetchImages=async(t="")=>{if(this.libraryProvider){let e=null;try{const o=await this.libraryProvider.getCategories();const r=await this.libraryProvider.searchImages(t);e=o.map((n,a)=>{const l=r.filter(c=>c.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:l.map(c=>({name:c.title||`image${a}`,identifier:`${n.name}-${c.title}-${a}`,thumbnailURI:c.thumbUrl,rawUrl:c.rawUrl,authorName:c.authorName,authorAvatar:c.authorAvatar}))}}).filter(n=>n.items.length)}catch(o){console.log(o)}nt(()=>{this.state.query=t;this.state.categories=e})}};this.toggleCategorySelection=t=>{this.selectedCategory=this.selectedCategory!==t?t:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=t=>{const e=this.items.findIndex(o=>o.identifier===t);if(e!==-1){return this.items[e].rawUrl}return t};this.configStore=t.configStore;this.state=T(Yy);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(t=>t.items).reduce((t,e)=>[...t,...e],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};s([T],Mt.prototype,"selectedCategory",2);s([p],Mt.prototype,"initProvider",2);s([p],Mt.prototype,"fetchImages",2);s([p],Mt.prototype,"toggleCategorySelection",2);s([p],Mt.prototype,"dispose",2);s([h],Mt.prototype,"selectedCategoryIdentifier",1);s([h],Mt.prototype,"categories",1);s([h],Mt.prototype,"items",1);s([h],Mt.prototype,"query",1);s([h],Mt.prototype,"config",1);s([h],Mt.prototype,"locale",1);var lh=/^data:image\/(.+?);base64,/;var Ky=i=>lh.test(i);var qy=i=>i.match(/^data:([^;]+)/)[1];var Jy=i=>i.replace(lh,"");var fr=class{constructor(t){this.applySerialization=async(t,e,o,r)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const a="Unexpected error occured";const l=e.deserializeImage(t);if(l.image&&l.image.data){const u=l.image.data;await this.editor.setImage(u);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(u);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const c=e.deserializeTransformation(t);if(!c){r(a);return}await this.applyStateOnUI(c);const d=e.deserialize(t);if(!d){r(a);return}await this.applyStateOnUI(d);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}o()};this.editor=t}serialize({image:t}={image:false}){const e=this.editor.activeStore.tool==="transform";const{displaySerializationModal:o}=this.editor.configStore.config;if(o){this.editor.modalStore.showInfoModal("saving")}return new Promise((r,n)=>{import("./serialization-NUWRU2SA.js").then(async({Serializer:a})=>{try{if(e){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:l}=this.editor.imageContainer.getData();const c=this.editor.engineMediator.output.container.getResolution();const d={width:l.width,height:l.height};const u=new a(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,c,d,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const m={["adjustment"]:I(this.editor.adjustmentsToolStore.state),["filter"]:I(this.editor.filterToolStore.state),["focus"]:I(this.editor.focusToolStore.serializableState),["overlay"]:I(this.editor.overlayToolStore.state),["frame"]:I(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:f,customStickers:b}=await this.editor.spriteStore.serializableState();f.spriteIdList=f.spriteIdList.sort((x,C)=>{const D=f.common[x].order;const A=f.common[C].order;return D-A});m.sprite=f;m.customStickers=b;m.transform=this.editor.transformToolStore.serializableState;let y;let v;if(t){const x=fr.getDataURL(l);v=qy(x);y=Jy(x)}if(o){this.editor.modalStore.hideModal()}r(u.serialise(m,y,v));if(e){this.editor.transformToolStore.onEnter()}}catch(l){if(o){this.editor.modalStore.hideModal()}n(l)}})})}deserialize(t){this.editor.modalStore.showInfoModal("loading");return new Promise((e,o)=>{try{import("./serialization-NUWRU2SA.js").then(({Deserializers:r})=>{const n=t.version.match(/[0-3].[0-8].[0-9]/i);let a=null;if(n&&r["3.9.0"]){a=new r["3.9.0"](this.editor)}else if(r[t.version]){a=new r[t.version](this.editor)}else{a=new r["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(t,a,e,o)})}else{this.applySerialization(t,a,e,o)}})}catch(r){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}o(r)}})}static getDataURL(t){if(t instanceof HTMLImageElement){const{src:n}=t;if(Ky(n)){return n}}if(t instanceof HTMLCanvasElement){return t.toDataURL("image/png")}const e=document.createElement("canvas");e.width=t.width;e.height=t.height;const o=e.getContext("2d");o.drawImage(t,0,0);const r=e.toDataURL("image/png");oo(e);return r}async applyStateOnUI(t){const e=this.editor.activeStore.tool==="transform";try{if(t.transform){if(!e){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(t.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!e){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(t.filter){await this.editor.filterToolStore.updateStateFromSerialization(t.filter)}if(t.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(t.adjustment)}if(t.focus){await this.editor.focusToolStore.updateStateFromSerialization(t.focus)}if(t.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(t.overlay)}if(t.sprite){let o=Object.keys(t).length-1;if(t.customStickers){o-=1}t.sprite.spriteIdList=t.sprite.spriteIdList.sort((r,n)=>{const a=t.sprite.common[r].order;const l=t.sprite.common[n].order;return a-l});await this.editor.spriteStore.updateStateFromSerialization(t.sprite,t.customStickers,Math.max(0,o))}if(t.brush){this.editor.brushToolStore.updateStateFromHistory(t.brush)}if(t.frame){await this.editor.frameToolStore.updateStateFromSerialization(t.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(o){if(o.name==="AssetNotFoundError"){console.error(o)}else{console.error(o);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:o.message,handleConfirm:()=>{this.applyStateOnUI(t)}})}}}};var Zy=i=>{const t=atob(i.split(",")[1]);const e=i.split(",")[0].split(":")[1].split(";")[0];const o=new ArrayBuffer(t.length);const r=new Uint8Array(o);for(let n=0;ni.split(",")[0].split(":")[1].split(";")[0];var dh=i=>{if(typeof i==="string"){return ch(i)}if(i.src.includes(".svg")){return"image/svg+xml"}if(i.src){return ch(i.src)}return"image/jpeg"};var Un=Rt(Dc());var gr=class{static isImageElement(t){return t instanceof HTMLImageElement}constructor({license:t,assetProvider:e,crossOrigin:o,backgroundColor:r}){this.crossOrigin=o;this.engine=new Fr({license:t,crossOrigin:o,assetProvider:e,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:r})}getAllFilterPreviewThumbnails(t){return new Promise((e,o)=>{const r=[];const n=[];t.forEach(a=>{if(a.isDuotone)r.push(a.identifier);else n.push(a.identifier)});this.getAllDuotonePreview(r).then(a=>{this.getAllLutPreview(n).then(l=>{e(Object.assign(a,l))}).catch(l=>{o(l)})}).catch(a=>{o(a)})})}async getAllDuotonePreview(t){const e={};if(!t.length)return e;const o=await this.engine.addDuoToneFilterFromAssets(t[0],this.container);await(0,Un.default)(t,async r=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(r);const a=o.filterOperation.getFilter();a.set({intensity:.5,lightColor:Ps.Color.fromHex(n.lightColor),darkColor:Ps.Color.fromHex(n.darkColor)});const l=await this.engine.export("data-url","image/jpeg",.8,false,true);e[r]=l},{concurrency:1});this.engine.removeEffect(o);return e}async loadLutAssets(t){const e={};await(0,Un.default)(t,async o=>{e[o]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",o))});return e}async getAllLutPreview(t){const e={};if(!t.length)return e;const o=await this.loadLutAssets(t);const r=await this.engine.addLUTFilterFromAssets(t[0],this.container);await(0,Un.default)(t,async n=>{const a=this.engine.assetProvider.getLUTFilterAsset(n);const l=r.filterOperation.getFilter();const c={horizontalTileCount:a.horizontalTileCount||5,verticalTileCount:a.verticalTileCount||5,image:o[n]};l.set({...c,intensity:a.defaultIntensity||1});r.setProperties({intensity:1});l._lutPrimitive.set(c);const d=await this.engine.export("data-url","image/jpeg",.8,false,true);e[n]=d},{concurrency:1});this.engine.removeEffect(r);return e}addImageToContainer(t){return new Promise((e,o)=>{let r;if(gr.isImageElement(t)){r=t;this.setBackgroundImage(r);e()}else{this.getImageElement(t).then(n=>{r=n;this.setBackgroundImage(r);e()}).catch(n=>{o({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,o)=>{const r=new Image;r.addEventListener("load",()=>{e(r)});r.addEventListener("error",n=>{o(n)});r.crossOrigin=this.crossOrigin;r.src=t})}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t})}const{size:e}=this.container.getBounds();const o=this.engine.getOutputContainer();o.setResolution(e)}};var Qy={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};var Qt=class{constructor(t){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(t,e)=>{const{height:o,width:r}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:a,snapToTop:l,snapToBottom:c}=this.configStore.config.snapping.position;const d=Math.min(o,r);let u=0;if(e==="bottom"){u=Math.round(o-d*c)}else if(e==="top"){u=Math.round(d*l)}else if(e==="right"){u=Math.round(r-d*a)}else if(e==="left"){u=Math.round(d*n)}else if(t==="vertical"&&e==="center"){u=Math.round(r/2)}else if(t==="horizontal"&&e==="center"){u=Math.round(o/2)}return u};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:t,snapToLeft:e,snapToRight:o}=this.configStore.config.snapping.position;const r=[];if(t){r.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(e){r.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(o){r.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return r};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:t,snapToTop:e,snapToBottom:o}=this.configStore.config.snapping.position;const r=[];if(t){r.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(e){r.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(o){r.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return r};this.getRotationGuidesFromConfig=()=>{const{angles:t}=this.configStore.config.snapping.rotation;const e=[];t.forEach(r=>{e.push(r);e.push(r+360);e.push(r-360)});const o=e.filter((r,n)=>e.indexOf(r)===n);return o.map(r=>({value:r*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:t,leftBottom:e,rightTop:o,rightBottom:r})=>{const n=Math.min(t.y,o.y,e.y,r.y);const a=Math.max(t.y,o.y,e.y,r.y);const l=Math.min(t.x,o.x,e.x,r.x);const c=Math.max(t.x,o.x,e.x,r.x);return{height:Math.round(a-n),width:Math.round(c-l)}};this.mapRange=({value:t,fromMin:e,fromLength:o,toMin:r,toLength:n})=>{return(t-e)*n/o+r};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(t,e,o,r)=>{if(e.length===0){return t}if(e[0]>t){return t-o}for(let n=0;n=l-m){return l+u+(r?o*2:0)}return this.mapRange({value:t,fromMin:a,fromLength:l-a,toMin:c,toLength:d-c})}}if(r){return t+(e.length-1)*o*2+o}return t};this.mapFromSnapSystem=(t,e,o,r)=>{if(e.length===0){return t}if(e[0]>t){if(t>=e[0]-o){return e[0]}return t+o}let n=t;for(let l=0;l{const o=e*.5;const{value:r,edge:n}=t;let a=r;if(n==="leading"){a+=o}else if(n==="trailing"){a-=o}return a};this.mapSnappingGuidesToCenter=(t,e)=>{const o=[];t.forEach(r=>{o.push(this.centerSnapValue(r,e))});return o};this.calcSnapThresholdInRadians=(t,e)=>{if(t===0){return 0}return e/t};this.calculatePreviewTopLeftPosition=()=>{const t=this.editor.engineMediator.preview.container.getPosition();const e=this.editor.getPreviewSize();const o=Xt();this.previewTopLeftPosition={x:t.x/o-e.width/2,y:t.y/o-e.height/2}};this.snapToRotation=(t,e,o)=>{const{rotationGuides:r}=this.state;const{enabled:n,threshold:a}=this.configStore.config.snapping.rotation;const{x:l,y:c}=this.previewTopLeftPosition;const{width:d}=this.editor.getPreviewSize();let u=(t+Math.PI*2)%(Math.PI*2);if(n){const m=new g(e).magnitude;const f=r.map(v=>v.value).sort((v,x)=>v-x);const b=this.calcSnapThresholdInRadians(m,a);if(!this.rotationOffset){const v=this.mapToSnapSystem(t,f,b,false);this.rotationOffset=v-u}u=this.mapFromSnapSystem(u+this.rotationOffset,f,b,false);const y={x:o.position.x-l-d,y:o.position.y-c};r.forEach(v=>{v.isVisible=v.value===u;v.position=y});return u}return t};this.snapToPosition=(t,e)=>{const{horizontalGuides:o,verticalGuides:r}=this.state;const{enabled:n,threshold:a}=this.configStore.config.snapping.position;const l=new g(this.previewTopLeftPosition);const{height:c,width:d}=this.getSpriteDimensions(e);const{x:u,y:m}=new g(t).subtract(l);if(n){const f=this.mapSnappingGuidesToCenter(o,c).sort((x,C)=>x-C);const b=this.mapSnappingGuidesToCenter(r,d).sort((x,C)=>x-C);if(!this.positionOffset){const x=this.mapToSnapSystem(u,b,a,true);const C=this.mapToSnapSystem(m,f,a,true);this.positionOffset=new g(x,C).subtract(new g(u,m))}let y=this.mapFromSnapSystem(u+this.positionOffset.x,b,a,true);let v=this.mapFromSnapSystem(m+this.positionOffset.y,f,a,true);y=Math.round(y);v=Math.round(v);o.forEach(x=>{const C=Math.round(this.centerSnapValue(x,c));x.isVisible=C===v});r.forEach(x=>{const C=Math.round(this.centerSnapValue(x,d));x.isVisible=C===y});return new g(y,v).add(l)}return{x:u,y:m}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=t;this.configStore=t.configStore;this.state=T(Qy);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(t=>({...t,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(t=>({...t,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(t=>({...t,isVisible:false}))}get positionGuides(){const{verticalGuides:t,horizontalGuides:e}=this.state;return[...t,...e]}get rotationGuides(){return this.state.rotationGuides}};s([T],Qt.prototype,"state",2);s([p],Qt.prototype,"snapToRotation",2);s([p],Qt.prototype,"snapToPosition",2);s([p],Qt.prototype,"hidePositionGuides",1);s([p],Qt.prototype,"hideRotationGuides",1);s([p],Qt.prototype,"dispose",2);s([h],Qt.prototype,"positionGuides",1);s([h],Qt.prototype,"rotationGuides",1);var Gn=class{constructor(t,e){this.initWithImage=async t=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(t);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const e=this.configStore.config.engine;this.previewThumbnails=new gr({...e,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:e.identifier?e.identifier:"rendering",error:e,handleConfirm:()=>{this.initWithImage(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:t,height:e})=>{const{maxMegaPixels:o}=this.configStore.config.engine.downscaleOptions;const r=kc.isMobile()?o.mobile:o.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${r}`,width:`${t}`,height:`${e}`}})})};this.init=t=>{var r,n;if(!((r=this.activeStore)==null?void 0:r.image)){this.initWithImage(t);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const e=this.historyStore.isDirty();const{displayDiscardChangesWarning:o}=this.configStore.config;if(e&&o){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(t);this.resetToolStates()},handleDismiss:()=>{this.setImage(t,true)}});return}if(e&&!o){this.setImage(t,true);return}this.historyStore.reset();this.setImage(t,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:a,displayCanvasRendererWarning:l}=this.configStore.config;if(a.preferredRenderer==="canvas"&&l){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(t,e=false)=>{try{if(!this.activeStore.image){this.initWithImage(t)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(t);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:o,flipVertically:r,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:r,flipHorizontally:o});await this.transformToolStore.rotateOutputContainer(Pc(n),false);if(e){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const a=this.activeStore.tool;if(!a){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(o){this.configStore.events.onErrorImageLoading(o);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:o.identifier?o.identifier:"rendering",error:o,handleConfirm:()=>{this.setImage(t,e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(o)}};this.onToolChange=(t,e=null,o=true)=>{var r,n;if(t===e){return}if((n=(r=this.engineMediator)==null?void 0:r.preview)==null?void 0:n.container){if([t,e].indexOf("transform")!==-1){if(t==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(e==="transform"){this.transformToolStore.onEnter()}this.resize(e)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(o){this.render()}}};this.resize=(t=null)=>{if(!this.engineMediator)return;try{const e=this.activeStore.tool;const o=t==="transform"||!t&&e==="transform";this.canvasStore.resizeCanvas(t);this.transformToolStore.applyDefaultCrop();const r=I(this.transformToolStore.maxCropMaskSize);if(!o){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const a=this.engineMediator.preview.updateTransform(n);if(a){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(r);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const l=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(l);if(!o){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:t,...e}={})=>{const o=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(o){this.transformToolStore.onLeave()}const{config:r}=this.configStore;const n={...r.export.image,...e};const{exportType:a,format:l,quality:c,enableDownload:d,transparent:u}=n;const m=await this.engineMediator.engine.export(a,l,c,u);if(o&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(d){this.triggerFileDownload(r.export.filename,l,a,m)}if(!t){this.configStore.events.onExport(m)}return m}catch(r){if(this.modalStore){this.modalStore.hideModal()}if(o&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(r)}};this.serialize=({image:t}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:t})}return Promise.resolve({})};this.deserialize=t=>{if(this.serializationMediator){return this.serializationMediator.deserialize(t)}return Promise.resolve()};this.close=()=>{var t,e,o,r,n,a;if((((t=this.historyStore)==null?void 0:t.isDirtySinceSave)||((o=(e=this.transformToolStore)==null?void 0:e.transformHistory)==null?void 0:o.hasChanges()))&&((n=(r=this.configStore)==null?void 0:r.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var l;if((l=this.configStore)==null?void 0:l.events){this.configStore.events.onClose()}}})}else if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:t,height:e}=this.engine.getOutputDimensions();return{width:t,height:e}}return{width:0,height:0}};this.wait=(t=0)=>new Promise(e=>setTimeout(e,t));this.clickableCanvas=async t=>{if(t){await new Promise(e=>setTimeout(e,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:t}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(t){const e=this.transformToolStore.localOutputImageSize;const o=e.width/e.height;const r=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(r.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(r.indexOf(parseFloat(o.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(t,e,o)=>{this.historyStore.addSnapshot(t,e,o)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=t=>this.assetProvider.getPathForCategory(t);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=t=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(t)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:t,height:e}=this.engine.getOutputDimensions();if(t&&e){return{width:Math.round(this.worldToPreview(this.outputToWorld(t))),height:Math.round(this.worldToPreview(this.outputToWorld(e)))}}return{height:e,width:t}};this.getImageMimeType=()=>{return dh(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var t,e,o;(o=(e=(t=this.engineMediator)==null?void 0:t.image)==null?void 0:e.container)==null?void 0:o.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(t,e,o,r)=>{const n=e==="image/jpeg"&&o!=="ms-blob"?".jpeg":".png";const a=t+n;const l=this.blobFromExportData(r);this.triggerBlobDownload(a,l)};this.triggerBlobDownload=(t,e)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(e,t)}else{const o=document.createElement("a");const r=URL.createObjectURL(e);o.href=r;o.download=t;document.body.appendChild(o);o.click();document.body.removeChild(o);if(!nc()){URL.revokeObjectURL(r)}}};this.blobFromExportData=t=>{if(typeof t==="string"){return ll(t)}if(t instanceof HTMLImageElement){return ll(t.src)}return t};this.configStore=new St;if(e){Object.entries(e).forEach(([r,n])=>{this.configStore.events.on(r,n)})}const o=this.configStore.saveConfig(t);this.engineMediator=new el(this);this.serializationMediator=new fr(this);this.spriteStore=new k(this);this.scale=new ct(this);this.filterToolStore=new ot(this);this.adjustmentsToolStore=new G(this);this.focusToolStore=new $(this);this.overlayToolStore=new at(this);this.frameToolStore=new Z(this);this.brushToolStore=new J(this);this.transformToolStore=new w(this);this.libraryStore=new Mt(this);this.modalStore=new Bt(this);this.snappingStore=new Qt(this);this.activeStore=new It(this);this.canvasStore=new yt(this);this.historyStore=new Fi(this);this.libraryStore.initProvider(o);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const t=this.outputContainer.getBounds();return Math.min(t.width,t.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(t,e){if(!this.engineMediator)return{x:0,y:0};if(re(t)){return this.engineMediator.previewSpaceToWorldSpace(t,e)}return this.engineMediator.previewSpaceToWorldSpace(t,e)}worldToPreview(t){if(!this.engineMediator)return{x:0,y:0};if(re(t)){return this.engineMediator.worldSpaceToPreviewSpace(t)}return this.engineMediator.worldSpaceToPreviewSpace(t)}worldSizeToPreview(t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(t.width),height:this.engineMediator.worldSpaceToPreviewSpace(t.height)}}previewSizeToWorld(t,e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(t.width,e),height:this.engineMediator.previewSpaceToWorldSpace(t.height,e)}}outputToWorld(t){if(!this.engineMediator)return{x:0,y:0};if(re(t)){return this.engineMediator.outputSpaceToWorldSpace(t)}return this.engineMediator.outputSpaceToWorldSpace(t)}previewToOutput(t){if(!this.engineMediator)return{x:0,y:0};if(re(t)){return this.engineMediator.previewSpaceToOutputSpace(t)}return this.engineMediator.previewSpaceToOutputSpace(t)}get outputContainer(){return this.engineMediator.output.container}};s([p],Gn.prototype,"resize",2);s([p],Gn.prototype,"export",2);s([p],Gn.prototype,"clickableCanvas",2);import ph from"react";var hh=({children:i})=>ph.createElement(ph.Fragment,null,i);import iv from"react";import tv from"styled-components";var uh=tv(Pi)` + 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:a},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};var Za=By;var hr=Wn();var Nn=Fn();var Lt={...hr,measurements:Nn};var Fy=i=>{if(i==="light"){return Za}return Wn};var ih=(i,t)=>{const e=Fy(i);if(t&&t[i]){const{primary:o,background:r,foreground:n}=t[i];const a={primary:o,background:r,foreground:n};const l=Object.keys(a).reduce((c,d)=>{if(a[d]){return{...c,[d]:a[d]}}return c},{});return kt([e(l),t[i]])}return e()||hr};var Ry=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];var oh=i=>{const t=Fn();if(i){const e={};Object.keys(i).forEach(o=>{if(Ry.indexOf(o)!==-1){e[o]=i[o]}});return kt([t,e])}return t};var Hy={config:wo,locale:Oi,theme:hr,measurements:Nn,initialMeasurements:Nn};var St=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(t,e)=>{return e.indexOf(t)!==-1};this.state=T(Hy);this.events=new Ka;this.licenseChecker=null}saveConfig(t){if(t.mainCanvasActions&&t.mainCanvasActions.length!==4){t.mainCanvasActions.length=4}const e=t.layout&&t.layout==="basic"?qa:wo;const o=kt([e,t],{clone:true});this.licenseChecker=new Fc(o.license);if(!this.licenseChecker.areCustomAssetsAllowed()){o.sticker.enableCustomUpload=false}const r=eh(o.language,o.custom.languages);const n=ih(o.theme,o.custom.themes);const a=oh(o.custom.measurements);const{provider:l}=o.library;const c=[];o.adjustment.categories=o.adjustment.categories.reduce((m,f)=>{m.push({...f,items:f.items.filter(b=>{if(!pc[b.identifier]){c.push(b.identifier);return false}return true})});return m},[]);if(c.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${c.join(", ")}`)}delete o.language;delete o.custom.languages;delete o.custom.themes;delete o.library.provider;let d=o.tools.reduce((m,f)=>{if(typeof f==="object"){return[...m,...f]}return[...m,f]},[]);if(!d.length){console.error(`Empty list input for tools`);d=On.reduce((m,f)=>{if(typeof f==="object"){return[...m,...f]}return[...m,f]},[])}d=d.filter(m=>this.licenseChecker.isToolAllowed(m));if(o.defaultTool){const m=this.checkDefaultToolAvailability(o.defaultTool,d);if(!m){[o.defaultTool]=d}}o.tools=d;this.state.config=o;this.state.locale=r;this.state.theme=n;this.state.measurements=a;this.state.initialMeasurements=a;const u=this.buildCustomAssetsConfig();this.assetProvider=new Ec(u,this.licenseChecker.areCustomAssetsAllowed(),o.assetResolver);this.loadThemeFont();return l}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((t,e)=>{if(typeof e==="string"){return[...t,e]}return[...t,"",...e]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:t}=this.theme;if(!t.skipLoading){this.assetProvider.getFontManager().injectFonts([t])}}buildCustomAssetsConfig(){const t=this.tools;const e=I(this.state.config);const o=this.state.config.assetBaseUrl;const{theme:r}=this.state;const n=t.indexOf("filter")!==-1?e["filter"]:void 0;const a=t.indexOf("focus")!==-1?e["focus"]:void 0;const l=t.indexOf("adjustment")!==-1?e["adjustment"]:void 0;const c=t.indexOf("sticker")!==-1?e["sticker"]:void 0;const d=t.indexOf("frame")!==-1?e["frame"]:void 0;const u=t.indexOf("overlay")!==-1?e["overlay"]:void 0;const m=t.indexOf("transform")!==-1?e["transform"]:void 0;const f=t.indexOf("text")!==-1?e["text"]:void 0;const b=t.indexOf("textdesign")!==-1?e["textdesign"]:void 0;return{basePath:o,theme:r,filter:n,focus:a,sticker:c,frame:d,overlay:u,transform:m,text:f,adjustment:l,textdesign:b}}};s([p],St.prototype,"saveConfig",1);s([p],St.prototype,"dispose",2);s([h],St.prototype,"config",1);s([h],St.prototype,"locale",1);s([h],St.prototype,"theme",1);s([h],St.prototype,"measurements",1);s([h],St.prototype,"initialMeasurements",1);s([h],St.prototype,"tools",1);s([h],St.prototype,"defaultTool",1);s([h],St.prototype,"isOrderDefault",1);s([h],St.prototype,"isLayoutAdvanced",1);s([h],St.prototype,"displayCloseButton",1);var Qa=class{constructor(t){this.editor=t}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,originalImage:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t,originalImage:t})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((t,e)=>{const{image:o}=this.editor.activeStore;if(lc(o)){this.setBackgroundImage(o);t()}else{const r=this.editor.libraryStore.getRawUrl(o);this.getImageElement(r).then(n=>{this.setBackgroundImage(n);t()}).catch(n=>{e({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,o)=>{const r=new Image;r.addEventListener("load",()=>{e(r)});r.addEventListener("error",n=>{o(n)});r.crossOrigin=this.editor.configStore.config.engine.crossOrigin;r.src=t})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}};var tl=class{constructor(t){this.applyNewImageTransform=()=>{const{size:t,width:e,height:o}=this.editor.engineMediator.image.container.getBounds();const r=this.container;r.setTransform(ve.IDENTITY);r.setResolution(t);r.setPivot(.5,.5);r.setPosition({x:e/2,y:o/2})};this.editor=t}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}};function ur(i,t){const e=i.width/i.height;const o=t.width/t.height;if(e>o){return i.height/t.height}return i.width/t.width}var _y={transform:ve.IDENTITY};var Me=class{constructor(t){this.initialTransform=ve.IDENTITY;this.editor=t;this.state=T(_y)}createPreview(t){this.container=this.editor.engine.createPreview(t)}updateTransform(t=0,e=true){const o=this.calculateTransform(t);if(o.scale.x){if(e){this.saveInitialTransform(o)}else{this.savePreviewTransform(o)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(t){this.initialTransform=t;this.savePreviewTransform(t)}savePreviewTransform(t){nt(()=>{this.state.transform.position=t.position;this.state.transform.scale=t.scale;this.state.transform.rotation=t.rotation;const e=Xt();const o=new g(t.scale).divide(e);this.previewTransformWithoutDpr={position:new g(t.position).divide(e),scale:o,rotation:t.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(t=0){const e=Xt();const{scaleImageToFit:o}=this.editor.configStore.config;const{width:r,height:n}=this.editor.canvasStore.canvasSize;const a=this.editor.engine.getOutputDimensions();const l=ur({width:r,height:n},a);let c=o?l:Math.min(1,l);const d=n-a.height*c;const u=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(dn*m){c=ur({width:r,height:n*m},a)}if(a.width*c>r*m){c=ur({width:r*m,height:n},a)}c*=e;const f={x:r*e/2,y:n*e/2};const b={x:c,y:c};return new ve(f,b,t)}};s([p],Me.prototype,"updateTransform",1);s([p],Me.prototype,"savePreviewTransform",1);s([h],Me.prototype,"transform",1);s([h],Me.prototype,"position",1);s([h],Me.prototype,"scale",1);s([h],Me.prototype,"rotation",1);var Ne=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(t){if(["sticker","text","textdesign","brush"].indexOf(t)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(t,e){const o=e.findIndex(r=>r===t);if(o!==-1){e.splice(o,1)}return void 0}static indexForOrder(t,e,o){const r=t[o];const n=e.findIndex(l=>l===o);if(n!==-1){return{index:n,order:e}}const{length:a}=e;if(a){let l;for(l=0;lr===t);if(o!==-1){this.spriteContainerOrder[o]=e}}bringToFront(t){const e=this.spriteContainerOrder.findIndex(o=>o===t);if(e!==-1){this.spriteContainerOrder.splice(e,1);this.spriteContainerOrder.push(t)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:t}=this.spriteContainerOrder;return this.spriteContainerOrder[t-1]}getSpriteIndex(t){const e=this.spriteContainerOrder.findIndex(o=>o===t);return e+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};var Vn=Ne;Vn.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3};var el=class{constructor(t){this.orderHelper=new Vn;this.init=()=>{const t=this.editor.configStore.config.engine;this.engine=new Fr({...t,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new Qa(this.editor);this.output=new tl(this.editor);this.preview=new Me(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=t}render(t){return this.engine.render(t)}previewSpaceToWorldSpace(t,e){const o=this.preview.previewTransformWithoutDpr;if(re(t)){const r=this.editor.engine.convertPointFromPreviewIntoWorldSpace(g.ZERO,o,e);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:t,y:0},o,e);return g.distance(new g(r),new g(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(t,o,e)}worldSpaceToPreviewSpace(t){const e=this.preview.previewTransformWithoutDpr;if(re(t)){const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace(g.ZERO,e);const r=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:t,y:0},e);return g.distance(new g(o),new g(r))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(t,e)}outputSpaceToWorldSpace(t){if(re(t)){return zs.getScalarInWorldSpace(t,this.editor.engine.getOutputContainer())}return zs.getPointInWorldSpace(t,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(t){const e=this.preview.previewTransformWithoutDpr;if(re(t)){const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace(g.ZERO,e);const r=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:t,y:0},e);return g.distance(new g(o),new g(r))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(t,e)}previewSpaceToFlippedPreviewSpace(t){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(t)}};var Mo=class{constructor(){this.snapshots=[];this.observeIndex=T.box(-1)}addSnapshot(t){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(t))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(t)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(t){if(t>0&&t0}get canRedo(){return this.snapshots.length-1>this.index}};s([h],Mo.prototype,"index",1);s([h],Mo.prototype,"canUndo",1);s([h],Mo.prototype,"canRedo",1);var Fi=class{constructor(t){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const t=this.appHistoryManager.undo();await this.applyState(t);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const t=this.appHistoryManager.redo();await this.applyState(t);this.awaitHistoryChange=false}};this.editor=t;this.appHistoryManager=new Mo}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const t=I(this.editor.adjustmentsToolStore.state);const e=I(this.editor.filterToolStore.state);const o=this.editor.focusToolStore.getFocusStateForHistory();const r=I(this.editor.overlayToolStore.state);const n=I(this.editor.frameToolStore.state);const{strokes:a}=this.editor.brushToolStore;const l=this.editor.spriteStore.getSpriteHistoryState();const c=this.editor.transformToolStore.serializableState;return{["adjustment"]:t,["filter"]:e,["focus"]:o,["overlay"]:r,["frame"]:n,["brush"]:a,sprite:l,["transform"]:c}}addInitialSnapshot(){const t=this.getHistoryState();this.appHistoryManager.addSnapshot({state:t,type:"add",description:"Initial State"})}addSnapshot(t,e,o){let r;if(!t){r=this.getHistoryState()}else if(t.sprite||t.transform){r={...this.getHistoryState(),...t}}else{r=t}this.appHistoryManager.addSnapshot({state:r,type:e,description:o});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:t}){try{if(t){const e=Object.keys(t);for(const o of e){switch(o){case"filter":await this.editor.filterToolStore.updateStateFromHistory(t[o]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(t[o]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(t[o]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(t[o]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(t[o],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(t[o]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(t[o]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(t[o]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(e){console.error(e);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:e,handleConfirm:()=>{this.applyState({state:t})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var t,e;return(e=(t=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:t.state)==null?void 0:e.sprite}};s([p],Fi.prototype,"undo",2);s([p],Fi.prototype,"redo",2);s([h],Fi.prototype,"canUndo",1);s([h],Fi.prototype,"canRedo",1);var $y=(i,t)=>new Promise((e,o)=>{const r=new XMLHttpRequest;r.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){e(n.result)}else{o(new Error(`The image could not be loaded from ${i}`))}};n.onerror=a=>{o(a)};n.readAsDataURL(r.response)};r.open("GET",i);r.responseType="blob";r.withCredentials=t==="use-credentials";r.send()});var rh=(i,t)=>{return new Promise((e,o)=>{const r=new Image;r.onload=()=>{e(r)};r.onerror=()=>{o(new Error(`Failed to load image with src:${i}`))};r.crossOrigin=t;r.src=i})};var Wy=(i,t)=>new Promise((e,o)=>{$y(i,t).then(r=>{const n=new Image;n.addEventListener("load",()=>{e(n)});n.src=r}).catch(()=>{rh(i,t).then(r=>e(r)).catch(r=>{o(r)})})});var il=async({url:i,image:t,crossOrigin:e="anonymous"})=>{try{if(t&&t.src&&t.src.substr(0,5)==="data:"||t&&t.src&&t.src.includes(".svg")){return t}if(typeof i==="string"&&i.substr(0,5)==="data:"||typeof i==="string"&&i.includes(".svg")){return rh(i,e)}return Wy(i||t.src,e)}catch(o){throw new Error(o)}};var Ny={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};var It=class{constructor(t){this.setImage=async t=>{try{const{crossOrigin:e}=this.editor.configStore.config.engine;if(typeof t==="string"&&!t.trim()||t===void 0||t===null){this.state.image=null}else if(typeof t==="string"){this.state.image=await il({url:No(t)?t:this.editor.assetProvider.getPath(t),crossOrigin:e})}else if(t instanceof HTMLImageElement){this.state.image=await il({image:t,crossOrigin:e})}if(this.isWebcam){this.state.isWebcam=false}}catch(e){throw new Error(e)}};this.setImageLoadedToEngine=t=>{this.state.imageLoadedToEngine=t};this.newImage=t=>{this.editor.init(t)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=t;this.state=T(Ny)}selectTool(t){var o,r,n;const{licenseChecker:e}=this.editor.configStore;if(this.state.tool!==t&&(e==null?void 0:e.isToolAllowed(t))&&(this.image||t==="library"||t==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const a=(n=(r=(o=this.editor.configStore.state.config["customTool"])==null?void 0:o.measurements)==null?void 0:r.advancedUIToolControlBar)==null?void 0:n.width;if(a){if(t==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=a}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,t);this.state.tool=t;this.editor.configStore.events.onToolChanged(t);switch(t){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(t){this.state.isWebcam=t}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};s([p],It.prototype,"selectTool",1);s([p],It.prototype,"selectWebcam",1);s([p],It.prototype,"setImage",2);s([p],It.prototype,"setImageLoadedToEngine",2);s([p],It.prototype,"newImage",2);s([p],It.prototype,"dispose",2);s([h],It.prototype,"webcamLabel",1);s([h],It.prototype,"tool",1);s([h],It.prototype,"isWebcam",1);s([h],It.prototype,"image",1);s([h],It.prototype,"imageLoadedToEngine",1);var Vy={height:150,width:150};var ol={height:0,width:0};var rl=class{constructor(t){this.canvasClickDisabled=T.box(false);this.resizeCanvas=(t=null)=>{const e=this.editor.activeStore.tool;const o=t==="transform"||!t&&e==="transform";const{isLayoutAdvanced:r,measurements:n}=this.editor.configStore;const{storedSize:a}=this.editor.canvasStore;let l=0;if(!r&&o){l=n.basicUIToolControlBar.controlsBarHeight*-1;if(t==="transform"&&e==="brush"){l-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:a.width,height:a.height+l})};this.setCanvasSize=t=>{this.state.canvasSize=t};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=t;this.state=T(rl.initialState)}setCanvasElement(t){this.canvas=t;this.editor.engineMediator.preview.createPreview(t);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:t,width:e,render:o}){const{imageLoadedToEngine:r}=this.editor.activeStore;if(t>ol.height&&e>ol.width){this.state.storedSize={width:e,height:t};if(this.state.canvasSize.height===0){this.state.canvasSize={width:e,height:t}}if(o&&r){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return g.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(t){const e=this.editor.engine.getContainersAtPreviewPoint(t,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(o=>o.getID()).filter(o=>o!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(e)}};var yt=rl;yt.initialState={canvasSize:ol,storedSize:Vy};s([p],yt.prototype,"setCanvasElement",1);s([p],yt.prototype,"saveDimensions",1);s([p],yt.prototype,"resizeCanvas",2);s([p],yt.prototype,"disableCanvasClick",1);s([p],yt.prototype,"enableCanvasClick",1);s([p],yt.prototype,"setCanvasSize",2);s([p],yt.prototype,"dispose",2);s([h],yt.prototype,"isCanvasClickable",1);s([h],yt.prototype,"canvasSize",1);s([h],yt.prototype,"storedSize",1);s([h],yt.prototype,"sizeVector",1);s([h],yt.prototype,"sizeVectorMagnitude",1);var Uy={type:null,identifier:null,isVisible:false,error:""};var Bt=class{constructor(t){this.showActionModal=({type:t,identifier:e,error:o,handleConfirm:r,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=e;this.state.type=t;this.state.error=o||"";this.handleConfirm=r;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=t.configStore;this.state=T(Uy)}showInfoModal(t){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=t;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:t}=this.state;const e=this.getModalLocale();if(e){const{bodyLabel:o,headerLabel:r,buttonYes:n,buttonNo:a}=e;return{headerLabel:r,bodyLabel:o,confirmLabel:n,dismissLabel:a,isVisible:t,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:t,measurements:{basicCanvasOffset:e,advancedUIToolControlBar:o,advancedUIToolbar:r},isOrderDefault:n}=this.configStore;const a=(o.width+r.width)*(!n?-1:1);const l=e;return t?{x:a/2,y:0}:{x:0,y:-l}}getModalLocale(){const{identifier:t,error:e,type:o}=this.state;const{locale:r}=this.configStore;if(!o||!t||o==="textEdit")return null;if(o&&t&&r[`${o}Modals`]&&r[`${o}Modals`][t]){const n=r[`${o}Modals`][t];let{body:a}=n;if(a&&typeof e==="object"){Object.keys(e).forEach(c=>{a=a.replace(`\${${c}}`,e[c])})}else if(a){a=a.replace("${error}",e)}let l=n.heading;if(o==="error"||o==="warning"){const c={error:r.common.error,warning:r.common.warning};const d=o==="error"?c.error:c.warning;l=`${d}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:a,headerLabel:l,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};s([p],Bt.prototype,"showActionModal",2);s([p],Bt.prototype,"showInfoModal",1);s([p],Bt.prototype,"showTextEditModal",1);s([p],Bt.prototype,"hideModal",2);s([p],Bt.prototype,"dispose",2);s([h],Bt.prototype,"modalProps",1);s([h],Bt.prototype,"isVisible",1);s([h],Bt.prototype,"type",1);s([h],Bt.prototype,"identifier",1);s([h],Bt.prototype,"positionOffset",1);var ct=class{constructor(t){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(t=>t/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:t,maxOffsetY:e}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=e}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=t}this.savePosition();this.scaleRender()}};this.setOffset=t=>{const{canDragX:e,canDragY:o}=this.checkOffset(t);if(e){this.offset.x=t.x}if(o){this.offset.y=t.y}this.scaleRender()};this.editor=t}setInitialTransform(t=0){const e=Xt();const{scaleImageToFit:o}=this.editor.configStore.config;const{transform:r}=this.editor.engineMediator.preview;nt(()=>{const n=Math.abs(t||r.scale.x);this.setDefaultScale(o?n:Math.min(1*e,n));this.setPosition(r.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:t,height:e}=this.editor.canvasStore.canvas;this.setPosition({x:t/2,y:e/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(t){this.state.position.x=t.x;this.state.position.y=t.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(t){if(this.defaultScale!==1){const o=this.SCALE_LEVELS.findIndex(r=>r===this.defaultScale);if(o!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,o),...this.SCALE_LEVELS.slice(o+1)]}}const e=this.SCALE_LEVELS.findIndex(o=>o===t);if(e!==-1){this.state.scaleIndex=e}else{const o=this.SCALE_LEVELS.findIndex((r,n)=>{if(n===0){return t0;const y=u>0;const v=m-l;const x=f-c;return{canDragX:v<0,canDragY:x<0,maxOffsetX:b?-v:v,maxOffsetY:y?-x:x}}calculateScale(t=0,e=this.previewSize,o=this.defaultScale){const{width:r,height:n}=e;const a=new g({x:r,y:n});const l=new g(Math.abs(a.x*Math.cos(t))+Math.abs(a.y*Math.sin(t)),Math.abs(a.x*Math.sin(t))+Math.abs(a.y*Math.cos(t)));const c=a.subtract(l).divide(2).multiply(o).abs;if(c.y>c.x){return c.y*2/a.y+o}return c.x*2/a.x+o}get defaultIndex(){return this.SCALE_LEVELS.findIndex(t=>t===this.defaultScale)}getPositionWithOffset(t=this.offset){const{position:e}=this;return{x:e.x-t.x,y:e.y-t.y}}scaleRender(t=false){const e=this.editor.scale.getPositionWithOffset();const o=t?this.defaultScale:this.scale;const r={x:o,y:o};this.editor.engineMediator.preview.container.setScale(r);this.editor.engineMediator.preview.container.setPosition(e);this.editor.engineMediator.preview.savePreviewTransform({scale:r,position:e,rotation:0});if(!t){this.editor.render()}}get scale(){const t=this.state.scaleIndex;return t!==-1?this.SCALE_LEVELS[t]:this.defaultScale}get zoomLevel(){const t=Xt();return(this.scale/t*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const t=this.state.scaleIndex;const e=t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;const{previewSize:o}=this;return{width:o.width*e/this.defaultScale,height:o.height*e/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};s([T],ct.prototype,"state",2);s([p],ct.prototype,"in",2);s([p],ct.prototype,"out",2);s([p],ct.prototype,"setInitialTransform",1);s([p],ct.prototype,"resetScale",1);s([p],ct.prototype,"resetPosition",1);s([p],ct.prototype,"setPosition",1);s([p],ct.prototype,"savePosition",1);s([p],ct.prototype,"setDefaultScale",1);s([p],ct.prototype,"setScaleToDefault",1);s([h],ct.prototype,"scale",1);s([h],ct.prototype,"zoomLevel",1);s([h],ct.prototype,"canDrag",1);s([h],ct.prototype,"canZoomOut",1);s([h],ct.prototype,"canZoomIn",1);s([h],ct.prototype,"position",1);s([h],ct.prototype,"scaledSize",1);var nh=[[0,0],[0,1],[1,0],[1,1]];var Gy=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];var he=class{constructor(t,e,o="center",r=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=e;this.m=o==="center"?he.movePivotTo([.5,.5]):nh;this.considerRotation=r;this.considerFlip=n;this.configStore=t.configStore}static getFlippedEdgeIndex(t,e,o){return Gy[(e?1:0)+(o?2:0)][t]}static movePivotTo(t){return nh.map(e=>[e[0]-t[0],e[1]-t[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(t,e,o){const r=he.getFlippedEdgeIndex(t,e,o);const n=this.m[r][0]*this.size.width;const a=this.m[r][1]*this.size.height;return{width:n,height:a}}get leftTop(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(0,e,o);return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottom(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(1,e,o);return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightTop(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(2,e,o);return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottom(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(3,e,o);return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(1,e,o);r.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:o}=this;const r=this.handleOrigin(3,e,o);r.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return he.coordinatesWithRotation(r,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftMid(){const t=new g(this.leftTop);const e=new g(this.leftBottom);return t.add(e).divide(2)}get rightMid(){const t=new g(this.rightTop);const e=new g(this.rightBottom);return t.add(e).divide(2)}};var tt=he;tt.coordinatesWithRotation=({width:t,height:e},o,r,n,a,l)=>{let c=t*Math.cos(o)-e*Math.sin(o)+l.x;let d=t*Math.sin(o)+e*Math.cos(o)+l.y;if(r){c=a.x*2-c}if(n){d=a.y*2-d}return new g({x:c,y:d}).rounded};s([h],tt.prototype,"position",1);s([h],tt.prototype,"size",1);s([h],tt.prototype,"rotation",1);s([h],tt.prototype,"flipHorizontally",1);s([h],tt.prototype,"flipVertically",1);s([h],tt.prototype,"flipCenter",1);s([h],tt.prototype,"leftTop",1);s([h],tt.prototype,"leftBottom",1);s([h],tt.prototype,"rightTop",1);s([h],tt.prototype,"rightBottom",1);s([h],tt.prototype,"leftBottomHandle",1);s([h],tt.prototype,"rightBottomHandle",1);s([h],tt.prototype,"leftMid",1);s([h],tt.prototype,"rightMid",1);var R=class{constructor(t,e){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:T.map({})};this.configStore=t.configStore;this.id=ye();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=e}changeIdentifier(t){this.state.identifier=t;const e=this.state.cropState.get(`${this.id}-${t}`);if(!e){this.state.cropState.set(`${this.id}-${t}`,{...Zt})}}changeRatio(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){this.state.cropState.set(`${this.id}-${this.identifier}`,{...e,ratio:t})}}changeSize(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t.width&&t.width>0){e.size.width=Math.round(t.width)}if(t.height&&t.height>0){e.size.height=Math.round(t.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeHeight(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.height=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changeWidth(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.width=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changePositionX(t,e){const o=this.state.cropState.get(`${this.id}-${this.identifier}`);if(o&&t<=e-this.minCropSize&&t>=0){o.position.x=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,o);return true}return false}changePositionY(t,e){const o=this.state.cropState.get(`${this.id}-${this.identifier}`);if(o&&t<=e-this.minCropSize&&t>=0){o.position.y=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,o);return true}return false}changePosition(t,e){const o=this.state.cropState.get(`${this.id}-${this.identifier}`);if(o){if(t.x<=e.width-this.minCropSize&&t.x>=0&&t.y<=e.height-this.minCropSize&&t.y>=0){o.position.x=Math.round(t.x);o.position.y=Math.round(t.y);this.state.cropState.set(`${this.id}-${this.identifier}`,o);return true}}return false}changeLockResolution(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.lockResolution=t!==void 0?t:!e.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeForceDimensions(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.forceDimensions=t;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}clearState(){this.state.cropState.forEach((t,e)=>e.startsWith(this.id)&&this.state.cropState.delete(e))}setRotation(t){this.state.rotationInDegrees=t}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:t,flipVertically:e}){this.state.flipHorizontally=t;this.state.flipVertically=e}setOutputRotation(t){this.state.outputRotation=t}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:t,height:e}=this.defaults.maxCropMaskSize;return new g(t/2,e/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:Zt.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:Zt.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:Zt.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:Zt.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:Zt.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:Zt.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:Zt.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:Zt.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:Zt.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};s([T],R.prototype,"state",2);s([p],R.prototype,"changeIdentifier",1);s([p],R.prototype,"changeRatio",1);s([p],R.prototype,"changeSize",1);s([p],R.prototype,"changeHeight",1);s([p],R.prototype,"changeWidth",1);s([p],R.prototype,"changePositionX",1);s([p],R.prototype,"changePositionY",1);s([p],R.prototype,"changePosition",1);s([p],R.prototype,"changeLockResolution",1);s([p],R.prototype,"changeForceDimensions",1);s([p],R.prototype,"clearState",1);s([p],R.prototype,"setRotation",1);s([p],R.prototype,"resetRotation",1);s([p],R.prototype,"resetOutputRotation",1);s([p],R.prototype,"resetFlip",1);s([p],R.prototype,"updateFlip",1);s([p],R.prototype,"setOutputRotation",1);s([p],R.prototype,"flipHorizontally",1);s([p],R.prototype,"flipVertically",1);s([p],R.prototype,"dispose",2);s([h],R.prototype,"flipCenter",1);s([h],R.prototype,"isFlippedHorizontal",1);s([h],R.prototype,"isFlippedVertical",1);s([h],R.prototype,"identifier",1);s([h],R.prototype,"height",1);s([h],R.prototype,"width",1);s([h],R.prototype,"position",1);s([h],R.prototype,"ratio",1);s([h],R.prototype,"size",1);s([h],R.prototype,"x",1);s([h],R.prototype,"y",1);s([h],R.prototype,"lockResolution",1);s([h],R.prototype,"forceDimensions",1);s([h],R.prototype,"selectedCrop",1);s([h],R.prototype,"rotationInDegrees",1);s([h],R.prototype,"outputRotation",1);var nl=class{constructor(t){this.transforms={output:JSON.stringify(ve.IDENTITY),preview:JSON.stringify(ve.IDENTITY)};this.setFrameOpacity=t=>{this.frameOpacity=t;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=t=>{this.overlayOpacity=t;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=t;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:t,flipVertically:e,rotation:o,outputRotation:r}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new g(this.transformToolStore.leftTopRespectFlip).add(new g(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new g(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const a=this.engineMediator.preview.container;const{outputContainer:l}=this.editor;l.setResolution(I(this.transformToolStore.localOutputImageSize));l.setData({flipVertically:e,flipHorizontally:t});const c=a.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let d=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:y,defaultImageSize:v}=this.transformToolStore;const x=this.transformToolStore.maxCropMaskSize;const C={height:y.height*v.height/x.height,width:y.width*v.width/x.width};d=C.width/this.transformToolStore.localOutputImageSize.width}const u=Math.abs(c.x);const m=d/(u/this.transformToolStore.defaultScale);const f={x:m,y:m};const b=-(o-r);l.setTransform({scale:f,position:n,rotation:b});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(t){this.transforms=t}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const t=this.engineMediator.preview.container;const{outputContainer:e}=this.editor;const o=JSON.parse(this.transforms.preview);e.setResolution(I(this.transformToolStore.defaultImageSize));t.setTransform(o);e.setTransform(JSON.parse(this.transforms.output));const r=o.scale;e.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:r.y<0,flipHorizontally:r.x<0});this.engineMediator.preview.savePreviewTransform(o);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(t,e=true){const{width:o,height:r}=this.editor.engineMediator.image.container.getBounds();const n=zc(t)?{width:r,height:o}:{width:o,height:r};this.editor.outputContainer.rotate(t,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:a}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(a);nt(()=>{this.editor.scale.setInitialTransform();const l=this.getScaleWithFlip(a);this.engineMediator.preview.container.setScale(l);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(e){this.editor.render()}}applyPreviewTransform(){const{rotation:t,flipHorizontally:e,flipVertically:o}=this.transformToolStore.rotateFlipState;const r=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let a=t;if(e){a=As(a)}if(o){a=As(a)}const l={position:r,rotation:a,scale:n};this.engineMediator.preview.savePreviewTransform(l);this.engineMediator.preview.container.setTransform(l)}getScaleWithFlip(t=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:e,flipVertically:o}=this.transformToolStore.rotateFlipState;const r=e?-1:1;const n=o?-1:1;const a=this.editor.scale.calculateScale(t);return{x:a*r,y:a*n}}saveTransforms(){const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:t,output:e}}saveTransformsBasedOnFlip(){const t=this.engineMediator.preview.container.getTransform();const{scale:e}=t;const{flipVertically:o,flipHorizontally:r}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...t,scale:{x:r?-e.x:e.x,y:o?-e.y:e.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}};var sl=class{constructor(t){this.store=t;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,dt.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}};var sh="identity";var Ri=class{constructor(t){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=T.box(false);this.minCropSize=0;this.transformHistory=new sl(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=t=>{if(!t.trim())return false;let e=this.editor.configStore.config.assetBaseUrl;const{length:o}=e;if(e[o-1]!=="/"){e+="/"}if(`${e}transform`===t){return false}const r=new Image;try{r.src=t;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const t=this.editor.outputContainer.getRotation();if(t!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=t=>{this.localOutputSize.height=Math.round(t.height);this.localOutputSize.width=Math.round(t.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(t.width),height:Math.round(t.height)})};this.changeDefaultScale=t=>{this.defaults.scale=t};this.changeLocalOutputHeight=t=>{this.localOutputSize.height=Math.round(t)};this.changeLocalOutputWidth=t=>{this.localOutputSize.width=Math.round(t)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?Ds:Es;this.rotateOutputContainer(e(t))};this.rotateAntiClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?Es:Ds;this.rotateOutputContainer(e(t))};this.flipHorizontally=(t=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(t);if(t){this.trackChanges()}};this.flipVertically=(t=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(t);if(t){this.trackChanges()}};this.applyDefaultCrop=(t=false)=>{if(this.identifier==="identity"){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,t)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:t,y:e})=>{const o=this.getRatio();const r=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:a}=this;const l=Math.min(Math.max(0,t),r.x-n.width);const c=Math.min(Math.max(0,e),r.y-n.height);const d=r.x-l;const u=r.y-c;const m={width:Math.max(this.minCropSize,Math.min(d,a.width-l)),height:Math.max(this.minCropSize,Math.min(u,a.height-c))};if(o==="*"){if(this.changePosition({x:l,y:c})){this.changeCropAndOutputSize(m)}}else{const f=this.proportionalSize(o,m);const b=new g(r).subtract({x:f.width,y:f.height});if(this.changePosition(b)){this.changeCropAndOutputSize(f,o)}}};this.onLeftBottom=({x:t,y:e})=>{const o=this.getRatio();const r=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:a}=this;const l=Math.min(Math.max(0,t),r.x-n.width);const c=Math.max(0,e,r.y+n.height);const d=r.x-l;const u=c-r.y;const m={width:Math.max(1,Math.min(d,a.width-l)),height:Math.max(1,Math.min(u,a.height-r.y))};if(o==="*"){if(this.changePositionX(l)){this.changeCropAndOutputSize(m)}}else{const f=this.proportionalSize(o,m);if(this.changePositionX(r.x-f.width)){this.changeCropAndOutputSize(f,o)}}};this.onRightTop=({x:t,y:e})=>{const o=this.getRatio();const r=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:a}=this;const l=Math.max(0,t,r.x+n.width);const c=Math.min(Math.max(0,e),r.y-n.height);const d=l-r.x;const u=r.y-c;const m={width:Math.max(1,Math.min(d,a.width-r.x)),height:Math.max(1,Math.min(u,a.height-c))};if(o==="*"){if(this.changePositionY(c)){this.changeCropAndOutputSize(m)}}else{const f=this.proportionalSize(o,m);if(this.changePositionY(r.y-f.height)){this.changeCropAndOutputSize(f,o)}}};this.onRightBottom=({x:t,y:e})=>{const o=this.getRatio();const r=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:a}=this;const l=Math.max(0,t,r.x+n.width);const c=Math.max(0,e,r.y+n.height);const d=l-r.x;const u=c-r.y;const m={width:Math.max(1,Math.min(d,a.width-r.x)),height:Math.max(1,Math.min(u,a.height-r.y))};if(o==="*"){this.changeCropAndOutputSize(m)}else{const f=this.proportionalSize(o,m);this.changeCropAndOutputSize(f,o)}};this.onPixelWidth=t=>{const e=JSON.stringify(I(this.localOutputSize));const o=this.entityManager.items.find(n=>n.identifier===this.identifier);const r=this.defaults.imageSize;if(o&&o.ratio){let n=t;let a=this.localOutputSize.height;let{ratio:l}=o;if(l==="*"&&this.lockResolution){l=this.localOutputSize.width/this.localOutputSize.height}if(l==="*"&&!this.lockResolution){n=Math.max(Math.min(t,r.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(a)})}else{const c=Ri.placeCropMask(l,r);n=Math.max(Math.min(n,c.width),this.minCropSize);a=n/l;this.changeLocalOutputSize({height:a,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.onPixelHeight=t=>{const e=JSON.stringify(I(this.localOutputSize));const o=this.entityManager.items.find(n=>n.identifier===this.identifier);const r=this.defaults.imageSize;if(o&&o.ratio){let n=t;let a=this.localOutputSize.width;let{ratio:l}=o;if(l==="*"&&this.lockResolution){l=this.localOutputSize.width/this.localOutputSize.height}if(l==="*"&&!this.lockResolution){n=Math.max(Math.min(t,r.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(a),height:Math.round(n)})}else{const c=Ri.placeCropMask(l,r);n=Math.max(Math.min(n,c.height),this.minCropSize);a=n*l;this.changeLocalOutputSize({height:n,width:a})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=t=>{this.transformations.setFrameOpacity(t)};this.setOverlayOpacity=t=>{this.transformations.setOverlayOpacity(t)};this.closestRatioReducer=t=>(e,o)=>{if(o===null)return-1;return Math.abs(t-e.ratio)(e,o)=>{if(o===null)return-1;const r=Math.abs(e.dimensions.x/e.dimensions.y);const n=Math.abs(o.dimensions.x/o.dimensions.y);if(r===n){return e.dimensions.x*e.dimensions.y>o.dimensions.x*o.dimensions.y?-1:1}return Math.abs(t-r){const t=this.entityManager.items.findIndex(c=>c.identifier==="imgly_transform_common_custom");if(t!==-1)return this.entityManager.items[t];const e=this.entityManager.items.findIndex(c=>c.ratio==="*");if(e!==-1)return this.entityManager.items[e];const o=I(this.editor.outputContainer.getResolution());const r=Math.abs(o.width/o.height);const[n]=this.entityManager.items.filter(c=>c.ratio&&typeof c.ratio==="number").sort(this.closestRatioReducer(r));const[a]=this.entityManager.items.filter(c=>c.dimensions&&!c.ratio).sort(this.closestDimensionsReducer(r));if(!n||!a||!n.ratio&&!a.dimensions){return this.entityManager.items[0]}if(!a||!a.dimensions)return n;if(!n||!n.ratio)return a;const l=Math.abs(a.dimensions.x/a.dimensions.y);if(l===n.ratio)return n;return Math.abs(r-n.ratio){let e=this.entityManager.items.find(o=>o.identifier===t);if(!e){e=this.getMatchingItem()}return e};this.editor=t;this.selectedCategory=sh;this.transformStore=new R(t,this.defaults);this.transformations=new nl(t);const{enableRotation:e,enableFlip:o,...r}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new it(n,{...r,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new tt(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new tt(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(t){return t*Math.PI/180}static placeCropMask(t,e){if(e.height*t>e.width){const r=e.width/t;return{height:r,width:e.width,yChanged:true}}const o=e.height*t;return{height:e.height,width:o,yChanged:false}}changeIdentifier(t,e=false){this.transformStore.changeIdentifier(t);const o=this.getCropMask(t,this.defaults.imageSize);if(o){this.transformStore.changeRatio(o.ratio);this.changeLocalOutputSize(o);this.updatePreviewSizeWRTImageSize();if(o.yChanged!==void 0){this.updateInitialCropMaskPosition(o.yChanged)}if(o.dimensions){this.changeLocalOutputSize({width:o.dimensions.x,height:o.dimensions.y})}if(e){this.trackChanges()}}}setDragMode(t){this.dragMode.set(t)}getCropMask(t,e){const o=this.getTransform(t);if(o){const{ratio:r,forceDimensions:n,lockDimensions:a,dimensions:l=null}=o;if(n){this.transformStore.changeForceDimensions(n)}if(a){this.transformStore.changeLockResolution(a)}if(r){switch(r){case"*":this.changePosition({x:0,y:0});return{...e,yChanged:void 0,ratio:"*",dimensions:l};default:return{...Ri.placeCropMask(o.ratio,e),ratio:o.ratio,dimensions:l}}}else{const{x:c,y:d}=o.dimensions;return{...Ri.placeCropMask(c/d,e),ratio:null,dimensions:l}}}return null}setCropDefaults(t=false){const e=this.editor.outputContainer.getResolution();this.setDefaultImageSize(e);const o=this.editor.getPreviewSize();const{position:r}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(o);this.setDefaultCropPosition({x:r.x-o.width/2,y:r.y-o.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!t){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(t){this.defaults.imageSize={...I(t)};if(!this.lockResolution){this.localOutputSize={...I(t)}}}setMaxCropSize(t){this.defaults.maxCropMaskSize.height=t.height;this.defaults.maxCropMaskSize.width=t.width}setDefaultCropPosition(t){this.defaults.cropMaskPosition.x=t.x;this.defaults.cropMaskPosition.y=t.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(t){this.selectedCategory=this.selectedCategory===t?sh:t}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:t,output:e})}changePosition(t){return this.transformStore.changePosition(t,this.defaults.maxCropMaskSize)}changePositionX(t){return this.transformStore.changePositionX(t,this.defaults.maxCropMaskSize.width)}changePositionY(t){return this.transformStore.changePositionY(t,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:t,height:e},o,r=true){this.transformStore.changeWidth(t);this.transformStore.changeHeight(e);if(!this.lockResolution){const{height:n,width:a}=this.defaults.maxCropMaskSize;const{height:l,width:c}=this.defaults.imageSize;let d=l/n*e;const u=c/a*t;if(o){d=u/o}if(r){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(u),height:Math.round(d)})}if(e>=this.minCropSize){this.changeLocalOutputHeight(d)}if(t>=this.minCropSize){this.changeLocalOutputWidth(u)}}}transformRender(t=true){this.transformations.applyPreviewTransform();if(t){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:t,flipVertically:e}=this.rotateFlipState;const{identifier:o,rotationInDegrees:r}=this;const n=Ts(r);const a=Ms(Is(this.editor.engineMediator.output.container.getRotation())+r);const{start:l,end:c}=this.convertUIToOperationOptions(n,a);return{flipHorizontally:t,flipVertically:e,rotation:n,start:l,end:c,identifier:o,outputRotation:a}}getStartEndForOperation(t){const{leftTop:e,rightBottom:o,maxCropMaskSize:r}=this;const n=e.y;const a=e.x;const l=o.x;const c=o.y;switch(t){case 270:return{leftTop:{x:r.height-c,y:a},rightBottom:{x:r.height-n,y:l}};case 180:return{leftTop:{x:r.width-l,y:r.height-c},rightBottom:{x:r.width-a,y:r.height-n}};case 90:return{leftTop:{x:n,y:r.width-l},rightBottom:{x:c,y:r.width-a}};default:return{leftTop:{x:a,y:n},rightBottom:{x:l,y:c}}}}getStartEndForUI(t,e,o){const{maxCropMaskSize:r}=this;const n=e.y;const a=e.x;const l=o.x;const c=o.y;switch(t){case 90:return{leftTop:{x:r.width-c,y:a},rightBottom:{x:r.width-n,y:l}};case 180:return{leftTop:{x:r.width-l,y:r.height-c},rightBottom:{x:r.width-a,y:r.height-n}};case 270:return{leftTop:{x:n,y:r.height-l},rightBottom:{x:c,y:r.height-a}};default:return{leftTop:{x:a,y:n},rightBottom:{x:l,y:c}}}}convertOperationOptionsToUI({start:t,end:e,rotation:o,outputRotation:r}){const n=r===90||r===270;const a=n?g.fromSize(this.defaultImageSize).swapped:g.fromSize(this.defaultImageSize);const l=Math.cos(o);const c=Math.sin(o);const d=this.calculateScale(o);const u=new g(Math.min(t.x,e.x),Math.min(t.y,e.y));const m=new g(Math.max(t.x,e.x),Math.max(t.y,e.y));const f=m.subtract(u).divide(2);const b=u.add(f).multiply(a);const y=b.subtract(a.multiply(.5));const v=new g(y.x*l-y.y*c,y.x*c+y.y*l).multiply(d);const x=a.multiply(.5).add(v);const C=x.divide(a);const D=C.subtract(f.multiply(d));const A=C.add(f.multiply(d));const B=n?g.fromSize(this.maxCropMaskSize).swapped:g.fromSize(this.maxCropMaskSize);const O=D.multiply(B);const P=A.multiply(B);const{leftTop:V,rightBottom:U}=this.getStartEndForUI(r,O,P);return{start:new g(V),end:new g(U)}}convertUIToOperationOptions(t,e){const o=e===90||e===270;const r=o?g.fromSize(this.defaultImageSize).swapped:g.fromSize(this.defaultImageSize);const n=o?g.fromSize(this.maxCropMaskSize).swapped:g.fromSize(this.maxCropMaskSize);const a=Math.cos(-t);const l=Math.sin(-t);const c=this.calculateScale(t,o);const{leftTop:d,rightBottom:u}=this.getStartEndForOperation(e);const m=new g(d).divide(n);const f=new g(u).divide(n);const b=f.subtract(m).divide(2);const y=m.add(b).multiply(r);const v=y.subtract(r.multiply(.5));const x=new g(v.x*a-v.y*l,v.x*l+v.y*a).divide(c);const C=r.multiply(.5).add(x);const D=C.divide(r);const A=D.subtract(b.divide(c));const B=D.add(b.divide(c));return{start:A,end:B}}calculateScale(t,e=false){const o=e?g.fromSize(this.defaultImageSize).swapped:g.fromSize(this.defaultImageSize);const r=new g(Math.abs(o.x*Math.cos(t))+Math.abs(o.y*Math.sin(t)),Math.abs(o.x*Math.sin(t))+Math.abs(o.y*Math.cos(t)));const n=o.subtract(r.clone()).divide(2).abs;return n.y>n.x?n.y*2/o.y+1:n.x*2/o.x+1}updateStateFromSerialization(t){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=Math.round(Is(t.rotation));this.transformStore.setRotation(e>180?e-360:e);this.transformations.rotateOutputContainer(Ts(Ms(t.outputRotation||0)));if(t.identifier){this.transformStore.changeIdentifier(t.identifier)}if(t.start&&t.end){if(t.end.x===0||t.end.y===0){t.end.x=1;t.end.y=1}const{start:o,end:r}=this.convertOperationOptionsToUI({start:new g(t.start),end:new g(t.end),rotation:t.rotation,outputRotation:t.outputRotation});this.changePositionX(o.x);this.changePositionY(o.y);const n=r.x-o.x;const a=r.y-o.y;this.transformStore.changeSize({width:n,height:a});const{maxCropMaskSize:l,imageSize:c}=this.defaults;const d={height:a*c.height/l.height,width:n*c.width/l.width};this.changeLocalOutputSize(d)}if(t.flipHorizontally){this.flipHorizontally(false)}if(t.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(t){this.defaultAngle=t}updateCanvasControls(t){const e=I(this.cropMaskPosition);const o=I(this.cropMaskSize);const r=I(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:r.height*o.height/t.height,width:r.width*o.width/t.width},void 0,false);this.changePosition({y:r.height*e.y/t.height,x:r.width*e.x/t.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(t){this.transformStore.setRotation(t);this.transformRender()}async rotateOutputContainer(t,e=true){this.setDragMode(true);this.transformations.rotateOutputContainer(t,e);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,false)}clickableCanvas(t){this.editor.clickableCanvas(t)}proportionalSize(t,e,o=this.defaults.maxCropMaskSize,r=this.minCropSize){let n=e.height*t;let{height:a}=e;if(n>o.width||n1){return{width:this.minCropSize*t,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*t}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const t=this.getTransform(this.identifier);if(t){if(Object.prototype.hasOwnProperty.call(t,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return t.ratio}const{x:e,y:o}=t.dimensions;return e/o}return"*"}};var w=Ri;s([T],w.prototype,"selectedCategory",2);s([T],w.prototype,"defaults",2);s([T],w.prototype,"localOutputSize",2);s([p],w.prototype,"changeIdentifier",1);s([p],w.prototype,"setDragMode",1);s([p],w.prototype,"setCropDefaults",1);s([p],w.prototype,"setDefaultImageSize",1);s([p],w.prototype,"setMaxCropSize",1);s([p],w.prototype,"setDefaultCropPosition",1);s([p],w.prototype,"resetCrop",1);s([p],w.prototype,"toggleCategorySelection",1);s([p],w.prototype,"pureReset",1);s([p],w.prototype,"reset",2);s([p],w.prototype,"changePosition",1);s([p],w.prototype,"changePositionX",1);s([p],w.prototype,"changePositionY",1);s([p],w.prototype,"changeCropAndOutputSize",1);s([p],w.prototype,"onLeave",1);s([p],w.prototype,"onEnter",1);s([p],w.prototype,"changeLocalOutputSize",2);s([p],w.prototype,"changeDefaultScale",2);s([p],w.prototype,"changeLocalOutputHeight",2);s([p],w.prototype,"changeLocalOutputWidth",2);s([p],w.prototype,"changeLockResolution",2);s([p],w.prototype,"setRotation",1);s([p],w.prototype,"rotateClockwise",2);s([p],w.prototype,"rotateAntiClockwise",2);s([p],w.prototype,"rotateOutputContainer",1);s([p],w.prototype,"flipHorizontally",2);s([p],w.prototype,"flipVertically",2);s([p],w.prototype,"applyDefaultCrop",2);s([p],w.prototype,"applyInitialCrop",1);s([p],w.prototype,"updateCropMask",2);s([p],w.prototype,"clickableCanvas",1);s([p],w.prototype,"onLeftTop",2);s([p],w.prototype,"onLeftBottom",2);s([p],w.prototype,"onRightTop",2);s([p],w.prototype,"onRightBottom",2);s([p],w.prototype,"proportionalSize",1);s([p],w.prototype,"onPixelWidth",2);s([p],w.prototype,"onPixelHeight",2);s([p],w.prototype,"updateInitialCropMaskPosition",1);s([p],w.prototype,"updatePreviewSizeWRTImageSize",1);s([p],w.prototype,"dispose",2);s([h],w.prototype,"cropState",1);s([h],w.prototype,"identifier",1);s([h],w.prototype,"ratio",1);s([h],w.prototype,"height",1);s([h],w.prototype,"width",1);s([h],w.prototype,"localOutputImageSize",1);s([h],w.prototype,"localOutputHeight",1);s([h],w.prototype,"localOutputWidth",1);s([h],w.prototype,"lockResolution",1);s([h],w.prototype,"forceDimensions",1);s([h],w.prototype,"rotationInDegrees",1);s([h],w.prototype,"outputRotation",1);s([h],w.prototype,"isDragMode",1);s([h],w.prototype,"rotateFlipState",1);s([h],w.prototype,"selectedCategoryIdentifier",1);s([h],w.prototype,"categories",1);s([h],w.prototype,"items",1);s([h],w.prototype,"config",1);s([h],w.prototype,"locale",1);s([h],w.prototype,"isOptionSelected",1);s([h],w.prototype,"leftTop",1);s([h],w.prototype,"leftBottom",1);s([h],w.prototype,"rightTop",1);s([h],w.prototype,"rightBottom",1);s([h],w.prototype,"isFlippedHorizontal",1);s([h],w.prototype,"isFlippedVertical",1);s([h],w.prototype,"leftTopRespectFlip",1);s([h],w.prototype,"leftBottomRespectFlip",1);s([h],w.prototype,"rightTopRespectFlip",1);s([h],w.prototype,"rightBottomRespectFlip",1);s([h],w.prototype,"cropMaskPosition",1);s([h],w.prototype,"cropMaskSize",1);s([h],w.prototype,"state",1);s([h],w.prototype,"defaultImageSize",1);s([h],w.prototype,"maxCropMaskSize",1);s([h],w.prototype,"minCropMaskSize",1);s([h],w.prototype,"defaultCropMaskPosition",1);s([h],w.prototype,"defaultScale",1);var ah=Rt(Dc());var jy={};var al="none";var Xy={position:{x:0,y:0},rotation:0};var mr=class{constructor(t){this.state=T.map(jy);this.selectedId=T.box(al);this.editMode=T.box(false);this.dragMode=T.box(false);this.minLength=0;this.counter=0;this.addSticker=async(t,e=true)=>{await this.addStickerAsync(t,e)};this.addStickerAsync=async({spriteId:t,state:e,transform:o},r=true)=>{return new Promise((n,a)=>{o=this.getInitialTransform(o);const{identifier:l}=e;const c=this.editor.orderHelper.addSprite(l);this.editor.engine.addStickerFromAssets(l,this.editor.engineMediator.image.container,c).then(async d=>{if(t){d.setData({id:t})}const u=d.getID();this.container[u]=d;this.editor.orderHelper.renameSprite(l,u);const m=this.getSize(u);m.width*=d.getScale().x;m.height*=d.getScale().y;d.setPivot(.5,.5);let f;if(o.scale){f=o.scale}else if(o.size){f={x:o.size.width/m.width,y:o.size.height/m.height}}else{const x=this.editor.shortestOutputSide*.4;const C=mr.magnitude(x)/mr.sizeMagnitude(d.getSizeInWorldSpace());f={x:C,y:C}}const{flipHorizontally:b,flipVertically:y}=this.editor.outputContainer.getData();d.setFlipHorizontally(b);d.setFlipVertically(y);d.setTransform({position:o.position,scale:f,rotation:o.rotation});if(e.flipHorizontally!==void 0){d.setFlipHorizontally(e.flipHorizontally!==b)}if(e.flipVertically!==void 0){d.setFlipVertically(e.flipVertically!==y)}this.setContainerProperties(u,{...e});const v=d.getData();this.setInitialSpriteState(u,"sticker");this.stickerToolStore.setState(u,{...v,identifier:l});await this.editor.renderPromise();if(r){this.setId(u);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(d=>{console.error(d);a()})})};this.addText=async(t,e=true)=>{await this.addTextAsync(t,e)};this.addTextAsync=({spriteId:t,state:e,transform:o},r=true)=>{return new Promise((n,a)=>{o=this.getInitialTransform(o);const l=this.editor.orderHelper.addSprite(e.identifier);const c=this.editor.shortestOutputSide;const d={fontIdentifier:e.identifier,text:e.text,width:e.width||c*.6,fontSize:e.fontSize||c*.1,lineHeight:e.lineHeight,alignment:e.alignment,textColor:e.textColor,backgroundColor:e.backgroundColor};this.editor.engine.addTextWithFontLoading(d,this.editor.engineMediator.image.container,l).then(async u=>{if(t){u.setData({id:t})}const m=u.getID();this.container[m]=u;this.editor.orderHelper.renameSprite(e.identifier,m);const{flipHorizontally:f,flipVertically:b}=this.editor.outputContainer.getData();u.setFlipHorizontally(f);u.setFlipVertically(b);u.setPivot(.5,.5);u.setPosition(o.position);u.setRotation(o.rotation);this.setInitialSpriteState(m,"text");const y=u.getData();this.textToolStore.setState(m,{...y});await this.editor.renderPromise();if(r){this.setId(m);this.addSnapshot("add",this.textLocale.add)}n()}).catch(u=>{console.error(u);a()})})};this.addTextDesign=async(t,e=true,o=false)=>{try{await this.addTextDesignAsync(t,e,o)}catch(r){console.warn(r)}};this.addTextDesignAsync=({spriteId:t,state:e,transform:o},r=true,n=false)=>{return new Promise((a,l)=>{o=this.getInitialTransform(o);const c=this.editor.orderHelper.addSprite(e.identifier);const d=this.editor.shortestOutputSide;const u={width:e.width||d*.6,text:e.text,color:e.color,inverted:e.isInverted,seed:e.seed,padding:e.padding};this.editor.engine.addTextDesignAsync(e.identifier,u,this.editor.engineMediator.image.container,c).then(async m=>{if(t){if(n){this.pureRemoveSprite(t);this.textDesignToolStore.state.delete(t)}m.setData({id:t})}const f=m.getID();this.container[f]=m;this.editor.orderHelper.renameSprite(e.identifier,f);const{flipHorizontally:b,flipVertically:y}=this.editor.outputContainer.getData();m.setFlipHorizontally(b);m.setFlipVertically(y);m.setPivot(.5,.5);m.setPosition(o.position);m.setRotation(o.rotation);this.setInitialSpriteState(f,"textdesign");const v=m.getData();this.textDesignToolStore.setState(f,{...v,identifier:e.identifier});await this.editor.renderPromise();if(r){this.setId(f);this.addSnapshot("add",this.textDesignLocale.add)}a()}).catch(m=>{l(m)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=t=>{this.editor.clickableCanvas(t)};this.setContainerProperties=(t,e,o=false)=>{this.container[t].setData(e);if(o){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(t,e)=>{this.container[t].setPosition(e)};this.pureRemoveSprite=t=>{this.editor.engine.removeContainer(this.container[t]);const e=this.container[t].getIndexInParent();if(e===-1){delete this.container[t];this.state.delete(t);this.editor.orderHelper.removeSprite(t);return true}return false};this.deleteSprite=(t=this.id)=>{const e=this.state.get(t);if(e.tool==="sticker"){this.stickerToolStore.delete()}else if(e.tool==="text"){this.textToolStore.delete()}else if(e.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=t=>{const e=this.pureRemoveSprite(t);if(e){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(t,e)=>{this.editor.addSnapshot(void 0,t,e)};this.spriteSnapshot=t=>{this.addSnapshot("edit",this.historyLocale[t])};this.addNewText=async(t,e)=>{if(this.textToolStore.doesTextAssetExist(e.identifier)){await this.addTextAsync({...t,state:e},false)}else{throw new oe(e.identifier)}};this.addNewTextDesign=async(t,e)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(e.identifier)){await this.addTextDesignAsync({...t,state:e},false)}else{throw new oe(e.identifier)}};this.addNewSticker=async(t,e)=>{if(this.stickerToolStore.doesStickerAssetExist(e.identifier)){await this.addStickerAsync({...t,state:e},false)}else{throw new oe(e.identifier)}};this.getSpriteHistoryState=()=>{const t=I(this.textToolStore.state);const e=I(this.textDesignToolStore.state);const o={common:I(this.state),["sticker"]:I(this.stickerToolStore.state),["text"]:t,["textdesign"]:e,spriteIdList:Object.keys(this.container)};Object.keys(o.common).forEach(r=>{o.common[r].size=this.container[r].getSizeInWorldSpace();o.common[r].position=this.container[r].getPosition();o.common[r].order=this.container[r].getIndexInParent()});return o};this.updateStateFromSerialization=async(t,e,o)=>{if(e&&e.length){try{const r=await Promise.all(e.map(async({svg:n,raster:a,name:l,identifier:c})=>{const d=(n==null?void 0:n.data)?"image/svg+xml":a.type;const u=`data:${d};base64,${(n==null?void 0:n.data)||a.data}`;const m=await $n(u,150);return{stickerURI:u,thumbnailURI:m,name:l,type:d,identifier:c}}));await this.stickerToolStore.addCustomStickerAsset(r)}catch(r){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(t.text){await this.textToolStore.loadFonts()}if(t.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(t.spriteIdList,t,o)};this.updateStateFromHistory=async t=>{const e=Object.keys(this.container);const o=e.filter(r=>t.spriteIdList.indexOf(r)===-1);o.forEach(r=>{this.pureRemoveSprite(r)});await this.updateStateByHistoryState(t.spriteIdList,t,0)};this.serializableState=async()=>{const t=this.editor.spriteStore.getSpriteHistoryState();Object.keys(t.common).forEach(o=>{const{flipHorizontally:r,flipVertically:n}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=n!==r?-t.common[o].rotation:t.common[o].rotation;t.common[o].rotation=n!==r?l+a:l-a});const e=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:o,type:r,stickerURI:n,name:a})=>{const l={identifier:o,name:a,raster:{data:"",type:"image/jpeg"}};if(r==="image/svg+xml"){l.svg={data:n.split(",")[1]}}if(r==="image/jpeg"||r==="image/png"||r==="image/gif"){[,l.raster.data]=n.split(",");l.raster.type=r}else{const c=await $n(n);[,l.raster.data]=c.split(",");l.raster.type="image/png"}return l}));return{sprite:t,customStickers:e}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(t=>{this.updatePositionAndSize(t,true);const e=this.state.get(t);if(e){if(e.tool==="text"){const o=this.getContainerProperties(t);this.textToolStore.changeSize(t,o)}else if(e.tool==="textdesign"){const o=this.getContainerProperties(t);this.textToolStore.changeWidth(o.width)}}})};this.setEditMode=t=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(t){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(t)}}};this.setDragMode=t=>{this.dragMode.set(t)};this.setPosition=t=>{const e=this.currentSprite;const o=this.container[this.id];if(e&&o){o.setPosition(this.editor.previewToWorld(t));const{position:r}=this.getSizePositionFromContainer();e.position.x=r.x;e.position.y=r.y;this.state.set(this.id,e);this.editor.render()}};this.setSize=t=>{const e=this.currentSprite;if(e){e.size.width=t.width;e.size.height=t.height;this.state.set(this.id,e)}};this.setRotation=t=>{const e=this.currentSprite;if(e){const{flipHorizontally:o,flipVertically:r}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const a=Uo({rotation:t,outputRotation:n,flipHorizontally:o,flipVertically:r});this.container[this.id].setRotation(a);e.rotation=this.container[this.id].getRotation();this.state.set(this.id,e);this.editor.render()}};this.onCanvasClick=t=>{if(!this.isEditMode){this.selectHighestOrderSprite(t)}};this.select=t=>{const e=this.state.get(t);if(e){const o=this.editor.activeStore.tool;if(o!==e.tool){this.editor.activeStore.selectTool(e.tool)}this.setId(t)}};this.selectLast=()=>{const t=this.editor.orderHelper.getLastSpriteId();if(t){this.select(t)}};this.selectNext=()=>{if(this.currentSprite){const t=this.container[this.id];const e=t.getIndexInParent();if(e){const o=Object.keys(this.container).find(r=>this.container[r].getIndexInParent()===e-1);if(o){this.select(o)}}}};this.deselect=()=>{this.setId(al)};this.bringToFront=async t=>{const e=this.editor.orderHelper.bringToFront(t);this.container[t].setIndexInParent(e);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=t=>{const e=this.state.get(t);const o=this.container[t];o.setFlipHorizontally(!o.getFlipHorizontally());e.flipHorizontally=o.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(t,e);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(t=>{this.pureRemoveSprite(t)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=t=>{const e=this.editor.brushToolStore.containerId();t=t.filter(n=>n!==e);if(t.length<1){this.deselect();return}let o="";let r=0;t.forEach(n=>{const a=this.container[n];const l=a&&a.getIndexInParent()||0;if(l>=r){r=l;o=n}});this.select(o)};this.onCornerDrag=({x:t,y:e})=>{if(this.currentSprite){const o=new g(this.currentSprite.position);const r=new g(t,e);const n=r.subtract(o).magnitude;const a=this.getSize();const l=n*2/mr.sizeMagnitude(a);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:a.width*l,height:a.height*l})}else{const c=this.rotationWRTOutputRotation;const d=r.subtract(o);const u=Math.cos(c);const m=Math.sin(c);const f=Math.max(Math.abs(d.x*u*2+d.y*m*2),this.minLength);const b=Math.max(Math.abs(d.x*-m*2+d.y*u*2),this.minLength);this.setStickerSize({width:f,height:b})}}else if(this.isSpriteText){this.setTextSize(a.width*l)}else if(this.isSpriteTextDesign){this.setTextDesignScale(l)}}this.editor.render()}};this.onWidthDrag=({x:t,y:e})=>{const o=new g(this.currentSprite.position);const r=new g(t,e);const n=r.subtract(o).magnitude;const a=this.editor.previewToWorld(2*n);if(a>this.minLength){this.setContainerProperties(this.id,{width:a},true);if(this.isSpriteText){const l=this.getContainerProperties(this.id);this.textToolStore.changeWidth(l.width)}}};this.onPaddingDrag=({x:t,y:e})=>{if(this.isSpriteTextDesign){let o=this.getContainerProperties(this.id);const r=new g(this.currentSprite.position);const n=new g(t,e);const a=n.subtract(r).magnitude;const l=Math.max(this.editor.previewToWorld(a)-o.width/2,0);this.setContainerProperties(this.id,{padding:l},true);if(this.isSpriteTextDesign){o=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(o.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();Object.values(this.container).forEach(o=>{if(o.type==="text"||o.type==="text-design"){o.setFlipHorizontally(t);o.setFlipVertically(e)}})};this.reverseTextHorizontally=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipHorizontally(t)}})};this.reverseTextVertically=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipVertically(t)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=t=>{return this.container[t].getData()};this.getContainerTransform=t=>{return this.container[t].getTransform()};this.getDuplicateContainerTransform=t=>{const e=this.container[t].getTransform();const o=this.editor.shortestOutputSide*.1;const r=new g(e.position).add(new g(o,o));return{...e,position:r}};this.getDuplicateContainerFlip=t=>{const e=this.container[t].getFlipHorizontally();const o=this.container[t].getFlipVertically();return{flipHorizontally:e,flipVertically:o}};this.updatePositionAndSize=(t=this.id,e=false)=>{const{position:o,size:r}=this.getSizePositionFromContainer(t);const n=this.state.get(t);if(n){n.position.x=o.x;n.position.y=o.y;n.size.width=r.width;n.size.height=r.height;if(e){const a=this.container[t].getRotation();this.container[t].setRotation(a);n.rotation=this.container[t].getRotation()}this.state.set(t,n)}};this.getInitialTransform=t=>{const e=this.editor.outputToWorld(Xy.position);if(!t){const o=this.editor.outputContainer.getRotation();return{rotation:o,position:e}}return{position:e,...t}};this.setInitialSpriteState=(t,e)=>{const o=this.container[t];const{position:r,size:n}=this.getSizePositionFromContainer(t);const a=o.getRotation();const l=e!=="sticker"?false:o.getFlipHorizontally();const c=e!=="sticker"?false:o.getFlipVertically();this.state.set(t,{tool:e,position:r,rotation:a,size:n,flipHorizontally:l,flipVertically:c})};this.setStickerSize=t=>{const e=this.container[this.id];e.setSizeInWorldSpace(this.editor.previewSizeToWorld(t));const o=this.currentSprite;if(o){o.size=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());this.state.set(this.id,o)}};this.setTextSize=t=>{let e=this.getContainerProperties(this.id);const o={width:this.editor.previewToWorld(t)};const r=o.width/e.width;const n={fontSize:Math.round(e.fontSize*r)};const a=this.isSpriteText?{...o,...n}:o;if(o.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,a,true);e=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(e.fontSize,true);this.textToolStore.changeWidth(e.width)}};this.setTextDesignScale=t=>{let e=this.getContainerProperties(this.id);const o=e.width*t;if(o>this.minLength){this.setContainerProperties(this.id,{width:o},true);const{width:r}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(r);e=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(e.padding)}};this.getSizePositionFromContainer=(t=this.id)=>{const e=this.container[t];if(e){const o=this.editor.worldToPreview(e.getPosition());const r=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());return{position:o,size:r}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(t=this.id)=>{const e=this.container[t];if(e){return this.editor.worldSizeToPreview(e.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=t;this.container={};this.stickerToolStore=new W(t);this.textToolStore=new L(t);this.textDesignToolStore=new N(t);this.rect=new tt(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(t,e){return new g(t,e||t).magnitude}static sizeMagnitude(t){return Math.sqrt(t.width*t.width+t.height*t.height)}async updateStateByHistoryState(t,e,o){await(0,ah.default)(t,async r=>{const n=e.common[r];if(!n)return;if(this.state.get(r)){this.updateExistingItem(r,e)}else{await this.addNewItem(r,e)}});t.forEach(r=>{const n=e.common[r];const a=this.container[r];if(!n||!a)return;a.setIndexInParent(n.order+o)});this.counter+=1}async addNewItem(t,e){const o=e.common[t];const r=o.size?{width:this.editor.worldToPreview(o.size.width),height:this.editor.worldToPreview(o.size.height)}:void 0;const{flipHorizontally:n,flipVertically:a}=this.editor.outputContainer.getData();const l=this.editor.outputContainer.getRotation();const c=a!==n?o.rotation-l:o.rotation+l;const d=a!==n?-c:c;const u={spriteId:t,transform:{size:r,position:new g(o.position),rotation:d}};if(e.text[t]){const m=e.text[t];const f=this.textToolStore.validFontWithConfig(m.identifier);m.identifier=f==null?void 0:f.identifier;await this.addNewText(u,m);return}if(e.textdesign[t]){await this.addNewTextDesign(u,e.textdesign[t]);return}if(e.sticker[t]){const m=this.stickerToolStore.items.find(f=>f.identifier===e.sticker[t].identifier);await this.addNewSticker(u,{...e.sticker[t],flipHorizontally:o.flipHorizontally,flipVertically:o.flipVertically,resizeMode:e.sticker[t].resizeMode||(m==null?void 0:m.resizeMode)||"keepAspect"})}}updateExistingItem(t,e){const o=e.common[t];const r=this.state.get(t);this.state.set(t,r);const n=this.container[t];n.setPosition(new g(o.position));n.setRotation(o.rotation);r.rotation=n.getRotation();if(o.flipHorizontally!==void 0){n.setFlipHorizontally(o.flipHorizontally)}if(o.flipVertically!==void 0){n.setFlipVertically(o.flipVertically)}if(e.text[t]){const a=e.text[t];this.textToolStore.updateStateFromHistory(t,{...a,fontIdentifier:a.identifier})}if(e.textdesign[t]){const a=e.textdesign[t];this.textDesignToolStore.updateStateFromHistory(t,{...a,inverted:a.isInverted})}if(e.sticker[t]){n.setSizeInWorldSpace(o.size);this.stickerToolStore.updateStateFromHistory(t,e.sticker[t])}this.updatePositionAndSize(t)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==al}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();const o=this.editor.outputContainer.getRotation();return Uo({rotation:this.currentSprite.rotation-o,flipHorizontally:t,flipVertically:e})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const t=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:t,y:e}=this.currentSprite.position;const{height:o,width:r}=this.currentSprite.size;return{x:Math.round(t-r/2),y:Math.round(e-o/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:t}=this.rect;return{x:t.x-this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:t}=this.rect;return{x:t.x+this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(t){this.selectedId.set(t)}};var k=mr;s([T],k.prototype,"counter",2);s([p],k.prototype,"addSticker",2);s([p],k.prototype,"addStickerAsync",2);s([p],k.prototype,"addText",2);s([p],k.prototype,"addTextAsync",2);s([p],k.prototype,"addTextDesign",2);s([p],k.prototype,"addTextDesignAsync",2);s([p],k.prototype,"clickableCanvas",2);s([p],k.prototype,"setContainerProperties",2);s([p],k.prototype,"setContainerPosition",2);s([p],k.prototype,"pureRemoveSprite",2);s([p],k.prototype,"deleteSprite",2);s([p],k.prototype,"removeSprite",2);s([p],k.prototype,"addSnapshot",2);s([p],k.prototype,"addNewText",2);s([p],k.prototype,"addNewTextDesign",2);s([p],k.prototype,"addNewSticker",2);s([p],k.prototype,"updateStateFromSerialization",2);s([p],k.prototype,"updateStateFromHistory",2);s([p],k.prototype,"updateCanvasControls",2);s([p],k.prototype,"setEditMode",2);s([p],k.prototype,"setDragMode",2);s([p],k.prototype,"setPosition",2);s([p],k.prototype,"setSize",2);s([p],k.prototype,"setRotation",2);s([p],k.prototype,"onCanvasClick",2);s([p],k.prototype,"select",2);s([p],k.prototype,"selectLast",2);s([p],k.prototype,"selectNext",2);s([p],k.prototype,"deselect",2);s([p],k.prototype,"bringToFront",2);s([p],k.prototype,"flipHorizontally",2);s([p],k.prototype,"pureReset",2);s([p],k.prototype,"onCornerDrag",2);s([p],k.prototype,"onWidthDrag",2);s([p],k.prototype,"onPaddingDrag",2);s([p],k.prototype,"correctTextFlip",2);s([p],k.prototype,"reverseTextHorizontally",2);s([p],k.prototype,"reverseTextVertically",2);s([p],k.prototype,"dispose",2);s([h],k.prototype,"currentSprite",1);s([h],k.prototype,"padding",1);s([h],k.prototype,"isEditMode",1);s([h],k.prototype,"isDragMode",1);s([h],k.prototype,"id",1);s([h],k.prototype,"isSpriteSelected",1);s([h],k.prototype,"position",1);s([h],k.prototype,"tool",1);s([h],k.prototype,"size",1);s([h],k.prototype,"rotation",1);s([h],k.prototype,"rotationWRTOutputRotation",1);s([h],k.prototype,"flipHorizontal",1);s([h],k.prototype,"isSpriteSticker",1);s([h],k.prototype,"isSpriteText",1);s([h],k.prototype,"isSpriteTextDesign",1);s([h],k.prototype,"isOnTop",1);s([h],k.prototype,"spritePosition",1);s([h],k.prototype,"currentRect",1);s([h],k.prototype,"leftTopPosition",1);s([h],k.prototype,"leftBottomPosition",1);s([h],k.prototype,"leftMidPosition",1);s([h],k.prototype,"leftMidPadPosition",1);s([h],k.prototype,"rightTopPosition",1);s([h],k.prototype,"rightBottomPosition",1);s([h],k.prototype,"rightMidPosition",1);s([h],k.prototype,"rightMidPadPosition",1);s([h],k.prototype,"leftBottomHandlePosition",1);s([h],k.prototype,"rightBottomHandlePosition",1);s([h],k.prototype,"historyLocale",1);s([h],k.prototype,"stickerLocale",1);s([h],k.prototype,"textLocale",1);s([h],k.prototype,"textDesignLocale",1);var Yy={categories:[],query:""};var Mt=class{constructor(t){this.initProvider=t=>{if(t){this.libraryProvider=new t}};this.fetchImages=async(t="")=>{if(this.libraryProvider){let e=null;try{const o=await this.libraryProvider.getCategories();const r=await this.libraryProvider.searchImages(t);e=o.map((n,a)=>{const l=r.filter(c=>c.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:l.map(c=>({name:c.title||`image${a}`,identifier:`${n.name}-${c.title}-${a}`,thumbnailURI:c.thumbUrl,rawUrl:c.rawUrl,authorName:c.authorName,authorAvatar:c.authorAvatar}))}}).filter(n=>n.items.length)}catch(o){console.log(o)}nt(()=>{this.state.query=t;this.state.categories=e})}};this.toggleCategorySelection=t=>{this.selectedCategory=this.selectedCategory!==t?t:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=t=>{const e=this.items.findIndex(o=>o.identifier===t);if(e!==-1){return this.items[e].rawUrl}return t};this.configStore=t.configStore;this.state=T(Yy);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(t=>t.items).reduce((t,e)=>[...t,...e],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};s([T],Mt.prototype,"selectedCategory",2);s([p],Mt.prototype,"initProvider",2);s([p],Mt.prototype,"fetchImages",2);s([p],Mt.prototype,"toggleCategorySelection",2);s([p],Mt.prototype,"dispose",2);s([h],Mt.prototype,"selectedCategoryIdentifier",1);s([h],Mt.prototype,"categories",1);s([h],Mt.prototype,"items",1);s([h],Mt.prototype,"query",1);s([h],Mt.prototype,"config",1);s([h],Mt.prototype,"locale",1);var lh=/^data:image\/(.+?);base64,/;var Ky=i=>lh.test(i);var qy=i=>i.match(/^data:([^;]+)/)[1];var Jy=i=>i.replace(lh,"");var fr=class{constructor(t){this.applySerialization=async(t,e,o,r)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const a="Unexpected error occured";const l=e.deserializeImage(t);if(l.image&&l.image.data){const u=l.image.data;await this.editor.setImage(u);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(u);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const c=e.deserializeTransformation(t);if(!c){r(a);return}await this.applyStateOnUI(c);const d=e.deserialize(t);if(!d){r(a);return}await this.applyStateOnUI(d);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}o()};this.editor=t}serialize({image:t}={image:false}){const e=this.editor.activeStore.tool==="transform";const{displaySerializationModal:o}=this.editor.configStore.config;if(o){this.editor.modalStore.showInfoModal("saving")}return new Promise((r,n)=>{import("./serialization-NEYY5PT4.js").then(async({Serializer:a})=>{try{if(e){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:l}=this.editor.imageContainer.getData();const c=this.editor.engineMediator.output.container.getResolution();const d={width:l.width,height:l.height};const u=new a(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,c,d,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const m={["adjustment"]:I(this.editor.adjustmentsToolStore.state),["filter"]:I(this.editor.filterToolStore.state),["focus"]:I(this.editor.focusToolStore.serializableState),["overlay"]:I(this.editor.overlayToolStore.state),["frame"]:I(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:f,customStickers:b}=await this.editor.spriteStore.serializableState();f.spriteIdList=f.spriteIdList.sort((x,C)=>{const D=f.common[x].order;const A=f.common[C].order;return D-A});m.sprite=f;m.customStickers=b;m.transform=this.editor.transformToolStore.serializableState;let y;let v;if(t){const x=fr.getDataURL(l);v=qy(x);y=Jy(x)}if(o){this.editor.modalStore.hideModal()}r(u.serialise(m,y,v));if(e){this.editor.transformToolStore.onEnter()}}catch(l){if(o){this.editor.modalStore.hideModal()}n(l)}})})}deserialize(t){this.editor.modalStore.showInfoModal("loading");return new Promise((e,o)=>{try{import("./serialization-NEYY5PT4.js").then(({Deserializers:r})=>{const n=t.version.match(/[0-3].[0-8].[0-9]/i);let a=null;if(n&&r["3.9.0"]){a=new r["3.9.0"](this.editor)}else if(r[t.version]){a=new r[t.version](this.editor)}else{a=new r["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(t,a,e,o)})}else{this.applySerialization(t,a,e,o)}})}catch(r){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}o(r)}})}static getDataURL(t){if(t instanceof HTMLImageElement){const{src:n}=t;if(Ky(n)){return n}}if(t instanceof HTMLCanvasElement){return t.toDataURL("image/png")}const e=document.createElement("canvas");e.width=t.width;e.height=t.height;const o=e.getContext("2d");o.drawImage(t,0,0);const r=e.toDataURL("image/png");oo(e);return r}async applyStateOnUI(t){const e=this.editor.activeStore.tool==="transform";try{if(t.transform){if(!e){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(t.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!e){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(t.filter){await this.editor.filterToolStore.updateStateFromSerialization(t.filter)}if(t.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(t.adjustment)}if(t.focus){await this.editor.focusToolStore.updateStateFromSerialization(t.focus)}if(t.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(t.overlay)}if(t.sprite){let o=Object.keys(t).length-1;if(t.customStickers){o-=1}t.sprite.spriteIdList=t.sprite.spriteIdList.sort((r,n)=>{const a=t.sprite.common[r].order;const l=t.sprite.common[n].order;return a-l});await this.editor.spriteStore.updateStateFromSerialization(t.sprite,t.customStickers,Math.max(0,o))}if(t.brush){this.editor.brushToolStore.updateStateFromHistory(t.brush)}if(t.frame){await this.editor.frameToolStore.updateStateFromSerialization(t.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(o){if(o.name==="AssetNotFoundError"){console.error(o)}else{console.error(o);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:o.message,handleConfirm:()=>{this.applyStateOnUI(t)}})}}}};var Zy=i=>{const t=atob(i.split(",")[1]);const e=i.split(",")[0].split(":")[1].split(";")[0];const o=new ArrayBuffer(t.length);const r=new Uint8Array(o);for(let n=0;ni.split(",")[0].split(":")[1].split(";")[0];var dh=i=>{if(typeof i==="string"){return ch(i)}if(i.src.includes(".svg")){return"image/svg+xml"}if(i.src){return ch(i.src)}return"image/jpeg"};var Un=Rt(Dc());var gr=class{static isImageElement(t){return t instanceof HTMLImageElement}constructor({license:t,assetProvider:e,crossOrigin:o,backgroundColor:r}){this.crossOrigin=o;this.engine=new Fr({license:t,crossOrigin:o,assetProvider:e,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:r})}getAllFilterPreviewThumbnails(t){return new Promise((e,o)=>{const r=[];const n=[];t.forEach(a=>{if(a.isDuotone)r.push(a.identifier);else n.push(a.identifier)});this.getAllDuotonePreview(r).then(a=>{this.getAllLutPreview(n).then(l=>{e(Object.assign(a,l))}).catch(l=>{o(l)})}).catch(a=>{o(a)})})}async getAllDuotonePreview(t){const e={};if(!t.length)return e;const o=await this.engine.addDuoToneFilterFromAssets(t[0],this.container);await(0,Un.default)(t,async r=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(r);const a=o.filterOperation.getFilter();a.set({intensity:.5,lightColor:Ps.Color.fromHex(n.lightColor),darkColor:Ps.Color.fromHex(n.darkColor)});const l=await this.engine.export("data-url","image/jpeg",.8,false,true);e[r]=l},{concurrency:1});this.engine.removeEffect(o);return e}async loadLutAssets(t){const e={};await(0,Un.default)(t,async o=>{e[o]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",o))});return e}async getAllLutPreview(t){const e={};if(!t.length)return e;const o=await this.loadLutAssets(t);const r=await this.engine.addLUTFilterFromAssets(t[0],this.container);await(0,Un.default)(t,async n=>{const a=this.engine.assetProvider.getLUTFilterAsset(n);const l=r.filterOperation.getFilter();const c={horizontalTileCount:a.horizontalTileCount||5,verticalTileCount:a.verticalTileCount||5,image:o[n]};l.set({...c,intensity:a.defaultIntensity||1});r.setProperties({intensity:1});l._lutPrimitive.set(c);const d=await this.engine.export("data-url","image/jpeg",.8,false,true);e[n]=d},{concurrency:1});this.engine.removeEffect(r);return e}addImageToContainer(t){return new Promise((e,o)=>{let r;if(gr.isImageElement(t)){r=t;this.setBackgroundImage(r);e()}else{this.getImageElement(t).then(n=>{r=n;this.setBackgroundImage(r);e()}).catch(n=>{o({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,o)=>{const r=new Image;r.addEventListener("load",()=>{e(r)});r.addEventListener("error",n=>{o(n)});r.crossOrigin=this.crossOrigin;r.src=t})}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t})}const{size:e}=this.container.getBounds();const o=this.engine.getOutputContainer();o.setResolution(e)}};var Qy={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};var Qt=class{constructor(t){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(t,e)=>{const{height:o,width:r}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:a,snapToTop:l,snapToBottom:c}=this.configStore.config.snapping.position;const d=Math.min(o,r);let u=0;if(e==="bottom"){u=Math.round(o-d*c)}else if(e==="top"){u=Math.round(d*l)}else if(e==="right"){u=Math.round(r-d*a)}else if(e==="left"){u=Math.round(d*n)}else if(t==="vertical"&&e==="center"){u=Math.round(r/2)}else if(t==="horizontal"&&e==="center"){u=Math.round(o/2)}return u};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:t,snapToLeft:e,snapToRight:o}=this.configStore.config.snapping.position;const r=[];if(t){r.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(e){r.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(o){r.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return r};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:t,snapToTop:e,snapToBottom:o}=this.configStore.config.snapping.position;const r=[];if(t){r.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(e){r.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(o){r.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return r};this.getRotationGuidesFromConfig=()=>{const{angles:t}=this.configStore.config.snapping.rotation;const e=[];t.forEach(r=>{e.push(r);e.push(r+360);e.push(r-360)});const o=e.filter((r,n)=>e.indexOf(r)===n);return o.map(r=>({value:r*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:t,leftBottom:e,rightTop:o,rightBottom:r})=>{const n=Math.min(t.y,o.y,e.y,r.y);const a=Math.max(t.y,o.y,e.y,r.y);const l=Math.min(t.x,o.x,e.x,r.x);const c=Math.max(t.x,o.x,e.x,r.x);return{height:Math.round(a-n),width:Math.round(c-l)}};this.mapRange=({value:t,fromMin:e,fromLength:o,toMin:r,toLength:n})=>{return(t-e)*n/o+r};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(t,e,o,r)=>{if(e.length===0){return t}if(e[0]>t){return t-o}for(let n=0;n=l-m){return l+u+(r?o*2:0)}return this.mapRange({value:t,fromMin:a,fromLength:l-a,toMin:c,toLength:d-c})}}if(r){return t+(e.length-1)*o*2+o}return t};this.mapFromSnapSystem=(t,e,o,r)=>{if(e.length===0){return t}if(e[0]>t){if(t>=e[0]-o){return e[0]}return t+o}let n=t;for(let l=0;l{const o=e*.5;const{value:r,edge:n}=t;let a=r;if(n==="leading"){a+=o}else if(n==="trailing"){a-=o}return a};this.mapSnappingGuidesToCenter=(t,e)=>{const o=[];t.forEach(r=>{o.push(this.centerSnapValue(r,e))});return o};this.calcSnapThresholdInRadians=(t,e)=>{if(t===0){return 0}return e/t};this.calculatePreviewTopLeftPosition=()=>{const t=this.editor.engineMediator.preview.container.getPosition();const e=this.editor.getPreviewSize();const o=Xt();this.previewTopLeftPosition={x:t.x/o-e.width/2,y:t.y/o-e.height/2}};this.snapToRotation=(t,e,o)=>{const{rotationGuides:r}=this.state;const{enabled:n,threshold:a}=this.configStore.config.snapping.rotation;const{x:l,y:c}=this.previewTopLeftPosition;const{width:d}=this.editor.getPreviewSize();let u=(t+Math.PI*2)%(Math.PI*2);if(n){const m=new g(e).magnitude;const f=r.map(v=>v.value).sort((v,x)=>v-x);const b=this.calcSnapThresholdInRadians(m,a);if(!this.rotationOffset){const v=this.mapToSnapSystem(t,f,b,false);this.rotationOffset=v-u}u=this.mapFromSnapSystem(u+this.rotationOffset,f,b,false);const y={x:o.position.x-l-d,y:o.position.y-c};r.forEach(v=>{v.isVisible=v.value===u;v.position=y});return u}return t};this.snapToPosition=(t,e)=>{const{horizontalGuides:o,verticalGuides:r}=this.state;const{enabled:n,threshold:a}=this.configStore.config.snapping.position;const l=new g(this.previewTopLeftPosition);const{height:c,width:d}=this.getSpriteDimensions(e);const{x:u,y:m}=new g(t).subtract(l);if(n){const f=this.mapSnappingGuidesToCenter(o,c).sort((x,C)=>x-C);const b=this.mapSnappingGuidesToCenter(r,d).sort((x,C)=>x-C);if(!this.positionOffset){const x=this.mapToSnapSystem(u,b,a,true);const C=this.mapToSnapSystem(m,f,a,true);this.positionOffset=new g(x,C).subtract(new g(u,m))}let y=this.mapFromSnapSystem(u+this.positionOffset.x,b,a,true);let v=this.mapFromSnapSystem(m+this.positionOffset.y,f,a,true);y=Math.round(y);v=Math.round(v);o.forEach(x=>{const C=Math.round(this.centerSnapValue(x,c));x.isVisible=C===v});r.forEach(x=>{const C=Math.round(this.centerSnapValue(x,d));x.isVisible=C===y});return new g(y,v).add(l)}return{x:u,y:m}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=t;this.configStore=t.configStore;this.state=T(Qy);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(t=>({...t,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(t=>({...t,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(t=>({...t,isVisible:false}))}get positionGuides(){const{verticalGuides:t,horizontalGuides:e}=this.state;return[...t,...e]}get rotationGuides(){return this.state.rotationGuides}};s([T],Qt.prototype,"state",2);s([p],Qt.prototype,"snapToRotation",2);s([p],Qt.prototype,"snapToPosition",2);s([p],Qt.prototype,"hidePositionGuides",1);s([p],Qt.prototype,"hideRotationGuides",1);s([p],Qt.prototype,"dispose",2);s([h],Qt.prototype,"positionGuides",1);s([h],Qt.prototype,"rotationGuides",1);var Gn=class{constructor(t,e){this.initWithImage=async t=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(t);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const e=this.configStore.config.engine;this.previewThumbnails=new gr({...e,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:e.identifier?e.identifier:"rendering",error:e,handleConfirm:()=>{this.initWithImage(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:t,height:e})=>{const{maxMegaPixels:o}=this.configStore.config.engine.downscaleOptions;const r=kc.isMobile()?o.mobile:o.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${r}`,width:`${t}`,height:`${e}`}})})};this.init=t=>{var r,n;if(!((r=this.activeStore)==null?void 0:r.image)){this.initWithImage(t);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const e=this.historyStore.isDirty();const{displayDiscardChangesWarning:o}=this.configStore.config;if(e&&o){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(t);this.resetToolStates()},handleDismiss:()=>{this.setImage(t,true)}});return}if(e&&!o){this.setImage(t,true);return}this.historyStore.reset();this.setImage(t,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:a,displayCanvasRendererWarning:l}=this.configStore.config;if(a.preferredRenderer==="canvas"&&l){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(t,e=false)=>{try{if(!this.activeStore.image){this.initWithImage(t)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(t);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:o,flipVertically:r,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:r,flipHorizontally:o});await this.transformToolStore.rotateOutputContainer(Pc(n),false);if(e){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const a=this.activeStore.tool;if(!a){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(o){this.configStore.events.onErrorImageLoading(o);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:o.identifier?o.identifier:"rendering",error:o,handleConfirm:()=>{this.setImage(t,e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(o)}};this.onToolChange=(t,e=null,o=true)=>{var r,n;if(t===e){return}if((n=(r=this.engineMediator)==null?void 0:r.preview)==null?void 0:n.container){if([t,e].indexOf("transform")!==-1){if(t==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(e==="transform"){this.transformToolStore.onEnter()}this.resize(e)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(o){this.render()}}};this.resize=(t=null)=>{if(!this.engineMediator)return;try{const e=this.activeStore.tool;const o=t==="transform"||!t&&e==="transform";this.canvasStore.resizeCanvas(t);this.transformToolStore.applyDefaultCrop();const r=I(this.transformToolStore.maxCropMaskSize);if(!o){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const a=this.engineMediator.preview.updateTransform(n);if(a){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(r);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const l=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(l);if(!o){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:t,...e}={})=>{const o=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(o){this.transformToolStore.onLeave()}const{config:r}=this.configStore;const n={...r.export.image,...e};const{exportType:a,format:l,quality:c,enableDownload:d,transparent:u}=n;const m=await this.engineMediator.engine.export(a,l,c,u);if(o&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(d){this.triggerFileDownload(r.export.filename,l,a,m)}if(!t){this.configStore.events.onExport(m)}return m}catch(r){if(this.modalStore){this.modalStore.hideModal()}if(o&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(r)}};this.serialize=({image:t}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:t})}return Promise.resolve({})};this.deserialize=t=>{if(this.serializationMediator){return this.serializationMediator.deserialize(t)}return Promise.resolve()};this.close=()=>{var t,e,o,r,n,a;if((((t=this.historyStore)==null?void 0:t.isDirtySinceSave)||((o=(e=this.transformToolStore)==null?void 0:e.transformHistory)==null?void 0:o.hasChanges()))&&((n=(r=this.configStore)==null?void 0:r.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var l;if((l=this.configStore)==null?void 0:l.events){this.configStore.events.onClose()}}})}else if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:t,height:e}=this.engine.getOutputDimensions();return{width:t,height:e}}return{width:0,height:0}};this.wait=(t=0)=>new Promise(e=>setTimeout(e,t));this.clickableCanvas=async t=>{if(t){await new Promise(e=>setTimeout(e,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:t}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(t){const e=this.transformToolStore.localOutputImageSize;const o=e.width/e.height;const r=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(r.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(r.indexOf(parseFloat(o.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(t,e,o)=>{this.historyStore.addSnapshot(t,e,o)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=t=>this.assetProvider.getPathForCategory(t);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=t=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(t)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:t,height:e}=this.engine.getOutputDimensions();if(t&&e){return{width:Math.round(this.worldToPreview(this.outputToWorld(t))),height:Math.round(this.worldToPreview(this.outputToWorld(e)))}}return{height:e,width:t}};this.getImageMimeType=()=>{return dh(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var t,e,o;(o=(e=(t=this.engineMediator)==null?void 0:t.image)==null?void 0:e.container)==null?void 0:o.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(t,e,o,r)=>{const n=e==="image/jpeg"&&o!=="ms-blob"?".jpeg":".png";const a=t+n;const l=this.blobFromExportData(r);this.triggerBlobDownload(a,l)};this.triggerBlobDownload=(t,e)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(e,t)}else{const o=document.createElement("a");const r=URL.createObjectURL(e);o.href=r;o.download=t;document.body.appendChild(o);o.click();document.body.removeChild(o);if(!nc()){URL.revokeObjectURL(r)}}};this.blobFromExportData=t=>{if(typeof t==="string"){return ll(t)}if(t instanceof HTMLImageElement){return ll(t.src)}return t};this.configStore=new St;if(e){Object.entries(e).forEach(([r,n])=>{this.configStore.events.on(r,n)})}const o=this.configStore.saveConfig(t);this.engineMediator=new el(this);this.serializationMediator=new fr(this);this.spriteStore=new k(this);this.scale=new ct(this);this.filterToolStore=new ot(this);this.adjustmentsToolStore=new G(this);this.focusToolStore=new $(this);this.overlayToolStore=new at(this);this.frameToolStore=new Z(this);this.brushToolStore=new J(this);this.transformToolStore=new w(this);this.libraryStore=new Mt(this);this.modalStore=new Bt(this);this.snappingStore=new Qt(this);this.activeStore=new It(this);this.canvasStore=new yt(this);this.historyStore=new Fi(this);this.libraryStore.initProvider(o);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const t=this.outputContainer.getBounds();return Math.min(t.width,t.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(t,e){if(!this.engineMediator)return{x:0,y:0};if(re(t)){return this.engineMediator.previewSpaceToWorldSpace(t,e)}return this.engineMediator.previewSpaceToWorldSpace(t,e)}worldToPreview(t){if(!this.engineMediator)return{x:0,y:0};if(re(t)){return this.engineMediator.worldSpaceToPreviewSpace(t)}return this.engineMediator.worldSpaceToPreviewSpace(t)}worldSizeToPreview(t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(t.width),height:this.engineMediator.worldSpaceToPreviewSpace(t.height)}}previewSizeToWorld(t,e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(t.width,e),height:this.engineMediator.previewSpaceToWorldSpace(t.height,e)}}outputToWorld(t){if(!this.engineMediator)return{x:0,y:0};if(re(t)){return this.engineMediator.outputSpaceToWorldSpace(t)}return this.engineMediator.outputSpaceToWorldSpace(t)}previewToOutput(t){if(!this.engineMediator)return{x:0,y:0};if(re(t)){return this.engineMediator.previewSpaceToOutputSpace(t)}return this.engineMediator.previewSpaceToOutputSpace(t)}get outputContainer(){return this.engineMediator.output.container}};s([p],Gn.prototype,"resize",2);s([p],Gn.prototype,"export",2);s([p],Gn.prototype,"clickableCanvas",2);import ph from"react";var hh=({children:i})=>ph.createElement(ph.Fragment,null,i);import iv from"react";import tv from"styled-components";var uh=tv(Pi)` margin: 2px; min-width: ${i=>i.theme.measurements.basicCard.large.width}px; height: ${i=>i.theme.measurements.basicCard.large.height}px; diff --git a/esm/chunk-F2RTEFCB.js b/esm/chunk-K4UIUOUT.js similarity index 99% rename from esm/chunk-F2RTEFCB.js rename to esm/chunk-K4UIUOUT.js index ab62c74..0c16d0c 100644 --- a/esm/chunk-F2RTEFCB.js +++ b/esm/chunk-K4UIUOUT.js @@ -1,4 +1,4 @@ -import{B as Qe,D as ko,G as xe,H as Ze,I as D,K as eo,M as Uo,N as oo,O as Fo,P as to,Q as ro,R as Lo,T as Ee,a as s,b as yo,c as R,f as ye,h as qe,m as oe,n as B,o as Je,p as Eo,q as Ao,r as h,u as a,w as Bo,x as Oo,z as de}from"./chunk-CYND4KUN.js";import{La as Ie,Oa as A,Ta as I,Xa as k,Ya as xo,a as ve,b as To,c as Se,n as Io,s as Te,t as N}from"./chunk-UDNMGV4K.js";var et=ve((bs,Zo)=>{"use strict";var On=false;var Qo=function(){};if(On){Jo=function e(t,r){var n=arguments.length;r=new Array(n>1?n-1:0);for(var o=1;o2?n-2:0);for(var o=2;o{"use strict";var Rn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";it.exports=Rn});var dt=ve((Rs,mt)=>{"use strict";var $n=at();function st(){}function lt(){}lt.resetWarningCache=st;mt.exports=function(){function e(n,o,i,m,d,p){if(p===$n){return}var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");c.name="Invariant Violation";throw c};e.isRequired=e;function t(){return e};var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:lt,resetWarningCache:st};r.PropTypes=r;return r}});var ct=ve((Ms,pt)=>{if(false){$s=null;Hs=true;pt.exports=null($s.isElement,Hs)}else{pt.exports=dt()()}var $s;var Hs});import Ye from"react";import{ThemeProvider as Ri}from"styled-components";import Zr from"react";import Vr from"react";import Xr from"styled-components";var Kr=Xr(oe)` +import{B as Qe,D as ko,G as xe,H as Ze,I as D,K as eo,M as Uo,N as oo,O as Fo,P as to,Q as ro,R as Lo,T as Ee,a as s,b as yo,c as R,f as ye,h as qe,m as oe,n as B,o as Je,p as Eo,q as Ao,r as h,u as a,w as Bo,x as Oo,z as de}from"./chunk-CV3QEYL2.js";import{La as Ie,Oa as A,Ta as I,Xa as k,Ya as xo,a as ve,b as To,c as Se,n as Io,s as Te,t as N}from"./chunk-UDNMGV4K.js";var et=ve((bs,Zo)=>{"use strict";var On=false;var Qo=function(){};if(On){Jo=function e(t,r){var n=arguments.length;r=new Array(n>1?n-1:0);for(var o=1;o2?n-2:0);for(var o=2;o{"use strict";var Rn="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";it.exports=Rn});var dt=ve((Rs,mt)=>{"use strict";var $n=at();function st(){}function lt(){}lt.resetWarningCache=st;mt.exports=function(){function e(n,o,i,m,d,p){if(p===$n){return}var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");c.name="Invariant Violation";throw c};e.isRequired=e;function t(){return e};var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:lt,resetWarningCache:st};r.PropTypes=r;return r}});var ct=ve((Ms,pt)=>{if(false){$s=null;Hs=true;pt.exports=null($s.isElement,Hs)}else{pt.exports=dt()()}var $s;var Hs});import Ye from"react";import{ThemeProvider as Ri}from"styled-components";import Zr from"react";import Vr from"react";import Xr from"styled-components";var Kr=Xr(oe)` width: ${e=>e.theme.measurements.advancedUICard.large.width}px; height: ${e=>e.theme.measurements.advancedUICard.large.height}px; margin-bottom: ${e=>e.theme.measurements.advancedUISpacer}px; @@ -308,4 +308,4 @@ import{B as Qe,D as ko,G as xe,H as Ze,I as D,K as eo,M as Uo,N as oo,O as Fo,P z-index: ${e=>e.theme.measurements.zIndex.disable}; `;var he=class extends x.Component{static getDerivedStateFromError(t){console.error(t);return{hasError:true}}render(){const{config:t,active:r,canvas:n,custom:o}=this.props;const i=o.getWindowContainer();return t.isOrderDefault?x.createElement(h.Container,null,r.isWebcam?x.createElement($r,{style:{left:0}}):null,x.createElement(oo,null),x.createElement(ho,null),x.createElement(vo,null),x.createElement(Qe,null,x.createElement(Ze,null),i&&x.createElement(i,{tool:r.tool},x.createElement(ro,null,r.isWebcam?x.createElement(to,null):null,r.image&&n&&x.createElement(eo,null))))):x.createElement(h.Container,null,r.isWebcam?x.createElement($r,{style:{right:0}}):null,x.createElement(oo,null),x.createElement(Qe,null,x.createElement(Ze,null),i&&x.createElement(i,{tool:r.tool},x.createElement(ro,null,r.isWebcam?x.createElement(to,null):null,r.image&&n&&x.createElement(eo,null)))),x.createElement(vo,null),x.createElement(ho,null))}};he=Se([R("config","active","canvas","custom"),s],he);import be from"react";import _i from"styled-components";var Hr=class extends be.Component{constructor(t){super(t);this.ref=null;this.updatePosition=()=>{const{isReverse:t}=this.props;const r={x:0,y:0};if(this.ref.current){const{top:n,height:o,left:i,right:m}=this.ref.current.getBoundingClientRect();r.y=n+o/4;r.x=t?window.innerWidth-m:i}this.setState({tooltipPosition:r})};this.mouseOver=t=>{this.updatePosition();this.setState({hoverTool:t})};this.mouseOut=()=>{this.setState({hoverTool:null})};this.state={hoverTool:null,tooltipPosition:{x:0,y:0}};this.ref=be.createRef()}componentDidMount(){this.updatePosition()}componentDidUpdate(t){const{isReverse:r}=this.props;if(r!==t.isReverse){this.updatePosition()}}render(){const{tool:t,isActive:r,isReverse:n,isDisabled:o,icon:i,label:m,onClick:d,className:p,children:c}=this.props;const{hoverTool:b,tooltipPosition:f}=this.state;return be.createElement(Pi,{ref:this.ref,onMouseOver:()=>this.mouseOver(t),onMouseOut:()=>this.mouseOut(),onFocus:()=>this.mouseOver(t),onBlur:()=>this.mouseOut(),className:p},be.createElement(l.Toolbar.Item,{ariaLabel:m,isActive:r,isDisabled:o,onClick:()=>d(t)},i,c),be.createElement(l.Toolbar.Tooltip,{position:f,reverse:n,show:b===t},m))}};var je=Hr;var Pi=_i.div` position: relative; -`;var Ve=class extends Ye.Component{constructor(){super(...arguments);this.componentWillUnmount=()=>{this.editor.cleanUpCanvasMemory()}}componentDidMount(){const{editor:t,storeProps:r}=this.props;this.editor=t;this.storeProps=r;const n=new Uo(this.editor.configStore.config.custom.components,{advancedUICategoryCard:l.Card,advancedUIItemCard:l.Card,advancedUIToolbarItem:je,advancedUIToolbar:l.Toolbar.Index,advancedUIToolControlBar:l.Sidebar.Index});const o={getAdvancedCategoryCard:n.getAdvancedCategoryCard,getAdvancedItemCard:n.getAdvancedItemCard,getAdvancedToolbarItem:n.getAdvancedToolbarItem,getAdvancedToolbar:n.getAdvancedToolbar,getAdvancedToolControlBar:n.getAdvancedToolControlBar,getDialog:n.getDialog,getButton:n.getButton,getColorItem:n.getColorItem,getCheckbox:n.getCheckbox,getWindowContainer:n.getWindowContainer,getSlider:n.getSlider};this.storeProps.custom=o;this.forceUpdate()}render(){return this.storeProps?Ye.createElement(yo,{...this.storeProps},Ye.createElement(Ri,{theme:{...this.editor.configStore.theme,measurements:this.editor.configStore.measurements}},Ye.createElement(he,null))):null}};import Mr,{useEffect as Gi}from"react";import Wr from"react-dom";import ge,{Suspense as $i,useMemo as Hi}from"react";var Mi=ge.lazy(()=>import("./basic-MI36SGM4.js"));var Wi=e=>{return{filterTool:e.filterToolStore,focusTool:e.focusToolStore,adjustmentsTool:e.adjustmentsToolStore,overlayTool:e.overlayToolStore,frameTool:e.frameToolStore,brushTool:e.brushToolStore,transformTool:e.transformToolStore,scale:e.scale,sprite:e.spriteStore,stickerTool:e.spriteStore.stickerToolStore,textTool:e.spriteStore.textToolStore,textDesignTool:e.spriteStore.textDesignToolStore,library:e.libraryStore,modal:e.modalStore,snapping:e.snappingStore,config:e.configStore,active:e.activeStore,canvas:e.canvasStore,history:e.historyStore,editor:e}};var Xe=({editor:e})=>{const t=Hi(()=>{return Wi(e)},[e]);if(e.configStore.config.layout==="basic"){return ge.createElement($i,{fallback:ge.createElement("div",null)},ge.createElement(Mi,{editor:e,storeProps:t}))}return ge.createElement(Ve,{editor:e,storeProps:t})};var zr=class extends Ie{constructor(t,r,n){super();this.dispose=()=>{if(this.container){Wr.unmountComponentAtNode(this.container);this.removeAllListeners("export");this.removeAllListeners("historyUndo");this.removeAllListeners("historyRedo");this.removeAllListeners("historyChange");this.removeAllListeners("editorReady");this.removeAllListeners("errorImageLoading");this.removeAllListeners("imageLoad");this.removeAllListeners("toolEnter");this.removeAllListeners("stickerUploadAdd");this.removeAllListeners("errorWebGLContextLost");this.removeAllListeners("cropDimensionsChange");if(this.editor){this.editor.dispose()}}};this.serialize=t=>{return this.editor.serialize(t)};this.deserialize=t=>{return this.editor.deserialize(t)};this.export=t=>{return this.editor.export(t)};this.close=()=>{return this.editor.close()};this.setImage=t=>{return this.editor.setImage(t,true)};this.getImageDimensions=()=>{return this.editor.getImageDimensions()};this.getImageMimeType=()=>{return this.editor.getImageMimeType()};this.reset=()=>{this.editor.resetToolStates();this.editor.resize()};this.container=r;const o={["export"]:i=>{this.emit("export",i)},["close"]:()=>{this.emit("close");this.dispose()},["historyUndo"]:()=>{this.emit("historyUndo")},["historyRedo"]:()=>{this.emit("historyRedo")},["historyChange"]:()=>{this.emit("historyChange")},["stickerUploadAdd"]:i=>{this.emit("stickerUploadAdd",i)},["cropDimensionsChange"]:i=>{this.emit("cropDimensionsChange",i)}};if(n){Object.entries(n).forEach(([i,m])=>{o[i]=m(this)})}this.editor=new xe({...t},o)}hasChanges(){return this.editor.hasChanges()}};var Gr=class{constructor(){this.container=null}init(t){return new Promise((r,n)=>{if(typeof window==="undefined"){r();return}this.container=typeof t.container==="string"?document.querySelector(t.container):t.container;if(this.container){this.editorApi=new zr(t,this.container,{["editorReady"]:o=>()=>{setTimeout(()=>{o.emit("editorReady")},0);r(o)},["errorImageLoading"]:o=>i=>{setTimeout(()=>{o.emit("errorImageLoading",i)},0);r(o)},["errorWebGLContextLost"]:o=>i=>{setTimeout(()=>{o.emit("errorWebGLContextLost",i)},0);r(o)},["imageLoad"]:o=>()=>{setTimeout(()=>{o.emit("imageLoad")},0);r(o)},["toolEnter"]:o=>i=>{setTimeout(()=>{o.emit("toolEnter",i)},0);r(o)}});Wr.render(Mr.createElement(ji,{editor:this.editorApi.editor}),this.container)}else{n(new Error("Provide a container"))}})}};var ji=({editor:e})=>{Gi(()=>{return()=>{var t;if((t=e==null?void 0:e.configStore)==null?void 0:t.events){e.configStore.events.removeAllListeners("export");e.configStore.events.removeAllListeners("close");e.configStore.events.removeAllListeners("historyUndo");e.configStore.events.removeAllListeners("historyRedo");e.configStore.events.removeAllListeners("historyChange");e.configStore.events.removeAllListeners("editorReady");e.configStore.events.removeAllListeners("errorImageLoading");e.configStore.events.removeAllListeners("imageLoad");e.configStore.events.removeAllListeners("toolEnter");e.configStore.events.removeAllListeners("stickerUploadAdd");e.configStore.events.removeAllListeners("errorWebGLContextLost");e.configStore.events.removeAllListeners("cropDimensionsChange")}}},[]);return Mr.createElement(Xe,{editor:e})};var Yi={init:e=>{const t=new Gr;return t.init(e)}};import So from"react";var jr=class extends So.Component{constructor(t){super(t);this.ui=new Ie;this.serialize=t=>{return this.editor.serialize(t)};this.deserialize=t=>{return this.editor.deserialize(t)};this.export=t=>{return this.editor.export(t)};this.close=()=>{return this.editor.close()};this.setImage=t=>{return this.editor.setImage(t,true)};this.getImageDimensions=()=>{return this.editor.getImageDimensions()};this.dispose=()=>{this.ui.removeAllListeners("export");this.ui.removeAllListeners("historyUndo");this.ui.removeAllListeners("historyRedo");this.ui.removeAllListeners("historyChange");this.ui.removeAllListeners("editorReady");this.ui.removeAllListeners("errorImageLoading");this.ui.removeAllListeners("imageLoad");this.ui.removeAllListeners("toolEnter");this.ui.removeAllListeners("stickerUploadAdd");this.ui.removeAllListeners("errorWebGLContextLost");this.ui.removeAllListeners("cropDimensionsChange");if(this.editor){this.editor.dispose()}};this.reset=()=>{this.editor.resetToolStates();this.editor.resize()};this.editor=new xe({...t},{["export"]:r=>{this.ui.emit("export",r)},["close"]:()=>{this.componentWillUnmount();this.ui.emit("close")},["historyUndo"]:()=>{this.ui.emit("historyUndo")},["historyRedo"]:()=>{this.ui.emit("historyRedo")},["historyChange"]:()=>{this.ui.emit("historyChange")},["editorReady"]:()=>{this.ui.emit("editorReady")},["errorImageLoading"]:r=>{this.ui.emit("errorImageLoading",r)},["imageLoad"]:()=>{this.ui.emit("imageLoad")},["toolEnter"]:r=>{this.ui.emit("toolEnter",r)},["stickerUploadAdd"]:r=>{this.ui.emit("stickerUploadAdd",r)},["cropDimensionsChange"]:r=>{this.ui.emit("cropDimensionsChange",r)},["errorWebGLContextLost"]:()=>{this.ui.emit("errorWebGLContextLost")}})}componentWillUnmount(){this.dispose()}hasChanges(){return this.editor.hasChanges()}render(){return So.createElement(Xe,{editor:this.editor})}};var Vi=e=>{if(typeof window==="undefined"){return null}return So.createElement(jr,{...e})};var fS=()=>{const{active:e}=a();return e.newImage};var bS=()=>{const{active:e}=a();return e.image};var SS=()=>{const e=a();return e.config.isLayoutAdvanced};Io({isolateGlobalState:true});var{Container:zS,Input:Xi,ColorItem:GS,ColorItemBase:jS,ColorItemBackground:YS,ColorItemTiledBackground:VS,ColorItemActiveOverlay:XS,Dialog:KS,DialogBase:qS,DialogContainer:JS,DialogBackdrop:QS,DialogHeader:ZS,DialogBody:eT,DialogFooter:oT,DialogSpinner:tT}=h;var{Search:Ki,Label:rT,Checkbox:nT,CheckboxBase:iT,CheckboxInput:aT,CheckboxCheckMark:sT,Dropdown:lT,Slider:mT,SliderBase:dT,SliderContainer:pT,SliderInput:cT,SliderTrack:uT,SliderLabel:fT}=Xi;var CT=pe;var hT=pe;var bT=Ki;var gT=l.Toolbar.Index;var vT=l.Sidebar.Index;var ST=l.Controlsbar;var TT=Ee.Toolbar.Index;var IT=Ee.Controlsbar;var yT=Ee.Itemsbar;export{je as a,Yi as b,Vi as c,fS as d,bS as e,SS as f,zS as g,GS as h,jS as i,YS as j,VS as k,XS as l,KS as m,qS as n,JS as o,QS as p,ZS as q,eT as r,oT as s,tT as t,rT as u,nT as v,iT as w,aT as x,sT as y,lT as z,mT as A,dT as B,pT as C,cT as D,uT as E,fT as F,CT as G,hT as H,bT as I,gT as J,vT as K,ST as L,TT as M,IT as N,yT as O}; +`;var Ve=class extends Ye.Component{constructor(){super(...arguments);this.componentWillUnmount=()=>{this.editor.cleanUpCanvasMemory()}}componentDidMount(){const{editor:t,storeProps:r}=this.props;this.editor=t;this.storeProps=r;const n=new Uo(this.editor.configStore.config.custom.components,{advancedUICategoryCard:l.Card,advancedUIItemCard:l.Card,advancedUIToolbarItem:je,advancedUIToolbar:l.Toolbar.Index,advancedUIToolControlBar:l.Sidebar.Index});const o={getAdvancedCategoryCard:n.getAdvancedCategoryCard,getAdvancedItemCard:n.getAdvancedItemCard,getAdvancedToolbarItem:n.getAdvancedToolbarItem,getAdvancedToolbar:n.getAdvancedToolbar,getAdvancedToolControlBar:n.getAdvancedToolControlBar,getDialog:n.getDialog,getButton:n.getButton,getColorItem:n.getColorItem,getCheckbox:n.getCheckbox,getWindowContainer:n.getWindowContainer,getSlider:n.getSlider};this.storeProps.custom=o;this.forceUpdate()}render(){return this.storeProps?Ye.createElement(yo,{...this.storeProps},Ye.createElement(Ri,{theme:{...this.editor.configStore.theme,measurements:this.editor.configStore.measurements}},Ye.createElement(he,null))):null}};import Mr,{useEffect as Gi}from"react";import Wr from"react-dom";import ge,{Suspense as $i,useMemo as Hi}from"react";var Mi=ge.lazy(()=>import("./basic-C7DKMWA4.js"));var Wi=e=>{return{filterTool:e.filterToolStore,focusTool:e.focusToolStore,adjustmentsTool:e.adjustmentsToolStore,overlayTool:e.overlayToolStore,frameTool:e.frameToolStore,brushTool:e.brushToolStore,transformTool:e.transformToolStore,scale:e.scale,sprite:e.spriteStore,stickerTool:e.spriteStore.stickerToolStore,textTool:e.spriteStore.textToolStore,textDesignTool:e.spriteStore.textDesignToolStore,library:e.libraryStore,modal:e.modalStore,snapping:e.snappingStore,config:e.configStore,active:e.activeStore,canvas:e.canvasStore,history:e.historyStore,editor:e}};var Xe=({editor:e})=>{const t=Hi(()=>{return Wi(e)},[e]);if(e.configStore.config.layout==="basic"){return ge.createElement($i,{fallback:ge.createElement("div",null)},ge.createElement(Mi,{editor:e,storeProps:t}))}return ge.createElement(Ve,{editor:e,storeProps:t})};var zr=class extends Ie{constructor(t,r,n){super();this.dispose=()=>{if(this.container){Wr.unmountComponentAtNode(this.container);this.removeAllListeners("export");this.removeAllListeners("historyUndo");this.removeAllListeners("historyRedo");this.removeAllListeners("historyChange");this.removeAllListeners("editorReady");this.removeAllListeners("errorImageLoading");this.removeAllListeners("imageLoad");this.removeAllListeners("toolEnter");this.removeAllListeners("stickerUploadAdd");this.removeAllListeners("errorWebGLContextLost");this.removeAllListeners("cropDimensionsChange");if(this.editor){this.editor.dispose()}}};this.serialize=t=>{return this.editor.serialize(t)};this.deserialize=t=>{return this.editor.deserialize(t)};this.export=t=>{return this.editor.export(t)};this.close=()=>{return this.editor.close()};this.setImage=t=>{return this.editor.setImage(t,true)};this.getImageDimensions=()=>{return this.editor.getImageDimensions()};this.getImageMimeType=()=>{return this.editor.getImageMimeType()};this.reset=()=>{this.editor.resetToolStates();this.editor.resize()};this.container=r;const o={["export"]:i=>{this.emit("export",i)},["close"]:()=>{this.emit("close");this.dispose()},["historyUndo"]:()=>{this.emit("historyUndo")},["historyRedo"]:()=>{this.emit("historyRedo")},["historyChange"]:()=>{this.emit("historyChange")},["stickerUploadAdd"]:i=>{this.emit("stickerUploadAdd",i)},["cropDimensionsChange"]:i=>{this.emit("cropDimensionsChange",i)}};if(n){Object.entries(n).forEach(([i,m])=>{o[i]=m(this)})}this.editor=new xe({...t},o)}hasChanges(){return this.editor.hasChanges()}};var Gr=class{constructor(){this.container=null}init(t){return new Promise((r,n)=>{if(typeof window==="undefined"){r();return}this.container=typeof t.container==="string"?document.querySelector(t.container):t.container;if(this.container){this.editorApi=new zr(t,this.container,{["editorReady"]:o=>()=>{setTimeout(()=>{o.emit("editorReady")},0);r(o)},["errorImageLoading"]:o=>i=>{setTimeout(()=>{o.emit("errorImageLoading",i)},0);r(o)},["errorWebGLContextLost"]:o=>i=>{setTimeout(()=>{o.emit("errorWebGLContextLost",i)},0);r(o)},["imageLoad"]:o=>()=>{setTimeout(()=>{o.emit("imageLoad")},0);r(o)},["toolEnter"]:o=>i=>{setTimeout(()=>{o.emit("toolEnter",i)},0);r(o)}});Wr.render(Mr.createElement(ji,{editor:this.editorApi.editor}),this.container)}else{n(new Error("Provide a container"))}})}};var ji=({editor:e})=>{Gi(()=>{return()=>{var t;if((t=e==null?void 0:e.configStore)==null?void 0:t.events){e.configStore.events.removeAllListeners("export");e.configStore.events.removeAllListeners("close");e.configStore.events.removeAllListeners("historyUndo");e.configStore.events.removeAllListeners("historyRedo");e.configStore.events.removeAllListeners("historyChange");e.configStore.events.removeAllListeners("editorReady");e.configStore.events.removeAllListeners("errorImageLoading");e.configStore.events.removeAllListeners("imageLoad");e.configStore.events.removeAllListeners("toolEnter");e.configStore.events.removeAllListeners("stickerUploadAdd");e.configStore.events.removeAllListeners("errorWebGLContextLost");e.configStore.events.removeAllListeners("cropDimensionsChange")}}},[]);return Mr.createElement(Xe,{editor:e})};var Yi={init:e=>{const t=new Gr;return t.init(e)}};import So from"react";var jr=class extends So.Component{constructor(t){super(t);this.ui=new Ie;this.serialize=t=>{return this.editor.serialize(t)};this.deserialize=t=>{return this.editor.deserialize(t)};this.export=t=>{return this.editor.export(t)};this.close=()=>{return this.editor.close()};this.setImage=t=>{return this.editor.setImage(t,true)};this.getImageDimensions=()=>{return this.editor.getImageDimensions()};this.dispose=()=>{this.ui.removeAllListeners("export");this.ui.removeAllListeners("historyUndo");this.ui.removeAllListeners("historyRedo");this.ui.removeAllListeners("historyChange");this.ui.removeAllListeners("editorReady");this.ui.removeAllListeners("errorImageLoading");this.ui.removeAllListeners("imageLoad");this.ui.removeAllListeners("toolEnter");this.ui.removeAllListeners("stickerUploadAdd");this.ui.removeAllListeners("errorWebGLContextLost");this.ui.removeAllListeners("cropDimensionsChange");if(this.editor){this.editor.dispose()}};this.reset=()=>{this.editor.resetToolStates();this.editor.resize()};this.editor=new xe({...t},{["export"]:r=>{this.ui.emit("export",r)},["close"]:()=>{this.componentWillUnmount();this.ui.emit("close")},["historyUndo"]:()=>{this.ui.emit("historyUndo")},["historyRedo"]:()=>{this.ui.emit("historyRedo")},["historyChange"]:()=>{this.ui.emit("historyChange")},["editorReady"]:()=>{this.ui.emit("editorReady")},["errorImageLoading"]:r=>{this.ui.emit("errorImageLoading",r)},["imageLoad"]:()=>{this.ui.emit("imageLoad")},["toolEnter"]:r=>{this.ui.emit("toolEnter",r)},["stickerUploadAdd"]:r=>{this.ui.emit("stickerUploadAdd",r)},["cropDimensionsChange"]:r=>{this.ui.emit("cropDimensionsChange",r)},["errorWebGLContextLost"]:()=>{this.ui.emit("errorWebGLContextLost")}})}componentWillUnmount(){this.dispose()}hasChanges(){return this.editor.hasChanges()}render(){return So.createElement(Xe,{editor:this.editor})}};var Vi=e=>{if(typeof window==="undefined"){return null}return So.createElement(jr,{...e})};var fS=()=>{const{active:e}=a();return e.newImage};var bS=()=>{const{active:e}=a();return e.image};var SS=()=>{const e=a();return e.config.isLayoutAdvanced};Io({isolateGlobalState:true});var{Container:zS,Input:Xi,ColorItem:GS,ColorItemBase:jS,ColorItemBackground:YS,ColorItemTiledBackground:VS,ColorItemActiveOverlay:XS,Dialog:KS,DialogBase:qS,DialogContainer:JS,DialogBackdrop:QS,DialogHeader:ZS,DialogBody:eT,DialogFooter:oT,DialogSpinner:tT}=h;var{Search:Ki,Label:rT,Checkbox:nT,CheckboxBase:iT,CheckboxInput:aT,CheckboxCheckMark:sT,Dropdown:lT,Slider:mT,SliderBase:dT,SliderContainer:pT,SliderInput:cT,SliderTrack:uT,SliderLabel:fT}=Xi;var CT=pe;var hT=pe;var bT=Ki;var gT=l.Toolbar.Index;var vT=l.Sidebar.Index;var ST=l.Controlsbar;var TT=Ee.Toolbar.Index;var IT=Ee.Controlsbar;var yT=Ee.Itemsbar;export{je as a,Yi as b,Vi as c,fS as d,bS as e,SS as f,zS as g,GS as h,jS as i,YS as j,VS as k,XS as l,KS as m,qS as n,JS as o,QS as p,ZS as q,eT as r,oT as s,tT as t,rT as u,nT as v,iT as w,aT as x,sT as y,lT as z,mT as A,dT as B,pT as C,cT as D,uT as E,fT as F,CT as G,hT as H,bT as I,gT as J,vT as K,ST as L,TT as M,IT as N,yT as O}; diff --git a/esm/index.js b/esm/index.js index eac8086..0623110 100644 --- a/esm/index.js +++ b/esm/index.js @@ -1,4 +1,4 @@ -import{A as m3,B as S3,C as b3,D as E3,E as I3,F as T3,G as A3,H as w3,I as O3,J as x3,K as R3,L as P3,M as _3,N as F3,O as M3,a as KW,b as zW,c as YW,d as XW,e as JW,f as ZW,g as QW,h as r3,i as e3,j as t3,k as n3,l as a3,m as i3,n as u3,o as o3,p as s3,q as f3,r as v3,s as c3,t as l3,u as h3,v as d3,w as p3,x as g3,y as q3,z as y3}from"./chunk-F2RTEFCB.js";import{C as HW,E as kW,F as VW,L as WW,e as FW,g as MW,h as LW,i as CW,j as jW,k as DW,l as UW,n as NW,o as $W,s as BW,t as GW}from"./chunk-CYND4KUN.js";import{$ as KV,Aa as SW,B as bV,Ba as bW,C as EV,Ca as EW,D as IV,Da as IW,E as TV,Ea as TW,F as AV,Fa as AW,G as wV,Ga as wW,H as OV,Ha as OW,I as xV,Ia as xW,J as RV,Ja as RW,K as PV,Ka as PW,L as _V,La as _W,M as FV,N as MV,O as LV,P as CV,Q as jV,R as DV,S as UV,T as NV,U as $V,V as BV,W as GV,X as HV,Y as kV,Z as VV,_ as WV,a as o,aa as zV,b as Xf,ba as YV,ca as XV,da as JV,ea as ZV,fa as QV,ga as rW,ha as eW,ia as tW,ja as nW,ka as aW,la as iW,ma as uW,na as oW,oa as sW,pa as fW,qa as vW,ra as cW,sa as lW,ta as hW,ua as dW,va as pW,wa as gW,xa as qW,ya as yW,za as mW}from"./chunk-UDNMGV4K.js";var nv=o((L3,tv)=>{"use strict";tv.exports=mi;function mi(r){if(!Nr.length){_n();Qf=true}Nr[Nr.length]=r}var Nr=[];var Qf=false;var _n;var Ur=0;var M0=1024;function Jf(){while(UrM0){for(var e=0,t=Nr.length-Ur;e{"use strict";var C0=nv();function Mn(){}var He=null;var ke={};function j0(r){try{return r.then}catch(e){He=e;return ke}}function D0(r,e){try{return r(e)}catch(t){He=t;return ke}}function U0(r,e,t){try{r(e,t)}catch(n){He=n;return ke}}uv.exports=yr;function yr(r){if(typeof this!=="object"){throw new TypeError("Promises must be constructed via new")}if(typeof r!=="function"){throw new TypeError("Promise constructor's argument is not a function")}this._U=0;this._V=0;this._W=null;this._X=null;if(r===Mn)return;iv(r,this)}yr._Y=null;yr._Z=null;yr._0=Mn;yr.prototype.then=function(r,e){if(this.constructor!==yr){return N0(this,r,e)}var t=new yr(Mn);Fn(this,new av(r,e,t));return t};function N0(r,e,t){return new r.constructor(function(n,a){var i=new yr(Mn);i.then(n,a);Fn(r,new av(e,t,i))})}function Fn(r,e){while(r._V===3){r=r._W}if(yr._Y){yr._Y(r)}if(r._V===0){if(r._U===0){r._U=1;r._X=e;return}if(r._U===1){r._U=2;r._X=[r._X,e];return}r._X.push(e);return}$0(r,e)}function $0(r,e){C0(function(){var t=r._V===1?e.onFulfilled:e.onRejected;if(t===null){if(r._V===1){Si(e.promise,r._W)}else{Ge(e.promise,r._W)}return}var n=D0(t,r._W);if(n===ke){Ge(e.promise,He)}else{Si(e.promise,n)}})}function Si(r,e){if(e===r){return Ge(r,new TypeError("A promise cannot be resolved with itself."))}if(e&&(typeof e==="object"||typeof e==="function")){var t=j0(e);if(t===ke){return Ge(r,He)}if(t===r.then&&e instanceof yr){r._V=3;r._W=e;bi(r);return}else if(typeof t==="function"){iv(t.bind(e),r);return}}r._V=1;r._W=e;bi(r)}function Ge(r,e){r._V=2;r._W=e;if(yr._Z){yr._Z(r,e)}bi(r)}function bi(r){if(r._U===1){Fn(r,r._X);r._X=null}if(r._U===2){for(var e=0;e{"use strict";var Ln=Ei();var ov=[ReferenceError,TypeError,RangeError];var Ii=false;Ti.disable=fv;function fv(){Ii=false;Ln._Y=null;Ln._Z=null}Ti.enable=B0;function B0(r){r=r||{};if(Ii)fv();Ii=true;var e=0;var t=0;var n={};Ln._Y=function(u){if(u._V===2&&n[u._1]){if(n[u._1].logged){i(u._1)}else{clearTimeout(n[u._1].timeout)}delete n[u._1]}};Ln._Z=function(u,f){if(u._U===0){u._1=e++;n[u._1]={displayId:null,error:f,timeout:setTimeout(a.bind(null,u._1),sv(f,ov)?100:2e3),logged:false}}};function a(u){if(r.allRejections||sv(n[u].error,r.whitelist||ov)){n[u].displayId=t++;if(r.onUnhandled){n[u].logged=true;r.onUnhandled(n[u].displayId,n[u].error)}else{n[u].logged=true;G0(n[u].displayId,n[u].error)}}}function i(u){if(n[u].logged){if(r.onHandled){r.onHandled(n[u].displayId,n[u].error)}else if(!n[u].onUnhandled){console.warn("Promise Rejection Handled (id: "+n[u].displayId+"):");console.warn(' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id '+n[u].displayId+".")}}}}function G0(r,e){console.warn("Possible Unhandled Promise Rejection (id: "+r+"):");var t=(e&&(e.stack||e))+"";t.split("\n").forEach(function(n){console.warn(" "+n)})}function sv(r,e){return e.some(function(t){return r instanceof t})}});var lv=o((D3,cv)=>{"use strict";var J=Ei();cv.exports=J;var H0=Ae(true);var k0=Ae(false);var V0=Ae(null);var W0=Ae(void 0);var K0=Ae(0);var z0=Ae("");function Ae(r){var e=new J(J._0);e._V=1;e._W=r;return e}J.resolve=function(r){if(r instanceof J)return r;if(r===null)return V0;if(r===void 0)return W0;if(r===true)return H0;if(r===false)return k0;if(r===0)return K0;if(r==="")return z0;if(typeof r==="object"||typeof r==="function"){try{var e=r.then;if(typeof e==="function"){return new J(e.bind(r))}}catch(t){return new J(function(n,a){a(t)})}}return Ae(r)};var Cn=function(r){if(typeof Array.from==="function"){Cn=Array.from;return Array.from(r)}Cn=function(e){return Array.prototype.slice.call(e)};return Array.prototype.slice.call(r)};J.all=function(r){var e=Cn(r);return new J(function(t,n){if(e.length===0)return t([]);var a=e.length;function i(f,s){if(s&&(typeof s==="object"||typeof s==="function")){if(s instanceof J&&s.then===J.prototype.then){while(s._V===3){s=s._W}if(s._V===1)return i(f,s._W);if(s._V===2)n(s._W);s.then(function(v){i(f,v)},n);return}else{var c=s.then;if(typeof c==="function"){var l=new J(c.bind(s));l.then(function(v){i(f,v)},n);return}}}e[f]=s;if(--a===0){t(e)}}for(var u=0;u{(function(r,e){typeof jn==="object"&&typeof hv!=="undefined"?e(jn):typeof define==="function"&&define.amd?define(["exports"],e):e(r.WHATWGFetch={})})(jn,function(r){"use strict";var e=typeof globalThis!=="undefined"&&globalThis||typeof self!=="undefined"&&self||typeof e!=="undefined"&&e;var t={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{new Blob;return true}catch(p){return false}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};function n(p){return p&&DataView.prototype.isPrototypeOf(p)}if(t.arrayBuffer){var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"];var i=ArrayBuffer.isView||function(p){return p&&a.indexOf(Object.prototype.toString.call(p))>-1}}function u(p){if(typeof p!=="string"){p=String(p)}if(/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(p)||p===""){throw new TypeError("Invalid character in header field name")}return p.toLowerCase()}function f(p){if(typeof p!=="string"){p=String(p)}return p}function s(p){var y={next:function(){var P=p.shift();return{done:P===void 0,value:P}}};if(t.iterable){y[Symbol.iterator]=function(){return y}}return y}function c(p){this.map={};if(p instanceof c){p.forEach(function(y,P){this.append(P,y)},this)}else if(Array.isArray(p)){p.forEach(function(y){this.append(y[0],y[1])},this)}else if(p){Object.getOwnPropertyNames(p).forEach(function(y){this.append(y,p[y])},this)}}c.prototype.append=function(p,y){p=u(p);y=f(y);var P=this.map[p];this.map[p]=P?P+", "+y:y};c.prototype["delete"]=function(p){delete this.map[u(p)]};c.prototype.get=function(p){p=u(p);return this.has(p)?this.map[p]:null};c.prototype.has=function(p){return this.map.hasOwnProperty(u(p))};c.prototype.set=function(p,y){this.map[u(p)]=f(y)};c.prototype.forEach=function(p,y){for(var P in this.map){if(this.map.hasOwnProperty(P)){p.call(y,this.map[P],P,this)}}};c.prototype.keys=function(){var p=[];this.forEach(function(y,P){p.push(P)});return s(p)};c.prototype.values=function(){var p=[];this.forEach(function(y){p.push(y)});return s(p)};c.prototype.entries=function(){var p=[];this.forEach(function(y,P){p.push([P,y])});return s(p)};if(t.iterable){c.prototype[Symbol.iterator]=c.prototype.entries}function l(p){if(p.bodyUsed){return Promise.reject(new TypeError("Already read"))}p.bodyUsed=true}function v(p){return new Promise(function(y,P){p.onload=function(){y(p.result)};p.onerror=function(){P(p.error)}})}function h(p){var y=new FileReader;var P=v(y);y.readAsArrayBuffer(p);return P}function I(p){var y=new FileReader;var P=v(y);y.readAsText(p);return P}function m(p){var y=new Uint8Array(p);var P=new Array(y.length);for(var B=0;B-1?y:p}function O(p,y){if(!(this instanceof O)){throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')}y=y||{};var P=y.body;if(p instanceof O){if(p.bodyUsed){throw new TypeError("Already read")}this.url=p.url;this.credentials=p.credentials;if(!y.headers){this.headers=new c(p.headers)}this.method=p.method;this.mode=p.mode;this.signal=p.signal;if(!P&&p._bodyInit!=null){P=p._bodyInit;p.bodyUsed=true}}else{this.url=String(p)}this.credentials=y.credentials||this.credentials||"same-origin";if(y.headers||!this.headers){this.headers=new c(y.headers)}this.method=_(y.method||this.method||"GET");this.mode=y.mode||this.mode||null;this.signal=y.signal||this.signal;this.referrer=null;if((this.method==="GET"||this.method==="HEAD")&&P){throw new TypeError("Body not allowed for GET or HEAD requests")}this._initBody(P);if(this.method==="GET"||this.method==="HEAD"){if(y.cache==="no-store"||y.cache==="no-cache"){var B=/([?&])_=[^&]*/;if(B.test(this.url)){this.url=this.url.replace(B,"$1_="+new Date().getTime())}else{var G=/\?/;this.url+=(G.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function K(p){var y=new FormData;p.trim().split("&").forEach(function(P){if(P){var B=P.split("=");var G=B.shift().replace(/\+/g," ");var L=B.join("=").replace(/\+/g," ");y.append(decodeURIComponent(G),decodeURIComponent(L))}});return y}function H(p){var y=new c;var P=p.replace(/\r?\n[\t ]+/g," ");P.split(/\r?\n/).forEach(function(B){var G=B.split(":");var L=G.shift().trim();if(L){var Ie=G.join(":").trim();y.append(L,Ie)}});return y}b.call(O.prototype);function N(p,y){if(!(this instanceof N)){throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')}if(!y){y={}}this.type="default";this.status=y.status===void 0?200:y.status;this.ok=this.status>=200&&this.status<300;this.statusText="statusText"in y?y.statusText:"";this.headers=new c(y.headers);this.url=y.url||"";this._initBody(p)}b.call(N.prototype);N.prototype.clone=function(){return new N(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})};N.error=function(){var p=new N(null,{status:0,statusText:""});p.type="error";return p};var sr=[301,302,303,307,308];N.redirect=function(p,y){if(sr.indexOf(y)===-1){throw new RangeError("Invalid status code")}return new N(null,{status:y,headers:{location:p}})};r.DOMException=e.DOMException;try{new r.DOMException}catch(p){r.DOMException=function(y,P){this.message=y;this.name=P;var B=Error(y);this.stack=B.stack};r.DOMException.prototype=Object.create(Error.prototype);r.DOMException.prototype.constructor=r.DOMException}function Tr(p,y){return new Promise(function(P,B){var G=new O(p,y);if(G.signal&&G.signal.aborted){return B(new r.DOMException("Aborted","AbortError"))}var L=new XMLHttpRequest;function Ie(){L.abort()}L.onload=function(){var g={status:L.status,statusText:L.statusText,headers:H(L.getAllResponseHeaders()||"")};g.url="responseURL"in L?L.responseURL:g.headers.get("X-Request-URL");var E="response"in L?L.response:L.responseText;setTimeout(function(){P(new N(E,g))},0)};L.onerror=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)};L.ontimeout=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)};L.onabort=function(){setTimeout(function(){B(new r.DOMException("Aborted","AbortError"))},0)};function S(g){try{return g===""&&e.location.href?e.location.href:g}catch(E){return g}}L.open(G.method,S(G.url),true);if(G.credentials==="include"){L.withCredentials=true}else if(G.credentials==="omit"){L.withCredentials=false}if("responseType"in L){if(t.blob){L.responseType="blob"}else if(t.arrayBuffer&&G.headers.get("Content-Type")&&G.headers.get("Content-Type").indexOf("application/octet-stream")!==-1){L.responseType="arraybuffer"}}if(y&&typeof y.headers==="object"&&!(y.headers instanceof c)){Object.getOwnPropertyNames(y.headers).forEach(function(g){L.setRequestHeader(g,f(y.headers[g]))})}else{G.headers.forEach(function(g,E){L.setRequestHeader(E,g)})}if(G.signal){G.signal.addEventListener("abort",Ie);L.onreadystatechange=function(){if(L.readyState===4){G.signal.removeEventListener("abort",Ie)}}}L.send(typeof G._bodyInit==="undefined"?null:G._bodyInit)})}Tr.polyfill=true;if(!e.fetch){e.fetch=Tr;e.Headers=c;e.Request=O;e.Response=N}r.Headers=c;r.Request=O;r.Response=N;r.fetch=Tr;Object.defineProperty(r,"__esModule",{value:true})})});var qv=o((U3,gv)=>{"use strict";var pv=Object.getOwnPropertySymbols;var Y0=Object.prototype.hasOwnProperty;var X0=Object.prototype.propertyIsEnumerable;function J0(r){if(r===null||r===void 0){throw new TypeError("Object.assign cannot be called with null or undefined")}return Object(r)}function Z0(){try{if(!Object.assign){return false}var r=new String("abc");r[5]="de";if(Object.getOwnPropertyNames(r)[0]==="5"){return false}var e={};for(var t=0;t<10;t++){e["_"+String.fromCharCode(t)]=t}var n=Object.getOwnPropertyNames(e).map(function(i){return e[i]});if(n.join("")!=="0123456789"){return false}var a={};"abcdefghijklmnopqrst".split("").forEach(function(i){a[i]=i});if(Object.keys(Object.assign({},a)).join("")!=="abcdefghijklmnopqrst"){return false}return true}catch(i){return false}}gv.exports=Z0()?Object.assign:function(r,e){var t;var n=J0(r);var a;for(var i=1;i{var Dn=function(r){return r&&r.Math==Math&&r};yv.exports=Dn(typeof globalThis=="object"&&globalThis)||Dn(typeof window=="object"&&window)||Dn(typeof self=="object"&&self)||Dn(typeof global=="object"&&global)||Function("return this")()});var A=o(($3,mv)=>{mv.exports=function(r){try{return!!r()}catch(e){return true}}});var C=o((B3,Sv)=>{var Q0=A();Sv.exports=!Q0(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var xt=o(Iv=>{"use strict";var bv={}.propertyIsEnumerable;var Ev=Object.getOwnPropertyDescriptor;var rT=Ev&&!bv.call({1:2},1);Iv.f=rT?function r(e){var t=Ev(this,e);return!!t&&t.enumerable}:bv});var Zr=o((H3,Tv)=>{Tv.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var mr=o((k3,Av)=>{var eT={}.toString;Av.exports=function(r){return eT.call(r).slice(8,-1)}});var Ve=o((V3,wv)=>{var tT=A();var nT=mr();var aT="".split;wv.exports=tT(function(){return!Object("z").propertyIsEnumerable(0)})?function(r){return nT(r)=="String"?aT.call(r,""):Object(r)}:Object});var tr=o((W3,Ov)=>{Ov.exports=function(r){if(r==void 0)throw TypeError("Can't call method on "+r);return r}});var lr=o((K3,xv)=>{var iT=Ve();var uT=tr();xv.exports=function(r){return iT(uT(r))}});var F=o((z3,Rv)=>{Rv.exports=function(r){return typeof r==="object"?r!==null:typeof r==="function"}});var wr=o((Y3,Pv)=>{var Un=F();Pv.exports=function(r,e){if(!Un(r))return r;var t,n;if(e&&typeof(t=r.toString)=="function"&&!Un(n=t.call(r)))return n;if(typeof(t=r.valueOf)=="function"&&!Un(n=t.call(r)))return n;if(!e&&typeof(t=r.toString)=="function"&&!Un(n=t.call(r)))return n;throw TypeError("Can't convert object to primitive value")}});var V=o((X3,_v)=>{var oT={}.hasOwnProperty;_v.exports=function(r,e){return oT.call(r,e)}});var Nn=o((J3,Mv)=>{var sT=R();var Fv=F();var Ai=sT.document;var fT=Fv(Ai)&&Fv(Ai.createElement);Mv.exports=function(r){return fT?Ai.createElement(r):{}}});var wi=o((Z3,Lv)=>{var vT=C();var cT=A();var lT=Nn();Lv.exports=!vT&&!cT(function(){return Object.defineProperty(lT("div"),"a",{get:function(){return 7}}).a!=7})});var rr=o(jv=>{var hT=C();var dT=xt();var pT=Zr();var gT=lr();var qT=wr();var yT=V();var mT=wi();var Cv=Object.getOwnPropertyDescriptor;jv.f=hT?Cv:function r(e,t){e=gT(e);t=qT(t,true);if(mT)try{return Cv(e,t)}catch(n){}if(yT(e,t))return pT(!dT.f.call(e,t),e[t])}});var M=o((r6,Dv)=>{var ST=F();Dv.exports=function(r){if(!ST(r)){throw TypeError(String(r)+" is not an object")}return r}});var $=o($v=>{var bT=C();var ET=wi();var Uv=M();var IT=wr();var Nv=Object.defineProperty;$v.f=bT?Nv:function r(e,t,n){Uv(e);t=IT(t,true);Uv(n);if(ET)try{return Nv(e,t,n)}catch(a){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");if("value"in n)e[t]=n.value;return e}});var nr=o((t6,Bv)=>{var TT=C();var AT=$();var wT=Zr();Bv.exports=TT?function(r,e,t){return AT.f(r,e,wT(1,t))}:function(r,e,t){r[e]=t;return r}});var $n=o((n6,Hv)=>{var Gv=R();var OT=nr();Hv.exports=function(r,e){try{OT(Gv,r,e)}catch(t){Gv[r]=e}return e}});var Oi=o((a6,Vv)=>{var xT=R();var RT=$n();var kv="__core-js_shared__";var PT=xT[kv]||RT(kv,{});Vv.exports=PT});var Bn=o((i6,Wv)=>{var xi=Oi();var _T=Function.toString;if(typeof xi.inspectSource!="function"){xi.inspectSource=function(r){return _T.call(r)}}Wv.exports=xi.inspectSource});var Ri=o((u6,zv)=>{var FT=R();var MT=Bn();var Kv=FT.WeakMap;zv.exports=typeof Kv==="function"&&/native code/.test(MT(Kv))});var Or=o((o6,Yv)=>{Yv.exports=false});var Gn=o((s6,Jv)=>{var LT=Or();var Xv=Oi();(Jv.exports=function(r,e){return Xv[r]||(Xv[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.6.5",mode:LT?"pure":"global",copyright:"\xA9 2020 Denis Pushkarev (zloirock.ru)"})});var We=o((f6,Zv)=>{var CT=0;var jT=Math.random();Zv.exports=function(r){return"Symbol("+String(r===void 0?"":r)+")_"+(++CT+jT).toString(36)}});var Rt=o((v6,rc)=>{var DT=Gn();var UT=We();var Qv=DT("keys");rc.exports=function(r){return Qv[r]||(Qv[r]=UT(r))}});var Ke=o((c6,ec)=>{ec.exports={}});var ar=o((l6,uc)=>{var NT=Ri();var $T=R();var BT=F();var GT=nr();var tc=V();var HT=Rt();var kT=Ke();var VT=$T.WeakMap;var Hn;var Pt;var kn;var WT=function(r){return kn(r)?Pt(r):Hn(r,{})};var KT=function(r){return function(e){var t;if(!BT(e)||(t=Pt(e)).type!==r){throw TypeError("Incompatible receiver, "+r+" required")}return t}};if(NT){we=new VT;nc=we.get;ac=we.has;ic=we.set;Hn=function(r,e){ic.call(we,r,e);return e};Pt=function(r){return nc.call(we,r)||{}};kn=function(r){return ac.call(we,r)}}else{ze=HT("state");kT[ze]=true;Hn=function(r,e){GT(r,ze,e);return e};Pt=function(r){return tc(r,ze)?r[ze]:{}};kn=function(r){return tc(r,ze)}}var we;var nc;var ac;var ic;var ze;uc.exports={set:Hn,get:Pt,has:kn,enforce:WT,getterFor:KT}});var er=o((h6,fc)=>{var zT=R();var oc=nr();var YT=V();var XT=$n();var JT=Bn();var sc=ar();var ZT=sc.get;var QT=sc.enforce;var rA=String(String).split("String");(fc.exports=function(r,e,t,n){var a=n?!!n.unsafe:false;var i=n?!!n.enumerable:false;var u=n?!!n.noTargetGet:false;if(typeof t=="function"){if(typeof e=="string"&&!YT(t,"name"))oc(t,"name",e);QT(t).source=rA.join(typeof e=="string"?e:"")}if(r===zT){if(i)r[e]=t;else XT(e,t);return}else if(!a){delete r[e]}else if(!u&&r[e]){i=true}if(i)r[e]=t;else oc(r,e,t)})(Function.prototype,"toString",function r(){return typeof this=="function"&&ZT(this).source||JT(this)})});var ce=o((d6,vc)=>{var eA=R();vc.exports=eA});var Sr=o((p6,lc)=>{var Pi=ce();var _i=R();var cc=function(r){return typeof r=="function"?r:void 0};lc.exports=function(r,e){return arguments.length<2?cc(Pi[r])||cc(_i[r]):Pi[r]&&Pi[r][e]||_i[r]&&_i[r][e]}});var br=o((g6,hc)=>{var tA=Math.ceil;var nA=Math.floor;hc.exports=function(r){return isNaN(r=+r)?0:(r>0?nA:tA)(r)}});var D=o((q6,dc)=>{var aA=br();var iA=Math.min;dc.exports=function(r){return r>0?iA(aA(r),9007199254740991):0}});var Qr=o((y6,pc)=>{var uA=br();var oA=Math.max;var sA=Math.min;pc.exports=function(r,e){var t=uA(r);return t<0?oA(t+e,0):sA(t,e)}});var Ye=o((m6,qc)=>{var fA=lr();var vA=D();var cA=Qr();var gc=function(r){return function(e,t,n){var a=fA(e);var i=vA(a.length);var u=cA(n,i);var f;if(r&&t!=t)while(i>u){f=a[u++];if(f!=f)return true}else for(;i>u;u++){if((r||u in a)&&a[u]===t)return r||u||0}return!r&&-1}};qc.exports={includes:gc(true),indexOf:gc(false)}});var Mi=o((S6,yc)=>{var Fi=V();var lA=lr();var hA=Ye().indexOf;var dA=Ke();yc.exports=function(r,e){var t=lA(r);var n=0;var a=[];var i;for(i in t)!Fi(dA,i)&&Fi(t,i)&&a.push(i);while(e.length>n)if(Fi(t,i=e[n++])){~hA(a,i)||a.push(i)}return a}});var Vn=o((b6,mc)=>{mc.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var le=o(Sc=>{var pA=Mi();var gA=Vn();var qA=gA.concat("length","prototype");Sc.f=Object.getOwnPropertyNames||function r(e){return pA(e,qA)}});var Wn=o(bc=>{bc.f=Object.getOwnPropertySymbols});var Kn=o((T6,Ec)=>{var yA=Sr();var mA=le();var SA=Wn();var bA=M();Ec.exports=yA("Reflect","ownKeys")||function r(e){var t=mA.f(bA(e));var n=SA.f;return n?t.concat(n(e)):t}});var Li=o((A6,Ic)=>{var EA=V();var IA=Kn();var TA=rr();var AA=$();Ic.exports=function(r,e){var t=IA(e);var n=AA.f;var a=TA.f;for(var i=0;i{var wA=A();var OA=/#|\.prototype\./;var _t=function(r,e){var t=RA[xA(r)];return t==_A?true:t==PA?false:typeof e=="function"?wA(e):!!e};var xA=_t.normalize=function(r){return String(r).replace(OA,".").toLowerCase()};var RA=_t.data={};var PA=_t.NATIVE="N";var _A=_t.POLYFILL="P";Tc.exports=_t});var d=o((O6,Ac)=>{var Ci=R();var FA=rr().f;var MA=nr();var LA=er();var CA=$n();var jA=Li();var DA=Xe();Ac.exports=function(r,e){var t=r.target;var n=r.global;var a=r.stat;var i,u,f,s,c,l;if(n){u=Ci}else if(a){u=Ci[t]||CA(t,{})}else{u=(Ci[t]||{}).prototype}if(u)for(f in e){c=e[f];if(r.noTargetGet){l=FA(u,f);s=l&&l.value}else s=u[f];i=DA(n?f:t+(a?".":"#")+f,r.forced);if(!i&&s!==void 0){if(typeof c===typeof s)continue;jA(c,s)}if(r.sham||s&&s.sham){MA(c,"sham",true)}LA(u,f,c,r)}}});var he=o((x6,wc)=>{var UA=mr();wc.exports=Array.isArray||function r(e){return UA(e)=="Array"}});var k=o((R6,Oc)=>{var NA=tr();Oc.exports=function(r){return Object(NA(r))}});var de=o((P6,xc)=>{"use strict";var $A=wr();var BA=$();var GA=Zr();xc.exports=function(r,e,t){var n=$A(e);if(n in r)BA.f(r,n,GA(0,t));else r[n]=t}});var zn=o((_6,Rc)=>{var HA=A();Rc.exports=!!Object.getOwnPropertySymbols&&!HA(function(){return!String(Symbol())})});var ji=o((F6,Pc)=>{var kA=zn();Pc.exports=kA&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var j=o((M6,Fc)=>{var VA=R();var WA=Gn();var _c=V();var KA=We();var zA=zn();var YA=ji();var Yn=WA("wks");var Ft=VA.Symbol;var XA=YA?Ft:Ft&&Ft.withoutSetter||KA;Fc.exports=function(r){if(!_c(Yn,r)){if(zA&&_c(Ft,r))Yn[r]=Ft[r];else Yn[r]=XA("Symbol."+r)}return Yn[r]}});var Je=o((L6,Lc)=>{var JA=F();var Mc=he();var ZA=j();var QA=ZA("species");Lc.exports=function(r,e){var t;if(Mc(r)){t=r.constructor;if(typeof t=="function"&&(t===Array||Mc(t.prototype)))t=void 0;else if(JA(t)){t=t[QA];if(t===null)t=void 0}}return new(t===void 0?Array:t)(e===0?0:e)}});var Mt=o((C6,Cc)=>{var rw=Sr();Cc.exports=rw("navigator","userAgent")||""});var Jn=o((j6,Nc)=>{var ew=R();var Di=Mt();var jc=ew.process;var Dc=jc&&jc.versions;var Uc=Dc&&Dc.v8;var re;var Xn;if(Uc){re=Uc.split(".");Xn=re[0]+re[1]}else if(Di){re=Di.match(/Edge\/(\d+)/);if(!re||re[1]>=74){re=Di.match(/Chrome\/(\d+)/);if(re)Xn=re[1]}}Nc.exports=Xn&&+Xn});var Ze=o((D6,$c)=>{var tw=A();var nw=j();var aw=Jn();var iw=nw("species");$c.exports=function(r){return aw>=51||!tw(function(){var e=[];var t=e.constructor={};t[iw]=function(){return{foo:1}};return e[r](Boolean).foo!==1})}});var Ui=o(()=>{"use strict";var uw=d();var ow=A();var sw=he();var fw=F();var vw=k();var cw=D();var Bc=de();var lw=Je();var hw=Ze();var dw=j();var pw=Jn();var kc=dw("isConcatSpreadable");var Gc=9007199254740991;var Hc="Maximum allowed index exceeded";var gw=pw>=51||!ow(function(){var r=[];r[kc]=false;return r.concat()[0]!==r});var qw=hw("concat");var yw=function(r){if(!fw(r))return false;var e=r[kc];return e!==void 0?!!e:sw(r)};var mw=!gw||!qw;uw({target:"Array",proto:true,forced:mw},{concat:function r(e){var t=vw(this);var n=lw(t,0);var a=0;var i,u,f,s,c;for(i=-1,f=arguments.length;iGc)throw TypeError(Hc);for(u=0;u=Gc)throw TypeError(Hc);Bc(n,a++,c)}}n.length=a;return n}})});var Zn=o(($6,Wc)=>{var Sw=j();var bw=Sw("toStringTag");var Vc={};Vc[bw]="z";Wc.exports=String(Vc)==="[object z]"});var Qe=o((B6,Kc)=>{var Ew=Zn();var Qn=mr();var Iw=j();var Tw=Iw("toStringTag");var Aw=Qn(function(){return arguments}())=="Arguments";var ww=function(r,e){try{return r[e]}catch(t){}};Kc.exports=Ew?Qn:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=ww(e=Object(r),Tw))=="string"?t:Aw?Qn(e):(n=Qn(e))=="Object"&&typeof e.callee=="function"?"Arguments":n}});var Yc=o((G6,zc)=>{"use strict";var Ow=Zn();var xw=Qe();zc.exports=Ow?{}.toString:function r(){return"[object "+xw(this)+"]"}});var Ni=o(()=>{var Rw=Zn();var Pw=er();var _w=Yc();if(!Rw){Pw(Object.prototype,"toString",_w,{unsafe:true})}});var rt=o((V6,Xc)=>{var Fw=Mi();var Mw=Vn();Xc.exports=Object.keys||function r(e){return Fw(e,Mw)}});var ra=o((W6,Jc)=>{var Lw=C();var Cw=$();var jw=M();var Dw=rt();Jc.exports=Lw?Object.defineProperties:function r(e,t){jw(e);var n=Dw(t);var a=n.length;var i=0;var u;while(a>i)Cw.f(e,u=n[i++],t[u]);return e}});var $i=o((K6,Zc)=>{var Uw=Sr();Zc.exports=Uw("document","documentElement")});var $r=o((z6,al)=>{var Nw=M();var $w=ra();var Qc=Vn();var Bw=Ke();var Gw=$i();var Hw=Nn();var kw=Rt();var rl=">";var el="<";var Hi="prototype";var ki="script";var tl=kw("IE_PROTO");var Bi=function(){};var nl=function(r){return el+ki+rl+r+el+"/"+ki+rl};var Vw=function(r){r.write(nl(""));r.close();var e=r.parentWindow.Object;r=null;return e};var Ww=function(){var r=Hw("iframe");var e="java"+ki+":";var t;r.style.display="none";Gw.appendChild(r);r.src=String(e);t=r.contentWindow.document;t.open();t.write(nl("document.F=Object"));t.close();return t.F};var Gi;var ea=function(){try{Gi=document.domain&&new ActiveXObject("htmlfile")}catch(e){}ea=Gi?Vw(Gi):Ww();var r=Qc.length;while(r--)delete ea[Hi][Qc[r]];return ea()};Bw[tl]=true;al.exports=Object.create||function r(e,t){var n;if(e!==null){Bi[Hi]=Nw(e);n=new Bi;Bi[Hi]=null;n[tl]=e}else n=ea();return t===void 0?n:$w(n,t)}});var Vi=o((Y6,ol)=>{var Kw=lr();var il=le().f;var zw={}.toString;var ul=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];var Yw=function(r){try{return il(r)}catch(e){return ul.slice()}};ol.exports.f=function r(e){return ul&&zw.call(e)=="[object Window]"?Yw(e):il(Kw(e))}});var Wi=o(sl=>{var Xw=j();sl.f=Xw});var Y=o((J6,vl)=>{var fl=ce();var Jw=V();var Zw=Wi();var Qw=$().f;vl.exports=function(r){var e=fl.Symbol||(fl.Symbol={});if(!Jw(e,r))Qw(e,r,{value:Zw.f(r)})}});var Fr=o((Z6,ll)=>{var rO=$().f;var eO=V();var tO=j();var cl=tO("toStringTag");ll.exports=function(r,e,t){if(r&&!eO(r=t?r:r.prototype,cl)){rO(r,cl,{configurable:true,value:e})}}});var ur=o((Q6,hl)=>{hl.exports=function(r){if(typeof r!="function"){throw TypeError(String(r)+" is not a function")}return r}});var Br=o((r4,dl)=>{var nO=ur();dl.exports=function(r,e,t){nO(r);if(e===void 0)return r;switch(t){case 0:return function(){return r.call(e)};case 1:return function(n){return r.call(e,n)};case 2:return function(n,a){return r.call(e,n,a)};case 3:return function(n,a,i){return r.call(e,n,a,i)}}return function(){return r.apply(e,arguments)}}});var Z=o((e4,pl)=>{var aO=Br();var iO=Ve();var uO=k();var oO=D();var sO=Je();var fO=[].push;var Oe=function(r){var e=r==1;var t=r==2;var n=r==3;var a=r==4;var i=r==6;var u=r==5||i;return function(f,s,c,l){var v=uO(f);var h=iO(v);var I=aO(s,c,3);var m=oO(h.length);var q=0;var b=l||sO;var T=e?b(f,m):t?b(f,0):void 0;var _,O;for(;m>q;q++)if(u||q in h){_=h[q];O=I(_,q,v);if(r){if(e)T[q]=O;else if(O)switch(r){case 3:return true;case 5:return _;case 6:return q;case 2:fO.call(T,_)}else if(a)return false}}return i?-1:n||a?a:T}};pl.exports={forEach:Oe(0),map:Oe(1),filter:Oe(2),some:Oe(3),every:Oe(4),find:Oe(5),findIndex:Oe(6)}});var su=o(()=>{"use strict";var tt=d();var Sl=R();var vO=Sr();var cO=Or();var et=C();var xe=zn();var lO=ji();var iu=A();var X=V();var hO=he();var dO=F();var Zi=M();var pO=k();var ta=lr();var uu=wr();var Qi=Zr();var Ct=$r();var bl=rt();var gO=le();var El=Vi();var ru=Wn();var Il=rr();var Tl=$();var Al=xt();var qO=nr();var Ki=er();var jt=Gn();var yO=Rt();var wl=Ke();var gl=We();var Ol=j();var mO=Wi();var SO=Y();var bO=Fr();var xl=ar();var na=Z().forEach;var hr=yO("hidden");var aa="Symbol";var ee="prototype";var ql=Ol("toPrimitive");var EO=xl.set;var yl=xl.getterFor(aa);var xr=Object[ee];var dr=Sl.Symbol;var Lt=vO("JSON","stringify");var Rl=Il.f;var pe=Tl.f;var Pl=El.f;var IO=Al.f;var te=jt("symbols");var Dt=jt("op-symbols");var zi=jt("string-to-symbol-registry");var Yi=jt("symbol-to-string-registry");var TO=jt("wks");var Xi=Sl.QObject;var eu=!Xi||!Xi[ee]||!Xi[ee].findChild;var tu=et&&iu(function(){return Ct(pe({},"a",{get:function(){return pe(this,"a",{value:7}).a}})).a!=7})?function(r,e,t){var n=Rl(xr,e);if(n)delete xr[e];pe(r,e,t);if(n&&r!==xr){pe(xr,e,n)}}:pe;var Ji=function(r,e){var t=te[r]=Ct(dr[ee]);EO(t,{type:aa,tag:r,description:e});if(!et)t.description=e;return t};var nu=lO?function(r){return typeof r=="symbol"}:function(r){return Object(r)instanceof dr};var ia=function r(e,t,n){if(e===xr)ia(Dt,t,n);Zi(e);var a=uu(t,true);Zi(n);if(X(te,a)){if(!n.enumerable){if(!X(e,hr))pe(e,hr,Qi(1,{}));e[hr][a]=true}else{if(X(e,hr)&&e[hr][a])e[hr][a]=false;n=Ct(n,{enumerable:Qi(0,false)})}return tu(e,a,n)}return pe(e,a,n)};var _l=function r(e,t){Zi(e);var n=ta(t);var a=bl(n).concat(ou(n));na(a,function(i){if(!et||au.call(n,i))ia(e,i,n[i])});return e};var AO=function r(e,t){return t===void 0?Ct(e):_l(Ct(e),t)};var au=function r(e){var t=uu(e,true);var n=IO.call(this,t);if(this===xr&&X(te,t)&&!X(Dt,t))return false;return n||!X(this,t)||!X(te,t)||X(this,hr)&&this[hr][t]?n:true};var Fl=function r(e,t){var n=ta(e);var a=uu(t,true);if(n===xr&&X(te,a)&&!X(Dt,a))return;var i=Rl(n,a);if(i&&X(te,a)&&!(X(n,hr)&&n[hr][a])){i.enumerable=true}return i};var Ml=function r(e){var t=Pl(ta(e));var n=[];na(t,function(a){if(!X(te,a)&&!X(wl,a))n.push(a)});return n};var ou=function r(e){var t=e===xr;var n=Pl(t?Dt:ta(e));var a=[];na(n,function(i){if(X(te,i)&&(!t||X(xr,i))){a.push(te[i])}});return a};if(!xe){dr=function r(){if(this instanceof dr)throw TypeError("Symbol is not a constructor");var e=!arguments.length||arguments[0]===void 0?void 0:String(arguments[0]);var t=gl(e);var n=function(a){if(this===xr)n.call(Dt,a);if(X(this,hr)&&X(this[hr],t))this[hr][t]=false;tu(this,t,Qi(1,a))};if(et&&eu)tu(xr,t,{configurable:true,set:n});return Ji(t,e)};Ki(dr[ee],"toString",function r(){return yl(this).tag});Ki(dr,"withoutSetter",function(r){return Ji(gl(r),r)});Al.f=au;Tl.f=ia;Il.f=Fl;gO.f=El.f=Ml;ru.f=ou;mO.f=function(r){return Ji(Ol(r),r)};if(et){pe(dr[ee],"description",{configurable:true,get:function r(){return yl(this).description}});if(!cO){Ki(xr,"propertyIsEnumerable",au,{unsafe:true})}}}tt({global:true,wrap:true,forced:!xe,sham:!xe},{Symbol:dr});na(bl(TO),function(r){SO(r)});tt({target:aa,stat:true,forced:!xe},{"for":function(r){var e=String(r);if(X(zi,e))return zi[e];var t=dr(e);zi[e]=t;Yi[t]=e;return t},keyFor:function r(e){if(!nu(e))throw TypeError(e+" is not a symbol");if(X(Yi,e))return Yi[e]},useSetter:function(){eu=true},useSimple:function(){eu=false}});tt({target:"Object",stat:true,forced:!xe,sham:!et},{create:AO,defineProperty:ia,defineProperties:_l,getOwnPropertyDescriptor:Fl});tt({target:"Object",stat:true,forced:!xe},{getOwnPropertyNames:Ml,getOwnPropertySymbols:ou});tt({target:"Object",stat:true,forced:iu(function(){ru.f(1)})},{getOwnPropertySymbols:function r(e){return ru.f(pO(e))}});if(Lt){ml=!xe||iu(function(){var r=dr();return Lt([r])!="[null]"||Lt({a:r})!="{}"||Lt(Object(r))!="{}"});tt({target:"JSON",stat:true,forced:ml},{stringify:function r(e,t,n){var a=[e];var i=1;var u;while(arguments.length>i)a.push(arguments[i++]);u=t;if(!dO(t)&&e===void 0||nu(e))return;if(!hO(t))t=function(f,s){if(typeof u=="function")s=u.call(this,f,s);if(!nu(s))return s};a[1]=t;return Lt.apply(null,a)}})}var ml;if(!dr[ee][ql]){qO(dr[ee],ql,dr[ee].valueOf)}bO(dr,aa);wl[hr]=true});var fu=o(()=>{var wO=Y();wO("asyncIterator")});var cu=o(()=>{"use strict";var OO=d();var xO=C();var RO=R();var PO=V();var _O=F();var FO=$().f;var MO=Li();var ne=RO.Symbol;if(xO&&typeof ne=="function"&&(!("description"in ne.prototype)||ne().description!==void 0)){vu={};nt=function r(){var e=arguments.length<1||arguments[0]===void 0?void 0:String(arguments[0]);var t=this instanceof nt?new ne(e):e===void 0?ne():ne(e);if(e==="")vu[t]=true;return t};MO(nt,ne);ua=nt.prototype=ne.prototype;ua.constructor=nt;Ll=ua.toString;Cl=String(ne("test"))=="Symbol(test)";jl=/^Symbol\((.*)\)[^)]+$/;FO(ua,"description",{configurable:true,get:function r(){var e=_O(this)?this.valueOf():this;var t=Ll.call(e);if(PO(vu,e))return"";var n=Cl?t.slice(7,-1):t.replace(jl,"$1");return n===""?void 0:n}});OO({global:true,forced:true},{Symbol:nt})}var vu;var nt;var ua;var Ll;var Cl;var jl});var lu=o(()=>{var LO=Y();LO("hasInstance")});var hu=o(()=>{var CO=Y();CO("isConcatSpreadable")});var du=o(()=>{var jO=Y();jO("iterator")});var pu=o(()=>{var DO=Y();DO("match")});var gu=o(()=>{var UO=Y();UO("matchAll")});var qu=o(()=>{var NO=Y();NO("replace")});var yu=o(()=>{var $O=Y();$O("search")});var mu=o(()=>{var BO=Y();BO("species")});var Su=o(()=>{var GO=Y();GO("split")});var bu=o(()=>{var HO=Y();HO("toPrimitive")});var Eu=o(()=>{var kO=Y();kO("toStringTag")});var Iu=o(()=>{var VO=Y();VO("unscopables")});var Tu=o(()=>{var WO=Fr();WO(Math,"Math",true)});var Au=o(()=>{var KO=R();var zO=Fr();zO(KO.JSON,"JSON",true)});var Ul=o((j4,Dl)=>{Ui();Ni();su();fu();cu();lu();hu();du();pu();gu();qu();yu();mu();Su();bu();Eu();Iu();Tu();Au();var YO=ce();Dl.exports=YO.Symbol});var Nl=o(()=>{var XO=Y();XO("asyncDispose")});var $l=o(()=>{var JO=Y();JO("dispose")});var Bl=o(()=>{var ZO=Y();ZO("observable")});var Gl=o(()=>{var QO=Y();QO("patternMatch")});var Hl=o(()=>{var rx=Y();rx("replaceAll")});var Vl=o((K4,kl)=>{var ex=Ul();Nl();$l();Bl();Gl();Hl();kl.exports=ex});var Ut=o((z4,Kl)=>{var tx=br();var nx=tr();var Wl=function(r){return function(e,t){var n=String(nx(e));var a=tx(t);var i=n.length;var u,f;if(a<0||a>=i)return r?"":void 0;u=n.charCodeAt(a);return u<55296||u>56319||a+1===i||(f=n.charCodeAt(a+1))<56320||f>57343?r?n.charAt(a):u:r?n.slice(a,a+2):(u-55296<<10)+(f-56320)+65536}};Kl.exports={codeAt:Wl(false),charAt:Wl(true)}});var oa=o((Y4,zl)=>{var ax=A();zl.exports=!ax(function(){function r(){}r.prototype.constructor=null;return Object.getPrototypeOf(new r)!==r.prototype})});var Rr=o((X4,Xl)=>{var ix=V();var ux=k();var ox=Rt();var sx=oa();var Yl=ox("IE_PROTO");var fx=Object.prototype;Xl.exports=sx?Object.getPrototypeOf:function(r){r=ux(r);if(ix(r,Yl))return r[Yl];if(typeof r.constructor=="function"&&r instanceof r.constructor){return r.constructor.prototype}return r instanceof Object?fx:null}});var xu=o((J4,rh)=>{"use strict";var Jl=Rr();var vx=nr();var cx=V();var lx=j();var hx=Or();var Zl=lx("iterator");var Ql=false;var dx=function(){return this};var at;var wu;var Ou;if([].keys){Ou=[].keys();if(!("next"in Ou))Ql=true;else{wu=Jl(Jl(Ou));if(wu!==Object.prototype)at=wu}}if(at==void 0)at={};if(!hx&&!cx(at,Zl)){vx(at,Zl,dx)}rh.exports={IteratorPrototype:at,BUGGY_SAFARI_ITERATORS:Ql}});var it=o((Z4,eh)=>{eh.exports={}});var sa=o((Q4,th)=>{"use strict";var px=xu().IteratorPrototype;var gx=$r();var qx=Zr();var yx=Fr();var mx=it();var Sx=function(){return this};th.exports=function(r,e,t){var n=e+" Iterator";r.prototype=gx(px,{next:qx(1,t)});yx(r,n,false,true);mx[n]=Sx;return r}});var Ru=o((rK,nh)=>{var bx=F();nh.exports=function(r){if(!bx(r)&&r!==null){throw TypeError("Can't set "+String(r)+" as a prototype")}return r}});var ge=o((eK,ah)=>{var Ex=M();var Ix=Ru();ah.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=false;var e={};var t;try{t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set;t.call(e,[]);r=e instanceof Array}catch(n){}return function n(a,i){Ex(a);Ix(i);if(r)t.call(a,i);else a.__proto__=i;return a}}():void 0)});var ca=o((tK,hh)=>{"use strict";var Tx=d();var Ax=sa();var ih=Rr();var uh=ge();var wx=Fr();var oh=nr();var Ox=er();var xx=j();var Pu=Or();var sh=it();var lh=xu();var _u=lh.IteratorPrototype;var fa=lh.BUGGY_SAFARI_ITERATORS;var Nt=xx("iterator");var fh="keys";var va="values";var vh="entries";var ch=function(){return this};hh.exports=function(r,e,t,n,a,i,u){Ax(t,e,n);var f=function(T){if(T===a&&h)return h;if(!fa&&T in l)return l[T];switch(T){case fh:return function _(){return new t(this,T)};case va:return function _(){return new t(this,T)};case vh:return function _(){return new t(this,T)}}return function(){return new t(this)}};var s=e+" Iterator";var c=false;var l=r.prototype;var v=l[Nt]||l["@@iterator"]||a&&l[a];var h=!fa&&v||f(a);var I=e=="Array"?l.entries||v:v;var m,q,b;if(I){m=ih(I.call(new r));if(_u!==Object.prototype&&m.next){if(!Pu&&ih(m)!==_u){if(uh){uh(m,_u)}else if(typeof m[Nt]!="function"){oh(m,Nt,ch)}}wx(m,s,true,true);if(Pu)sh[s]=ch}}if(a==va&&v&&v.name!==va){c=true;h=function T(){return v.call(this)}}if((!Pu||u)&&l[Nt]!==h){oh(l,Nt,h)}sh[e]=h;if(a){q={values:f(va),keys:i?h:f(fh),entries:f(vh)};if(u)for(b in q){if(fa||c||!(b in l)){Ox(l,b,q[b])}}else Tx({target:e,proto:true,forced:fa||c},q)}return q}});var la=o(()=>{"use strict";var Rx=Ut().charAt;var dh=ar();var Px=ca();var ph="String Iterator";var _x=dh.set;var Fx=dh.getterFor(ph);Px(String,"String",function(r){_x(this,{type:ph,string:String(r),index:0})},function r(){var e=Fx(this);var t=e.string;var n=e.index;var a;if(n>=t.length)return{value:void 0,done:true};a=Rx(t,n);e.index+=a.length;return{value:a,done:false}})});var Fu=o((iK,qh)=>{var gh=M();qh.exports=function(r,e,t,n){try{return n?e(gh(t)[0],t[1]):e(t)}catch(i){var a=r["return"];if(a!==void 0)gh(a.call(r));throw i}}});var ha=o((uK,yh)=>{var Mx=j();var Lx=it();var Cx=Mx("iterator");var jx=Array.prototype;yh.exports=function(r){return r!==void 0&&(Lx.Array===r||jx[Cx]===r)}});var ut=o((oK,mh)=>{var Dx=Qe();var Ux=it();var Nx=j();var $x=Nx("iterator");mh.exports=function(r){if(r!=void 0)return r[$x]||r["@@iterator"]||Ux[Dx(r)]}});var Mu=o((sK,bh)=>{"use strict";var Bx=Br();var Gx=k();var Hx=Fu();var kx=ha();var Vx=D();var Sh=de();var Wx=ut();bh.exports=function r(e){var t=Gx(e);var n=typeof this=="function"?this:Array;var a=arguments.length;var i=a>1?arguments[1]:void 0;var u=i!==void 0;var f=Wx(t);var s=0;var c,l,v,h,I,m;if(u)i=Bx(i,a>2?arguments[2]:void 0,2);if(f!=void 0&&!(n==Array&&kx(f))){h=f.call(t);I=h.next;l=new n;for(;!(v=I.call(h)).done;s++){m=u?Hx(h,i,[v.value,s],true):v.value;Sh(l,s,m)}}else{c=Vx(t.length);l=new n(c);for(;c>s;s++){m=u?i(t[s],s):t[s];Sh(l,s,m)}}l.length=s;return l}});var $t=o((fK,Ah)=>{var Kx=j();var Ih=Kx("iterator");var Th=false;try{Eh=0;Lu={next:function(){return{done:!!Eh++}},"return":function(){Th=true}};Lu[Ih]=function(){return this};Array.from(Lu,function(){throw 2})}catch(r){}var Eh;var Lu;Ah.exports=function(r,e){if(!e&&!Th)return false;var t=false;try{var n={};n[Ih]=function(){return{next:function(){return{done:t=true}}}};r(n)}catch(a){}return t}});var Cu=o(()=>{var zx=d();var Yx=Mu();var Xx=$t();var Jx=!Xx(function(r){Array.from(r)});zx({target:"Array",stat:true,forced:Jx},{from:Yx})});var Oh=o((lK,wh)=>{la();Cu();var Zx=ce();wh.exports=Zx.Array.from});var Rh=o((hK,xh)=>{var Qx=Oh();xh.exports=Qx});var Du=o((dK,Fh)=>{"use strict";var Ph=C();var rR=A();var ju=rt();var eR=Wn();var tR=xt();var nR=k();var aR=Ve();var ot=Object.assign;var _h=Object.defineProperty;Fh.exports=!ot||rR(function(){if(Ph&&ot({b:1},ot(_h({},"a",{enumerable:true,get:function(){_h(this,"b",{value:3,enumerable:false})}}),{b:2})).b!==1)return true;var r={};var e={};var t=Symbol();var n="abcdefghijklmnopqrst";r[t]=7;n.split("").forEach(function(a){e[a]=a});return ot({},r)[t]!=7||ju(ot({},e)).join("")!=n})?function r(e,t){var n=nR(e);var a=arguments.length;var i=1;var u=eR.f;var f=tR.f;while(a>i){var s=aR(arguments[i++]);var c=u?ju(s).concat(u(s)):ju(s);var l=c.length;var v=0;var h;while(l>v){h=c[v++];if(!Ph||f.call(s,h))n[h]=s[h]}}return n}:ot});var Lh=o(()=>{var iR=d();var Mh=Du();iR({target:"Object",stat:true,forced:Object.assign!==Mh},{assign:Mh})});var Ch=o(()=>{var uR=d();var oR=C();var sR=$r();uR({target:"Object",stat:true,sham:!oR},{create:sR})});var Dh=o(()=>{var fR=d();var jh=C();var vR=$();fR({target:"Object",stat:true,forced:!jh,sham:!jh},{defineProperty:vR.f})});var Nh=o(()=>{var cR=d();var Uh=C();var lR=ra();cR({target:"Object",stat:true,forced:!Uh,sham:!Uh},{defineProperties:lR})});var Uu=o((IK,Bh)=>{var hR=C();var dR=rt();var pR=lr();var gR=xt().f;var $h=function(r){return function(e){var t=pR(e);var n=dR(t);var a=n.length;var i=0;var u=[];var f;while(a>i){f=n[i++];if(!hR||gR.call(t,f)){u.push(r?[f,t[f]]:t[f])}}return u}};Bh.exports={entries:$h(true),values:$h(false)}});var Gh=o(()=>{var qR=d();var yR=Uu().entries;qR({target:"Object",stat:true},{entries:function r(e){return yR(e)}})});var st=o((wK,Hh)=>{var mR=A();Hh.exports=!mR(function(){return Object.isExtensible(Object.preventExtensions({}))})});var qe=o((OK,kh)=>{var SR=Ke();var bR=F();var Nu=V();var ER=$().f;var IR=We();var TR=st();var Re=IR("meta");var AR=0;var $u=Object.isExtensible||function(){return true};var Bu=function(r){ER(r,Re,{value:{objectID:"O"+ ++AR,weakData:{}}})};var wR=function(r,e){if(!bR(r))return typeof r=="symbol"?r:(typeof r=="string"?"S":"P")+r;if(!Nu(r,Re)){if(!$u(r))return"F";if(!e)return"E";Bu(r)}return r[Re].objectID};var OR=function(r,e){if(!Nu(r,Re)){if(!$u(r))return true;if(!e)return false;Bu(r)}return r[Re].weakData};var xR=function(r){if(TR&&RR.REQUIRED&&$u(r)&&!Nu(r,Re))Bu(r);return r};var RR=kh.exports={REQUIRED:false,fastKey:wR,getWeakData:OR,onFreeze:xR};SR[Re]=true});var Vh=o(()=>{var PR=d();var _R=st();var FR=A();var MR=F();var LR=qe().onFreeze;var Gu=Object.freeze;var CR=FR(function(){Gu(1)});PR({target:"Object",stat:true,forced:CR,sham:!_R},{freeze:function r(e){return Gu&&MR(e)?Gu(LR(e)):e}})});var Pe=o((PK,Wh)=>{var jR=M();var DR=ha();var UR=D();var NR=Br();var $R=ut();var BR=Fu();var Bt=function(r,e){this.stopped=r;this.result=e};var GR=Wh.exports=function(r,e,t,n,a){var i=NR(e,t,n?2:1);var u,f,s,c,l,v,h;if(a){u=r}else{f=$R(r);if(typeof f!="function")throw TypeError("Target is not iterable");if(DR(f)){for(s=0,c=UR(r.length);c>s;s++){l=n?i(jR(h=r[s])[0],h[1]):i(r[s]);if(l&&l instanceof Bt)return l}return new Bt(false)}u=f.call(r)}v=u.next;while(!(h=v.call(u)).done){l=BR(u,i,h.value,n);if(typeof l=="object"&&l&&l instanceof Bt)return l}return new Bt(false)};GR.stop=function(r){return new Bt(true,r)}});var Kh=o(()=>{var HR=d();var kR=Pe();var VR=de();HR({target:"Object",stat:true},{fromEntries:function r(e){var t={};kR(e,function(n,a){VR(t,n,a)},void 0,true);return t}})});var Xh=o(()=>{var WR=d();var KR=A();var zR=lr();var zh=rr().f;var Yh=C();var YR=KR(function(){zh(1)});var XR=!Yh||YR;WR({target:"Object",stat:true,forced:XR,sham:!Yh},{getOwnPropertyDescriptor:function r(e,t){return zh(zR(e),t)}})});var Jh=o(()=>{var JR=d();var ZR=C();var QR=Kn();var rP=lr();var eP=rr();var tP=de();JR({target:"Object",stat:true,sham:!ZR},{getOwnPropertyDescriptors:function r(e){var t=rP(e);var n=eP.f;var a=QR(t);var i={};var u=0;var f,s;while(a.length>u){s=n(t,f=a[u++]);if(s!==void 0)tP(i,f,s)}return i}})});var Zh=o(()=>{var nP=d();var aP=A();var iP=Vi().f;var uP=aP(function(){return!Object.getOwnPropertyNames(1)});nP({target:"Object",stat:true,forced:uP},{getOwnPropertyNames:iP})});var rd=o(()=>{var oP=d();var sP=A();var fP=k();var Qh=Rr();var vP=oa();var cP=sP(function(){Qh(1)});oP({target:"Object",stat:true,forced:cP,sham:!vP},{getPrototypeOf:function r(e){return Qh(fP(e))}})});var Hu=o((BK,ed)=>{ed.exports=Object.is||function r(e,t){return e===t?e!==0||1/e===1/t:e!=e&&t!=t}});var td=o(()=>{var lP=d();var hP=Hu();lP({target:"Object",stat:true},{is:hP})});var nd=o(()=>{var dP=d();var pP=A();var gP=F();var ku=Object.isExtensible;var qP=pP(function(){ku(1)});dP({target:"Object",stat:true,forced:qP},{isExtensible:function r(e){return gP(e)?ku?ku(e):true:false}})});var ad=o(()=>{var yP=d();var mP=A();var SP=F();var Vu=Object.isFrozen;var bP=mP(function(){Vu(1)});yP({target:"Object",stat:true,forced:bP},{isFrozen:function r(e){return SP(e)?Vu?Vu(e):false:true}})});var id=o(()=>{var EP=d();var IP=A();var TP=F();var Wu=Object.isSealed;var AP=IP(function(){Wu(1)});EP({target:"Object",stat:true,forced:AP},{isSealed:function r(e){return TP(e)?Wu?Wu(e):false:true}})});var od=o(()=>{var wP=d();var OP=k();var ud=rt();var xP=A();var RP=xP(function(){ud(1)});wP({target:"Object",stat:true,forced:RP},{keys:function r(e){return ud(OP(e))}})});var sd=o(()=>{var PP=d();var _P=F();var FP=qe().onFreeze;var MP=st();var LP=A();var Ku=Object.preventExtensions;var CP=LP(function(){Ku(1)});PP({target:"Object",stat:true,forced:CP,sham:!MP},{preventExtensions:function r(e){return Ku&&_P(e)?Ku(FP(e)):e}})});var fd=o(()=>{var jP=d();var DP=F();var UP=qe().onFreeze;var NP=st();var $P=A();var zu=Object.seal;var BP=$P(function(){zu(1)});jP({target:"Object",stat:true,forced:BP,sham:!NP},{seal:function r(e){return zu&&DP(e)?zu(UP(e)):e}})});var vd=o(()=>{var GP=d();var HP=ge();GP({target:"Object",stat:true},{setPrototypeOf:HP})});var cd=o(()=>{var kP=d();var VP=Uu().values;kP({target:"Object",stat:true},{values:function r(e){return VP(e)}})});var Gt=o((uz,ld)=>{"use strict";var WP=Or();var KP=R();var zP=A();ld.exports=WP||!zP(function(){var r=Math.random();__defineSetter__.call(null,r,function(){});delete KP[r]})});var hd=o(()=>{"use strict";var YP=d();var XP=C();var JP=Gt();var ZP=k();var QP=ur();var r1=$();if(XP){YP({target:"Object",proto:true,forced:JP},{__defineGetter__:function r(e,t){r1.f(ZP(this),e,{get:QP(t),enumerable:true,configurable:true})}})}});var dd=o(()=>{"use strict";var e1=d();var t1=C();var n1=Gt();var a1=k();var i1=ur();var u1=$();if(t1){e1({target:"Object",proto:true,forced:n1},{__defineSetter__:function r(e,t){u1.f(a1(this),e,{set:i1(t),enumerable:true,configurable:true})}})}});var pd=o(()=>{"use strict";var o1=d();var s1=C();var f1=Gt();var v1=k();var c1=wr();var l1=Rr();var h1=rr().f;if(s1){o1({target:"Object",proto:true,forced:f1},{__lookupGetter__:function r(e){var t=v1(this);var n=c1(e,true);var a;do{if(a=h1(t,n))return a.get}while(t=l1(t))}})}});var gd=o(()=>{"use strict";var d1=d();var p1=C();var g1=Gt();var q1=k();var y1=wr();var m1=Rr();var S1=rr().f;if(p1){d1({target:"Object",proto:true,forced:g1},{__lookupSetter__:function r(e){var t=q1(this);var n=y1(e,true);var a;do{if(a=S1(t,n))return a.set}while(t=m1(t))}})}});var Xu=o((pz,yd)=>{"use strict";var b1=ur();var E1=F();var qd=[].slice;var Yu={};var I1=function(r,e,t){if(!(e in Yu)){for(var n=[],a=0;a{var T1=d();var A1=Xu();T1({target:"Function",proto:true},{bind:A1})});var bd=o(()=>{var w1=C();var O1=$().f;var Ju=Function.prototype;var x1=Ju.toString;var R1=/^\s*function ([^ (]*)/;var Sd="name";if(w1&&!(Sd in Ju)){O1(Ju,Sd,{configurable:true,get:function(){try{return x1.call(this).match(R1)[1]}catch(r){return""}}})}});var Ad=o(()=>{"use strict";var Ed=F();var P1=$();var _1=Rr();var F1=j();var Id=F1("hasInstance");var Td=Function.prototype;if(!(Id in Td)){P1.f(Td,Id,{value:function(r){if(typeof this!="function"||!Ed(r))return false;if(!Ed(this.prototype))return r instanceof this;while(r=_1(r))if(this.prototype===r)return true;return false}})}});var wd=o(()=>{var M1=d();var L1=R();M1({global:true},{globalThis:L1})});var Od=o(()=>{var C1=d();var j1=he();C1({target:"Array",stat:true},{isArray:j1})});var xd=o(()=>{"use strict";var D1=d();var U1=A();var N1=de();var $1=U1(function(){function r(){}return!(Array.of.call(r)instanceof r)});D1({target:"Array",stat:true,forced:$1},{of:function r(){var e=0;var t=arguments.length;var n=new(typeof this=="function"?this:Array)(t);while(t>e)N1(n,e,arguments[e++]);n.length=t;return n}})});var Qu=o((xz,Rd)=>{"use strict";var B1=k();var Zu=Qr();var G1=D();var H1=Math.min;Rd.exports=[].copyWithin||function r(e,t){var n=B1(this);var a=G1(n.length);var i=Zu(e,a);var u=Zu(t,a);var f=arguments.length>2?arguments[2]:void 0;var s=H1((f===void 0?a:Zu(f,a))-u,a-i);var c=1;if(u0){if(u in n)n[i]=n[u];else delete n[i];i+=c;u+=c}return n}});var ae=o((Rz,Pd)=>{var k1=j();var V1=$r();var W1=$();var ro=k1("unscopables");var eo=Array.prototype;if(eo[ro]==void 0){W1.f(eo,ro,{configurable:true,value:V1(null)})}Pd.exports=function(r){eo[ro][r]=true}});var _d=o(()=>{var K1=d();var z1=Qu();var Y1=ae();K1({target:"Array",proto:true},{copyWithin:z1});Y1("copyWithin")});var Gr=o((Fz,Fd)=>{"use strict";var X1=A();Fd.exports=function(r,e){var t=[][r];return!!t&&X1(function(){t.call(null,e||function(){throw 1},1)})}});var or=o((Mz,Ld)=>{var J1=C();var Z1=A();var da=V();var Q1=Object.defineProperty;var to={};var Md=function(r){throw r};Ld.exports=function(r,e){if(da(to,r))return to[r];if(!e)e={};var t=[][r];var n=da(e,"ACCESSORS")?e.ACCESSORS:false;var a=da(e,0)?e[0]:Md;var i=da(e,1)?e[1]:void 0;return to[r]=!!t&&!Z1(function(){if(n&&!J1)return true;var u={length:-1};if(n)Q1(u,1,{enumerable:true,get:Md});else u[1]=1;t.call(u,a,i)})}});var Cd=o(()=>{"use strict";var r_=d();var e_=Z().every;var t_=Gr();var n_=or();var a_=t_("every");var i_=n_("every");r_({target:"Array",proto:true,forced:!a_||!i_},{every:function r(e){return e_(this,e,arguments.length>1?arguments[1]:void 0)}})});var pa=o((jz,Dd)=>{"use strict";var u_=k();var jd=Qr();var o_=D();Dd.exports=function r(e){var t=u_(this);var n=o_(t.length);var a=arguments.length;var i=jd(a>1?arguments[1]:void 0,n);var u=a>2?arguments[2]:void 0;var f=u===void 0?n:jd(u,n);while(f>i)t[i++]=e;return t}});var Ud=o(()=>{var s_=d();var f_=pa();var v_=ae();s_({target:"Array",proto:true},{fill:f_});v_("fill")});var Nd=o(()=>{"use strict";var c_=d();var l_=Z().filter;var h_=Ze();var d_=or();var p_=h_("filter");var g_=d_("filter");c_({target:"Array",proto:true,forced:!p_||!g_},{filter:function r(e){return l_(this,e,arguments.length>1?arguments[1]:void 0)}})});var no=o(()=>{"use strict";var q_=d();var y_=Z().find;var m_=ae();var S_=or();var ga="find";var $d=true;var b_=S_(ga);if(ga in[])Array(1)[ga](function(){$d=false});q_({target:"Array",proto:true,forced:$d||!b_},{find:function r(e){return y_(this,e,arguments.length>1?arguments[1]:void 0)}});m_(ga)});var Gd=o(()=>{"use strict";var E_=d();var I_=Z().findIndex;var T_=ae();var A_=or();var qa="findIndex";var Bd=true;var w_=A_(qa);if(qa in[])Array(1)[qa](function(){Bd=false});E_({target:"Array",proto:true,forced:Bd||!w_},{findIndex:function r(e){return I_(this,e,arguments.length>1?arguments[1]:void 0)}});T_(qa)});var ao=o((Vz,kd)=>{"use strict";var O_=he();var x_=D();var R_=Br();var Hd=function(r,e,t,n,a,i,u,f){var s=a;var c=0;var l=u?R_(u,f,3):false;var v;while(c0&&O_(v)){s=Hd(r,e,v,x_(v.length),s,i-1)-1}else{if(s>=9007199254740991)throw TypeError("Exceed the acceptable array length");r[s]=v}s++}c++}return s};kd.exports=Hd});var Vd=o(()=>{"use strict";var P_=d();var __=ao();var F_=k();var M_=D();var L_=br();var C_=Je();P_({target:"Array",proto:true},{flat:function r(){var e=arguments.length?arguments[0]:void 0;var t=F_(this);var n=M_(t.length);var a=C_(t,0);a.length=__(a,t,t,n,0,e===void 0?1:L_(e));return a}})});var Wd=o(()=>{"use strict";var j_=d();var D_=ao();var U_=k();var N_=D();var $_=ur();var B_=Je();j_({target:"Array",proto:true},{flatMap:function r(e){var t=U_(this);var n=N_(t.length);var a;$_(e);a=B_(t,0);a.length=D_(a,t,t,n,0,1,e,arguments.length>1?arguments[1]:void 0);return a}})});var io=o((Xz,Kd)=>{"use strict";var G_=Z().forEach;var H_=Gr();var k_=or();var V_=H_("forEach");var W_=k_("forEach");Kd.exports=!V_||!W_?function r(e){return G_(this,e,arguments.length>1?arguments[1]:void 0)}:[].forEach});var Yd=o(()=>{"use strict";var K_=d();var zd=io();K_({target:"Array",proto:true,forced:[].forEach!=zd},{forEach:zd})});var Xd=o(()=>{"use strict";var z_=d();var Y_=Ye().includes;var X_=ae();var J_=or();var Z_=J_("indexOf",{ACCESSORS:true,1:0});z_({target:"Array",proto:true,forced:!Z_},{includes:function r(e){return Y_(this,e,arguments.length>1?arguments[1]:void 0)}});X_("includes")});var Qd=o(()=>{"use strict";var Q_=d();var rF=Ye().indexOf;var eF=Gr();var tF=or();var Zd=[].indexOf;var Jd=!!Zd&&1/[1].indexOf(1,-0)<0;var nF=eF("indexOf");var aF=tF("indexOf",{ACCESSORS:true,1:0});Q_({target:"Array",proto:true,forced:Jd||!nF||!aF},{indexOf:function r(e){return Jd?Zd.apply(this,arguments)||0:rF(this,e,arguments.length>1?arguments[1]:void 0)}})});var rp=o(()=>{"use strict";var iF=d();var uF=Ve();var oF=lr();var sF=Gr();var fF=[].join;var vF=uF!=Object;var cF=sF("join",",");iF({target:"Array",proto:true,forced:vF||!cF},{join:function r(e){return fF.call(oF(this),e===void 0?",":e)}})});var oo=o((i5,tp)=>{"use strict";var lF=lr();var hF=br();var dF=D();var pF=Gr();var gF=or();var qF=Math.min;var uo=[].lastIndexOf;var ep=!!uo&&1/[1].lastIndexOf(1,-0)<0;var yF=pF("lastIndexOf");var mF=gF("indexOf",{ACCESSORS:true,1:0});var SF=ep||!yF||!mF;tp.exports=SF?function r(e){if(ep)return uo.apply(this,arguments)||0;var t=lF(this);var n=dF(t.length);var a=n-1;if(arguments.length>1)a=qF(a,hF(arguments[1]));if(a<0)a=n+a;for(;a>=0;a--)if(a in t&&t[a]===e)return a||0;return-1}:uo});var ap=o(()=>{var bF=d();var np=oo();bF({target:"Array",proto:true,forced:np!==[].lastIndexOf},{lastIndexOf:np})});var so=o(()=>{"use strict";var EF=d();var IF=Z().map;var TF=Ze();var AF=or();var wF=TF("map");var OF=AF("map");EF({target:"Array",proto:true,forced:!wF||!OF},{map:function r(e){return IF(this,e,arguments.length>1?arguments[1]:void 0)}})});var Ht=o((v5,up)=>{var xF=ur();var RF=k();var PF=Ve();var _F=D();var ip=function(r){return function(e,t,n,a){xF(t);var i=RF(e);var u=PF(i);var f=_F(i.length);var s=r?f-1:0;var c=r?-1:1;if(n<2)while(true){if(s in u){a=u[s];s+=c;break}s+=c;if(r?s<0:f<=s){throw TypeError("Reduce of empty array with no initial value")}}for(;r?s>=0:f>s;s+=c)if(s in u){a=t(a,u[s],s,i)}return a}};up.exports={left:ip(false),right:ip(true)}});var op=o(()=>{"use strict";var FF=d();var MF=Ht().left;var LF=Gr();var CF=or();var jF=LF("reduce");var DF=CF("reduce",{1:0});FF({target:"Array",proto:true,forced:!jF||!DF},{reduce:function r(e){return MF(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})});var sp=o(()=>{"use strict";var UF=d();var NF=Ht().right;var $F=Gr();var BF=or();var GF=$F("reduceRight");var HF=BF("reduce",{1:0});UF({target:"Array",proto:true,forced:!GF||!HF},{reduceRight:function r(e){return NF(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})});var vp=o(()=>{"use strict";var kF=d();var VF=he();var WF=[].reverse;var fp=[1,2];kF({target:"Array",proto:true,forced:String(fp)===String(fp.reverse())},{reverse:function r(){if(VF(this))this.length=this.length;return WF.call(this)}})});var hp=o(()=>{"use strict";var KF=d();var zF=F();var cp=he();var lp=Qr();var YF=D();var XF=lr();var JF=de();var ZF=j();var QF=Ze();var rM=or();var eM=QF("slice");var tM=rM("slice",{ACCESSORS:true,0:0,1:2});var nM=ZF("species");var aM=[].slice;var iM=Math.max;KF({target:"Array",proto:true,forced:!eM||!tM},{slice:function r(e,t){var n=XF(this);var a=YF(n.length);var i=lp(e,a);var u=lp(t===void 0?a:t,a);var f,s,c;if(cp(n)){f=n.constructor;if(typeof f=="function"&&(f===Array||cp(f.prototype))){f=void 0}else if(zF(f)){f=f[nM];if(f===null)f=void 0}if(f===Array||f===void 0){return aM.call(n,i,u)}}s=new(f===void 0?Array:f)(iM(u-i,0));for(c=0;i{"use strict";var uM=d();var oM=Z().some;var sM=Gr();var fM=or();var vM=sM("some");var cM=fM("some");uM({target:"Array",proto:true,forced:!vM||!cM},{some:function r(e){return oM(this,e,arguments.length>1?arguments[1]:void 0)}})});var yp=o(()=>{"use strict";var lM=d();var hM=ur();var pp=k();var qp=A();var dM=Gr();var fo=[];var gp=fo.sort;var pM=qp(function(){fo.sort(void 0)});var gM=qp(function(){fo.sort(null)});var qM=dM("sort");var yM=pM||!gM||!qM;lM({target:"Array",proto:true,forced:yM},{sort:function r(e){return e===void 0?gp.call(pp(this)):gp.call(pp(this),hM(e))}})});var mp=o(()=>{"use strict";var mM=d();var SM=Qr();var bM=br();var EM=D();var IM=k();var TM=Je();var AM=de();var wM=Ze();var OM=or();var xM=wM("splice");var RM=OM("splice",{ACCESSORS:true,0:0,1:2});var PM=Math.max;var _M=Math.min;var FM=9007199254740991;var MM="Maximum allowed length exceeded";mM({target:"Array",proto:true,forced:!xM||!RM},{splice:function r(e,t){var n=IM(this);var a=EM(n.length);var i=SM(e,a);var u=arguments.length;var f,s,c,l,v,h;if(u===0){f=s=0}else if(u===1){f=0;s=a-i}else{f=u-2;s=_M(PM(bM(t),0),a-i)}if(a+f-s>FM){throw TypeError(MM)}c=TM(n,s);for(l=0;la-s+f;l--)delete n[l-1]}else if(f>s){for(l=a-s;l>i;l--){v=l+s-1;h=l+f-1;if(v in n)n[h]=n[v];else delete n[h]}}for(l=0;l{"use strict";var LM=Sr();var CM=$();var jM=j();var DM=C();var Sp=jM("species");bp.exports=function(r){var e=LM(r);var t=CM.f;if(DM&&e&&!e[Sp]){t(e,Sp,{configurable:true,get:function(){return this}})}}});var Ep=o(()=>{var UM=_e();UM("Array")});var Ip=o(()=>{var NM=ae();NM("flat")});var Tp=o(()=>{var $M=ae();$M("flatMap")});var kt=o((F5,xp)=>{"use strict";var BM=lr();var vo=ae();var Ap=it();var wp=ar();var GM=ca();var Op="Array Iterator";var HM=wp.set;var kM=wp.getterFor(Op);xp.exports=GM(Array,"Array",function(r,e){HM(this,{type:Op,target:BM(r),index:0,kind:e})},function(){var r=kM(this);var e=r.target;var t=r.kind;var n=r.index++;if(!e||n>=e.length){r.target=void 0;return{value:void 0,done:true}}if(t=="keys")return{value:n,done:false};if(t=="values")return{value:e[n],done:false};return{value:[n,e[n]],done:false}},"values");Ap.Arguments=Ap.Array;vo("keys");vo("values");vo("entries")});var _p=o(()=>{var VM=d();var WM=Qr();var Rp=String.fromCharCode;var Pp=String.fromCodePoint;var KM=!!Pp&&Pp.length!=1;VM({target:"String",stat:true,forced:KM},{fromCodePoint:function r(e){var t=[];var n=arguments.length;var a=0;var i;while(n>a){i=+arguments[a++];if(WM(i,1114111)!==i)throw RangeError(i+" is not a valid code point");t.push(i<65536?Rp(i):Rp(((i-=65536)>>10)+55296,i%1024+56320))}return t.join("")}})});var Fp=o(()=>{var zM=d();var YM=lr();var XM=D();zM({target:"String",stat:true},{raw:function r(e){var t=YM(e.raw);var n=XM(t.length);var a=arguments.length;var i=[];var u=0;while(n>u){i.push(String(t[u++]));if(u{"use strict";var JM=d();var ZM=Ut().codeAt;JM({target:"String",proto:true},{codePointAt:function r(e){return ZM(this,e)}})});var Vt=o((N5,Lp)=>{var QM=F();var rL=mr();var eL=j();var tL=eL("match");Lp.exports=function(r){var e;return QM(r)&&((e=r[tL])!==void 0?!!e:rL(r)=="RegExp")}});var ya=o(($5,Cp)=>{var nL=Vt();Cp.exports=function(r){if(nL(r)){throw TypeError("The method doesn't accept regular expressions")}return r}});var ma=o((B5,jp)=>{var aL=j();var iL=aL("match");jp.exports=function(r){var e=/./;try{"/./"[r](e)}catch(t){try{e[iL]=false;return"/./"[r](e)}catch(n){}}return false}});var $p=o(()=>{"use strict";var uL=d();var oL=rr().f;var Dp=D();var sL=ya();var fL=tr();var vL=ma();var cL=Or();var Up="".endsWith;var lL=Math.min;var Np=vL("endsWith");var hL=!cL&&!Np&&!!function(){var r=oL(String.prototype,"endsWith");return r&&!r.writable}();uL({target:"String",proto:true,forced:!hL&&!Np},{endsWith:function r(e){var t=String(fL(this));sL(e);var n=arguments.length>1?arguments[1]:void 0;var a=Dp(t.length);var i=n===void 0?a:lL(Dp(n),a);var u=String(e);return Up?Up.call(t,u,i):t.slice(i-u.length,i)===u}})});var Bp=o(()=>{"use strict";var dL=d();var pL=ya();var gL=tr();var qL=ma();dL({target:"String",proto:true,forced:!qL("includes")},{includes:function r(e){return!!~String(gL(this)).indexOf(pL(e),arguments.length>1?arguments[1]:void 0)}})});var ft=o((W5,Gp)=>{"use strict";var yL=M();Gp.exports=function(){var r=yL(this);var e="";if(r.global)e+="g";if(r.ignoreCase)e+="i";if(r.multiline)e+="m";if(r.dotAll)e+="s";if(r.unicode)e+="u";if(r.sticky)e+="y";return e}});var Wt=o(co=>{"use strict";var Hp=A();function kp(r,e){return RegExp(r,e)}co.UNSUPPORTED_Y=Hp(function(){var r=kp("a","y");r.lastIndex=2;return r.exec("abcd")!=null});co.BROKEN_CARET=Hp(function(){var r=kp("^r","gy");r.lastIndex=2;return r.exec("str")!=null})});var Kt=o((z5,zp)=>{"use strict";var mL=ft();var Vp=Wt();var Sa=RegExp.prototype.exec;var SL=String.prototype.replace;var Wp=Sa;var lo=function(){var r=/a/;var e=/b*/g;Sa.call(r,"a");Sa.call(e,"a");return r.lastIndex!==0||e.lastIndex!==0}();var Kp=Vp.UNSUPPORTED_Y||Vp.BROKEN_CARET;var ho=/()??/.exec("")[1]!==void 0;var bL=lo||ho||Kp;if(bL){Wp=function r(e){var t=this;var n,a,i,u;var f=Kp&&t.sticky;var s=mL.call(t);var c=t.source;var l=0;var v=e;if(f){s=s.replace("y","");if(s.indexOf("g")===-1){s+="g"}v=String(e).slice(t.lastIndex);if(t.lastIndex>0&&(!t.multiline||t.multiline&&e[t.lastIndex-1]!=="\n")){c="(?: "+c+")";v=" "+v;l++}a=new RegExp("^(?:"+c+")",s)}if(ho){a=new RegExp("^"+c+"$(?!\\s)",s)}if(lo)n=t.lastIndex;i=Sa.call(f?a:t,v);if(f){if(i){i.input=i.input.slice(l);i[0]=i[0].slice(l);i.index=t.lastIndex;t.lastIndex+=i[0].length}else t.lastIndex=0}else if(lo&&i){t.lastIndex=t.global?i.index+i[0].length:n}if(ho&&i&&i.length>1){SL.call(i[0],a,function(){for(u=1;u{"use strict";var EL=d();var Yp=Kt();EL({target:"RegExp",proto:true,forced:/./.exec!==Yp},{exec:Yp})});var zt=o((J5,rg)=>{"use strict";ba();var Xp=er();var Ea=A();var po=j();var IL=Kt();var TL=nr();var AL=po("species");var wL=!Ea(function(){var r=/./;r.exec=function(){var e=[];e.groups={a:"7"};return e};return"".replace(r,"$")!=="7"});var Jp=function(){return"a".replace(/./,"$0")==="$0"}();var Zp=po("replace");var Qp=function(){if(/./[Zp]){return/./[Zp]("a","$0")===""}return false}();var OL=!Ea(function(){var r=/(?:)/;var e=r.exec;r.exec=function(){return e.apply(this,arguments)};var t="ab".split(r);return t.length!==2||t[0]!=="a"||t[1]!=="b"});rg.exports=function(r,e,t,n){var a=po(r);var i=!Ea(function(){var v={};v[a]=function(){return 7};return""[r](v)!=7});var u=i&&!Ea(function(){var v=false;var h=/a/;if(r==="split"){h={};h.constructor={};h.constructor[AL]=function(){return h};h.flags="";h[a]=/./[a]}h.exec=function(){v=true;return null};h[a]("");return!v});if(!i||!u||r==="replace"&&!(wL&&Jp&&!Qp)||r==="split"&&!OL){var f=/./[a];var s=t(a,""[r],function(v,h,I,m,q){if(h.exec===IL){if(i&&!q){return{done:true,value:f.call(h,I,m)}}return{done:true,value:v.call(I,h,m)}}return{done:false}},{REPLACE_KEEPS_$0:Jp,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:Qp});var c=s[0];var l=s[1];Xp(String.prototype,r,c);Xp(RegExp.prototype,a,e==2?function(v,h){return l.call(v,this,h)}:function(v){return l.call(v,this)})}if(n)TL(RegExp.prototype[a],"sham",true)}});var Yt=o((Z5,eg)=>{"use strict";var xL=Ut().charAt;eg.exports=function(r,e,t){return e+(t?xL(r,e).length:1)}});var Xt=o((Q5,tg)=>{var RL=mr();var PL=Kt();tg.exports=function(r,e){var t=r.exec;if(typeof t==="function"){var n=t.call(r,e);if(typeof n!=="object"){throw TypeError("RegExp exec method returned something other than an Object or null")}return n}if(RL(r)!=="RegExp"){throw TypeError("RegExp#exec called on incompatible receiver")}return PL.call(r,e)}});var ag=o(()=>{"use strict";var _L=zt();var FL=M();var ML=D();var LL=tr();var CL=Yt();var ng=Xt();_L("match",1,function(r,e,t){return[function n(a){var i=LL(this);var u=a==void 0?void 0:a[r];return u!==void 0?u.call(a,i):new RegExp(a)[r](String(i))},function(n){var a=t(e,n,this);if(a.done)return a.value;var i=FL(n);var u=String(this);if(!i.global)return ng(i,u);var f=i.unicode;i.lastIndex=0;var s=[];var c=0;var l;while((l=ng(i,u))!==null){var v=String(l[0]);s[c]=v;if(v==="")i.lastIndex=CL(u,ML(i.lastIndex),f);c++}return c===0?null:s}]})});var Hr=o((tY,ug)=>{var ig=M();var jL=ur();var DL=j();var UL=DL("species");ug.exports=function(r,e){var t=ig(r).constructor;var n;return t===void 0||(n=ig(t)[UL])==void 0?e:jL(n)}});var hg=o(()=>{"use strict";var NL=d();var $L=sa();var og=tr();var sg=D();var BL=ur();var GL=M();var HL=mr();var kL=Vt();var fg=ft();var VL=nr();var WL=A();var KL=j();var zL=Hr();var YL=Yt();var vg=ar();var qo=Or();var Ia=KL("matchAll");var cg="RegExp String";var lg=cg+" Iterator";var XL=vg.set;var JL=vg.getterFor(lg);var Jt=RegExp.prototype;var ZL=Jt.exec;var yo="".matchAll;var go=!!yo&&!WL(function(){"a".matchAll(/./)});var QL=function(r,e){var t=r.exec;var n;if(typeof t=="function"){n=t.call(r,e);if(typeof n!="object")throw TypeError("Incorrect exec result");return n}return ZL.call(r,e)};var rC=$L(function r(e,t,n,a){XL(this,{type:lg,regexp:e,string:t,global:n,unicode:a,done:false})},cg,function r(){var e=JL(this);if(e.done)return{value:void 0,done:true};var t=e.regexp;var n=e.string;var a=QL(t,n);if(a===null)return{value:void 0,done:e.done=true};if(e.global){if(String(a[0])=="")t.lastIndex=YL(n,sg(t.lastIndex),e.unicode);return{value:a,done:false}}e.done=true;return{value:a,done:false}});var mo=function(r){var e=GL(this);var t=String(r);var n,a,i,u,f,s;n=zL(e,RegExp);a=e.flags;if(a===void 0&&e instanceof RegExp&&!("flags"in Jt)){a=fg.call(e)}i=a===void 0?"":String(a);u=new n(n===RegExp?e.source:e,i);f=!!~i.indexOf("g");s=!!~i.indexOf("u");u.lastIndex=sg(e.lastIndex);return new rC(u,t,f,s)};NL({target:"String",proto:true,forced:go},{matchAll:function r(e){var t=og(this);var n,a,i,u;if(e!=null){if(kL(e)){n=String(og("flags"in Jt?e.flags:fg.call(e)));if(!~n.indexOf("g"))throw TypeError("`.matchAll` does not allow non-global regexes")}if(go)return yo.apply(t,arguments);i=e[Ia];if(i===void 0&&qo&&HL(e)=="RegExp")i=mo;if(i!=null)return BL(i).call(e,t)}else if(go)return yo.apply(t,arguments);a=String(t);u=new RegExp(e,"g");return qo?mo.call(u,a):u[Ia](a)}});qo||Ia in Jt||VL(Jt,Ia,mo)});var Ta=o((iY,dg)=>{"use strict";var eC=br();var tC=tr();dg.exports="".repeat||function r(e){var t=String(tC(this));var n="";var a=eC(e);if(a<0||a==Infinity)throw RangeError("Wrong number of repetitions");for(;a>0;(a>>>=1)&&(t+=t))if(a&1)n+=t;return n}});var Aa=o((uY,gg)=>{var nC=D();var aC=Ta();var iC=tr();var uC=Math.ceil;var pg=function(r){return function(e,t,n){var a=String(iC(e));var i=a.length;var u=n===void 0?" ":String(n);var f=nC(t);var s,c;if(f<=i||u=="")return a;s=f-i;c=aC.call(u,uC(s/u.length));if(c.length>s)c=c.slice(0,s);return r?a+c:c+a}};gg.exports={start:pg(false),end:pg(true)}});var So=o((oY,qg)=>{var oC=Mt();qg.exports=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(oC)});var yg=o(()=>{"use strict";var sC=d();var fC=Aa().end;var vC=So();sC({target:"String",proto:true,forced:vC},{padEnd:function r(e){return fC(this,e,arguments.length>1?arguments[1]:void 0)}})});var mg=o(()=>{"use strict";var cC=d();var lC=Aa().start;var hC=So();cC({target:"String",proto:true,forced:hC},{padStart:function r(e){return lC(this,e,arguments.length>1?arguments[1]:void 0)}})});var Sg=o(()=>{var dC=d();var pC=Ta();dC({target:"String",proto:true},{repeat:pC})});var bg=o(()=>{"use strict";var gC=zt();var qC=M();var yC=k();var mC=D();var SC=br();var bC=tr();var EC=Yt();var IC=Xt();var TC=Math.max;var AC=Math.min;var wC=Math.floor;var OC=/\$([$&'`]|\d\d?|<[^>]*>)/g;var xC=/\$([$&'`]|\d\d?)/g;var RC=function(r){return r===void 0?r:String(r)};gC("replace",2,function(r,e,t,n){var a=n.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;var i=n.REPLACE_KEEPS_$0;var u=a?"$":"$0";return[function s(c,l){var v=bC(this);var h=c==void 0?void 0:c[r];return h!==void 0?h.call(c,v,l):e.call(String(v),c,l)},function(s,c){if(!a&&i||typeof c==="string"&&c.indexOf(u)===-1){var l=t(e,s,this,c);if(l.done)return l.value}var v=qC(s);var h=String(this);var I=typeof c==="function";if(!I)c=String(c);var m=v.global;if(m){var q=v.unicode;v.lastIndex=0}var b=[];while(true){var T=IC(v,h);if(T===null)break;b.push(T);if(!m)break;var _=String(T[0]);if(_==="")v.lastIndex=EC(h,mC(v.lastIndex),q)}var O="";var K=0;for(var H=0;H=K){O+=h.slice(K,sr)+B;K=sr+N.length}}return O+h.slice(K)}];function f(s,c,l,v,h,I){var m=l+s.length;var q=v.length;var b=xC;if(h!==void 0){h=yC(h);b=OC}return e.call(I,b,function(T,_){var O;switch(_.charAt(0)){case"$":return"$";case"&":return s;case"`":return c.slice(0,l);case"'":return c.slice(m);case"<":O=h[_.slice(1,-1)];break;default:var K=+_;if(K===0)return T;if(K>q){var H=wC(K/10);if(H===0)return T;if(H<=q)return v[H-1]===void 0?_.charAt(1):v[H-1]+_.charAt(1);return T}O=v[K-1]}return O===void 0?"":O})}})});var Ig=o(()=>{"use strict";var PC=zt();var _C=M();var FC=tr();var Eg=Hu();var MC=Xt();PC("search",1,function(r,e,t){return[function n(a){var i=FC(this);var u=a==void 0?void 0:a[r];return u!==void 0?u.call(a,i):new RegExp(a)[r](String(i))},function(n){var a=t(e,n,this);if(a.done)return a.value;var i=_C(n);var u=String(this);var f=i.lastIndex;if(!Eg(f,0))i.lastIndex=0;var s=MC(i,u);if(!Eg(i.lastIndex,f))i.lastIndex=f;return s===null?-1:s.index}]})});var wg=o(()=>{"use strict";var LC=zt();var CC=Vt();var jC=M();var Tg=tr();var DC=Hr();var UC=Yt();var NC=D();var Ag=Xt();var $C=Kt();var BC=A();var GC=[].push;var HC=Math.min;var bo=4294967295;var vt=!BC(function(){return!RegExp(bo,"y")});LC("split",2,function(r,e,t){var n;if("abbc".split(/(b)*/)[1]=="c"||"test".split(/(?:)/,-1).length!=4||"ab".split(/(?:ab)*/).length!=2||".".split(/(.?)(.?)/).length!=4||".".split(/()()/).length>1||"".split(/.?/).length){n=function(a,i){var u=String(Tg(this));var f=i===void 0?bo:i>>>0;if(f===0)return[];if(a===void 0)return[u];if(!CC(a)){return e.call(u,a,f)}var s=[];var c=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(a.sticky?"y":"");var l=0;var v=new RegExp(a.source,c+"g");var h,I,m;while(h=$C.call(v,u)){I=v.lastIndex;if(I>l){s.push(u.slice(l,h.index));if(h.length>1&&h.index=f)break}if(v.lastIndex===h.index)v.lastIndex++}if(l===u.length){if(m||!v.test(""))s.push("")}else s.push(u.slice(l));return s.length>f?s.slice(0,f):s}}else if("0".split(void 0,0).length){n=function(a,i){return a===void 0&&i===0?[]:e.call(this,a,i)}}else n=e;return[function a(i,u){var f=Tg(this);var s=i==void 0?void 0:i[r];return s!==void 0?s.call(i,f,u):n.call(String(f),i,u)},function(a,i){var u=t(n,a,this,i,n!==e);if(u.done)return u.value;var f=jC(a);var s=String(this);var c=DC(f,RegExp);var l=f.unicode;var v=(f.ignoreCase?"i":"")+(f.multiline?"m":"")+(f.unicode?"u":"")+(vt?"y":"g");var h=new c(vt?f:"^(?:"+f.source+")",v);var I=i===void 0?bo:i>>>0;if(I===0)return[];if(s.length===0)return Ag(h,s)===null?[s]:[];var m=0;var q=0;var b=[];while(q{"use strict";var kC=d();var VC=rr().f;var WC=D();var KC=ya();var zC=tr();var YC=ma();var XC=Or();var Og="".startsWith;var JC=Math.min;var xg=YC("startsWith");var ZC=!XC&&!xg&&!!function(){var r=VC(String.prototype,"startsWith");return r&&!r.writable}();kC({target:"String",proto:true,forced:!ZC&&!xg},{startsWith:function r(e){var t=String(zC(this));KC(e);var n=WC(JC(arguments.length>1?arguments[1]:void 0,t.length));var a=String(e);return Og?Og.call(t,a,n):t.slice(n,n+a.length)===a}})});var Zt=o((EY,Pg)=>{Pg.exports=" \n\v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF"});var Fe=o((IY,_g)=>{var QC=tr();var rj=Zt();var wa="["+rj+"]";var ej=RegExp("^"+wa+wa+"*");var tj=RegExp(wa+wa+"*$");var Eo=function(r){return function(e){var t=String(QC(e));if(r&1)t=t.replace(ej,"");if(r&2)t=t.replace(tj,"");return t}};_g.exports={start:Eo(1),end:Eo(2),trim:Eo(3)}});var Oa=o((TY,Lg)=>{var nj=A();var Fg=Zt();var Mg="\u200B\x85\u180E";Lg.exports=function(r){return nj(function(){return!!Fg[r]()||Mg[r]()!=Mg||Fg[r].name!==r})}});var Cg=o(()=>{"use strict";var aj=d();var ij=Fe().trim;var uj=Oa();aj({target:"String",proto:true,forced:uj("trim")},{trim:function r(){return ij(this)}})});var Ug=o(()=>{"use strict";var oj=d();var sj=Fe().start;var fj=Oa();var Dg=fj("trimStart");var jg=Dg?function r(){return sj(this)}:"".trimStart;oj({target:"String",proto:true,forced:Dg},{trimStart:jg,trimLeft:jg})});var Bg=o(()=>{"use strict";var vj=d();var cj=Fe().end;var lj=Oa();var $g=lj("trimEnd");var Ng=$g?function r(){return cj(this)}:"".trimEnd;vj({target:"String",proto:true,forced:$g},{trimEnd:Ng,trimRight:Ng})});var pr=o((_Y,Gg)=>{var hj=tr();var dj=/"/g;Gg.exports=function(r,e,t,n){var a=String(hj(r));var i="<"+e;if(t!=="")i+=" "+t+'="'+String(n).replace(dj,""")+'"';return i+">"+a+""}});var gr=o((FY,Hg)=>{var pj=A();Hg.exports=function(r){return pj(function(){var e=""[r]('"');return e!==e.toLowerCase()||e.split('"').length>3})}});var kg=o(()=>{"use strict";var gj=d();var qj=pr();var yj=gr();gj({target:"String",proto:true,forced:yj("anchor")},{anchor:function r(e){return qj(this,"a","name",e)}})});var Vg=o(()=>{"use strict";var mj=d();var Sj=pr();var bj=gr();mj({target:"String",proto:true,forced:bj("big")},{big:function r(){return Sj(this,"big","","")}})});var Wg=o(()=>{"use strict";var Ej=d();var Ij=pr();var Tj=gr();Ej({target:"String",proto:true,forced:Tj("blink")},{blink:function r(){return Ij(this,"blink","","")}})});var Kg=o(()=>{"use strict";var Aj=d();var wj=pr();var Oj=gr();Aj({target:"String",proto:true,forced:Oj("bold")},{bold:function r(){return wj(this,"b","","")}})});var zg=o(()=>{"use strict";var xj=d();var Rj=pr();var Pj=gr();xj({target:"String",proto:true,forced:Pj("fixed")},{fixed:function r(){return Rj(this,"tt","","")}})});var Yg=o(()=>{"use strict";var _j=d();var Fj=pr();var Mj=gr();_j({target:"String",proto:true,forced:Mj("fontcolor")},{fontcolor:function r(e){return Fj(this,"font","color",e)}})});var Xg=o(()=>{"use strict";var Lj=d();var Cj=pr();var jj=gr();Lj({target:"String",proto:true,forced:jj("fontsize")},{fontsize:function r(e){return Cj(this,"font","size",e)}})});var Jg=o(()=>{"use strict";var Dj=d();var Uj=pr();var Nj=gr();Dj({target:"String",proto:true,forced:Nj("italics")},{italics:function r(){return Uj(this,"i","","")}})});var Zg=o(()=>{"use strict";var $j=d();var Bj=pr();var Gj=gr();$j({target:"String",proto:true,forced:Gj("link")},{link:function r(e){return Bj(this,"a","href",e)}})});var Qg=o(()=>{"use strict";var Hj=d();var kj=pr();var Vj=gr();Hj({target:"String",proto:true,forced:Vj("small")},{small:function r(){return kj(this,"small","","")}})});var rq=o(()=>{"use strict";var Wj=d();var Kj=pr();var zj=gr();Wj({target:"String",proto:true,forced:zj("strike")},{strike:function r(){return Kj(this,"strike","","")}})});var eq=o(()=>{"use strict";var Yj=d();var Xj=pr();var Jj=gr();Yj({target:"String",proto:true,forced:Jj("sub")},{sub:function r(){return Xj(this,"sub","","")}})});var tq=o(()=>{"use strict";var Zj=d();var Qj=pr();var rD=gr();Zj({target:"String",proto:true,forced:rD("sup")},{sup:function r(){return Qj(this,"sup","","")}})});var Qt=o((i7,aq)=>{var eD=F();var nq=ge();aq.exports=function(r,e,t){var n,a;if(nq&&typeof(n=e.constructor)=="function"&&n!==t&&eD(a=n.prototype)&&a!==t.prototype)nq(r,a);return r}});var oq=o(()=>{var tD=C();var uq=R();var nD=Xe();var aD=Qt();var iD=$().f;var uD=le().f;var oD=Vt();var sD=ft();var fD=Wt();var vD=er();var cD=A();var lD=ar().set;var hD=_e();var dD=j();var pD=dD("match");var Vr=uq.RegExp;var Io=Vr.prototype;var rn=/a/g;var To=/a/g;var Oo=new Vr(rn)!==rn;var xo=fD.UNSUPPORTED_Y;var gD=tD&&nD("RegExp",!Oo||xo||cD(function(){To[pD]=false;return Vr(rn)!=rn||Vr(To)==To||Vr(rn,"i")!="/a/i"}));if(gD){kr=function r(e,t){var n=this instanceof kr;var a=oD(e);var i=t===void 0;var u;if(!n&&a&&e.constructor===kr&&i){return e}if(Oo){if(a&&!i)e=e.source}else if(e instanceof kr){if(i)t=sD.call(e);e=e.source}if(xo){u=!!t&&t.indexOf("y")>-1;if(u)t=t.replace(/y/g,"")}var f=aD(Oo?new Vr(e,t):Vr(e,t),n?this:Io,kr);if(xo&&u)lD(f,{sticky:u});return f};iq=function(r){r in kr||iD(kr,r,{configurable:true,get:function(){return Vr[r]},set:function(e){Vr[r]=e}})};Ao=uD(Vr);wo=0;while(Ao.length>wo)iq(Ao[wo++]);Io.constructor=kr;kr.prototype=Io;vD(uq,"RegExp",kr)}var kr;var iq;var Ao;var wo;hD("RegExp")});var sq=o(()=>{var qD=C();var yD=$();var mD=ft();var SD=Wt().UNSUPPORTED_Y;if(qD&&(/./g.flags!="g"||SD)){yD.f(RegExp.prototype,"flags",{configurable:true,get:mD})}});var fq=o(()=>{var bD=C();var ED=Wt().UNSUPPORTED_Y;var ID=$().f;var TD=ar().get;var AD=RegExp.prototype;if(bD&&ED){ID(RegExp.prototype,"sticky",{configurable:true,get:function(){if(this===AD)return void 0;if(this instanceof RegExp){return!!TD(this).sticky}throw TypeError("Incompatible receiver, RegExp required")}})}});var vq=o(()=>{"use strict";ba();var wD=d();var OD=F();var xD=function(){var r=false;var e=/[ac]/;e.exec=function(){r=true;return/./.exec.apply(this,arguments)};return e.test("abc")===true&&r}();var RD=/./.test;wD({target:"RegExp",proto:true,forced:!xD},{test:function(r){if(typeof this.exec!=="function"){return RD.call(this,r)}var e=this.exec(r);if(e!==null&&!OD(e)){throw new Error("RegExp exec method returned something other than an Object or null")}return!!e}})});var hq=o(()=>{"use strict";var PD=er();var _D=M();var FD=A();var MD=ft();var Ro="toString";var cq=RegExp.prototype;var lq=cq[Ro];var LD=FD(function(){return lq.call({source:"a",flags:"b"})!="/a/b"});var CD=lq.name!=Ro;if(LD||CD){PD(RegExp.prototype,Ro,function r(){var e=_D(this);var t=String(e.source);var n=e.flags;var a=String(n===void 0&&e instanceof RegExp&&!("flags"in cq)?MD.call(e):n);return"/"+t+"/"+a},{unsafe:true})}});var Po=o((g7,pq)=>{var jD=R();var DD=Fe().trim;var dq=Zt();var xa=jD.parseInt;var UD=/^[+-]?0[Xx]/;var ND=xa(dq+"08")!==8||xa(dq+"0x16")!==22;pq.exports=ND?function r(e,t){var n=DD(String(e));return xa(n,t>>>0||(UD.test(n)?16:10))}:xa});var qq=o(()=>{var $D=d();var gq=Po();$D({global:true,forced:parseInt!=gq},{parseInt:gq})});var Fo=o((m7,yq)=>{var BD=R();var GD=Fe().trim;var HD=Zt();var _o=BD.parseFloat;var kD=1/_o(HD+"-0")!==-Infinity;yq.exports=kD?function r(e){var t=GD(String(e));var n=_o(t);return n===0&&t.charAt(0)=="-"?-0:n}:_o});var Sq=o(()=>{var VD=d();var mq=Fo();VD({global:true,forced:parseFloat!=mq},{parseFloat:mq})});var Aq=o(()=>{"use strict";var WD=C();var Iq=R();var KD=Xe();var zD=er();var bq=V();var Tq=mr();var YD=Qt();var XD=wr();var JD=A();var ZD=$r();var QD=le().f;var rU=rr().f;var eU=$().f;var tU=Fe().trim;var tn="Number";var me=Iq[tn];var Pa=me.prototype;var nU=Tq(ZD(Pa))==tn;var Eq=function(r){var e=XD(r,false);var t,n,a,i,u,f,s,c;if(typeof e=="string"&&e.length>2){e=tU(e);t=e.charCodeAt(0);if(t===43||t===45){n=e.charCodeAt(2);if(n===88||n===120)return NaN}else if(t===48){switch(e.charCodeAt(1)){case 66:case 98:a=2;i=49;break;case 79:case 111:a=8;i=55;break;default:return+e}u=e.slice(2);f=u.length;for(s=0;si)return NaN}return parseInt(u,a)}}return+e};if(KD(tn,!me(" 0o1")||!me("0b1")||me("+0x1"))){ye=function r(e){var t=arguments.length<1?0:e;var n=this;return n instanceof ye&&(nU?JD(function(){Pa.valueOf.call(n)}):Tq(n)!=tn)?YD(new me(Eq(t)),n,ye):Eq(t)};for(Mo=WD?QD(me):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),Ra=0;Mo.length>Ra;Ra++){if(bq(me,en=Mo[Ra])&&!bq(ye,en)){eU(ye,en,rU(me,en))}}ye.prototype=Pa;Pa.constructor=ye;zD(Iq,tn,ye)}var ye;var Mo;var Ra;var en});var wq=o(()=>{var aU=d();aU({target:"Number",stat:true},{EPSILON:Math.pow(2,-52)})});var xq=o((w7,Oq)=>{var iU=R();var uU=iU.isFinite;Oq.exports=Number.isFinite||function r(e){return typeof e=="number"&&uU(e)}});var Rq=o(()=>{var oU=d();var sU=xq();oU({target:"Number",stat:true},{isFinite:sU})});var Lo=o((R7,Pq)=>{var fU=F();var vU=Math.floor;Pq.exports=function r(e){return!fU(e)&&isFinite(e)&&vU(e)===e}});var _q=o(()=>{var cU=d();var lU=Lo();cU({target:"Number",stat:true},{isInteger:lU})});var Fq=o(()=>{var hU=d();hU({target:"Number",stat:true},{isNaN:function r(e){return e!=e}})});var Mq=o(()=>{var dU=d();var pU=Lo();var gU=Math.abs;dU({target:"Number",stat:true},{isSafeInteger:function r(e){return pU(e)&&gU(e)<=9007199254740991}})});var Lq=o(()=>{var qU=d();qU({target:"Number",stat:true},{MAX_SAFE_INTEGER:9007199254740991})});var Cq=o(()=>{var yU=d();yU({target:"Number",stat:true},{MIN_SAFE_INTEGER:-9007199254740991})});var Dq=o(()=>{var mU=d();var jq=Fo();mU({target:"Number",stat:true,forced:Number.parseFloat!=jq},{parseFloat:jq})});var Nq=o(()=>{var SU=d();var Uq=Po();SU({target:"Number",stat:true,forced:Number.parseInt!=Uq},{parseInt:Uq})});var Co=o((k7,$q)=>{var bU=mr();$q.exports=function(r){if(typeof r!="number"&&bU(r)!="Number"){throw TypeError("Incorrect invocation")}return+r}});var Hq=o(()=>{"use strict";var EU=d();var IU=br();var TU=Co();var jo=Ta();var AU=A();var Bq=1 .toFixed;var Gq=Math.floor;var ct=function(r,e,t){return e===0?t:e%2===1?ct(r,e-1,t*r):ct(r*r,e/2,t)};var wU=function(r){var e=0;var t=r;while(t>=4096){e+=12;t/=4096}while(t>=2){e+=1;t/=2}return e};var OU=Bq&&(8e-5 .toFixed(3)!=="0.000"||.9 .toFixed(0)!=="1"||1.255 .toFixed(2)!=="1.25"||1000000000000000100 .toFixed(0)!=="1000000000000000128")||!AU(function(){Bq.call({})});EU({target:"Number",proto:true,forced:OU},{toFixed:function r(e){var t=TU(this);var n=IU(e);var a=[0,0,0,0,0,0];var i="";var u="0";var f,s,c,l;var v=function(m,q){var b=-1;var T=q;while(++b<6){T+=m*a[b];a[b]=T%1e7;T=Gq(T/1e7)}};var h=function(m){var q=6;var b=0;while(--q>=0){b+=a[q];a[q]=Gq(b/m);b=b%m*1e7}};var I=function(){var m=6;var q="";while(--m>=0){if(q!==""||m===0||a[m]!==0){var b=String(a[m]);q=q===""?b:q+jo.call("0",7-b.length)+b}}return q};if(n<0||n>20)throw RangeError("Incorrect fraction digits");if(t!=t)return"NaN";if(t<=-1e21||t>=1e21)return String(t);if(t<0){i="-";t=-t}if(t>1e-21){f=wU(t*ct(2,69,1))-69;s=f<0?t*ct(2,-f,1):t/ct(2,f,1);s*=4503599627370496;f=52-f;if(f>0){v(0,s);c=n;while(c>=7){v(1e7,0);c-=7}v(ct(10,c,1),0);c=f-1;while(c>=23){h(1<<23);c-=23}h(1<0){l=u.length;u=i+(l<=n?"0."+jo.call("0",n-l)+u:u.slice(0,l-n)+"."+u.slice(l-n))}else{u=i+u}return u}})});var Wq=o(()=>{"use strict";var xU=d();var kq=A();var Vq=Co();var _a=1 .toPrecision;var RU=kq(function(){return _a.call(1,void 0)!=="1"})||!kq(function(){_a.call({})});xU({target:"Number",proto:true,forced:RU},{toPrecision:function r(e){return e===void 0?_a.call(Vq(this)):_a.call(Vq(this),e)}})});var Do=o((Y7,Kq)=>{var PU=Math.log;Kq.exports=Math.log1p||function r(e){return(e=+e)>-1e-8&&e<1e-8?e-e*e/2:PU(1+e)}});var Yq=o(()=>{var _U=d();var FU=Do();var Uo=Math.acosh;var MU=Math.log;var zq=Math.sqrt;var LU=Math.LN2;var CU=!Uo||Math.floor(Uo(Number.MAX_VALUE))!=710||Uo(Infinity)!=Infinity;_U({target:"Math",stat:true,forced:CU},{acosh:function r(e){return(e=+e)<1?NaN:e>9490626562425156e-8?MU(e)+LU:FU(e-1+zq(e-1)*zq(e+1))}})});var Zq=o(()=>{var jU=d();var Xq=Math.asinh;var DU=Math.log;var UU=Math.sqrt;function Jq(r){return!isFinite(r=+r)||r==0?r:r<0?-Jq(-r):DU(r+UU(r*r+1))}jU({target:"Math",stat:true,forced:!(Xq&&1/Xq(0)>0)},{asinh:Jq})});var ry=o(()=>{var NU=d();var Qq=Math.atanh;var $U=Math.log;NU({target:"Math",stat:true,forced:!(Qq&&1/Qq(-0)<0)},{atanh:function r(e){return(e=+e)==0?e:$U((1+e)/(1-e))/2}})});var Fa=o((tX,ey)=>{ey.exports=Math.sign||function r(e){return(e=+e)==0||e!=e?e:e<0?-1:1}});var ty=o(()=>{var BU=d();var GU=Fa();var HU=Math.abs;var kU=Math.pow;BU({target:"Math",stat:true},{cbrt:function r(e){return GU(e=+e)*kU(HU(e),1/3)}})});var ny=o(()=>{var VU=d();var WU=Math.floor;var KU=Math.log;var zU=Math.LOG2E;VU({target:"Math",stat:true},{clz32:function r(e){return(e>>>=0)?31-WU(KU(e+.5)*zU):32}})});var an=o((oX,ay)=>{var nn=Math.expm1;var YU=Math.exp;ay.exports=!nn||nn(10)>22025.465794806718||nn(10)<22025.465794806718||nn(-2e-17)!=-2e-17?function r(e){return(e=+e)==0?e:e>-1e-6&&e<1e-6?e+e*e/2:YU(e)-1}:nn});var uy=o(()=>{var XU=d();var JU=an();var iy=Math.cosh;var ZU=Math.abs;var No=Math.E;XU({target:"Math",stat:true,forced:!iy||iy(710)===Infinity},{cosh:function r(e){var t=JU(ZU(e)-1)+1;return(t+1/(t*No*No))*(No/2)}})});var sy=o(()=>{var QU=d();var oy=an();QU({target:"Math",stat:true,forced:oy!=Math.expm1},{expm1:oy})});var vy=o((lX,fy)=>{var rN=Fa();var eN=Math.abs;var La=Math.pow;var Bo=La(2,-52);var Ma=La(2,-23);var tN=La(2,127)*(2-Ma);var $o=La(2,-126);var nN=function(r){return r+1/Bo-1/Bo};fy.exports=Math.fround||function r(e){var t=eN(e);var n=rN(e);var a,i;if(t<$o)return n*nN(t/$o/Ma)*$o*Ma;a=(1+Ma/Bo)*t;i=a-(a-t);if(i>tN||i!=i)return n*Infinity;return n*i}});var cy=o(()=>{var aN=d();var iN=vy();aN({target:"Math",stat:true},{fround:iN})});var hy=o(()=>{var uN=d();var ly=Math.hypot;var oN=Math.abs;var sN=Math.sqrt;var fN=!!ly&&ly(Infinity,NaN)!==Infinity;uN({target:"Math",stat:true,forced:fN},{hypot:function r(e,t){var n=0;var a=0;var i=arguments.length;var u=0;var f,s;while(a0){s=f/u;n+=s*s}else n+=f}return u===Infinity?Infinity:u*sN(n)}})});var py=o(()=>{var vN=d();var cN=A();var dy=Math.imul;var lN=cN(function(){return dy(4294967295,5)!=-5||dy.length!=2});vN({target:"Math",stat:true,forced:lN},{imul:function r(e,t){var n=65535;var a=+e;var i=+t;var u=n&a;var f=n&i;return 0|u*f+((n&a>>>16)*f+u*(n&i>>>16)<<16>>>0)}})});var gy=o(()=>{var hN=d();var dN=Math.log;var pN=Math.LOG10E;hN({target:"Math",stat:true},{log10:function r(e){return dN(e)*pN}})});var qy=o(()=>{var gN=d();var qN=Do();gN({target:"Math",stat:true},{log1p:qN})});var yy=o(()=>{var yN=d();var mN=Math.log;var SN=Math.LN2;yN({target:"Math",stat:true},{log2:function r(e){return mN(e)/SN}})});var my=o(()=>{var bN=d();var EN=Fa();bN({target:"Math",stat:true},{sign:EN})});var Ey=o(()=>{var IN=d();var TN=A();var Sy=an();var AN=Math.abs;var by=Math.exp;var wN=Math.E;var ON=TN(function(){return Math.sinh(-2e-17)!=-2e-17});IN({target:"Math",stat:true,forced:ON},{sinh:function r(e){return AN(e=+e)<1?(Sy(e)-Sy(-e))/2:(by(e-1)-by(-e-1))*(wN/2)}})});var Ay=o(()=>{var xN=d();var Iy=an();var Ty=Math.exp;xN({target:"Math",stat:true},{tanh:function r(e){var t=Iy(e=+e);var n=Iy(-e);return t==Infinity?1:n==Infinity?-1:(t-n)/(Ty(e)+Ty(-e))}})});var wy=o(()=>{var RN=d();var PN=Math.ceil;var _N=Math.floor;RN({target:"Math",stat:true},{trunc:function r(e){return(e>0?_N:PN)(e)}})});var Oy=o(()=>{var FN=d();FN({target:"Date",stat:true},{now:function r(){return new Date().getTime()}})});var xy=o(()=>{"use strict";var MN=d();var LN=A();var CN=k();var jN=wr();var DN=LN(function(){return new Date(NaN).toJSON()!==null||Date.prototype.toJSON.call({toISOString:function(){return 1}})!==1});MN({target:"Date",proto:true,forced:DN},{toJSON:function r(e){var t=CN(this);var n=jN(t);return typeof n=="number"&&!isFinite(n)?null:t.toISOString()}})});var Fy=o((DX,_y)=>{"use strict";var Ry=A();var Me=Aa().start;var UN=Math.abs;var Py=Date.prototype;var NN=Py.getTime;var Go=Py.toISOString;_y.exports=Ry(function(){return Go.call(new Date(-5e13-1))!="0385-07-25T07:06:39.999Z"})||!Ry(function(){Go.call(new Date(NaN))})?function r(){if(!isFinite(NN.call(this)))throw RangeError("Invalid time value");var e=this;var t=e.getUTCFullYear();var n=e.getUTCMilliseconds();var a=t<0?"-":t>9999?"+":"";return a+Me(UN(t),a?6:4,0)+"-"+Me(e.getUTCMonth()+1,2,0)+"-"+Me(e.getUTCDate(),2,0)+"T"+Me(e.getUTCHours(),2,0)+":"+Me(e.getUTCMinutes(),2,0)+":"+Me(e.getUTCSeconds(),2,0)+"."+Me(n,3,0)+"Z"}:Go});var Ly=o(()=>{var $N=d();var My=Fy();$N({target:"Date",proto:true,forced:Date.prototype.toISOString!==My},{toISOString:My})});var Dy=o(()=>{var BN=er();var Ho=Date.prototype;var Cy="Invalid Date";var jy="toString";var GN=Ho[jy];var HN=Ho.getTime;if(new Date(NaN)+""!=Cy){BN(Ho,jy,function r(){var e=HN.call(this);return e===e?GN.call(this):Cy})}});var Ny=o((GX,Uy)=>{"use strict";var kN=M();var VN=wr();Uy.exports=function(r){if(r!=="string"&&r!=="number"&&r!=="default"){throw TypeError("Incorrect hint")}return VN(kN(this),r!=="number")}});var Gy=o(()=>{var WN=nr();var KN=Ny();var zN=j();var $y=zN("toPrimitive");var By=Date.prototype;if(!($y in By)){WN(By,$y,KN)}});var Vy=o(()=>{var YN=d();var XN=Sr();var JN=A();var Ca=XN("JSON","stringify");var ZN=/[\uD800-\uDFFF]/g;var Hy=/^[\uD800-\uDBFF]$/;var ky=/^[\uDC00-\uDFFF]$/;var QN=function(r,e,t){var n=t.charAt(e-1);var a=t.charAt(e+1);if(Hy.test(r)&&!ky.test(a)||ky.test(r)&&!Hy.test(n)){return"\\u"+r.charCodeAt(0).toString(16)}return r};var r2=JN(function(){return Ca("\uDF06\uD834")!=='"\\udf06\\ud834"'||Ca("\uDEAD")!=='"\\udead"'});if(Ca){YN({target:"JSON",stat:true,forced:r2},{stringify:function r(e,t,n){var a=Ca.apply(null,arguments);return typeof a=="string"?a.replace(ZN,QN):a}})}});var ko=o((KX,Wy)=>{var e2=R();Wy.exports=e2.Promise});var Le=o((zX,Ky)=>{var t2=er();Ky.exports=function(r,e,t){for(var n in e)t2(r,n,e[n],t);return r}});var ie=o((YX,zy)=>{zy.exports=function(r,e,t){if(!(r instanceof e)){throw TypeError("Incorrect "+(t?t+" ":"")+"invocation")}return r}});var Vo=o((XX,Yy)=>{var n2=Mt();Yy.exports=/(iphone|ipod|ipad).*applewebkit/i.test(n2)});var ja=o((JX,nm)=>{var Wr=R();var a2=A();var i2=mr();var u2=Br();var Xy=$i();var Jy=Nn();var o2=Vo();var Jo=Wr.location;var Zo=Wr.setImmediate;var Qo=Wr.clearImmediate;var Zy=Wr.process;var Qy=Wr.MessageChannel;var Wo=Wr.Dispatch;var Ko=0;var un={};var rm="onreadystatechange";var Ce;var zo;var Yo;var rs=function(r){if(un.hasOwnProperty(r)){var e=un[r];delete un[r];e()}};var Xo=function(r){return function(){rs(r)}};var em=function(r){rs(r.data)};var tm=function(r){Wr.postMessage(r+"",Jo.protocol+"//"+Jo.host)};if(!Zo||!Qo){Zo=function r(e){var t=[];var n=1;while(arguments.length>n)t.push(arguments[n++]);un[++Ko]=function(){(typeof e=="function"?e:Function(e)).apply(void 0,t)};Ce(Ko);return Ko};Qo=function r(e){delete un[e]};if(i2(Zy)=="process"){Ce=function(r){Zy.nextTick(Xo(r))}}else if(Wo&&Wo.now){Ce=function(r){Wo.now(Xo(r))}}else if(Qy&&!o2){zo=new Qy;Yo=zo.port2;zo.port1.onmessage=em;Ce=u2(Yo.postMessage,Yo,1)}else if(Wr.addEventListener&&typeof postMessage=="function"&&!Wr.importScripts&&!a2(tm)&&Jo.protocol!=="file:"){Ce=tm;Wr.addEventListener("message",em,false)}else if(rm in Jy("script")){Ce=function(r){Xy.appendChild(Jy("script"))[rm]=function(){Xy.removeChild(this);rs(r)}}}else{Ce=function(r){setTimeout(Xo(r),0)}}}nm.exports={set:Zo,clear:Qo}});var us=o((ZX,fm)=>{var ht=R();var s2=rr().f;var f2=mr();var v2=ja().set;var c2=Vo();var am=ht.MutationObserver||ht.WebKitMutationObserver;var is=ht.process;var es=ht.Promise;var im=f2(is)=="process";var um=s2(ht,"queueMicrotask");var sm=um&&um.value;var on;var je;var sn;var lt;var ts;var ns;var as;var om;if(!sm){on=function(){var r,e;if(im&&(r=is.domain))r.exit();while(je){e=je.fn;je=je.next;try{e()}catch(t){if(je)lt();else sn=void 0;throw t}}sn=void 0;if(r)r.enter()};if(im){lt=function(){is.nextTick(on)}}else if(am&&!c2){ts=true;ns=document.createTextNode("");new am(on).observe(ns,{characterData:true});lt=function(){ns.data=ts=!ts}}else if(es&&es.resolve){as=es.resolve(void 0);om=as.then;lt=function(){om.call(as,on)}}else{lt=function(){v2.call(ht,on)}}}fm.exports=sm||function(r){var e={fn:r,next:void 0};if(sn)sn.next=e;if(!je){je=e;lt()}sn=e}});var Da=o((QX,cm)=>{"use strict";var vm=ur();var l2=function(r){var e,t;this.promise=new r(function(n,a){if(e!==void 0||t!==void 0)throw TypeError("Bad Promise constructor");e=n;t=a});this.resolve=vm(e);this.reject=vm(t)};cm.exports.f=function(r){return new l2(r)}});var os=o((r9,lm)=>{var h2=M();var d2=F();var p2=Da();lm.exports=function(r,e){h2(r);if(d2(e)&&e.constructor===r)return e;var t=p2.f(r);var n=t.resolve;n(e);return t.promise}});var dm=o((e9,hm)=>{var g2=R();hm.exports=function(r,e){var t=g2.console;if(t&&t.error){arguments.length===1?t.error(r):t.error(r,e)}}});var ss=o((t9,pm)=>{pm.exports=function(r){try{return{error:false,value:r()}}catch(e){return{error:true,value:e}}}});var Cm=o(()=>{"use strict";var vn=d();var $a=Or();var ue=R();var Tm=Sr();var Na=ko();var q2=er();var y2=Le();var m2=Fr();var S2=_e();var b2=F();var fs=ur();var E2=ie();var I2=mr();var T2=Bn();var gm=Pe();var A2=$t();var w2=Hr();var Am=ja().set;var wm=us();var Om=os();var O2=dm();var xm=Da();var vs=ss();var hs=ar();var x2=Xe();var R2=j();var qm=Jn();var P2=R2("species");var Kr="Promise";var ym=hs.get;var _2=hs.set;var F2=hs.getterFor(Kr);var ir=Na;var Rm=ue.TypeError;var cs=ue.document;var Ba=ue.process;var mm=Tm("fetch");var gt=xm.f;var M2=gt;var fn=I2(Ba)=="process";var L2=!!(cs&&cs.createEvent&&ue.dispatchEvent);var Pm="unhandledrejection";var C2="rejectionhandled";var Sm=0;var _m=1;var j2=2;var ds=1;var Fm=2;var Ua;var bm;var ps;var Em;var cn=x2(Kr,function(){var r=T2(ir)!==String(ir);if(!r){if(qm===66)return true;if(!fn&&typeof PromiseRejectionEvent!="function")return true}if($a&&!ir.prototype["finally"])return true;if(qm>=51&&/native code/.test(ir))return false;var e=ir.resolve(1);var t=function(a){a(function(){},function(){})};var n=e.constructor={};n[P2]=t;return!(e.then(function(){})instanceof t)});var D2=cn||!A2(function(r){ir.all(r)["catch"](function(){})});var Mm=function(r){var e;return b2(r)&&typeof(e=r.then)=="function"?e:false};var gs=function(r,e,t){if(e.notified)return;e.notified=true;var n=e.reactions;wm(function(){var a=e.value;var i=e.state==_m;var u=0;while(n.length>u){var f=n[u++];var s=i?f.ok:f.fail;var c=f.resolve;var l=f.reject;var v=f.domain;var h,I,m;try{if(s){if(!i){if(e.rejection===Fm)N2(r,e);e.rejection=ds}if(s===true)h=a;else{if(v)v.enter();h=s(a);if(v){v.exit();m=true}}if(h===f.promise){l(Rm("Promise-chain cycle"))}else if(I=Mm(h)){I.call(h,c,l)}else c(h)}else l(a)}catch(q){if(v&&!m)v.exit();l(q)}}e.reactions=[];e.notified=false;if(t&&!e.rejection)U2(r,e)})};var Lm=function(r,e,t){var n,a;if(L2){n=cs.createEvent("Event");n.promise=e;n.reason=t;n.initEvent(r,false,true);ue.dispatchEvent(n)}else n={promise:e,reason:t};if(a=ue["on"+r])a(n);else if(r===Pm)O2("Unhandled promise rejection",t)};var U2=function(r,e){Am.call(ue,function(){var t=e.value;var n=Im(e);var a;if(n){a=vs(function(){if(fn){Ba.emit("unhandledRejection",t,r)}else Lm(Pm,r,t)});e.rejection=fn||Im(e)?Fm:ds;if(a.error)throw a.value}})};var Im=function(r){return r.rejection!==ds&&!r.parent};var N2=function(r,e){Am.call(ue,function(){if(fn){Ba.emit("rejectionHandled",r)}else Lm(C2,r,e.value)})};var dt=function(r,e,t,n){return function(a){r(e,t,a,n)}};var pt=function(r,e,t,n){if(e.done)return;e.done=true;if(n)e=n;e.value=t;e.state=j2;gs(r,e,true)};var ls=function(r,e,t,n){if(e.done)return;e.done=true;if(n)e=n;try{if(r===t)throw Rm("Promise can't be resolved itself");var a=Mm(t);if(a){wm(function(){var i={done:false};try{a.call(t,dt(ls,r,i,e),dt(pt,r,i,e))}catch(u){pt(r,i,u,e)}})}else{e.value=t;e.state=_m;gs(r,e,false)}}catch(i){pt(r,{done:false},i,e)}};if(cn){ir=function r(e){E2(this,ir,Kr);fs(e);Ua.call(this);var t=ym(this);try{e(dt(ls,this,t),dt(pt,this,t))}catch(n){pt(this,t,n)}};Ua=function r(e){_2(this,{type:Kr,done:false,notified:false,parent:false,reactions:[],rejection:false,state:Sm,value:void 0})};Ua.prototype=y2(ir.prototype,{then:function r(e,t){var n=F2(this);var a=gt(w2(this,ir));a.ok=typeof e=="function"?e:true;a.fail=typeof t=="function"&&t;a.domain=fn?Ba.domain:void 0;n.parent=true;n.reactions.push(a);if(n.state!=Sm)gs(this,n,false);return a.promise},"catch":function(r){return this.then(void 0,r)}});bm=function(){var r=new Ua;var e=ym(r);this.promise=r;this.resolve=dt(ls,r,e);this.reject=dt(pt,r,e)};xm.f=gt=function(r){return r===ir||r===ps?new bm(r):M2(r)};if(!$a&&typeof Na=="function"){Em=Na.prototype.then;q2(Na.prototype,"then",function r(e,t){var n=this;return new ir(function(a,i){Em.call(n,a,i)}).then(e,t)},{unsafe:true});if(typeof mm=="function")vn({global:true,enumerable:true,forced:true},{fetch:function r(e){return Om(ir,mm.apply(ue,arguments))}})}}vn({global:true,wrap:true,forced:cn},{Promise:ir});m2(ir,Kr,false,true);S2(Kr);ps=Tm(Kr);vn({target:Kr,stat:true,forced:cn},{reject:function r(e){var t=gt(this);t.reject.call(void 0,e);return t.promise}});vn({target:Kr,stat:true,forced:$a||cn},{resolve:function r(e){return Om($a&&this===ps?ir:this,e)}});vn({target:Kr,stat:true,forced:D2},{all:function r(e){var t=this;var n=gt(t);var a=n.resolve;var i=n.reject;var u=vs(function(){var f=fs(t.resolve);var s=[];var c=0;var l=1;gm(e,function(v){var h=c++;var I=false;s.push(void 0);l++;f.call(t,v).then(function(m){if(I)return;I=true;s[h]=m;--l||a(s)},i)});--l||a(s)});if(u.error)i(u.value);return n.promise},race:function r(e){var t=this;var n=gt(t);var a=n.reject;var i=vs(function(){var u=fs(t.resolve);gm(e,function(f){u.call(t,f).then(n.resolve,a)})});if(i.error)a(i.value);return n.promise}})});var jm=o(()=>{"use strict";var $2=d();var B2=ur();var G2=Da();var H2=ss();var k2=Pe();$2({target:"Promise",stat:true},{allSettled:function r(e){var t=this;var n=G2.f(t);var a=n.resolve;var i=n.reject;var u=H2(function(){var f=B2(t.resolve);var s=[];var c=0;var l=1;k2(e,function(v){var h=c++;var I=false;s.push(void 0);l++;f.call(t,v).then(function(m){if(I)return;I=true;s[h]={status:"fulfilled",value:m};--l||a(s)},function(m){if(I)return;I=true;s[h]={status:"rejected",reason:m};--l||a(s)})});--l||a(s)});if(u.error)i(u.value);return n.promise}})});var Nm=o(()=>{"use strict";var V2=d();var W2=Or();var ln=ko();var K2=A();var Um=Sr();var z2=Hr();var Dm=os();var Y2=er();var X2=!!ln&&K2(function(){ln.prototype["finally"].call({then:function(){}},function(){})});V2({target:"Promise",proto:true,real:true,forced:X2},{"finally":function(r){var e=z2(this,Um("Promise"));var t=typeof r=="function";return this.then(t?function(n){return Dm(e,r()).then(function(){return n})}:r,t?function(n){return Dm(e,r()).then(function(){throw n})}:r)}});if(!W2&&typeof ln=="function"&&!ln.prototype["finally"]){Y2(ln.prototype,"finally",Um("Promise").prototype["finally"])}});var hn=o((f9,Bm)=>{"use strict";var J2=d();var Z2=R();var $m=Xe();var Q2=er();var r$=qe();var e$=Pe();var t$=ie();var qs=F();var ys=A();var n$=$t();var a$=Fr();var i$=Qt();Bm.exports=function(r,e,t){var n=r.indexOf("Map")!==-1;var a=r.indexOf("Weak")!==-1;var i=n?"set":"add";var u=Z2[r];var f=u&&u.prototype;var s=u;var c={};var l=function(b){var T=f[b];Q2(f,b,b=="add"?function _(O){T.call(this,O===0?0:O);return this}:b=="delete"?function(_){return a&&!qs(_)?false:T.call(this,_===0?0:_)}:b=="get"?function _(O){return a&&!qs(O)?void 0:T.call(this,O===0?0:O)}:b=="has"?function _(O){return a&&!qs(O)?false:T.call(this,O===0?0:O)}:function _(O,K){T.call(this,O===0?0:O,K);return this})};if($m(r,typeof u!="function"||!(a||f.forEach&&!ys(function(){new u().entries().next()})))){s=t.getConstructor(e,r,n,i);r$.REQUIRED=true}else if($m(r,true)){var v=new s;var h=v[i](a?{}:-0,1)!=v;var I=ys(function(){v.has(1)});var m=n$(function(b){new u(b)});var q=!a&&ys(function(){var b=new u;var T=5;while(T--)b[i](T,T);return!b.has(-0)});if(!m){s=e(function(b,T){t$(b,s,r);var _=i$(new u,b,s);if(T!=void 0)e$(T,_[i],_,n);return _});s.prototype=f;f.constructor=s}if(I||q){l("delete");l("has");n&&l("get")}if(q||h)l(i);if(a&&f.clear)delete f.clear}c[r]=s;J2({global:true,forced:s!=u},c);a$(s,r);if(!a)t.setStrong(s,r,n);return s}});var Ss=o((v9,Wm)=>{"use strict";var u$=$().f;var o$=$r();var Gm=Le();var s$=Br();var f$=ie();var v$=Pe();var c$=ca();var l$=_e();var dn=C();var Hm=qe().fastKey;var Vm=ar();var km=Vm.set;var ms=Vm.getterFor;Wm.exports={getConstructor:function(r,e,t,n){var a=r(function(s,c){f$(s,a,e);km(s,{type:e,index:o$(null),first:void 0,last:void 0,size:0});if(!dn)s.size=0;if(c!=void 0)v$(c,s[n],s,t)});var i=ms(e);var u=function(s,c,l){var v=i(s);var h=f(s,c);var I,m;if(h){h.value=l}else{v.last=h={index:m=Hm(c,true),key:c,value:l,previous:I=v.last,next:void 0,removed:false};if(!v.first)v.first=h;if(I)I.next=h;if(dn)v.size++;else s.size++;if(m!=="F")v.index[m]=h}return s};var f=function(s,c){var l=i(s);var v=Hm(c);var h;if(v!=="F")return l.index[v];for(h=l.first;h;h=h.next){if(h.key==c)return h}};Gm(a.prototype,{clear:function s(){var c=this;var l=i(c);var v=l.index;var h=l.first;while(h){h.removed=true;if(h.previous)h.previous=h.previous.next=void 0;delete v[h.index];h=h.next}l.first=l.last=void 0;if(dn)l.size=0;else c.size=0},"delete":function(s){var c=this;var l=i(c);var v=f(c,s);if(v){var h=v.next;var I=v.previous;delete l.index[v.index];v.removed=true;if(I)I.next=h;if(h)h.previous=I;if(l.first==v)l.first=h;if(l.last==v)l.last=I;if(dn)l.size--;else c.size--}return!!v},forEach:function s(c){var l=i(this);var v=s$(c,arguments.length>1?arguments[1]:void 0,3);var h;while(h=h?h.next:l.first){v(h.value,h.key,this);while(h&&h.removed)h=h.previous}},has:function s(c){return!!f(this,c)}});Gm(a.prototype,t?{get:function s(c){var l=f(this,c);return l&&l.value},set:function s(c,l){return u(this,c===0?0:c,l)}}:{add:function s(c){return u(this,c=c===0?0:c,c)}});if(dn)u$(a.prototype,"size",{get:function(){return i(this).size}});return a},setStrong:function(r,e,t){var n=e+" Iterator";var a=ms(e);var i=ms(n);c$(r,e,function(u,f){km(this,{type:n,target:u,state:a(u),kind:f,last:void 0})},function(){var u=i(this);var f=u.kind;var s=u.last;while(s&&s.removed)s=s.previous;if(!u.target||!(u.last=s=s?s.next:u.state.first)){u.target=void 0;return{value:void 0,done:true}}if(f=="keys")return{value:s.key,done:false};if(f=="values")return{value:s.value,done:false};return{value:[s.key,s.value],done:false}},t?"entries":"values",!t,true);l$(e)}}});var zm=o((c9,Km)=>{"use strict";var h$=hn();var d$=Ss();Km.exports=h$("Map",function(r){return function e(){return r(this,arguments.length?arguments[0]:void 0)}},d$)});var Xm=o((l9,Ym)=>{"use strict";var p$=hn();var g$=Ss();Ym.exports=p$("Set",function(r){return function e(){return r(this,arguments.length?arguments[0]:void 0)}},g$)});var Is=o((h9,tS)=>{"use strict";var Jm=Le();var Ga=qe().getWeakData;var q$=M();var bs=F();var y$=ie();var m$=Pe();var Qm=Z();var Zm=V();var rS=ar();var S$=rS.set;var b$=rS.getterFor;var E$=Qm.find;var I$=Qm.findIndex;var T$=0;var Ha=function(r){return r.frozen||(r.frozen=new eS)};var eS=function(){this.entries=[]};var Es=function(r,e){return E$(r.entries,function(t){return t[0]===e})};eS.prototype={get:function(r){var e=Es(this,r);if(e)return e[1]},has:function(r){return!!Es(this,r)},set:function(r,e){var t=Es(this,r);if(t)t[1]=e;else this.entries.push([r,e])},"delete":function(r){var e=I$(this.entries,function(t){return t[0]===r});if(~e)this.entries.splice(e,1);return!!~e}};tS.exports={getConstructor:function(r,e,t,n){var a=r(function(f,s){y$(f,a,e);S$(f,{type:e,id:T$++,frozen:void 0});if(s!=void 0)m$(s,f[n],f,t)});var i=b$(e);var u=function(f,s,c){var l=i(f);var v=Ga(q$(s),true);if(v===true)Ha(l).set(s,c);else v[l.id]=c;return f};Jm(a.prototype,{"delete":function(f){var s=i(this);if(!bs(f))return false;var c=Ga(f);if(c===true)return Ha(s)["delete"](f);return c&&Zm(c,s.id)&&delete c[s.id]},has:function f(s){var c=i(this);if(!bs(s))return false;var l=Ga(s);if(l===true)return Ha(c).has(s);return l&&Zm(l,c.id)}});Jm(a.prototype,t?{get:function f(s){var c=i(this);if(bs(s)){var l=Ga(s);if(l===true)return Ha(c).get(s);return l?l[c.id]:void 0}},set:function f(s,c){return u(this,s,c)}}:{add:function f(s){return u(this,s,true)}});return a}}});var oS=o((d9,uS)=>{"use strict";var nS=R();var A$=Le();var w$=qe();var O$=hn();var aS=Is();var ka=F();var Va=ar().enforce;var x$=Ri();var R$=!nS.ActiveXObject&&"ActiveXObject"in nS;var Wa=Object.isExtensible;var pn;var iS=function(r){return function e(){return r(this,arguments.length?arguments[0]:void 0)}};var P$=uS.exports=O$("WeakMap",iS,aS);if(x$&&R$){pn=aS.getConstructor(iS,"WeakMap",true);w$.REQUIRED=true;qt=P$.prototype;Ts=qt["delete"];gn=qt.has;As=qt.get;ws=qt.set;A$(qt,{"delete":function(r){if(ka(r)&&!Wa(r)){var e=Va(this);if(!e.frozen)e.frozen=new pn;return Ts.call(this,r)||e.frozen["delete"](r)}return Ts.call(this,r)},has:function r(e){if(ka(e)&&!Wa(e)){var t=Va(this);if(!t.frozen)t.frozen=new pn;return gn.call(this,e)||t.frozen.has(e)}return gn.call(this,e)},get:function r(e){if(ka(e)&&!Wa(e)){var t=Va(this);if(!t.frozen)t.frozen=new pn;return gn.call(this,e)?As.call(this,e):t.frozen.get(e)}return As.call(this,e)},set:function r(e,t){if(ka(e)&&!Wa(e)){var n=Va(this);if(!n.frozen)n.frozen=new pn;gn.call(this,e)?ws.call(this,e,t):n.frozen.set(e,t)}else ws.call(this,e,t);return this}})}var qt;var Ts;var gn;var As;var ws});var sS=o(()=>{"use strict";var _$=hn();var F$=Is();_$("WeakSet",function(r){return function e(){return r(this,arguments.length?arguments[0]:void 0)}},F$)});var Ka=o((q9,fS)=>{fS.exports=typeof ArrayBuffer!=="undefined"&&typeof DataView!=="undefined"});var Os=o((y9,vS)=>{var M$=br();var L$=D();vS.exports=function(r){if(r===void 0)return 0;var e=M$(r);var t=L$(e);if(e!==t)throw RangeError("Wrong length or index");return t}});var lS=o((m9,cS)=>{var xs=1/0;var C$=Math.abs;var oe=Math.pow;var j$=Math.floor;var D$=Math.log;var U$=Math.LN2;var N$=function(r,e,t){var n=new Array(t);var a=t*8-e-1;var i=(1<>1;var f=e===23?oe(2,-24)-oe(2,-77):0;var s=r<0||r===0&&1/r<0?1:0;var c=0;var l,v,h;r=C$(r);if(r!=r||r===xs){v=r!=r?1:0;l=i}else{l=j$(D$(r)/U$);if(r*(h=oe(2,-l))<1){l--;h*=2}if(l+u>=1){r+=f/h}else{r+=f*oe(2,1-u)}if(r*h>=2){l++;h/=2}if(l+u>=i){v=0;l=i}else if(l+u>=1){v=(r*h-1)*oe(2,e);l=l+u}else{v=r*oe(2,u-1)*oe(2,e);l=0}}for(;e>=8;n[c++]=v&255,v/=256,e-=8);l=l<0;n[c++]=l&255,l/=256,a-=8);n[--c]|=s*128;return n};var $$=function(r,e){var t=r.length;var n=t*8-e-1;var a=(1<>1;var u=n-7;var f=t-1;var s=r[f--];var c=s&127;var l;s>>=7;for(;u>0;c=c*256+r[f],f--,u-=8);l=c&(1<<-u)-1;c>>=-u;u+=e;for(;u>0;l=l*256+r[f],f--,u-=8);if(c===0){c=1-i}else if(c===a){return l?NaN:s?-xs:xs}else{l=l+oe(2,e);c=c-i}return(s?-1:1)*l*oe(2,c-e)};cS.exports={pack:N$,unpack:$$}});var mn=o((S9,xS)=>{"use strict";var Ls=R();var Rs=C();var B$=Ka();var G$=nr();var hS=Le();var Ps=A();var za=ie();var H$=br();var k$=D();var Za=Os();var IS=lS();var V$=Rr();var dS=ge();var W$=le().f;var K$=$().f;var z$=pa();var TS=Fr();var AS=ar();var yt=AS.get;var pS=AS.set;var Qa="ArrayBuffer";var ri="DataView";var yn="prototype";var Y$="Wrong length";var wS="Wrong index";var Mr=Ls[Qa];var Er=Mr;var Lr=Ls[ri];var Ya=Lr&&Lr[yn];var gS=Object.prototype;var ei=Ls.RangeError;var OS=IS.pack;var qS=IS.unpack;var yS=function(r){return[r&255]};var mS=function(r){return[r&255,r>>8&255]};var SS=function(r){return[r&255,r>>8&255,r>>16&255,r>>24&255]};var bS=function(r){return r[3]<<24|r[2]<<16|r[1]<<8|r[0]};var X$=function(r){return OS(r,23,4)};var J$=function(r){return OS(r,52,8)};var Xa=function(r,e){K$(r[yn],e,{get:function(){return yt(this)[e]}})};var Se=function(r,e,t,n){var a=Za(t);var i=yt(r);if(a+e>i.byteLength)throw ei(wS);var u=yt(i.buffer).bytes;var f=a+i.byteOffset;var s=u.slice(f,f+e);return n?s:s.reverse()};var be=function(r,e,t,n,a,i){var u=Za(t);var f=yt(r);if(u+e>f.byteLength)throw ei(wS);var s=yt(f.buffer).bytes;var c=u+f.byteOffset;var l=n(+a);for(var v=0;va)throw ei("Wrong offset");n=n===void 0?a-i:k$(n);if(i+n>a)throw ei(Y$);pS(this,{buffer:e,byteLength:n,byteOffset:i});if(!Rs){this.buffer=e;this.byteLength=n;this.byteOffset=i}};if(Rs){Xa(Er,"byteLength");Xa(Lr,"buffer");Xa(Lr,"byteLength");Xa(Lr,"byteOffset")}hS(Lr[yn],{getInt8:function r(e){return Se(this,1,e)[0]<<24>>24},getUint8:function r(e){return Se(this,1,e)[0]},getInt16:function r(e){var t=Se(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function r(e){var t=Se(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function r(e){return bS(Se(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function r(e){return bS(Se(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function r(e){return qS(Se(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function r(e){return qS(Se(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function r(e,t){be(this,1,e,yS,t)},setUint8:function r(e,t){be(this,1,e,yS,t)},setInt16:function r(e,t){be(this,2,e,mS,t,arguments.length>2?arguments[2]:void 0)},setUint16:function r(e,t){be(this,2,e,mS,t,arguments.length>2?arguments[2]:void 0)},setInt32:function r(e,t){be(this,4,e,SS,t,arguments.length>2?arguments[2]:void 0)},setUint32:function r(e,t){be(this,4,e,SS,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function r(e,t){be(this,4,e,X$,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function r(e,t){be(this,8,e,J$,t,arguments.length>2?arguments[2]:void 0)}})}else{if(!Ps(function(){Mr(1)})||!Ps(function(){new Mr(-1)})||Ps(function(){new Mr;new Mr(1.5);new Mr(NaN);return Mr.name!=Qa})){Er=function r(e){za(this,Er);return new Mr(Za(e))};ES=Er[yn]=Mr[yn];for(_s=W$(Mr),Fs=0;_s.length>Fs;){if(!((Ja=_s[Fs++])in Er)){G$(Er,Ja,Mr[Ja])}}ES.constructor=Er}if(dS&&V$(Ya)!==gS){dS(Ya,gS)}qn=new Lr(new Er(2));Ms=Ya.setInt8;qn.setInt8(0,2147483648);qn.setInt8(1,2147483649);if(qn.getInt8(0)||!qn.getInt8(1))hS(Ya,{setInt8:function r(e,t){Ms.call(this,e,t<<24>>24)},setUint8:function r(e,t){Ms.call(this,e,t<<24>>24)}},{unsafe:true})}var ES;var _s;var Fs;var Ja;var qn;var Ms;TS(Er,Qa);TS(Lr,ri);xS.exports={ArrayBuffer:Er,DataView:Lr}});var PS=o(()=>{"use strict";var Z$=d();var Q$=R();var rB=mn();var eB=_e();var Cs="ArrayBuffer";var RS=rB[Cs];var tB=Q$[Cs];Z$({global:true,forced:tB!==RS},{ArrayBuffer:RS});eB(Cs)});var U=o((I9,NS)=>{"use strict";var nB=Ka();var Ns=C();var qr=R();var CS=F();var mt=V();var $s=Qe();var aB=nr();var js=er();var iB=$().f;var Bs=Rr();var St=ge();var uB=j();var oB=We();var Sn=qr.Int8Array;var Ds=Sn&&Sn.prototype;var _S=qr.Uint8ClampedArray;var FS=_S&&_S.prototype;var se=Sn&&Bs(Sn);var Cr=Ds&&Bs(Ds);var jS=Object.prototype;var MS=jS.isPrototypeOf;var LS=uB("toStringTag");var Us=oB("TYPED_ARRAY_TAG");var fe=nB&&!!St&&$s(qr.opera)!=="Opera";var DS=false;var Ir;var jr={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8};var sB=function r(e){var t=$s(e);return t==="DataView"||mt(jr,t)};var US=function(r){return CS(r)&&mt(jr,$s(r))};var fB=function(r){if(US(r))return r;throw TypeError("Target is not a typed array")};var vB=function(r){if(St){if(MS.call(se,r))return r}else for(var e in jr)if(mt(jr,Ir)){var t=qr[e];if(t&&(r===t||MS.call(t,r))){return r}}throw TypeError("Target is not a typed array constructor")};var cB=function(r,e,t){if(!Ns)return;if(t)for(var n in jr){var a=qr[n];if(a&&mt(a.prototype,r)){delete a.prototype[r]}}if(!Cr[r]||t){js(Cr,r,t?e:fe&&Ds[r]||e)}};var lB=function(r,e,t){var n,a;if(!Ns)return;if(St){if(t)for(n in jr){a=qr[n];if(a&&mt(a,r)){delete a[r]}}if(!se[r]||t){try{return js(se,r,t?e:fe&&Sn[r]||e)}catch(i){}}else return}for(n in jr){a=qr[n];if(a&&(!a[r]||t)){js(a,r,e)}}};for(Ir in jr){if(!qr[Ir])fe=false}if(!fe||typeof se!="function"||se===Function.prototype){se=function r(){throw TypeError("Incorrect invocation")};if(fe)for(Ir in jr){if(qr[Ir])St(qr[Ir],se)}}if(!fe||!Cr||Cr===jS){Cr=se.prototype;if(fe)for(Ir in jr){if(qr[Ir])St(qr[Ir].prototype,Cr)}}if(fe&&Bs(FS)!==Cr){St(FS,Cr)}if(Ns&&!mt(Cr,LS)){DS=true;iB(Cr,LS,{get:function(){return CS(this)?this[Us]:void 0}});for(Ir in jr)if(qr[Ir]){aB(qr[Ir],Us,Ir)}}NS.exports={NATIVE_ARRAY_BUFFER_VIEWS:fe,TYPED_ARRAY_TAG:DS&&Us,aTypedArray:fB,aTypedArrayConstructor:vB,exportTypedArrayMethod:cB,exportTypedArrayStaticMethod:lB,isView:sB,isTypedArray:US,TypedArray:se,TypedArrayPrototype:Cr}});var BS=o(()=>{var hB=d();var $S=U();var dB=$S.NATIVE_ARRAY_BUFFER_VIEWS;hB({target:"ArrayBuffer",stat:true,forced:!dB},{isView:$S.isView})});var KS=o(()=>{"use strict";var pB=d();var gB=A();var WS=mn();var GS=M();var HS=Qr();var qB=D();var yB=Hr();var Gs=WS.ArrayBuffer;var kS=WS.DataView;var VS=Gs.prototype.slice;var mB=gB(function(){return!new Gs(2).slice(1,void 0).byteLength});pB({target:"ArrayBuffer",proto:true,unsafe:true,forced:mB},{slice:function r(e,t){if(VS!==void 0&&t===void 0){return VS.call(GS(this),e)}var n=GS(this).byteLength;var a=HS(e,n);var i=HS(t===void 0?n:t,n);var u=new(yB(this,Gs))(qB(i-a));var f=new kS(this);var s=new kS(u);var c=0;while(a{var SB=d();var bB=mn();var EB=Ka();SB({global:true,forced:!EB},{DataView:bB.DataView})});var ti=o((P9,XS)=>{var YS=R();var Hs=A();var IB=$t();var TB=U().NATIVE_ARRAY_BUFFER_VIEWS;var AB=YS.ArrayBuffer;var De=YS.Int8Array;XS.exports=!TB||!Hs(function(){De(1)})||!Hs(function(){new De(-1)})||!IB(function(r){new De;new De(null);new De(1.5);new De(r)},true)||Hs(function(){return new De(new AB(2),1,void 0).length!==1})});var ZS=o((_9,JS)=>{var wB=br();JS.exports=function(r){var e=wB(r);if(e<0)throw RangeError("The argument can't be less than 0");return e}});var ks=o((F9,QS)=>{var OB=ZS();QS.exports=function(r,e){var t=OB(r);if(t%e)throw RangeError("Wrong offset");return t}});var Vs=o((M9,rb)=>{var xB=k();var RB=D();var PB=ut();var _B=ha();var FB=Br();var MB=U().aTypedArrayConstructor;rb.exports=function r(e){var t=xB(e);var n=arguments.length;var a=n>1?arguments[1]:void 0;var i=a!==void 0;var u=PB(t);var f,s,c,l,v,h;if(u!=void 0&&!_B(u)){v=u.call(t);h=v.next;t=[];while(!(l=h.call(v)).done){t.push(l.value)}}if(i&&n>2){a=FB(a,arguments[2],2)}s=RB(t.length);c=new(MB(this))(s);for(f=0;s>f;f++){c[f]=i?a(t[f],f):t[f]}return c}});var zr=o((L9,Zs)=>{"use strict";var eb=d();var cb=R();var LB=C();var CB=ti();var bt=U();var lb=mn();var tb=ie();var jB=Zr();var bn=nr();var DB=D();var nb=Os();var Ws=ks();var hb=wr();var En=V();var UB=Qe();var Ys=F();var NB=$r();var ni=ge();var $B=le().f;var ab=Vs();var BB=Z().forEach;var GB=_e();var db=$();var pb=rr();var gb=ar();var HB=Qt();var Xs=gb.get;var kB=gb.set;var Qs=db.f;var VB=pb.f;var WB=Math.round;var Ks=cb.RangeError;var qb=lb.ArrayBuffer;var KB=lb.DataView;var ai=bt.NATIVE_ARRAY_BUFFER_VIEWS;var ib=bt.TYPED_ARRAY_TAG;var ub=bt.TypedArray;var In=bt.TypedArrayPrototype;var zB=bt.aTypedArrayConstructor;var Js=bt.isTypedArray;var ii="BYTES_PER_ELEMENT";var zs="Wrong length";var ob=function(r,e){var t=0;var n=e.length;var a=new(zB(r))(n);while(n>t)a[t]=e[t++];return a};var ui=function(r,e){Qs(r,e,{get:function(){return Xs(this)[e]}})};var sb=function(r){var e;return r instanceof qb||(e=UB(r))=="ArrayBuffer"||e=="SharedArrayBuffer"};var yb=function(r,e){return Js(r)&&typeof e!="symbol"&&e in r&&String(+e)==String(e)};var fb=function r(e,t){return yb(e,t=hb(t,true))?jB(2,e[t]):VB(e,t)};var vb=function r(e,t,n){if(yb(e,t=hb(t,true))&&Ys(n)&&En(n,"value")&&!En(n,"get")&&!En(n,"set")&&!n.configurable&&(!En(n,"writable")||n.writable)&&(!En(n,"enumerable")||n.enumerable)){e[t]=n.value;return e}return Qs(e,t,n)};if(LB){if(!ai){pb.f=fb;db.f=vb;ui(In,"buffer");ui(In,"byteOffset");ui(In,"byteLength");ui(In,"length")}eb({target:"Object",stat:true,forced:!ai},{getOwnPropertyDescriptor:fb,defineProperty:vb});Zs.exports=function(r,e,t){var n=r.match(/\d+$/)[0]/8;var a=r+(t?"Clamped":"")+"Array";var i="get"+r;var u="set"+r;var f=cb[a];var s=f;var c=s&&s.prototype;var l={};var v=function(m,q){var b=Xs(m);return b.view[i](q*n+b.byteOffset,true)};var h=function(m,q,b){var T=Xs(m);if(t)b=(b=WB(b))<0?0:b>255?255:b&255;T.view[u](q*n+T.byteOffset,b,true)};var I=function(m,q){Qs(m,q,{get:function(){return v(this,q)},set:function(b){return h(this,q,b)},enumerable:true})};if(!ai){s=e(function(m,q,b,T){tb(m,s,a);var _=0;var O=0;var K,H,N;if(!Ys(q)){N=nb(q);H=N*n;K=new qb(H)}else if(sb(q)){K=q;O=Ws(b,n);var sr=q.byteLength;if(T===void 0){if(sr%n)throw Ks(zs);H=sr-O;if(H<0)throw Ks(zs)}else{H=DB(T)*n;if(H+O>sr)throw Ks(zs)}N=H/n}else if(Js(q)){return ob(s,q)}else{return ab.call(s,q)}kB(m,{buffer:K,byteOffset:O,byteLength:H,length:N,view:new KB(K)});while(_{var YB=zr();YB("Int8",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Sb=o(()=>{var XB=zr();XB("Uint8",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var bb=o(()=>{var JB=zr();JB("Uint8",function(r){return function e(t,n,a){return r(this,t,n,a)}},true)});var Eb=o(()=>{var ZB=zr();ZB("Int16",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Ib=o(()=>{var QB=zr();QB("Uint16",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Tb=o(()=>{var rG=zr();rG("Int32",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Ab=o(()=>{var eG=zr();eG("Uint32",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var wb=o(()=>{var tG=zr();tG("Float32",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Ob=o(()=>{var nG=zr();nG("Float64",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var xb=o(()=>{"use strict";var aG=ti();var iG=U().exportTypedArrayStaticMethod;var uG=Vs();iG("from",uG,aG)});var Pb=o(()=>{"use strict";var Rb=U();var oG=ti();var sG=Rb.aTypedArrayConstructor;var fG=Rb.exportTypedArrayStaticMethod;fG("of",function r(){var e=0;var t=arguments.length;var n=new(sG(this))(t);while(t>e)n[e]=arguments[e++];return n},oG)});var Fb=o(()=>{"use strict";var _b=U();var vG=Qu();var cG=_b.aTypedArray;var lG=_b.exportTypedArrayMethod;lG("copyWithin",function r(e,t){return vG.call(cG(this),e,t,arguments.length>2?arguments[2]:void 0)})});var Lb=o(()=>{"use strict";var Mb=U();var hG=Z().every;var dG=Mb.aTypedArray;var pG=Mb.exportTypedArrayMethod;pG("every",function r(e){return hG(dG(this),e,arguments.length>1?arguments[1]:void 0)})});var jb=o(()=>{"use strict";var Cb=U();var gG=pa();var qG=Cb.aTypedArray;var yG=Cb.exportTypedArrayMethod;yG("fill",function r(e){return gG.apply(qG(this),arguments)})});var Db=o(()=>{"use strict";var rf=U();var mG=Z().filter;var SG=Hr();var bG=rf.aTypedArray;var EG=rf.aTypedArrayConstructor;var IG=rf.exportTypedArrayMethod;IG("filter",function r(e){var t=mG(bG(this),e,arguments.length>1?arguments[1]:void 0);var n=SG(this,this.constructor);var a=0;var i=t.length;var u=new(EG(n))(i);while(i>a)u[a]=t[a++];return u})});var Nb=o(()=>{"use strict";var Ub=U();var TG=Z().find;var AG=Ub.aTypedArray;var wG=Ub.exportTypedArrayMethod;wG("find",function r(e){return TG(AG(this),e,arguments.length>1?arguments[1]:void 0)})});var Bb=o(()=>{"use strict";var $b=U();var OG=Z().findIndex;var xG=$b.aTypedArray;var RG=$b.exportTypedArrayMethod;RG("findIndex",function r(e){return OG(xG(this),e,arguments.length>1?arguments[1]:void 0)})});var Hb=o(()=>{"use strict";var Gb=U();var PG=Z().forEach;var _G=Gb.aTypedArray;var FG=Gb.exportTypedArrayMethod;FG("forEach",function r(e){PG(_G(this),e,arguments.length>1?arguments[1]:void 0)})});var Vb=o(()=>{"use strict";var kb=U();var MG=Ye().includes;var LG=kb.aTypedArray;var CG=kb.exportTypedArrayMethod;CG("includes",function r(e){return MG(LG(this),e,arguments.length>1?arguments[1]:void 0)})});var Kb=o(()=>{"use strict";var Wb=U();var jG=Ye().indexOf;var DG=Wb.aTypedArray;var UG=Wb.exportTypedArrayMethod;UG("indexOf",function r(e){return jG(DG(this),e,arguments.length>1?arguments[1]:void 0)})});var Qb=o(()=>{"use strict";var NG=R();var Yb=U();var tf=kt();var $G=j();var Xb=$G("iterator");var zb=NG.Uint8Array;var BG=tf.values;var GG=tf.keys;var HG=tf.entries;var nf=Yb.aTypedArray;var oi=Yb.exportTypedArrayMethod;var ef=zb&&zb.prototype[Xb];var Jb=!!ef&&(ef.name=="values"||ef.name==void 0);var Zb=function r(){return BG.call(nf(this))};oi("entries",function r(){return HG.call(nf(this))});oi("keys",function r(){return GG.call(nf(this))});oi("values",Zb,!Jb);oi(Xb,Zb,!Jb)});var eE=o(()=>{"use strict";var rE=U();var kG=rE.aTypedArray;var VG=rE.exportTypedArrayMethod;var WG=[].join;VG("join",function r(e){return WG.apply(kG(this),arguments)})});var nE=o(()=>{"use strict";var tE=U();var KG=oo();var zG=tE.aTypedArray;var YG=tE.exportTypedArrayMethod;YG("lastIndexOf",function r(e){return KG.apply(zG(this),arguments)})});var aE=o(()=>{"use strict";var af=U();var XG=Z().map;var JG=Hr();var ZG=af.aTypedArray;var QG=af.aTypedArrayConstructor;var rH=af.exportTypedArrayMethod;rH("map",function r(e){return XG(ZG(this),e,arguments.length>1?arguments[1]:void 0,function(t,n){return new(QG(JG(t,t.constructor)))(n)})})});var uE=o(()=>{"use strict";var iE=U();var eH=Ht().left;var tH=iE.aTypedArray;var nH=iE.exportTypedArrayMethod;nH("reduce",function r(e){return eH(tH(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)})});var sE=o(()=>{"use strict";var oE=U();var aH=Ht().right;var iH=oE.aTypedArray;var uH=oE.exportTypedArrayMethod;uH("reduceRight",function r(e){return aH(iH(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)})});var vE=o(()=>{"use strict";var fE=U();var oH=fE.aTypedArray;var sH=fE.exportTypedArrayMethod;var fH=Math.floor;sH("reverse",function r(){var e=this;var t=oH(e).length;var n=fH(t/2);var a=0;var i;while(a{"use strict";var cE=U();var vH=D();var cH=ks();var lH=k();var hH=A();var dH=cE.aTypedArray;var pH=cE.exportTypedArrayMethod;var gH=hH(function(){new Int8Array(1).set({})});pH("set",function r(e){dH(this);var t=cH(arguments.length>1?arguments[1]:void 0,1);var n=this.length;var a=lH(e);var i=vH(a.length);var u=0;if(i+t>n)throw RangeError("Wrong length");while(u{"use strict";var uf=U();var qH=Hr();var yH=A();var mH=uf.aTypedArray;var SH=uf.aTypedArrayConstructor;var bH=uf.exportTypedArrayMethod;var EH=[].slice;var IH=yH(function(){new Int8Array(1).slice()});bH("slice",function r(e,t){var n=EH.call(mH(this),e,t);var a=qH(this,this.constructor);var i=0;var u=n.length;var f=new(SH(a))(u);while(u>i)f[i]=n[i++];return f},IH)});var pE=o(()=>{"use strict";var dE=U();var TH=Z().some;var AH=dE.aTypedArray;var wH=dE.exportTypedArrayMethod;wH("some",function r(e){return TH(AH(this),e,arguments.length>1?arguments[1]:void 0)})});var qE=o(()=>{"use strict";var gE=U();var OH=gE.aTypedArray;var xH=gE.exportTypedArrayMethod;var RH=[].sort;xH("sort",function r(e){return RH.call(OH(this),e)})});var SE=o(()=>{"use strict";var mE=U();var PH=D();var yE=Qr();var _H=Hr();var FH=mE.aTypedArray;var MH=mE.exportTypedArrayMethod;MH("subarray",function r(e,t){var n=FH(this);var a=n.length;var i=yE(e,a);return new(_H(n,n.constructor))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,PH((t===void 0?a:yE(t,a))-i))})});var TE=o(()=>{"use strict";var LH=R();var EE=U();var of=A();var si=LH.Int8Array;var bE=EE.aTypedArray;var CH=EE.exportTypedArrayMethod;var IE=[].toLocaleString;var jH=[].slice;var DH=!!si&&of(function(){IE.call(new si(1))});var UH=of(function(){return[1,2].toLocaleString()!=new si([1,2]).toLocaleString()})||!of(function(){si.prototype.toLocaleString.call([1,2])});CH("toLocaleString",function r(){return IE.apply(DH?jH.call(bE(this)):bE(this),arguments)},UH)});var wE=o(()=>{"use strict";var NH=U().exportTypedArrayMethod;var $H=A();var BH=R();var AE=BH.Uint8Array;var GH=AE&&AE.prototype||{};var fi=[].toString;var HH=[].join;if($H(function(){fi.call({})})){fi=function r(){return HH.call(this)}}var kH=GH.toString!=fi;NH("toString",fi,kH)});var OE=o(()=>{var VH=d();var WH=Sr();var KH=ur();var zH=M();var YH=A();var sf=WH("Reflect","apply");var XH=Function.apply;var JH=!YH(function(){sf(function(){})});VH({target:"Reflect",stat:true,forced:JH},{apply:function r(e,t,n){KH(e);zH(n);return sf?sf(e,t,n):XH.call(e,t,n)}})});var LE=o(()=>{var ZH=d();var QH=Sr();var xE=ur();var r8=M();var RE=F();var e8=$r();var t8=Xu();var _E=A();var ff=QH("Reflect","construct");var FE=_E(function(){function r(){}return!(ff(function(){},[],r)instanceof r)});var ME=!_E(function(){ff(function(){})});var PE=FE||ME;ZH({target:"Reflect",stat:true,forced:PE,sham:PE},{construct:function r(e,t){xE(e);r8(t);var n=arguments.length<3?e:xE(arguments[2]);if(ME&&!FE)return ff(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var a=[null];a.push.apply(a,t);return new(t8.apply(e,a))}var i=n.prototype;var u=e8(RE(i)?i:Object.prototype);var f=Function.apply.call(e,u,t);return RE(f)?f:u}})});var DE=o(()=>{var n8=d();var a8=C();var CE=M();var i8=wr();var jE=$();var u8=A();var o8=u8(function(){Reflect.defineProperty(jE.f({},1,{value:1}),1,{value:2})});n8({target:"Reflect",stat:true,forced:o8,sham:!a8},{defineProperty:function r(e,t,n){CE(e);var a=i8(t,true);CE(n);try{jE.f(e,a,n);return true}catch(i){return false}}})});var UE=o(()=>{var s8=d();var f8=M();var v8=rr().f;s8({target:"Reflect",stat:true},{deleteProperty:function r(e,t){var n=v8(f8(e),t);return n&&!n.configurable?false:delete e[t]}})});var $E=o(()=>{var c8=d();var l8=F();var h8=M();var d8=V();var p8=rr();var g8=Rr();function NE(r,e){var t=arguments.length<3?r:arguments[2];var n,a;if(h8(r)===t)return r[e];if(n=p8.f(r,e))return d8(n,"value")?n.value:n.get===void 0?void 0:n.get.call(t);if(l8(a=g8(r)))return NE(a,e,t)}c8({target:"Reflect",stat:true},{get:NE})});var BE=o(()=>{var q8=d();var y8=C();var m8=M();var S8=rr();q8({target:"Reflect",stat:true,sham:!y8},{getOwnPropertyDescriptor:function r(e,t){return S8.f(m8(e),t)}})});var GE=o(()=>{var b8=d();var E8=M();var I8=Rr();var T8=oa();b8({target:"Reflect",stat:true,sham:!T8},{getPrototypeOf:function r(e){return I8(E8(e))}})});var HE=o(()=>{var A8=d();A8({target:"Reflect",stat:true},{has:function r(e,t){return t in e}})});var VE=o(()=>{var w8=d();var O8=M();var kE=Object.isExtensible;w8({target:"Reflect",stat:true},{isExtensible:function r(e){O8(e);return kE?kE(e):true}})});var WE=o(()=>{var x8=d();var R8=Kn();x8({target:"Reflect",stat:true},{ownKeys:R8})});var KE=o(()=>{var P8=d();var _8=Sr();var F8=M();var M8=st();P8({target:"Reflect",stat:true,sham:!M8},{preventExtensions:function r(e){F8(e);try{var t=_8("Object","preventExtensions");if(t)t(e);return true}catch(n){return false}}})});var QE=o(()=>{var L8=d();var C8=M();var zE=F();var j8=V();var D8=A();var vf=$();var YE=rr();var JE=Rr();var XE=Zr();function ZE(r,e,t){var n=arguments.length<4?r:arguments[3];var a=YE.f(C8(r),e);var i,u;if(!a){if(zE(u=JE(r))){return ZE(u,e,t,n)}a=XE(0)}if(j8(a,"value")){if(a.writable===false||!zE(n))return false;if(i=YE.f(n,e)){if(i.get||i.set||i.writable===false)return false;i.value=t;vf.f(n,e,i)}else vf.f(n,e,XE(0,t));return true}return a.set===void 0?false:(a.set.call(n,t),true)}var U8=D8(function(){var r=vf.f({},"a",{configurable:true});return Reflect.set(JE(r),"a",1,r)!==false});L8({target:"Reflect",stat:true,forced:U8},{set:ZE})});var eI=o(()=>{var N8=d();var $8=M();var B8=Ru();var rI=ge();if(rI)N8({target:"Reflect",stat:true},{setPrototypeOf:function r(e,t){$8(e);B8(t);try{rI(e,t);return true}catch(n){return false}}})});var nI=o((bZ,tI)=>{su();fu();cu();lu();hu();du();pu();gu();qu();yu();mu();Su();bu();Eu();Iu();Lh();Ch();Dh();Nh();Gh();Vh();Kh();Xh();Jh();Zh();rd();td();nd();ad();id();od();sd();fd();vd();cd();Ni();hd();dd();pd();gd();md();bd();Ad();wd();Cu();Od();xd();Ui();_d();Cd();Ud();Nd();no();Gd();Vd();Wd();Yd();Xd();Qd();rp();ap();so();op();sp();vp();hp();dp();yp();mp();Ep();Ip();Tp();kt();_p();Fp();Mp();$p();Bp();ag();hg();yg();mg();Sg();bg();Ig();wg();Rg();Cg();Ug();Bg();la();kg();Vg();Wg();Kg();zg();Yg();Xg();Jg();Zg();Qg();rq();eq();tq();oq();ba();sq();fq();vq();hq();qq();Sq();Aq();wq();Rq();_q();Fq();Mq();Lq();Cq();Dq();Nq();Hq();Wq();Yq();Zq();ry();ty();ny();uy();sy();cy();hy();py();gy();qy();yy();my();Ey();Ay();Tu();wy();Oy();xy();Ly();Dy();Gy();Vy();Au();Cm();jm();Nm();zm();Xm();oS();sS();PS();BS();KS();zS();mb();Sb();bb();Eb();Ib();Tb();Ab();wb();Ob();xb();Pb();Fb();Lb();jb();Db();Nb();Bb();Hb();Vb();Kb();Qb();eE();nE();aE();uE();sE();vE();lE();hE();pE();qE();SE();TE();wE();OE();LE();DE();UE();$E();BE();GE();HE();VE();WE();KE();QE();eI();var G8=ce();tI.exports=G8});var cf=o((EZ,aI)=>{aI.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var uI=o(()=>{var H8=R();var k8=cf();var lf=io();var V8=nr();for(iI in k8){hf=H8[iI];Tn=hf&&hf.prototype;if(Tn&&Tn.forEach!==lf)try{V8(Tn,"forEach",lf)}catch(r){Tn.forEach=lf}}var hf;var Tn;var iI});var vI=o(()=>{var W8=R();var oI=cf();var An=kt();var df=nr();var fI=j();var pf=fI("iterator");var sI=fI("toStringTag");var gf=An.values;for(vi in oI){qf=W8[vi];Yr=qf&&qf.prototype;if(Yr){if(Yr[pf]!==gf)try{df(Yr,pf,gf)}catch(r){Yr[pf]=gf}if(!Yr[sI]){df(Yr,sI,vi)}if(oI[vi])for(Ue in An){if(Yr[Ue]!==An[Ue])try{df(Yr,Ue,An[Ue])}catch(r){Yr[Ue]=An[Ue]}}}}var qf;var Yr;var Ue;var vi});var hI=o(()=>{var K8=d();var cI=R();var lI=ja();var z8=!cI.setImmediate||!cI.clearImmediate;K8({global:true,bind:true,enumerable:true,forced:z8},{setImmediate:lI.set,clearImmediate:lI.clear})});var pI=o(()=>{var Y8=d();var X8=R();var J8=us();var Z8=mr();var dI=X8.process;var Q8=Z8(dI)=="process";Y8({global:true,enumerable:true,noTargetGet:true},{queueMicrotask:function r(e){var t=Q8&&dI.domain;J8(t?t.bind(e):e)}})});var yI=o(()=>{var rk=d();var gI=R();var ek=Mt();var tk=[].slice;var nk=/MSIE .\./.test(ek);var qI=function(r){return function(e,t){var n=arguments.length>2;var a=n?tk.call(arguments,2):void 0;return r(n?function(){(typeof e=="function"?e:Function(e)).apply(this,a)}:e,t)}};rk({global:true,bind:true,forced:nk},{setTimeout:qI(gI.setTimeout),setInterval:qI(gI.setInterval)})});var yf=o((MZ,mI)=>{var ak=A();var ik=j();var uk=Or();var ok=ik("iterator");mI.exports=!ak(function(){var r=new URL("b?a=1&b=2&c=3","http://a");var e=r.searchParams;var t="";r.pathname="c%20d";e.forEach(function(n,a){e["delete"]("b");t+=a+n});return uk&&!r.toJSON||!e.sort||r.href!=="http://a/c%20d?a=1&c=3"||e.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!e[ok]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||t!=="a1c3"||new URL("http://x",void 0).host!=="x"})});var TI=o((LZ,II)=>{"use strict";var mf=2147483647;var wn=36;var EI=1;var Ef=26;var sk=38;var fk=700;var vk=72;var ck=128;var lk="-";var hk=/[^\0-\u007E]/;var dk=/[.\u3002\uFF0E\uFF61]/g;var SI="Overflow: input needs wider integers to process";var Sf=wn-EI;var Et=Math.floor;var bf=String.fromCharCode;var pk=function(r){var e=[];var t=0;var n=r.length;while(t=55296&&a<=56319&&t>1;r+=Et(r/e);for(;r>Sf*Ef>>1;n+=wn){r=Et(r/Sf)}return Et(n+(Sf+1)*r/(r+sk))};var qk=function(r){var e=[];r=pk(r);var t=r.length;var n=ck;var a=0;var i=vk;var u,f;for(u=0;u=n&&fEt((mf-a)/v)){throw RangeError(SI)}a+=(l-n)*v;n=l;for(u=0;umf){throw RangeError(SI)}if(f==n){var h=a;for(var I=wn;;I+=wn){var m=I<=i?EI:I>=i+Ef?Ef:I-i;if(h{var yk=M();var mk=ut();AI.exports=function(r){var e=mk(r);if(typeof e!="function"){throw TypeError(String(r)+" is not iterable")}return yk(e.call(r))}});var wf=o((jZ,BI)=>{"use strict";kt();var FI=d();var MI=Sr();var LI=yf();var CI=er();var Sk=Le();var bk=Fr();var Ek=sa();var Af=ar();var Ik=ie();var Tk=V();var Ak=Br();var wk=Qe();var Ok=M();var jI=F();var xk=$r();var OI=Zr();var DI=wI();var Rk=ut();var Pk=j();var xI=MI("fetch");var If=MI("Headers");var _k=Pk("iterator");var Tt="URLSearchParams";var UI=Tt+"Iterator";var NI=Af.set;var Dr=Af.getterFor(Tt);var Fk=Af.getterFor(UI);var Mk=/\+/g;var RI=Array(4);var Lk=function(r){return RI[r-1]||(RI[r-1]=RegExp("((?:%[\\da-f]{2}){"+r+"})","gi"))};var Ck=function(r){try{return decodeURIComponent(r)}catch(e){return r}};var PI=function(r){var e=r.replace(Mk," ");var t=4;try{return decodeURIComponent(e)}catch(n){while(t){e=e.replace(Lk(t--),Ck)}return e}};var jk=/[!'()~]|%20/g;var Dk={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};var Uk=function(r){return Dk[r]};var _I=function(r){return encodeURIComponent(r).replace(jk,Uk)};var $I=function(r,e){if(e){var t=e.split("&");var n=0;var a,i;while(n0?arguments[0]:void 0;var t=this;var n=[];var a,i,u,f,s,c,l,v,h;NI(t,{type:Tt,entries:n,updateURL:function(){},updateSearchParams:Nk});if(e!==void 0){if(jI(e)){a=Rk(e);if(typeof a==="function"){i=a.call(e);u=i.next;while(!(f=u.call(i)).done){s=DI(Ok(f.value));c=s.next;if((l=c.call(s)).done||(v=c.call(s)).done||!c.call(s).done)throw TypeError("Expected sequence with length 2");n.push({key:l.value+"",value:v.value+""})}}else for(h in e)if(Tk(e,h))n.push({key:h,value:e[h]+""})}else{$I(n,typeof e==="string"?e.charAt(0)==="?"?e.slice(1):e:e+"")}}};var ci=On.prototype;Sk(ci,{append:function r(e,t){It(arguments.length,2);var n=Dr(this);n.entries.push({key:e+"",value:t+""});n.updateURL()},"delete":function(r){It(arguments.length,1);var e=Dr(this);var t=e.entries;var n=r+"";var a=0;while(aa.key){t.splice(i,0,a);break}}if(i===u)t.push(a)}e.updateURL()},forEach:function r(e){var t=Dr(this).entries;var n=Ak(e,arguments.length>1?arguments[1]:void 0,3);var a=0;var i;while(a1){n=arguments[1];if(jI(n)){a=n.body;if(wk(a)===Tt){i=n.headers?new If(n.headers):new If;if(!i.has("content-type")){i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8")}n=xk(n,{body:OI(0,String(a)),headers:OI(0,i)})}}t.push(n)}return xI.apply(this,t)}})}BI.exports={URLSearchParams:On,getState:Dr}});var g0=o(()=>{"use strict";la();var $k=d();var kf=C();var Bk=yf();var Gk=R();var Hk=ra();var pi=er();var kk=ie();var Vf=V();var Wf=Du();var wt=Mu();var Vk=Ut().codeAt;var Wk=TI();var Kk=Fr();var QI=wf();var r0=ar();var xn=Gk.URL;var zk=QI.URLSearchParams;var jf=QI.getState;var Yk=r0.set;var W=r0.getterFor("URL");var Xk=Math.floor;var GI=Math.pow;var Jk="Invalid authority";var Of="Invalid scheme";var $e="Invalid host";var HI="Invalid port";var e0=/[A-Za-z]/;var Zk=/[\d+-.A-Za-z]/;var Df=/\d/;var Qk=/^(0x|0X)/;var rV=/^[0-7]+$/;var eV=/^\d+$/;var t0=/^[\dA-Fa-f]+$/;var tV=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/;var nV=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/;var aV=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;var iV=/[\u0009\u000A\u000D]/g;var Pr;var xf=function(r,e){var t,n,a;if(e.charAt(0)=="["){if(e.charAt(e.length-1)!="]")return $e;t=oV(e.slice(1,-1));if(!t)return $e;r.host=t}else if(!Q(r)){if(nV.test(e))return $e;t="";n=wt(e);for(a=0;a4)return r;n=[];for(a=0;a1&&i.charAt(0)=="0"){u=Qk.test(i)?16:8;i=i.slice(u==8?1:2)}if(i===""){f=0}else{if(!(u==10?eV:u==8?rV:t0).test(i))return r;f=parseInt(i,u)}n.push(f)}for(a=0;a=GI(256,5-t))return null}else if(f>255)return null}s=n.pop();for(a=0;a6)return;f=0;while(h()){s=null;if(f>0){if(h()=="."&&f<4)a++;else return}if(!Df.test(h()))return;while(Df.test(h())){c=parseInt(h(),10);if(s===null)s=c;else if(s==0)return;else s=s*10+c;if(s>255)return;a++}e[t]=e[t]*256+s;f++;if(f==2||f==4)t++}if(f!=4)return;break}else if(h()==":"){a++;if(!h())return}else if(h())return;e[t++]=i}if(n!==null){l=t-n;t=7;while(t!=0&&l>0){v=e[t];e[t--]=e[n+l-1];e[n+--l]=v}}else if(t!=8)return;return e};var sV=function(r){var e=null;var t=1;var n=null;var a=0;var i=0;for(;i<8;i++){if(r[i]!==0){if(a>t){e=n;t=a}n=null;a=0}else{if(n===null)n=i;++a}}if(a>t){e=n;t=a}return e};var Pn=function(r){var e,t,n,a;if(typeof r=="number"){e=[];for(t=0;t<4;t++){e.unshift(r%256);r=Xk(r/256)}return e.join(".")}else if(typeof r=="object"){e="";n=sV(r);for(t=0;t<8;t++){if(a&&r[t]===0)continue;if(a)a=false;if(n===t){e+=t?":":"::";a=true}else{e+=r[t].toString(16);if(t<7)e+=":"}}return"["+e+"]"}return r};var gi={};var n0=Wf({},gi,{" ":1,'"':1,"<":1,">":1,"`":1});var a0=Wf({},n0,{"#":1,"?":1,"{":1,"}":1});var Uf=Wf({},a0,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1});var Ee=function(r,e){var t=Vk(r,0);return t>32&&t<127&&!Vf(e,r)?r:encodeURIComponent(r)};var di={ftp:21,file:null,http:80,https:443,ws:80,wss:443};var Q=function(r){return Vf(di,r.scheme)};var Nf=function(r){return r.username!=""||r.password!=""};var Rf=function(r){return!r.host||r.cannotBeABaseURL||r.scheme=="file"};var Rn=function(r,e){var t;return r.length==2&&e0.test(r.charAt(0))&&((t=r.charAt(1))==":"||!e&&t=="|")};var kI=function(r){var e;return r.length>1&&Rn(r.slice(0,2))&&(r.length==2||((e=r.charAt(2))==="/"||e==="\\"||e==="?"||e==="#"))};var VI=function(r){var e=r.path;var t=e.length;if(t&&(r.scheme!="file"||t!=1||!Rn(e[0],true))){e.pop()}};var fV=function(r){return r==="."||r.toLowerCase()==="%2e"};var vV=function(r){r=r.toLowerCase();return r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"};var $f={};var WI={};var Pf={};var KI={};var zI={};var _f={};var YI={};var XI={};var li={};var hi={};var Bf={};var Gf={};var Hf={};var Ff={};var JI={};var Mf={};var At={};var Xr={};var ZI={};var Ne={};var ve={};var Jr=function(r,e,t,n){var a=t||$f;var i=0;var u="";var f=false;var s=false;var c=false;var l,v,h,I;if(!t){r.scheme="";r.username="";r.password="";r.host=null;r.port=null;r.path=[];r.query=null;r.fragment=null;r.cannotBeABaseURL=false;e=e.replace(aV,"")}e=e.replace(iV,"");l=wt(e);while(i<=l.length){v=l[i];switch(a){case $f:if(v&&e0.test(v)){u+=v.toLowerCase();a=WI}else if(!t){a=Pf;continue}else return Of;break;case WI:if(v&&(Zk.test(v)||v=="+"||v=="-"||v==".")){u+=v.toLowerCase()}else if(v==":"){if(t&&(Q(r)!=Vf(di,u)||u=="file"&&(Nf(r)||r.port!==null)||r.scheme=="file"&&!r.host))return;r.scheme=u;if(t){if(Q(r)&&di[r.scheme]==r.port)r.port=null;return}u="";if(r.scheme=="file"){a=Ff}else if(Q(r)&&n&&n.scheme==r.scheme){a=KI}else if(Q(r)){a=XI}else if(l[i+1]=="/"){a=zI;i++}else{r.cannotBeABaseURL=true;r.path.push("");a=ZI}}else if(!t){u="";a=Pf;i=0;continue}else return Of;break;case Pf:if(!n||n.cannotBeABaseURL&&v!="#")return Of;if(n.cannotBeABaseURL&&v=="#"){r.scheme=n.scheme;r.path=n.path.slice();r.query=n.query;r.fragment="";r.cannotBeABaseURL=true;a=ve;break}a=n.scheme=="file"?Ff:_f;continue;case KI:if(v=="/"&&l[i+1]=="/"){a=li;i++}else{a=_f;continue}break;case zI:if(v=="/"){a=hi;break}else{a=Xr;continue}case _f:r.scheme=n.scheme;if(v==Pr){r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;r.path=n.path.slice();r.query=n.query}else if(v=="/"||v=="\\"&&Q(r)){a=YI}else if(v=="?"){r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;r.path=n.path.slice();r.query="";a=Ne}else if(v=="#"){r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;r.path=n.path.slice();r.query=n.query;r.fragment="";a=ve}else{r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;r.path=n.path.slice();r.path.pop();a=Xr;continue}break;case YI:if(Q(r)&&(v=="/"||v=="\\")){a=li}else if(v=="/"){a=hi}else{r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;a=Xr;continue}break;case XI:a=li;if(v!="/"||u.charAt(i+1)!="/")continue;i++;break;case li:if(v!="/"&&v!="\\"){a=hi;continue}break;case hi:if(v=="@"){if(f)u="%40"+u;f=true;h=wt(u);for(var m=0;m65535)return HI;r.port=Q(r)&&T===di[r.scheme]?null:T;u=""}if(t)return;a=At;continue}else return HI;break;case Ff:r.scheme="file";if(v=="/"||v=="\\")a=JI;else if(n&&n.scheme=="file"){if(v==Pr){r.host=n.host;r.path=n.path.slice();r.query=n.query}else if(v=="?"){r.host=n.host;r.path=n.path.slice();r.query="";a=Ne}else if(v=="#"){r.host=n.host;r.path=n.path.slice();r.query=n.query;r.fragment="";a=ve}else{if(!kI(l.slice(i).join(""))){r.host=n.host;r.path=n.path.slice();VI(r)}a=Xr;continue}}else{a=Xr;continue}break;case JI:if(v=="/"||v=="\\"){a=Mf;break}if(n&&n.scheme=="file"&&!kI(l.slice(i).join(""))){if(Rn(n.path[0],true))r.path.push(n.path[0]);else r.host=n.host}a=Xr;continue;case Mf:if(v==Pr||v=="/"||v=="\\"||v=="?"||v=="#"){if(!t&&Rn(u)){a=Xr}else if(u==""){r.host="";if(t)return;a=At}else{I=xf(r,u);if(I)return I;if(r.host=="localhost")r.host="";if(t)return;u="";a=At}continue}else u+=v;break;case At:if(Q(r)){a=Xr;if(v!="/"&&v!="\\")continue}else if(!t&&v=="?"){r.query="";a=Ne}else if(!t&&v=="#"){r.fragment="";a=ve}else if(v!=Pr){a=Xr;if(v!="/")continue}break;case Xr:if(v==Pr||v=="/"||v=="\\"&&Q(r)||!t&&(v=="?"||v=="#")){if(vV(u)){VI(r);if(v!="/"&&!(v=="\\"&&Q(r))){r.path.push("")}}else if(fV(u)){if(v!="/"&&!(v=="\\"&&Q(r))){r.path.push("")}}else{if(r.scheme=="file"&&!r.path.length&&Rn(u)){if(r.host)r.host="";u=u.charAt(0)+":"}r.path.push(u)}u="";if(r.scheme=="file"&&(v==Pr||v=="?"||v=="#")){while(r.path.length>1&&r.path[0]===""){r.path.shift()}}if(v=="?"){r.query="";a=Ne}else if(v=="#"){r.fragment="";a=ve}}else{u+=Ee(v,a0)}break;case ZI:if(v=="?"){r.query="";a=Ne}else if(v=="#"){r.fragment="";a=ve}else if(v!=Pr){r.path[0]+=Ee(v,gi)}break;case Ne:if(!t&&v=="#"){r.fragment="";a=ve}else if(v!=Pr){if(v=="'"&&Q(r))r.query+="%27";else if(v=="#")r.query+="%23";else r.query+=Ee(v,gi)}break;case ve:if(v!=Pr)r.fragment+=Ee(v,n0);break}i++}};var Be=function r(e){var t=kk(this,Be,"URL");var n=arguments.length>1?arguments[1]:void 0;var a=String(e);var i=Yk(t,{type:"URL"});var u,f;if(n!==void 0){if(n instanceof Be)u=W(n);else{f=Jr(u={},String(n));if(f)throw TypeError(f)}}f=Jr(i,a,null,u);if(f)throw TypeError(f);var s=i.searchParams=new zk;var c=jf(s);c.updateSearchParams(i.query);c.updateURL=function(){i.query=String(s)||null};if(!kf){t.href=qi.call(t);t.origin=i0.call(t);t.protocol=u0.call(t);t.username=o0.call(t);t.password=s0.call(t);t.host=f0.call(t);t.hostname=v0.call(t);t.port=c0.call(t);t.pathname=l0.call(t);t.search=h0.call(t);t.searchParams=d0.call(t);t.hash=p0.call(t)}};var Kf=Be.prototype;var qi=function(){var r=W(this);var e=r.scheme;var t=r.username;var n=r.password;var a=r.host;var i=r.port;var u=r.path;var f=r.query;var s=r.fragment;var c=e+":";if(a!==null){c+="//";if(Nf(r)){c+=t+(n?":"+n:"")+"@"}c+=Pn(a);if(i!==null)c+=":"+i}else if(e=="file")c+="//";c+=r.cannotBeABaseURL?u[0]:u.length?"/"+u.join("/"):"";if(f!==null)c+="?"+f;if(s!==null)c+="#"+s;return c};var i0=function(){var r=W(this);var e=r.scheme;var t=r.port;if(e=="blob")try{return new URL(e.path[0]).origin}catch(n){return"null"}if(e=="file"||!Q(r))return"null";return e+"://"+Pn(r.host)+(t!==null?":"+t:"")};var u0=function(){return W(this).scheme+":"};var o0=function(){return W(this).username};var s0=function(){return W(this).password};var f0=function(){var r=W(this);var e=r.host;var t=r.port;return e===null?"":t===null?Pn(e):Pn(e)+":"+t};var v0=function(){var r=W(this).host;return r===null?"":Pn(r)};var c0=function(){var r=W(this).port;return r===null?"":String(r)};var l0=function(){var r=W(this);var e=r.path;return r.cannotBeABaseURL?e[0]:e.length?"/"+e.join("/"):""};var h0=function(){var r=W(this).query;return r?"?"+r:""};var d0=function(){return W(this).searchParams};var p0=function(){var r=W(this).fragment;return r?"#"+r:""};var _r=function(r,e){return{get:r,set:e,configurable:true,enumerable:true}};if(kf){Hk(Kf,{href:_r(qi,function(r){var e=W(this);var t=String(r);var n=Jr(e,t);if(n)throw TypeError(n);jf(e.searchParams).updateSearchParams(e.query)}),origin:_r(i0),protocol:_r(u0,function(r){var e=W(this);Jr(e,String(r)+":",$f)}),username:_r(o0,function(r){var e=W(this);var t=wt(String(r));if(Rf(e))return;e.username="";for(var n=0;n{"use strict";var cV=d();cV({target:"URL",proto:true,enumerable:true},{toJSON:function r(){return URL.prototype.toString.call(this)}})});var m0=o((BZ,y0)=>{uI();vI();hI();pI();yI();g0();q0();wf();var lV=ce();y0.exports=lV});var b0=o((GZ,S0)=>{nI();m0();var hV=ce();S0.exports=hV});var I0=o((HZ,zf)=>{var E0=function(r){"use strict";var e=Object.prototype;var t=e.hasOwnProperty;var n;var a=typeof Symbol==="function"?Symbol:{};var i=a.iterator||"@@iterator";var u=a.asyncIterator||"@@asyncIterator";var f=a.toStringTag||"@@toStringTag";function s(S,g,E){Object.defineProperty(S,g,{value:E,enumerable:true,configurable:true,writable:true});return S[g]}try{s({},"")}catch(S){s=function(g,E,x){return g[E]=x}}function c(S,g,E,x){var w=g&&g.prototype instanceof b?g:b;var z=Object.create(w.prototype);var fr=new G(x||[]);z._invoke=p(S,E,fr);return z}r.wrap=c;function l(S,g,E){try{return{type:"normal",arg:S.call(g,E)}}catch(x){return{type:"throw",arg:x}}}var v="suspendedStart";var h="suspendedYield";var I="executing";var m="completed";var q={};function b(){}function T(){}function _(){}var O={};O[i]=function(){return this};var K=Object.getPrototypeOf;var H=K&&K(K(L([])));if(H&&H!==e&&t.call(H,i)){O=H}var N=_.prototype=b.prototype=Object.create(O);T.prototype=N.constructor=_;_.constructor=T;T.displayName=s(_,f,"GeneratorFunction");function sr(S){["next","throw","return"].forEach(function(g){s(S,g,function(E){return this._invoke(g,E)})})}r.isGeneratorFunction=function(S){var g=typeof S==="function"&&S.constructor;return g?g===T||(g.displayName||g.name)==="GeneratorFunction":false};r.mark=function(S){if(Object.setPrototypeOf){Object.setPrototypeOf(S,_)}else{S.__proto__=_;s(S,f,"GeneratorFunction")}S.prototype=Object.create(N);return S};r.awrap=function(S){return{__await:S}};function Tr(S,g){function E(z,fr,vr,Ar){var cr=l(S[z],S,fr);if(cr.type==="throw"){Ar(cr.arg)}else{var yi=cr.arg;var Ot=yi.value;if(Ot&&typeof Ot==="object"&&t.call(Ot,"__await")){return g.resolve(Ot.__await).then(function(Te){E("next",Te,vr,Ar)},function(Te){E("throw",Te,vr,Ar)})}return g.resolve(Ot).then(function(Te){yi.value=Te;vr(yi)},function(Te){return E("throw",Te,vr,Ar)})}}var x;function w(z,fr){function vr(){return new g(function(Ar,cr){E(z,fr,Ar,cr)})}return x=x?x.then(vr,vr):vr()}this._invoke=w}sr(Tr.prototype);Tr.prototype[u]=function(){return this};r.AsyncIterator=Tr;r.async=function(S,g,E,x,w){if(w===void 0)w=Promise;var z=new Tr(c(S,g,E,x),w);return r.isGeneratorFunction(g)?z:z.next().then(function(fr){return fr.done?fr.value:z.next()})};function p(S,g,E){var x=v;return function w(z,fr){if(x===I){throw new Error("Generator is already running")}if(x===m){if(z==="throw"){throw fr}return Ie()}E.method=z;E.arg=fr;while(true){var vr=E.delegate;if(vr){var Ar=y(vr,E);if(Ar){if(Ar===q)continue;return Ar}}if(E.method==="next"){E.sent=E._sent=E.arg}else if(E.method==="throw"){if(x===v){x=m;throw E.arg}E.dispatchException(E.arg)}else if(E.method==="return"){E.abrupt("return",E.arg)}x=I;var cr=l(S,g,E);if(cr.type==="normal"){x=E.done?m:h;if(cr.arg===q){continue}return{value:cr.arg,done:E.done}}else if(cr.type==="throw"){x=m;E.method="throw";E.arg=cr.arg}}}}function y(S,g){var E=S.iterator[g.method];if(E===n){g.delegate=null;if(g.method==="throw"){if(S.iterator["return"]){g.method="return";g.arg=n;y(S,g);if(g.method==="throw"){return q}}g.method="throw";g.arg=new TypeError("The iterator does not provide a 'throw' method")}return q}var x=l(E,S.iterator,g.arg);if(x.type==="throw"){g.method="throw";g.arg=x.arg;g.delegate=null;return q}var w=x.arg;if(!w){g.method="throw";g.arg=new TypeError("iterator result is not an object");g.delegate=null;return q}if(w.done){g[S.resultName]=w.value;g.next=S.nextLoc;if(g.method!=="return"){g.method="next";g.arg=n}}else{return w}g.delegate=null;return q}sr(N);s(N,f,"Generator");N[i]=function(){return this};N.toString=function(){return"[object Generator]"};function P(S){var g={tryLoc:S[0]};if(1 in S){g.catchLoc=S[1]}if(2 in S){g.finallyLoc=S[2];g.afterLoc=S[3]}this.tryEntries.push(g)}function B(S){var g=S.completion||{};g.type="normal";delete g.arg;S.completion=g}function G(S){this.tryEntries=[{tryLoc:"root"}];S.forEach(P,this);this.reset(true)}r.keys=function(S){var g=[];for(var E in S){g.push(E)}g.reverse();return function x(){while(g.length){var w=g.pop();if(w in S){x.value=w;x.done=false;return x}}x.done=true;return x}};function L(S){if(S){var g=S[i];if(g){return g.call(S)}if(typeof S.next==="function"){return S}if(!isNaN(S.length)){var E=-1,x=function w(){while(++E=0;--x){var w=this.tryEntries[x];var z=w.completion;if(w.tryLoc==="root"){return E("end")}if(w.tryLoc<=this.prev){var fr=t.call(w,"catchLoc");var vr=t.call(w,"finallyLoc");if(fr&&vr){if(this.prev=0;--E){var x=this.tryEntries[E];if(x.tryLoc<=this.prev&&t.call(x,"finallyLoc")&&this.prev=0;--g){var E=this.tryEntries[g];if(E.finallyLoc===S){this.complete(E.completion,E.afterLoc);B(E);return q}}},"catch":function(S){for(var g=this.tryEntries.length-1;g>=0;--g){var E=this.tryEntries[g];if(E.tryLoc===S){var x=E.completion;if(x.type==="throw"){var w=x.arg;B(E)}return w}}throw new Error("illegal catch attempt")},delegateYield:function(S,g,E){this.delegate={iterator:L(S),resultName:g,nextLoc:E};if(this.method==="next"){this.arg=n}return q}};return r}(typeof zf==="object"?zf.exports:{});try{regeneratorRuntime=E0}catch(r){Function("r","regeneratorRuntime = r")(E0)}});var Yf=o((kZ,T0)=>{var dV=R();var pV=Br();var gV=Function.call;T0.exports=function(r,e,t){return pV(gV,dV[r].prototype[e],t)}});var w0=o((VZ,A0)=>{no();var qV=Yf();A0.exports=qV("Array","find")});var x0=o((WZ,O0)=>{var yV=w0();O0.exports=yV});var P0=o((KZ,R0)=>{so();var mV=Yf();R0.exports=mV("Array","map")});var F0=o((zZ,_0)=>{var SV=P0();_0.exports=SV});if(typeof Promise==="undefined"){vv().enable();self.Promise=lv()}if(typeof window!=="undefined"){dv()}Object.assign=qv();Vl();Rh();b0();I0();var JZ=Xf(x0());var ZZ=Xf(F0());export{BV as AdjustmentConfiguration,UV as AdjustmentIdentifier,NV as AdjustmentIdentifierKeys,$V as AdvancedAdjustmentControlBarItem,bW as AdvancedBrushControlBarItem,HV as AdvancedFilterControlBarItem,XV as AdvancedFocusControlBarItem,rW as AdvancedFrameControlBarItem,uW as AdvancedLibraryControlBarItem,sW as AdvancedOverlayControlBarItem,hW as AdvancedStickerControlBarItem,gW as AdvancedTextControlBarItem,TW as AdvancedTextDesignControlBarItem,wW as AdvancedTransformControlBarItem,NW as AdvancedUICardLabel,A3 as AdvancedUICategoryCard,P3 as AdvancedUIControlsBarSection,w3 as AdvancedUIItemCard,R3 as AdvancedUIToolControlBar,x3 as AdvancedUIToolbar,KW as AdvancedUIToolbarItem,PV as AlignmentMode,EW as BasicBrushControlBarTabs,kV as BasicFilterControlBarTabs,JV as BasicFocusControlBarTabs,eW as BasicFrameControlBarTabs,fW as BasicOverlayControlBarTabs,dW as BasicStickerControlBarTabs,qW as BasicTextControlBarTabs,OW as BasicTransformControlBarTabs,F3 as BasicUIToolControlBar,M3 as BasicUIToolItemsBar,_3 as BasicUIToolbar,cW as BlendMode,IW as BrushConfiguration,IV as CanvasAction,BW as CanvasBarTextSecondaryButton,$W as CardAvatar,wV as CardType,AV as CategoryHeaderType,d3 as Checkbox,p3 as CheckboxBase,q3 as CheckboxCheckMark,g3 as CheckboxInput,r3 as ColorItem,a3 as ColorItemActiveOverlay,t3 as ColorItemBackground,e3 as ColorItemBase,n3 as ColorItemTiledBackground,DV as Configuration,UW as ContainedPrimaryButton,QW as Container,GV as CustomToolConfiguration,i3 as Dialog,s3 as DialogBackdrop,u3 as DialogBase,v3 as DialogBody,o3 as DialogContainer,c3 as DialogFooter,f3 as DialogHeader,l3 as DialogSpinner,y3 as Dropdown,FW as DropdownCaret,_W as EventEmitter,MV as ExportConfiguration,LV as ExportFormat,YV as FilterCategoryIdentifier,VV as FilterConfiguration,zV as FilterIdentifier,ZV as FocusConfiguration,QV as FocusIdentifier,tW as FrameConfiguration,DW as IconButton,CV as ImageFormat,jV as ImageMimeType,h3 as Label,nW as LibraryCategory,oW as LibraryConfiguration,aW as LibraryImage,iW as LibraryProvider,OV as ModalType,CW as OutlinedPrimaryButton,jW as OutlinedSecondaryButton,vW as OverlayConfiguration,lW as OverlayIdentifier,zW as PhotoEditorSDKUI,YW as PhotoEditorSDKUIComponent,O3 as SearchField,FV as SerializationExportType,m3 as Slider,S3 as SliderBase,b3 as SliderContainer,xV as SliderIdentifier,E3 as SliderInput,T3 as SliderLabel,I3 as SliderTrack,RV as SnappingConfiguration,GW as SpriteActionButton,pW as StickerConfiguration,yW as TextConfiguration,AW as TextDesignConfiguration,MW as TextPrimaryButton,LW as TextSecondaryButton,TV as Tool,xW as TransformConfiguration,RW as TransformIdentifier,PW as UIEvent,_V as WatermarkConfiguration,WW as WindowContainer,VW as calculateAdvancedUIToolControlBarMeasurements,kW as deepmergeAll,HW as defaultConfig,WV as isDuoToneFilterAsset,EV as isExistingCategory,bV as isExistingItem,SW as isGoogleFontAsset,KV as isLUTFilterAsset,mW as isWebFontAsset,JW as useGetImage,ZW as useIsLayoutAdvanced,XW as useSetImage}; +import{A as m3,B as S3,C as b3,D as E3,E as I3,F as T3,G as A3,H as w3,I as O3,J as x3,K as R3,L as P3,M as _3,N as F3,O as M3,a as KW,b as zW,c as YW,d as XW,e as JW,f as ZW,g as QW,h as r3,i as e3,j as t3,k as n3,l as a3,m as i3,n as u3,o as o3,p as s3,q as f3,r as v3,s as c3,t as l3,u as h3,v as d3,w as p3,x as g3,y as q3,z as y3}from"./chunk-K4UIUOUT.js";import{C as HW,E as kW,F as VW,L as WW,e as FW,g as MW,h as LW,i as CW,j as jW,k as DW,l as UW,n as NW,o as $W,s as BW,t as GW}from"./chunk-CV3QEYL2.js";import{$ as KV,Aa as SW,B as bV,Ba as bW,C as EV,Ca as EW,D as IV,Da as IW,E as TV,Ea as TW,F as AV,Fa as AW,G as wV,Ga as wW,H as OV,Ha as OW,I as xV,Ia as xW,J as RV,Ja as RW,K as PV,Ka as PW,L as _V,La as _W,M as FV,N as MV,O as LV,P as CV,Q as jV,R as DV,S as UV,T as NV,U as $V,V as BV,W as GV,X as HV,Y as kV,Z as VV,_ as WV,a as o,aa as zV,b as Xf,ba as YV,ca as XV,da as JV,ea as ZV,fa as QV,ga as rW,ha as eW,ia as tW,ja as nW,ka as aW,la as iW,ma as uW,na as oW,oa as sW,pa as fW,qa as vW,ra as cW,sa as lW,ta as hW,ua as dW,va as pW,wa as gW,xa as qW,ya as yW,za as mW}from"./chunk-UDNMGV4K.js";var nv=o((L3,tv)=>{"use strict";tv.exports=mi;function mi(r){if(!Nr.length){_n();Qf=true}Nr[Nr.length]=r}var Nr=[];var Qf=false;var _n;var Ur=0;var M0=1024;function Jf(){while(UrM0){for(var e=0,t=Nr.length-Ur;e{"use strict";var C0=nv();function Mn(){}var He=null;var ke={};function j0(r){try{return r.then}catch(e){He=e;return ke}}function D0(r,e){try{return r(e)}catch(t){He=t;return ke}}function U0(r,e,t){try{r(e,t)}catch(n){He=n;return ke}}uv.exports=yr;function yr(r){if(typeof this!=="object"){throw new TypeError("Promises must be constructed via new")}if(typeof r!=="function"){throw new TypeError("Promise constructor's argument is not a function")}this._U=0;this._V=0;this._W=null;this._X=null;if(r===Mn)return;iv(r,this)}yr._Y=null;yr._Z=null;yr._0=Mn;yr.prototype.then=function(r,e){if(this.constructor!==yr){return N0(this,r,e)}var t=new yr(Mn);Fn(this,new av(r,e,t));return t};function N0(r,e,t){return new r.constructor(function(n,a){var i=new yr(Mn);i.then(n,a);Fn(r,new av(e,t,i))})}function Fn(r,e){while(r._V===3){r=r._W}if(yr._Y){yr._Y(r)}if(r._V===0){if(r._U===0){r._U=1;r._X=e;return}if(r._U===1){r._U=2;r._X=[r._X,e];return}r._X.push(e);return}$0(r,e)}function $0(r,e){C0(function(){var t=r._V===1?e.onFulfilled:e.onRejected;if(t===null){if(r._V===1){Si(e.promise,r._W)}else{Ge(e.promise,r._W)}return}var n=D0(t,r._W);if(n===ke){Ge(e.promise,He)}else{Si(e.promise,n)}})}function Si(r,e){if(e===r){return Ge(r,new TypeError("A promise cannot be resolved with itself."))}if(e&&(typeof e==="object"||typeof e==="function")){var t=j0(e);if(t===ke){return Ge(r,He)}if(t===r.then&&e instanceof yr){r._V=3;r._W=e;bi(r);return}else if(typeof t==="function"){iv(t.bind(e),r);return}}r._V=1;r._W=e;bi(r)}function Ge(r,e){r._V=2;r._W=e;if(yr._Z){yr._Z(r,e)}bi(r)}function bi(r){if(r._U===1){Fn(r,r._X);r._X=null}if(r._U===2){for(var e=0;e{"use strict";var Ln=Ei();var ov=[ReferenceError,TypeError,RangeError];var Ii=false;Ti.disable=fv;function fv(){Ii=false;Ln._Y=null;Ln._Z=null}Ti.enable=B0;function B0(r){r=r||{};if(Ii)fv();Ii=true;var e=0;var t=0;var n={};Ln._Y=function(u){if(u._V===2&&n[u._1]){if(n[u._1].logged){i(u._1)}else{clearTimeout(n[u._1].timeout)}delete n[u._1]}};Ln._Z=function(u,f){if(u._U===0){u._1=e++;n[u._1]={displayId:null,error:f,timeout:setTimeout(a.bind(null,u._1),sv(f,ov)?100:2e3),logged:false}}};function a(u){if(r.allRejections||sv(n[u].error,r.whitelist||ov)){n[u].displayId=t++;if(r.onUnhandled){n[u].logged=true;r.onUnhandled(n[u].displayId,n[u].error)}else{n[u].logged=true;G0(n[u].displayId,n[u].error)}}}function i(u){if(n[u].logged){if(r.onHandled){r.onHandled(n[u].displayId,n[u].error)}else if(!n[u].onUnhandled){console.warn("Promise Rejection Handled (id: "+n[u].displayId+"):");console.warn(' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id '+n[u].displayId+".")}}}}function G0(r,e){console.warn("Possible Unhandled Promise Rejection (id: "+r+"):");var t=(e&&(e.stack||e))+"";t.split("\n").forEach(function(n){console.warn(" "+n)})}function sv(r,e){return e.some(function(t){return r instanceof t})}});var lv=o((D3,cv)=>{"use strict";var J=Ei();cv.exports=J;var H0=Ae(true);var k0=Ae(false);var V0=Ae(null);var W0=Ae(void 0);var K0=Ae(0);var z0=Ae("");function Ae(r){var e=new J(J._0);e._V=1;e._W=r;return e}J.resolve=function(r){if(r instanceof J)return r;if(r===null)return V0;if(r===void 0)return W0;if(r===true)return H0;if(r===false)return k0;if(r===0)return K0;if(r==="")return z0;if(typeof r==="object"||typeof r==="function"){try{var e=r.then;if(typeof e==="function"){return new J(e.bind(r))}}catch(t){return new J(function(n,a){a(t)})}}return Ae(r)};var Cn=function(r){if(typeof Array.from==="function"){Cn=Array.from;return Array.from(r)}Cn=function(e){return Array.prototype.slice.call(e)};return Array.prototype.slice.call(r)};J.all=function(r){var e=Cn(r);return new J(function(t,n){if(e.length===0)return t([]);var a=e.length;function i(f,s){if(s&&(typeof s==="object"||typeof s==="function")){if(s instanceof J&&s.then===J.prototype.then){while(s._V===3){s=s._W}if(s._V===1)return i(f,s._W);if(s._V===2)n(s._W);s.then(function(v){i(f,v)},n);return}else{var c=s.then;if(typeof c==="function"){var l=new J(c.bind(s));l.then(function(v){i(f,v)},n);return}}}e[f]=s;if(--a===0){t(e)}}for(var u=0;u{(function(r,e){typeof jn==="object"&&typeof hv!=="undefined"?e(jn):typeof define==="function"&&define.amd?define(["exports"],e):e(r.WHATWGFetch={})})(jn,function(r){"use strict";var e=typeof globalThis!=="undefined"&&globalThis||typeof self!=="undefined"&&self||typeof e!=="undefined"&&e;var t={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{new Blob;return true}catch(p){return false}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};function n(p){return p&&DataView.prototype.isPrototypeOf(p)}if(t.arrayBuffer){var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"];var i=ArrayBuffer.isView||function(p){return p&&a.indexOf(Object.prototype.toString.call(p))>-1}}function u(p){if(typeof p!=="string"){p=String(p)}if(/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(p)||p===""){throw new TypeError("Invalid character in header field name")}return p.toLowerCase()}function f(p){if(typeof p!=="string"){p=String(p)}return p}function s(p){var y={next:function(){var P=p.shift();return{done:P===void 0,value:P}}};if(t.iterable){y[Symbol.iterator]=function(){return y}}return y}function c(p){this.map={};if(p instanceof c){p.forEach(function(y,P){this.append(P,y)},this)}else if(Array.isArray(p)){p.forEach(function(y){this.append(y[0],y[1])},this)}else if(p){Object.getOwnPropertyNames(p).forEach(function(y){this.append(y,p[y])},this)}}c.prototype.append=function(p,y){p=u(p);y=f(y);var P=this.map[p];this.map[p]=P?P+", "+y:y};c.prototype["delete"]=function(p){delete this.map[u(p)]};c.prototype.get=function(p){p=u(p);return this.has(p)?this.map[p]:null};c.prototype.has=function(p){return this.map.hasOwnProperty(u(p))};c.prototype.set=function(p,y){this.map[u(p)]=f(y)};c.prototype.forEach=function(p,y){for(var P in this.map){if(this.map.hasOwnProperty(P)){p.call(y,this.map[P],P,this)}}};c.prototype.keys=function(){var p=[];this.forEach(function(y,P){p.push(P)});return s(p)};c.prototype.values=function(){var p=[];this.forEach(function(y){p.push(y)});return s(p)};c.prototype.entries=function(){var p=[];this.forEach(function(y,P){p.push([P,y])});return s(p)};if(t.iterable){c.prototype[Symbol.iterator]=c.prototype.entries}function l(p){if(p.bodyUsed){return Promise.reject(new TypeError("Already read"))}p.bodyUsed=true}function v(p){return new Promise(function(y,P){p.onload=function(){y(p.result)};p.onerror=function(){P(p.error)}})}function h(p){var y=new FileReader;var P=v(y);y.readAsArrayBuffer(p);return P}function I(p){var y=new FileReader;var P=v(y);y.readAsText(p);return P}function m(p){var y=new Uint8Array(p);var P=new Array(y.length);for(var B=0;B-1?y:p}function O(p,y){if(!(this instanceof O)){throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')}y=y||{};var P=y.body;if(p instanceof O){if(p.bodyUsed){throw new TypeError("Already read")}this.url=p.url;this.credentials=p.credentials;if(!y.headers){this.headers=new c(p.headers)}this.method=p.method;this.mode=p.mode;this.signal=p.signal;if(!P&&p._bodyInit!=null){P=p._bodyInit;p.bodyUsed=true}}else{this.url=String(p)}this.credentials=y.credentials||this.credentials||"same-origin";if(y.headers||!this.headers){this.headers=new c(y.headers)}this.method=_(y.method||this.method||"GET");this.mode=y.mode||this.mode||null;this.signal=y.signal||this.signal;this.referrer=null;if((this.method==="GET"||this.method==="HEAD")&&P){throw new TypeError("Body not allowed for GET or HEAD requests")}this._initBody(P);if(this.method==="GET"||this.method==="HEAD"){if(y.cache==="no-store"||y.cache==="no-cache"){var B=/([?&])_=[^&]*/;if(B.test(this.url)){this.url=this.url.replace(B,"$1_="+new Date().getTime())}else{var G=/\?/;this.url+=(G.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})};function K(p){var y=new FormData;p.trim().split("&").forEach(function(P){if(P){var B=P.split("=");var G=B.shift().replace(/\+/g," ");var L=B.join("=").replace(/\+/g," ");y.append(decodeURIComponent(G),decodeURIComponent(L))}});return y}function H(p){var y=new c;var P=p.replace(/\r?\n[\t ]+/g," ");P.split(/\r?\n/).forEach(function(B){var G=B.split(":");var L=G.shift().trim();if(L){var Ie=G.join(":").trim();y.append(L,Ie)}});return y}b.call(O.prototype);function N(p,y){if(!(this instanceof N)){throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')}if(!y){y={}}this.type="default";this.status=y.status===void 0?200:y.status;this.ok=this.status>=200&&this.status<300;this.statusText="statusText"in y?y.statusText:"";this.headers=new c(y.headers);this.url=y.url||"";this._initBody(p)}b.call(N.prototype);N.prototype.clone=function(){return new N(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})};N.error=function(){var p=new N(null,{status:0,statusText:""});p.type="error";return p};var sr=[301,302,303,307,308];N.redirect=function(p,y){if(sr.indexOf(y)===-1){throw new RangeError("Invalid status code")}return new N(null,{status:y,headers:{location:p}})};r.DOMException=e.DOMException;try{new r.DOMException}catch(p){r.DOMException=function(y,P){this.message=y;this.name=P;var B=Error(y);this.stack=B.stack};r.DOMException.prototype=Object.create(Error.prototype);r.DOMException.prototype.constructor=r.DOMException}function Tr(p,y){return new Promise(function(P,B){var G=new O(p,y);if(G.signal&&G.signal.aborted){return B(new r.DOMException("Aborted","AbortError"))}var L=new XMLHttpRequest;function Ie(){L.abort()}L.onload=function(){var g={status:L.status,statusText:L.statusText,headers:H(L.getAllResponseHeaders()||"")};g.url="responseURL"in L?L.responseURL:g.headers.get("X-Request-URL");var E="response"in L?L.response:L.responseText;setTimeout(function(){P(new N(E,g))},0)};L.onerror=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)};L.ontimeout=function(){setTimeout(function(){B(new TypeError("Network request failed"))},0)};L.onabort=function(){setTimeout(function(){B(new r.DOMException("Aborted","AbortError"))},0)};function S(g){try{return g===""&&e.location.href?e.location.href:g}catch(E){return g}}L.open(G.method,S(G.url),true);if(G.credentials==="include"){L.withCredentials=true}else if(G.credentials==="omit"){L.withCredentials=false}if("responseType"in L){if(t.blob){L.responseType="blob"}else if(t.arrayBuffer&&G.headers.get("Content-Type")&&G.headers.get("Content-Type").indexOf("application/octet-stream")!==-1){L.responseType="arraybuffer"}}if(y&&typeof y.headers==="object"&&!(y.headers instanceof c)){Object.getOwnPropertyNames(y.headers).forEach(function(g){L.setRequestHeader(g,f(y.headers[g]))})}else{G.headers.forEach(function(g,E){L.setRequestHeader(E,g)})}if(G.signal){G.signal.addEventListener("abort",Ie);L.onreadystatechange=function(){if(L.readyState===4){G.signal.removeEventListener("abort",Ie)}}}L.send(typeof G._bodyInit==="undefined"?null:G._bodyInit)})}Tr.polyfill=true;if(!e.fetch){e.fetch=Tr;e.Headers=c;e.Request=O;e.Response=N}r.Headers=c;r.Request=O;r.Response=N;r.fetch=Tr;Object.defineProperty(r,"__esModule",{value:true})})});var qv=o((U3,gv)=>{"use strict";var pv=Object.getOwnPropertySymbols;var Y0=Object.prototype.hasOwnProperty;var X0=Object.prototype.propertyIsEnumerable;function J0(r){if(r===null||r===void 0){throw new TypeError("Object.assign cannot be called with null or undefined")}return Object(r)}function Z0(){try{if(!Object.assign){return false}var r=new String("abc");r[5]="de";if(Object.getOwnPropertyNames(r)[0]==="5"){return false}var e={};for(var t=0;t<10;t++){e["_"+String.fromCharCode(t)]=t}var n=Object.getOwnPropertyNames(e).map(function(i){return e[i]});if(n.join("")!=="0123456789"){return false}var a={};"abcdefghijklmnopqrst".split("").forEach(function(i){a[i]=i});if(Object.keys(Object.assign({},a)).join("")!=="abcdefghijklmnopqrst"){return false}return true}catch(i){return false}}gv.exports=Z0()?Object.assign:function(r,e){var t;var n=J0(r);var a;for(var i=1;i{var Dn=function(r){return r&&r.Math==Math&&r};yv.exports=Dn(typeof globalThis=="object"&&globalThis)||Dn(typeof window=="object"&&window)||Dn(typeof self=="object"&&self)||Dn(typeof global=="object"&&global)||Function("return this")()});var A=o(($3,mv)=>{mv.exports=function(r){try{return!!r()}catch(e){return true}}});var C=o((B3,Sv)=>{var Q0=A();Sv.exports=!Q0(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})});var xt=o(Iv=>{"use strict";var bv={}.propertyIsEnumerable;var Ev=Object.getOwnPropertyDescriptor;var rT=Ev&&!bv.call({1:2},1);Iv.f=rT?function r(e){var t=Ev(this,e);return!!t&&t.enumerable}:bv});var Zr=o((H3,Tv)=>{Tv.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var mr=o((k3,Av)=>{var eT={}.toString;Av.exports=function(r){return eT.call(r).slice(8,-1)}});var Ve=o((V3,wv)=>{var tT=A();var nT=mr();var aT="".split;wv.exports=tT(function(){return!Object("z").propertyIsEnumerable(0)})?function(r){return nT(r)=="String"?aT.call(r,""):Object(r)}:Object});var tr=o((W3,Ov)=>{Ov.exports=function(r){if(r==void 0)throw TypeError("Can't call method on "+r);return r}});var lr=o((K3,xv)=>{var iT=Ve();var uT=tr();xv.exports=function(r){return iT(uT(r))}});var F=o((z3,Rv)=>{Rv.exports=function(r){return typeof r==="object"?r!==null:typeof r==="function"}});var wr=o((Y3,Pv)=>{var Un=F();Pv.exports=function(r,e){if(!Un(r))return r;var t,n;if(e&&typeof(t=r.toString)=="function"&&!Un(n=t.call(r)))return n;if(typeof(t=r.valueOf)=="function"&&!Un(n=t.call(r)))return n;if(!e&&typeof(t=r.toString)=="function"&&!Un(n=t.call(r)))return n;throw TypeError("Can't convert object to primitive value")}});var V=o((X3,_v)=>{var oT={}.hasOwnProperty;_v.exports=function(r,e){return oT.call(r,e)}});var Nn=o((J3,Mv)=>{var sT=R();var Fv=F();var Ai=sT.document;var fT=Fv(Ai)&&Fv(Ai.createElement);Mv.exports=function(r){return fT?Ai.createElement(r):{}}});var wi=o((Z3,Lv)=>{var vT=C();var cT=A();var lT=Nn();Lv.exports=!vT&&!cT(function(){return Object.defineProperty(lT("div"),"a",{get:function(){return 7}}).a!=7})});var rr=o(jv=>{var hT=C();var dT=xt();var pT=Zr();var gT=lr();var qT=wr();var yT=V();var mT=wi();var Cv=Object.getOwnPropertyDescriptor;jv.f=hT?Cv:function r(e,t){e=gT(e);t=qT(t,true);if(mT)try{return Cv(e,t)}catch(n){}if(yT(e,t))return pT(!dT.f.call(e,t),e[t])}});var M=o((r6,Dv)=>{var ST=F();Dv.exports=function(r){if(!ST(r)){throw TypeError(String(r)+" is not an object")}return r}});var $=o($v=>{var bT=C();var ET=wi();var Uv=M();var IT=wr();var Nv=Object.defineProperty;$v.f=bT?Nv:function r(e,t,n){Uv(e);t=IT(t,true);Uv(n);if(ET)try{return Nv(e,t,n)}catch(a){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");if("value"in n)e[t]=n.value;return e}});var nr=o((t6,Bv)=>{var TT=C();var AT=$();var wT=Zr();Bv.exports=TT?function(r,e,t){return AT.f(r,e,wT(1,t))}:function(r,e,t){r[e]=t;return r}});var $n=o((n6,Hv)=>{var Gv=R();var OT=nr();Hv.exports=function(r,e){try{OT(Gv,r,e)}catch(t){Gv[r]=e}return e}});var Oi=o((a6,Vv)=>{var xT=R();var RT=$n();var kv="__core-js_shared__";var PT=xT[kv]||RT(kv,{});Vv.exports=PT});var Bn=o((i6,Wv)=>{var xi=Oi();var _T=Function.toString;if(typeof xi.inspectSource!="function"){xi.inspectSource=function(r){return _T.call(r)}}Wv.exports=xi.inspectSource});var Ri=o((u6,zv)=>{var FT=R();var MT=Bn();var Kv=FT.WeakMap;zv.exports=typeof Kv==="function"&&/native code/.test(MT(Kv))});var Or=o((o6,Yv)=>{Yv.exports=false});var Gn=o((s6,Jv)=>{var LT=Or();var Xv=Oi();(Jv.exports=function(r,e){return Xv[r]||(Xv[r]=e!==void 0?e:{})})("versions",[]).push({version:"3.6.5",mode:LT?"pure":"global",copyright:"\xA9 2020 Denis Pushkarev (zloirock.ru)"})});var We=o((f6,Zv)=>{var CT=0;var jT=Math.random();Zv.exports=function(r){return"Symbol("+String(r===void 0?"":r)+")_"+(++CT+jT).toString(36)}});var Rt=o((v6,rc)=>{var DT=Gn();var UT=We();var Qv=DT("keys");rc.exports=function(r){return Qv[r]||(Qv[r]=UT(r))}});var Ke=o((c6,ec)=>{ec.exports={}});var ar=o((l6,uc)=>{var NT=Ri();var $T=R();var BT=F();var GT=nr();var tc=V();var HT=Rt();var kT=Ke();var VT=$T.WeakMap;var Hn;var Pt;var kn;var WT=function(r){return kn(r)?Pt(r):Hn(r,{})};var KT=function(r){return function(e){var t;if(!BT(e)||(t=Pt(e)).type!==r){throw TypeError("Incompatible receiver, "+r+" required")}return t}};if(NT){we=new VT;nc=we.get;ac=we.has;ic=we.set;Hn=function(r,e){ic.call(we,r,e);return e};Pt=function(r){return nc.call(we,r)||{}};kn=function(r){return ac.call(we,r)}}else{ze=HT("state");kT[ze]=true;Hn=function(r,e){GT(r,ze,e);return e};Pt=function(r){return tc(r,ze)?r[ze]:{}};kn=function(r){return tc(r,ze)}}var we;var nc;var ac;var ic;var ze;uc.exports={set:Hn,get:Pt,has:kn,enforce:WT,getterFor:KT}});var er=o((h6,fc)=>{var zT=R();var oc=nr();var YT=V();var XT=$n();var JT=Bn();var sc=ar();var ZT=sc.get;var QT=sc.enforce;var rA=String(String).split("String");(fc.exports=function(r,e,t,n){var a=n?!!n.unsafe:false;var i=n?!!n.enumerable:false;var u=n?!!n.noTargetGet:false;if(typeof t=="function"){if(typeof e=="string"&&!YT(t,"name"))oc(t,"name",e);QT(t).source=rA.join(typeof e=="string"?e:"")}if(r===zT){if(i)r[e]=t;else XT(e,t);return}else if(!a){delete r[e]}else if(!u&&r[e]){i=true}if(i)r[e]=t;else oc(r,e,t)})(Function.prototype,"toString",function r(){return typeof this=="function"&&ZT(this).source||JT(this)})});var ce=o((d6,vc)=>{var eA=R();vc.exports=eA});var Sr=o((p6,lc)=>{var Pi=ce();var _i=R();var cc=function(r){return typeof r=="function"?r:void 0};lc.exports=function(r,e){return arguments.length<2?cc(Pi[r])||cc(_i[r]):Pi[r]&&Pi[r][e]||_i[r]&&_i[r][e]}});var br=o((g6,hc)=>{var tA=Math.ceil;var nA=Math.floor;hc.exports=function(r){return isNaN(r=+r)?0:(r>0?nA:tA)(r)}});var D=o((q6,dc)=>{var aA=br();var iA=Math.min;dc.exports=function(r){return r>0?iA(aA(r),9007199254740991):0}});var Qr=o((y6,pc)=>{var uA=br();var oA=Math.max;var sA=Math.min;pc.exports=function(r,e){var t=uA(r);return t<0?oA(t+e,0):sA(t,e)}});var Ye=o((m6,qc)=>{var fA=lr();var vA=D();var cA=Qr();var gc=function(r){return function(e,t,n){var a=fA(e);var i=vA(a.length);var u=cA(n,i);var f;if(r&&t!=t)while(i>u){f=a[u++];if(f!=f)return true}else for(;i>u;u++){if((r||u in a)&&a[u]===t)return r||u||0}return!r&&-1}};qc.exports={includes:gc(true),indexOf:gc(false)}});var Mi=o((S6,yc)=>{var Fi=V();var lA=lr();var hA=Ye().indexOf;var dA=Ke();yc.exports=function(r,e){var t=lA(r);var n=0;var a=[];var i;for(i in t)!Fi(dA,i)&&Fi(t,i)&&a.push(i);while(e.length>n)if(Fi(t,i=e[n++])){~hA(a,i)||a.push(i)}return a}});var Vn=o((b6,mc)=>{mc.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var le=o(Sc=>{var pA=Mi();var gA=Vn();var qA=gA.concat("length","prototype");Sc.f=Object.getOwnPropertyNames||function r(e){return pA(e,qA)}});var Wn=o(bc=>{bc.f=Object.getOwnPropertySymbols});var Kn=o((T6,Ec)=>{var yA=Sr();var mA=le();var SA=Wn();var bA=M();Ec.exports=yA("Reflect","ownKeys")||function r(e){var t=mA.f(bA(e));var n=SA.f;return n?t.concat(n(e)):t}});var Li=o((A6,Ic)=>{var EA=V();var IA=Kn();var TA=rr();var AA=$();Ic.exports=function(r,e){var t=IA(e);var n=AA.f;var a=TA.f;for(var i=0;i{var wA=A();var OA=/#|\.prototype\./;var _t=function(r,e){var t=RA[xA(r)];return t==_A?true:t==PA?false:typeof e=="function"?wA(e):!!e};var xA=_t.normalize=function(r){return String(r).replace(OA,".").toLowerCase()};var RA=_t.data={};var PA=_t.NATIVE="N";var _A=_t.POLYFILL="P";Tc.exports=_t});var d=o((O6,Ac)=>{var Ci=R();var FA=rr().f;var MA=nr();var LA=er();var CA=$n();var jA=Li();var DA=Xe();Ac.exports=function(r,e){var t=r.target;var n=r.global;var a=r.stat;var i,u,f,s,c,l;if(n){u=Ci}else if(a){u=Ci[t]||CA(t,{})}else{u=(Ci[t]||{}).prototype}if(u)for(f in e){c=e[f];if(r.noTargetGet){l=FA(u,f);s=l&&l.value}else s=u[f];i=DA(n?f:t+(a?".":"#")+f,r.forced);if(!i&&s!==void 0){if(typeof c===typeof s)continue;jA(c,s)}if(r.sham||s&&s.sham){MA(c,"sham",true)}LA(u,f,c,r)}}});var he=o((x6,wc)=>{var UA=mr();wc.exports=Array.isArray||function r(e){return UA(e)=="Array"}});var k=o((R6,Oc)=>{var NA=tr();Oc.exports=function(r){return Object(NA(r))}});var de=o((P6,xc)=>{"use strict";var $A=wr();var BA=$();var GA=Zr();xc.exports=function(r,e,t){var n=$A(e);if(n in r)BA.f(r,n,GA(0,t));else r[n]=t}});var zn=o((_6,Rc)=>{var HA=A();Rc.exports=!!Object.getOwnPropertySymbols&&!HA(function(){return!String(Symbol())})});var ji=o((F6,Pc)=>{var kA=zn();Pc.exports=kA&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var j=o((M6,Fc)=>{var VA=R();var WA=Gn();var _c=V();var KA=We();var zA=zn();var YA=ji();var Yn=WA("wks");var Ft=VA.Symbol;var XA=YA?Ft:Ft&&Ft.withoutSetter||KA;Fc.exports=function(r){if(!_c(Yn,r)){if(zA&&_c(Ft,r))Yn[r]=Ft[r];else Yn[r]=XA("Symbol."+r)}return Yn[r]}});var Je=o((L6,Lc)=>{var JA=F();var Mc=he();var ZA=j();var QA=ZA("species");Lc.exports=function(r,e){var t;if(Mc(r)){t=r.constructor;if(typeof t=="function"&&(t===Array||Mc(t.prototype)))t=void 0;else if(JA(t)){t=t[QA];if(t===null)t=void 0}}return new(t===void 0?Array:t)(e===0?0:e)}});var Mt=o((C6,Cc)=>{var rw=Sr();Cc.exports=rw("navigator","userAgent")||""});var Jn=o((j6,Nc)=>{var ew=R();var Di=Mt();var jc=ew.process;var Dc=jc&&jc.versions;var Uc=Dc&&Dc.v8;var re;var Xn;if(Uc){re=Uc.split(".");Xn=re[0]+re[1]}else if(Di){re=Di.match(/Edge\/(\d+)/);if(!re||re[1]>=74){re=Di.match(/Chrome\/(\d+)/);if(re)Xn=re[1]}}Nc.exports=Xn&&+Xn});var Ze=o((D6,$c)=>{var tw=A();var nw=j();var aw=Jn();var iw=nw("species");$c.exports=function(r){return aw>=51||!tw(function(){var e=[];var t=e.constructor={};t[iw]=function(){return{foo:1}};return e[r](Boolean).foo!==1})}});var Ui=o(()=>{"use strict";var uw=d();var ow=A();var sw=he();var fw=F();var vw=k();var cw=D();var Bc=de();var lw=Je();var hw=Ze();var dw=j();var pw=Jn();var kc=dw("isConcatSpreadable");var Gc=9007199254740991;var Hc="Maximum allowed index exceeded";var gw=pw>=51||!ow(function(){var r=[];r[kc]=false;return r.concat()[0]!==r});var qw=hw("concat");var yw=function(r){if(!fw(r))return false;var e=r[kc];return e!==void 0?!!e:sw(r)};var mw=!gw||!qw;uw({target:"Array",proto:true,forced:mw},{concat:function r(e){var t=vw(this);var n=lw(t,0);var a=0;var i,u,f,s,c;for(i=-1,f=arguments.length;iGc)throw TypeError(Hc);for(u=0;u=Gc)throw TypeError(Hc);Bc(n,a++,c)}}n.length=a;return n}})});var Zn=o(($6,Wc)=>{var Sw=j();var bw=Sw("toStringTag");var Vc={};Vc[bw]="z";Wc.exports=String(Vc)==="[object z]"});var Qe=o((B6,Kc)=>{var Ew=Zn();var Qn=mr();var Iw=j();var Tw=Iw("toStringTag");var Aw=Qn(function(){return arguments}())=="Arguments";var ww=function(r,e){try{return r[e]}catch(t){}};Kc.exports=Ew?Qn:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=ww(e=Object(r),Tw))=="string"?t:Aw?Qn(e):(n=Qn(e))=="Object"&&typeof e.callee=="function"?"Arguments":n}});var Yc=o((G6,zc)=>{"use strict";var Ow=Zn();var xw=Qe();zc.exports=Ow?{}.toString:function r(){return"[object "+xw(this)+"]"}});var Ni=o(()=>{var Rw=Zn();var Pw=er();var _w=Yc();if(!Rw){Pw(Object.prototype,"toString",_w,{unsafe:true})}});var rt=o((V6,Xc)=>{var Fw=Mi();var Mw=Vn();Xc.exports=Object.keys||function r(e){return Fw(e,Mw)}});var ra=o((W6,Jc)=>{var Lw=C();var Cw=$();var jw=M();var Dw=rt();Jc.exports=Lw?Object.defineProperties:function r(e,t){jw(e);var n=Dw(t);var a=n.length;var i=0;var u;while(a>i)Cw.f(e,u=n[i++],t[u]);return e}});var $i=o((K6,Zc)=>{var Uw=Sr();Zc.exports=Uw("document","documentElement")});var $r=o((z6,al)=>{var Nw=M();var $w=ra();var Qc=Vn();var Bw=Ke();var Gw=$i();var Hw=Nn();var kw=Rt();var rl=">";var el="<";var Hi="prototype";var ki="script";var tl=kw("IE_PROTO");var Bi=function(){};var nl=function(r){return el+ki+rl+r+el+"/"+ki+rl};var Vw=function(r){r.write(nl(""));r.close();var e=r.parentWindow.Object;r=null;return e};var Ww=function(){var r=Hw("iframe");var e="java"+ki+":";var t;r.style.display="none";Gw.appendChild(r);r.src=String(e);t=r.contentWindow.document;t.open();t.write(nl("document.F=Object"));t.close();return t.F};var Gi;var ea=function(){try{Gi=document.domain&&new ActiveXObject("htmlfile")}catch(e){}ea=Gi?Vw(Gi):Ww();var r=Qc.length;while(r--)delete ea[Hi][Qc[r]];return ea()};Bw[tl]=true;al.exports=Object.create||function r(e,t){var n;if(e!==null){Bi[Hi]=Nw(e);n=new Bi;Bi[Hi]=null;n[tl]=e}else n=ea();return t===void 0?n:$w(n,t)}});var Vi=o((Y6,ol)=>{var Kw=lr();var il=le().f;var zw={}.toString;var ul=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];var Yw=function(r){try{return il(r)}catch(e){return ul.slice()}};ol.exports.f=function r(e){return ul&&zw.call(e)=="[object Window]"?Yw(e):il(Kw(e))}});var Wi=o(sl=>{var Xw=j();sl.f=Xw});var Y=o((J6,vl)=>{var fl=ce();var Jw=V();var Zw=Wi();var Qw=$().f;vl.exports=function(r){var e=fl.Symbol||(fl.Symbol={});if(!Jw(e,r))Qw(e,r,{value:Zw.f(r)})}});var Fr=o((Z6,ll)=>{var rO=$().f;var eO=V();var tO=j();var cl=tO("toStringTag");ll.exports=function(r,e,t){if(r&&!eO(r=t?r:r.prototype,cl)){rO(r,cl,{configurable:true,value:e})}}});var ur=o((Q6,hl)=>{hl.exports=function(r){if(typeof r!="function"){throw TypeError(String(r)+" is not a function")}return r}});var Br=o((r4,dl)=>{var nO=ur();dl.exports=function(r,e,t){nO(r);if(e===void 0)return r;switch(t){case 0:return function(){return r.call(e)};case 1:return function(n){return r.call(e,n)};case 2:return function(n,a){return r.call(e,n,a)};case 3:return function(n,a,i){return r.call(e,n,a,i)}}return function(){return r.apply(e,arguments)}}});var Z=o((e4,pl)=>{var aO=Br();var iO=Ve();var uO=k();var oO=D();var sO=Je();var fO=[].push;var Oe=function(r){var e=r==1;var t=r==2;var n=r==3;var a=r==4;var i=r==6;var u=r==5||i;return function(f,s,c,l){var v=uO(f);var h=iO(v);var I=aO(s,c,3);var m=oO(h.length);var q=0;var b=l||sO;var T=e?b(f,m):t?b(f,0):void 0;var _,O;for(;m>q;q++)if(u||q in h){_=h[q];O=I(_,q,v);if(r){if(e)T[q]=O;else if(O)switch(r){case 3:return true;case 5:return _;case 6:return q;case 2:fO.call(T,_)}else if(a)return false}}return i?-1:n||a?a:T}};pl.exports={forEach:Oe(0),map:Oe(1),filter:Oe(2),some:Oe(3),every:Oe(4),find:Oe(5),findIndex:Oe(6)}});var su=o(()=>{"use strict";var tt=d();var Sl=R();var vO=Sr();var cO=Or();var et=C();var xe=zn();var lO=ji();var iu=A();var X=V();var hO=he();var dO=F();var Zi=M();var pO=k();var ta=lr();var uu=wr();var Qi=Zr();var Ct=$r();var bl=rt();var gO=le();var El=Vi();var ru=Wn();var Il=rr();var Tl=$();var Al=xt();var qO=nr();var Ki=er();var jt=Gn();var yO=Rt();var wl=Ke();var gl=We();var Ol=j();var mO=Wi();var SO=Y();var bO=Fr();var xl=ar();var na=Z().forEach;var hr=yO("hidden");var aa="Symbol";var ee="prototype";var ql=Ol("toPrimitive");var EO=xl.set;var yl=xl.getterFor(aa);var xr=Object[ee];var dr=Sl.Symbol;var Lt=vO("JSON","stringify");var Rl=Il.f;var pe=Tl.f;var Pl=El.f;var IO=Al.f;var te=jt("symbols");var Dt=jt("op-symbols");var zi=jt("string-to-symbol-registry");var Yi=jt("symbol-to-string-registry");var TO=jt("wks");var Xi=Sl.QObject;var eu=!Xi||!Xi[ee]||!Xi[ee].findChild;var tu=et&&iu(function(){return Ct(pe({},"a",{get:function(){return pe(this,"a",{value:7}).a}})).a!=7})?function(r,e,t){var n=Rl(xr,e);if(n)delete xr[e];pe(r,e,t);if(n&&r!==xr){pe(xr,e,n)}}:pe;var Ji=function(r,e){var t=te[r]=Ct(dr[ee]);EO(t,{type:aa,tag:r,description:e});if(!et)t.description=e;return t};var nu=lO?function(r){return typeof r=="symbol"}:function(r){return Object(r)instanceof dr};var ia=function r(e,t,n){if(e===xr)ia(Dt,t,n);Zi(e);var a=uu(t,true);Zi(n);if(X(te,a)){if(!n.enumerable){if(!X(e,hr))pe(e,hr,Qi(1,{}));e[hr][a]=true}else{if(X(e,hr)&&e[hr][a])e[hr][a]=false;n=Ct(n,{enumerable:Qi(0,false)})}return tu(e,a,n)}return pe(e,a,n)};var _l=function r(e,t){Zi(e);var n=ta(t);var a=bl(n).concat(ou(n));na(a,function(i){if(!et||au.call(n,i))ia(e,i,n[i])});return e};var AO=function r(e,t){return t===void 0?Ct(e):_l(Ct(e),t)};var au=function r(e){var t=uu(e,true);var n=IO.call(this,t);if(this===xr&&X(te,t)&&!X(Dt,t))return false;return n||!X(this,t)||!X(te,t)||X(this,hr)&&this[hr][t]?n:true};var Fl=function r(e,t){var n=ta(e);var a=uu(t,true);if(n===xr&&X(te,a)&&!X(Dt,a))return;var i=Rl(n,a);if(i&&X(te,a)&&!(X(n,hr)&&n[hr][a])){i.enumerable=true}return i};var Ml=function r(e){var t=Pl(ta(e));var n=[];na(t,function(a){if(!X(te,a)&&!X(wl,a))n.push(a)});return n};var ou=function r(e){var t=e===xr;var n=Pl(t?Dt:ta(e));var a=[];na(n,function(i){if(X(te,i)&&(!t||X(xr,i))){a.push(te[i])}});return a};if(!xe){dr=function r(){if(this instanceof dr)throw TypeError("Symbol is not a constructor");var e=!arguments.length||arguments[0]===void 0?void 0:String(arguments[0]);var t=gl(e);var n=function(a){if(this===xr)n.call(Dt,a);if(X(this,hr)&&X(this[hr],t))this[hr][t]=false;tu(this,t,Qi(1,a))};if(et&&eu)tu(xr,t,{configurable:true,set:n});return Ji(t,e)};Ki(dr[ee],"toString",function r(){return yl(this).tag});Ki(dr,"withoutSetter",function(r){return Ji(gl(r),r)});Al.f=au;Tl.f=ia;Il.f=Fl;gO.f=El.f=Ml;ru.f=ou;mO.f=function(r){return Ji(Ol(r),r)};if(et){pe(dr[ee],"description",{configurable:true,get:function r(){return yl(this).description}});if(!cO){Ki(xr,"propertyIsEnumerable",au,{unsafe:true})}}}tt({global:true,wrap:true,forced:!xe,sham:!xe},{Symbol:dr});na(bl(TO),function(r){SO(r)});tt({target:aa,stat:true,forced:!xe},{"for":function(r){var e=String(r);if(X(zi,e))return zi[e];var t=dr(e);zi[e]=t;Yi[t]=e;return t},keyFor:function r(e){if(!nu(e))throw TypeError(e+" is not a symbol");if(X(Yi,e))return Yi[e]},useSetter:function(){eu=true},useSimple:function(){eu=false}});tt({target:"Object",stat:true,forced:!xe,sham:!et},{create:AO,defineProperty:ia,defineProperties:_l,getOwnPropertyDescriptor:Fl});tt({target:"Object",stat:true,forced:!xe},{getOwnPropertyNames:Ml,getOwnPropertySymbols:ou});tt({target:"Object",stat:true,forced:iu(function(){ru.f(1)})},{getOwnPropertySymbols:function r(e){return ru.f(pO(e))}});if(Lt){ml=!xe||iu(function(){var r=dr();return Lt([r])!="[null]"||Lt({a:r})!="{}"||Lt(Object(r))!="{}"});tt({target:"JSON",stat:true,forced:ml},{stringify:function r(e,t,n){var a=[e];var i=1;var u;while(arguments.length>i)a.push(arguments[i++]);u=t;if(!dO(t)&&e===void 0||nu(e))return;if(!hO(t))t=function(f,s){if(typeof u=="function")s=u.call(this,f,s);if(!nu(s))return s};a[1]=t;return Lt.apply(null,a)}})}var ml;if(!dr[ee][ql]){qO(dr[ee],ql,dr[ee].valueOf)}bO(dr,aa);wl[hr]=true});var fu=o(()=>{var wO=Y();wO("asyncIterator")});var cu=o(()=>{"use strict";var OO=d();var xO=C();var RO=R();var PO=V();var _O=F();var FO=$().f;var MO=Li();var ne=RO.Symbol;if(xO&&typeof ne=="function"&&(!("description"in ne.prototype)||ne().description!==void 0)){vu={};nt=function r(){var e=arguments.length<1||arguments[0]===void 0?void 0:String(arguments[0]);var t=this instanceof nt?new ne(e):e===void 0?ne():ne(e);if(e==="")vu[t]=true;return t};MO(nt,ne);ua=nt.prototype=ne.prototype;ua.constructor=nt;Ll=ua.toString;Cl=String(ne("test"))=="Symbol(test)";jl=/^Symbol\((.*)\)[^)]+$/;FO(ua,"description",{configurable:true,get:function r(){var e=_O(this)?this.valueOf():this;var t=Ll.call(e);if(PO(vu,e))return"";var n=Cl?t.slice(7,-1):t.replace(jl,"$1");return n===""?void 0:n}});OO({global:true,forced:true},{Symbol:nt})}var vu;var nt;var ua;var Ll;var Cl;var jl});var lu=o(()=>{var LO=Y();LO("hasInstance")});var hu=o(()=>{var CO=Y();CO("isConcatSpreadable")});var du=o(()=>{var jO=Y();jO("iterator")});var pu=o(()=>{var DO=Y();DO("match")});var gu=o(()=>{var UO=Y();UO("matchAll")});var qu=o(()=>{var NO=Y();NO("replace")});var yu=o(()=>{var $O=Y();$O("search")});var mu=o(()=>{var BO=Y();BO("species")});var Su=o(()=>{var GO=Y();GO("split")});var bu=o(()=>{var HO=Y();HO("toPrimitive")});var Eu=o(()=>{var kO=Y();kO("toStringTag")});var Iu=o(()=>{var VO=Y();VO("unscopables")});var Tu=o(()=>{var WO=Fr();WO(Math,"Math",true)});var Au=o(()=>{var KO=R();var zO=Fr();zO(KO.JSON,"JSON",true)});var Ul=o((j4,Dl)=>{Ui();Ni();su();fu();cu();lu();hu();du();pu();gu();qu();yu();mu();Su();bu();Eu();Iu();Tu();Au();var YO=ce();Dl.exports=YO.Symbol});var Nl=o(()=>{var XO=Y();XO("asyncDispose")});var $l=o(()=>{var JO=Y();JO("dispose")});var Bl=o(()=>{var ZO=Y();ZO("observable")});var Gl=o(()=>{var QO=Y();QO("patternMatch")});var Hl=o(()=>{var rx=Y();rx("replaceAll")});var Vl=o((K4,kl)=>{var ex=Ul();Nl();$l();Bl();Gl();Hl();kl.exports=ex});var Ut=o((z4,Kl)=>{var tx=br();var nx=tr();var Wl=function(r){return function(e,t){var n=String(nx(e));var a=tx(t);var i=n.length;var u,f;if(a<0||a>=i)return r?"":void 0;u=n.charCodeAt(a);return u<55296||u>56319||a+1===i||(f=n.charCodeAt(a+1))<56320||f>57343?r?n.charAt(a):u:r?n.slice(a,a+2):(u-55296<<10)+(f-56320)+65536}};Kl.exports={codeAt:Wl(false),charAt:Wl(true)}});var oa=o((Y4,zl)=>{var ax=A();zl.exports=!ax(function(){function r(){}r.prototype.constructor=null;return Object.getPrototypeOf(new r)!==r.prototype})});var Rr=o((X4,Xl)=>{var ix=V();var ux=k();var ox=Rt();var sx=oa();var Yl=ox("IE_PROTO");var fx=Object.prototype;Xl.exports=sx?Object.getPrototypeOf:function(r){r=ux(r);if(ix(r,Yl))return r[Yl];if(typeof r.constructor=="function"&&r instanceof r.constructor){return r.constructor.prototype}return r instanceof Object?fx:null}});var xu=o((J4,rh)=>{"use strict";var Jl=Rr();var vx=nr();var cx=V();var lx=j();var hx=Or();var Zl=lx("iterator");var Ql=false;var dx=function(){return this};var at;var wu;var Ou;if([].keys){Ou=[].keys();if(!("next"in Ou))Ql=true;else{wu=Jl(Jl(Ou));if(wu!==Object.prototype)at=wu}}if(at==void 0)at={};if(!hx&&!cx(at,Zl)){vx(at,Zl,dx)}rh.exports={IteratorPrototype:at,BUGGY_SAFARI_ITERATORS:Ql}});var it=o((Z4,eh)=>{eh.exports={}});var sa=o((Q4,th)=>{"use strict";var px=xu().IteratorPrototype;var gx=$r();var qx=Zr();var yx=Fr();var mx=it();var Sx=function(){return this};th.exports=function(r,e,t){var n=e+" Iterator";r.prototype=gx(px,{next:qx(1,t)});yx(r,n,false,true);mx[n]=Sx;return r}});var Ru=o((rK,nh)=>{var bx=F();nh.exports=function(r){if(!bx(r)&&r!==null){throw TypeError("Can't set "+String(r)+" as a prototype")}return r}});var ge=o((eK,ah)=>{var Ex=M();var Ix=Ru();ah.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=false;var e={};var t;try{t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set;t.call(e,[]);r=e instanceof Array}catch(n){}return function n(a,i){Ex(a);Ix(i);if(r)t.call(a,i);else a.__proto__=i;return a}}():void 0)});var ca=o((tK,hh)=>{"use strict";var Tx=d();var Ax=sa();var ih=Rr();var uh=ge();var wx=Fr();var oh=nr();var Ox=er();var xx=j();var Pu=Or();var sh=it();var lh=xu();var _u=lh.IteratorPrototype;var fa=lh.BUGGY_SAFARI_ITERATORS;var Nt=xx("iterator");var fh="keys";var va="values";var vh="entries";var ch=function(){return this};hh.exports=function(r,e,t,n,a,i,u){Ax(t,e,n);var f=function(T){if(T===a&&h)return h;if(!fa&&T in l)return l[T];switch(T){case fh:return function _(){return new t(this,T)};case va:return function _(){return new t(this,T)};case vh:return function _(){return new t(this,T)}}return function(){return new t(this)}};var s=e+" Iterator";var c=false;var l=r.prototype;var v=l[Nt]||l["@@iterator"]||a&&l[a];var h=!fa&&v||f(a);var I=e=="Array"?l.entries||v:v;var m,q,b;if(I){m=ih(I.call(new r));if(_u!==Object.prototype&&m.next){if(!Pu&&ih(m)!==_u){if(uh){uh(m,_u)}else if(typeof m[Nt]!="function"){oh(m,Nt,ch)}}wx(m,s,true,true);if(Pu)sh[s]=ch}}if(a==va&&v&&v.name!==va){c=true;h=function T(){return v.call(this)}}if((!Pu||u)&&l[Nt]!==h){oh(l,Nt,h)}sh[e]=h;if(a){q={values:f(va),keys:i?h:f(fh),entries:f(vh)};if(u)for(b in q){if(fa||c||!(b in l)){Ox(l,b,q[b])}}else Tx({target:e,proto:true,forced:fa||c},q)}return q}});var la=o(()=>{"use strict";var Rx=Ut().charAt;var dh=ar();var Px=ca();var ph="String Iterator";var _x=dh.set;var Fx=dh.getterFor(ph);Px(String,"String",function(r){_x(this,{type:ph,string:String(r),index:0})},function r(){var e=Fx(this);var t=e.string;var n=e.index;var a;if(n>=t.length)return{value:void 0,done:true};a=Rx(t,n);e.index+=a.length;return{value:a,done:false}})});var Fu=o((iK,qh)=>{var gh=M();qh.exports=function(r,e,t,n){try{return n?e(gh(t)[0],t[1]):e(t)}catch(i){var a=r["return"];if(a!==void 0)gh(a.call(r));throw i}}});var ha=o((uK,yh)=>{var Mx=j();var Lx=it();var Cx=Mx("iterator");var jx=Array.prototype;yh.exports=function(r){return r!==void 0&&(Lx.Array===r||jx[Cx]===r)}});var ut=o((oK,mh)=>{var Dx=Qe();var Ux=it();var Nx=j();var $x=Nx("iterator");mh.exports=function(r){if(r!=void 0)return r[$x]||r["@@iterator"]||Ux[Dx(r)]}});var Mu=o((sK,bh)=>{"use strict";var Bx=Br();var Gx=k();var Hx=Fu();var kx=ha();var Vx=D();var Sh=de();var Wx=ut();bh.exports=function r(e){var t=Gx(e);var n=typeof this=="function"?this:Array;var a=arguments.length;var i=a>1?arguments[1]:void 0;var u=i!==void 0;var f=Wx(t);var s=0;var c,l,v,h,I,m;if(u)i=Bx(i,a>2?arguments[2]:void 0,2);if(f!=void 0&&!(n==Array&&kx(f))){h=f.call(t);I=h.next;l=new n;for(;!(v=I.call(h)).done;s++){m=u?Hx(h,i,[v.value,s],true):v.value;Sh(l,s,m)}}else{c=Vx(t.length);l=new n(c);for(;c>s;s++){m=u?i(t[s],s):t[s];Sh(l,s,m)}}l.length=s;return l}});var $t=o((fK,Ah)=>{var Kx=j();var Ih=Kx("iterator");var Th=false;try{Eh=0;Lu={next:function(){return{done:!!Eh++}},"return":function(){Th=true}};Lu[Ih]=function(){return this};Array.from(Lu,function(){throw 2})}catch(r){}var Eh;var Lu;Ah.exports=function(r,e){if(!e&&!Th)return false;var t=false;try{var n={};n[Ih]=function(){return{next:function(){return{done:t=true}}}};r(n)}catch(a){}return t}});var Cu=o(()=>{var zx=d();var Yx=Mu();var Xx=$t();var Jx=!Xx(function(r){Array.from(r)});zx({target:"Array",stat:true,forced:Jx},{from:Yx})});var Oh=o((lK,wh)=>{la();Cu();var Zx=ce();wh.exports=Zx.Array.from});var Rh=o((hK,xh)=>{var Qx=Oh();xh.exports=Qx});var Du=o((dK,Fh)=>{"use strict";var Ph=C();var rR=A();var ju=rt();var eR=Wn();var tR=xt();var nR=k();var aR=Ve();var ot=Object.assign;var _h=Object.defineProperty;Fh.exports=!ot||rR(function(){if(Ph&&ot({b:1},ot(_h({},"a",{enumerable:true,get:function(){_h(this,"b",{value:3,enumerable:false})}}),{b:2})).b!==1)return true;var r={};var e={};var t=Symbol();var n="abcdefghijklmnopqrst";r[t]=7;n.split("").forEach(function(a){e[a]=a});return ot({},r)[t]!=7||ju(ot({},e)).join("")!=n})?function r(e,t){var n=nR(e);var a=arguments.length;var i=1;var u=eR.f;var f=tR.f;while(a>i){var s=aR(arguments[i++]);var c=u?ju(s).concat(u(s)):ju(s);var l=c.length;var v=0;var h;while(l>v){h=c[v++];if(!Ph||f.call(s,h))n[h]=s[h]}}return n}:ot});var Lh=o(()=>{var iR=d();var Mh=Du();iR({target:"Object",stat:true,forced:Object.assign!==Mh},{assign:Mh})});var Ch=o(()=>{var uR=d();var oR=C();var sR=$r();uR({target:"Object",stat:true,sham:!oR},{create:sR})});var Dh=o(()=>{var fR=d();var jh=C();var vR=$();fR({target:"Object",stat:true,forced:!jh,sham:!jh},{defineProperty:vR.f})});var Nh=o(()=>{var cR=d();var Uh=C();var lR=ra();cR({target:"Object",stat:true,forced:!Uh,sham:!Uh},{defineProperties:lR})});var Uu=o((IK,Bh)=>{var hR=C();var dR=rt();var pR=lr();var gR=xt().f;var $h=function(r){return function(e){var t=pR(e);var n=dR(t);var a=n.length;var i=0;var u=[];var f;while(a>i){f=n[i++];if(!hR||gR.call(t,f)){u.push(r?[f,t[f]]:t[f])}}return u}};Bh.exports={entries:$h(true),values:$h(false)}});var Gh=o(()=>{var qR=d();var yR=Uu().entries;qR({target:"Object",stat:true},{entries:function r(e){return yR(e)}})});var st=o((wK,Hh)=>{var mR=A();Hh.exports=!mR(function(){return Object.isExtensible(Object.preventExtensions({}))})});var qe=o((OK,kh)=>{var SR=Ke();var bR=F();var Nu=V();var ER=$().f;var IR=We();var TR=st();var Re=IR("meta");var AR=0;var $u=Object.isExtensible||function(){return true};var Bu=function(r){ER(r,Re,{value:{objectID:"O"+ ++AR,weakData:{}}})};var wR=function(r,e){if(!bR(r))return typeof r=="symbol"?r:(typeof r=="string"?"S":"P")+r;if(!Nu(r,Re)){if(!$u(r))return"F";if(!e)return"E";Bu(r)}return r[Re].objectID};var OR=function(r,e){if(!Nu(r,Re)){if(!$u(r))return true;if(!e)return false;Bu(r)}return r[Re].weakData};var xR=function(r){if(TR&&RR.REQUIRED&&$u(r)&&!Nu(r,Re))Bu(r);return r};var RR=kh.exports={REQUIRED:false,fastKey:wR,getWeakData:OR,onFreeze:xR};SR[Re]=true});var Vh=o(()=>{var PR=d();var _R=st();var FR=A();var MR=F();var LR=qe().onFreeze;var Gu=Object.freeze;var CR=FR(function(){Gu(1)});PR({target:"Object",stat:true,forced:CR,sham:!_R},{freeze:function r(e){return Gu&&MR(e)?Gu(LR(e)):e}})});var Pe=o((PK,Wh)=>{var jR=M();var DR=ha();var UR=D();var NR=Br();var $R=ut();var BR=Fu();var Bt=function(r,e){this.stopped=r;this.result=e};var GR=Wh.exports=function(r,e,t,n,a){var i=NR(e,t,n?2:1);var u,f,s,c,l,v,h;if(a){u=r}else{f=$R(r);if(typeof f!="function")throw TypeError("Target is not iterable");if(DR(f)){for(s=0,c=UR(r.length);c>s;s++){l=n?i(jR(h=r[s])[0],h[1]):i(r[s]);if(l&&l instanceof Bt)return l}return new Bt(false)}u=f.call(r)}v=u.next;while(!(h=v.call(u)).done){l=BR(u,i,h.value,n);if(typeof l=="object"&&l&&l instanceof Bt)return l}return new Bt(false)};GR.stop=function(r){return new Bt(true,r)}});var Kh=o(()=>{var HR=d();var kR=Pe();var VR=de();HR({target:"Object",stat:true},{fromEntries:function r(e){var t={};kR(e,function(n,a){VR(t,n,a)},void 0,true);return t}})});var Xh=o(()=>{var WR=d();var KR=A();var zR=lr();var zh=rr().f;var Yh=C();var YR=KR(function(){zh(1)});var XR=!Yh||YR;WR({target:"Object",stat:true,forced:XR,sham:!Yh},{getOwnPropertyDescriptor:function r(e,t){return zh(zR(e),t)}})});var Jh=o(()=>{var JR=d();var ZR=C();var QR=Kn();var rP=lr();var eP=rr();var tP=de();JR({target:"Object",stat:true,sham:!ZR},{getOwnPropertyDescriptors:function r(e){var t=rP(e);var n=eP.f;var a=QR(t);var i={};var u=0;var f,s;while(a.length>u){s=n(t,f=a[u++]);if(s!==void 0)tP(i,f,s)}return i}})});var Zh=o(()=>{var nP=d();var aP=A();var iP=Vi().f;var uP=aP(function(){return!Object.getOwnPropertyNames(1)});nP({target:"Object",stat:true,forced:uP},{getOwnPropertyNames:iP})});var rd=o(()=>{var oP=d();var sP=A();var fP=k();var Qh=Rr();var vP=oa();var cP=sP(function(){Qh(1)});oP({target:"Object",stat:true,forced:cP,sham:!vP},{getPrototypeOf:function r(e){return Qh(fP(e))}})});var Hu=o((BK,ed)=>{ed.exports=Object.is||function r(e,t){return e===t?e!==0||1/e===1/t:e!=e&&t!=t}});var td=o(()=>{var lP=d();var hP=Hu();lP({target:"Object",stat:true},{is:hP})});var nd=o(()=>{var dP=d();var pP=A();var gP=F();var ku=Object.isExtensible;var qP=pP(function(){ku(1)});dP({target:"Object",stat:true,forced:qP},{isExtensible:function r(e){return gP(e)?ku?ku(e):true:false}})});var ad=o(()=>{var yP=d();var mP=A();var SP=F();var Vu=Object.isFrozen;var bP=mP(function(){Vu(1)});yP({target:"Object",stat:true,forced:bP},{isFrozen:function r(e){return SP(e)?Vu?Vu(e):false:true}})});var id=o(()=>{var EP=d();var IP=A();var TP=F();var Wu=Object.isSealed;var AP=IP(function(){Wu(1)});EP({target:"Object",stat:true,forced:AP},{isSealed:function r(e){return TP(e)?Wu?Wu(e):false:true}})});var od=o(()=>{var wP=d();var OP=k();var ud=rt();var xP=A();var RP=xP(function(){ud(1)});wP({target:"Object",stat:true,forced:RP},{keys:function r(e){return ud(OP(e))}})});var sd=o(()=>{var PP=d();var _P=F();var FP=qe().onFreeze;var MP=st();var LP=A();var Ku=Object.preventExtensions;var CP=LP(function(){Ku(1)});PP({target:"Object",stat:true,forced:CP,sham:!MP},{preventExtensions:function r(e){return Ku&&_P(e)?Ku(FP(e)):e}})});var fd=o(()=>{var jP=d();var DP=F();var UP=qe().onFreeze;var NP=st();var $P=A();var zu=Object.seal;var BP=$P(function(){zu(1)});jP({target:"Object",stat:true,forced:BP,sham:!NP},{seal:function r(e){return zu&&DP(e)?zu(UP(e)):e}})});var vd=o(()=>{var GP=d();var HP=ge();GP({target:"Object",stat:true},{setPrototypeOf:HP})});var cd=o(()=>{var kP=d();var VP=Uu().values;kP({target:"Object",stat:true},{values:function r(e){return VP(e)}})});var Gt=o((uz,ld)=>{"use strict";var WP=Or();var KP=R();var zP=A();ld.exports=WP||!zP(function(){var r=Math.random();__defineSetter__.call(null,r,function(){});delete KP[r]})});var hd=o(()=>{"use strict";var YP=d();var XP=C();var JP=Gt();var ZP=k();var QP=ur();var r1=$();if(XP){YP({target:"Object",proto:true,forced:JP},{__defineGetter__:function r(e,t){r1.f(ZP(this),e,{get:QP(t),enumerable:true,configurable:true})}})}});var dd=o(()=>{"use strict";var e1=d();var t1=C();var n1=Gt();var a1=k();var i1=ur();var u1=$();if(t1){e1({target:"Object",proto:true,forced:n1},{__defineSetter__:function r(e,t){u1.f(a1(this),e,{set:i1(t),enumerable:true,configurable:true})}})}});var pd=o(()=>{"use strict";var o1=d();var s1=C();var f1=Gt();var v1=k();var c1=wr();var l1=Rr();var h1=rr().f;if(s1){o1({target:"Object",proto:true,forced:f1},{__lookupGetter__:function r(e){var t=v1(this);var n=c1(e,true);var a;do{if(a=h1(t,n))return a.get}while(t=l1(t))}})}});var gd=o(()=>{"use strict";var d1=d();var p1=C();var g1=Gt();var q1=k();var y1=wr();var m1=Rr();var S1=rr().f;if(p1){d1({target:"Object",proto:true,forced:g1},{__lookupSetter__:function r(e){var t=q1(this);var n=y1(e,true);var a;do{if(a=S1(t,n))return a.set}while(t=m1(t))}})}});var Xu=o((pz,yd)=>{"use strict";var b1=ur();var E1=F();var qd=[].slice;var Yu={};var I1=function(r,e,t){if(!(e in Yu)){for(var n=[],a=0;a{var T1=d();var A1=Xu();T1({target:"Function",proto:true},{bind:A1})});var bd=o(()=>{var w1=C();var O1=$().f;var Ju=Function.prototype;var x1=Ju.toString;var R1=/^\s*function ([^ (]*)/;var Sd="name";if(w1&&!(Sd in Ju)){O1(Ju,Sd,{configurable:true,get:function(){try{return x1.call(this).match(R1)[1]}catch(r){return""}}})}});var Ad=o(()=>{"use strict";var Ed=F();var P1=$();var _1=Rr();var F1=j();var Id=F1("hasInstance");var Td=Function.prototype;if(!(Id in Td)){P1.f(Td,Id,{value:function(r){if(typeof this!="function"||!Ed(r))return false;if(!Ed(this.prototype))return r instanceof this;while(r=_1(r))if(this.prototype===r)return true;return false}})}});var wd=o(()=>{var M1=d();var L1=R();M1({global:true},{globalThis:L1})});var Od=o(()=>{var C1=d();var j1=he();C1({target:"Array",stat:true},{isArray:j1})});var xd=o(()=>{"use strict";var D1=d();var U1=A();var N1=de();var $1=U1(function(){function r(){}return!(Array.of.call(r)instanceof r)});D1({target:"Array",stat:true,forced:$1},{of:function r(){var e=0;var t=arguments.length;var n=new(typeof this=="function"?this:Array)(t);while(t>e)N1(n,e,arguments[e++]);n.length=t;return n}})});var Qu=o((xz,Rd)=>{"use strict";var B1=k();var Zu=Qr();var G1=D();var H1=Math.min;Rd.exports=[].copyWithin||function r(e,t){var n=B1(this);var a=G1(n.length);var i=Zu(e,a);var u=Zu(t,a);var f=arguments.length>2?arguments[2]:void 0;var s=H1((f===void 0?a:Zu(f,a))-u,a-i);var c=1;if(u0){if(u in n)n[i]=n[u];else delete n[i];i+=c;u+=c}return n}});var ae=o((Rz,Pd)=>{var k1=j();var V1=$r();var W1=$();var ro=k1("unscopables");var eo=Array.prototype;if(eo[ro]==void 0){W1.f(eo,ro,{configurable:true,value:V1(null)})}Pd.exports=function(r){eo[ro][r]=true}});var _d=o(()=>{var K1=d();var z1=Qu();var Y1=ae();K1({target:"Array",proto:true},{copyWithin:z1});Y1("copyWithin")});var Gr=o((Fz,Fd)=>{"use strict";var X1=A();Fd.exports=function(r,e){var t=[][r];return!!t&&X1(function(){t.call(null,e||function(){throw 1},1)})}});var or=o((Mz,Ld)=>{var J1=C();var Z1=A();var da=V();var Q1=Object.defineProperty;var to={};var Md=function(r){throw r};Ld.exports=function(r,e){if(da(to,r))return to[r];if(!e)e={};var t=[][r];var n=da(e,"ACCESSORS")?e.ACCESSORS:false;var a=da(e,0)?e[0]:Md;var i=da(e,1)?e[1]:void 0;return to[r]=!!t&&!Z1(function(){if(n&&!J1)return true;var u={length:-1};if(n)Q1(u,1,{enumerable:true,get:Md});else u[1]=1;t.call(u,a,i)})}});var Cd=o(()=>{"use strict";var r_=d();var e_=Z().every;var t_=Gr();var n_=or();var a_=t_("every");var i_=n_("every");r_({target:"Array",proto:true,forced:!a_||!i_},{every:function r(e){return e_(this,e,arguments.length>1?arguments[1]:void 0)}})});var pa=o((jz,Dd)=>{"use strict";var u_=k();var jd=Qr();var o_=D();Dd.exports=function r(e){var t=u_(this);var n=o_(t.length);var a=arguments.length;var i=jd(a>1?arguments[1]:void 0,n);var u=a>2?arguments[2]:void 0;var f=u===void 0?n:jd(u,n);while(f>i)t[i++]=e;return t}});var Ud=o(()=>{var s_=d();var f_=pa();var v_=ae();s_({target:"Array",proto:true},{fill:f_});v_("fill")});var Nd=o(()=>{"use strict";var c_=d();var l_=Z().filter;var h_=Ze();var d_=or();var p_=h_("filter");var g_=d_("filter");c_({target:"Array",proto:true,forced:!p_||!g_},{filter:function r(e){return l_(this,e,arguments.length>1?arguments[1]:void 0)}})});var no=o(()=>{"use strict";var q_=d();var y_=Z().find;var m_=ae();var S_=or();var ga="find";var $d=true;var b_=S_(ga);if(ga in[])Array(1)[ga](function(){$d=false});q_({target:"Array",proto:true,forced:$d||!b_},{find:function r(e){return y_(this,e,arguments.length>1?arguments[1]:void 0)}});m_(ga)});var Gd=o(()=>{"use strict";var E_=d();var I_=Z().findIndex;var T_=ae();var A_=or();var qa="findIndex";var Bd=true;var w_=A_(qa);if(qa in[])Array(1)[qa](function(){Bd=false});E_({target:"Array",proto:true,forced:Bd||!w_},{findIndex:function r(e){return I_(this,e,arguments.length>1?arguments[1]:void 0)}});T_(qa)});var ao=o((Vz,kd)=>{"use strict";var O_=he();var x_=D();var R_=Br();var Hd=function(r,e,t,n,a,i,u,f){var s=a;var c=0;var l=u?R_(u,f,3):false;var v;while(c0&&O_(v)){s=Hd(r,e,v,x_(v.length),s,i-1)-1}else{if(s>=9007199254740991)throw TypeError("Exceed the acceptable array length");r[s]=v}s++}c++}return s};kd.exports=Hd});var Vd=o(()=>{"use strict";var P_=d();var __=ao();var F_=k();var M_=D();var L_=br();var C_=Je();P_({target:"Array",proto:true},{flat:function r(){var e=arguments.length?arguments[0]:void 0;var t=F_(this);var n=M_(t.length);var a=C_(t,0);a.length=__(a,t,t,n,0,e===void 0?1:L_(e));return a}})});var Wd=o(()=>{"use strict";var j_=d();var D_=ao();var U_=k();var N_=D();var $_=ur();var B_=Je();j_({target:"Array",proto:true},{flatMap:function r(e){var t=U_(this);var n=N_(t.length);var a;$_(e);a=B_(t,0);a.length=D_(a,t,t,n,0,1,e,arguments.length>1?arguments[1]:void 0);return a}})});var io=o((Xz,Kd)=>{"use strict";var G_=Z().forEach;var H_=Gr();var k_=or();var V_=H_("forEach");var W_=k_("forEach");Kd.exports=!V_||!W_?function r(e){return G_(this,e,arguments.length>1?arguments[1]:void 0)}:[].forEach});var Yd=o(()=>{"use strict";var K_=d();var zd=io();K_({target:"Array",proto:true,forced:[].forEach!=zd},{forEach:zd})});var Xd=o(()=>{"use strict";var z_=d();var Y_=Ye().includes;var X_=ae();var J_=or();var Z_=J_("indexOf",{ACCESSORS:true,1:0});z_({target:"Array",proto:true,forced:!Z_},{includes:function r(e){return Y_(this,e,arguments.length>1?arguments[1]:void 0)}});X_("includes")});var Qd=o(()=>{"use strict";var Q_=d();var rF=Ye().indexOf;var eF=Gr();var tF=or();var Zd=[].indexOf;var Jd=!!Zd&&1/[1].indexOf(1,-0)<0;var nF=eF("indexOf");var aF=tF("indexOf",{ACCESSORS:true,1:0});Q_({target:"Array",proto:true,forced:Jd||!nF||!aF},{indexOf:function r(e){return Jd?Zd.apply(this,arguments)||0:rF(this,e,arguments.length>1?arguments[1]:void 0)}})});var rp=o(()=>{"use strict";var iF=d();var uF=Ve();var oF=lr();var sF=Gr();var fF=[].join;var vF=uF!=Object;var cF=sF("join",",");iF({target:"Array",proto:true,forced:vF||!cF},{join:function r(e){return fF.call(oF(this),e===void 0?",":e)}})});var oo=o((i5,tp)=>{"use strict";var lF=lr();var hF=br();var dF=D();var pF=Gr();var gF=or();var qF=Math.min;var uo=[].lastIndexOf;var ep=!!uo&&1/[1].lastIndexOf(1,-0)<0;var yF=pF("lastIndexOf");var mF=gF("indexOf",{ACCESSORS:true,1:0});var SF=ep||!yF||!mF;tp.exports=SF?function r(e){if(ep)return uo.apply(this,arguments)||0;var t=lF(this);var n=dF(t.length);var a=n-1;if(arguments.length>1)a=qF(a,hF(arguments[1]));if(a<0)a=n+a;for(;a>=0;a--)if(a in t&&t[a]===e)return a||0;return-1}:uo});var ap=o(()=>{var bF=d();var np=oo();bF({target:"Array",proto:true,forced:np!==[].lastIndexOf},{lastIndexOf:np})});var so=o(()=>{"use strict";var EF=d();var IF=Z().map;var TF=Ze();var AF=or();var wF=TF("map");var OF=AF("map");EF({target:"Array",proto:true,forced:!wF||!OF},{map:function r(e){return IF(this,e,arguments.length>1?arguments[1]:void 0)}})});var Ht=o((v5,up)=>{var xF=ur();var RF=k();var PF=Ve();var _F=D();var ip=function(r){return function(e,t,n,a){xF(t);var i=RF(e);var u=PF(i);var f=_F(i.length);var s=r?f-1:0;var c=r?-1:1;if(n<2)while(true){if(s in u){a=u[s];s+=c;break}s+=c;if(r?s<0:f<=s){throw TypeError("Reduce of empty array with no initial value")}}for(;r?s>=0:f>s;s+=c)if(s in u){a=t(a,u[s],s,i)}return a}};up.exports={left:ip(false),right:ip(true)}});var op=o(()=>{"use strict";var FF=d();var MF=Ht().left;var LF=Gr();var CF=or();var jF=LF("reduce");var DF=CF("reduce",{1:0});FF({target:"Array",proto:true,forced:!jF||!DF},{reduce:function r(e){return MF(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})});var sp=o(()=>{"use strict";var UF=d();var NF=Ht().right;var $F=Gr();var BF=or();var GF=$F("reduceRight");var HF=BF("reduce",{1:0});UF({target:"Array",proto:true,forced:!GF||!HF},{reduceRight:function r(e){return NF(this,e,arguments.length,arguments.length>1?arguments[1]:void 0)}})});var vp=o(()=>{"use strict";var kF=d();var VF=he();var WF=[].reverse;var fp=[1,2];kF({target:"Array",proto:true,forced:String(fp)===String(fp.reverse())},{reverse:function r(){if(VF(this))this.length=this.length;return WF.call(this)}})});var hp=o(()=>{"use strict";var KF=d();var zF=F();var cp=he();var lp=Qr();var YF=D();var XF=lr();var JF=de();var ZF=j();var QF=Ze();var rM=or();var eM=QF("slice");var tM=rM("slice",{ACCESSORS:true,0:0,1:2});var nM=ZF("species");var aM=[].slice;var iM=Math.max;KF({target:"Array",proto:true,forced:!eM||!tM},{slice:function r(e,t){var n=XF(this);var a=YF(n.length);var i=lp(e,a);var u=lp(t===void 0?a:t,a);var f,s,c;if(cp(n)){f=n.constructor;if(typeof f=="function"&&(f===Array||cp(f.prototype))){f=void 0}else if(zF(f)){f=f[nM];if(f===null)f=void 0}if(f===Array||f===void 0){return aM.call(n,i,u)}}s=new(f===void 0?Array:f)(iM(u-i,0));for(c=0;i{"use strict";var uM=d();var oM=Z().some;var sM=Gr();var fM=or();var vM=sM("some");var cM=fM("some");uM({target:"Array",proto:true,forced:!vM||!cM},{some:function r(e){return oM(this,e,arguments.length>1?arguments[1]:void 0)}})});var yp=o(()=>{"use strict";var lM=d();var hM=ur();var pp=k();var qp=A();var dM=Gr();var fo=[];var gp=fo.sort;var pM=qp(function(){fo.sort(void 0)});var gM=qp(function(){fo.sort(null)});var qM=dM("sort");var yM=pM||!gM||!qM;lM({target:"Array",proto:true,forced:yM},{sort:function r(e){return e===void 0?gp.call(pp(this)):gp.call(pp(this),hM(e))}})});var mp=o(()=>{"use strict";var mM=d();var SM=Qr();var bM=br();var EM=D();var IM=k();var TM=Je();var AM=de();var wM=Ze();var OM=or();var xM=wM("splice");var RM=OM("splice",{ACCESSORS:true,0:0,1:2});var PM=Math.max;var _M=Math.min;var FM=9007199254740991;var MM="Maximum allowed length exceeded";mM({target:"Array",proto:true,forced:!xM||!RM},{splice:function r(e,t){var n=IM(this);var a=EM(n.length);var i=SM(e,a);var u=arguments.length;var f,s,c,l,v,h;if(u===0){f=s=0}else if(u===1){f=0;s=a-i}else{f=u-2;s=_M(PM(bM(t),0),a-i)}if(a+f-s>FM){throw TypeError(MM)}c=TM(n,s);for(l=0;la-s+f;l--)delete n[l-1]}else if(f>s){for(l=a-s;l>i;l--){v=l+s-1;h=l+f-1;if(v in n)n[h]=n[v];else delete n[h]}}for(l=0;l{"use strict";var LM=Sr();var CM=$();var jM=j();var DM=C();var Sp=jM("species");bp.exports=function(r){var e=LM(r);var t=CM.f;if(DM&&e&&!e[Sp]){t(e,Sp,{configurable:true,get:function(){return this}})}}});var Ep=o(()=>{var UM=_e();UM("Array")});var Ip=o(()=>{var NM=ae();NM("flat")});var Tp=o(()=>{var $M=ae();$M("flatMap")});var kt=o((F5,xp)=>{"use strict";var BM=lr();var vo=ae();var Ap=it();var wp=ar();var GM=ca();var Op="Array Iterator";var HM=wp.set;var kM=wp.getterFor(Op);xp.exports=GM(Array,"Array",function(r,e){HM(this,{type:Op,target:BM(r),index:0,kind:e})},function(){var r=kM(this);var e=r.target;var t=r.kind;var n=r.index++;if(!e||n>=e.length){r.target=void 0;return{value:void 0,done:true}}if(t=="keys")return{value:n,done:false};if(t=="values")return{value:e[n],done:false};return{value:[n,e[n]],done:false}},"values");Ap.Arguments=Ap.Array;vo("keys");vo("values");vo("entries")});var _p=o(()=>{var VM=d();var WM=Qr();var Rp=String.fromCharCode;var Pp=String.fromCodePoint;var KM=!!Pp&&Pp.length!=1;VM({target:"String",stat:true,forced:KM},{fromCodePoint:function r(e){var t=[];var n=arguments.length;var a=0;var i;while(n>a){i=+arguments[a++];if(WM(i,1114111)!==i)throw RangeError(i+" is not a valid code point");t.push(i<65536?Rp(i):Rp(((i-=65536)>>10)+55296,i%1024+56320))}return t.join("")}})});var Fp=o(()=>{var zM=d();var YM=lr();var XM=D();zM({target:"String",stat:true},{raw:function r(e){var t=YM(e.raw);var n=XM(t.length);var a=arguments.length;var i=[];var u=0;while(n>u){i.push(String(t[u++]));if(u{"use strict";var JM=d();var ZM=Ut().codeAt;JM({target:"String",proto:true},{codePointAt:function r(e){return ZM(this,e)}})});var Vt=o((N5,Lp)=>{var QM=F();var rL=mr();var eL=j();var tL=eL("match");Lp.exports=function(r){var e;return QM(r)&&((e=r[tL])!==void 0?!!e:rL(r)=="RegExp")}});var ya=o(($5,Cp)=>{var nL=Vt();Cp.exports=function(r){if(nL(r)){throw TypeError("The method doesn't accept regular expressions")}return r}});var ma=o((B5,jp)=>{var aL=j();var iL=aL("match");jp.exports=function(r){var e=/./;try{"/./"[r](e)}catch(t){try{e[iL]=false;return"/./"[r](e)}catch(n){}}return false}});var $p=o(()=>{"use strict";var uL=d();var oL=rr().f;var Dp=D();var sL=ya();var fL=tr();var vL=ma();var cL=Or();var Up="".endsWith;var lL=Math.min;var Np=vL("endsWith");var hL=!cL&&!Np&&!!function(){var r=oL(String.prototype,"endsWith");return r&&!r.writable}();uL({target:"String",proto:true,forced:!hL&&!Np},{endsWith:function r(e){var t=String(fL(this));sL(e);var n=arguments.length>1?arguments[1]:void 0;var a=Dp(t.length);var i=n===void 0?a:lL(Dp(n),a);var u=String(e);return Up?Up.call(t,u,i):t.slice(i-u.length,i)===u}})});var Bp=o(()=>{"use strict";var dL=d();var pL=ya();var gL=tr();var qL=ma();dL({target:"String",proto:true,forced:!qL("includes")},{includes:function r(e){return!!~String(gL(this)).indexOf(pL(e),arguments.length>1?arguments[1]:void 0)}})});var ft=o((W5,Gp)=>{"use strict";var yL=M();Gp.exports=function(){var r=yL(this);var e="";if(r.global)e+="g";if(r.ignoreCase)e+="i";if(r.multiline)e+="m";if(r.dotAll)e+="s";if(r.unicode)e+="u";if(r.sticky)e+="y";return e}});var Wt=o(co=>{"use strict";var Hp=A();function kp(r,e){return RegExp(r,e)}co.UNSUPPORTED_Y=Hp(function(){var r=kp("a","y");r.lastIndex=2;return r.exec("abcd")!=null});co.BROKEN_CARET=Hp(function(){var r=kp("^r","gy");r.lastIndex=2;return r.exec("str")!=null})});var Kt=o((z5,zp)=>{"use strict";var mL=ft();var Vp=Wt();var Sa=RegExp.prototype.exec;var SL=String.prototype.replace;var Wp=Sa;var lo=function(){var r=/a/;var e=/b*/g;Sa.call(r,"a");Sa.call(e,"a");return r.lastIndex!==0||e.lastIndex!==0}();var Kp=Vp.UNSUPPORTED_Y||Vp.BROKEN_CARET;var ho=/()??/.exec("")[1]!==void 0;var bL=lo||ho||Kp;if(bL){Wp=function r(e){var t=this;var n,a,i,u;var f=Kp&&t.sticky;var s=mL.call(t);var c=t.source;var l=0;var v=e;if(f){s=s.replace("y","");if(s.indexOf("g")===-1){s+="g"}v=String(e).slice(t.lastIndex);if(t.lastIndex>0&&(!t.multiline||t.multiline&&e[t.lastIndex-1]!=="\n")){c="(?: "+c+")";v=" "+v;l++}a=new RegExp("^(?:"+c+")",s)}if(ho){a=new RegExp("^"+c+"$(?!\\s)",s)}if(lo)n=t.lastIndex;i=Sa.call(f?a:t,v);if(f){if(i){i.input=i.input.slice(l);i[0]=i[0].slice(l);i.index=t.lastIndex;t.lastIndex+=i[0].length}else t.lastIndex=0}else if(lo&&i){t.lastIndex=t.global?i.index+i[0].length:n}if(ho&&i&&i.length>1){SL.call(i[0],a,function(){for(u=1;u{"use strict";var EL=d();var Yp=Kt();EL({target:"RegExp",proto:true,forced:/./.exec!==Yp},{exec:Yp})});var zt=o((J5,rg)=>{"use strict";ba();var Xp=er();var Ea=A();var po=j();var IL=Kt();var TL=nr();var AL=po("species");var wL=!Ea(function(){var r=/./;r.exec=function(){var e=[];e.groups={a:"7"};return e};return"".replace(r,"$")!=="7"});var Jp=function(){return"a".replace(/./,"$0")==="$0"}();var Zp=po("replace");var Qp=function(){if(/./[Zp]){return/./[Zp]("a","$0")===""}return false}();var OL=!Ea(function(){var r=/(?:)/;var e=r.exec;r.exec=function(){return e.apply(this,arguments)};var t="ab".split(r);return t.length!==2||t[0]!=="a"||t[1]!=="b"});rg.exports=function(r,e,t,n){var a=po(r);var i=!Ea(function(){var v={};v[a]=function(){return 7};return""[r](v)!=7});var u=i&&!Ea(function(){var v=false;var h=/a/;if(r==="split"){h={};h.constructor={};h.constructor[AL]=function(){return h};h.flags="";h[a]=/./[a]}h.exec=function(){v=true;return null};h[a]("");return!v});if(!i||!u||r==="replace"&&!(wL&&Jp&&!Qp)||r==="split"&&!OL){var f=/./[a];var s=t(a,""[r],function(v,h,I,m,q){if(h.exec===IL){if(i&&!q){return{done:true,value:f.call(h,I,m)}}return{done:true,value:v.call(I,h,m)}}return{done:false}},{REPLACE_KEEPS_$0:Jp,REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE:Qp});var c=s[0];var l=s[1];Xp(String.prototype,r,c);Xp(RegExp.prototype,a,e==2?function(v,h){return l.call(v,this,h)}:function(v){return l.call(v,this)})}if(n)TL(RegExp.prototype[a],"sham",true)}});var Yt=o((Z5,eg)=>{"use strict";var xL=Ut().charAt;eg.exports=function(r,e,t){return e+(t?xL(r,e).length:1)}});var Xt=o((Q5,tg)=>{var RL=mr();var PL=Kt();tg.exports=function(r,e){var t=r.exec;if(typeof t==="function"){var n=t.call(r,e);if(typeof n!=="object"){throw TypeError("RegExp exec method returned something other than an Object or null")}return n}if(RL(r)!=="RegExp"){throw TypeError("RegExp#exec called on incompatible receiver")}return PL.call(r,e)}});var ag=o(()=>{"use strict";var _L=zt();var FL=M();var ML=D();var LL=tr();var CL=Yt();var ng=Xt();_L("match",1,function(r,e,t){return[function n(a){var i=LL(this);var u=a==void 0?void 0:a[r];return u!==void 0?u.call(a,i):new RegExp(a)[r](String(i))},function(n){var a=t(e,n,this);if(a.done)return a.value;var i=FL(n);var u=String(this);if(!i.global)return ng(i,u);var f=i.unicode;i.lastIndex=0;var s=[];var c=0;var l;while((l=ng(i,u))!==null){var v=String(l[0]);s[c]=v;if(v==="")i.lastIndex=CL(u,ML(i.lastIndex),f);c++}return c===0?null:s}]})});var Hr=o((tY,ug)=>{var ig=M();var jL=ur();var DL=j();var UL=DL("species");ug.exports=function(r,e){var t=ig(r).constructor;var n;return t===void 0||(n=ig(t)[UL])==void 0?e:jL(n)}});var hg=o(()=>{"use strict";var NL=d();var $L=sa();var og=tr();var sg=D();var BL=ur();var GL=M();var HL=mr();var kL=Vt();var fg=ft();var VL=nr();var WL=A();var KL=j();var zL=Hr();var YL=Yt();var vg=ar();var qo=Or();var Ia=KL("matchAll");var cg="RegExp String";var lg=cg+" Iterator";var XL=vg.set;var JL=vg.getterFor(lg);var Jt=RegExp.prototype;var ZL=Jt.exec;var yo="".matchAll;var go=!!yo&&!WL(function(){"a".matchAll(/./)});var QL=function(r,e){var t=r.exec;var n;if(typeof t=="function"){n=t.call(r,e);if(typeof n!="object")throw TypeError("Incorrect exec result");return n}return ZL.call(r,e)};var rC=$L(function r(e,t,n,a){XL(this,{type:lg,regexp:e,string:t,global:n,unicode:a,done:false})},cg,function r(){var e=JL(this);if(e.done)return{value:void 0,done:true};var t=e.regexp;var n=e.string;var a=QL(t,n);if(a===null)return{value:void 0,done:e.done=true};if(e.global){if(String(a[0])=="")t.lastIndex=YL(n,sg(t.lastIndex),e.unicode);return{value:a,done:false}}e.done=true;return{value:a,done:false}});var mo=function(r){var e=GL(this);var t=String(r);var n,a,i,u,f,s;n=zL(e,RegExp);a=e.flags;if(a===void 0&&e instanceof RegExp&&!("flags"in Jt)){a=fg.call(e)}i=a===void 0?"":String(a);u=new n(n===RegExp?e.source:e,i);f=!!~i.indexOf("g");s=!!~i.indexOf("u");u.lastIndex=sg(e.lastIndex);return new rC(u,t,f,s)};NL({target:"String",proto:true,forced:go},{matchAll:function r(e){var t=og(this);var n,a,i,u;if(e!=null){if(kL(e)){n=String(og("flags"in Jt?e.flags:fg.call(e)));if(!~n.indexOf("g"))throw TypeError("`.matchAll` does not allow non-global regexes")}if(go)return yo.apply(t,arguments);i=e[Ia];if(i===void 0&&qo&&HL(e)=="RegExp")i=mo;if(i!=null)return BL(i).call(e,t)}else if(go)return yo.apply(t,arguments);a=String(t);u=new RegExp(e,"g");return qo?mo.call(u,a):u[Ia](a)}});qo||Ia in Jt||VL(Jt,Ia,mo)});var Ta=o((iY,dg)=>{"use strict";var eC=br();var tC=tr();dg.exports="".repeat||function r(e){var t=String(tC(this));var n="";var a=eC(e);if(a<0||a==Infinity)throw RangeError("Wrong number of repetitions");for(;a>0;(a>>>=1)&&(t+=t))if(a&1)n+=t;return n}});var Aa=o((uY,gg)=>{var nC=D();var aC=Ta();var iC=tr();var uC=Math.ceil;var pg=function(r){return function(e,t,n){var a=String(iC(e));var i=a.length;var u=n===void 0?" ":String(n);var f=nC(t);var s,c;if(f<=i||u=="")return a;s=f-i;c=aC.call(u,uC(s/u.length));if(c.length>s)c=c.slice(0,s);return r?a+c:c+a}};gg.exports={start:pg(false),end:pg(true)}});var So=o((oY,qg)=>{var oC=Mt();qg.exports=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(oC)});var yg=o(()=>{"use strict";var sC=d();var fC=Aa().end;var vC=So();sC({target:"String",proto:true,forced:vC},{padEnd:function r(e){return fC(this,e,arguments.length>1?arguments[1]:void 0)}})});var mg=o(()=>{"use strict";var cC=d();var lC=Aa().start;var hC=So();cC({target:"String",proto:true,forced:hC},{padStart:function r(e){return lC(this,e,arguments.length>1?arguments[1]:void 0)}})});var Sg=o(()=>{var dC=d();var pC=Ta();dC({target:"String",proto:true},{repeat:pC})});var bg=o(()=>{"use strict";var gC=zt();var qC=M();var yC=k();var mC=D();var SC=br();var bC=tr();var EC=Yt();var IC=Xt();var TC=Math.max;var AC=Math.min;var wC=Math.floor;var OC=/\$([$&'`]|\d\d?|<[^>]*>)/g;var xC=/\$([$&'`]|\d\d?)/g;var RC=function(r){return r===void 0?r:String(r)};gC("replace",2,function(r,e,t,n){var a=n.REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE;var i=n.REPLACE_KEEPS_$0;var u=a?"$":"$0";return[function s(c,l){var v=bC(this);var h=c==void 0?void 0:c[r];return h!==void 0?h.call(c,v,l):e.call(String(v),c,l)},function(s,c){if(!a&&i||typeof c==="string"&&c.indexOf(u)===-1){var l=t(e,s,this,c);if(l.done)return l.value}var v=qC(s);var h=String(this);var I=typeof c==="function";if(!I)c=String(c);var m=v.global;if(m){var q=v.unicode;v.lastIndex=0}var b=[];while(true){var T=IC(v,h);if(T===null)break;b.push(T);if(!m)break;var _=String(T[0]);if(_==="")v.lastIndex=EC(h,mC(v.lastIndex),q)}var O="";var K=0;for(var H=0;H=K){O+=h.slice(K,sr)+B;K=sr+N.length}}return O+h.slice(K)}];function f(s,c,l,v,h,I){var m=l+s.length;var q=v.length;var b=xC;if(h!==void 0){h=yC(h);b=OC}return e.call(I,b,function(T,_){var O;switch(_.charAt(0)){case"$":return"$";case"&":return s;case"`":return c.slice(0,l);case"'":return c.slice(m);case"<":O=h[_.slice(1,-1)];break;default:var K=+_;if(K===0)return T;if(K>q){var H=wC(K/10);if(H===0)return T;if(H<=q)return v[H-1]===void 0?_.charAt(1):v[H-1]+_.charAt(1);return T}O=v[K-1]}return O===void 0?"":O})}})});var Ig=o(()=>{"use strict";var PC=zt();var _C=M();var FC=tr();var Eg=Hu();var MC=Xt();PC("search",1,function(r,e,t){return[function n(a){var i=FC(this);var u=a==void 0?void 0:a[r];return u!==void 0?u.call(a,i):new RegExp(a)[r](String(i))},function(n){var a=t(e,n,this);if(a.done)return a.value;var i=_C(n);var u=String(this);var f=i.lastIndex;if(!Eg(f,0))i.lastIndex=0;var s=MC(i,u);if(!Eg(i.lastIndex,f))i.lastIndex=f;return s===null?-1:s.index}]})});var wg=o(()=>{"use strict";var LC=zt();var CC=Vt();var jC=M();var Tg=tr();var DC=Hr();var UC=Yt();var NC=D();var Ag=Xt();var $C=Kt();var BC=A();var GC=[].push;var HC=Math.min;var bo=4294967295;var vt=!BC(function(){return!RegExp(bo,"y")});LC("split",2,function(r,e,t){var n;if("abbc".split(/(b)*/)[1]=="c"||"test".split(/(?:)/,-1).length!=4||"ab".split(/(?:ab)*/).length!=2||".".split(/(.?)(.?)/).length!=4||".".split(/()()/).length>1||"".split(/.?/).length){n=function(a,i){var u=String(Tg(this));var f=i===void 0?bo:i>>>0;if(f===0)return[];if(a===void 0)return[u];if(!CC(a)){return e.call(u,a,f)}var s=[];var c=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(a.sticky?"y":"");var l=0;var v=new RegExp(a.source,c+"g");var h,I,m;while(h=$C.call(v,u)){I=v.lastIndex;if(I>l){s.push(u.slice(l,h.index));if(h.length>1&&h.index=f)break}if(v.lastIndex===h.index)v.lastIndex++}if(l===u.length){if(m||!v.test(""))s.push("")}else s.push(u.slice(l));return s.length>f?s.slice(0,f):s}}else if("0".split(void 0,0).length){n=function(a,i){return a===void 0&&i===0?[]:e.call(this,a,i)}}else n=e;return[function a(i,u){var f=Tg(this);var s=i==void 0?void 0:i[r];return s!==void 0?s.call(i,f,u):n.call(String(f),i,u)},function(a,i){var u=t(n,a,this,i,n!==e);if(u.done)return u.value;var f=jC(a);var s=String(this);var c=DC(f,RegExp);var l=f.unicode;var v=(f.ignoreCase?"i":"")+(f.multiline?"m":"")+(f.unicode?"u":"")+(vt?"y":"g");var h=new c(vt?f:"^(?:"+f.source+")",v);var I=i===void 0?bo:i>>>0;if(I===0)return[];if(s.length===0)return Ag(h,s)===null?[s]:[];var m=0;var q=0;var b=[];while(q{"use strict";var kC=d();var VC=rr().f;var WC=D();var KC=ya();var zC=tr();var YC=ma();var XC=Or();var Og="".startsWith;var JC=Math.min;var xg=YC("startsWith");var ZC=!XC&&!xg&&!!function(){var r=VC(String.prototype,"startsWith");return r&&!r.writable}();kC({target:"String",proto:true,forced:!ZC&&!xg},{startsWith:function r(e){var t=String(zC(this));KC(e);var n=WC(JC(arguments.length>1?arguments[1]:void 0,t.length));var a=String(e);return Og?Og.call(t,a,n):t.slice(n,n+a.length)===a}})});var Zt=o((EY,Pg)=>{Pg.exports=" \n\v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF"});var Fe=o((IY,_g)=>{var QC=tr();var rj=Zt();var wa="["+rj+"]";var ej=RegExp("^"+wa+wa+"*");var tj=RegExp(wa+wa+"*$");var Eo=function(r){return function(e){var t=String(QC(e));if(r&1)t=t.replace(ej,"");if(r&2)t=t.replace(tj,"");return t}};_g.exports={start:Eo(1),end:Eo(2),trim:Eo(3)}});var Oa=o((TY,Lg)=>{var nj=A();var Fg=Zt();var Mg="\u200B\x85\u180E";Lg.exports=function(r){return nj(function(){return!!Fg[r]()||Mg[r]()!=Mg||Fg[r].name!==r})}});var Cg=o(()=>{"use strict";var aj=d();var ij=Fe().trim;var uj=Oa();aj({target:"String",proto:true,forced:uj("trim")},{trim:function r(){return ij(this)}})});var Ug=o(()=>{"use strict";var oj=d();var sj=Fe().start;var fj=Oa();var Dg=fj("trimStart");var jg=Dg?function r(){return sj(this)}:"".trimStart;oj({target:"String",proto:true,forced:Dg},{trimStart:jg,trimLeft:jg})});var Bg=o(()=>{"use strict";var vj=d();var cj=Fe().end;var lj=Oa();var $g=lj("trimEnd");var Ng=$g?function r(){return cj(this)}:"".trimEnd;vj({target:"String",proto:true,forced:$g},{trimEnd:Ng,trimRight:Ng})});var pr=o((_Y,Gg)=>{var hj=tr();var dj=/"/g;Gg.exports=function(r,e,t,n){var a=String(hj(r));var i="<"+e;if(t!=="")i+=" "+t+'="'+String(n).replace(dj,""")+'"';return i+">"+a+""}});var gr=o((FY,Hg)=>{var pj=A();Hg.exports=function(r){return pj(function(){var e=""[r]('"');return e!==e.toLowerCase()||e.split('"').length>3})}});var kg=o(()=>{"use strict";var gj=d();var qj=pr();var yj=gr();gj({target:"String",proto:true,forced:yj("anchor")},{anchor:function r(e){return qj(this,"a","name",e)}})});var Vg=o(()=>{"use strict";var mj=d();var Sj=pr();var bj=gr();mj({target:"String",proto:true,forced:bj("big")},{big:function r(){return Sj(this,"big","","")}})});var Wg=o(()=>{"use strict";var Ej=d();var Ij=pr();var Tj=gr();Ej({target:"String",proto:true,forced:Tj("blink")},{blink:function r(){return Ij(this,"blink","","")}})});var Kg=o(()=>{"use strict";var Aj=d();var wj=pr();var Oj=gr();Aj({target:"String",proto:true,forced:Oj("bold")},{bold:function r(){return wj(this,"b","","")}})});var zg=o(()=>{"use strict";var xj=d();var Rj=pr();var Pj=gr();xj({target:"String",proto:true,forced:Pj("fixed")},{fixed:function r(){return Rj(this,"tt","","")}})});var Yg=o(()=>{"use strict";var _j=d();var Fj=pr();var Mj=gr();_j({target:"String",proto:true,forced:Mj("fontcolor")},{fontcolor:function r(e){return Fj(this,"font","color",e)}})});var Xg=o(()=>{"use strict";var Lj=d();var Cj=pr();var jj=gr();Lj({target:"String",proto:true,forced:jj("fontsize")},{fontsize:function r(e){return Cj(this,"font","size",e)}})});var Jg=o(()=>{"use strict";var Dj=d();var Uj=pr();var Nj=gr();Dj({target:"String",proto:true,forced:Nj("italics")},{italics:function r(){return Uj(this,"i","","")}})});var Zg=o(()=>{"use strict";var $j=d();var Bj=pr();var Gj=gr();$j({target:"String",proto:true,forced:Gj("link")},{link:function r(e){return Bj(this,"a","href",e)}})});var Qg=o(()=>{"use strict";var Hj=d();var kj=pr();var Vj=gr();Hj({target:"String",proto:true,forced:Vj("small")},{small:function r(){return kj(this,"small","","")}})});var rq=o(()=>{"use strict";var Wj=d();var Kj=pr();var zj=gr();Wj({target:"String",proto:true,forced:zj("strike")},{strike:function r(){return Kj(this,"strike","","")}})});var eq=o(()=>{"use strict";var Yj=d();var Xj=pr();var Jj=gr();Yj({target:"String",proto:true,forced:Jj("sub")},{sub:function r(){return Xj(this,"sub","","")}})});var tq=o(()=>{"use strict";var Zj=d();var Qj=pr();var rD=gr();Zj({target:"String",proto:true,forced:rD("sup")},{sup:function r(){return Qj(this,"sup","","")}})});var Qt=o((i7,aq)=>{var eD=F();var nq=ge();aq.exports=function(r,e,t){var n,a;if(nq&&typeof(n=e.constructor)=="function"&&n!==t&&eD(a=n.prototype)&&a!==t.prototype)nq(r,a);return r}});var oq=o(()=>{var tD=C();var uq=R();var nD=Xe();var aD=Qt();var iD=$().f;var uD=le().f;var oD=Vt();var sD=ft();var fD=Wt();var vD=er();var cD=A();var lD=ar().set;var hD=_e();var dD=j();var pD=dD("match");var Vr=uq.RegExp;var Io=Vr.prototype;var rn=/a/g;var To=/a/g;var Oo=new Vr(rn)!==rn;var xo=fD.UNSUPPORTED_Y;var gD=tD&&nD("RegExp",!Oo||xo||cD(function(){To[pD]=false;return Vr(rn)!=rn||Vr(To)==To||Vr(rn,"i")!="/a/i"}));if(gD){kr=function r(e,t){var n=this instanceof kr;var a=oD(e);var i=t===void 0;var u;if(!n&&a&&e.constructor===kr&&i){return e}if(Oo){if(a&&!i)e=e.source}else if(e instanceof kr){if(i)t=sD.call(e);e=e.source}if(xo){u=!!t&&t.indexOf("y")>-1;if(u)t=t.replace(/y/g,"")}var f=aD(Oo?new Vr(e,t):Vr(e,t),n?this:Io,kr);if(xo&&u)lD(f,{sticky:u});return f};iq=function(r){r in kr||iD(kr,r,{configurable:true,get:function(){return Vr[r]},set:function(e){Vr[r]=e}})};Ao=uD(Vr);wo=0;while(Ao.length>wo)iq(Ao[wo++]);Io.constructor=kr;kr.prototype=Io;vD(uq,"RegExp",kr)}var kr;var iq;var Ao;var wo;hD("RegExp")});var sq=o(()=>{var qD=C();var yD=$();var mD=ft();var SD=Wt().UNSUPPORTED_Y;if(qD&&(/./g.flags!="g"||SD)){yD.f(RegExp.prototype,"flags",{configurable:true,get:mD})}});var fq=o(()=>{var bD=C();var ED=Wt().UNSUPPORTED_Y;var ID=$().f;var TD=ar().get;var AD=RegExp.prototype;if(bD&&ED){ID(RegExp.prototype,"sticky",{configurable:true,get:function(){if(this===AD)return void 0;if(this instanceof RegExp){return!!TD(this).sticky}throw TypeError("Incompatible receiver, RegExp required")}})}});var vq=o(()=>{"use strict";ba();var wD=d();var OD=F();var xD=function(){var r=false;var e=/[ac]/;e.exec=function(){r=true;return/./.exec.apply(this,arguments)};return e.test("abc")===true&&r}();var RD=/./.test;wD({target:"RegExp",proto:true,forced:!xD},{test:function(r){if(typeof this.exec!=="function"){return RD.call(this,r)}var e=this.exec(r);if(e!==null&&!OD(e)){throw new Error("RegExp exec method returned something other than an Object or null")}return!!e}})});var hq=o(()=>{"use strict";var PD=er();var _D=M();var FD=A();var MD=ft();var Ro="toString";var cq=RegExp.prototype;var lq=cq[Ro];var LD=FD(function(){return lq.call({source:"a",flags:"b"})!="/a/b"});var CD=lq.name!=Ro;if(LD||CD){PD(RegExp.prototype,Ro,function r(){var e=_D(this);var t=String(e.source);var n=e.flags;var a=String(n===void 0&&e instanceof RegExp&&!("flags"in cq)?MD.call(e):n);return"/"+t+"/"+a},{unsafe:true})}});var Po=o((g7,pq)=>{var jD=R();var DD=Fe().trim;var dq=Zt();var xa=jD.parseInt;var UD=/^[+-]?0[Xx]/;var ND=xa(dq+"08")!==8||xa(dq+"0x16")!==22;pq.exports=ND?function r(e,t){var n=DD(String(e));return xa(n,t>>>0||(UD.test(n)?16:10))}:xa});var qq=o(()=>{var $D=d();var gq=Po();$D({global:true,forced:parseInt!=gq},{parseInt:gq})});var Fo=o((m7,yq)=>{var BD=R();var GD=Fe().trim;var HD=Zt();var _o=BD.parseFloat;var kD=1/_o(HD+"-0")!==-Infinity;yq.exports=kD?function r(e){var t=GD(String(e));var n=_o(t);return n===0&&t.charAt(0)=="-"?-0:n}:_o});var Sq=o(()=>{var VD=d();var mq=Fo();VD({global:true,forced:parseFloat!=mq},{parseFloat:mq})});var Aq=o(()=>{"use strict";var WD=C();var Iq=R();var KD=Xe();var zD=er();var bq=V();var Tq=mr();var YD=Qt();var XD=wr();var JD=A();var ZD=$r();var QD=le().f;var rU=rr().f;var eU=$().f;var tU=Fe().trim;var tn="Number";var me=Iq[tn];var Pa=me.prototype;var nU=Tq(ZD(Pa))==tn;var Eq=function(r){var e=XD(r,false);var t,n,a,i,u,f,s,c;if(typeof e=="string"&&e.length>2){e=tU(e);t=e.charCodeAt(0);if(t===43||t===45){n=e.charCodeAt(2);if(n===88||n===120)return NaN}else if(t===48){switch(e.charCodeAt(1)){case 66:case 98:a=2;i=49;break;case 79:case 111:a=8;i=55;break;default:return+e}u=e.slice(2);f=u.length;for(s=0;si)return NaN}return parseInt(u,a)}}return+e};if(KD(tn,!me(" 0o1")||!me("0b1")||me("+0x1"))){ye=function r(e){var t=arguments.length<1?0:e;var n=this;return n instanceof ye&&(nU?JD(function(){Pa.valueOf.call(n)}):Tq(n)!=tn)?YD(new me(Eq(t)),n,ye):Eq(t)};for(Mo=WD?QD(me):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),Ra=0;Mo.length>Ra;Ra++){if(bq(me,en=Mo[Ra])&&!bq(ye,en)){eU(ye,en,rU(me,en))}}ye.prototype=Pa;Pa.constructor=ye;zD(Iq,tn,ye)}var ye;var Mo;var Ra;var en});var wq=o(()=>{var aU=d();aU({target:"Number",stat:true},{EPSILON:Math.pow(2,-52)})});var xq=o((w7,Oq)=>{var iU=R();var uU=iU.isFinite;Oq.exports=Number.isFinite||function r(e){return typeof e=="number"&&uU(e)}});var Rq=o(()=>{var oU=d();var sU=xq();oU({target:"Number",stat:true},{isFinite:sU})});var Lo=o((R7,Pq)=>{var fU=F();var vU=Math.floor;Pq.exports=function r(e){return!fU(e)&&isFinite(e)&&vU(e)===e}});var _q=o(()=>{var cU=d();var lU=Lo();cU({target:"Number",stat:true},{isInteger:lU})});var Fq=o(()=>{var hU=d();hU({target:"Number",stat:true},{isNaN:function r(e){return e!=e}})});var Mq=o(()=>{var dU=d();var pU=Lo();var gU=Math.abs;dU({target:"Number",stat:true},{isSafeInteger:function r(e){return pU(e)&&gU(e)<=9007199254740991}})});var Lq=o(()=>{var qU=d();qU({target:"Number",stat:true},{MAX_SAFE_INTEGER:9007199254740991})});var Cq=o(()=>{var yU=d();yU({target:"Number",stat:true},{MIN_SAFE_INTEGER:-9007199254740991})});var Dq=o(()=>{var mU=d();var jq=Fo();mU({target:"Number",stat:true,forced:Number.parseFloat!=jq},{parseFloat:jq})});var Nq=o(()=>{var SU=d();var Uq=Po();SU({target:"Number",stat:true,forced:Number.parseInt!=Uq},{parseInt:Uq})});var Co=o((k7,$q)=>{var bU=mr();$q.exports=function(r){if(typeof r!="number"&&bU(r)!="Number"){throw TypeError("Incorrect invocation")}return+r}});var Hq=o(()=>{"use strict";var EU=d();var IU=br();var TU=Co();var jo=Ta();var AU=A();var Bq=1 .toFixed;var Gq=Math.floor;var ct=function(r,e,t){return e===0?t:e%2===1?ct(r,e-1,t*r):ct(r*r,e/2,t)};var wU=function(r){var e=0;var t=r;while(t>=4096){e+=12;t/=4096}while(t>=2){e+=1;t/=2}return e};var OU=Bq&&(8e-5 .toFixed(3)!=="0.000"||.9 .toFixed(0)!=="1"||1.255 .toFixed(2)!=="1.25"||1000000000000000100 .toFixed(0)!=="1000000000000000128")||!AU(function(){Bq.call({})});EU({target:"Number",proto:true,forced:OU},{toFixed:function r(e){var t=TU(this);var n=IU(e);var a=[0,0,0,0,0,0];var i="";var u="0";var f,s,c,l;var v=function(m,q){var b=-1;var T=q;while(++b<6){T+=m*a[b];a[b]=T%1e7;T=Gq(T/1e7)}};var h=function(m){var q=6;var b=0;while(--q>=0){b+=a[q];a[q]=Gq(b/m);b=b%m*1e7}};var I=function(){var m=6;var q="";while(--m>=0){if(q!==""||m===0||a[m]!==0){var b=String(a[m]);q=q===""?b:q+jo.call("0",7-b.length)+b}}return q};if(n<0||n>20)throw RangeError("Incorrect fraction digits");if(t!=t)return"NaN";if(t<=-1e21||t>=1e21)return String(t);if(t<0){i="-";t=-t}if(t>1e-21){f=wU(t*ct(2,69,1))-69;s=f<0?t*ct(2,-f,1):t/ct(2,f,1);s*=4503599627370496;f=52-f;if(f>0){v(0,s);c=n;while(c>=7){v(1e7,0);c-=7}v(ct(10,c,1),0);c=f-1;while(c>=23){h(1<<23);c-=23}h(1<0){l=u.length;u=i+(l<=n?"0."+jo.call("0",n-l)+u:u.slice(0,l-n)+"."+u.slice(l-n))}else{u=i+u}return u}})});var Wq=o(()=>{"use strict";var xU=d();var kq=A();var Vq=Co();var _a=1 .toPrecision;var RU=kq(function(){return _a.call(1,void 0)!=="1"})||!kq(function(){_a.call({})});xU({target:"Number",proto:true,forced:RU},{toPrecision:function r(e){return e===void 0?_a.call(Vq(this)):_a.call(Vq(this),e)}})});var Do=o((Y7,Kq)=>{var PU=Math.log;Kq.exports=Math.log1p||function r(e){return(e=+e)>-1e-8&&e<1e-8?e-e*e/2:PU(1+e)}});var Yq=o(()=>{var _U=d();var FU=Do();var Uo=Math.acosh;var MU=Math.log;var zq=Math.sqrt;var LU=Math.LN2;var CU=!Uo||Math.floor(Uo(Number.MAX_VALUE))!=710||Uo(Infinity)!=Infinity;_U({target:"Math",stat:true,forced:CU},{acosh:function r(e){return(e=+e)<1?NaN:e>9490626562425156e-8?MU(e)+LU:FU(e-1+zq(e-1)*zq(e+1))}})});var Zq=o(()=>{var jU=d();var Xq=Math.asinh;var DU=Math.log;var UU=Math.sqrt;function Jq(r){return!isFinite(r=+r)||r==0?r:r<0?-Jq(-r):DU(r+UU(r*r+1))}jU({target:"Math",stat:true,forced:!(Xq&&1/Xq(0)>0)},{asinh:Jq})});var ry=o(()=>{var NU=d();var Qq=Math.atanh;var $U=Math.log;NU({target:"Math",stat:true,forced:!(Qq&&1/Qq(-0)<0)},{atanh:function r(e){return(e=+e)==0?e:$U((1+e)/(1-e))/2}})});var Fa=o((tX,ey)=>{ey.exports=Math.sign||function r(e){return(e=+e)==0||e!=e?e:e<0?-1:1}});var ty=o(()=>{var BU=d();var GU=Fa();var HU=Math.abs;var kU=Math.pow;BU({target:"Math",stat:true},{cbrt:function r(e){return GU(e=+e)*kU(HU(e),1/3)}})});var ny=o(()=>{var VU=d();var WU=Math.floor;var KU=Math.log;var zU=Math.LOG2E;VU({target:"Math",stat:true},{clz32:function r(e){return(e>>>=0)?31-WU(KU(e+.5)*zU):32}})});var an=o((oX,ay)=>{var nn=Math.expm1;var YU=Math.exp;ay.exports=!nn||nn(10)>22025.465794806718||nn(10)<22025.465794806718||nn(-2e-17)!=-2e-17?function r(e){return(e=+e)==0?e:e>-1e-6&&e<1e-6?e+e*e/2:YU(e)-1}:nn});var uy=o(()=>{var XU=d();var JU=an();var iy=Math.cosh;var ZU=Math.abs;var No=Math.E;XU({target:"Math",stat:true,forced:!iy||iy(710)===Infinity},{cosh:function r(e){var t=JU(ZU(e)-1)+1;return(t+1/(t*No*No))*(No/2)}})});var sy=o(()=>{var QU=d();var oy=an();QU({target:"Math",stat:true,forced:oy!=Math.expm1},{expm1:oy})});var vy=o((lX,fy)=>{var rN=Fa();var eN=Math.abs;var La=Math.pow;var Bo=La(2,-52);var Ma=La(2,-23);var tN=La(2,127)*(2-Ma);var $o=La(2,-126);var nN=function(r){return r+1/Bo-1/Bo};fy.exports=Math.fround||function r(e){var t=eN(e);var n=rN(e);var a,i;if(t<$o)return n*nN(t/$o/Ma)*$o*Ma;a=(1+Ma/Bo)*t;i=a-(a-t);if(i>tN||i!=i)return n*Infinity;return n*i}});var cy=o(()=>{var aN=d();var iN=vy();aN({target:"Math",stat:true},{fround:iN})});var hy=o(()=>{var uN=d();var ly=Math.hypot;var oN=Math.abs;var sN=Math.sqrt;var fN=!!ly&&ly(Infinity,NaN)!==Infinity;uN({target:"Math",stat:true,forced:fN},{hypot:function r(e,t){var n=0;var a=0;var i=arguments.length;var u=0;var f,s;while(a0){s=f/u;n+=s*s}else n+=f}return u===Infinity?Infinity:u*sN(n)}})});var py=o(()=>{var vN=d();var cN=A();var dy=Math.imul;var lN=cN(function(){return dy(4294967295,5)!=-5||dy.length!=2});vN({target:"Math",stat:true,forced:lN},{imul:function r(e,t){var n=65535;var a=+e;var i=+t;var u=n&a;var f=n&i;return 0|u*f+((n&a>>>16)*f+u*(n&i>>>16)<<16>>>0)}})});var gy=o(()=>{var hN=d();var dN=Math.log;var pN=Math.LOG10E;hN({target:"Math",stat:true},{log10:function r(e){return dN(e)*pN}})});var qy=o(()=>{var gN=d();var qN=Do();gN({target:"Math",stat:true},{log1p:qN})});var yy=o(()=>{var yN=d();var mN=Math.log;var SN=Math.LN2;yN({target:"Math",stat:true},{log2:function r(e){return mN(e)/SN}})});var my=o(()=>{var bN=d();var EN=Fa();bN({target:"Math",stat:true},{sign:EN})});var Ey=o(()=>{var IN=d();var TN=A();var Sy=an();var AN=Math.abs;var by=Math.exp;var wN=Math.E;var ON=TN(function(){return Math.sinh(-2e-17)!=-2e-17});IN({target:"Math",stat:true,forced:ON},{sinh:function r(e){return AN(e=+e)<1?(Sy(e)-Sy(-e))/2:(by(e-1)-by(-e-1))*(wN/2)}})});var Ay=o(()=>{var xN=d();var Iy=an();var Ty=Math.exp;xN({target:"Math",stat:true},{tanh:function r(e){var t=Iy(e=+e);var n=Iy(-e);return t==Infinity?1:n==Infinity?-1:(t-n)/(Ty(e)+Ty(-e))}})});var wy=o(()=>{var RN=d();var PN=Math.ceil;var _N=Math.floor;RN({target:"Math",stat:true},{trunc:function r(e){return(e>0?_N:PN)(e)}})});var Oy=o(()=>{var FN=d();FN({target:"Date",stat:true},{now:function r(){return new Date().getTime()}})});var xy=o(()=>{"use strict";var MN=d();var LN=A();var CN=k();var jN=wr();var DN=LN(function(){return new Date(NaN).toJSON()!==null||Date.prototype.toJSON.call({toISOString:function(){return 1}})!==1});MN({target:"Date",proto:true,forced:DN},{toJSON:function r(e){var t=CN(this);var n=jN(t);return typeof n=="number"&&!isFinite(n)?null:t.toISOString()}})});var Fy=o((DX,_y)=>{"use strict";var Ry=A();var Me=Aa().start;var UN=Math.abs;var Py=Date.prototype;var NN=Py.getTime;var Go=Py.toISOString;_y.exports=Ry(function(){return Go.call(new Date(-5e13-1))!="0385-07-25T07:06:39.999Z"})||!Ry(function(){Go.call(new Date(NaN))})?function r(){if(!isFinite(NN.call(this)))throw RangeError("Invalid time value");var e=this;var t=e.getUTCFullYear();var n=e.getUTCMilliseconds();var a=t<0?"-":t>9999?"+":"";return a+Me(UN(t),a?6:4,0)+"-"+Me(e.getUTCMonth()+1,2,0)+"-"+Me(e.getUTCDate(),2,0)+"T"+Me(e.getUTCHours(),2,0)+":"+Me(e.getUTCMinutes(),2,0)+":"+Me(e.getUTCSeconds(),2,0)+"."+Me(n,3,0)+"Z"}:Go});var Ly=o(()=>{var $N=d();var My=Fy();$N({target:"Date",proto:true,forced:Date.prototype.toISOString!==My},{toISOString:My})});var Dy=o(()=>{var BN=er();var Ho=Date.prototype;var Cy="Invalid Date";var jy="toString";var GN=Ho[jy];var HN=Ho.getTime;if(new Date(NaN)+""!=Cy){BN(Ho,jy,function r(){var e=HN.call(this);return e===e?GN.call(this):Cy})}});var Ny=o((GX,Uy)=>{"use strict";var kN=M();var VN=wr();Uy.exports=function(r){if(r!=="string"&&r!=="number"&&r!=="default"){throw TypeError("Incorrect hint")}return VN(kN(this),r!=="number")}});var Gy=o(()=>{var WN=nr();var KN=Ny();var zN=j();var $y=zN("toPrimitive");var By=Date.prototype;if(!($y in By)){WN(By,$y,KN)}});var Vy=o(()=>{var YN=d();var XN=Sr();var JN=A();var Ca=XN("JSON","stringify");var ZN=/[\uD800-\uDFFF]/g;var Hy=/^[\uD800-\uDBFF]$/;var ky=/^[\uDC00-\uDFFF]$/;var QN=function(r,e,t){var n=t.charAt(e-1);var a=t.charAt(e+1);if(Hy.test(r)&&!ky.test(a)||ky.test(r)&&!Hy.test(n)){return"\\u"+r.charCodeAt(0).toString(16)}return r};var r2=JN(function(){return Ca("\uDF06\uD834")!=='"\\udf06\\ud834"'||Ca("\uDEAD")!=='"\\udead"'});if(Ca){YN({target:"JSON",stat:true,forced:r2},{stringify:function r(e,t,n){var a=Ca.apply(null,arguments);return typeof a=="string"?a.replace(ZN,QN):a}})}});var ko=o((KX,Wy)=>{var e2=R();Wy.exports=e2.Promise});var Le=o((zX,Ky)=>{var t2=er();Ky.exports=function(r,e,t){for(var n in e)t2(r,n,e[n],t);return r}});var ie=o((YX,zy)=>{zy.exports=function(r,e,t){if(!(r instanceof e)){throw TypeError("Incorrect "+(t?t+" ":"")+"invocation")}return r}});var Vo=o((XX,Yy)=>{var n2=Mt();Yy.exports=/(iphone|ipod|ipad).*applewebkit/i.test(n2)});var ja=o((JX,nm)=>{var Wr=R();var a2=A();var i2=mr();var u2=Br();var Xy=$i();var Jy=Nn();var o2=Vo();var Jo=Wr.location;var Zo=Wr.setImmediate;var Qo=Wr.clearImmediate;var Zy=Wr.process;var Qy=Wr.MessageChannel;var Wo=Wr.Dispatch;var Ko=0;var un={};var rm="onreadystatechange";var Ce;var zo;var Yo;var rs=function(r){if(un.hasOwnProperty(r)){var e=un[r];delete un[r];e()}};var Xo=function(r){return function(){rs(r)}};var em=function(r){rs(r.data)};var tm=function(r){Wr.postMessage(r+"",Jo.protocol+"//"+Jo.host)};if(!Zo||!Qo){Zo=function r(e){var t=[];var n=1;while(arguments.length>n)t.push(arguments[n++]);un[++Ko]=function(){(typeof e=="function"?e:Function(e)).apply(void 0,t)};Ce(Ko);return Ko};Qo=function r(e){delete un[e]};if(i2(Zy)=="process"){Ce=function(r){Zy.nextTick(Xo(r))}}else if(Wo&&Wo.now){Ce=function(r){Wo.now(Xo(r))}}else if(Qy&&!o2){zo=new Qy;Yo=zo.port2;zo.port1.onmessage=em;Ce=u2(Yo.postMessage,Yo,1)}else if(Wr.addEventListener&&typeof postMessage=="function"&&!Wr.importScripts&&!a2(tm)&&Jo.protocol!=="file:"){Ce=tm;Wr.addEventListener("message",em,false)}else if(rm in Jy("script")){Ce=function(r){Xy.appendChild(Jy("script"))[rm]=function(){Xy.removeChild(this);rs(r)}}}else{Ce=function(r){setTimeout(Xo(r),0)}}}nm.exports={set:Zo,clear:Qo}});var us=o((ZX,fm)=>{var ht=R();var s2=rr().f;var f2=mr();var v2=ja().set;var c2=Vo();var am=ht.MutationObserver||ht.WebKitMutationObserver;var is=ht.process;var es=ht.Promise;var im=f2(is)=="process";var um=s2(ht,"queueMicrotask");var sm=um&&um.value;var on;var je;var sn;var lt;var ts;var ns;var as;var om;if(!sm){on=function(){var r,e;if(im&&(r=is.domain))r.exit();while(je){e=je.fn;je=je.next;try{e()}catch(t){if(je)lt();else sn=void 0;throw t}}sn=void 0;if(r)r.enter()};if(im){lt=function(){is.nextTick(on)}}else if(am&&!c2){ts=true;ns=document.createTextNode("");new am(on).observe(ns,{characterData:true});lt=function(){ns.data=ts=!ts}}else if(es&&es.resolve){as=es.resolve(void 0);om=as.then;lt=function(){om.call(as,on)}}else{lt=function(){v2.call(ht,on)}}}fm.exports=sm||function(r){var e={fn:r,next:void 0};if(sn)sn.next=e;if(!je){je=e;lt()}sn=e}});var Da=o((QX,cm)=>{"use strict";var vm=ur();var l2=function(r){var e,t;this.promise=new r(function(n,a){if(e!==void 0||t!==void 0)throw TypeError("Bad Promise constructor");e=n;t=a});this.resolve=vm(e);this.reject=vm(t)};cm.exports.f=function(r){return new l2(r)}});var os=o((r9,lm)=>{var h2=M();var d2=F();var p2=Da();lm.exports=function(r,e){h2(r);if(d2(e)&&e.constructor===r)return e;var t=p2.f(r);var n=t.resolve;n(e);return t.promise}});var dm=o((e9,hm)=>{var g2=R();hm.exports=function(r,e){var t=g2.console;if(t&&t.error){arguments.length===1?t.error(r):t.error(r,e)}}});var ss=o((t9,pm)=>{pm.exports=function(r){try{return{error:false,value:r()}}catch(e){return{error:true,value:e}}}});var Cm=o(()=>{"use strict";var vn=d();var $a=Or();var ue=R();var Tm=Sr();var Na=ko();var q2=er();var y2=Le();var m2=Fr();var S2=_e();var b2=F();var fs=ur();var E2=ie();var I2=mr();var T2=Bn();var gm=Pe();var A2=$t();var w2=Hr();var Am=ja().set;var wm=us();var Om=os();var O2=dm();var xm=Da();var vs=ss();var hs=ar();var x2=Xe();var R2=j();var qm=Jn();var P2=R2("species");var Kr="Promise";var ym=hs.get;var _2=hs.set;var F2=hs.getterFor(Kr);var ir=Na;var Rm=ue.TypeError;var cs=ue.document;var Ba=ue.process;var mm=Tm("fetch");var gt=xm.f;var M2=gt;var fn=I2(Ba)=="process";var L2=!!(cs&&cs.createEvent&&ue.dispatchEvent);var Pm="unhandledrejection";var C2="rejectionhandled";var Sm=0;var _m=1;var j2=2;var ds=1;var Fm=2;var Ua;var bm;var ps;var Em;var cn=x2(Kr,function(){var r=T2(ir)!==String(ir);if(!r){if(qm===66)return true;if(!fn&&typeof PromiseRejectionEvent!="function")return true}if($a&&!ir.prototype["finally"])return true;if(qm>=51&&/native code/.test(ir))return false;var e=ir.resolve(1);var t=function(a){a(function(){},function(){})};var n=e.constructor={};n[P2]=t;return!(e.then(function(){})instanceof t)});var D2=cn||!A2(function(r){ir.all(r)["catch"](function(){})});var Mm=function(r){var e;return b2(r)&&typeof(e=r.then)=="function"?e:false};var gs=function(r,e,t){if(e.notified)return;e.notified=true;var n=e.reactions;wm(function(){var a=e.value;var i=e.state==_m;var u=0;while(n.length>u){var f=n[u++];var s=i?f.ok:f.fail;var c=f.resolve;var l=f.reject;var v=f.domain;var h,I,m;try{if(s){if(!i){if(e.rejection===Fm)N2(r,e);e.rejection=ds}if(s===true)h=a;else{if(v)v.enter();h=s(a);if(v){v.exit();m=true}}if(h===f.promise){l(Rm("Promise-chain cycle"))}else if(I=Mm(h)){I.call(h,c,l)}else c(h)}else l(a)}catch(q){if(v&&!m)v.exit();l(q)}}e.reactions=[];e.notified=false;if(t&&!e.rejection)U2(r,e)})};var Lm=function(r,e,t){var n,a;if(L2){n=cs.createEvent("Event");n.promise=e;n.reason=t;n.initEvent(r,false,true);ue.dispatchEvent(n)}else n={promise:e,reason:t};if(a=ue["on"+r])a(n);else if(r===Pm)O2("Unhandled promise rejection",t)};var U2=function(r,e){Am.call(ue,function(){var t=e.value;var n=Im(e);var a;if(n){a=vs(function(){if(fn){Ba.emit("unhandledRejection",t,r)}else Lm(Pm,r,t)});e.rejection=fn||Im(e)?Fm:ds;if(a.error)throw a.value}})};var Im=function(r){return r.rejection!==ds&&!r.parent};var N2=function(r,e){Am.call(ue,function(){if(fn){Ba.emit("rejectionHandled",r)}else Lm(C2,r,e.value)})};var dt=function(r,e,t,n){return function(a){r(e,t,a,n)}};var pt=function(r,e,t,n){if(e.done)return;e.done=true;if(n)e=n;e.value=t;e.state=j2;gs(r,e,true)};var ls=function(r,e,t,n){if(e.done)return;e.done=true;if(n)e=n;try{if(r===t)throw Rm("Promise can't be resolved itself");var a=Mm(t);if(a){wm(function(){var i={done:false};try{a.call(t,dt(ls,r,i,e),dt(pt,r,i,e))}catch(u){pt(r,i,u,e)}})}else{e.value=t;e.state=_m;gs(r,e,false)}}catch(i){pt(r,{done:false},i,e)}};if(cn){ir=function r(e){E2(this,ir,Kr);fs(e);Ua.call(this);var t=ym(this);try{e(dt(ls,this,t),dt(pt,this,t))}catch(n){pt(this,t,n)}};Ua=function r(e){_2(this,{type:Kr,done:false,notified:false,parent:false,reactions:[],rejection:false,state:Sm,value:void 0})};Ua.prototype=y2(ir.prototype,{then:function r(e,t){var n=F2(this);var a=gt(w2(this,ir));a.ok=typeof e=="function"?e:true;a.fail=typeof t=="function"&&t;a.domain=fn?Ba.domain:void 0;n.parent=true;n.reactions.push(a);if(n.state!=Sm)gs(this,n,false);return a.promise},"catch":function(r){return this.then(void 0,r)}});bm=function(){var r=new Ua;var e=ym(r);this.promise=r;this.resolve=dt(ls,r,e);this.reject=dt(pt,r,e)};xm.f=gt=function(r){return r===ir||r===ps?new bm(r):M2(r)};if(!$a&&typeof Na=="function"){Em=Na.prototype.then;q2(Na.prototype,"then",function r(e,t){var n=this;return new ir(function(a,i){Em.call(n,a,i)}).then(e,t)},{unsafe:true});if(typeof mm=="function")vn({global:true,enumerable:true,forced:true},{fetch:function r(e){return Om(ir,mm.apply(ue,arguments))}})}}vn({global:true,wrap:true,forced:cn},{Promise:ir});m2(ir,Kr,false,true);S2(Kr);ps=Tm(Kr);vn({target:Kr,stat:true,forced:cn},{reject:function r(e){var t=gt(this);t.reject.call(void 0,e);return t.promise}});vn({target:Kr,stat:true,forced:$a||cn},{resolve:function r(e){return Om($a&&this===ps?ir:this,e)}});vn({target:Kr,stat:true,forced:D2},{all:function r(e){var t=this;var n=gt(t);var a=n.resolve;var i=n.reject;var u=vs(function(){var f=fs(t.resolve);var s=[];var c=0;var l=1;gm(e,function(v){var h=c++;var I=false;s.push(void 0);l++;f.call(t,v).then(function(m){if(I)return;I=true;s[h]=m;--l||a(s)},i)});--l||a(s)});if(u.error)i(u.value);return n.promise},race:function r(e){var t=this;var n=gt(t);var a=n.reject;var i=vs(function(){var u=fs(t.resolve);gm(e,function(f){u.call(t,f).then(n.resolve,a)})});if(i.error)a(i.value);return n.promise}})});var jm=o(()=>{"use strict";var $2=d();var B2=ur();var G2=Da();var H2=ss();var k2=Pe();$2({target:"Promise",stat:true},{allSettled:function r(e){var t=this;var n=G2.f(t);var a=n.resolve;var i=n.reject;var u=H2(function(){var f=B2(t.resolve);var s=[];var c=0;var l=1;k2(e,function(v){var h=c++;var I=false;s.push(void 0);l++;f.call(t,v).then(function(m){if(I)return;I=true;s[h]={status:"fulfilled",value:m};--l||a(s)},function(m){if(I)return;I=true;s[h]={status:"rejected",reason:m};--l||a(s)})});--l||a(s)});if(u.error)i(u.value);return n.promise}})});var Nm=o(()=>{"use strict";var V2=d();var W2=Or();var ln=ko();var K2=A();var Um=Sr();var z2=Hr();var Dm=os();var Y2=er();var X2=!!ln&&K2(function(){ln.prototype["finally"].call({then:function(){}},function(){})});V2({target:"Promise",proto:true,real:true,forced:X2},{"finally":function(r){var e=z2(this,Um("Promise"));var t=typeof r=="function";return this.then(t?function(n){return Dm(e,r()).then(function(){return n})}:r,t?function(n){return Dm(e,r()).then(function(){throw n})}:r)}});if(!W2&&typeof ln=="function"&&!ln.prototype["finally"]){Y2(ln.prototype,"finally",Um("Promise").prototype["finally"])}});var hn=o((f9,Bm)=>{"use strict";var J2=d();var Z2=R();var $m=Xe();var Q2=er();var r$=qe();var e$=Pe();var t$=ie();var qs=F();var ys=A();var n$=$t();var a$=Fr();var i$=Qt();Bm.exports=function(r,e,t){var n=r.indexOf("Map")!==-1;var a=r.indexOf("Weak")!==-1;var i=n?"set":"add";var u=Z2[r];var f=u&&u.prototype;var s=u;var c={};var l=function(b){var T=f[b];Q2(f,b,b=="add"?function _(O){T.call(this,O===0?0:O);return this}:b=="delete"?function(_){return a&&!qs(_)?false:T.call(this,_===0?0:_)}:b=="get"?function _(O){return a&&!qs(O)?void 0:T.call(this,O===0?0:O)}:b=="has"?function _(O){return a&&!qs(O)?false:T.call(this,O===0?0:O)}:function _(O,K){T.call(this,O===0?0:O,K);return this})};if($m(r,typeof u!="function"||!(a||f.forEach&&!ys(function(){new u().entries().next()})))){s=t.getConstructor(e,r,n,i);r$.REQUIRED=true}else if($m(r,true)){var v=new s;var h=v[i](a?{}:-0,1)!=v;var I=ys(function(){v.has(1)});var m=n$(function(b){new u(b)});var q=!a&&ys(function(){var b=new u;var T=5;while(T--)b[i](T,T);return!b.has(-0)});if(!m){s=e(function(b,T){t$(b,s,r);var _=i$(new u,b,s);if(T!=void 0)e$(T,_[i],_,n);return _});s.prototype=f;f.constructor=s}if(I||q){l("delete");l("has");n&&l("get")}if(q||h)l(i);if(a&&f.clear)delete f.clear}c[r]=s;J2({global:true,forced:s!=u},c);a$(s,r);if(!a)t.setStrong(s,r,n);return s}});var Ss=o((v9,Wm)=>{"use strict";var u$=$().f;var o$=$r();var Gm=Le();var s$=Br();var f$=ie();var v$=Pe();var c$=ca();var l$=_e();var dn=C();var Hm=qe().fastKey;var Vm=ar();var km=Vm.set;var ms=Vm.getterFor;Wm.exports={getConstructor:function(r,e,t,n){var a=r(function(s,c){f$(s,a,e);km(s,{type:e,index:o$(null),first:void 0,last:void 0,size:0});if(!dn)s.size=0;if(c!=void 0)v$(c,s[n],s,t)});var i=ms(e);var u=function(s,c,l){var v=i(s);var h=f(s,c);var I,m;if(h){h.value=l}else{v.last=h={index:m=Hm(c,true),key:c,value:l,previous:I=v.last,next:void 0,removed:false};if(!v.first)v.first=h;if(I)I.next=h;if(dn)v.size++;else s.size++;if(m!=="F")v.index[m]=h}return s};var f=function(s,c){var l=i(s);var v=Hm(c);var h;if(v!=="F")return l.index[v];for(h=l.first;h;h=h.next){if(h.key==c)return h}};Gm(a.prototype,{clear:function s(){var c=this;var l=i(c);var v=l.index;var h=l.first;while(h){h.removed=true;if(h.previous)h.previous=h.previous.next=void 0;delete v[h.index];h=h.next}l.first=l.last=void 0;if(dn)l.size=0;else c.size=0},"delete":function(s){var c=this;var l=i(c);var v=f(c,s);if(v){var h=v.next;var I=v.previous;delete l.index[v.index];v.removed=true;if(I)I.next=h;if(h)h.previous=I;if(l.first==v)l.first=h;if(l.last==v)l.last=I;if(dn)l.size--;else c.size--}return!!v},forEach:function s(c){var l=i(this);var v=s$(c,arguments.length>1?arguments[1]:void 0,3);var h;while(h=h?h.next:l.first){v(h.value,h.key,this);while(h&&h.removed)h=h.previous}},has:function s(c){return!!f(this,c)}});Gm(a.prototype,t?{get:function s(c){var l=f(this,c);return l&&l.value},set:function s(c,l){return u(this,c===0?0:c,l)}}:{add:function s(c){return u(this,c=c===0?0:c,c)}});if(dn)u$(a.prototype,"size",{get:function(){return i(this).size}});return a},setStrong:function(r,e,t){var n=e+" Iterator";var a=ms(e);var i=ms(n);c$(r,e,function(u,f){km(this,{type:n,target:u,state:a(u),kind:f,last:void 0})},function(){var u=i(this);var f=u.kind;var s=u.last;while(s&&s.removed)s=s.previous;if(!u.target||!(u.last=s=s?s.next:u.state.first)){u.target=void 0;return{value:void 0,done:true}}if(f=="keys")return{value:s.key,done:false};if(f=="values")return{value:s.value,done:false};return{value:[s.key,s.value],done:false}},t?"entries":"values",!t,true);l$(e)}}});var zm=o((c9,Km)=>{"use strict";var h$=hn();var d$=Ss();Km.exports=h$("Map",function(r){return function e(){return r(this,arguments.length?arguments[0]:void 0)}},d$)});var Xm=o((l9,Ym)=>{"use strict";var p$=hn();var g$=Ss();Ym.exports=p$("Set",function(r){return function e(){return r(this,arguments.length?arguments[0]:void 0)}},g$)});var Is=o((h9,tS)=>{"use strict";var Jm=Le();var Ga=qe().getWeakData;var q$=M();var bs=F();var y$=ie();var m$=Pe();var Qm=Z();var Zm=V();var rS=ar();var S$=rS.set;var b$=rS.getterFor;var E$=Qm.find;var I$=Qm.findIndex;var T$=0;var Ha=function(r){return r.frozen||(r.frozen=new eS)};var eS=function(){this.entries=[]};var Es=function(r,e){return E$(r.entries,function(t){return t[0]===e})};eS.prototype={get:function(r){var e=Es(this,r);if(e)return e[1]},has:function(r){return!!Es(this,r)},set:function(r,e){var t=Es(this,r);if(t)t[1]=e;else this.entries.push([r,e])},"delete":function(r){var e=I$(this.entries,function(t){return t[0]===r});if(~e)this.entries.splice(e,1);return!!~e}};tS.exports={getConstructor:function(r,e,t,n){var a=r(function(f,s){y$(f,a,e);S$(f,{type:e,id:T$++,frozen:void 0});if(s!=void 0)m$(s,f[n],f,t)});var i=b$(e);var u=function(f,s,c){var l=i(f);var v=Ga(q$(s),true);if(v===true)Ha(l).set(s,c);else v[l.id]=c;return f};Jm(a.prototype,{"delete":function(f){var s=i(this);if(!bs(f))return false;var c=Ga(f);if(c===true)return Ha(s)["delete"](f);return c&&Zm(c,s.id)&&delete c[s.id]},has:function f(s){var c=i(this);if(!bs(s))return false;var l=Ga(s);if(l===true)return Ha(c).has(s);return l&&Zm(l,c.id)}});Jm(a.prototype,t?{get:function f(s){var c=i(this);if(bs(s)){var l=Ga(s);if(l===true)return Ha(c).get(s);return l?l[c.id]:void 0}},set:function f(s,c){return u(this,s,c)}}:{add:function f(s){return u(this,s,true)}});return a}}});var oS=o((d9,uS)=>{"use strict";var nS=R();var A$=Le();var w$=qe();var O$=hn();var aS=Is();var ka=F();var Va=ar().enforce;var x$=Ri();var R$=!nS.ActiveXObject&&"ActiveXObject"in nS;var Wa=Object.isExtensible;var pn;var iS=function(r){return function e(){return r(this,arguments.length?arguments[0]:void 0)}};var P$=uS.exports=O$("WeakMap",iS,aS);if(x$&&R$){pn=aS.getConstructor(iS,"WeakMap",true);w$.REQUIRED=true;qt=P$.prototype;Ts=qt["delete"];gn=qt.has;As=qt.get;ws=qt.set;A$(qt,{"delete":function(r){if(ka(r)&&!Wa(r)){var e=Va(this);if(!e.frozen)e.frozen=new pn;return Ts.call(this,r)||e.frozen["delete"](r)}return Ts.call(this,r)},has:function r(e){if(ka(e)&&!Wa(e)){var t=Va(this);if(!t.frozen)t.frozen=new pn;return gn.call(this,e)||t.frozen.has(e)}return gn.call(this,e)},get:function r(e){if(ka(e)&&!Wa(e)){var t=Va(this);if(!t.frozen)t.frozen=new pn;return gn.call(this,e)?As.call(this,e):t.frozen.get(e)}return As.call(this,e)},set:function r(e,t){if(ka(e)&&!Wa(e)){var n=Va(this);if(!n.frozen)n.frozen=new pn;gn.call(this,e)?ws.call(this,e,t):n.frozen.set(e,t)}else ws.call(this,e,t);return this}})}var qt;var Ts;var gn;var As;var ws});var sS=o(()=>{"use strict";var _$=hn();var F$=Is();_$("WeakSet",function(r){return function e(){return r(this,arguments.length?arguments[0]:void 0)}},F$)});var Ka=o((q9,fS)=>{fS.exports=typeof ArrayBuffer!=="undefined"&&typeof DataView!=="undefined"});var Os=o((y9,vS)=>{var M$=br();var L$=D();vS.exports=function(r){if(r===void 0)return 0;var e=M$(r);var t=L$(e);if(e!==t)throw RangeError("Wrong length or index");return t}});var lS=o((m9,cS)=>{var xs=1/0;var C$=Math.abs;var oe=Math.pow;var j$=Math.floor;var D$=Math.log;var U$=Math.LN2;var N$=function(r,e,t){var n=new Array(t);var a=t*8-e-1;var i=(1<>1;var f=e===23?oe(2,-24)-oe(2,-77):0;var s=r<0||r===0&&1/r<0?1:0;var c=0;var l,v,h;r=C$(r);if(r!=r||r===xs){v=r!=r?1:0;l=i}else{l=j$(D$(r)/U$);if(r*(h=oe(2,-l))<1){l--;h*=2}if(l+u>=1){r+=f/h}else{r+=f*oe(2,1-u)}if(r*h>=2){l++;h/=2}if(l+u>=i){v=0;l=i}else if(l+u>=1){v=(r*h-1)*oe(2,e);l=l+u}else{v=r*oe(2,u-1)*oe(2,e);l=0}}for(;e>=8;n[c++]=v&255,v/=256,e-=8);l=l<0;n[c++]=l&255,l/=256,a-=8);n[--c]|=s*128;return n};var $$=function(r,e){var t=r.length;var n=t*8-e-1;var a=(1<>1;var u=n-7;var f=t-1;var s=r[f--];var c=s&127;var l;s>>=7;for(;u>0;c=c*256+r[f],f--,u-=8);l=c&(1<<-u)-1;c>>=-u;u+=e;for(;u>0;l=l*256+r[f],f--,u-=8);if(c===0){c=1-i}else if(c===a){return l?NaN:s?-xs:xs}else{l=l+oe(2,e);c=c-i}return(s?-1:1)*l*oe(2,c-e)};cS.exports={pack:N$,unpack:$$}});var mn=o((S9,xS)=>{"use strict";var Ls=R();var Rs=C();var B$=Ka();var G$=nr();var hS=Le();var Ps=A();var za=ie();var H$=br();var k$=D();var Za=Os();var IS=lS();var V$=Rr();var dS=ge();var W$=le().f;var K$=$().f;var z$=pa();var TS=Fr();var AS=ar();var yt=AS.get;var pS=AS.set;var Qa="ArrayBuffer";var ri="DataView";var yn="prototype";var Y$="Wrong length";var wS="Wrong index";var Mr=Ls[Qa];var Er=Mr;var Lr=Ls[ri];var Ya=Lr&&Lr[yn];var gS=Object.prototype;var ei=Ls.RangeError;var OS=IS.pack;var qS=IS.unpack;var yS=function(r){return[r&255]};var mS=function(r){return[r&255,r>>8&255]};var SS=function(r){return[r&255,r>>8&255,r>>16&255,r>>24&255]};var bS=function(r){return r[3]<<24|r[2]<<16|r[1]<<8|r[0]};var X$=function(r){return OS(r,23,4)};var J$=function(r){return OS(r,52,8)};var Xa=function(r,e){K$(r[yn],e,{get:function(){return yt(this)[e]}})};var Se=function(r,e,t,n){var a=Za(t);var i=yt(r);if(a+e>i.byteLength)throw ei(wS);var u=yt(i.buffer).bytes;var f=a+i.byteOffset;var s=u.slice(f,f+e);return n?s:s.reverse()};var be=function(r,e,t,n,a,i){var u=Za(t);var f=yt(r);if(u+e>f.byteLength)throw ei(wS);var s=yt(f.buffer).bytes;var c=u+f.byteOffset;var l=n(+a);for(var v=0;va)throw ei("Wrong offset");n=n===void 0?a-i:k$(n);if(i+n>a)throw ei(Y$);pS(this,{buffer:e,byteLength:n,byteOffset:i});if(!Rs){this.buffer=e;this.byteLength=n;this.byteOffset=i}};if(Rs){Xa(Er,"byteLength");Xa(Lr,"buffer");Xa(Lr,"byteLength");Xa(Lr,"byteOffset")}hS(Lr[yn],{getInt8:function r(e){return Se(this,1,e)[0]<<24>>24},getUint8:function r(e){return Se(this,1,e)[0]},getInt16:function r(e){var t=Se(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function r(e){var t=Se(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function r(e){return bS(Se(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function r(e){return bS(Se(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function r(e){return qS(Se(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function r(e){return qS(Se(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function r(e,t){be(this,1,e,yS,t)},setUint8:function r(e,t){be(this,1,e,yS,t)},setInt16:function r(e,t){be(this,2,e,mS,t,arguments.length>2?arguments[2]:void 0)},setUint16:function r(e,t){be(this,2,e,mS,t,arguments.length>2?arguments[2]:void 0)},setInt32:function r(e,t){be(this,4,e,SS,t,arguments.length>2?arguments[2]:void 0)},setUint32:function r(e,t){be(this,4,e,SS,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function r(e,t){be(this,4,e,X$,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function r(e,t){be(this,8,e,J$,t,arguments.length>2?arguments[2]:void 0)}})}else{if(!Ps(function(){Mr(1)})||!Ps(function(){new Mr(-1)})||Ps(function(){new Mr;new Mr(1.5);new Mr(NaN);return Mr.name!=Qa})){Er=function r(e){za(this,Er);return new Mr(Za(e))};ES=Er[yn]=Mr[yn];for(_s=W$(Mr),Fs=0;_s.length>Fs;){if(!((Ja=_s[Fs++])in Er)){G$(Er,Ja,Mr[Ja])}}ES.constructor=Er}if(dS&&V$(Ya)!==gS){dS(Ya,gS)}qn=new Lr(new Er(2));Ms=Ya.setInt8;qn.setInt8(0,2147483648);qn.setInt8(1,2147483649);if(qn.getInt8(0)||!qn.getInt8(1))hS(Ya,{setInt8:function r(e,t){Ms.call(this,e,t<<24>>24)},setUint8:function r(e,t){Ms.call(this,e,t<<24>>24)}},{unsafe:true})}var ES;var _s;var Fs;var Ja;var qn;var Ms;TS(Er,Qa);TS(Lr,ri);xS.exports={ArrayBuffer:Er,DataView:Lr}});var PS=o(()=>{"use strict";var Z$=d();var Q$=R();var rB=mn();var eB=_e();var Cs="ArrayBuffer";var RS=rB[Cs];var tB=Q$[Cs];Z$({global:true,forced:tB!==RS},{ArrayBuffer:RS});eB(Cs)});var U=o((I9,NS)=>{"use strict";var nB=Ka();var Ns=C();var qr=R();var CS=F();var mt=V();var $s=Qe();var aB=nr();var js=er();var iB=$().f;var Bs=Rr();var St=ge();var uB=j();var oB=We();var Sn=qr.Int8Array;var Ds=Sn&&Sn.prototype;var _S=qr.Uint8ClampedArray;var FS=_S&&_S.prototype;var se=Sn&&Bs(Sn);var Cr=Ds&&Bs(Ds);var jS=Object.prototype;var MS=jS.isPrototypeOf;var LS=uB("toStringTag");var Us=oB("TYPED_ARRAY_TAG");var fe=nB&&!!St&&$s(qr.opera)!=="Opera";var DS=false;var Ir;var jr={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8};var sB=function r(e){var t=$s(e);return t==="DataView"||mt(jr,t)};var US=function(r){return CS(r)&&mt(jr,$s(r))};var fB=function(r){if(US(r))return r;throw TypeError("Target is not a typed array")};var vB=function(r){if(St){if(MS.call(se,r))return r}else for(var e in jr)if(mt(jr,Ir)){var t=qr[e];if(t&&(r===t||MS.call(t,r))){return r}}throw TypeError("Target is not a typed array constructor")};var cB=function(r,e,t){if(!Ns)return;if(t)for(var n in jr){var a=qr[n];if(a&&mt(a.prototype,r)){delete a.prototype[r]}}if(!Cr[r]||t){js(Cr,r,t?e:fe&&Ds[r]||e)}};var lB=function(r,e,t){var n,a;if(!Ns)return;if(St){if(t)for(n in jr){a=qr[n];if(a&&mt(a,r)){delete a[r]}}if(!se[r]||t){try{return js(se,r,t?e:fe&&Sn[r]||e)}catch(i){}}else return}for(n in jr){a=qr[n];if(a&&(!a[r]||t)){js(a,r,e)}}};for(Ir in jr){if(!qr[Ir])fe=false}if(!fe||typeof se!="function"||se===Function.prototype){se=function r(){throw TypeError("Incorrect invocation")};if(fe)for(Ir in jr){if(qr[Ir])St(qr[Ir],se)}}if(!fe||!Cr||Cr===jS){Cr=se.prototype;if(fe)for(Ir in jr){if(qr[Ir])St(qr[Ir].prototype,Cr)}}if(fe&&Bs(FS)!==Cr){St(FS,Cr)}if(Ns&&!mt(Cr,LS)){DS=true;iB(Cr,LS,{get:function(){return CS(this)?this[Us]:void 0}});for(Ir in jr)if(qr[Ir]){aB(qr[Ir],Us,Ir)}}NS.exports={NATIVE_ARRAY_BUFFER_VIEWS:fe,TYPED_ARRAY_TAG:DS&&Us,aTypedArray:fB,aTypedArrayConstructor:vB,exportTypedArrayMethod:cB,exportTypedArrayStaticMethod:lB,isView:sB,isTypedArray:US,TypedArray:se,TypedArrayPrototype:Cr}});var BS=o(()=>{var hB=d();var $S=U();var dB=$S.NATIVE_ARRAY_BUFFER_VIEWS;hB({target:"ArrayBuffer",stat:true,forced:!dB},{isView:$S.isView})});var KS=o(()=>{"use strict";var pB=d();var gB=A();var WS=mn();var GS=M();var HS=Qr();var qB=D();var yB=Hr();var Gs=WS.ArrayBuffer;var kS=WS.DataView;var VS=Gs.prototype.slice;var mB=gB(function(){return!new Gs(2).slice(1,void 0).byteLength});pB({target:"ArrayBuffer",proto:true,unsafe:true,forced:mB},{slice:function r(e,t){if(VS!==void 0&&t===void 0){return VS.call(GS(this),e)}var n=GS(this).byteLength;var a=HS(e,n);var i=HS(t===void 0?n:t,n);var u=new(yB(this,Gs))(qB(i-a));var f=new kS(this);var s=new kS(u);var c=0;while(a{var SB=d();var bB=mn();var EB=Ka();SB({global:true,forced:!EB},{DataView:bB.DataView})});var ti=o((P9,XS)=>{var YS=R();var Hs=A();var IB=$t();var TB=U().NATIVE_ARRAY_BUFFER_VIEWS;var AB=YS.ArrayBuffer;var De=YS.Int8Array;XS.exports=!TB||!Hs(function(){De(1)})||!Hs(function(){new De(-1)})||!IB(function(r){new De;new De(null);new De(1.5);new De(r)},true)||Hs(function(){return new De(new AB(2),1,void 0).length!==1})});var ZS=o((_9,JS)=>{var wB=br();JS.exports=function(r){var e=wB(r);if(e<0)throw RangeError("The argument can't be less than 0");return e}});var ks=o((F9,QS)=>{var OB=ZS();QS.exports=function(r,e){var t=OB(r);if(t%e)throw RangeError("Wrong offset");return t}});var Vs=o((M9,rb)=>{var xB=k();var RB=D();var PB=ut();var _B=ha();var FB=Br();var MB=U().aTypedArrayConstructor;rb.exports=function r(e){var t=xB(e);var n=arguments.length;var a=n>1?arguments[1]:void 0;var i=a!==void 0;var u=PB(t);var f,s,c,l,v,h;if(u!=void 0&&!_B(u)){v=u.call(t);h=v.next;t=[];while(!(l=h.call(v)).done){t.push(l.value)}}if(i&&n>2){a=FB(a,arguments[2],2)}s=RB(t.length);c=new(MB(this))(s);for(f=0;s>f;f++){c[f]=i?a(t[f],f):t[f]}return c}});var zr=o((L9,Zs)=>{"use strict";var eb=d();var cb=R();var LB=C();var CB=ti();var bt=U();var lb=mn();var tb=ie();var jB=Zr();var bn=nr();var DB=D();var nb=Os();var Ws=ks();var hb=wr();var En=V();var UB=Qe();var Ys=F();var NB=$r();var ni=ge();var $B=le().f;var ab=Vs();var BB=Z().forEach;var GB=_e();var db=$();var pb=rr();var gb=ar();var HB=Qt();var Xs=gb.get;var kB=gb.set;var Qs=db.f;var VB=pb.f;var WB=Math.round;var Ks=cb.RangeError;var qb=lb.ArrayBuffer;var KB=lb.DataView;var ai=bt.NATIVE_ARRAY_BUFFER_VIEWS;var ib=bt.TYPED_ARRAY_TAG;var ub=bt.TypedArray;var In=bt.TypedArrayPrototype;var zB=bt.aTypedArrayConstructor;var Js=bt.isTypedArray;var ii="BYTES_PER_ELEMENT";var zs="Wrong length";var ob=function(r,e){var t=0;var n=e.length;var a=new(zB(r))(n);while(n>t)a[t]=e[t++];return a};var ui=function(r,e){Qs(r,e,{get:function(){return Xs(this)[e]}})};var sb=function(r){var e;return r instanceof qb||(e=UB(r))=="ArrayBuffer"||e=="SharedArrayBuffer"};var yb=function(r,e){return Js(r)&&typeof e!="symbol"&&e in r&&String(+e)==String(e)};var fb=function r(e,t){return yb(e,t=hb(t,true))?jB(2,e[t]):VB(e,t)};var vb=function r(e,t,n){if(yb(e,t=hb(t,true))&&Ys(n)&&En(n,"value")&&!En(n,"get")&&!En(n,"set")&&!n.configurable&&(!En(n,"writable")||n.writable)&&(!En(n,"enumerable")||n.enumerable)){e[t]=n.value;return e}return Qs(e,t,n)};if(LB){if(!ai){pb.f=fb;db.f=vb;ui(In,"buffer");ui(In,"byteOffset");ui(In,"byteLength");ui(In,"length")}eb({target:"Object",stat:true,forced:!ai},{getOwnPropertyDescriptor:fb,defineProperty:vb});Zs.exports=function(r,e,t){var n=r.match(/\d+$/)[0]/8;var a=r+(t?"Clamped":"")+"Array";var i="get"+r;var u="set"+r;var f=cb[a];var s=f;var c=s&&s.prototype;var l={};var v=function(m,q){var b=Xs(m);return b.view[i](q*n+b.byteOffset,true)};var h=function(m,q,b){var T=Xs(m);if(t)b=(b=WB(b))<0?0:b>255?255:b&255;T.view[u](q*n+T.byteOffset,b,true)};var I=function(m,q){Qs(m,q,{get:function(){return v(this,q)},set:function(b){return h(this,q,b)},enumerable:true})};if(!ai){s=e(function(m,q,b,T){tb(m,s,a);var _=0;var O=0;var K,H,N;if(!Ys(q)){N=nb(q);H=N*n;K=new qb(H)}else if(sb(q)){K=q;O=Ws(b,n);var sr=q.byteLength;if(T===void 0){if(sr%n)throw Ks(zs);H=sr-O;if(H<0)throw Ks(zs)}else{H=DB(T)*n;if(H+O>sr)throw Ks(zs)}N=H/n}else if(Js(q)){return ob(s,q)}else{return ab.call(s,q)}kB(m,{buffer:K,byteOffset:O,byteLength:H,length:N,view:new KB(K)});while(_{var YB=zr();YB("Int8",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Sb=o(()=>{var XB=zr();XB("Uint8",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var bb=o(()=>{var JB=zr();JB("Uint8",function(r){return function e(t,n,a){return r(this,t,n,a)}},true)});var Eb=o(()=>{var ZB=zr();ZB("Int16",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Ib=o(()=>{var QB=zr();QB("Uint16",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Tb=o(()=>{var rG=zr();rG("Int32",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Ab=o(()=>{var eG=zr();eG("Uint32",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var wb=o(()=>{var tG=zr();tG("Float32",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var Ob=o(()=>{var nG=zr();nG("Float64",function(r){return function e(t,n,a){return r(this,t,n,a)}})});var xb=o(()=>{"use strict";var aG=ti();var iG=U().exportTypedArrayStaticMethod;var uG=Vs();iG("from",uG,aG)});var Pb=o(()=>{"use strict";var Rb=U();var oG=ti();var sG=Rb.aTypedArrayConstructor;var fG=Rb.exportTypedArrayStaticMethod;fG("of",function r(){var e=0;var t=arguments.length;var n=new(sG(this))(t);while(t>e)n[e]=arguments[e++];return n},oG)});var Fb=o(()=>{"use strict";var _b=U();var vG=Qu();var cG=_b.aTypedArray;var lG=_b.exportTypedArrayMethod;lG("copyWithin",function r(e,t){return vG.call(cG(this),e,t,arguments.length>2?arguments[2]:void 0)})});var Lb=o(()=>{"use strict";var Mb=U();var hG=Z().every;var dG=Mb.aTypedArray;var pG=Mb.exportTypedArrayMethod;pG("every",function r(e){return hG(dG(this),e,arguments.length>1?arguments[1]:void 0)})});var jb=o(()=>{"use strict";var Cb=U();var gG=pa();var qG=Cb.aTypedArray;var yG=Cb.exportTypedArrayMethod;yG("fill",function r(e){return gG.apply(qG(this),arguments)})});var Db=o(()=>{"use strict";var rf=U();var mG=Z().filter;var SG=Hr();var bG=rf.aTypedArray;var EG=rf.aTypedArrayConstructor;var IG=rf.exportTypedArrayMethod;IG("filter",function r(e){var t=mG(bG(this),e,arguments.length>1?arguments[1]:void 0);var n=SG(this,this.constructor);var a=0;var i=t.length;var u=new(EG(n))(i);while(i>a)u[a]=t[a++];return u})});var Nb=o(()=>{"use strict";var Ub=U();var TG=Z().find;var AG=Ub.aTypedArray;var wG=Ub.exportTypedArrayMethod;wG("find",function r(e){return TG(AG(this),e,arguments.length>1?arguments[1]:void 0)})});var Bb=o(()=>{"use strict";var $b=U();var OG=Z().findIndex;var xG=$b.aTypedArray;var RG=$b.exportTypedArrayMethod;RG("findIndex",function r(e){return OG(xG(this),e,arguments.length>1?arguments[1]:void 0)})});var Hb=o(()=>{"use strict";var Gb=U();var PG=Z().forEach;var _G=Gb.aTypedArray;var FG=Gb.exportTypedArrayMethod;FG("forEach",function r(e){PG(_G(this),e,arguments.length>1?arguments[1]:void 0)})});var Vb=o(()=>{"use strict";var kb=U();var MG=Ye().includes;var LG=kb.aTypedArray;var CG=kb.exportTypedArrayMethod;CG("includes",function r(e){return MG(LG(this),e,arguments.length>1?arguments[1]:void 0)})});var Kb=o(()=>{"use strict";var Wb=U();var jG=Ye().indexOf;var DG=Wb.aTypedArray;var UG=Wb.exportTypedArrayMethod;UG("indexOf",function r(e){return jG(DG(this),e,arguments.length>1?arguments[1]:void 0)})});var Qb=o(()=>{"use strict";var NG=R();var Yb=U();var tf=kt();var $G=j();var Xb=$G("iterator");var zb=NG.Uint8Array;var BG=tf.values;var GG=tf.keys;var HG=tf.entries;var nf=Yb.aTypedArray;var oi=Yb.exportTypedArrayMethod;var ef=zb&&zb.prototype[Xb];var Jb=!!ef&&(ef.name=="values"||ef.name==void 0);var Zb=function r(){return BG.call(nf(this))};oi("entries",function r(){return HG.call(nf(this))});oi("keys",function r(){return GG.call(nf(this))});oi("values",Zb,!Jb);oi(Xb,Zb,!Jb)});var eE=o(()=>{"use strict";var rE=U();var kG=rE.aTypedArray;var VG=rE.exportTypedArrayMethod;var WG=[].join;VG("join",function r(e){return WG.apply(kG(this),arguments)})});var nE=o(()=>{"use strict";var tE=U();var KG=oo();var zG=tE.aTypedArray;var YG=tE.exportTypedArrayMethod;YG("lastIndexOf",function r(e){return KG.apply(zG(this),arguments)})});var aE=o(()=>{"use strict";var af=U();var XG=Z().map;var JG=Hr();var ZG=af.aTypedArray;var QG=af.aTypedArrayConstructor;var rH=af.exportTypedArrayMethod;rH("map",function r(e){return XG(ZG(this),e,arguments.length>1?arguments[1]:void 0,function(t,n){return new(QG(JG(t,t.constructor)))(n)})})});var uE=o(()=>{"use strict";var iE=U();var eH=Ht().left;var tH=iE.aTypedArray;var nH=iE.exportTypedArrayMethod;nH("reduce",function r(e){return eH(tH(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)})});var sE=o(()=>{"use strict";var oE=U();var aH=Ht().right;var iH=oE.aTypedArray;var uH=oE.exportTypedArrayMethod;uH("reduceRight",function r(e){return aH(iH(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)})});var vE=o(()=>{"use strict";var fE=U();var oH=fE.aTypedArray;var sH=fE.exportTypedArrayMethod;var fH=Math.floor;sH("reverse",function r(){var e=this;var t=oH(e).length;var n=fH(t/2);var a=0;var i;while(a{"use strict";var cE=U();var vH=D();var cH=ks();var lH=k();var hH=A();var dH=cE.aTypedArray;var pH=cE.exportTypedArrayMethod;var gH=hH(function(){new Int8Array(1).set({})});pH("set",function r(e){dH(this);var t=cH(arguments.length>1?arguments[1]:void 0,1);var n=this.length;var a=lH(e);var i=vH(a.length);var u=0;if(i+t>n)throw RangeError("Wrong length");while(u{"use strict";var uf=U();var qH=Hr();var yH=A();var mH=uf.aTypedArray;var SH=uf.aTypedArrayConstructor;var bH=uf.exportTypedArrayMethod;var EH=[].slice;var IH=yH(function(){new Int8Array(1).slice()});bH("slice",function r(e,t){var n=EH.call(mH(this),e,t);var a=qH(this,this.constructor);var i=0;var u=n.length;var f=new(SH(a))(u);while(u>i)f[i]=n[i++];return f},IH)});var pE=o(()=>{"use strict";var dE=U();var TH=Z().some;var AH=dE.aTypedArray;var wH=dE.exportTypedArrayMethod;wH("some",function r(e){return TH(AH(this),e,arguments.length>1?arguments[1]:void 0)})});var qE=o(()=>{"use strict";var gE=U();var OH=gE.aTypedArray;var xH=gE.exportTypedArrayMethod;var RH=[].sort;xH("sort",function r(e){return RH.call(OH(this),e)})});var SE=o(()=>{"use strict";var mE=U();var PH=D();var yE=Qr();var _H=Hr();var FH=mE.aTypedArray;var MH=mE.exportTypedArrayMethod;MH("subarray",function r(e,t){var n=FH(this);var a=n.length;var i=yE(e,a);return new(_H(n,n.constructor))(n.buffer,n.byteOffset+i*n.BYTES_PER_ELEMENT,PH((t===void 0?a:yE(t,a))-i))})});var TE=o(()=>{"use strict";var LH=R();var EE=U();var of=A();var si=LH.Int8Array;var bE=EE.aTypedArray;var CH=EE.exportTypedArrayMethod;var IE=[].toLocaleString;var jH=[].slice;var DH=!!si&&of(function(){IE.call(new si(1))});var UH=of(function(){return[1,2].toLocaleString()!=new si([1,2]).toLocaleString()})||!of(function(){si.prototype.toLocaleString.call([1,2])});CH("toLocaleString",function r(){return IE.apply(DH?jH.call(bE(this)):bE(this),arguments)},UH)});var wE=o(()=>{"use strict";var NH=U().exportTypedArrayMethod;var $H=A();var BH=R();var AE=BH.Uint8Array;var GH=AE&&AE.prototype||{};var fi=[].toString;var HH=[].join;if($H(function(){fi.call({})})){fi=function r(){return HH.call(this)}}var kH=GH.toString!=fi;NH("toString",fi,kH)});var OE=o(()=>{var VH=d();var WH=Sr();var KH=ur();var zH=M();var YH=A();var sf=WH("Reflect","apply");var XH=Function.apply;var JH=!YH(function(){sf(function(){})});VH({target:"Reflect",stat:true,forced:JH},{apply:function r(e,t,n){KH(e);zH(n);return sf?sf(e,t,n):XH.call(e,t,n)}})});var LE=o(()=>{var ZH=d();var QH=Sr();var xE=ur();var r8=M();var RE=F();var e8=$r();var t8=Xu();var _E=A();var ff=QH("Reflect","construct");var FE=_E(function(){function r(){}return!(ff(function(){},[],r)instanceof r)});var ME=!_E(function(){ff(function(){})});var PE=FE||ME;ZH({target:"Reflect",stat:true,forced:PE,sham:PE},{construct:function r(e,t){xE(e);r8(t);var n=arguments.length<3?e:xE(arguments[2]);if(ME&&!FE)return ff(e,t,n);if(e==n){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var a=[null];a.push.apply(a,t);return new(t8.apply(e,a))}var i=n.prototype;var u=e8(RE(i)?i:Object.prototype);var f=Function.apply.call(e,u,t);return RE(f)?f:u}})});var DE=o(()=>{var n8=d();var a8=C();var CE=M();var i8=wr();var jE=$();var u8=A();var o8=u8(function(){Reflect.defineProperty(jE.f({},1,{value:1}),1,{value:2})});n8({target:"Reflect",stat:true,forced:o8,sham:!a8},{defineProperty:function r(e,t,n){CE(e);var a=i8(t,true);CE(n);try{jE.f(e,a,n);return true}catch(i){return false}}})});var UE=o(()=>{var s8=d();var f8=M();var v8=rr().f;s8({target:"Reflect",stat:true},{deleteProperty:function r(e,t){var n=v8(f8(e),t);return n&&!n.configurable?false:delete e[t]}})});var $E=o(()=>{var c8=d();var l8=F();var h8=M();var d8=V();var p8=rr();var g8=Rr();function NE(r,e){var t=arguments.length<3?r:arguments[2];var n,a;if(h8(r)===t)return r[e];if(n=p8.f(r,e))return d8(n,"value")?n.value:n.get===void 0?void 0:n.get.call(t);if(l8(a=g8(r)))return NE(a,e,t)}c8({target:"Reflect",stat:true},{get:NE})});var BE=o(()=>{var q8=d();var y8=C();var m8=M();var S8=rr();q8({target:"Reflect",stat:true,sham:!y8},{getOwnPropertyDescriptor:function r(e,t){return S8.f(m8(e),t)}})});var GE=o(()=>{var b8=d();var E8=M();var I8=Rr();var T8=oa();b8({target:"Reflect",stat:true,sham:!T8},{getPrototypeOf:function r(e){return I8(E8(e))}})});var HE=o(()=>{var A8=d();A8({target:"Reflect",stat:true},{has:function r(e,t){return t in e}})});var VE=o(()=>{var w8=d();var O8=M();var kE=Object.isExtensible;w8({target:"Reflect",stat:true},{isExtensible:function r(e){O8(e);return kE?kE(e):true}})});var WE=o(()=>{var x8=d();var R8=Kn();x8({target:"Reflect",stat:true},{ownKeys:R8})});var KE=o(()=>{var P8=d();var _8=Sr();var F8=M();var M8=st();P8({target:"Reflect",stat:true,sham:!M8},{preventExtensions:function r(e){F8(e);try{var t=_8("Object","preventExtensions");if(t)t(e);return true}catch(n){return false}}})});var QE=o(()=>{var L8=d();var C8=M();var zE=F();var j8=V();var D8=A();var vf=$();var YE=rr();var JE=Rr();var XE=Zr();function ZE(r,e,t){var n=arguments.length<4?r:arguments[3];var a=YE.f(C8(r),e);var i,u;if(!a){if(zE(u=JE(r))){return ZE(u,e,t,n)}a=XE(0)}if(j8(a,"value")){if(a.writable===false||!zE(n))return false;if(i=YE.f(n,e)){if(i.get||i.set||i.writable===false)return false;i.value=t;vf.f(n,e,i)}else vf.f(n,e,XE(0,t));return true}return a.set===void 0?false:(a.set.call(n,t),true)}var U8=D8(function(){var r=vf.f({},"a",{configurable:true});return Reflect.set(JE(r),"a",1,r)!==false});L8({target:"Reflect",stat:true,forced:U8},{set:ZE})});var eI=o(()=>{var N8=d();var $8=M();var B8=Ru();var rI=ge();if(rI)N8({target:"Reflect",stat:true},{setPrototypeOf:function r(e,t){$8(e);B8(t);try{rI(e,t);return true}catch(n){return false}}})});var nI=o((bZ,tI)=>{su();fu();cu();lu();hu();du();pu();gu();qu();yu();mu();Su();bu();Eu();Iu();Lh();Ch();Dh();Nh();Gh();Vh();Kh();Xh();Jh();Zh();rd();td();nd();ad();id();od();sd();fd();vd();cd();Ni();hd();dd();pd();gd();md();bd();Ad();wd();Cu();Od();xd();Ui();_d();Cd();Ud();Nd();no();Gd();Vd();Wd();Yd();Xd();Qd();rp();ap();so();op();sp();vp();hp();dp();yp();mp();Ep();Ip();Tp();kt();_p();Fp();Mp();$p();Bp();ag();hg();yg();mg();Sg();bg();Ig();wg();Rg();Cg();Ug();Bg();la();kg();Vg();Wg();Kg();zg();Yg();Xg();Jg();Zg();Qg();rq();eq();tq();oq();ba();sq();fq();vq();hq();qq();Sq();Aq();wq();Rq();_q();Fq();Mq();Lq();Cq();Dq();Nq();Hq();Wq();Yq();Zq();ry();ty();ny();uy();sy();cy();hy();py();gy();qy();yy();my();Ey();Ay();Tu();wy();Oy();xy();Ly();Dy();Gy();Vy();Au();Cm();jm();Nm();zm();Xm();oS();sS();PS();BS();KS();zS();mb();Sb();bb();Eb();Ib();Tb();Ab();wb();Ob();xb();Pb();Fb();Lb();jb();Db();Nb();Bb();Hb();Vb();Kb();Qb();eE();nE();aE();uE();sE();vE();lE();hE();pE();qE();SE();TE();wE();OE();LE();DE();UE();$E();BE();GE();HE();VE();WE();KE();QE();eI();var G8=ce();tI.exports=G8});var cf=o((EZ,aI)=>{aI.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var uI=o(()=>{var H8=R();var k8=cf();var lf=io();var V8=nr();for(iI in k8){hf=H8[iI];Tn=hf&&hf.prototype;if(Tn&&Tn.forEach!==lf)try{V8(Tn,"forEach",lf)}catch(r){Tn.forEach=lf}}var hf;var Tn;var iI});var vI=o(()=>{var W8=R();var oI=cf();var An=kt();var df=nr();var fI=j();var pf=fI("iterator");var sI=fI("toStringTag");var gf=An.values;for(vi in oI){qf=W8[vi];Yr=qf&&qf.prototype;if(Yr){if(Yr[pf]!==gf)try{df(Yr,pf,gf)}catch(r){Yr[pf]=gf}if(!Yr[sI]){df(Yr,sI,vi)}if(oI[vi])for(Ue in An){if(Yr[Ue]!==An[Ue])try{df(Yr,Ue,An[Ue])}catch(r){Yr[Ue]=An[Ue]}}}}var qf;var Yr;var Ue;var vi});var hI=o(()=>{var K8=d();var cI=R();var lI=ja();var z8=!cI.setImmediate||!cI.clearImmediate;K8({global:true,bind:true,enumerable:true,forced:z8},{setImmediate:lI.set,clearImmediate:lI.clear})});var pI=o(()=>{var Y8=d();var X8=R();var J8=us();var Z8=mr();var dI=X8.process;var Q8=Z8(dI)=="process";Y8({global:true,enumerable:true,noTargetGet:true},{queueMicrotask:function r(e){var t=Q8&&dI.domain;J8(t?t.bind(e):e)}})});var yI=o(()=>{var rk=d();var gI=R();var ek=Mt();var tk=[].slice;var nk=/MSIE .\./.test(ek);var qI=function(r){return function(e,t){var n=arguments.length>2;var a=n?tk.call(arguments,2):void 0;return r(n?function(){(typeof e=="function"?e:Function(e)).apply(this,a)}:e,t)}};rk({global:true,bind:true,forced:nk},{setTimeout:qI(gI.setTimeout),setInterval:qI(gI.setInterval)})});var yf=o((MZ,mI)=>{var ak=A();var ik=j();var uk=Or();var ok=ik("iterator");mI.exports=!ak(function(){var r=new URL("b?a=1&b=2&c=3","http://a");var e=r.searchParams;var t="";r.pathname="c%20d";e.forEach(function(n,a){e["delete"]("b");t+=a+n});return uk&&!r.toJSON||!e.sort||r.href!=="http://a/c%20d?a=1&c=3"||e.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!e[ok]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("http://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("http://a#\u0431").hash!=="#%D0%B1"||t!=="a1c3"||new URL("http://x",void 0).host!=="x"})});var TI=o((LZ,II)=>{"use strict";var mf=2147483647;var wn=36;var EI=1;var Ef=26;var sk=38;var fk=700;var vk=72;var ck=128;var lk="-";var hk=/[^\0-\u007E]/;var dk=/[.\u3002\uFF0E\uFF61]/g;var SI="Overflow: input needs wider integers to process";var Sf=wn-EI;var Et=Math.floor;var bf=String.fromCharCode;var pk=function(r){var e=[];var t=0;var n=r.length;while(t=55296&&a<=56319&&t>1;r+=Et(r/e);for(;r>Sf*Ef>>1;n+=wn){r=Et(r/Sf)}return Et(n+(Sf+1)*r/(r+sk))};var qk=function(r){var e=[];r=pk(r);var t=r.length;var n=ck;var a=0;var i=vk;var u,f;for(u=0;u=n&&fEt((mf-a)/v)){throw RangeError(SI)}a+=(l-n)*v;n=l;for(u=0;umf){throw RangeError(SI)}if(f==n){var h=a;for(var I=wn;;I+=wn){var m=I<=i?EI:I>=i+Ef?Ef:I-i;if(h{var yk=M();var mk=ut();AI.exports=function(r){var e=mk(r);if(typeof e!="function"){throw TypeError(String(r)+" is not iterable")}return yk(e.call(r))}});var wf=o((jZ,BI)=>{"use strict";kt();var FI=d();var MI=Sr();var LI=yf();var CI=er();var Sk=Le();var bk=Fr();var Ek=sa();var Af=ar();var Ik=ie();var Tk=V();var Ak=Br();var wk=Qe();var Ok=M();var jI=F();var xk=$r();var OI=Zr();var DI=wI();var Rk=ut();var Pk=j();var xI=MI("fetch");var If=MI("Headers");var _k=Pk("iterator");var Tt="URLSearchParams";var UI=Tt+"Iterator";var NI=Af.set;var Dr=Af.getterFor(Tt);var Fk=Af.getterFor(UI);var Mk=/\+/g;var RI=Array(4);var Lk=function(r){return RI[r-1]||(RI[r-1]=RegExp("((?:%[\\da-f]{2}){"+r+"})","gi"))};var Ck=function(r){try{return decodeURIComponent(r)}catch(e){return r}};var PI=function(r){var e=r.replace(Mk," ");var t=4;try{return decodeURIComponent(e)}catch(n){while(t){e=e.replace(Lk(t--),Ck)}return e}};var jk=/[!'()~]|%20/g;var Dk={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};var Uk=function(r){return Dk[r]};var _I=function(r){return encodeURIComponent(r).replace(jk,Uk)};var $I=function(r,e){if(e){var t=e.split("&");var n=0;var a,i;while(n0?arguments[0]:void 0;var t=this;var n=[];var a,i,u,f,s,c,l,v,h;NI(t,{type:Tt,entries:n,updateURL:function(){},updateSearchParams:Nk});if(e!==void 0){if(jI(e)){a=Rk(e);if(typeof a==="function"){i=a.call(e);u=i.next;while(!(f=u.call(i)).done){s=DI(Ok(f.value));c=s.next;if((l=c.call(s)).done||(v=c.call(s)).done||!c.call(s).done)throw TypeError("Expected sequence with length 2");n.push({key:l.value+"",value:v.value+""})}}else for(h in e)if(Tk(e,h))n.push({key:h,value:e[h]+""})}else{$I(n,typeof e==="string"?e.charAt(0)==="?"?e.slice(1):e:e+"")}}};var ci=On.prototype;Sk(ci,{append:function r(e,t){It(arguments.length,2);var n=Dr(this);n.entries.push({key:e+"",value:t+""});n.updateURL()},"delete":function(r){It(arguments.length,1);var e=Dr(this);var t=e.entries;var n=r+"";var a=0;while(aa.key){t.splice(i,0,a);break}}if(i===u)t.push(a)}e.updateURL()},forEach:function r(e){var t=Dr(this).entries;var n=Ak(e,arguments.length>1?arguments[1]:void 0,3);var a=0;var i;while(a1){n=arguments[1];if(jI(n)){a=n.body;if(wk(a)===Tt){i=n.headers?new If(n.headers):new If;if(!i.has("content-type")){i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8")}n=xk(n,{body:OI(0,String(a)),headers:OI(0,i)})}}t.push(n)}return xI.apply(this,t)}})}BI.exports={URLSearchParams:On,getState:Dr}});var g0=o(()=>{"use strict";la();var $k=d();var kf=C();var Bk=yf();var Gk=R();var Hk=ra();var pi=er();var kk=ie();var Vf=V();var Wf=Du();var wt=Mu();var Vk=Ut().codeAt;var Wk=TI();var Kk=Fr();var QI=wf();var r0=ar();var xn=Gk.URL;var zk=QI.URLSearchParams;var jf=QI.getState;var Yk=r0.set;var W=r0.getterFor("URL");var Xk=Math.floor;var GI=Math.pow;var Jk="Invalid authority";var Of="Invalid scheme";var $e="Invalid host";var HI="Invalid port";var e0=/[A-Za-z]/;var Zk=/[\d+-.A-Za-z]/;var Df=/\d/;var Qk=/^(0x|0X)/;var rV=/^[0-7]+$/;var eV=/^\d+$/;var t0=/^[\dA-Fa-f]+$/;var tV=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/;var nV=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/;var aV=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;var iV=/[\u0009\u000A\u000D]/g;var Pr;var xf=function(r,e){var t,n,a;if(e.charAt(0)=="["){if(e.charAt(e.length-1)!="]")return $e;t=oV(e.slice(1,-1));if(!t)return $e;r.host=t}else if(!Q(r)){if(nV.test(e))return $e;t="";n=wt(e);for(a=0;a4)return r;n=[];for(a=0;a1&&i.charAt(0)=="0"){u=Qk.test(i)?16:8;i=i.slice(u==8?1:2)}if(i===""){f=0}else{if(!(u==10?eV:u==8?rV:t0).test(i))return r;f=parseInt(i,u)}n.push(f)}for(a=0;a=GI(256,5-t))return null}else if(f>255)return null}s=n.pop();for(a=0;a6)return;f=0;while(h()){s=null;if(f>0){if(h()=="."&&f<4)a++;else return}if(!Df.test(h()))return;while(Df.test(h())){c=parseInt(h(),10);if(s===null)s=c;else if(s==0)return;else s=s*10+c;if(s>255)return;a++}e[t]=e[t]*256+s;f++;if(f==2||f==4)t++}if(f!=4)return;break}else if(h()==":"){a++;if(!h())return}else if(h())return;e[t++]=i}if(n!==null){l=t-n;t=7;while(t!=0&&l>0){v=e[t];e[t--]=e[n+l-1];e[n+--l]=v}}else if(t!=8)return;return e};var sV=function(r){var e=null;var t=1;var n=null;var a=0;var i=0;for(;i<8;i++){if(r[i]!==0){if(a>t){e=n;t=a}n=null;a=0}else{if(n===null)n=i;++a}}if(a>t){e=n;t=a}return e};var Pn=function(r){var e,t,n,a;if(typeof r=="number"){e=[];for(t=0;t<4;t++){e.unshift(r%256);r=Xk(r/256)}return e.join(".")}else if(typeof r=="object"){e="";n=sV(r);for(t=0;t<8;t++){if(a&&r[t]===0)continue;if(a)a=false;if(n===t){e+=t?":":"::";a=true}else{e+=r[t].toString(16);if(t<7)e+=":"}}return"["+e+"]"}return r};var gi={};var n0=Wf({},gi,{" ":1,'"':1,"<":1,">":1,"`":1});var a0=Wf({},n0,{"#":1,"?":1,"{":1,"}":1});var Uf=Wf({},a0,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1});var Ee=function(r,e){var t=Vk(r,0);return t>32&&t<127&&!Vf(e,r)?r:encodeURIComponent(r)};var di={ftp:21,file:null,http:80,https:443,ws:80,wss:443};var Q=function(r){return Vf(di,r.scheme)};var Nf=function(r){return r.username!=""||r.password!=""};var Rf=function(r){return!r.host||r.cannotBeABaseURL||r.scheme=="file"};var Rn=function(r,e){var t;return r.length==2&&e0.test(r.charAt(0))&&((t=r.charAt(1))==":"||!e&&t=="|")};var kI=function(r){var e;return r.length>1&&Rn(r.slice(0,2))&&(r.length==2||((e=r.charAt(2))==="/"||e==="\\"||e==="?"||e==="#"))};var VI=function(r){var e=r.path;var t=e.length;if(t&&(r.scheme!="file"||t!=1||!Rn(e[0],true))){e.pop()}};var fV=function(r){return r==="."||r.toLowerCase()==="%2e"};var vV=function(r){r=r.toLowerCase();return r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"};var $f={};var WI={};var Pf={};var KI={};var zI={};var _f={};var YI={};var XI={};var li={};var hi={};var Bf={};var Gf={};var Hf={};var Ff={};var JI={};var Mf={};var At={};var Xr={};var ZI={};var Ne={};var ve={};var Jr=function(r,e,t,n){var a=t||$f;var i=0;var u="";var f=false;var s=false;var c=false;var l,v,h,I;if(!t){r.scheme="";r.username="";r.password="";r.host=null;r.port=null;r.path=[];r.query=null;r.fragment=null;r.cannotBeABaseURL=false;e=e.replace(aV,"")}e=e.replace(iV,"");l=wt(e);while(i<=l.length){v=l[i];switch(a){case $f:if(v&&e0.test(v)){u+=v.toLowerCase();a=WI}else if(!t){a=Pf;continue}else return Of;break;case WI:if(v&&(Zk.test(v)||v=="+"||v=="-"||v==".")){u+=v.toLowerCase()}else if(v==":"){if(t&&(Q(r)!=Vf(di,u)||u=="file"&&(Nf(r)||r.port!==null)||r.scheme=="file"&&!r.host))return;r.scheme=u;if(t){if(Q(r)&&di[r.scheme]==r.port)r.port=null;return}u="";if(r.scheme=="file"){a=Ff}else if(Q(r)&&n&&n.scheme==r.scheme){a=KI}else if(Q(r)){a=XI}else if(l[i+1]=="/"){a=zI;i++}else{r.cannotBeABaseURL=true;r.path.push("");a=ZI}}else if(!t){u="";a=Pf;i=0;continue}else return Of;break;case Pf:if(!n||n.cannotBeABaseURL&&v!="#")return Of;if(n.cannotBeABaseURL&&v=="#"){r.scheme=n.scheme;r.path=n.path.slice();r.query=n.query;r.fragment="";r.cannotBeABaseURL=true;a=ve;break}a=n.scheme=="file"?Ff:_f;continue;case KI:if(v=="/"&&l[i+1]=="/"){a=li;i++}else{a=_f;continue}break;case zI:if(v=="/"){a=hi;break}else{a=Xr;continue}case _f:r.scheme=n.scheme;if(v==Pr){r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;r.path=n.path.slice();r.query=n.query}else if(v=="/"||v=="\\"&&Q(r)){a=YI}else if(v=="?"){r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;r.path=n.path.slice();r.query="";a=Ne}else if(v=="#"){r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;r.path=n.path.slice();r.query=n.query;r.fragment="";a=ve}else{r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;r.path=n.path.slice();r.path.pop();a=Xr;continue}break;case YI:if(Q(r)&&(v=="/"||v=="\\")){a=li}else if(v=="/"){a=hi}else{r.username=n.username;r.password=n.password;r.host=n.host;r.port=n.port;a=Xr;continue}break;case XI:a=li;if(v!="/"||u.charAt(i+1)!="/")continue;i++;break;case li:if(v!="/"&&v!="\\"){a=hi;continue}break;case hi:if(v=="@"){if(f)u="%40"+u;f=true;h=wt(u);for(var m=0;m65535)return HI;r.port=Q(r)&&T===di[r.scheme]?null:T;u=""}if(t)return;a=At;continue}else return HI;break;case Ff:r.scheme="file";if(v=="/"||v=="\\")a=JI;else if(n&&n.scheme=="file"){if(v==Pr){r.host=n.host;r.path=n.path.slice();r.query=n.query}else if(v=="?"){r.host=n.host;r.path=n.path.slice();r.query="";a=Ne}else if(v=="#"){r.host=n.host;r.path=n.path.slice();r.query=n.query;r.fragment="";a=ve}else{if(!kI(l.slice(i).join(""))){r.host=n.host;r.path=n.path.slice();VI(r)}a=Xr;continue}}else{a=Xr;continue}break;case JI:if(v=="/"||v=="\\"){a=Mf;break}if(n&&n.scheme=="file"&&!kI(l.slice(i).join(""))){if(Rn(n.path[0],true))r.path.push(n.path[0]);else r.host=n.host}a=Xr;continue;case Mf:if(v==Pr||v=="/"||v=="\\"||v=="?"||v=="#"){if(!t&&Rn(u)){a=Xr}else if(u==""){r.host="";if(t)return;a=At}else{I=xf(r,u);if(I)return I;if(r.host=="localhost")r.host="";if(t)return;u="";a=At}continue}else u+=v;break;case At:if(Q(r)){a=Xr;if(v!="/"&&v!="\\")continue}else if(!t&&v=="?"){r.query="";a=Ne}else if(!t&&v=="#"){r.fragment="";a=ve}else if(v!=Pr){a=Xr;if(v!="/")continue}break;case Xr:if(v==Pr||v=="/"||v=="\\"&&Q(r)||!t&&(v=="?"||v=="#")){if(vV(u)){VI(r);if(v!="/"&&!(v=="\\"&&Q(r))){r.path.push("")}}else if(fV(u)){if(v!="/"&&!(v=="\\"&&Q(r))){r.path.push("")}}else{if(r.scheme=="file"&&!r.path.length&&Rn(u)){if(r.host)r.host="";u=u.charAt(0)+":"}r.path.push(u)}u="";if(r.scheme=="file"&&(v==Pr||v=="?"||v=="#")){while(r.path.length>1&&r.path[0]===""){r.path.shift()}}if(v=="?"){r.query="";a=Ne}else if(v=="#"){r.fragment="";a=ve}}else{u+=Ee(v,a0)}break;case ZI:if(v=="?"){r.query="";a=Ne}else if(v=="#"){r.fragment="";a=ve}else if(v!=Pr){r.path[0]+=Ee(v,gi)}break;case Ne:if(!t&&v=="#"){r.fragment="";a=ve}else if(v!=Pr){if(v=="'"&&Q(r))r.query+="%27";else if(v=="#")r.query+="%23";else r.query+=Ee(v,gi)}break;case ve:if(v!=Pr)r.fragment+=Ee(v,n0);break}i++}};var Be=function r(e){var t=kk(this,Be,"URL");var n=arguments.length>1?arguments[1]:void 0;var a=String(e);var i=Yk(t,{type:"URL"});var u,f;if(n!==void 0){if(n instanceof Be)u=W(n);else{f=Jr(u={},String(n));if(f)throw TypeError(f)}}f=Jr(i,a,null,u);if(f)throw TypeError(f);var s=i.searchParams=new zk;var c=jf(s);c.updateSearchParams(i.query);c.updateURL=function(){i.query=String(s)||null};if(!kf){t.href=qi.call(t);t.origin=i0.call(t);t.protocol=u0.call(t);t.username=o0.call(t);t.password=s0.call(t);t.host=f0.call(t);t.hostname=v0.call(t);t.port=c0.call(t);t.pathname=l0.call(t);t.search=h0.call(t);t.searchParams=d0.call(t);t.hash=p0.call(t)}};var Kf=Be.prototype;var qi=function(){var r=W(this);var e=r.scheme;var t=r.username;var n=r.password;var a=r.host;var i=r.port;var u=r.path;var f=r.query;var s=r.fragment;var c=e+":";if(a!==null){c+="//";if(Nf(r)){c+=t+(n?":"+n:"")+"@"}c+=Pn(a);if(i!==null)c+=":"+i}else if(e=="file")c+="//";c+=r.cannotBeABaseURL?u[0]:u.length?"/"+u.join("/"):"";if(f!==null)c+="?"+f;if(s!==null)c+="#"+s;return c};var i0=function(){var r=W(this);var e=r.scheme;var t=r.port;if(e=="blob")try{return new URL(e.path[0]).origin}catch(n){return"null"}if(e=="file"||!Q(r))return"null";return e+"://"+Pn(r.host)+(t!==null?":"+t:"")};var u0=function(){return W(this).scheme+":"};var o0=function(){return W(this).username};var s0=function(){return W(this).password};var f0=function(){var r=W(this);var e=r.host;var t=r.port;return e===null?"":t===null?Pn(e):Pn(e)+":"+t};var v0=function(){var r=W(this).host;return r===null?"":Pn(r)};var c0=function(){var r=W(this).port;return r===null?"":String(r)};var l0=function(){var r=W(this);var e=r.path;return r.cannotBeABaseURL?e[0]:e.length?"/"+e.join("/"):""};var h0=function(){var r=W(this).query;return r?"?"+r:""};var d0=function(){return W(this).searchParams};var p0=function(){var r=W(this).fragment;return r?"#"+r:""};var _r=function(r,e){return{get:r,set:e,configurable:true,enumerable:true}};if(kf){Hk(Kf,{href:_r(qi,function(r){var e=W(this);var t=String(r);var n=Jr(e,t);if(n)throw TypeError(n);jf(e.searchParams).updateSearchParams(e.query)}),origin:_r(i0),protocol:_r(u0,function(r){var e=W(this);Jr(e,String(r)+":",$f)}),username:_r(o0,function(r){var e=W(this);var t=wt(String(r));if(Rf(e))return;e.username="";for(var n=0;n{"use strict";var cV=d();cV({target:"URL",proto:true,enumerable:true},{toJSON:function r(){return URL.prototype.toString.call(this)}})});var m0=o((BZ,y0)=>{uI();vI();hI();pI();yI();g0();q0();wf();var lV=ce();y0.exports=lV});var b0=o((GZ,S0)=>{nI();m0();var hV=ce();S0.exports=hV});var I0=o((HZ,zf)=>{var E0=function(r){"use strict";var e=Object.prototype;var t=e.hasOwnProperty;var n;var a=typeof Symbol==="function"?Symbol:{};var i=a.iterator||"@@iterator";var u=a.asyncIterator||"@@asyncIterator";var f=a.toStringTag||"@@toStringTag";function s(S,g,E){Object.defineProperty(S,g,{value:E,enumerable:true,configurable:true,writable:true});return S[g]}try{s({},"")}catch(S){s=function(g,E,x){return g[E]=x}}function c(S,g,E,x){var w=g&&g.prototype instanceof b?g:b;var z=Object.create(w.prototype);var fr=new G(x||[]);z._invoke=p(S,E,fr);return z}r.wrap=c;function l(S,g,E){try{return{type:"normal",arg:S.call(g,E)}}catch(x){return{type:"throw",arg:x}}}var v="suspendedStart";var h="suspendedYield";var I="executing";var m="completed";var q={};function b(){}function T(){}function _(){}var O={};O[i]=function(){return this};var K=Object.getPrototypeOf;var H=K&&K(K(L([])));if(H&&H!==e&&t.call(H,i)){O=H}var N=_.prototype=b.prototype=Object.create(O);T.prototype=N.constructor=_;_.constructor=T;T.displayName=s(_,f,"GeneratorFunction");function sr(S){["next","throw","return"].forEach(function(g){s(S,g,function(E){return this._invoke(g,E)})})}r.isGeneratorFunction=function(S){var g=typeof S==="function"&&S.constructor;return g?g===T||(g.displayName||g.name)==="GeneratorFunction":false};r.mark=function(S){if(Object.setPrototypeOf){Object.setPrototypeOf(S,_)}else{S.__proto__=_;s(S,f,"GeneratorFunction")}S.prototype=Object.create(N);return S};r.awrap=function(S){return{__await:S}};function Tr(S,g){function E(z,fr,vr,Ar){var cr=l(S[z],S,fr);if(cr.type==="throw"){Ar(cr.arg)}else{var yi=cr.arg;var Ot=yi.value;if(Ot&&typeof Ot==="object"&&t.call(Ot,"__await")){return g.resolve(Ot.__await).then(function(Te){E("next",Te,vr,Ar)},function(Te){E("throw",Te,vr,Ar)})}return g.resolve(Ot).then(function(Te){yi.value=Te;vr(yi)},function(Te){return E("throw",Te,vr,Ar)})}}var x;function w(z,fr){function vr(){return new g(function(Ar,cr){E(z,fr,Ar,cr)})}return x=x?x.then(vr,vr):vr()}this._invoke=w}sr(Tr.prototype);Tr.prototype[u]=function(){return this};r.AsyncIterator=Tr;r.async=function(S,g,E,x,w){if(w===void 0)w=Promise;var z=new Tr(c(S,g,E,x),w);return r.isGeneratorFunction(g)?z:z.next().then(function(fr){return fr.done?fr.value:z.next()})};function p(S,g,E){var x=v;return function w(z,fr){if(x===I){throw new Error("Generator is already running")}if(x===m){if(z==="throw"){throw fr}return Ie()}E.method=z;E.arg=fr;while(true){var vr=E.delegate;if(vr){var Ar=y(vr,E);if(Ar){if(Ar===q)continue;return Ar}}if(E.method==="next"){E.sent=E._sent=E.arg}else if(E.method==="throw"){if(x===v){x=m;throw E.arg}E.dispatchException(E.arg)}else if(E.method==="return"){E.abrupt("return",E.arg)}x=I;var cr=l(S,g,E);if(cr.type==="normal"){x=E.done?m:h;if(cr.arg===q){continue}return{value:cr.arg,done:E.done}}else if(cr.type==="throw"){x=m;E.method="throw";E.arg=cr.arg}}}}function y(S,g){var E=S.iterator[g.method];if(E===n){g.delegate=null;if(g.method==="throw"){if(S.iterator["return"]){g.method="return";g.arg=n;y(S,g);if(g.method==="throw"){return q}}g.method="throw";g.arg=new TypeError("The iterator does not provide a 'throw' method")}return q}var x=l(E,S.iterator,g.arg);if(x.type==="throw"){g.method="throw";g.arg=x.arg;g.delegate=null;return q}var w=x.arg;if(!w){g.method="throw";g.arg=new TypeError("iterator result is not an object");g.delegate=null;return q}if(w.done){g[S.resultName]=w.value;g.next=S.nextLoc;if(g.method!=="return"){g.method="next";g.arg=n}}else{return w}g.delegate=null;return q}sr(N);s(N,f,"Generator");N[i]=function(){return this};N.toString=function(){return"[object Generator]"};function P(S){var g={tryLoc:S[0]};if(1 in S){g.catchLoc=S[1]}if(2 in S){g.finallyLoc=S[2];g.afterLoc=S[3]}this.tryEntries.push(g)}function B(S){var g=S.completion||{};g.type="normal";delete g.arg;S.completion=g}function G(S){this.tryEntries=[{tryLoc:"root"}];S.forEach(P,this);this.reset(true)}r.keys=function(S){var g=[];for(var E in S){g.push(E)}g.reverse();return function x(){while(g.length){var w=g.pop();if(w in S){x.value=w;x.done=false;return x}}x.done=true;return x}};function L(S){if(S){var g=S[i];if(g){return g.call(S)}if(typeof S.next==="function"){return S}if(!isNaN(S.length)){var E=-1,x=function w(){while(++E=0;--x){var w=this.tryEntries[x];var z=w.completion;if(w.tryLoc==="root"){return E("end")}if(w.tryLoc<=this.prev){var fr=t.call(w,"catchLoc");var vr=t.call(w,"finallyLoc");if(fr&&vr){if(this.prev=0;--E){var x=this.tryEntries[E];if(x.tryLoc<=this.prev&&t.call(x,"finallyLoc")&&this.prev=0;--g){var E=this.tryEntries[g];if(E.finallyLoc===S){this.complete(E.completion,E.afterLoc);B(E);return q}}},"catch":function(S){for(var g=this.tryEntries.length-1;g>=0;--g){var E=this.tryEntries[g];if(E.tryLoc===S){var x=E.completion;if(x.type==="throw"){var w=x.arg;B(E)}return w}}throw new Error("illegal catch attempt")},delegateYield:function(S,g,E){this.delegate={iterator:L(S),resultName:g,nextLoc:E};if(this.method==="next"){this.arg=n}return q}};return r}(typeof zf==="object"?zf.exports:{});try{regeneratorRuntime=E0}catch(r){Function("r","regeneratorRuntime = r")(E0)}});var Yf=o((kZ,T0)=>{var dV=R();var pV=Br();var gV=Function.call;T0.exports=function(r,e,t){return pV(gV,dV[r].prototype[e],t)}});var w0=o((VZ,A0)=>{no();var qV=Yf();A0.exports=qV("Array","find")});var x0=o((WZ,O0)=>{var yV=w0();O0.exports=yV});var P0=o((KZ,R0)=>{so();var mV=Yf();R0.exports=mV("Array","map")});var F0=o((zZ,_0)=>{var SV=P0();_0.exports=SV});if(typeof Promise==="undefined"){vv().enable();self.Promise=lv()}if(typeof window!=="undefined"){dv()}Object.assign=qv();Vl();Rh();b0();I0();var JZ=Xf(x0());var ZZ=Xf(F0());export{BV as AdjustmentConfiguration,UV as AdjustmentIdentifier,NV as AdjustmentIdentifierKeys,$V as AdvancedAdjustmentControlBarItem,bW as AdvancedBrushControlBarItem,HV as AdvancedFilterControlBarItem,XV as AdvancedFocusControlBarItem,rW as AdvancedFrameControlBarItem,uW as AdvancedLibraryControlBarItem,sW as AdvancedOverlayControlBarItem,hW as AdvancedStickerControlBarItem,gW as AdvancedTextControlBarItem,TW as AdvancedTextDesignControlBarItem,wW as AdvancedTransformControlBarItem,NW as AdvancedUICardLabel,A3 as AdvancedUICategoryCard,P3 as AdvancedUIControlsBarSection,w3 as AdvancedUIItemCard,R3 as AdvancedUIToolControlBar,x3 as AdvancedUIToolbar,KW as AdvancedUIToolbarItem,PV as AlignmentMode,EW as BasicBrushControlBarTabs,kV as BasicFilterControlBarTabs,JV as BasicFocusControlBarTabs,eW as BasicFrameControlBarTabs,fW as BasicOverlayControlBarTabs,dW as BasicStickerControlBarTabs,qW as BasicTextControlBarTabs,OW as BasicTransformControlBarTabs,F3 as BasicUIToolControlBar,M3 as BasicUIToolItemsBar,_3 as BasicUIToolbar,cW as BlendMode,IW as BrushConfiguration,IV as CanvasAction,BW as CanvasBarTextSecondaryButton,$W as CardAvatar,wV as CardType,AV as CategoryHeaderType,d3 as Checkbox,p3 as CheckboxBase,q3 as CheckboxCheckMark,g3 as CheckboxInput,r3 as ColorItem,a3 as ColorItemActiveOverlay,t3 as ColorItemBackground,e3 as ColorItemBase,n3 as ColorItemTiledBackground,DV as Configuration,UW as ContainedPrimaryButton,QW as Container,GV as CustomToolConfiguration,i3 as Dialog,s3 as DialogBackdrop,u3 as DialogBase,v3 as DialogBody,o3 as DialogContainer,c3 as DialogFooter,f3 as DialogHeader,l3 as DialogSpinner,y3 as Dropdown,FW as DropdownCaret,_W as EventEmitter,MV as ExportConfiguration,LV as ExportFormat,YV as FilterCategoryIdentifier,VV as FilterConfiguration,zV as FilterIdentifier,ZV as FocusConfiguration,QV as FocusIdentifier,tW as FrameConfiguration,DW as IconButton,CV as ImageFormat,jV as ImageMimeType,h3 as Label,nW as LibraryCategory,oW as LibraryConfiguration,aW as LibraryImage,iW as LibraryProvider,OV as ModalType,CW as OutlinedPrimaryButton,jW as OutlinedSecondaryButton,vW as OverlayConfiguration,lW as OverlayIdentifier,zW as PhotoEditorSDKUI,YW as PhotoEditorSDKUIComponent,O3 as SearchField,FV as SerializationExportType,m3 as Slider,S3 as SliderBase,b3 as SliderContainer,xV as SliderIdentifier,E3 as SliderInput,T3 as SliderLabel,I3 as SliderTrack,RV as SnappingConfiguration,GW as SpriteActionButton,pW as StickerConfiguration,yW as TextConfiguration,AW as TextDesignConfiguration,MW as TextPrimaryButton,LW as TextSecondaryButton,TV as Tool,xW as TransformConfiguration,RW as TransformIdentifier,PW as UIEvent,_V as WatermarkConfiguration,WW as WindowContainer,VW as calculateAdvancedUIToolControlBarMeasurements,kW as deepmergeAll,HW as defaultConfig,WV as isDuoToneFilterAsset,EV as isExistingCategory,bV as isExistingItem,SW as isGoogleFontAsset,KV as isLUTFilterAsset,mW as isWebFontAsset,JW as useGetImage,ZW as useIsLayoutAdvanced,XW as useSetImage}; /* object-assign (c) Sindre Sorhus diff --git a/esm/no-polyfills.js b/esm/no-polyfills.js index 422c547..21803b6 100644 --- a/esm/no-polyfills.js +++ b/esm/no-polyfills.js @@ -1 +1 @@ -import{A as _a,B as $a,C as ab,D as bb,E as cb,F as db,G as eb,H as fb,I as gb,J as hb,K as ib,L as jb,M as kb,N as lb,O as mb,a as Aa,b as Ba,c as Ca,d as Da,e as Ea,f as Fa,g as Ga,h as Ha,i as Ia,j as Ja,k as Ka,l as La,m as Ma,n as Na,o as Oa,p as Pa,q as Qa,r as Ra,s as Sa,t as Ta,u as Ua,v as Va,w as Wa,x as Xa,y as Ya,z as Za}from"./chunk-F2RTEFCB.js";import{C as wa,E as xa,F as ya,L as za,e as la,g as ma,h as na,i as oa,j as pa,k as qa,l as ra,n as sa,o as ta,s as ua,t as va}from"./chunk-CYND4KUN.js";import{$ as A,Aa as $,B as a,Ba as aa,C as b,Ca as ba,D as c,Da as ca,E as d,Ea as da,F as e,Fa as ea,G as f,Ga as fa,H as g,Ha as ga,I as h,Ia as ha,J as i,Ja as ia,K as j,Ka as ja,L as k,La as ka,M as l,N as m,O as n,P as o,Q as p,R as q,S as r,T as s,U as t,V as u,W as v,X as w,Y as x,Z as y,_ as z,aa as B,ba as C,ca as D,da as E,ea as F,fa as G,ga as H,ha as I,ia as J,ja as K,ka as L,la as M,ma as N,na as O,oa as P,pa as Q,qa as R,ra as S,sa as T,ta as U,ua as V,va as W,wa as X,xa as Y,ya as Z,za as _}from"./chunk-UDNMGV4K.js";export{u as AdjustmentConfiguration,r as AdjustmentIdentifier,s as AdjustmentIdentifierKeys,t as AdvancedAdjustmentControlBarItem,aa as AdvancedBrushControlBarItem,w as AdvancedFilterControlBarItem,D as AdvancedFocusControlBarItem,H as AdvancedFrameControlBarItem,N as AdvancedLibraryControlBarItem,P as AdvancedOverlayControlBarItem,U as AdvancedStickerControlBarItem,X as AdvancedTextControlBarItem,da as AdvancedTextDesignControlBarItem,fa as AdvancedTransformControlBarItem,sa as AdvancedUICardLabel,eb as AdvancedUICategoryCard,jb as AdvancedUIControlsBarSection,fb as AdvancedUIItemCard,ib as AdvancedUIToolControlBar,hb as AdvancedUIToolbar,Aa as AdvancedUIToolbarItem,j as AlignmentMode,ba as BasicBrushControlBarTabs,x as BasicFilterControlBarTabs,E as BasicFocusControlBarTabs,I as BasicFrameControlBarTabs,Q as BasicOverlayControlBarTabs,V as BasicStickerControlBarTabs,Y as BasicTextControlBarTabs,ga as BasicTransformControlBarTabs,lb as BasicUIToolControlBar,mb as BasicUIToolItemsBar,kb as BasicUIToolbar,S as BlendMode,ca as BrushConfiguration,c as CanvasAction,ua as CanvasBarTextSecondaryButton,ta as CardAvatar,f as CardType,e as CategoryHeaderType,Va as Checkbox,Wa as CheckboxBase,Ya as CheckboxCheckMark,Xa as CheckboxInput,Ha as ColorItem,La as ColorItemActiveOverlay,Ja as ColorItemBackground,Ia as ColorItemBase,Ka as ColorItemTiledBackground,q as Configuration,ra as ContainedPrimaryButton,Ga as Container,v as CustomToolConfiguration,Ma as Dialog,Pa as DialogBackdrop,Na as DialogBase,Ra as DialogBody,Oa as DialogContainer,Sa as DialogFooter,Qa as DialogHeader,Ta as DialogSpinner,Za as Dropdown,la as DropdownCaret,ka as EventEmitter,m as ExportConfiguration,n as ExportFormat,C as FilterCategoryIdentifier,y as FilterConfiguration,B as FilterIdentifier,F as FocusConfiguration,G as FocusIdentifier,J as FrameConfiguration,qa as IconButton,o as ImageFormat,p as ImageMimeType,Ua as Label,K as LibraryCategory,O as LibraryConfiguration,L as LibraryImage,M as LibraryProvider,g as ModalType,oa as OutlinedPrimaryButton,pa as OutlinedSecondaryButton,R as OverlayConfiguration,T as OverlayIdentifier,Ba as PhotoEditorSDKUI,Ca as PhotoEditorSDKUIComponent,gb as SearchField,l as SerializationExportType,_a as Slider,$a as SliderBase,ab as SliderContainer,h as SliderIdentifier,bb as SliderInput,db as SliderLabel,cb as SliderTrack,i as SnappingConfiguration,va as SpriteActionButton,W as StickerConfiguration,Z as TextConfiguration,ea as TextDesignConfiguration,ma as TextPrimaryButton,na as TextSecondaryButton,d as Tool,ha as TransformConfiguration,ia as TransformIdentifier,ja as UIEvent,k as WatermarkConfiguration,za as WindowContainer,ya as calculateAdvancedUIToolControlBarMeasurements,xa as deepmergeAll,wa as defaultConfig,z as isDuoToneFilterAsset,b as isExistingCategory,a as isExistingItem,$ as isGoogleFontAsset,A as isLUTFilterAsset,_ as isWebFontAsset,Ea as useGetImage,Fa as useIsLayoutAdvanced,Da as useSetImage}; +import{A as _a,B as $a,C as ab,D as bb,E as cb,F as db,G as eb,H as fb,I as gb,J as hb,K as ib,L as jb,M as kb,N as lb,O as mb,a as Aa,b as Ba,c as Ca,d as Da,e as Ea,f as Fa,g as Ga,h as Ha,i as Ia,j as Ja,k as Ka,l as La,m as Ma,n as Na,o as Oa,p as Pa,q as Qa,r as Ra,s as Sa,t as Ta,u as Ua,v as Va,w as Wa,x as Xa,y as Ya,z as Za}from"./chunk-K4UIUOUT.js";import{C as wa,E as xa,F as ya,L as za,e as la,g as ma,h as na,i as oa,j as pa,k as qa,l as ra,n as sa,o as ta,s as ua,t as va}from"./chunk-CV3QEYL2.js";import{$ as A,Aa as $,B as a,Ba as aa,C as b,Ca as ba,D as c,Da as ca,E as d,Ea as da,F as e,Fa as ea,G as f,Ga as fa,H as g,Ha as ga,I as h,Ia as ha,J as i,Ja as ia,K as j,Ka as ja,L as k,La as ka,M as l,N as m,O as n,P as o,Q as p,R as q,S as r,T as s,U as t,V as u,W as v,X as w,Y as x,Z as y,_ as z,aa as B,ba as C,ca as D,da as E,ea as F,fa as G,ga as H,ha as I,ia as J,ja as K,ka as L,la as M,ma as N,na as O,oa as P,pa as Q,qa as R,ra as S,sa as T,ta as U,ua as V,va as W,wa as X,xa as Y,ya as Z,za as _}from"./chunk-UDNMGV4K.js";export{u as AdjustmentConfiguration,r as AdjustmentIdentifier,s as AdjustmentIdentifierKeys,t as AdvancedAdjustmentControlBarItem,aa as AdvancedBrushControlBarItem,w as AdvancedFilterControlBarItem,D as AdvancedFocusControlBarItem,H as AdvancedFrameControlBarItem,N as AdvancedLibraryControlBarItem,P as AdvancedOverlayControlBarItem,U as AdvancedStickerControlBarItem,X as AdvancedTextControlBarItem,da as AdvancedTextDesignControlBarItem,fa as AdvancedTransformControlBarItem,sa as AdvancedUICardLabel,eb as AdvancedUICategoryCard,jb as AdvancedUIControlsBarSection,fb as AdvancedUIItemCard,ib as AdvancedUIToolControlBar,hb as AdvancedUIToolbar,Aa as AdvancedUIToolbarItem,j as AlignmentMode,ba as BasicBrushControlBarTabs,x as BasicFilterControlBarTabs,E as BasicFocusControlBarTabs,I as BasicFrameControlBarTabs,Q as BasicOverlayControlBarTabs,V as BasicStickerControlBarTabs,Y as BasicTextControlBarTabs,ga as BasicTransformControlBarTabs,lb as BasicUIToolControlBar,mb as BasicUIToolItemsBar,kb as BasicUIToolbar,S as BlendMode,ca as BrushConfiguration,c as CanvasAction,ua as CanvasBarTextSecondaryButton,ta as CardAvatar,f as CardType,e as CategoryHeaderType,Va as Checkbox,Wa as CheckboxBase,Ya as CheckboxCheckMark,Xa as CheckboxInput,Ha as ColorItem,La as ColorItemActiveOverlay,Ja as ColorItemBackground,Ia as ColorItemBase,Ka as ColorItemTiledBackground,q as Configuration,ra as ContainedPrimaryButton,Ga as Container,v as CustomToolConfiguration,Ma as Dialog,Pa as DialogBackdrop,Na as DialogBase,Ra as DialogBody,Oa as DialogContainer,Sa as DialogFooter,Qa as DialogHeader,Ta as DialogSpinner,Za as Dropdown,la as DropdownCaret,ka as EventEmitter,m as ExportConfiguration,n as ExportFormat,C as FilterCategoryIdentifier,y as FilterConfiguration,B as FilterIdentifier,F as FocusConfiguration,G as FocusIdentifier,J as FrameConfiguration,qa as IconButton,o as ImageFormat,p as ImageMimeType,Ua as Label,K as LibraryCategory,O as LibraryConfiguration,L as LibraryImage,M as LibraryProvider,g as ModalType,oa as OutlinedPrimaryButton,pa as OutlinedSecondaryButton,R as OverlayConfiguration,T as OverlayIdentifier,Ba as PhotoEditorSDKUI,Ca as PhotoEditorSDKUIComponent,gb as SearchField,l as SerializationExportType,_a as Slider,$a as SliderBase,ab as SliderContainer,h as SliderIdentifier,bb as SliderInput,db as SliderLabel,cb as SliderTrack,i as SnappingConfiguration,va as SpriteActionButton,W as StickerConfiguration,Z as TextConfiguration,ea as TextDesignConfiguration,ma as TextPrimaryButton,na as TextSecondaryButton,d as Tool,ha as TransformConfiguration,ia as TransformIdentifier,ja as UIEvent,k as WatermarkConfiguration,za as WindowContainer,ya as calculateAdvancedUIToolControlBarMeasurements,xa as deepmergeAll,wa as defaultConfig,z as isDuoToneFilterAsset,b as isExistingCategory,a as isExistingItem,$ as isGoogleFontAsset,A as isLUTFilterAsset,_ as isWebFontAsset,Ea as useGetImage,Fa as useIsLayoutAdvanced,Da as useSetImage}; diff --git a/esm/serialization-NUWRU2SA.js b/esm/serialization-NEYY5PT4.js similarity index 99% rename from esm/serialization-NUWRU2SA.js rename to esm/serialization-NEYY5PT4.js index 6efb294..cf71a0a 100644 --- a/esm/serialization-NUWRU2SA.js +++ b/esm/serialization-NEYY5PT4.js @@ -1 +1 @@ -import{Ma as v,Oa as b,Qa as u,lb as h}from"./chunk-UDNMGV4K.js";var I=(y="image/png")=>`data:${y};base64,`;var d=class{constructor(e){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const i=h.relativeToAbsolutePoint(e,this.cropSpace,false);return h.pointFromSpaceToSpace(i,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,i=>i.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:d.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const i={};if(e.image){i.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(I(),""):""};i.image.data=i.image.data?I()+i.image.data:""}return i}deserializeTransformation(e){const i={};const a=e.operations.find(o=>o.type==="orientation");const r=e.operations.find(o=>o.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;i.transform=d.initializeEmptyTransform();if(a!=null){i.transform.outputRotation=a.options.rotation;i.transform.flipHorizontally=a.options.flipHorizontally||false;i.transform.flipVertically=a.options.flipVertically||false}if(r){i.transform.start=r.options.start;i.transform.end=r.options.end;i.transform.rotation=r.options.rotation||0;i.transform.identifier=r.options.meta?r.options.meta.identifier:""}return i}deserialize(e){var n,o;const i={};if(e.meta?!d.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const a=this.editor.engineMediator.output.container.getResolution();const{size:r}=this.editor.engineMediator.image.container.getBounds();this.outputSize=a;this.imageSize=r;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(p=>{switch(p.type){case"filter":i.filter=d.deserializeFilter(p.options);break;case"adjustments":i.adjustment=d.deserializeAdjustments(p.options);break;case"focus":i.focus=this.deserializeFocus(p.options);break;case"sprite":const{sprites:z}=p.options;z.forEach(t=>{switch(t.type){case"frame":i.frame=this.deserializeFrame(t.options);break;case"overlay":i.overlay=d.deserializeOverlay(t.options);break;case"brush":if(!i.brush){i.brush=this.deserializeBrush(t.options)}else{i.brush.strokes.push(...this.deserializeBrush(t.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!i.sprite){i.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const s=b();i.sprite.spriteIdList.push(s);i.sprite.common[s]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(t.options.position),tool:"sticker",rotation:t.options.rotation||0,flipHorizontally:t.options.flipHorizontally,flipVertically:t.options.flipVertically};this.spriteOrder+=1;if(t.type==="sticker"){i.sprite.common[s].tool="sticker";i.sprite.common[s].size={width:this.mapRelativeCropSizeToScaledImageSize(t.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(t.options.dimensions.y)};i.sprite.sticker[s]=d.deserializeStickers(t.options)}else if(t.type==="text"){i.sprite.common[s].tool="text";i.sprite.text[s]=this.deserializeTexts(t.options)}else if(t.type==="textdesign"){i.sprite.common[s].tool="textdesign";i.sprite.textdesign[s]=this.deserializeTextDesign(t.options)}break;default:break}});break;default:break}});if(e.assetLibrary){i.customStickers=((o=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:o.stickers)||[]}return i}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:d.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:break}return void 0}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new u(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new u(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const i=new u(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new u(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new u(this.mapRelativeCropPointToImageSpace(e.start)).add(new u(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(i.y,i.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:v(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:d.deserialzeColor(e.color),backgroundColor:d.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:d.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(i=>{return{path:{controlPoints:i.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:d.deserialzeColor(i.brush.color),size:i.brush.size,hardness:i.brush.hardness}}})}}};var k=(y="image/png")=>`data:${y};base64,`;var c=class{constructor(e){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const i=h.relativeToAbsolutePoint(e,this.cropSpace,false);return h.pointFromSpaceToSpace(i,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,i=>i.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:c.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const i={};if(e.image){i.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(k(),""):""};i.image.data=i.image.data?k()+i.image.data:""}return i}deserializeTransformation(e){const i={};const a=e.operations.find(o=>o.type==="orientation");const r=e.operations.find(o=>o.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;i.transform=c.initializeEmptyTransform();if(a!=null){i.transform.outputRotation=a.options.rotation;i.transform.flipHorizontally=a.options.flipHorizontally||false;i.transform.flipVertically=a.options.flipVertically||false}if(r){i.transform.start=r.options.start;i.transform.end=r.options.end;i.transform.rotation=r.options.rotation||0;i.transform.identifier=r.options.meta?r.options.meta.identifier:""}return i}deserialize(e){var n,o;const i={};if(e.meta?!c.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const a=this.editor.engineMediator.output.container.getResolution();const{size:r}=this.editor.engineMediator.image.container.getBounds();this.outputSize=a;this.imageSize=r;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(p=>{switch(p.type){case"filter":i.filter=c.deserializeFilter(p.options);break;case"adjustments":i.adjustment=c.deserializeAdjustments(p.options);break;case"focus":i.focus=this.deserializeFocus(p.options);break;case"sprite":const{sprites:z}=p.options;z.forEach(t=>{switch(t.type){case"frame":i.frame=this.deserializeFrame(t.options);break;case"overlay":i.overlay=c.deserializeOverlay(t.options);break;case"brush":if(!i.brush){i.brush=this.deserializeBrush(t.options)}else{i.brush.strokes.push(...this.deserializeBrush(t.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!i.sprite){i.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const s=b();i.sprite.spriteIdList.push(s);i.sprite.common[s]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(t.options.position),tool:"sticker",rotation:t.options.rotation||0,flipHorizontally:t.options.flipHorizontally,flipVertically:t.options.flipVertically};this.spriteOrder+=1;if(t.type==="sticker"){i.sprite.common[s].tool="sticker";i.sprite.common[s].size={width:this.mapRelativeCropSizeToScaledImageSize(t.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(t.options.dimensions.y)};i.sprite.sticker[s]=c.deserializeStickers(t.options)}else if(t.type==="text"){i.sprite.common[s].tool="text";i.sprite.text[s]=this.deserializeTexts(t.options)}else if(t.type==="textdesign"){i.sprite.common[s].tool="textdesign";i.sprite.textdesign[s]=this.deserializeTextDesign(t.options)}break;default:break}});break;default:break}});if(e.assetLibrary){i.customStickers=((o=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:o.stickers)||[]}return i}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:c.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:return void 0}}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new u(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new u(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const i=new u(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new u(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new u(this.mapRelativeCropPointToImageSpace(e.start)).add(new u(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(i.y,i.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:v(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:c.deserialzeColor(e.color),backgroundColor:c.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:c.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(i=>{return{path:{controlPoints:i.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:c.deserialzeColor(i.brush.color),size:i.brush.size,hardness:i.brush.hardness}}})}}};var E="@photoeditorsdk/root";var j="5.19.2";var A="The most comprehensive photo editor SDK for HTML5";var H="http://github.com/imgly/pesdk-html5";var L="PhotoEditorSDK (img.ly GmbH) ";var V="SEE LICENSE IN LICENSE.md";var B=true;var G={};var U={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};var N={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};var K={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};var X={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};var $={eslint:"7.10.0"};var W=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];var q={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};var F={name:E,version:j,description:A,repository:H,author:L,license:V,private:B,bin:G,scripts:U,devDependencies:N,dependencies:K,devEngines:X,resolutions:$,workspaces:W,husky:q};var f=class{constructor(e,i,a,r,n,o){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=e=>{const i=h.pointFromSpaceToSpace(e,this.imageSpace,this.cropSpace,false);return h.absoluteToRelativePoint(i,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=e=>{return e/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=e=>{return e/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(e,i=0,a=3)=>{const r=Math.tan(i);const n=Math.sqrt(r**2+1);return{x:e.x+a/n,y:e.y+a*r/n}};this.previewPosition=e;this.previewSize=i;this.outputSize=a;this.imageSize=r;this.imageSpace=n;this.cropSpace=o;this.outputScale=o.getScale()}static serializeFilters(e){return{type:"filter",options:{intensity:e.intensity,identifier:e.identifier}}}static serializeAdjustments(e){return{type:"adjustments",options:e}}static serializeOverlay(e){return{type:"overlay",options:{identifier:e.identifier,intensity:e.opacity,blendMode:e.blendMode.replace(/[A-Z]/g,i=>` ${i.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:F.version,createdAt:new Date().toISOString()}}serialise(e,i,a){const r=f.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(i){n.type=a;n.data=i}const o=[];const p=[];const{adjustment:z}=e;if(Object.keys(z).map(l=>z[l]).filter(Boolean).length){o.push(f.serializeAdjustments(z))}const{filter:t}=e;if(t.identifier!=="identity"){o.push(f.serializeFilters(t))}const{overlay:s}=e;if(s.identifier!=="identity"){p.push(f.serializeOverlay(s))}if(e.transform){const{transform:l,orientation:S}=this.serializeTransform(e.transform);const O=[l.options.start.x!==0,l.options.start.y!==0,l.options.end.x!==1,l.options.end.y!==1,l.options.rotation!==0];const T=[S.options.rotation!==0,S.options.flipVertically!==false,S.options.flipHorizontally!==false];if(O.some(g=>g)){o.push(l)}if(T.some(g=>g)){o.push(S)}}const{frame:C}=e;if(C.identifier!=="identity"){p.push(this.serialzeFrame(C))}const{focus:R}=e;if(R.identifier!=="identity"){o.push(this.serializeFocus(R))}if(e.sprite){e.sprite.spriteIdList.forEach(l=>{const S=e.sprite.common[l];switch(S.tool){case"sticker":const O=e.sprite.sticker[l];p.push(this.serializeSticker(O,S,e.transform));break;case"text":const T=e.sprite.text[l];p.push(this.serializeText(T,S));break;case"textdesign":const g=e.sprite.textdesign[l];p.push(this.serializeTextDesign(g,S));break;default:break}})}if(e.brush.strokes.length){p.push({type:"brush",options:{paths:e.brush.strokes.map(l=>{return{points:l.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:l.brush.color},size:l.brush.size,hardness:l.brush.hardness}}})}})}if(p.length){const l={type:"sprite",options:{sprites:p}};o.push(l)}const P=e.customStickers;const w={assets:{stickers:P}};return{version:this.version,meta:r,image:n,operations:o,assetLibrary:w}}serialzeFrame(e){return{type:"frame",options:{identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.color},size:this.mapSizeToRelativeUnscaledCropSize(e.width)}}}serializeFocus(e){const i=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(e.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(e.linear.start),end:this.mapImagePointToRelativeCropPoint(e.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(e.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(e.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(e.radial.center,0,e.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(e.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:a}=e;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(a.origin,a.rotation,i/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(a.origin,a.rotation,-i/2)),size:this.mapSizeToRelativeScaledCropSize(e.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(e.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(e.gaussian.blurRadius)}}}}}serializeSticker(e,i,a){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(i.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(i.size.width),y:this.mapSizeToRelativeScaledCropSize(i.size.height)},rotation:i.rotation,flipVertically:(i.flipVertically||false)!==(a.flipVertically||false),flipHorizontally:(i.flipHorizontally||false)!==(a.flipHorizontally||false),identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.tintColor},tintMode:e.tintMode}}}serializeText(e,i){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(i.position),rotation:i.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:e.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(e.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(e.width),text:e.text,lineHeight:e.lineHeight,color:{rgba:e.textColor},backgroundColor:{rgba:e.backgroundColor},alignment:e.alignment}}}serializeTextDesign(e,i){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(i.position),rotation:i.rotation,flipVertically:false,flipHorizontally:false,identifier:e.identifier,inverted:e.isInverted,text:e.text,seed:e.seed,width:this.mapSizeToRelativeScaledCropSize(e.width),padding:this.mapSizeToRelativeScaledCropSize(e.padding),color:{rgba:e.color}}}}serializeTransform(e){const{start:i,end:a}=e;const r={type:"transform",options:{start:i,end:a,rotation:e.rotation,meta:{identifier:e.identifier}}};const n={type:"orientation",options:{rotation:e.outputRotation,flipHorizontally:e.flipHorizontally,flipVertically:e.flipVertically}};return{transform:r,orientation:n}}};var Te={"3.9.0":c,"3.12.0":d};export{Te as Deserializers,f as Serializer}; +import{Ma as v,Oa as b,Qa as u,lb as h}from"./chunk-UDNMGV4K.js";var I=(y="image/png")=>`data:${y};base64,`;var d=class{constructor(e){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const i=h.relativeToAbsolutePoint(e,this.cropSpace,false);return h.pointFromSpaceToSpace(i,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,i=>i.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:d.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const i={};if(e.image){i.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(I(),""):""};i.image.data=i.image.data?I()+i.image.data:""}return i}deserializeTransformation(e){const i={};const a=e.operations.find(o=>o.type==="orientation");const r=e.operations.find(o=>o.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;i.transform=d.initializeEmptyTransform();if(a!=null){i.transform.outputRotation=a.options.rotation;i.transform.flipHorizontally=a.options.flipHorizontally||false;i.transform.flipVertically=a.options.flipVertically||false}if(r){i.transform.start=r.options.start;i.transform.end=r.options.end;i.transform.rotation=r.options.rotation||0;i.transform.identifier=r.options.meta?r.options.meta.identifier:""}return i}deserialize(e){var n,o;const i={};if(e.meta?!d.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const a=this.editor.engineMediator.output.container.getResolution();const{size:r}=this.editor.engineMediator.image.container.getBounds();this.outputSize=a;this.imageSize=r;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(p=>{switch(p.type){case"filter":i.filter=d.deserializeFilter(p.options);break;case"adjustments":i.adjustment=d.deserializeAdjustments(p.options);break;case"focus":i.focus=this.deserializeFocus(p.options);break;case"sprite":const{sprites:z}=p.options;z.forEach(t=>{switch(t.type){case"frame":i.frame=this.deserializeFrame(t.options);break;case"overlay":i.overlay=d.deserializeOverlay(t.options);break;case"brush":if(!i.brush){i.brush=this.deserializeBrush(t.options)}else{i.brush.strokes.push(...this.deserializeBrush(t.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!i.sprite){i.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const s=b();i.sprite.spriteIdList.push(s);i.sprite.common[s]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(t.options.position),tool:"sticker",rotation:t.options.rotation||0,flipHorizontally:t.options.flipHorizontally,flipVertically:t.options.flipVertically};this.spriteOrder+=1;if(t.type==="sticker"){i.sprite.common[s].tool="sticker";i.sprite.common[s].size={width:this.mapRelativeCropSizeToScaledImageSize(t.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(t.options.dimensions.y)};i.sprite.sticker[s]=d.deserializeStickers(t.options)}else if(t.type==="text"){i.sprite.common[s].tool="text";i.sprite.text[s]=this.deserializeTexts(t.options)}else if(t.type==="textdesign"){i.sprite.common[s].tool="textdesign";i.sprite.textdesign[s]=this.deserializeTextDesign(t.options)}break;default:break}});break;default:break}});if(e.assetLibrary){i.customStickers=((o=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:o.stickers)||[]}return i}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:d.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:break}return void 0}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new u(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new u(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const i=new u(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new u(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new u(this.mapRelativeCropPointToImageSpace(e.start)).add(new u(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(i.y,i.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:v(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:d.deserialzeColor(e.color),backgroundColor:d.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:d.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(i=>{return{path:{controlPoints:i.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:d.deserialzeColor(i.brush.color),size:i.brush.size,hardness:i.brush.hardness}}})}}};var k=(y="image/png")=>`data:${y};base64,`;var c=class{constructor(e){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const i=h.relativeToAbsolutePoint(e,this.cropSpace,false);return h.pointFromSpaceToSpace(i,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,i=>i.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:c.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const i={};if(e.image){i.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(k(),""):""};i.image.data=i.image.data?k()+i.image.data:""}return i}deserializeTransformation(e){const i={};const a=e.operations.find(o=>o.type==="orientation");const r=e.operations.find(o=>o.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;i.transform=c.initializeEmptyTransform();if(a!=null){i.transform.outputRotation=a.options.rotation;i.transform.flipHorizontally=a.options.flipHorizontally||false;i.transform.flipVertically=a.options.flipVertically||false}if(r){i.transform.start=r.options.start;i.transform.end=r.options.end;i.transform.rotation=r.options.rotation||0;i.transform.identifier=r.options.meta?r.options.meta.identifier:""}return i}deserialize(e){var n,o;const i={};if(e.meta?!c.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const a=this.editor.engineMediator.output.container.getResolution();const{size:r}=this.editor.engineMediator.image.container.getBounds();this.outputSize=a;this.imageSize=r;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(p=>{switch(p.type){case"filter":i.filter=c.deserializeFilter(p.options);break;case"adjustments":i.adjustment=c.deserializeAdjustments(p.options);break;case"focus":i.focus=this.deserializeFocus(p.options);break;case"sprite":const{sprites:z}=p.options;z.forEach(t=>{switch(t.type){case"frame":i.frame=this.deserializeFrame(t.options);break;case"overlay":i.overlay=c.deserializeOverlay(t.options);break;case"brush":if(!i.brush){i.brush=this.deserializeBrush(t.options)}else{i.brush.strokes.push(...this.deserializeBrush(t.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!i.sprite){i.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const s=b();i.sprite.spriteIdList.push(s);i.sprite.common[s]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(t.options.position),tool:"sticker",rotation:t.options.rotation||0,flipHorizontally:t.options.flipHorizontally,flipVertically:t.options.flipVertically};this.spriteOrder+=1;if(t.type==="sticker"){i.sprite.common[s].tool="sticker";i.sprite.common[s].size={width:this.mapRelativeCropSizeToScaledImageSize(t.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(t.options.dimensions.y)};i.sprite.sticker[s]=c.deserializeStickers(t.options)}else if(t.type==="text"){i.sprite.common[s].tool="text";i.sprite.text[s]=this.deserializeTexts(t.options)}else if(t.type==="textdesign"){i.sprite.common[s].tool="textdesign";i.sprite.textdesign[s]=this.deserializeTextDesign(t.options)}break;default:break}});break;default:break}});if(e.assetLibrary){i.customStickers=((o=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:o.stickers)||[]}return i}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:c.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:return void 0}}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new u(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new u(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const i=new u(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new u(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new u(this.mapRelativeCropPointToImageSpace(e.start)).add(new u(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(i.y,i.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:v(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:c.deserialzeColor(e.color),backgroundColor:c.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:c.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(i=>{return{path:{controlPoints:i.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:c.deserialzeColor(i.brush.color),size:i.brush.size,hardness:i.brush.hardness}}})}}};var E="@photoeditorsdk/root";var j="5.19.3";var A="The most comprehensive photo editor SDK for HTML5";var H="http://github.com/imgly/pesdk-html5";var L="PhotoEditorSDK (img.ly GmbH) ";var V="SEE LICENSE IN LICENSE.md";var B=true;var G={};var U={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};var N={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};var K={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};var X={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};var $={eslint:"7.10.0"};var W=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];var q={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};var F={name:E,version:j,description:A,repository:H,author:L,license:V,private:B,bin:G,scripts:U,devDependencies:N,dependencies:K,devEngines:X,resolutions:$,workspaces:W,husky:q};var f=class{constructor(e,i,a,r,n,o){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=e=>{const i=h.pointFromSpaceToSpace(e,this.imageSpace,this.cropSpace,false);return h.absoluteToRelativePoint(i,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=e=>{return e/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=e=>{return e/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(e,i=0,a=3)=>{const r=Math.tan(i);const n=Math.sqrt(r**2+1);return{x:e.x+a/n,y:e.y+a*r/n}};this.previewPosition=e;this.previewSize=i;this.outputSize=a;this.imageSize=r;this.imageSpace=n;this.cropSpace=o;this.outputScale=o.getScale()}static serializeFilters(e){return{type:"filter",options:{intensity:e.intensity,identifier:e.identifier}}}static serializeAdjustments(e){return{type:"adjustments",options:e}}static serializeOverlay(e){return{type:"overlay",options:{identifier:e.identifier,intensity:e.opacity,blendMode:e.blendMode.replace(/[A-Z]/g,i=>` ${i.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:F.version,createdAt:new Date().toISOString()}}serialise(e,i,a){const r=f.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(i){n.type=a;n.data=i}const o=[];const p=[];const{adjustment:z}=e;if(Object.keys(z).map(l=>z[l]).filter(Boolean).length){o.push(f.serializeAdjustments(z))}const{filter:t}=e;if(t.identifier!=="identity"){o.push(f.serializeFilters(t))}const{overlay:s}=e;if(s.identifier!=="identity"){p.push(f.serializeOverlay(s))}if(e.transform){const{transform:l,orientation:S}=this.serializeTransform(e.transform);const O=[l.options.start.x!==0,l.options.start.y!==0,l.options.end.x!==1,l.options.end.y!==1,l.options.rotation!==0];const T=[S.options.rotation!==0,S.options.flipVertically!==false,S.options.flipHorizontally!==false];if(O.some(g=>g)){o.push(l)}if(T.some(g=>g)){o.push(S)}}const{frame:C}=e;if(C.identifier!=="identity"){p.push(this.serialzeFrame(C))}const{focus:R}=e;if(R.identifier!=="identity"){o.push(this.serializeFocus(R))}if(e.sprite){e.sprite.spriteIdList.forEach(l=>{const S=e.sprite.common[l];switch(S.tool){case"sticker":const O=e.sprite.sticker[l];p.push(this.serializeSticker(O,S,e.transform));break;case"text":const T=e.sprite.text[l];p.push(this.serializeText(T,S));break;case"textdesign":const g=e.sprite.textdesign[l];p.push(this.serializeTextDesign(g,S));break;default:break}})}if(e.brush.strokes.length){p.push({type:"brush",options:{paths:e.brush.strokes.map(l=>{return{points:l.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:l.brush.color},size:l.brush.size,hardness:l.brush.hardness}}})}})}if(p.length){const l={type:"sprite",options:{sprites:p}};o.push(l)}const P=e.customStickers;const w={assets:{stickers:P}};return{version:this.version,meta:r,image:n,operations:o,assetLibrary:w}}serialzeFrame(e){return{type:"frame",options:{identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.color},size:this.mapSizeToRelativeUnscaledCropSize(e.width)}}}serializeFocus(e){const i=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(e.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(e.linear.start),end:this.mapImagePointToRelativeCropPoint(e.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(e.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(e.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(e.radial.center,0,e.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(e.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:a}=e;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(a.origin,a.rotation,i/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(a.origin,a.rotation,-i/2)),size:this.mapSizeToRelativeScaledCropSize(e.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(e.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(e.gaussian.blurRadius)}}}}}serializeSticker(e,i,a){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(i.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(i.size.width),y:this.mapSizeToRelativeScaledCropSize(i.size.height)},rotation:i.rotation,flipVertically:(i.flipVertically||false)!==(a.flipVertically||false),flipHorizontally:(i.flipHorizontally||false)!==(a.flipHorizontally||false),identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.tintColor},tintMode:e.tintMode}}}serializeText(e,i){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(i.position),rotation:i.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:e.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(e.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(e.width),text:e.text,lineHeight:e.lineHeight,color:{rgba:e.textColor},backgroundColor:{rgba:e.backgroundColor},alignment:e.alignment}}}serializeTextDesign(e,i){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(i.position),rotation:i.rotation,flipVertically:false,flipHorizontally:false,identifier:e.identifier,inverted:e.isInverted,text:e.text,seed:e.seed,width:this.mapSizeToRelativeScaledCropSize(e.width),padding:this.mapSizeToRelativeScaledCropSize(e.padding),color:{rgba:e.color}}}}serializeTransform(e){const{start:i,end:a}=e;const r={type:"transform",options:{start:i,end:a,rotation:e.rotation,meta:{identifier:e.identifier}}};const n={type:"orientation",options:{rotation:e.outputRotation,flipHorizontally:e.flipHorizontally,flipVertically:e.flipVertically}};return{transform:r,orientation:n}}};var Te={"3.9.0":c,"3.12.0":d};export{Te as Deserializers,f as Serializer}; diff --git a/legacy/index.js b/legacy/index.js index bb11b5c..235997a 100644 --- a/legacy/index.js +++ b/legacy/index.js @@ -12712,7 +12712,7 @@ object-assign (c) Sindre Sorhus @license MIT */ -"use strict";var _excluded=["position","defaultPosition","rotation","defaultClassName","defaultClassNameDragging","defaultClassNameDragged"],_excluded2=["isActive","isDisabled","label","ariaLabel","children","className"],_excluded3=["direction","data-test","className","children"],_excluded4=["label","children","icon","fullWidth","isDisabled"],_excluded5=["label","icon","children"],_excluded6=["enableRotation","enableFlip"],_excluded7=["preventExportEvent"],_excluded8=["type"],_excluded9=["children"],_excluded10=["children"],_excluded11=["children"],_excluded12=["children"],_excluded13=["isActive"],_excluded14=["type"];var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10,_templateObject11,_templateObject12,_templateObject13,_templateObject14,_templateObject15,_templateObject16,_templateObject17,_templateObject18,_templateObject19,_templateObject20,_templateObject21,_templateObject22,_templateObject23,_templateObject24,_templateObject25,_templateObject26,_templateObject27,_templateObject28,_templateObject29,_templateObject30,_templateObject31,_templateObject32,_templateObject33,_templateObject34,_templateObject35,_templateObject36,_templateObject37,_templateObject38,_templateObject39,_templateObject40,_templateObject41,_templateObject42,_templateObject43,_templateObject44,_templateObject45,_templateObject46,_templateObject47,_templateObject48,_templateObject49,_templateObject50,_templateObject51,_templateObject52,_templateObject53,_templateObject54,_templateObject55,_templateObject56,_templateObject57,_templateObject58,_templateObject59,_templateObject60,_templateObject61,_templateObject62,_templateObject63,_templateObject64,_templateObject65,_templateObject66,_templateObject67,_templateObject68,_templateObject69,_templateObject70,_templateObject71,_templateObject72,_templateObject73,_templateObject74,_templateObject75,_templateObject76,_templateObject77,_templateObject78,_templateObject79,_templateObject80,_templateObject81,_templateObject82,_templateObject83,_templateObject84,_templateObject85,_templateObject86,_templateObject87,_templateObject88,_templateObject89,_templateObject90,_templateObject91,_templateObject92,_templateObject93,_templateObject94,_templateObject95,_templateObject96,_templateObject97,_templateObject98,_templateObject99,_templateObject100,_templateObject101,_templateObject102,_templateObject103,_templateObject104,_templateObject105,_templateObject106,_templateObject107,_templateObject108,_templateObject109,_templateObject110,_templateObject111,_templateObject112,_templateObject113,_templateObject114,_templateObject115,_templateObject116,_templateObject117,_templateObject118,_templateObject119,_templateObject120,_templateObject121,_templateObject122,_templateObject123,_templateObject124,_templateObject125,_templateObject126,_templateObject127,_templateObject128,_templateObject129,_templateObject130,_templateObject131,_templateObject132,_templateObject133,_templateObject134,_templateObject135,_templateObject136,_templateObject137,_templateObject138,_templateObject139,_templateObject140,_templateObject141,_templateObject142,_templateObject143,_templateObject144,_templateObject145,_templateObject146,_templateObject147,_templateObject148,_templateObject149,_templateObject150,_templateObject151,_templateObject152,_templateObject153,_templateObject154,_templateObject155,_templateObject156,_templateObject157,_templateObject158,_templateObject159,_templateObject160,_templateObject161,_templateObject162,_templateObject163,_templateObject164,_templateObject165,_templateObject166,_templateObject167,_templateObject168,_templateObject169,_templateObject170,_templateObject171,_templateObject172,_templateObject173,_templateObject174,_templateObject175,_templateObject176,_templateObject177,_templateObject178,_templateObject179,_templateObject180,_templateObject181,_templateObject182,_templateObject183,_templateObject184,_templateObject185,_templateObject186,_templateObject187,_templateObject188,_templateObject189,_templateObject190,_templateObject191,_templateObject192,_templateObject193,_templateObject194,_templateObject195,_templateObject196,_templateObject197,_templateObject198,_templateObject199,_templateObject200,_templateObject201,_templateObject202,_templateObject203,_templateObject204,_templateObject205,_templateObject206,_templateObject207,_templateObject208,_templateObject209,_templateObject210,_templateObject211,_templateObject212,_templateObject213,_templateObject214,_templateObject215,_templateObject216,_templateObject217,_templateObject218,_templateObject219,_templateObject220,_templateObject221,_templateObject222,_templateObject223,_templateObject224,_templateObject225,_templateObject226,_templateObject227,_templateObject228,_templateObject229,_templateObject230,_templateObject231,_templateObject232,_templateObject233,_templateObject234,_templateObject235,_templateObject236,_templateObject237,_templateObject238,_templateObject239,_templateObject240,_templateObject241,_templateObject242,_templateObject243,_templateObject244,_templateObject245,_templateObject246,_templateObject247,_templateObject248,_templateObject249,_templateObject250,_templateObject251,_templateObject252,_templateObject253,_templateObject254,_templateObject255,_templateObject256,_templateObject257,_templateObject258,_templateObject259,_templateObject260,_templateObject261,_templateObject262,_templateObject263,_templateObject264,_templateObject265,_templateObject266,_templateObject267,_templateObject268,_templateObject269,_templateObject270,_templateObject271,_templateObject272,_templateObject273,_templateObject274,_templateObject275,_templateObject276,_templateObject277,_templateObject278,_templateObject279,_templateObject280,_templateObject281,_templateObject282,_templateObject283,_templateObject284,_templateObject285,_templateObject286,_templateObject287,_templateObject288,_templateObject289,_templateObject290,_templateObject291,_templateObject292,_templateObject293,_templateObject294,_templateObject295,_templateObject296,_templateObject297,_templateObject298,_templateObject299,_templateObject300,_templateObject301,_templateObject302,_templateObject303,_templateObject304,_templateObject305,_templateObject306,_templateObject307,_templateObject308,_templateObject309,_templateObject310,_templateObject311,_templateObject312,_templateObject313,_templateObject314,_templateObject315,_templateObject316,_templateObject317,_templateObject318,_templateObject319,_templateObject320,_templateObject321,_templateObject322,_templateObject323,_templateObject324,_templateObject325,_templateObject326,_templateObject327,_templateObject328,_templateObject329,_templateObject330,_templateObject331,_templateObject332,_templateObject333,_templateObject334,_templateObject335,_templateObject336,_templateObject337,_templateObject338,_templateObject339,_templateObject340,_templateObject341,_templateObject342,_templateObject343,_templateObject344,_templateObject345,_templateObject346,_templateObject347,_templateObject348,_templateObject349,_templateObject350,_templateObject351,_templateObject352,_templateObject353,_templateObject354,_templateObject355,_templateObject356,_templateObject357,_templateObject358,_templateObject359,_templateObject360,_templateObject361,_templateObject362,_templateObject363,_templateObject364,_templateObject365,_templateObject366,_templateObject367,_templateObject368,_templateObject369,_templateObject370,_templateObject371,_templateObject372;function _get(target,property,receiver){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get;}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(receiver);}return desc.value;};}return _get(target,property,receiver||target);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i=0)continue;target[key]=source[key];}return target;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map():undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function");}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper);}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor);}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class);};return _wrapNativeSuper(Class);}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct;}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e37){throw _e37;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e38){didErr=true;err=_e38;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i1?void 0:r?DD(t,e):t;for(var n=i.length-1,s;n>=0;n--){if(s=i[n])o=(r?s(t,e,o):s(o))||o;}if(r&&o)Pu(t,e,o);return o;};var q=function q(i,t,e){aJ(i,_typeof(t)!=="symbol"?t+"":t,e);return e;};function Wm(){if(typeof window!=="undefined"){return window;}if(typeof global!=="undefined"){return global;}if(typeof self!=="undefined"){return self;}return cJ;}function Cr(){return++lt.mobxGuid;}function me(i){pa(false,i);throw"X";}function pa(i,t){if(!i)throw new Error("[mobx] "+(t||lJ));}function is(i,t){if(true)return false;if(t){return is("'"+i+"', use '"+t+"' instead.");}if(RD.indexOf(i)!==-1)return false;RD.push(i);console.error("[mobx] Deprecated: "+i);return true;}function k0(i){var t=false;return function(){if(t)return;t=true;return i.apply(this,arguments);};}function uJ(i){var t=[];i.forEach(function(e){if(t.indexOf(e)===-1)t.push(e);});return t;}function I0(i){return i!==null&&_typeof(i)==="object";}function Uu(i){if(i===null||_typeof(i)!=="object")return false;var t=Object.getPrototypeOf(i);return t===Object.prototype||t===null;}function dJ(i){if(Nu(i)||sn(i)){return i;}else if(Array.isArray(i)){return new Map(i);}else if(Uu(i)){var t=new Map();for(var e in i){t.set(e,i[e]);}return t;}else{return me("Cannot convert to map from '"+i+"'");}}function mJ(i,t){for(var e=0;e0)&&!(o=r.next()).done){n.push(o.value);}}catch(a){s={error:a};}finally{try{if(o&&!o.done&&(e=r["return"]))e.call(r);}finally{if(s)throw s.error;}}return n;}function x0(){for(var i=[],t=0;t0;if(lt.computationDepth>0&&t)me(false);if(!lt.allowStateChanges&&(t||lt.enforceActions==="strict"))me(false);}function FJ(i){if(false){console.warn("[mobx] Observable "+i.name+" being read outside a reactive context");}}function QD(i,t,e){var r=Ll(true);tE(i);i.newObserving=new Array(i.observing.length+100);i.unboundDepsCount=0;i.runId=++lt.runId;var o=lt.trackingDerivation;lt.trackingDerivation=i;var n;if(lt.disableErrorBoundaries===true){n=t.call(e);}else{try{n=t.call(e);}catch(s){n=new fg(s);}}lt.trackingDerivation=o;RJ(i);if(i.observing.length===0){OJ(i);}os(r);return n;}function OJ(i){if(true)return;if(lt.reactionRequiresObservable||i.requiresObservable){console.warn("[mobx] Derivation "+i.name+" is created/updated without reading any observable value");}}function RJ(i){var t=i.observing;var e=i.observing=i.newObserving;var r=Yt.UP_TO_DATE;var o=0,n=i.unboundDepsCount;for(var s=0;sr){r=a.dependenciesState;}}e.length=o;i.newObserving=null;n=t.length;while(n--){var a=t[n];if(a.diffValue===0){oE(a,i);}a.diffValue=0;}while(o--){var a=e[o];if(a.diffValue===1){a.diffValue=0;zJ(a,i);}}if(r!==Yt.UP_TO_DATE){i.dependenciesState=r;i.onBecomeStale();}}function C0(i){var t=i.observing;i.observing=[];var e=t.length;while(e--){oE(t[e],i);}i.dependenciesState=Yt.NOT_TRACKING;}function R0(i){var t=Hu();var e=i();ha(t);return e;}function Hu(){var i=lt.trackingDerivation;lt.trackingDerivation=null;return i;}function ha(i){lt.trackingDerivation=i;}function Ll(i){var t=lt.allowStateReads;lt.allowStateReads=i;return t;}function os(i){lt.allowStateReads=i;}function tE(i){if(i.dependenciesState===Yt.UP_TO_DATE)return;i.dependenciesState=Yt.UP_TO_DATE;var t=i.observing;var e=t.length;while(e--){t[e].lowestObserverState=Yt.UP_TO_DATE;}}function Al(i,t){if(false){pa(typeof t==="function","`action` can only be invoked on functions");if(typeof i!=="string"||!i)me("actions should have valid names, got: '"+i+"'");}var e=function e(){return eE(i,t,this,arguments);};if(false){if(xpt){Object.defineProperty(e,"name",{value:i});}}e.isMobxAction=true;return e;}function eE(i,t,e,r){var o=BJ(i,e,r);try{return t.apply(e,r);}catch(n){o.error=n;throw n;}finally{PJ(o);}}function BJ(i,t,e){var r=bi()&&!!i;var o=0;if(r){o=Date.now();var n=e&&e.length||0;var s=new Array(n);if(n>0)for(var a=0;at.dependenciesState)i.lowestObserverState=t.dependenciesState;}function oE(i,t){if(i.observers.length===1){i.observers.length=0;nE(i);}else{var e=i.observers;var r=i.observersIndexes;var o=e.pop();if(o!==t){var n=r[t.__mapid]||0;if(n){r[o.__mapid]=n;}else{delete r[o.__mapid];}e[n]=o;}delete r[t.__mapid];}}function nE(i){if(i.isPendingUnobservation===false){i.isPendingUnobservation=true;lt.pendingUnobservations.push(i);}}function ns(){lt.inBatch++;}function ss(){if(--lt.inBatch===0){cE();var i=lt.pendingUnobservations;for(var t=0;t0){nE(i);}return false;}function UJ(i){if(i.lowestObserverState===Yt.STALE)return;i.lowestObserverState=Yt.STALE;var t=i.observers;var e=t.length;while(e--){var r=t[e];if(r.dependenciesState===Yt.UP_TO_DATE){if(r.isTracing!==xo.NONE){aE(r,i);}r.onBecomeStale();}r.dependenciesState=Yt.STALE;}}function NJ(i){if(i.lowestObserverState===Yt.STALE)return;i.lowestObserverState=Yt.STALE;var t=i.observers;var e=t.length;while(e--){var r=t[e];if(r.dependenciesState===Yt.POSSIBLY_STALE)r.dependenciesState=Yt.STALE;else if(r.dependenciesState===Yt.UP_TO_DATE)i.lowestObserverState=Yt.UP_TO_DATE;}}function HJ(i){if(i.lowestObserverState!==Yt.UP_TO_DATE)return;i.lowestObserverState=Yt.POSSIBLY_STALE;var t=i.observers;var e=t.length;while(e--){var r=t[e];if(r.dependenciesState===Yt.UP_TO_DATE){r.dependenciesState=Yt.POSSIBLY_STALE;if(r.isTracing!==xo.NONE){aE(r,i);}r.onBecomeStale();}}}function aE(i,t){console.log("[mobx.trace] '"+i.name+"' is invalidated due to a change in: '"+t.name+"'");if(i.isTracing===xo.BREAK){var e=[];lE(B0(i),e,1);new Function("debugger;\n/*\nTracing '"+i.name+"'\n\nYou are entering this break point because derivation '"+i.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(i instanceof ga?i.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+e.join("\n")+"\n*/\n ")();}}function lE(i,t,e){if(t.length>=1e3){t.push("(and many more)");return;}t.push(""+new Array(e).join(" ")+i.name);if(i.dependencies)i.dependencies.forEach(function(r){return lE(r,t,e+1);});}function cE(){if(lt.inBatch>0||lt.isRunningReactions)return;S0(WJ);}function WJ(){lt.isRunningReactions=true;var i=lt.pendingReactions;var t=0;while(i.length>0){if(++t===LD){console.error("Reaction doesn't converge to a stable state after "+LD+" iterations."+(" Probably there is a cycle in the reactive function: "+i[0]));i.splice(0);}var e=i.splice(0);for(var r=0,o=e.length;r";var r=typeof i==="function"?i:t;if(false){pa(typeof r==="function"&&r.length===0,"`runInAction` expects a function without arguments");if(typeof e!=="string"||!e)me("actions should have valid names, got: '"+e+"'");}return eE(e,r,this,void 0);}function b0(i,t,e){as(i,t,Al(t,e.bind(i)));}function XJ(i,t){if(t===void 0){t=VD;}if(false){pa(typeof i==="function","Autorun expects a function as first argument");pa(isAction(i)===false,"Autorun does not accept actions since actions are untrackable");}var e=t&&t.name||i.name||"Autorun@"+Cr();var r=!t.scheduler&&!t.delay;var o;if(r){o=new ba(e,function(){this.track(a);},t.onError,t.requiresObservable);}else{var n=YJ(t);var s=false;o=new ba(e,function(){if(!s){s=true;n(function(){s=false;if(!o.isDisposed)o.track(a);});}},t.onError,t.requiresObservable);}function a(){i(o);}o.schedule();return o.getDisposer();}function YJ(i){return i.scheduler?i.scheduler:i.delay?function(t){return setTimeout(t,i.delay);}:qJ;}function JJ(i,t,e){return dE("onBecomeObserved",i,t,e);}function uE(i,t,e){return dE("onBecomeUnobserved",i,t,e);}function dE(i,t,e,r){var o=typeof r==="function"?ya(t,e):ya(t);var n=typeof r==="function"?r:e;var s=o[i];if(typeof s!=="function")return me(false);o[i]=function(){s.call(this);n.call(this);};return function(){o[i]=s;};}function wg(i){var t=i.enforceActions,e=i.computedRequiresReaction,r=i.computedConfigurable,o=i.disableErrorBoundaries,n=i.arrayBuffer,s=i.reactionScheduler,a=i.reactionRequiresObservable,l=i.observableRequiresReaction;if(i.isolateGlobalState===true){LJ();}if(t!==void 0){if(typeof t==="boolean"||t==="strict")is("Deprecated value for 'enforceActions', use 'false' => '\"never\"', 'true' => '\"observed\"', '\"strict\"' => \"'always'\" instead");var c=void 0;switch(t){case true:case"observed":c=true;break;case false:case"never":c=false;break;case"strict":case"always":c="strict";break;default:me("Invalid value for 'enforceActions': '"+t+"', expected 'never', 'always' or 'observed'");}lt.enforceActions=c;lt.allowStateChanges=c===true||c==="strict"?false:true;}if(e!==void 0){lt.computedRequiresReaction=!!e;}if(a!==void 0){lt.reactionRequiresObservable=!!a;}if(l!==void 0){lt.observableRequiresReaction=!!l;lt.allowStateReads=!lt.observableRequiresReaction;}if(r!==void 0){lt.computedConfigurable=!!r;}if(o!==void 0){if(o===true)console.warn("WARNING: Debug feature only. MobX will NOT recover from errors if this is on.");lt.disableErrorBoundaries=!!o;}if(typeof n==="number"){M0(n);}if(s){GJ(s);}}function ZJ(i,t,e,r){if(false){pa(arguments.length>=2&&arguments.length<=4,"'extendObservable' expected 2-4 arguments");pa(_typeof(i)==="object","'extendObservable' expects an object as first argument");pa(!sn(i),"'extendObservable' should not be used on maps, use map.merge instead");pa(!yg(t),"Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540");if(e){for(var o in e){if(!(o in t))me("Trying to declare a decorator for unspecified property '"+o+"'");}}}r=Lu(r);var n=r.defaultDecorator||(r.deep===false?ZD:O0);Bl(i);L0(i,r.name,n.enhancer);ns();try{var s=Object.getOwnPropertyNames(t);for(var a=0,l=s.length;a0)t.dependencies=uJ(i.observing).map(mE);return t;}function QJ(){this.message="FLOW_CANCELLED";}function tZ(i,t){if(i===null||i===void 0)return false;if(t!==void 0){if(false)return me("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");if(Ml(i)){var e=i.$mobx;return e.values&&!!e.values[t];}return false;}return Ml(i)||!!i.$mobx||F0(i)||bg(i)||Sg(i);}function yg(i){if(arguments.length!==1)me(false);return tZ(i);}function eZ(i){if(Ml(i)){return i.$mobx.getKeys();}if(sn(i)){return rs(i.keys());}if(xa(i)){return rs(i.keys());}if(zl(i)){return i.map(function(t,e){return e;});}return me(false);}function Mu(i,t,e,r){if(r.detectCycles)i.set(t,e);return e;}function ma(i,t,e){if(!t.recurseEverything&&!yg(i))return i;if(_typeof(i)!=="object")return i;if(i===null)return null;if(i instanceof Date)return i;if(MJ(i))return ma(i.get(),t,e);if(yg(i))eZ(i);var r=t.detectCycles===true;if(r&&i!==null&&e.has(i)){return e.get(i);}if(zl(i)||Array.isArray(i)){var o=Mu(e,i,[],t);var n=i.map(function(g){return ma(g,t,e);});o.length=n.length;for(var s=0,a=n.length;s0;}function qm(i,t){var e=i.interceptors||(i.interceptors=[]);e.push(t);return k0(function(){var r=e.indexOf(t);if(r!==-1)e.splice(r,1);});}function on(i,t){var e=Hu();try{var r=i.interceptors;if(r)for(var o=0,n=r.length;o0;}function Ym(i,t){var e=i.changeListeners||(i.changeListeners=[]);e.push(t);return k0(function(){var r=e.indexOf(t);if(r!==-1)e.splice(r,1);});}function wo(i,t){var e=Hu();var r=i.changeListeners;if(!r)return;r=r.slice();for(var o=0,n=r.length;o2)es("box");var e=Lu(t);return new fa(i,lg(e),e.name,true,e.equals);},shallowBox:function shallowBox(i,t){if(arguments.length>2)es("shallowBox");is("observable.shallowBox","observable.box(value, { deep: false })");return Q.box(i,{name:t,deep:false});},array:function array(i,t){if(arguments.length>2)es("array");var e=Lu(t);return new nn(i,lg(e),e.name);},shallowArray:function shallowArray(i,t){if(arguments.length>2)es("shallowArray");is("observable.shallowArray","observable.array(values, { deep: false })");return Q.array(i,{name:t,deep:false});},map:function map(i,t){if(arguments.length>2)es("map");var e=Lu(t);return new Tg(i,lg(e),e.name);},shallowMap:function shallowMap(i,t){if(arguments.length>2)es("shallowMap");is("observable.shallowMap","observable.map(values, { deep: false })");return Q.map(i,{name:t,deep:false});},set:function set(i,t){if(arguments.length>2)es("set");var e=Lu(t);return new kg(i,lg(e),e.name);},object:function object(i,t,e){if(typeof arguments[1]==="string")es("object");var r=Lu(e);return ZJ({},i,t,r);},shallowObject:function shallowObject(i,t){if(typeof arguments[1]==="string")es("shallowObject");is("observable.shallowObject","observable.object(values, {}, { deep: false })");return Q.object(i,{},{name:t,deep:false});},ref:ZD,shallow:kJ,deep:O0,struct:IJ};Q=DJ;Object.keys(PD).forEach(function(i){return Q[i]=PD[i];});hg=YD(false,function(i,t,e,r,o){if(false){pa(e&&e.get,"Trying to declare a computed value for unspecified getter '"+t+"'");}var n=e.get,s=e.set;var a=o[0]||{};hZ(i,t,_Fe({get:n,set:s},a));});EJ=hg({equals:pg.structural});S=function i(t,e,r){if(typeof e==="string"){return hg.apply(null,arguments);}if(t!==null&&_typeof(t)==="object"&&arguments.length===1){return hg.apply(null,arguments);}if(false){pa(typeof t==="function","First argument to `computed` should be an expression.");pa(arguments.length<3,"Computed takes one or two arguments if used as function");}var o=_typeof(e)==="object"?e:{};o.get=t;o.set=typeof e==="function"?e:o.set;o.name=o.name||t.name||"";return new ga(o);};S.struct=EJ;(function(i){i[i["NOT_TRACKING"]=-1]="NOT_TRACKING";i[i["UP_TO_DATE"]=0]="UP_TO_DATE";i[i["POSSIBLY_STALE"]=1]="POSSIBLY_STALE";i[i["STALE"]=2]="STALE";})(Yt||(Yt={}));(function(i){i[i["NONE"]=0]="NONE";i[i["LOG"]=1]="LOG";i[i["BREAK"]=2]="BREAK";})(xo||(xo={}));fg=function(){function i(t){this.cause=t;}return i;}();gg=0;AJ=1;MD=Object.getOwnPropertyDescriptor(function(){},"name");xpt=MD&&MD.configurable;fa=function(i){qD(t,i);function t(e,r,o,n,s){if(o===void 0){o="ObservableValue@"+Cr();}if(n===void 0){n=true;}if(s===void 0){s=pg["default"];}var a=i.call(this,o)||this;a.enhancer=r;a.name=o;a.equals=s;a.hasUnreportedChange=false;a.value=r(e,void 0,o);if(n&&bi()){Pl({type:"create",name:a.name,newValue:""+a.value});}return a;}t.prototype.dehanceValue=function(e){if(this.dehancer!==void 0)return this.dehancer(e);return e;};t.prototype.set=function(e){var r=this.value;e=this.prepareNewValue(e);if(e!==lt.UNCHANGED){var o=bi();if(o){vo({type:"update",name:this.name,newValue:e,oldValue:r});}this.setNewValue(e);if(o)Co();}};t.prototype.prepareNewValue=function(e){zu(this);if(rn(this)){var r=on(this,{object:this,type:"update",newValue:e});if(!r)return lt.UNCHANGED;e=r.newValue;}e=this.enhancer(e,this.value,this.name);return this.equals(this.value,e)?lt.UNCHANGED:e;};t.prototype.setNewValue=function(e){var r=this.value;this.value=e;this.reportChanged();if(So(this)){wo(this,{type:"update",object:this,newValue:e,oldValue:r});}};t.prototype.get=function(){this.reportObserved();return this.dehanceValue(this.value);};t.prototype.intercept=function(e){return qm(this,e);};t.prototype.observe=function(e,r){if(r)e({object:this,type:"update",newValue:this.value,oldValue:void 0});return Ym(this,e);};t.prototype.toJSON=function(){return this.get();};t.prototype.toString=function(){return this.name+"["+this.value+"]";};t.prototype.valueOf=function(){return $D(this.get());};return t;}(_g);fa.prototype[jD()]=fa.prototype.valueOf;MJ=_a("ObservableValue",fa);ga=function(){function i(t){this.dependenciesState=Yt.NOT_TRACKING;this.observing=[];this.newObserving=null;this.isBeingObserved=false;this.isPendingUnobservation=false;this.observers=[];this.observersIndexes={};this.diffValue=0;this.runId=0;this.lastAccessedBy=0;this.lowestObserverState=Yt.UP_TO_DATE;this.unboundDepsCount=0;this.__mapid="#"+Cr();this.value=new fg(null);this.isComputing=false;this.isRunningSetter=false;this.isTracing=xo.NONE;pa(t.get,"missing option for computed: get");this.derivation=t.get;this.name=t.name||"ComputedValue@"+Cr();if(t.set)this.setter=Al(this.name+"-setter",t.set);this.equals=t.equals||(t.compareStructural||t.struct?pg.structural:pg["default"]);this.scope=t.context;this.requiresReaction=!!t.requiresReaction;this.keepAlive=!!t.keepAlive;}i.prototype.onBecomeStale=function(){HJ(this);};i.prototype.onBecomeUnobserved=function(){};i.prototype.onBecomeObserved=function(){};i.prototype.get=function(){if(this.isComputing)me("Cycle detected in computation "+this.name+": "+this.derivation);if(lt.inBatch===0&&this.observers.length===0&&!this.keepAlive){if(v0(this)){this.warnAboutUntrackedRead();ns();this.value=this.computeValue(false);ss();}}else{sE(this);if(v0(this)){if(this.trackAndCompute())NJ(this);}}var t=this.value;if(Hm(t))throw t.cause;return t;};i.prototype.peek=function(){var t=this.computeValue(false);if(Hm(t))throw t.cause;return t;};i.prototype.set=function(t){if(this.setter){pa(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?");this.isRunningSetter=true;try{this.setter.call(this.scope,t);}finally{this.isRunningSetter=false;}}else pa(false,false);};i.prototype.trackAndCompute=function(){if(bi()){Pl({object:this.scope,type:"compute",name:this.name});}var t=this.value;var e=this.dependenciesState===Yt.NOT_TRACKING;var r=this.computeValue(true);var o=e||Hm(t)||Hm(r)||!this.equals(t,r);if(o){this.value=r;}return o;};i.prototype.computeValue=function(t){this.isComputing=true;lt.computationDepth++;var e;if(t){e=QD(this,this.derivation,this.scope);}else{if(lt.disableErrorBoundaries===true){e=this.derivation.call(this.scope);}else{try{e=this.derivation.call(this.scope);}catch(r){e=new fg(r);}}}lt.computationDepth--;this.isComputing=false;return e;};i.prototype.suspend=function(){if(!this.keepAlive){C0(this);this.value=void 0;}};i.prototype.observe=function(t,e){var r=this;var o=true;var n=void 0;return XJ(function(){var s=r.get();if(!o||e){var a=Hu();t({type:"update",object:r,newValue:s,oldValue:n});ha(a);}o=false;n=s;});};i.prototype.warnAboutUntrackedRead=function(){if(true)return;if(this.requiresReaction===true){me("[mobx] Computed value "+this.name+" is read outside a reactive context");}if(this.isTracing!==xo.NONE){console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context. Doing a full recompute");}if(lt.computedRequiresReaction){console.warn("[mobx] Computed value "+this.name+" is being read outside a reactive context. Doing a full recompute");}};i.prototype.toJSON=function(){return this.get();};i.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]";};i.prototype.valueOf=function(){return $D(this.get());};return i;}();ga.prototype[jD()]=ga.prototype.valueOf;Sg=_a("ComputedValue",ga);ug=function(){function i(){this.version=5;this.UNCHANGED={};this.trackingDerivation=null;this.computationDepth=0;this.runId=0;this.mobxGuid=0;this.inBatch=0;this.pendingUnobservations=[];this.pendingReactions=[];this.isRunningReactions=false;this.allowStateChanges=true;this.allowStateReads=true;this.enforceActions=false;this.spyListeners=[];this.globalReactionErrorHandlers=[];this.computedRequiresReaction=false;this.reactionRequiresObservable=false;this.observableRequiresReaction=false;this.computedConfigurable=false;this.disableErrorBoundaries=false;this.suppressReactionErrors=false;}return i;}();dg=true;rE=false;lt=function(){var i=Wm();if(i.__mobxInstanceCount>0&&!i.__mobxGlobals)dg=false;if(i.__mobxGlobals&&i.__mobxGlobals.version!==new ug().version)dg=false;if(!dg){setTimeout(function(){if(!rE){me("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`");}},1);return new ug();}else if(i.__mobxGlobals){i.__mobxInstanceCount+=1;if(!i.__mobxGlobals.UNCHANGED)i.__mobxGlobals.UNCHANGED={};return i.__mobxGlobals;}else{i.__mobxInstanceCount=1;return i.__mobxGlobals=new ug();}}();ba=function(){function i(t,e,r,o){if(t===void 0){t="Reaction@"+Cr();}if(o===void 0){o=false;}this.name=t;this.onInvalidate=e;this.errorHandler=r;this.requiresObservable=o;this.observing=[];this.newObserving=[];this.dependenciesState=Yt.NOT_TRACKING;this.diffValue=0;this.runId=0;this.unboundDepsCount=0;this.__mapid="#"+Cr();this.isDisposed=false;this._isScheduled=false;this._isTrackPending=false;this._isRunning=false;this.isTracing=xo.NONE;}i.prototype.onBecomeStale=function(){this.schedule();};i.prototype.schedule=function(){if(!this._isScheduled){this._isScheduled=true;lt.pendingReactions.push(this);cE();}};i.prototype.isScheduled=function(){return this._isScheduled;};i.prototype.runReaction=function(){if(!this.isDisposed){ns();this._isScheduled=false;if(v0(this)){this._isTrackPending=true;try{this.onInvalidate();if(this._isTrackPending&&bi()){Pl({name:this.name,type:"scheduled-reaction"});}}catch(t){this.reportExceptionInDerivation(t);}}ss();}};i.prototype.track=function(t){ns();var e=bi();var r;if(e){r=Date.now();vo({name:this.name,type:"reaction"});}this._isRunning=true;var o=QD(this,t,void 0);this._isRunning=false;this._isTrackPending=false;if(this.isDisposed){C0(this);}if(Hm(o))this.reportExceptionInDerivation(o.cause);if(e){Co({time:Date.now()-r});}ss();};i.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler){this.errorHandler(t,this);return;}if(lt.disableErrorBoundaries)throw t;var r="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";if(lt.suppressReactionErrors){console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)");}else{console.error(r,t);}if(bi()){Pl({type:"error",name:this.name,message:r,error:""+t});}lt.globalReactionErrorHandlers.forEach(function(o){return o(t,e);});};i.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;if(!this._isRunning){ns();C0(this);ss();}}};i.prototype.getDisposer=function(){var t=this.dispose.bind(this);t.$mobx=this;return t;};i.prototype.toString=function(){return"Reaction["+this.name+"]";};i.prototype.trace=function(t){if(t===void 0){t=false;}rZ(this,t);};return i;}();LD=100;S0=function S0(i){return i();};bg=_a("Reaction",ba);VJ={spyReportEnd:true};C=function i(t,e,r,o){if(arguments.length===1&&typeof t==="function")return Al(t.name||"",t);if(arguments.length===2&&typeof e==="function")return Al(t,e);if(arguments.length===1&&typeof t==="string")return zD(t);if(o===true){t[e]=Al(t.name||e,r.value);}else{return zD(e).apply(null,arguments);}};C.bound=KJ;qJ=function qJ(i){return i();};QJ.prototype=Object.create(Error.prototype);iZ={detectCycles:true,exportMapsAsObjects:true,recurseEverything:false};nZ=1e4;sZ=function(){var i=false;var t={};Object.defineProperty(t,"0",{set:function set(){i=true;}});Object.create(t)["0"]=1;return i===false;}();w0=0;P0=function(){function i(){}return i;}();aZ(P0,Array.prototype);if(Object.isFrozen(Array)){["constructor","push","shift","concat","pop","unshift","replace","find","findIndex","splice","reverse","sort"].forEach(function(i){Object.defineProperty(P0.prototype,i,{configurable:true,writable:true,value:Array.prototype[i]});});}pE=function(){function i(t,e,r,o){this.array=r;this.owned=o;this.values=[];this.lastKnownLength=0;this.atom=new _g(t||"ObservableArray@"+Cr());this.enhancer=function(n,s){return e(n,s,t+"[..]");};}i.prototype.dehanceValue=function(t){if(this.dehancer!==void 0)return this.dehancer(t);return t;};i.prototype.dehanceValues=function(t){if(this.dehancer!==void 0&&t.length>0)return t.map(this.dehancer);return t;};i.prototype.intercept=function(t){return qm(this,t);};i.prototype.observe=function(t,e){if(e===void 0){e=false;}if(e){t({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0});}return Ym(this,t);};i.prototype.getArrayLength=function(){this.atom.reportObserved();return this.values.length;};i.prototype.setArrayLength=function(t){if(typeof t!=="number"||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t===e)return;else if(t>e){var r=new Array(t-e);for(var o=0;o0&&t+e+1>w0)M0(t+e+1);};i.prototype.spliceWithArray=function(t,e,r){var o=this;zu(this.atom);var n=this.values.length;if(t===void 0)t=0;else if(t>n)t=n;else if(t<0)t=Math.max(0,n+t);if(arguments.length===1)e=n-t;else if(e===void 0||e===null)e=0;else e=Math.max(0,Math.min(e,n-t));if(r===void 0)r=mg;if(rn(this)){var s=on(this,{object:this.array,type:"splice",index:t,removedCount:e,added:r});if(!s)return mg;e=s.removedCount;r=s.added;}r=r.length===0?r:r.map(function(c){return o.enhancer(c,void 0);});var a=r.length-e;this.updateArrayLength(n,a);var l=this.spliceItemsIntoValues(t,e,r);if(e!==0||r.length!==0)this.notifyArraySplice(t,r,l);return this.dehanceValues(l);};i.prototype.spliceItemsIntoValues=function(t,e,r){var o;if(r.length-1){this.splice(r,1);return true;}return false;};t.prototype.move=function(e,r){is("observableArray.move is deprecated, use .slice() & .replace() instead");function o(a){if(a<0){throw new Error("[mobx.array] Index out of bounds: "+a+" is negative");}var l=this.$mobx.values.length;if(a>=l){throw new Error("[mobx.array] Index out of bounds: "+a+" is not smaller than "+l);}}o.call(this,e);o.call(this,r);if(e===r){return;}var n=this.$mobx.values;var s;if(e0)&&!(o=r.next()).done){n.push(o.value);}}catch(a){s={error:a};}finally{try{if(o&&!o.done&&(e=r["return"]))e.call(r);}finally{if(s)throw s.error;}}return n;};CZ={};});function wZ(i){i();}function Ig(i){if(!i){i=wZ;if(false){console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native");}}wg({reactionScheduler:i});vE()[SZ]=true;}var SZ;var W0=d(function(){Tt();Wu();SZ=xE("observerBatching");});function an(){return TZ;}var TZ;var Dg=d(function(){TZ=false;});function CE(i){return B0(i);}var SE=d(function(){Tt();});function wE(i){var t={cleanAt:Date.now()+kZ,reaction:i};return t;}function TE(){if(G0===void 0){G0=setTimeout(DZ,IZ);}}function kE(i){Zm.add(i);TE();}function IE(i){Zm["delete"](i);}function DZ(){G0=void 0;var i=Date.now();Zm.forEach(function(t){var e=t.current;if(e){if(i>=e.cleanAt){e.reaction.dispose();t.current=null;Zm["delete"](t);}}});if(Zm.size>0){TE();}}var kZ,IZ,Zm,G0;var DE=d(function(){kZ=1e4;IZ=1e4;Zm=new Set();});function V0(i){return function(){if(Eg){Fg.push(i);}else{i();}};}function j0(i){Eg=true;Fg=[];try{var t=i();Eg=false;var e=Fg.length>0?Fg:void 0;EE["default"].useLayoutEffect(function(){if(e){e.forEach(function(r){return r();});}},[e]);return t;}finally{Eg=false;}}var EE,Eg,Fg;var $0=d(function(){EE=y(_("react"));Eg=false;Fg=[];});function FE(i){return"observer"+i;}function Gu(i,t,e){if(t===void 0){t="observed";}if(e===void 0){e=EZ;}if(an()){return i();}var r=e.useForceUpdate||H0;var o=r();var n=V0(o);var s=Og["default"].useRef(null);if(!s.current){var a=new ba(FE(t),function(){if(l.mounted){n();}else{a.dispose();s.current=null;}});var l=wE(a);s.current=l;kE(s);}var c=s.current.reaction;Og["default"].useDebugValue(c,CE);Og["default"].useEffect(function(){IE(s);if(s.current){s.current.mounted=true;}else{s.current={reaction:new ba(FE(t),function(){n();}),cleanAt:Infinity};n();}return function(){s.current.reaction.dispose();s.current=null;};},[]);return j0(function(){var u;var m;c.track(function(){try{u=i();}catch(p){m=p;}});if(m){throw m;}return u;});}var Og,EZ;var Rg=d(function(){Tt();Og=y(_("react"));SE();DE();Dg();Wu();$0();EZ={};});function X0(i,t){if(an()){return i;}var e=_K2({forwardRef:false},t);var r=i.displayName||i.name;var o=function o(s,a){return Gu(function(){return i(s,a);},r);};o.displayName=r;var n;if(e.forwardRef){n=(0,Qm.memo)((0,Qm.forwardRef)(o));}else{n=(0,Qm.memo)(o);}OZ(i,n);n.displayName=r;return n;}function OZ(i,t){Object.keys(i).forEach(function(e){if(!FZ[e]){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e));}});}var Qm,_K2,FZ;var OE=d(function(){Qm=_("react");Dg();Rg();_K2=function K0(){_K2=Object.assign||function(i){for(var t,e=1,r=arguments.length;e2?r-2:0),n=2;n";}function VZ(i){var t=this;if(an()===true)return i.call(this);ls(this,Bg,false);ls(this,Ag,false);var e=Q0(this);var r=i.bind(this);var o=false;var n=new ba(e+".render()",function(){if(!o){o=true;if(t[qE]!==true){var a=true;try{ls(t,Ag,true);if(!t[Bg])Me.Component.prototype.forceUpdate.call(t);a=false;}finally{ls(t,Ag,false);if(a)n.dispose();}}}});n["reactComponent"]=this;s[Z0]=n;this.render=s;function s(){o=false;var a=void 0;var l=void 0;n.track(function(){try{l=iE(false,r);}catch(c){a=c;}});if(a){throw a;}return l;}return s.call(this);}function HE(i,t){if(an()){console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side.");}if(this.state!==t){return true;}return!$E(this.props,i);}function WE(i,t){var e=va("reactProp_"+t+"_valueHolder");var r=va("reactProp_"+t+"_atomHolder");function o(){if(!this[r]){ls(this,r,xg("reactive "+t));}return this[r];}Object.defineProperty(i,t,{configurable:true,enumerable:true,get:function n(){var s=false;if(Ll&&os){s=Ll(true);}o.call(this).reportObserved();if(Ll&&os){os(s);}return this[e];},set:function n(s){if(!this[Ag]&&!$E(this[e],s)){ls(this,e,s);ls(this,Bg,true);o.call(this).reportChanged();ls(this,Bg,false);}else{ls(this,e,s);}}});}function w(i){if(i["isMobxInjector"]===true){console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'");}if(VE&&i["$$typeof"]===VE){throw new Error("Mobx observer: You are trying to use 'observer' on a function component wrapped in either another observer or 'React.memo'. The observer already applies 'React.memo' for you.");}if(GE&&i["$$typeof"]===GE){var t=i["render"];if(typeof t!=="function")throw new Error("render property of ForwardRef was not a function");return(0,Me.forwardRef)(function e(){var r=arguments;return(0,Me.createElement)(Vu,null,function(){return t.apply(void 0,r);});});}if(typeof i==="function"&&(!i.prototype||!i.prototype.render)&&!i["isReactClass"]&&!Object.prototype.isPrototypeOf.call(Me.Component,i)){return X0(i);}return GZ(i);}function Pg(){Pg=Object.assign||function(i){for(var t=1;t=0)continue;e[o]=i[o];}return e;}function ep(i){var t=i.children,e=jZ(i,["children"]);var r=Me["default"].useContext(tp);var o=Me["default"].useRef(Pg({},r,e));var n=o.current;if(false){var s=Pg({},n,e);if(!$E(n,s)){throw new Error("MobX Provider: The set of provided stores has changed. See: https://github.com/mobxjs/mobx-react#the-set-of-provided-stores-has-changed-error.");}}return Me["default"].createElement(tp.Provider,{value:n},t);}function jE(i,t,e,r){var o=Me["default"].forwardRef(function(n,s){var a=Pg({},n);var l=Me["default"].useContext(tp);Object.assign(a,i(l||{},a)||{});if(s){a.ref=s;}return Me["default"].createElement(t,a);});if(r)o=w(o);o["isMobxInjector"]=true;NZ(t,o);o["wrappedComponent"]=t;o.displayName=$Z(t,e);return o;}function $Z(i,t){var e;var r=i.displayName||i.name||i.constructor&&i.constructor.name||"Component";if(t)e="inject-with-"+t+"("+r+")";else e="inject("+r+")";return e;}function KZ(i){return function(t,e){i.forEach(function(r){if(r in e)return;if(!(r in t))throw new Error("MobX injector: Store '"+r+"' is not available! Make sure it is provided by some Provider");e[r]=t[r];});return e;};}function rt(){for(var i=arguments.length,t=new Array(i),e=0;e0;});};});var nF;var sF=d(function(){ju();nF=function nF(){return qr.some(function(i){return i.skippedTargets.length>0;});};});var aF,lF;var cF=d(function(){aF="ResizeObserver loop completed with undelivered notifications.";lF=function lF(){var i;if(typeof ErrorEvent==="function"){i=new ErrorEvent("error",{message:aF});}else{i=document.createEvent("Event");i.initEvent("error",false,false);i.message=aF;}window.dispatchEvent(i);};});var Ul;var iC=d(function(){(function(i){i["BORDER_BOX"]="border-box";i["CONTENT_BOX"]="content-box";i["DEVICE_PIXEL_CONTENT_BOX"]="device-pixel-content-box";})(Ul||(Ul={}));});var rC;var uF=d(function(){rC=function(){function i(t,e,r,o){this.x=t;this.y=e;this.width=r;this.height=o;this.top=this.y;this.left=this.x;this.bottom=this.top+this.height;this.right=this.left+this.width;return Object.freeze(this);}i.prototype.toJSON=function(){var t=this,e=t.x,r=t.y,o=t.top,n=t.right,s=t.bottom,a=t.left,l=t.width,c=t.height;return{x:e,y:r,top:o,right:n,bottom:s,left:a,width:l,height:c};};i.fromRect=function(t){return new i(t.x,t.y,t.width,t.height);};return i;}();});var ip,zg,oC,dF;var rp=d(function(){ip=function ip(i){return i instanceof SVGElement&&"getBBox"in i;};zg=function zg(i){if(ip(i)){var t=i.getBBox(),e=t.width,r=t.height;return!e&&!r;}var o=i,n=o.offsetWidth,s=o.offsetHeight;return!(n||s||i.getClientRects().length);};oC=function oC(i){var t,e;var r=(e=(t=i)===null||t===void 0?void 0:t.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(r&&i instanceof r.Element);};dF=function dF(i){switch(i.tagName){case"INPUT":if(i.type!=="image"){break;}case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return true;}return false;};});var Nl;var nC=d(function(){Nl=typeof window!=="undefined"?window:{};});var Ug,mF,XZ,qZ,ln,$u,pF,sC,Ng;var Hg=d(function(){iC();uF();rp();nC();Ug=new WeakMap();mF=/auto|scroll/;XZ=/^tb|vertical/;qZ=/msie|trident/i.test(Nl.navigator&&Nl.navigator.userAgent);ln=function ln(i){return parseFloat(i||"0");};$u=function $u(i,t,e){if(i===void 0){i=0;}if(t===void 0){t=0;}if(e===void 0){e=false;}return Object.freeze({inlineSize:(e?t:i)||0,blockSize:(e?i:t)||0});};pF=Object.freeze({devicePixelContentBoxSize:$u(),borderBoxSize:$u(),contentBoxSize:$u(),contentRect:new rC(0,0,0,0)});sC=function sC(i,t){if(t===void 0){t=false;}if(Ug.has(i)&&!t){return Ug.get(i);}if(zg(i)){Ug.set(i,pF);return pF;}var e=getComputedStyle(i);var r=ip(i)&&i.ownerSVGElement&&i.getBBox();var o=!qZ&&e.boxSizing==="border-box";var n=XZ.test(e.writingMode||"");var s=!r&&mF.test(e.overflowY||"");var a=!r&&mF.test(e.overflowX||"");var l=r?0:ln(e.paddingTop);var c=r?0:ln(e.paddingRight);var u=r?0:ln(e.paddingBottom);var m=r?0:ln(e.paddingLeft);var p=r?0:ln(e.borderTopWidth);var h=r?0:ln(e.borderRightWidth);var g=r?0:ln(e.borderBottomWidth);var x=r?0:ln(e.borderLeftWidth);var v=m+c;var b=l+u;var T=x+h;var k=p+g;var E=!a?0:i.offsetHeight-k-i.clientHeight;var A=!s?0:i.offsetWidth-T-i.clientWidth;var I=o?v+T:0;var F=o?b+k:0;var Z=r?r.width:ln(e.width)-I-A;var et=r?r.height:ln(e.height)-F-E;var pt=Z+v+A+T;var yt=et+b+E+k;var bt=Object.freeze({devicePixelContentBoxSize:$u(Math.round(Z*devicePixelRatio),Math.round(et*devicePixelRatio),n),borderBoxSize:$u(pt,yt,n),contentBoxSize:$u(Z,et,n),contentRect:new rC(m,l,Z,et)});Ug.set(i,bt);return bt;};Ng=function Ng(i,t,e){var r=sC(i,e),o=r.borderBoxSize,n=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Ul.DEVICE_PIXEL_CONTENT_BOX:return s;case Ul.BORDER_BOX:return o;default:return n;}};});var aC;var lC=d(function(){Hg();aC=function(){function i(t){var e=sC(t);this.target=t;this.contentRect=e.contentRect;this.borderBoxSize=[e.borderBoxSize];this.contentBoxSize=[e.contentBoxSize];this.devicePixelContentBoxSize=[e.devicePixelContentBoxSize];}return i;}();});var Wg;var cC=d(function(){rp();Wg=function Wg(i){if(zg(i)){return Infinity;}var t=0;var e=i.parentNode;while(e){t+=1;e=e.parentNode;}return t;};});var hF;var fF=d(function(){ju();lC();cC();Hg();hF=function hF(){var i=Infinity;var t=[];qr.forEach(function n(s){if(s.activeTargets.length===0){return;}var a=[];s.activeTargets.forEach(function l(c){var u=new aC(c.target);var m=Wg(c.target);a.push(u);c.lastReportedSize=Ng(c.target,c.observedBox);if(mi){e.activeTargets.push(o);}else{e.skippedTargets.push(o);}}});});};});var bF;var yF=d(function(){oF();sF();cF();fF();gF();bF=function bF(){var i=0;uC(i);while(rF()){i=hF();uC(i);}if(nF()){lF();}return i>0;};});var dC,_F,YZ,xF;var vF=d(function(){_F=[];YZ=function YZ(){return _F.splice(0).forEach(function(i){return i();});};xF=function xF(i){if(!dC){var t=0;var e=document.createTextNode("");var r={characterData:true};new MutationObserver(function(){return YZ();}).observe(e,r);dC=function dC(){e.textContent=""+(t?t--:t++);};}_F.push(i);dC();};});var CF;var SF=d(function(){vF();CF=function CF(i){xF(function t(){requestAnimationFrame(i);});};});var Gg,JZ,ZZ,QZ,wF,TF,mC,tQ,Vg,pC;var kF=d(function(){yF();nC();SF();Gg=0;JZ=function JZ(){return!!Gg;};ZZ=250;QZ={attributes:true,characterData:true,childList:true,subtree:true};wF=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"];TF=function TF(i){if(i===void 0){i=0;}return Date.now()+i;};mC=false;tQ=function(){function i(){var t=this;this.stopped=true;this.listener=function(){return t.schedule();};}i.prototype.run=function(t){var e=this;if(t===void 0){t=ZZ;}if(mC){return;}mC=true;var r=TF(t);CF(function(){var o=false;try{o=bF();}finally{mC=false;t=r-TF();if(!JZ()){return;}if(o){e.run(1e3);}else if(t>0){e.run(t);}else{e.start();}}});};i.prototype.schedule=function(){this.stop();this.run();};i.prototype.observe=function(){var t=this;var e=function e(){return t.observer&&t.observer.observe(document.body,QZ);};document.body?e():Nl.addEventListener("DOMContentLoaded",e);};i.prototype.start=function(){var t=this;if(this.stopped){this.stopped=false;this.observer=new MutationObserver(this.listener);this.observe();wF.forEach(function(e){return Nl.addEventListener(e,t.listener,true);});}};i.prototype.stop=function(){var t=this;if(!this.stopped){this.observer&&this.observer.disconnect();wF.forEach(function(e){return Nl.removeEventListener(e,t.listener,true);});this.stopped=true;}};return i;}();Vg=new tQ();pC=function pC(i){!Gg&&i>0&&Vg.start();Gg+=i;!Gg&&Vg.stop();};});var eQ,IF;var DF=d(function(){iC();Hg();rp();eQ=function eQ(i){return!ip(i)&&!dF(i)&&getComputedStyle(i).display==="inline";};IF=function(){function i(t,e){this.target=t;this.observedBox=e||Ul.CONTENT_BOX;this.lastReportedSize={inlineSize:0,blockSize:0};}i.prototype.isActive=function(){var t=Ng(this.target,this.observedBox,true);if(eQ(this.target)){this.lastReportedSize=t;}if(this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize){return true;}return false;};return i;}();});var EF;var FF=d(function(){EF=function(){function i(t,e){this.activeTargets=[];this.skippedTargets=[];this.observationTargets=[];this.observer=t;this.callback=e;}return i;}();});var jg,OF,op;var RF=d(function(){kF();DF();FF();ju();jg=new WeakMap();OF=function OF(i,t){for(var e=0;e=0){n&&qr.splice(qr.indexOf(r),1);r.observationTargets.splice(o,1);pC(-1);}};i.disconnect=function(t){var e=this;var r=jg.get(t);r.observationTargets.slice().forEach(function(o){return e.unobserve(t,o.target);});r.activeTargets.splice(0,r.activeTargets.length);};return i;}();});var Hl;var AF=d(function(){RF();rp();Hl=function(){function i(t){if(arguments.length===0){throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");}if(typeof t!=="function"){throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");}op.connect(this,t);}i.prototype.observe=function(t,e){if(arguments.length===0){throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");}if(!oC(t)){throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");}op.observe(this,t,e);};i.prototype.unobserve=function(t){if(arguments.length===0){throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");}if(!oC(t)){throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");}op.unobserve(this,t);};i.prototype.disconnect=function(){op.disconnect(this);};i.toString=function(){return"function ResizeObserver () { [polyfill code] }";};return i;}();});var $g=d(function(){AF();lC();});var Ku=Gt(function(Ift,MF){var iQ="Expected a function";var BF=0/0;var rQ="[object Symbol]";var oQ=/^\s+|\s+$/g;var nQ=/^[-+]0x[0-9a-f]+$/i;var sQ=/^0b[01]+$/i;var aQ=/^0o[0-7]+$/i;var lQ=parseInt;var cQ=(typeof global==="undefined"?"undefined":_typeof(global))=="object"&&global&&global.Object===Object&&global;var uQ=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self;var dQ=cQ||uQ||Function("return this")();var mQ=Object.prototype;var pQ=mQ.toString;var hQ=Math.max;var fQ=Math.min;var hC=function hC(){return dQ.Date.now();};function gQ(i,t,e){var r,o,n,s,a,l,c=0,u=false,m=false,p=true;if(typeof i!="function"){throw new TypeError(iQ);}t=PF(t)||0;if(fC(e)){u=!!e.leading;m="maxWait"in e;n=m?hQ(PF(e.maxWait)||0,t):n;p="trailing"in e?!!e.trailing:p;}function h(I){var F=r,Z=o;r=o=void 0;c=I;s=i.apply(Z,F);return s;}function g(I){c=I;a=setTimeout(b,t);return u?h(I):s;}function x(I){var F=I-l,Z=I-c,et=t-F;return m?fQ(et,n-Z):et;}function v(I){var F=I-l,Z=I-c;return l===void 0||F>=t||F<0||m&&Z>=n;}function b(){var I=hC();if(v(I)){return T(I);}a=setTimeout(b,x(I));}function T(I){a=void 0;if(p&&r){return h(I);}r=o=void 0;return s;}function k(){if(a!==void 0){clearTimeout(a);}c=0;r=l=o=a=void 0;}function E(){return a===void 0?s:T(hC());}function A(){var I=hC(),F=v(I);r=arguments;o=this;l=I;if(F){if(a===void 0){return g(l);}if(m){a=setTimeout(b,t);return h(l);}}if(a===void 0){a=setTimeout(b,t);}return s;}A.cancel=k;A.flush=E;return A;}function fC(i){var t=_typeof(i);return!!i&&(t=="object"||t=="function");}function bQ(i){return!!i&&_typeof(i)=="object";}function yQ(i){return _typeof(i)=="symbol"||bQ(i)&&pQ.call(i)==rQ;}function PF(i){if(typeof i=="number"){return i;}if(yQ(i)){return BF;}if(fC(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=fC(t)?t+"":t;}if(typeof i!="string"){return i===0?i:+i;}i=i.replace(oQ,"");var e=sQ.test(i);return e||aQ.test(i)?lQ(i.slice(2),e?2:8):nQ.test(i)?BF:+i;}MF.exports=gQ;});var LF,Oe;var Sr=d(function(){LF=y(_("react"));Oe=LF["default"].createContext({});});var zF=d(function(){});var $t;var To=d(function(){$t=function $t(i){if(i){i.width=1;i.height=1;var t=i.getContext("2d");if(t){t.clearRect(0,0,1,1);}}};});var np,wr,ve,UF,NF,HF,WF;var gC=d(function(){To();np=function np(){return typeof window!=="undefined"&&window.navigator&&window.navigator.userAgent||"";};wr=function wr(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return i.indexOf("Edge")!==-1;};ve=function ve(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return!!i.match(/msie|trident/i);};UF=function UF(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return!!i.match(/windows/i);};NF=function NF(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return i.indexOf("Safari")!==-1&&i.indexOf("Chrome")===-1;};HF=function HF(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return!!i.match(/iP(hone|od|ad)|AppleWebKit/);};WF=function WF(){if(typeof document==="undefined"){return false;}var i=document.createElement("canvas");var t=i.getContext("webgl")||i.getContext("experimental-webgl");var e=t&&t instanceof WebGLRenderingContext;$t(i);return e;};});var _Q,GF;var VF=d(function(){_Q=new RegExp(/\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC68|\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83D\uDC68\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83D\uDC68\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83D\uDC68\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83D\uDC68\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC69(?:\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFE])|\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFC-\uDFFF]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68\u200D(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC68|\uD83D\uDC69\u200D\u2764\uFE0F\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDDD1\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC68(?:\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|(?:\uD83D[\uDC67-\uDC69])\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]\uFE0F)|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83C\uDFF3\uFE0F\u200D\u26A7|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF]))\u200D[\u2695\u2696\u2708]\uFE0F|\uD83D\uDC69\u200D(?:\uD83D[\uDC67\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83D\uDC3B\u200D\u2744|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDF])\u200D[\u2640\u2642])\uFE0F|\uD83E\uDDD1\u200D[\u2695\u2696\u2708]\uFE0F|(?:\uD83D[\uDC68\uDC69])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D[\u2695\u2696\u2708]\uFE0F)|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC08\u200D\u2B1B|\uD83E\uDDD1\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDC66\uDC67\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC3\uDFC7]|\uD83D[\uDC43\uDC4A-\uDC4C\uDC4F\uDC50\uDC66-\uDC69\uDC6B-\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD7A\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270C\u270D]|\uD83C[\uDFC2\uDFC4\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC46-\uDC49\uDC4D\uDC4E\uDD74\uDD75\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9\u23EA\u23ED-\u23EF\u23F1-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7\u26F8\u26FA\u26FD\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2753\u2757\u2763\u2764\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE1A\uDE2F\uDE37\uDF0D-\uDF0F\uDF15\uDF1C\uDF21\uDF24-\uDF2C\uDF36\uDF78\uDF7D\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFA7\uDFAC-\uDFAE\uDFC6\uDFCD\uDFCE\uDFD4-\uDFE0\uDFED\uDFF3\uDFF5\uDFF7]|\uD83D[\uDC08\uDC15\uDC1F\uDC26\uDC3F\uDC41\uDC53\uDC6A\uDC7D\uDCA3\uDCB0\uDCB3\uDCBB\uDCBF\uDCCB\uDCDA\uDCDF\uDCE4-\uDCE6\uDCEA-\uDCED\uDCF7\uDCF9-\uDCFB\uDCFD\uDD08\uDD0D\uDD12\uDD13\uDD49\uDD4A\uDD50-\uDD67\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDE10\uDE87\uDE8D\uDE91\uDE94\uDE98\uDEAD\uDEB2\uDEB9\uDEBA\uDEBC\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|[\u23E9-\u23F3\u23F8-\u23FA\u25FB-\u25FE\u2614\u2615\u267F\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26C8\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]/g);GF=function GF(i){return i.replace(_Q,"");};});var cn;var bC=d(function(){cn=function cn(i){try{new URL(i);return true;}catch(t){return false;}};});var jF;var yC=d(function(){jF=function jF(i){return i instanceof HTMLImageElement;};});function xQ(i){return!Object.prototype.hasOwnProperty.call(i,"name");}function vQ(i){return!Object.prototype.hasOwnProperty.call(i,"name");}var $F=d(function(){});var ko;var sp=d(function(){ko=function(m){m["UNDO"]="undo";m["REDO"]="redo";m["DELETE"]="delete";m["BRING_TO_FRONT"]="bringtofront";m["EDIT"]="edit";m["DUPLICATE"]="duplicate";m["ADD"]="add";m["FLIP"]="flip";m["INVERT"]="invert";m["CLOSE"]="close";m["EXPORT"]="export";return m;}(ko||{});});var H;var _C=d(function(){H=function(p){p["LIBRARY"]="library";p["TRANSFORM"]="transform";p["FILTER"]="filter";p["ADJUSTMENT"]="adjustment";p["FOCUS"]="focus";p["STICKER"]="sticker";p["TEXT"]="text";p["TEXT_DESIGN"]="textdesign";p["OVERLAY"]="overlay";p["FRAME"]="frame";p["BRUSH"]="brush";p["CUSTOM"]="customTool";return p;}(H||{});});var KF=d(function(){});var XF=d(function(){});var qF=d(function(){});var YF=d(function(){});var un;var Xu=d(function(){un=function(e){e["TEXT"]="text";e["CARD"]="card";return e;}(un||{});});var JF=d(function(){});var ZF=d(function(){});var Ue;var QF=d(function(){Ue=function(r){r["LARGE"]="large";r["MEDIUM"]="medium";r["SMALL"]="small";return r;}(Ue||{});});var tO=d(function(){});var eO=d(function(){});var iO=d(function(){});var rO=d(function(){});var oO=d(function(){});var nO=d(function(){});var sO=d(function(){});var aO=d(function(){});var lO=d(function(){});var cO=d(function(){});var uO=d(function(){});var dO=d(function(){});var mO=d(function(){});var pO=d(function(){});var dn;var hO=d(function(){dn=function(o){o["ERROR"]="error";o["WARNING"]="warning";o["INFO"]="info";o["TEXT_EDIT"]="textEdit";return o;}(dn||{});});var fO=d(function(){});var gO=d(function(){});var bO=d(function(){});var yO=d(function(){});var _O=d(function(){});var qe;var xO=d(function(){qe=function(c){c["BrushSize"]="brush-size";c["BrushHardness"]="brush-hardness";c["FilterIntensity"]="filter-intensity";c["TextLineSpacing"]="text-line-spacing";c["StickerOpacity"]="sticker-opacity";c["OverlayOpacity"]="overlay-opacity";c["FrameSize"]="frame-size";c["FrameOpacity"]="frame-opacity";c["FocusIntensity"]="focus-intensity";return c;}(qe||{});});var vO=d(function(){});var CO=d(function(){});var SO=d(function(){});var wO=d(function(){});var TO=d(function(){});var kO=d(function(){});var IO=d(function(){});var DO,EO,Kg;var FO=d(function(){DO=function DO(){_classCallCheck(this,DO);this.enabled=true;this.threshold=20;this.snapToHorizontalCenter=true;this.snapToVerticalCenter=true;this.snapToLeft=.1;this.snapToRight=.1;this.snapToTop=.1;this.snapToBottom=.1;};EO=function EO(){_classCallCheck(this,EO);this.enabled=true;this.threshold=20;this.angles=[0,45,90,135,180,225,270,315];};Kg=function Kg(){_classCallCheck(this,Kg);this.position=new DO();this.rotation=new EO();};});var OO,Xg;var RO=d(function(){OO=function(n){n["CENTER"]="center";n["TOP_LEFT"]="top-left";n["TOP_RIGHT"]="top-right";n["BOTTOM_LEFT"]="bottom-left";n["BOTTOM_RIGHT"]="bottom-right";return n;}(OO||{});Xg=function Xg(){_classCallCheck(this,Xg);this.watermarkURI="";this.alignment="top-right";this.inset=.05;this.size=.2;};});var AO,BO;var PO=d(function(){AO=function(t){t["OBJECT"]="object";return t;}(AO||{});BO=function BO(){_classCallCheck(this,BO);};});var Wl;var MO=d(function(){Wl=function(o){o["IMAGE"]="image";o["DATA_URL"]="data-url";o["BLOB"]="blob";o["MSBLOB"]="ms-blob";return o;}(Wl||{});});var mn;var LO=d(function(){mn=function(e){e["PNG"]="image/png";e["JPEG"]="image/jpeg";return e;}(mn||{});});var ap;var zO=d(function(){ap=function(l){l["BMP"]="image/bmp";l["GIF"]="image/gif";l["ICO"]="image/x-icon";l["JPEG"]="image/jpeg";l["PNG"]="image/png";l["SVG"]="image/svg+xml";l["TIFF"]="image/tiff";l["WEBP"]="image/webp";return l;}(ap||{});});var UO=d(function(){});var NO=d(function(){});var HO=d(function(){});var WO=d(function(){});var GO;var VO=d(function(){_C();GO=function GO(){_classCallCheck(this,GO);this.order="default";this.language="en";this.theme="dark";this.assetBaseUrl="assets/";this.assetResolver={};this.displayResizeWarning=false;this.displayCloseWarning=true;this.displayDiscardChangesWarning=true;this.displayCanvasRendererWarning=true;this.displayToolControlBarTitle=true;this.displaySerializationModal=true;this.forceCrop=false;this.enableZoom=true;this.scaleImageToFit=true;this.restrictZoomOutToDefault=true;this.defaultTool="filter";};"filter","focus","adjustment","library","overlay","sticker","text","textdesign","frame","brush","transform","customTool";});var jO=d(function(){});var qu,xC;var $O=d(function(){qu=function(p){p["BRIGHTNESS"]="brightness";p["CONTRAST"]="contrast";p["SATURATION"]="saturation";p["CLARITY"]="clarity";p["SHADOWS"]="shadows";p["HIGHLIGHTS"]="highlights";p["EXPOSURE"]="exposure";p["GAMMA"]="gamma";p["BLACKS"]="blacks";p["WHITES"]="whites";p["TEMPERATURE"]="temperature";p["SHARPNESS"]="sharpness";return p;}(qu||{});xC=Object.values(qu).reduce(function(i,t){i[t]=true;return i;},{});});var vC,qg;var KO=d(function(){vC=function(o){o["RemoveAdjustmentButton"]="removeAdjustmentButton";o["Expandable"]="expandable";o["Separator"]="separator";o["Items"]="items";return o;}(vC||{});qg=function qg(){_classCallCheck(this,qg);this.categories=[];this.flattenCategories=false;this.advancedUIToolControlBarOrder=[{type:"expandable",children:["removeAdjustmentButton","separator"]},"items"];};});var XO=d(function(){});var qO=d(function(){$O();KO();XO();});var YO;var JO=d(function(){YO=function YO(){_classCallCheck(this,YO);};});var CC,SC,Yg;var ZO=d(function(){Xu();CC=function(n){n["RemoveFilterButton"]="removeFilterButton";n["FilterIntensitySlider"]="filterIntensitySlider";n["Expandable"]="expandable";n["Separator"]="separator";n["Items"]="items";return n;}(CC||{});SC=function(t){t["FilterIntensity"]="filterIntensity";return t;}(SC||{});Yg=function Yg(){_classCallCheck(this,Yg);this.categories=[];this.flattenCategories=false;this.categoryHeaderType="card";this.enablePreviewThumbnails=false;this.advancedUIToolControlBarOrder=[{type:"expandable",children:["removeFilterButton","filterIntensitySlider","separator"]},"items"];this.basicUIToolControlBarTabsOrder=["filterIntensity"];};});function Yu(i){return i.lightColor!==void 0;}function wC(i){return i.lutURI!==void 0;}var QO=d(function(){});var lp,cp;var tR=d(function(){lp=function(ut){ut["Desert"]="imgly_duotone_desert";ut["Peach"]="imgly_duotone_peach";ut["Clash"]="imgly_duotone_clash";ut["Plum"]="imgly_duotone_plum";ut["Breezy"]="imgly_duotone_breezy";ut["DeepBlue"]="imgly_duotone_deepblue";ut["Frog"]="imgly_duotone_frog";ut["Sunset"]="imgly_duotone_sunset";ut["AD1920"]="imgly_lut_ad1920";ut["Greyed"]="imgly_lut_bw";ut["Dusty"]="imgly_lut_x400";ut["Litho"]="imgly_lut_litho";ut["Sepia"]="imgly_lut_sepiahigh";ut["Weathered"]="imgly_lut_plate";ut["HardStuff"]="imgly_lut_sin";ut["Polaroid"]="imgly_lut_blues";ut["Sunny70s"]="imgly_lut_front";ut["Oldtimer"]="imgly_lut_texas";ut["Inferno"]="imgly_lut_celsius";ut["Snappy"]="imgly_lut_cool";ut["Chestnut"]="imgly_lut_chest";ut["Softy"]="imgly_lut_winter";ut["Pebble"]="imgly_lut_kdynamic";ut["Moss"]="imgly_lut_fall";ut["Lemon"]="imgly_lut_lenin";ut["GreenGap"]="imgly_lut_pola669";ut["Colla"]="imgly_lut_elder";ut["Solanus"]="imgly_lut_orchid";ut["Kalmen"]="imgly_lut_bleached";ut["Joran"]="imgly_lut_bleachedblue";ut["Levante"]="imgly_lut_breeze";ut["Zephyr"]="imgly_lut_blueshadows";ut["Golden"]="imgly_lut_sunset";ut["LowFire"]="imgly_lut_eighties";ut["Sunrise"]="imgly_lut_evening";ut["FlatBlack"]="imgly_lut_k2";ut["Pumpkin"]="imgly_lut_nogreen";ut["Ancient"]="imgly_lut_ancient";ut["Candy"]="imgly_lut_cottoncandy";ut["Classic"]="imgly_lut_classic";ut["Colorful"]="imgly_lut_colorful";ut["Creamy"]="imgly_lut_creamy";ut["Fixie"]="imgly_lut_fixie";ut["Food"]="imgly_lut_food";ut["Fridge"]="imgly_lut_fridge";ut["Glam"]="imgly_lut_glam";ut["Gobblin"]="imgly_lut_gobblin";ut["Hicon"]="imgly_lut_highcontrast";ut["HighCarb"]="imgly_lut_highcarb";ut["K1"]="imgly_lut_k1";ut["K6"]="imgly_lut_k6";ut["Keen"]="imgly_lut_keen";ut["Lomo"]="imgly_lut_lomo";ut["Lomo100"]="imgly_lut_lomo100";ut["Lucid"]="imgly_lut_lucid";ut["Mellow"]="imgly_lut_mellow";ut["Neat"]="imgly_lut_neat";ut["Pale"]="imgly_lut_pale";ut["Pitched"]="imgly_lut_pitched";ut["PolaSX"]="imgly_lut_polasx";ut["Pro400"]="imgly_lut_pro400";ut["Quozi"]="imgly_lut_quozi";ut["Settled"]="imgly_lut_settled";ut["Seventies"]="imgly_lut_seventies";ut["Soft"]="imgly_lut_soft";ut["Steel"]="imgly_lut_steel";ut["Summer"]="imgly_lut_summer";ut["Tender"]="imgly_lut_tender";ut["Twilight"]="imgly_lut_twilight";return ut;}(lp||{});cp=function(a){a["DuoTone"]="imgly_filter_category_duotone";a["BW"]="imgly_filter_category_bw";a["Vintage"]="imgly_filter_category_vintage";a["Smooth"]="imgly_filter_category_smooth";a["Cold"]="imgly_filter_category_cold";a["Warm"]="imgly_filter_category_warm";a["Legacy"]="imgly_filter_category_legacy";return a;}(cp||{});});var eR=d(function(){ZO();QO();tR();});var TC,iR,Jg;var rR=d(function(){TC=function(n){n["RemoveFocusButton"]="removeFocusButton";n["FocusIntensitySlider"]="focusIntensitySlider";n["Expandable"]="expandable";n["Separator"]="separator";n["Items"]="items";return n;}(TC||{});iR=function(t){t["FocusIntensity"]="focusIntensity";return t;}(iR||{});Jg=function Jg(){_classCallCheck(this,Jg);this.items=[];this.advancedUIToolControlBarOrder=[{type:"expandable",children:["removeFocusButton","focusIntensitySlider","separator"]},"items"];this.basicUIToolControlBarTabsOrder=["focusIntensity"];};});var oR=d(function(){});var cs;var nR=d(function(){cs=function(o){o["RADIAL"]="radial";o["LINEAR"]="linear";o["MIRRORED"]="mirrored";o["GAUSSIAN"]="gaussian";return o;}(cs||{});});var sR=d(function(){rR();oR();nR();});var kC,IC,Zg;var aR=d(function(){kC=function(a){a["RemoveFrameButton"]="removeFrameButton";a["FrameOpacitySlider"]="frameOpacitySlider";a["FrameSizeSlider"]="frameSizeSlider";a["FrameColorList"]="frameColorList";a["Separator"]="separator";a["Items"]="items";a["Expandable"]="expandable";return a;}(kC||{});IC=function(r){r["FrameSize"]="frameSize";r["FrameOpacity"]="frameOpacity";r["FrameColor"]="frameColor";return r;}(IC||{});Zg=function Zg(){_classCallCheck(this,Zg);this.items=[];this.advancedUIToolControlBarOrder=[{type:"expandable",children:["removeFrameButton","frameOpacitySlider","frameSizeSlider","frameColorList","separator"]},"items"];this.basicUIToolControlBarTabsOrder=["frameOpacity","frameSize","frameColor"];};});var lR=d(function(){});var cR=d(function(){aR();lR();});var Qg;var DC=d(function(){Qg=/*#__PURE__*/function(){function Qg(t){_classCallCheck(this,Qg);this.name=t.name;this.coverImageUrl=t.coverImageUrl;}_createClass(Qg,[{key:"loadCoverImage",value:function loadCoverImage(){var _this=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"anonymous";return new Promise(function(e,r){var o=new Image();o.addEventListener("load",function(){e(o);});o.addEventListener("error",function(){r(new Error("Failed to load image at ".concat(_this.coverImage)));});o.crossOrigin=t;o.src=_this.coverImageUrl;_this.coverImage=o;});}}]);return Qg;}();});var tb;var EC=d(function(){tb=/*#__PURE__*/function(){function tb(t){_classCallCheck(this,tb);this.title=t.title;this.category=t.category||t.title;this.thumbUrl=t.thumbUrl;this.rawUrl=t.rawUrl;this.authorName=t.authorName;this.authorAvatar=t.authorAvatar;}_createClass(tb,[{key:"loadThumbImage",value:function loadThumbImage(){var _this2=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"anonymous";return new Promise(function(e,r){var o=new Image();o.addEventListener("load",function(){e(o);});o.addEventListener("error",function(){r(new Error("Failed to load image at ".concat(_this2.thumbUrl)));});o.crossOrigin=t;o.src=_this2.thumbUrl;_this2.thumbImage=o;});}},{key:"getThumbImage",value:function getThumbImage(){return this.thumbUrl;}}]);return tb;}();});var eb;var uR=d(function(){eb=/*#__PURE__*/function(){function eb(){_classCallCheck(this,eb);}_createClass(eb,[{key:"getData",value:function getData(t){return new Promise(function(e,r){var o=new XMLHttpRequest();o.open("GET",t,true);o.responseType="json";o.onload=function(){var n=o.status;if(n===200){e(o.response);}else{r(new Error("HTTP Status ".concat(n)));}};o.send();});}}]);return eb;}();});var ib;var FC=d(function(){uR();ib=/*#__PURE__*/function(){function ib(){_classCallCheck(this,ib);}_createClass(ib,[{key:"loadJSON",value:function loadJSON(t){var e=new eb();return e.getData(t);}},{key:"getCategories",value:function getCategories(){return Promise.resolve([]);}},{key:"searchImages",value:function searchImages(t){return Promise.resolve([]);}}]);return ib;}();});var OC;var dR=d(function(){DC();EC();FC();OC=/*#__PURE__*/function(_ib){_inherits(OC,_ib);var _super=_createSuper(OC);function OC(){_classCallCheck(this,OC);return _super.apply(this,arguments);}_createClass(OC,[{key:"loadData",value:function loadData(){var _this3=this;if(this.data){return Promise.resolve(this.data);}return this.loadJSON("https://img.ly/static/libraries/unsplash/metadata.json").then(function(t){if(typeof t==="string"){t=JSON.parse(t);}_this3.data=t;return t;});}},{key:"getCategories",value:function getCategories(){return this.loadData().then(function(t){return t.categories.map(function(e){return new Qg({name:e.name,coverImageUrl:e.coverImage});});});}},{key:"searchImages",value:function searchImages(t){return this.loadData().then(function(e){return e.images.filter(function(r){var o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").split(/\s+/);for(var n=0;n1?_len-1:0),_key=1;_key<_len;_key++){e[_key-1]=arguments[_key];}var r=this.events[t];if(!r||!r.length){return false;}r.slice(0).forEach(function(o){return o.apply(null,e);});return true;}}]);return Tr;}();});var LR=d(function(){});var zR=d(function(){});var R=d(function(){$F();sp();_C();KF();XF();qF();YF();Xu();JF();ZF();QF();tO();eO();iO();rO();oO();nO();sO();aO();lO();cO();uO();dO();mO();pO();hO();fO();gO();bO();yO();_O();xO();vO();CO();SO();wO();TO();kO();IO();FO();RO();PO();MO();LO();zO();UO();NO();HO();WO();VO();jO();qO();JO();eR();sR();cR();pR();yR();vR();TR();IR();FR();BR();PR();MR();LR();zR();});var CQ,ub;var UR=d(function(){R();CQ=[{identifier:"basics",name:"Basics",items:[{identifier:"brightness"},{identifier:"contrast"},{identifier:"saturation"},{identifier:"gamma"}]},{identifier:"refinements",name:"Refinements",items:[{identifier:"clarity"},{identifier:"shadows"},{identifier:"highlights"},{identifier:"exposure"},{identifier:"blacks"},{identifier:"whites"},{identifier:"temperature"},{identifier:"sharpness"}]}];ub=CQ;});var SQ,db;var NR=d(function(){R();SQ=[{identifier:"imgly_filter_category_duotone",name:"DuoTone",thumbnailURI:"./categories/duotone.jpg",items:[{identifier:"imgly_duotone_desert",name:"Desert",thumbnailURI:"./items/imgly_duotone_desert.jpg",lightColor:"#e1de9a",darkColor:"#cb2129",defaultIntensity:.5},{identifier:"imgly_duotone_peach",name:"Peach",thumbnailURI:"./items/imgly_duotone_peach.jpg",lightColor:"#e9abb8",darkColor:"#0040ff",defaultIntensity:.5},{identifier:"imgly_duotone_clash",name:"Clash",thumbnailURI:"./items/imgly_duotone_clash.jpg",lightColor:"#f41a0f",darkColor:"#23007c",defaultIntensity:.5},{identifier:"imgly_duotone_plum",name:"Plum",thumbnailURI:"./items/imgly_duotone_plum.jpg",lightColor:"#74d7ff",darkColor:"#23007c",defaultIntensity:.5},{identifier:"imgly_duotone_breezy",name:"Breezy",thumbnailURI:"./items/imgly_duotone_breezy.jpg",lightColor:"#68fdff",darkColor:"#c20000",defaultIntensity:.5},{identifier:"imgly_duotone_deepblue",name:"Deep Blue",thumbnailURI:"./items/imgly_duotone_deepblue.jpg",lightColor:"#2de9eb",darkColor:"#58007c",defaultIntensity:.5},{identifier:"imgly_duotone_frog",name:"Frog",thumbnailURI:"./items/imgly_duotone_frog.jpg",lightColor:"#5bff60",darkColor:"#7f23a9",defaultIntensity:.5},{identifier:"imgly_duotone_sunset",name:"Sunset",thumbnailURI:"./items/imgly_duotone_sunset.jpg",lightColor:"#f8ea46",darkColor:"#c400be",defaultIntensity:.5}]},{identifier:"imgly_filter_category_bw",name:"B & W",thumbnailURI:"./categories/b&w.jpg",items:[{identifier:"imgly_lut_ad1920",name:"1920 A.D.",thumbnailURI:"./items/imgly_lut_ad1920.jpg",lutURI:"./items/imgly_lut_ad1920_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_bw",name:"Greyed",thumbnailURI:"./items/imgly_lut_bw.jpg",lutURI:"./items/imgly_lut_bw_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_x400",name:"Dusty",thumbnailURI:"./items/imgly_lut_x400.jpg",lutURI:"./items/imgly_lut_dusty_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_litho",name:"Litho",thumbnailURI:"./items/imgly_lut_litho.jpg",lutURI:"./items/imgly_lut_litho_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_sepiahigh",name:"Sepia",thumbnailURI:"./items/imgly_lut_sepiahigh.jpg",lutURI:"./items/imgly_lut_sepia_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_plate",name:"Weathered",thumbnailURI:"./items/imgly_lut_plate.jpg",lutURI:"./items/imgly_lut_weathered_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_sin",name:"Hard Stuff",thumbnailURI:"./items/imgly_lut_sin.jpg",lutURI:"./items/imgly_lut_hard_stuff_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8}]},{identifier:"imgly_filter_category_vintage",name:"Vintage",thumbnailURI:"./categories/vintage.jpg",items:[{identifier:"imgly_lut_blues",name:"Polaroid",thumbnailURI:"./items/imgly_lut_blues.jpg",lutURI:"./items/imgly_lut_polaroid_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_front",name:"Sunny 70s",thumbnailURI:"./items/imgly_lut_front.jpg",lutURI:"./items/imgly_lut_sunny_70s_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_texas",name:"Oldtimer",thumbnailURI:"./items/imgly_lut_texas.jpg",lutURI:"./items/imgly_lut_oldtimer_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_celsius",name:"Inferno",thumbnailURI:"./items/imgly_lut_celsius.jpg",lutURI:"./items/imgly_lut_inferno_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_cool",name:"Snappy",thumbnailURI:"./items/imgly_lut_cool.jpg",lutURI:"./items/imgly_lut_snappy_5_5_128.png",defaultIntensity:1}]},{identifier:"imgly_filter_category_smooth",name:"Smooth",thumbnailURI:"./categories/smooth.jpg",items:[{identifier:"imgly_lut_chest",name:"Chestnut",thumbnailURI:"./items/imgly_lut_chest.jpg",lutURI:"./items/imgly_lut_chestnut_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_winter",name:"Softy",thumbnailURI:"./items/imgly_lut_winter.jpg",lutURI:"./items/imgly_lut_softly_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_kdynamic",name:"Pebble",thumbnailURI:"./items/imgly_lut_kdynamic.jpg",lutURI:"./items/imgly_lut_pebble_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_fall",name:"Moss",thumbnailURI:"./items/imgly_lut_fall.jpg",lutURI:"./items/imgly_lut_moss_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_lenin",name:"Lemon",thumbnailURI:"./items/imgly_lut_lenin.jpg",lutURI:"./items/imgly_lut_lemon_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_pola669",name:"Green Gap",thumbnailURI:"./items/imgly_lut_pola669.jpg",lutURI:"./items/imgly_lut_green_gap_5_5_128.png",defaultIntensity:1}]},{identifier:"imgly_filter_category_cold",name:"Cold",thumbnailURI:"./categories/cold.jpg",items:[{identifier:"imgly_lut_elder",name:"Colla",thumbnailURI:"./items/imgly_lut_elder.jpg",lutURI:"./items/imgly_lut_colla_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_orchid",name:"Solanus",thumbnailURI:"./items/imgly_lut_orchid.jpg",lutURI:"./items/imgly_lut_solanus_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_bleached",name:"Kalmen",thumbnailURI:"./items/imgly_lut_bleached.jpg",lutURI:"./items/imgly_lut_kalmen_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_bleachedblue",name:"Joran",thumbnailURI:"./items/imgly_lut_bleachedblue.jpg",lutURI:"./items/imgly_lut_joran_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_breeze",name:"Levante",thumbnailURI:"./items/imgly_lut_breeze.jpg",lutURI:"./items/imgly_lut_levante_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_blueshadows",name:"Zephyr",thumbnailURI:"./items/imgly_lut_blueshadows.jpg",lutURI:"./items/imgly_lut_zephyr_5_5_128.png",defaultIntensity:1}]},{identifier:"imgly_filter_category_warm",name:"Warm",thumbnailURI:"./categories/warm.jpg",items:[{identifier:"imgly_lut_sunset",name:"Golden",thumbnailURI:"./items/imgly_lut_sunset.jpg",lutURI:"./items/imgly_lut_golden_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_eighties",name:"Low Fire",thumbnailURI:"./items/imgly_lut_eighties.jpg",lutURI:"./items/imgly_lut_low_fire_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_evening",name:"Sunrise",thumbnailURI:"./items/imgly_lut_evening.jpg",lutURI:"./items/imgly_lut_sunrise_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_k2",name:"Flat Black",thumbnailURI:"./items/imgly_lut_k2.jpg",lutURI:"./items/imgly_lut_flat_black_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_nogreen",name:"Pumpkin",thumbnailURI:"./items/imgly_lut_nogreen.jpg",lutURI:"./items/imgly_lut_pumpkin_5_5_128.png",defaultIntensity:1}]},{identifier:"imgly_filter_category_legacy",name:"Legacy",thumbnailURI:"./categories/legacy.jpg",items:[{identifier:"imgly_lut_ancient",name:"Ancient",thumbnailURI:"./items/imgly_lut_ancient.jpg",lutURI:"./items/imgly_lut_ancient_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_cottoncandy",name:"Candy",thumbnailURI:"./items/imgly_lut_cottoncandy.jpg",lutURI:"./items/imgly_lut_cottoncandy_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_classic",name:"Classic",thumbnailURI:"./items/imgly_lut_classic.jpg",lutURI:"./items/imgly_lut_classic_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_colorful",name:"Colorful",thumbnailURI:"./items/imgly_lut_colorful.jpg",lutURI:"./items/imgly_lut_colorful_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_creamy",name:"Creamy",thumbnailURI:"./items/imgly_lut_creamy.jpg",lutURI:"./items/imgly_lut_creamy_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_fixie",name:"Fixie",thumbnailURI:"./items/imgly_lut_fixie.jpg",lutURI:"./items/imgly_lut_fixie_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_food",name:"Food",thumbnailURI:"./items/imgly_lut_food.jpg",lutURI:"./items/imgly_lut_food_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_fridge",name:"Fridge",thumbnailURI:"./items/imgly_lut_fridge.jpg",lutURI:"./items/imgly_lut_fridge_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_glam",name:"Glam",thumbnailURI:"./items/imgly_lut_glam.jpg",lutURI:"./items/imgly_lut_glam_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_gobblin",name:"Gobblin",thumbnailURI:"./items/imgly_lut_gobblin.jpg",lutURI:"./items/imgly_lut_gobblin_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_highcontrast",name:"Hicon",thumbnailURI:"./items/imgly_lut_highcontrast.jpg",lutURI:"./items/imgly_lut_highcontrast_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_highcarb",name:"High Carb",thumbnailURI:"./items/imgly_lut_highcarb.jpg",lutURI:"./items/imgly_lut_highcarb_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_k1",name:"K1",thumbnailURI:"./items/imgly_lut_k1.jpg",lutURI:"./items/imgly_lut_k1_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_k6",name:"K6",thumbnailURI:"./items/imgly_lut_k6.jpg",lutURI:"./items/imgly_lut_k6_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_keen",name:"Keen",thumbnailURI:"./items/imgly_lut_keen.jpg",lutURI:"./items/imgly_lut_keen_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_lomo",name:"Lomo",thumbnailURI:"./items/imgly_lut_lomo.jpg",lutURI:"./items/imgly_lut_lomo_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_lomo100",name:"Lomo 100",thumbnailURI:"./items/imgly_lut_lomo100.jpg",lutURI:"./items/imgly_lut_lomo100_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_lucid",name:"Lucid",thumbnailURI:"./items/imgly_lut_lucid.jpg",lutURI:"./items/imgly_lut_lucid_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_mellow",name:"Mellow",thumbnailURI:"./items/imgly_lut_mellow.jpg",lutURI:"./items/imgly_lut_mellow_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_neat",name:"Neat",thumbnailURI:"./items/imgly_lut_neat.jpg",lutURI:"./items/imgly_lut_neat_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_pale",name:"Pale",thumbnailURI:"./items/imgly_lut_pale.jpg",lutURI:"./items/imgly_lut_pale_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_pitched",name:"Pitched",thumbnailURI:"./items/imgly_lut_pitched.jpg",lutURI:"./items/imgly_lut_pitched_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_polasx",name:"Pola SX",thumbnailURI:"./items/imgly_lut_polasx.jpg",lutURI:"./items/imgly_lut_polasx_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_pro400",name:"Pro 400",thumbnailURI:"./items/imgly_lut_pro400.jpg",lutURI:"./items/imgly_lut_pro400_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_quozi",name:"Quozi",thumbnailURI:"./items/imgly_lut_quozi.jpg",lutURI:"./items/imgly_lut_quozi_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_settled",name:"Settled",thumbnailURI:"./items/imgly_lut_settled.jpg",lutURI:"./items/imgly_lut_settled_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_seventies",name:"Seventies",thumbnailURI:"./items/imgly_lut_seventies.jpg",lutURI:"./items/imgly_lut_seventies_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_soft",name:"Soft",thumbnailURI:"./items/imgly_lut_soft.jpg",lutURI:"./items/imgly_lut_soft_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_steel",name:"Steel",thumbnailURI:"./items/imgly_lut_steel.jpg",lutURI:"./items/imgly_lut_steel_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_summer",name:"Summer",thumbnailURI:"./items/imgly_lut_summer.jpg",lutURI:"./items/imgly_lut_summer_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_tender",name:"Tender",thumbnailURI:"./items/imgly_lut_tender.jpg",lutURI:"./items/imgly_lut_tender_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_twilight",name:"Twilight",thumbnailURI:"./items/imgly_lut_twilight.jpg",lutURI:"./items/imgly_lut_twilight_5_5_128.png",defaultIntensity:1}]}];db=SQ;});var wQ,KC;var HR=d(function(){R();wQ=[{identifier:"radial",thumbnailURI:"./items/radial.png"},{identifier:"mirrored",thumbnailURI:"./items/mirrored.png"},{identifier:"linear",thumbnailURI:"./items/linear.png"},{identifier:"gaussian",thumbnailURI:"./items/gaussian.png"}];KC=wQ;});var TQ,mb;var WR=d(function(){TQ=[{identifier:"imgly_font_open_sans_bold",fontFamily:"Open Sans",fontWeight:"bold",fontURI:"./fonts/imgly_font_open_sans_bold.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2189,descender:-600}},{identifier:"imgly_font_aleo_bold",fontFamily:"Aleo",fontWeight:"bold",fontURI:"./fonts/imgly_font_aleo_bold.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:805,descender:-195}},{identifier:"imgly_font_amaticsc",fontFamily:"Amatic SC",fontWeight:"normal",fontURI:"./fonts/imgly_font_amaticsc.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1016,descender:-245}},{identifier:"imgly_font_archivo_black",fontFamily:"Archivo",fontWeight:"normal",fontURI:"./fonts/imgly_font_archivo_black.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:878,descender:-210}},{identifier:"imgly_font_bungee_inline",fontFamily:"Bungee Inline",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_bungee_inline.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:860,descender:-140}},{identifier:"imgly_font_fira_sans_regular",fontFamily:"Fira Sans",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_fira_sans_regular.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:935,descender:-265}},{identifier:"imgly_font_carter_one",fontFamily:"Carter One",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_carter_one.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2264,descender:-890}},{identifier:"imgly_font_codystar",fontFamily:"Codystar",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_codystar.woff",format:"woff",textMetrics:{unitsPerEm:1024,ascender:953,descender:-255}},{identifier:"imgly_font_krona_one",fontFamily:"Krona One",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_krona_one.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2030,descender:-530}},{identifier:"imgly_font_kumar_one_outline",fontFamily:"Kumar One Outline",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_kumar_one_outline.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1137,descender:-642}},{identifier:"imgly_font_lobster",fontFamily:"Lobster",fontWeight:"normal",fontURI:"./fonts/imgly_font_lobster.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1e3,descender:-250}},{identifier:"imgly_font_molle",fontFamily:"Molle",fontWeight:"normal",fontStyle:"italic",fontURI:"./fonts/imgly_font_molle.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1852,descender:-701}},{identifier:"imgly_font_monoton",fontFamily:"Monoton",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_monoton.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2366,descender:-822}},{identifier:"imgly_font_nixie_one",fontFamily:"Nixie One",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_nixie_one.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:926,descender:-210}},{identifier:"imgly_font_notable",fontFamily:"Notable",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_notable.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1143,descender:-157}},{identifier:"imgly_font_ostrich_sans_black",fontFamily:"Ostrich",fontWeight:800,fontStyle:"normal",fontURI:"./fonts/imgly_font_ostrich_sans_black.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:950,descender:-250}},{identifier:"imgly_font_ostrich_sans_bold",fontFamily:"Ostrich",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_ostrich_sans_bold.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:950,descender:-250}},{identifier:"imgly_font_oswald_semi_bold",fontFamily:"Oswald SemiBold",googleFamily:"Oswald",fontWeight:600,fontStyle:"normal",fontURI:"./fonts/imgly_font_oswald_semi_bold.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1193,descender:-289}},{identifier:"imgly_font_palanquin_dark_semi_bold",fontFamily:"Palanquin Dark SemiBold",googleFamily:"Palanquin Dark",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_palanquin_dark_semi_bold.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1320,descender:-491}},{identifier:"imgly_font_poppins",fontFamily:"Poppins",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_poppins.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1050,descender:-350}},{identifier:"imgly_font_permanent_marker",fontFamily:"Permanent Marker",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_permanent_marker.woff",format:"woff",textMetrics:{unitsPerEm:1024,ascender:1136,descender:-325}},{identifier:"imgly_font_roboto_black_italic",fontFamily:"Roboto Black",fontWeight:"bold",fontStyle:"italic",googleFamily:"Roboto",fontURI:"./fonts/imgly_font_roboto_black_italic.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1900,descender:-500}},{identifier:"imgly_font_roboto_light_italic",fontFamily:"Roboto Light",googleFamily:"Roboto",fontWeight:300,fontStyle:"italic",fontURI:"./fonts/imgly_font_roboto_light_italic.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1900,descender:-500}},{identifier:"imgly_font_sancreek",fontFamily:"Sancreek",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_sancreek.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2104,descender:-738}},{identifier:"imgly_font_stint_ultra_expanded",fontFamily:"Stint Ultra Expanded",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_stint_ultra_expanded.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1853,descender:-483}},{identifier:"imgly_font_trash_hand",fontFamily:"Trash Hand",fontWeight:"normal",fontURI:"./fonts/imgly_font_trash_hand.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:759,descender:-304}},{identifier:"imgly_font_vt323",fontFamily:"VT323",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_vt323.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:800,descender:-200}},{identifier:"imgly_font_yeseva_one",fontFamily:"Yeseva One",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_yeseva_one.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:915,descender:-240}},{identifier:"imgly_font_abril_fatface_regular",fontFamily:"Abril Fatface",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_abril_fatface_regular.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1058,descender:-291}},{identifier:"imgly_font_montserrat_light",fontFamily:"Montserrat Light",googleFamily:"Montserrat",fontWeight:300,fontStyle:"normal",fontURI:"./fonts/imgly_font_montserrat_light.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:968,descender:-251}},{identifier:"imgly_font_handycheera_regular",fontFamily:"Handycheera",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_handycheera_regular.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2199,descender:-808}},{identifier:"imgly_font_ostrich_sans_heavy",fontFamily:"Ostrich",fontWeight:900,fontStyle:"normal",fontURI:"./fonts/imgly_font_ostrich_sans_heavy.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:674,descender:0}},{identifier:"imgly_font_petit_formal_script",fontFamily:"Petit Formal Script",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_petit_formal_script.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2033,descender:-527}},{identifier:"imgly_font_rasa_500",fontFamily:"Rasa",fontWeight:500,fontStyle:"normal",fontURI:"./fonts/imgly_font_rasa_500.woff",format:"woff",textMetrics:{unitsPerEm:2750,ascender:2300,descender:-1050}},{identifier:"imgly_font_rasa_regular",fontFamily:"Rasa",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_rasa_regular.woff",format:"woff",textMetrics:{unitsPerEm:2750,ascender:2300,descender:-1050}},{identifier:"imgly_font_roboto_black",fontFamily:"Roboto Black",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_roboto_black.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1900,descender:-500}},{identifier:"imgly_font_roboto_light",fontFamily:"Roboto Light",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_roboto_light.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1900,descender:-500}},{identifier:"imgly_font_sue_ellen_francisco",fontFamily:"Sue Ellen Francisco",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_sue_ellen_francisco.woff",format:"woff",textMetrics:{unitsPerEm:1024,ascender:1362,descender:-634}},{identifier:"imgly_font_ultra",fontFamily:"Ultra",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_ultra.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2066,descender:-561}},{identifier:"imgly_font_allison_regular",fontFamily:"Allison",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_allison_regular.ttf",format:"truetype",textMetrics:{unitsPerEm:1e3,ascender:890,descender:-380}},{identifier:"imgly_font_cookie_regular",fontFamily:"Cookie",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_cookie_regular.ttf",format:"truetype",textMetrics:{unitsPerEm:1e3,ascender:789,descender:-320}},{identifier:"imgly_font_lexend_bold",fontFamily:"Lexend",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_lexend_bold.ttf",format:"truetype",textMetrics:{unitsPerEm:1e3,ascender:1e3,descender:-250}},{identifier:"imgly_font_outfit_bold",fontFamily:"Outfit",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_outfit_bold.ttf",format:"truetype",textMetrics:{unitsPerEm:1e3,ascender:1e3,descender:-260}}];mb=TQ;});var GR,VR;var jR=d(function(){GR=["imgly_font_open_sans_bold","imgly_font_aleo_bold","imgly_font_amaticsc","imgly_font_archivo_black","imgly_font_bungee_inline","imgly_font_carter_one","imgly_font_codystar","imgly_font_fira_sans_regular","imgly_font_krona_one","imgly_font_kumar_one_outline","imgly_font_lexend_bold","imgly_font_lobster","imgly_font_molle","imgly_font_monoton","imgly_font_nixie_one","imgly_font_notable","imgly_font_ostrich_sans_black","imgly_font_ostrich_sans_bold","imgly_font_oswald_semi_bold","imgly_font_outfit_bold","imgly_font_palanquin_dark_semi_bold","imgly_font_poppins","imgly_font_permanent_marker","imgly_font_roboto_black_italic","imgly_font_roboto_light_italic","imgly_font_sancreek","imgly_font_stint_ultra_expanded","imgly_font_trash_hand","imgly_font_vt323","imgly_font_yeseva_one"];VR=["imgly_font_abril_fatface_regular","imgly_font_allison_regular","imgly_font_bungee_inline","imgly_font_cookie_regular","imgly_font_handycheera_regular","imgly_font_lexend_bold","imgly_font_montserrat_light","imgly_font_ostrich_sans_black","imgly_font_ostrich_sans_bold","imgly_font_ostrich_sans_heavy","imgly_font_outfit_bold","imgly_font_permanent_marker","imgly_font_petit_formal_script","imgly_font_rasa_500","imgly_font_rasa_regular","imgly_font_roboto_black","imgly_font_roboto_light","imgly_font_roboto_black_italic","imgly_font_roboto_light_italic","imgly_font_sue_ellen_francisco","imgly_font_ultra"];});var kQ,pb;var $R=d(function(){kQ=[{identifier:"imgly_frame_dia",name:"Dia",layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_dia/imgly_frame_dia_thumb.png",imageGroups:{top:{mid:{image:"./items/imgly_frame_dia/imgly_frame_dia_top.png",mode:"repeat"}},left:{start:"./items/imgly_frame_dia/imgly_frame_dia_top_corner_left.png",mid:"./items/imgly_frame_dia/imgly_frame_dia_left.png",end:"./items/imgly_frame_dia/imgly_frame_dia_bottom_corner_left.png"},right:{start:"./items/imgly_frame_dia/imgly_frame_dia_top_corner_right.png",mid:"./items/imgly_frame_dia/imgly_frame_dia_right.png",end:"./items/imgly_frame_dia/imgly_frame_dia_bottom_corner_right.png"},bottom:{mid:{image:"./items/imgly_frame_dia/imgly_frame_dia_bottom.png",mode:"repeat"}}}},{identifier:"imgly_frame_art_decor",name:"Art Decor",tintable:true,layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_art_decor/imgly_frame_art_decor_thumb.png",imageGroups:{top:{start:"./items/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_left.png",mid:{image:"./items/imgly_frame_art_decor/imgly_frame_art_decor_top.png",mode:"stretch"},end:"./items/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_right.png"},left:{mid:{image:"./items/imgly_frame_art_decor/imgly_frame_art_decor_left.png",mode:"stretch"}},right:{mid:{image:"./items/imgly_frame_art_decor/imgly_frame_art_decor_right.png",mode:"stretch"}},bottom:{start:"./items/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_left.png",mid:{image:"./items/imgly_frame_art_decor/imgly_frame_art_decor_bottom.png",mode:"stretch"},end:"./items/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_right.png"}}},{identifier:"imgly_frame_black_passepartout",name:"Black Passepartout",layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_thumb.png",imageGroups:{top:{start:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_left.png",mid:{image:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top.png",mode:"stretch"},end:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_right.png"},left:{mid:{image:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_right.png",mode:"stretch"}},bottom:{start:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_left.png",mid:{image:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom.png",mode:"stretch"},end:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_right.png"}}},{identifier:"imgly_frame_wood_passepartout",name:"Wood Passepartout",layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_thumb.png",imageGroups:{top:{start:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_left.png",mid:{image:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top.png",mode:"stretch"},end:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_right.png"},left:{mid:{image:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_right.png",mode:"stretch"}},bottom:{start:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_left.png",mid:{image:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom.png",mode:"stretch"},end:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_right.png"}}},{identifier:"imgly_frame_lowpoly_shadow",name:"Low Poly",layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_thumb.png",imageGroups:{top:{start:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_left.png",mid:{image:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top.png",mode:"stretch"},end:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_right.png"},left:{mid:{image:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_left.png",mode:"stretch"}},right:{mid:{image:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_right.png",mode:"stretch"}},bottom:{start:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_left.png",mid:{image:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom.png",mode:"stretch"},end:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_right.png"}}}];pb=kQ;});var IQ,hb;var KR=d(function(){R();IQ=[{identifier:"imgly_overlay_golden",name:"Golden",defaultBlendMode:"lighten",overlayURI:"./items/imgly_overlay_golden.jpg",thumbnailURI:"./items/imgly_overlay_golden_thumb.jpg"},{identifier:"imgly_overlay_lightleak1",name:"Lightleak",defaultBlendMode:"screen",overlayURI:"./items/imgly_overlay_lightleak1.jpg",thumbnailURI:"./items/imgly_overlay_lightleak1_thumb.jpg"},{identifier:"imgly_overlay_rain",name:"Rain",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_rain.jpg",thumbnailURI:"./items/imgly_overlay_rain_thumb.jpg"},{identifier:"imgly_overlay_mosaic",name:"Mosaic",defaultBlendMode:"multiply",overlayURI:"./items/imgly_overlay_mosaic.jpg",thumbnailURI:"./items/imgly_overlay_mosaic_thumb.jpg"},{identifier:"imgly_overlay_vintage",name:"Vintage",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_vintage.jpg",thumbnailURI:"./items/imgly_overlay_vintage_thumb.jpg"},{identifier:"imgly_overlay_paper",name:"Paper",defaultBlendMode:"multiply",overlayURI:"./items/imgly_overlay_paper.jpg",thumbnailURI:"./items/imgly_overlay_paper_thumb.jpg"},{identifier:"imgly_overlay_bokeh",name:"Bokeh",defaultBlendMode:"lighten",overlayURI:"./items/imgly_overlay_bokeh.jpg",thumbnailURI:"./items/imgly_overlay_bokeh_thumb.jpg"},{identifier:"imgly_overlay_hearts",name:"Hearts",defaultBlendMode:"screen",overlayURI:"./items/imgly_overlay_hearts.jpg",thumbnailURI:"./items/imgly_overlay_hearts_thumb.jpg"},{identifier:"imgly_overlay_lightleak2",name:"Lightleak 2",defaultBlendMode:"lighten",overlayURI:"./items/imgly_overlay_lightleak2.jpg",thumbnailURI:"./items/imgly_overlay_lightleak2_thumb.jpg"},{identifier:"imgly_overlay_wood",name:"Wood",defaultBlendMode:"multiply",overlayURI:"./items/imgly_overlay_wood.jpg",thumbnailURI:"./items/imgly_overlay_wood_thumb.jpg"},{identifier:"imgly_overlay_chop",name:"Chop",defaultBlendMode:"multiply",overlayURI:"./items/imgly_overlay_chop.jpg",thumbnailURI:"./items/imgly_overlay_chop_thumb.jpg"},{identifier:"imgly_overlay_metal",name:"Metal",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_metal.jpg",thumbnailURI:"./items/imgly_overlay_metal_thumb.jpg"},{identifier:"imgly_overlay_painting",name:"Painting",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_painting.jpg",thumbnailURI:"./items/imgly_overlay_painting_thumb.jpg"},{identifier:"imgly_overlay_grain",name:"Grain",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_grain.jpg",thumbnailURI:"./items/imgly_overlay_grain_thumb.jpg"},{identifier:"imgly_overlay_clouds",name:"Clouds",defaultBlendMode:"softLight",overlayURI:"./items/imgly_overlay_clouds.jpg",thumbnailURI:"./items/imgly_overlay_clouds_thumb.jpg"},{identifier:"imgly_overlay_wall1",name:"Wall",defaultBlendMode:"lighten",overlayURI:"./items/imgly_overlay_wall1.jpg",thumbnailURI:"./items/imgly_overlay_wall1_thumb.jpg"},{identifier:"imgly_overlay_wall2",name:"Wall 2",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_wall2.jpg",thumbnailURI:"./items/imgly_overlay_wall2_thumb.jpg"}];hb=IQ;});var DQ,fb;var XR=d(function(){DQ=[{identifier:"imgly_sticker_emoticons",name:"Emoticons",thumbnailURI:"./categories/emoticons.png",items:[{identifier:"imgly_sticker_emoticons_grin",stickerURI:"./emoticons/imgly_sticker_emoticons_grin.svg",tintMode:"none",name:"Grin",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_laugh",stickerURI:"./emoticons/imgly_sticker_emoticons_laugh.svg",tintMode:"none",name:"Laugh",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_smile",stickerURI:"./emoticons/imgly_sticker_emoticons_smile.svg",tintMode:"none",name:"Smile",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_wink",stickerURI:"./emoticons/imgly_sticker_emoticons_wink.svg",tintMode:"none",name:"Wink",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_tongue_out_wink",stickerURI:"./emoticons/imgly_sticker_emoticons_tongue_out_wink.svg",tintMode:"none",name:"Tongue out wink",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_angel",stickerURI:"./emoticons/imgly_sticker_emoticons_angel.svg",tintMode:"none",name:"Angel",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_kisses",stickerURI:"./emoticons/imgly_sticker_emoticons_kisses.svg",tintMode:"none",name:"Kisses",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_loving",stickerURI:"./emoticons/imgly_sticker_emoticons_loving.svg",tintMode:"none",name:"Loving",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_kiss",stickerURI:"./emoticons/imgly_sticker_emoticons_kiss.svg",tintMode:"none",name:"Kiss",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_wave",stickerURI:"./emoticons/imgly_sticker_emoticons_wave.svg",tintMode:"none",name:"Wave",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_nerd",stickerURI:"./emoticons/imgly_sticker_emoticons_nerd.svg",tintMode:"none",name:"Nerd",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_cool",stickerURI:"./emoticons/imgly_sticker_emoticons_cool.svg",tintMode:"none",name:"Cool",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_blush",stickerURI:"./emoticons/imgly_sticker_emoticons_blush.svg",tintMode:"none",name:"Blush",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_duckface",stickerURI:"./emoticons/imgly_sticker_emoticons_duckface.svg",tintMode:"none",name:"Duckface",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_furious",stickerURI:"./emoticons/imgly_sticker_emoticons_furious.svg",tintMode:"none",name:"Furious",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_angry",stickerURI:"./emoticons/imgly_sticker_emoticons_angry.svg",tintMode:"none",name:"Angry",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_steaming_furious",stickerURI:"./emoticons/imgly_sticker_emoticons_steaming_furious.svg",tintMode:"none",name:"Steaming Furious",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sad",stickerURI:"./emoticons/imgly_sticker_emoticons_sad.svg",tintMode:"none",name:"Sad",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_anxious",stickerURI:"./emoticons/imgly_sticker_emoticons_anxious.svg",tintMode:"none",name:"Anxious",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_cry",stickerURI:"./emoticons/imgly_sticker_emoticons_cry.svg",tintMode:"none",name:"Cry",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sobbing",stickerURI:"./emoticons/imgly_sticker_emoticons_sobbing.svg",tintMode:"none",name:"Sobbing",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_loud_cry",stickerURI:"./emoticons/imgly_sticker_emoticons_loud_cry.svg",tintMode:"none",name:"Loud Cry",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_wide_grin",stickerURI:"./emoticons/imgly_sticker_emoticons_wide_grin.svg",tintMode:"none",name:"Wide grin",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_impatient",stickerURI:"./emoticons/imgly_sticker_emoticons_impatient.svg",tintMode:"none",name:"Impatient",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_tired",stickerURI:"./emoticons/imgly_sticker_emoticons_tired.svg",tintMode:"none",name:"Tired",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_asleep",stickerURI:"./emoticons/imgly_sticker_emoticons_asleep.svg",tintMode:"none",name:"Asleep",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sleepy",stickerURI:"./emoticons/imgly_sticker_emoticons_sleepy.svg",tintMode:"none",name:"Sleepy",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_deceased",stickerURI:"./emoticons/imgly_sticker_emoticons_deceased.svg",tintMode:"none",name:"Deceased",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_attention",stickerURI:"./emoticons/imgly_sticker_emoticons_attention.svg",tintMode:"none",name:"Attention",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_question",stickerURI:"./emoticons/imgly_sticker_emoticons_question.svg",tintMode:"none",name:"Question",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_not_speaking_to_you",stickerURI:"./emoticons/imgly_sticker_emoticons_not_speaking_to_you.svg",tintMode:"none",name:"Not speaking to you",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sick",stickerURI:"./emoticons/imgly_sticker_emoticons_sick.svg",tintMode:"none",name:"Sick",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_pumpkin",stickerURI:"./emoticons/imgly_sticker_emoticons_pumpkin.svg",tintMode:"none",name:"Pumpkin",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_boxer",stickerURI:"./emoticons/imgly_sticker_emoticons_boxer.svg",tintMode:"none",name:"Boxer",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_idea",stickerURI:"./emoticons/imgly_sticker_emoticons_idea.svg",tintMode:"none",name:"Idea",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_smoking",stickerURI:"./emoticons/imgly_sticker_emoticons_smoking.svg",tintMode:"none",name:"Smoking",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_beer",stickerURI:"./emoticons/imgly_sticker_emoticons_beer.svg",tintMode:"none",name:"Beer",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_skateboard",stickerURI:"./emoticons/imgly_sticker_emoticons_skateboard.svg",tintMode:"none",name:"Skateboard",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_guitar",stickerURI:"./emoticons/imgly_sticker_emoticons_guitar.svg",tintMode:"none",name:"Guitar",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_music",stickerURI:"./emoticons/imgly_sticker_emoticons_music.svg",tintMode:"none",name:"Music",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sunbathing",stickerURI:"./emoticons/imgly_sticker_emoticons_sunbathing.svg",tintMode:"none",name:"Sunbathing",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_hippie",stickerURI:"./emoticons/imgly_sticker_emoticons_hippie.svg",tintMode:"none",name:"Hippie",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_humourous",stickerURI:"./emoticons/imgly_sticker_emoticons_humourous.svg",tintMode:"none",name:"Humourous",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_hitman",stickerURI:"./emoticons/imgly_sticker_emoticons_hitman.svg",tintMode:"none",name:"Hitman",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_harry_potter",stickerURI:"./emoticons/imgly_sticker_emoticons_harry_potter.svg",tintMode:"none",name:"Harry Potter",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_business",stickerURI:"./emoticons/imgly_sticker_emoticons_business.svg",tintMode:"none",name:"Business",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_batman",stickerURI:"./emoticons/imgly_sticker_emoticons_batman.svg",tintMode:"none",name:"Batman",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_skull",stickerURI:"./emoticons/imgly_sticker_emoticons_skull.svg",tintMode:"none",name:"Skull",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_ninja",stickerURI:"./emoticons/imgly_sticker_emoticons_ninja.svg",tintMode:"none",name:"Ninja",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_masked",stickerURI:"./emoticons/imgly_sticker_emoticons_masked.svg",tintMode:"none",name:"Masked",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_alien",stickerURI:"./emoticons/imgly_sticker_emoticons_alien.svg",tintMode:"none",name:"Alien",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_wrestler",stickerURI:"./emoticons/imgly_sticker_emoticons_wrestler.svg",tintMode:"none",name:"Wrestler",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_devil",stickerURI:"./emoticons/imgly_sticker_emoticons_devil.svg",tintMode:"none",name:"Devil",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_star",stickerURI:"./emoticons/imgly_sticker_emoticons_star.svg",tintMode:"none",name:"Star",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_baby_chicken",stickerURI:"./emoticons/imgly_sticker_emoticons_baby_chicken.svg",tintMode:"none",name:"Baby Chicken",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_rabbit",stickerURI:"./emoticons/imgly_sticker_emoticons_rabbit.svg",tintMode:"none",name:"Rabbit",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_pig",stickerURI:"./emoticons/imgly_sticker_emoticons_pig.svg",tintMode:"none",name:"Pig",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_chicken",stickerURI:"./emoticons/imgly_sticker_emoticons_chicken.svg",tintMode:"none",name:"Chicken",resizeMode:"keepAspect"}]},{identifier:"imgly_sticker_shapes",name:"Shapes",thumbnailURI:"./categories/shapes.png",items:[{identifier:"imgly_sticker_shapes_badge_01",stickerURI:"./shapes/imgly_sticker_shapes_badge_01.svg",tintMode:"solid",name:"Shape Badge 01",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_04",stickerURI:"./shapes/imgly_sticker_shapes_badge_04.svg",tintMode:"solid",name:"Shape Badge 04",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_12",stickerURI:"./shapes/imgly_sticker_shapes_badge_12.svg",tintMode:"solid",name:"Shape Badge 12",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_06",stickerURI:"./shapes/imgly_sticker_shapes_badge_06.svg",tintMode:"solid",name:"Shape Badge 06",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_13",stickerURI:"./shapes/imgly_sticker_shapes_badge_13.svg",tintMode:"solid",name:"Shape Badge 13",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_36",stickerURI:"./shapes/imgly_sticker_shapes_badge_36.svg",tintMode:"solid",name:"Shape Badge 36",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_08",stickerURI:"./shapes/imgly_sticker_shapes_badge_08.svg",tintMode:"solid",name:"Shape Badge 08",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_11",stickerURI:"./shapes/imgly_sticker_shapes_badge_11.svg",tintMode:"solid",name:"Shape Badge 11",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_35",stickerURI:"./shapes/imgly_sticker_shapes_badge_35.svg",tintMode:"solid",name:"Shape Badge 35",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_28",stickerURI:"./shapes/imgly_sticker_shapes_badge_28.svg",tintMode:"solid",name:"Shape Badge 28",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_32",stickerURI:"./shapes/imgly_sticker_shapes_badge_32.svg",tintMode:"solid",name:"Shape Badge 32",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_15",stickerURI:"./shapes/imgly_sticker_shapes_badge_15.svg",tintMode:"solid",name:"Shape Badge 15",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_20",stickerURI:"./shapes/imgly_sticker_shapes_badge_20.svg",tintMode:"solid",name:"Shape Badge 20",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_18",stickerURI:"./shapes/imgly_sticker_shapes_badge_18.svg",tintMode:"solid",name:"Shape Badge 18",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_19",stickerURI:"./shapes/imgly_sticker_shapes_badge_19.svg",tintMode:"solid",name:"Shape Badge 19",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_arrow_02",stickerURI:"./shapes/imgly_sticker_shapes_arrow_02.svg",tintMode:"solid",name:"Shape Arrow 02",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_arrow_03",stickerURI:"./shapes/imgly_sticker_shapes_arrow_03.svg",tintMode:"solid",name:"Shape Arrow 03",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_spray_01",stickerURI:"./shapes/imgly_sticker_shapes_spray_01.svg",tintMode:"solid",name:"Shape Spray 01",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_spray_04",stickerURI:"./shapes/imgly_sticker_shapes_spray_04.svg",tintMode:"solid",name:"Shape Spray 04",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_spray_03",stickerURI:"./shapes/imgly_sticker_shapes_spray_03.svg",tintMode:"solid",name:"Shape Spray 03",resizeMode:"keepAspect"}]}];fb=DQ;});var EQ,qR;var YR=d(function(){EQ=[{thumbnailURI:"./items/dark/imgly_text_design_icon_thislayoutisgreat.png",identifier:"imgly_text_design_blocks",name:"Blocks"},{thumbnailURI:"./items/dark/imgly_text_design_icon_fatandfast.png",identifier:"imgly_text_design_rotated",name:"Rotated"},{thumbnailURI:"./items/dark/imgly_text_design_icon_summerfeeling.png",identifier:"imgly_text_design_blocks_light",name:"Blocks Light"},{thumbnailURI:"./items/dark/imgly_text_design_icon_typewithstyle.png",identifier:"imgly_text_design_equal_width",name:"Equal Width"},{thumbnailURI:"./items/dark/imgly_text_design_icon_inthebox.png",identifier:"imgly_text_design_masked",name:"Masked"},{thumbnailURI:"./items/dark/imgly_text_design_icon_bluefriday.png",identifier:"imgly_text_design_celebrate",name:"Celebrate"},{thumbnailURI:"./items/dark/imgly_text_design_icon_decorative.png",identifier:"imgly_text_design_sunshine",name:"Sunshine"},{thumbnailURI:"./items/dark/imgly_text_design_icon_specialdeals.png",identifier:"imgly_text_design_masked_badge",name:"Masked Badge"},{thumbnailURI:"./items/dark/imgly_text_design_icon_doublelines.png",identifier:"imgly_text_design_blocks_condensed",name:"Blocks Condensed"},{thumbnailURI:"./items/dark/imgly_text_design_icon_celebrate.png",identifier:"imgly_text_design_celebrate_simple",name:"Celebrate Simple"},{thumbnailURI:"./items/dark/imgly_text_design_icon_beerandburger.png",identifier:"imgly_text_design_equal_width_fat",name:"Equal Width Fat"},{thumbnailURI:"./items/dark/imgly_text_design_icon_watercolor.png",identifier:"imgly_text_design_watercolor",name:"Watercolor"},{thumbnailURI:"./items/dark/imgly_text_design_icon_particle.png",identifier:"imgly_text_design_particles",name:"Particles"},{thumbnailURI:"./items/dark/imgly_text_design_icon_yeah.png",identifier:"imgly_text_design_masked_speech_bubble",name:"Masked Speech Bubble"},{thumbnailURI:"./items/dark/imgly_text_design_icon_thisisadream.png",identifier:"imgly_text_design_masked_speech_bubble_comic",name:"Masked Speech Bubble Comic"},{thumbnailURI:"./items/dark/imgly_text_design_icon_fatface.png",identifier:"imgly_text_design_multiline",name:"Multiline"}];qR=EQ;});var FQ,JR;var ZR=d(function(){FQ=[{thumbnailURI:"./items/light/imgly_text_design_icon_thislayoutisgreat.png",identifier:"imgly_text_design_blocks",name:"Blocks"},{thumbnailURI:"./items/light/imgly_text_design_icon_fatandfast.png",identifier:"imgly_text_design_rotated",name:"Rotated"},{thumbnailURI:"./items/light/imgly_text_design_icon_summerfeeling.png",identifier:"imgly_text_design_blocks_light",name:"Blocks Light"},{thumbnailURI:"./items/light/imgly_text_design_icon_typewithstyle.png",identifier:"imgly_text_design_equal_width",name:"Equal Width"},{thumbnailURI:"./items/light/imgly_text_design_icon_inthebox.png",identifier:"imgly_text_design_masked",name:"Masked"},{thumbnailURI:"./items/light/imgly_text_design_icon_bluefriday.png",identifier:"imgly_text_design_celebrate",name:"Celebrate"},{thumbnailURI:"./items/light/imgly_text_design_icon_decorative.png",identifier:"imgly_text_design_sunshine",name:"Sunshine"},{thumbnailURI:"./items/light/imgly_text_design_icon_specialdeals.png",identifier:"imgly_text_design_masked_badge",name:"Masked Badge"},{thumbnailURI:"./items/light/imgly_text_design_icon_doublelines.png",identifier:"imgly_text_design_blocks_condensed",name:"Blocks Condensed"},{thumbnailURI:"./items/light/imgly_text_design_icon_celebrate.png",identifier:"imgly_text_design_celebrate_simple",name:"Celebrate Simple"},{thumbnailURI:"./items/light/imgly_text_design_icon_beerandburger.png",identifier:"imgly_text_design_equal_width_fat",name:"Equal Width Fat"},{thumbnailURI:"./items/light/imgly_text_design_icon_watercolor.png",identifier:"imgly_text_design_watercolor",name:"Watercolor"},{thumbnailURI:"./items/light/imgly_text_design_icon_particle.png",identifier:"imgly_text_design_particles",name:"Particles"},{thumbnailURI:"./items/light/imgly_text_design_icon_yeah.png",identifier:"imgly_text_design_masked_speech_bubble",name:"Masked Speech Bubble"},{thumbnailURI:"./items/light/imgly_text_design_icon_thisisadream.png",identifier:"imgly_text_design_masked_speech_bubble_comic",name:"Masked Speech Bubble Comic"},{thumbnailURI:"./items/light/imgly_text_design_icon_fatface.png",identifier:"imgly_text_design_multiline",name:"Multiline"}];JR=FQ;});var OQ,gb;var QR=d(function(){OQ=[{identifier:"imgly_transforms_common",name:"Common",items:[{identifier:"imgly_transform_common_custom",name:"Custom",thumbnailURI:"",ratio:"*"},{identifier:"imgly_transform_common_square",name:"Square",thumbnailURI:"",ratio:1},{identifier:"imgly_transform_common_4",name:"4:3",thumbnailURI:"",ratio:4/3},{identifier:"imgly_transform_common_16",name:"16:9",thumbnailURI:"",ratio:16/9},{identifier:"imgly_transform_common_3",name:"3:4",thumbnailURI:"",ratio:3/4},{identifier:"imgly_transform_common_9",name:"9:16",thumbnailURI:"",ratio:9/16}]},{identifier:"imgly_transforms_facebook",name:"Facebook",items:[{identifier:"imgly_transform_facebook_profile",name:"Profile",thumbnailURI:"",dimensions:{x:300,y:300},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_facebook_title",name:"Title",thumbnailURI:"",dimensions:{x:1200,y:627},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_facebook_post",name:"Post",thumbnailURI:"",dimensions:{x:940,y:788},forceDimensions:true,lockDimensions:true}]},{identifier:"imgly_transforms_instagram",name:"Instagram",items:[{identifier:"imgly_transform_instagram_landscape",name:"Landscape",thumbnailURI:"",dimensions:{x:1080,y:566},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_instagram_portrait",name:"Portrait",thumbnailURI:"",dimensions:{x:1080,y:1350},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_instagram_square",name:"Square",thumbnailURI:"",dimensions:{x:1080,y:1080},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_instagram_story",name:"Story",thumbnailURI:"",dimensions:{x:1080,y:1920},forceDimensions:true,lockDimensions:true}]},{identifier:"imgly_transforms_twitter",name:"Twitter",items:[{identifier:"imgly_transform_twitter_post",name:"Post",thumbnailURI:"",dimensions:{x:1024,y:512},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_twitter_profile",name:"Profile",thumbnailURI:"",dimensions:{x:400,y:400},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_twitter_title",name:"Title",thumbnailURI:"",dimensions:{x:1500,y:500},forceDimensions:true,lockDimensions:true}]}];gb=OQ;});var us,hn;var XC=d(function(){us={imgly_font_bernier_regular:"imgly_font_sancreek",imgly_font_cheque_regular:"imgly_font_kumar_one_outline",imgly_font_gagalin_regular:"imgly_font_permanent_marker",imgly_font_hagin_caps_thin:"imgly_font_nixie_one",imgly_font_intro_inline:"imgly_font_bungee_inline",imgly_font_nexa_script:"imgly_font_molle",imgly_font_panton_blackitalic_caps:"imgly_font_roboto_black_italic",imgly_font_panton_lightitalic_caps:"imgly_font_roboto_light_italic",imgly_font_perfograma:"imgly_font_codystar",imgly_font_panton_black_caps:"imgly_font_roboto_black",imgly_font_panton_light_caps:"imgly_font_roboto_light",imgly_font_summer_font_light:"imgly_font_sue_ellen_francisco",imgly_font_wolesbro:"imgly_font_cookie_regular",imgly_font_campton_bold:"imgly_font_outfit_bold",imgly_font_galano_grotesque_bold:"imgly_font_lexend_bold",imgly_font_amberlight:"imgly_font_allison_regular)"};hn=function hn(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(us[i]){if(t){console.warn("Font ".concat(i," was deprecated. Please use ").concat(us[i]," instead."));}return us[i];}return i;};});var mp={};de(mp,{isMobile:function isMobile(){return qC;}});function qC(){if(typeof navigator==="undefined"){return false;}var i=navigator.userAgent||navigator.vendor||window.opera;return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4));}var YC=d(function(){});function At(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var t=Math.random()*16|0;var e=i==="x"?t:t&3|8;return e.toString(16);});}var tA=d(function(){});var eA,iA;var JC=d(function(){eA=function eA(i){i.preventDefault();i.stopPropagation();};iA=function iA(){};});var ZC=d(function(){});var o_t;var rA=d(function(){JC();ZC();o_t=typeof window!=="undefined"?window.performance.now.bind(window.performance):iA();});var pp;var QC=d(function(){pp=/*#__PURE__*/function(){function pp(t){_classCallCheck(this,pp);this.text=t;this.lastOffsetWidth=-1;var e="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.element=document.createElement("div");this.element.setAttribute("aria-hidden","true");this.element.appendChild(document.createTextNode(t));this.collapsible=document.createElement("span");this.expandable=document.createElement("span");this.collapsibleInner=document.createElement("span");this.expandableInner=document.createElement("span");this.collapsible.style.cssText=e;this.expandable.style.cssText=e;this.expandableInner.style.cssText=e;this.collapsibleInner.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;";this.collapsible.appendChild(this.collapsibleInner);this.expandable.appendChild(this.expandableInner);this.element.appendChild(this.collapsible);this.element.appendChild(this.expandable);}_createClass(pp,[{key:"getElement",value:function getElement(){return this.element;}},{key:"setFont",value:function setFont(t){this.element.style.cssText="max-width:none;\n min-width:20px;\n min-height:20px;\n display:inline-block;\n overflow:hidden;\n position:absolute;\n width:auto;\n margin:0;\n padding:0;\n top:-999px;\n white-space:nowrap;\n font-synthesis:none;\n font:".concat(t,";");}},{key:"getWidth",value:function getWidth(){return this.element.offsetWidth;}},{key:"setWidth",value:function setWidth(t){this.element.style.width="".concat(t,"px");}},{key:"onResize",value:function onResize(t){var _this4=this;var e=function e(){_this4.onScroll(t);};this.collapsible.addEventListener("scroll",e);this.expandable.addEventListener("scroll",e);this.reset();}},{key:"reset",value:function reset(){var t=this.getWidth();var e=t+100;this.expandableInner.style.width="".concat(e,"px");this.expandable.scrollLeft=e;this.collapsible.scrollLeft=this.collapsible.scrollWidth+100;if(this.lastOffsetWidth!==t){this.lastOffsetWidth=t;return true;}return false;}},{key:"onScroll",value:function onScroll(t){if(this.reset()&&this.element.parentNode!==null){t(this.lastOffsetWidth);}}}]);return pp;}();});var _Ce,Ca;var oA=d(function(){QC();_Ce=/*#__PURE__*/function(){function Ce(t){_classCallCheck(this,Ce);this.font=_objectSpread({fontFamily:"normal",fontStyle:"normal",fontWeight:"normal",fontStretch:"normal"},t);}_createClass(Ce,[{key:"load",value:function load(t,e){var _this5=this;var r="BESbswy";var o=null;var n=e||_Ce.DEFAULT_TIMEOUT;var s=this.getTime();return new Promise(function(a,l){if(_Ce.supportsNativeFontLoading()&&!_Ce.hasSafari10Bug()){var c=new Promise(function(m,p){var h=function h(){var g=_this5.getTime();if(g-s>=n){p(new Error(""+n+"ms timeout exceeded"));}else{document["fonts"].load(_this5.getStyle("\"".concat(_this5.font.fontFamily,"\"")),r).then(function(x){if(x.length>=1){m();}else{setTimeout(h,25);}},l);}};h();});var u=new Promise(function(m,p){o=setTimeout(function(){p(new Error("".concat(n," ms timeout exceeded")));},n);});Promise.race([u,c]).then(function(){clearTimeout(o);a(_this5);},l);}else{var _c2=new pp(r);var _u2=new pp(r);var m=new pp(r);var p=-1;var h=-1;var g=-1;var x=-1;var v=-1;var b=-1;var T=document.createElement("div");var k=function k(){if(T.parentNode!==null){T.parentNode.removeChild(T);}};var E=function E(){if(p!==-1&&h!==-1||p!==-1&&g!==-1||h!==-1&&g!==-1){if(p===h||p===g||h===g){if(_Ce.hasWebKitFallbackBug()){if(p===x&&h===x&&g===x||p===v&&h===v&&g===v||p===b&&h===b&&g===b){return;}}k();clearTimeout(o);a(_this5);}}};T.dir="ltr";_c2.setFont(_this5.getStyle("sans-serif"));_u2.setFont(_this5.getStyle("serif"));m.setFont(_this5.getStyle("monospace"));T.appendChild(_c2.getElement());T.appendChild(_u2.getElement());T.appendChild(m.getElement());document.body.appendChild(T);x=_c2.getWidth();v=_u2.getWidth();b=m.getWidth();var A=function A(){var I=_this5.getTime();if(I-s>=n){k();l(new Error("".concat(n," ms timeout exceeded")));}else{var F=document.hidden;if(F===true||F===void 0){p=_c2.getWidth();h=_u2.getWidth();g=m.getWidth();E();}o=setTimeout(A,50);}};A();_c2.onResize(function(I){p=I;E();});_c2.setFont(_this5.getStyle("\"".concat(_this5.font.fontFamily,"\",sans-serif")));_u2.onResize(function(I){h=I;E();});_u2.setFont(_this5.getStyle("\"".concat(_this5.font.fontFamily,"\",serif")));m.onResize(function(I){g=I;E();});m.setFont(_this5.getStyle("\"".concat(_this5.font.fontFamily,"\",monospace")));}});}},{key:"getStyle",value:function getStyle(t){return[this.font.fontStyle,this.font.fontWeight,_Ce.supportsStretch()?this.font.fontStretch:"","100px",t].join(" ");}},{key:"getTime",value:function getTime(){return new Date().getTime();}}],[{key:"getUserAgent",value:function getUserAgent(){return window.navigator.userAgent;}},{key:"getNavigatorVendor",value:function getNavigatorVendor(){return window.navigator.vendor;}},{key:"hasWebKitFallbackBug",value:function hasWebKitFallbackBug(){if(_Ce.HAS_WEBKIT_FALLBACK_BUG===null){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(_Ce.getUserAgent());_Ce.HAS_WEBKIT_FALLBACK_BUG=!!t&&(parseInt(t[1],10)<536||parseInt(t[1],10)===536&&parseInt(t[2],10)<=11);}return _Ce.HAS_WEBKIT_FALLBACK_BUG;}},{key:"hasSafari10Bug",value:function hasSafari10Bug(){if(_Ce.HAS_SAFARI_10_BUG===null){if(_Ce.supportsNativeFontLoading()&&/Apple/.test(_Ce.getNavigatorVendor())){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(_Ce.getUserAgent());_Ce.HAS_SAFARI_10_BUG=!!t&&parseInt(t[1],10)<603;}else{_Ce.HAS_SAFARI_10_BUG=false;}}return _Ce.HAS_SAFARI_10_BUG;}},{key:"supportsNativeFontLoading",value:function supportsNativeFontLoading(){if(_Ce.SUPPORTS_NATIVE_FONT_LOADING===null){_Ce.SUPPORTS_NATIVE_FONT_LOADING=!!document["fonts"];}return _Ce.SUPPORTS_NATIVE_FONT_LOADING;}},{key:"supportsStretch",value:function supportsStretch(){if(_Ce.SUPPORTS_STRETCH===null){var t=document.createElement("div");try{t.style.font="condensend 100px sans-serif";}catch(e){_Ce.SUPPORTS_STRETCH=false;}_Ce.SUPPORTS_STRETCH=t.style.font!=="";}return _Ce.SUPPORTS_STRETCH;}}]);return Ce;}();Ca=_Ce;Ca.HAS_WEBKIT_FALLBACK_BUG=null;Ca.HAS_SAFARI_10_BUG=null;Ca.SUPPORTS_STRETCH=null;Ca.SUPPORTS_NATIVE_FONT_LOADING=null;Ca.DEFAULT_TIMEOUT=6e4;});var _ge,O;var tS=d(function(){_ge=/*#__PURE__*/function(){function ge(t,e){_classCallCheck(this,ge);if(typeof t==="number"){this.x=t;this.y=e;}else{this.x=t.x;this.y=t.y;}}_createClass(ge,[{key:"magnitude",get:function get(){return Math.sqrt(this.x*this.x+this.y*this.y);}},{key:"normalized",get:function get(){var t=this.magnitude;return new _ge(this.x/t,this.y/t);}},{key:"floored",get:function get(){return new _ge(Math.floor(this.x),Math.floor(this.y));}},{key:"rounded",get:function get(){return new _ge(Math.round(this.x),Math.round(this.y));}},{key:"min",get:function get(){return Math.min(this.x,this.y);}},{key:"max",get:function get(){return Math.max(this.x,this.y);}},{key:"abs",get:function get(){return new _ge(Math.abs(this.x),Math.abs(this.y));}},{key:"swapped",get:function get(){return new _ge(this.y,this.x);}},{key:"clone",value:function clone(){return new _ge(this.x,this.y);}},{key:"add",value:function add(t,e){if(typeof t==="number"){return new _ge(this.x+t,this.y+e);}else{return new _ge(this.x+t.x,this.y+t.y);}}},{key:"subtract",value:function subtract(t,e){if(typeof t==="number"){return new _ge(this.x-t,this.y-e);}else{return new _ge(this.x-t.x,this.y-t.y);}}},{key:"multiply",value:function multiply(t,e){if(typeof t==="number"){return new _ge(this.x*t,this.y*(e===void 0?t:e));}else{return new _ge(this.x*t.x,this.y*t.y);}}},{key:"divide",value:function divide(t,e){if(typeof t==="number"){return new _ge(this.x/t,this.y/(e===void 0?t:e));}else{return new _ge(this.x/t.x,this.y/t.y);}}},{key:"equals",value:function equals(t){return this.x===t.x&&this.y===t.y;}},{key:"clamp",value:function clamp(t,e){var r=Math.max(t.x,Math.min(e.x,this.x));var o=Math.max(t.y,Math.min(e.y,this.y));return new _ge(r,o);}}],[{key:"fromSize",value:function fromSize(t){return new _ge(t.width,t.height);}},{key:"distance",value:function distance(t,e){var r=e.x-t.x;var o=e.y-t.y;return Math.sqrt(r*r+o*o);}},{key:"dot",value:function dot(t,e){return t.x*e.x+t.y*e.y;}},{key:"lerp",value:function lerp(t,e,r){var o=Math.min(Math.max(r,0),1);return new _ge(t.x*o+e.x*(1-o),t.y*o+e.y*(1-o));}},{key:"lerpUnclamped",value:function lerpUnclamped(t,e,r){return new _ge(t.x*r+e.x*(1-r),t.y*r+e.y*(1-r));}},{key:"proportionalFit",value:function proportionalFit(t,e){var r=t.x/t.y;var o=e.x/e.y;if(r>o){return e.multiply(t.y/e.y);}else{return e.multiply(t.x/e.x);}}}]);return ge;}();O=_ge;O.ZERO=new _ge(0,0);O.ONE=new _ge(1,1);O.UP=new _ge(0,1);O.DOWN=new _ge(0,-1);O.RIGHT=new _ge(1,0);O.LEFT=new _ge(-1,0);});var eS=d(function(){R();});var hp;var nA=d(function(){tS();eS();YC();hp=/*#__PURE__*/function(_Tr){_inherits(hp,_Tr);var _super2=_createSuper(hp);function hp(t,e){var _this6;_classCallCheck(this,hp);_this6=_super2.call(this);_this6.image=t;_this6.options=e;return _this6;}_createClass(hp,[{key:"needsResize",value:function needsResize(){var t=this.resizedDimensions();return t.x=0;r--){var o=i[r];if(o==="."){i.splice(r,1);}else if(o===".."){i.splice(r,1);e++;}else if(e){i.splice(r,1);e--;}}if(t){for(;e--;e){i.unshift("..");}}return i;}function PQ(i){return i.charAt(0)==="/";}function MQ(i){var t=PQ(i);var e=i.substr(-1)==="/";i=BQ(i.split("/").filter(Boolean),!t).join("/");if(!i&&!t){i=".";}if(i&&e){i+="/";}return(t?"/":"")+i;}var fp;var mA=d(function(){fp=function fp(){for(var _len2=arguments.length,i=new Array(_len2),_key2=0;_key2<_len2;_key2++){i[_key2]=arguments[_key2];}return MQ(i.join("/"));};});var hA=Gt(function(__t,pA){var LQ=typeof Element!=="undefined";var zQ=typeof Map==="function";var UQ=typeof Set==="function";var NQ=typeof ArrayBuffer==="function"&&!!ArrayBuffer.isView;function bb(i,t){if(i===t)return true;if(i&&t&&_typeof(i)=="object"&&_typeof(t)=="object"){if(i.constructor!==t.constructor)return false;var e,r,o;if(Array.isArray(i)){e=i.length;if(e!=t.length)return false;for(r=e;r--!==0;){if(!bb(i[r],t[r]))return false;}return true;}var n;if(zQ&&i instanceof Map&&t instanceof Map){if(i.size!==t.size)return false;n=i.entries();while(!(r=n.next()).done){if(!t.has(r.value[0]))return false;}n=i.entries();while(!(r=n.next()).done){if(!bb(r.value[1],t.get(r.value[0])))return false;}return true;}if(UQ&&i instanceof Set&&t instanceof Set){if(i.size!==t.size)return false;n=i.entries();while(!(r=n.next()).done){if(!t.has(r.value[0]))return false;}return true;}if(NQ&&ArrayBuffer.isView(i)&&ArrayBuffer.isView(t)){e=i.length;if(e!=t.length)return false;for(r=e;r--!==0;){if(i[r]!==t[r])return false;}return true;}if(i.constructor===RegExp)return i.source===t.source&&i.flags===t.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===t.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===t.toString();o=Object.keys(i);e=o.length;if(e!==Object.keys(t).length)return false;for(r=e;r--!==0;){if(!Object.prototype.hasOwnProperty.call(t,o[r]))return false;}if(LQ&&i instanceof Element)return false;for(r=e;r--!==0;){if((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&i.$$typeof){continue;}if(!bb(i[o[r]],t[o[r]]))return false;}return true;}return i!==i&&t!==t;}pA.exports=function i(t,e){try{return bb(t,e);}catch(r){if((r.message||"").match(/stack|recursion/i)){console.warn("react-fast-compare cannot handle circular refs");return false;}throw r;}};});var Ye,rS,Io;var fA=d(function(){Ye=y(hA());rS=function rS(i,t,_ref){var _ref2=_slicedToArray(_ref,2),e=_ref2[0],r=_ref2[1];var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var n=i[t];if(n){if(nr){console.error("".concat(t," must be less than or equal to ").concat(r));return r;}}return n||o;};Io=function Io(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[1,1,1,1];var r=i[t];var o=true;if(r){r.forEach(function(n){if(n<0){console.error("".concat(n," in ").concat(t," must be greater than or equal to 0"));o=false;}if(n>1){console.error("".concat(n," in ").concat(t," must be less than or equal to 1"));o=false;}});}if(!o)return e;return r||e;};});var kt,yb;var gA=d(function(){kt=function kt(i){return i*.08;};yb=function yb(i){return i*.03;};});var bA,yA;var _A=d(function(){bA=function bA(i,t){var e=i.indexOf(t);if(e===-1||!i.length)return void 0;if(e===i.length-1)return i[0];return i[e+1];};yA=function yA(i,t){var e=i.indexOf(t);if(e===-1||!i.length)return void 0;if(e===0)return i[i.length-1];return i[e-1];};});var gp,oS;var xA=d(function(){gp={};oS=function oS(_ref3){var i=_ref3.src,t=_ref3.crossOrigin,e=_ref3.key,r=_ref3.resolve,o=_ref3.reject;gp[e]=i;var n=new Image();n.onload=function(){if(gp[e]===i){r(n);delete gp[e];}};n.onerror=function(s){if(gp[e]===i){o(s);delete gp[e];}};n.crossOrigin=t;n.src=i;};});var Do;var vA=d(function(){Do=/*#__PURE__*/function(_Error){_inherits(Do,_Error);var _super3=_createSuper(Do);function Do(t){var _this7;_classCallCheck(this,Do);_this7=_super3.call(this,t);_this7.name="AssetNotFoundError";return _this7;}return Do;}(/*#__PURE__*/_wrapNativeSuper(Error));});var Eo;var CA=d(function(){Eo=function Eo(){return Math.max(window.devicePixelRatio||1,1);};});var bp=d(function(){XC();YC();tA();rA();ZC();oA();QC();nA();eS();lA();dA();JC();mA();fA();gA();_A();xA();vA();CA();});var wA=Gt(function(j_t,SA){"use strict";SA.exports=function(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var e=arguments.length>2?arguments[2]:undefined;e=_objectSpread({indent:" ",includeEmptyLines:false},e);if(typeof i!=="string"){throw new TypeError("Expected `input` to be a `string`, got `".concat(_typeof(i),"`"));}if(typeof t!=="number"){throw new TypeError("Expected `count` to be a `number`, got `".concat(_typeof(t),"`"));}if(typeof e.indent!=="string"){throw new TypeError("Expected `options.indent` to be a `string`, got `".concat(_typeof(e.indent),"`"));}if(t===0){return i;}var r=e.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return i.replace(r,e.indent.repeat(t));};});var TA=Gt(function(){});var EA=Gt(function(X_t,DA){"use strict";var kA=TA();var IA=/\s+at.*(?:\(|\s)(.*)\)?/;var HQ=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;var WQ=typeof kA.homedir==="undefined"?"":kA.homedir();DA.exports=function(i,t){t=Object.assign({pretty:false},t);return i.replace(/\\/g,"/").split("\n").filter(function(e){var r=e.match(IA);if(r===null||!r[1]){return true;}var o=r[1];if(o.includes(".app/Contents/Resources/electron.asar")||o.includes(".app/Contents/Resources/default_app.asar")){return false;}return!HQ.test(o);}).filter(function(e){return e.trim()!=="";}).map(function(e){if(t.pretty){return e.replace(IA,function(r,o){return r.replace(o,o.replace(WQ,"~"));});}return e;}).join("\n");};});var RA=Gt(function(q_t,OA){"use strict";var GQ=wA();var VQ=EA();var jQ=function jQ(i){return i.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");};var FA=/*#__PURE__*/function(_Error2,_Symbol$iterator){_inherits(FA,_Error2);var _super4=_createSuper(FA);function FA(t){var _this8;_classCallCheck(this,FA);if(!Array.isArray(t)){throw new TypeError("Expected input to be an Array, got ".concat(_typeof(t)));}t=_toConsumableArray(t).map(function(r){if(r instanceof Error){return r;}if(r!==null&&_typeof(r)==="object"){return Object.assign(new Error(r.message),r);}return new Error(r);});var e=t.map(function(r){return typeof r.stack==="string"?jQ(VQ(r.stack)):String(r);}).join("\n");e="\n"+GQ(e,4);_this8=_super4.call(this,e);_this8.name="AggregateError";Object.defineProperty(_assertThisInitialized(_this8),"_errors",{value:t});return _this8;}_createClass(FA,[{key:_Symbol$iterator,value:/*#__PURE__*/regeneratorRuntime.mark(function value(){var _iterator2,_step2,t;return regeneratorRuntime.wrap(function value$(_context){while(1){switch(_context.prev=_context.next){case 0:_iterator2=_createForOfIteratorHelper(this._errors);_context.prev=1;_iterator2.s();case 3:if((_step2=_iterator2.n()).done){_context.next=9;break;}t=_step2.value;_context.next=7;return t;case 7:_context.next=3;break;case 9:_context.next=14;break;case 11:_context.prev=11;_context.t0=_context["catch"](1);_iterator2.e(_context.t0);case 14:_context.prev=14;_iterator2.f();return _context.finish(14);case 17:case"end":return _context.stop();}}},value,this,[[1,11,14,17]]);})}]);return FA;}(/*#__PURE__*/_wrapNativeSuper(Error),Symbol.iterator);OA.exports=FA;});var Ju=Gt(function(Y_t,AA){"use strict";var $Q=RA();AA.exports=/*#__PURE__*/function(){var _ref4=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(i,t){var _ref5,_ref5$concurrency,e,_ref5$stopOnError,r,_args3=arguments;return regeneratorRuntime.wrap(function _callee2$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_ref5=_args3.length>2&&_args3[2]!==undefined?_args3[2]:{},_ref5$concurrency=_ref5.concurrency,e=_ref5$concurrency===void 0?Infinity:_ref5$concurrency,_ref5$stopOnError=_ref5.stopOnError,r=_ref5$stopOnError===void 0?true:_ref5$stopOnError;return _context3.abrupt("return",new Promise(function(o,n){if(typeof t!=="function"){throw new TypeError("Mapper function is required");}if(!((Number.isSafeInteger(e)||e===Infinity)&&e>=1)){throw new TypeError("Expected `concurrency` to be an integer from 1 and up or `Infinity`, got `".concat(e,"` (").concat(_typeof(e),")"));}var s=[];var a=[];var l=i[Symbol.iterator]();var c=false;var u=false;var m=0;var p=0;var h=function h(){if(c){return;}var g=l.next();var x=p;p++;if(g.done){u=true;if(m===0){if(!r&&a.length!==0){n(new $Q(a));}else{o(s);}}return;}m++;_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var v;return regeneratorRuntime.wrap(function _callee$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return g.value;case 3:v=_context2.sent;_context2.next=6;return t(v,x);case 6:s[x]=_context2.sent;m--;h();_context2.next=14;break;case 11:_context2.prev=11;_context2.t0=_context2["catch"](0);if(r){c=true;n(_context2.t0);}else{a.push(_context2.t0);m--;h();}case 14:case"end":return _context2.stop();}}},_callee,null,[[0,11]]);}))();};for(var g=0;g1&&_args7[1]!==undefined?_args7[1]:true;return _context7.abrupt("return",new Promise(function(r,o){if(_this12.isFontLoaded(t.identifier)){r();}if(e){_this12.injectFonts([t]);}var n=new Ca(t);n.load().then(function(){_this12.loadedFonts[t.identifier]=t;r();})["catch"](function(s){o(t.identifier);});}));case 2:case"end":return _context7.stop();}}},_callee6);}));function loadFont(_x6){return _loadFont.apply(this,arguments);}return loadFont;}()},{key:"loadFontWithIdentifier",value:function(){var _loadFontWithIdentifier=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee7(t){var e,r,_args8=arguments;return regeneratorRuntime.wrap(function _callee7$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:e=_args8.length>1&&_args8[1]!==undefined?_args8[1]:true;r=this.assetManager.getFontAsset(t);if(r){_context8.next=4;break;}throw new Error("The requested font asset with identifier ".concat(t," does not exist!"));case 4:return _context8.abrupt("return",this.loadFont(r,e));case 5:case"end":return _context8.stop();}}},_callee7,this);}));function loadFontWithIdentifier(_x7){return _loadFontWithIdentifier.apply(this,arguments);}return loadFontWithIdentifier;}()},{key:"injectFonts",value:function injectFonts(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.assetManager.getPathForCategory("font");var r=t.filter(NC);var o=t.filter(UC);if(r.length>0){this.addGoogleFontLinks(r);}if(o.length>0){this.addWebFontCSS(o,e);}}},{key:"addGoogleFontLinks",value:function addGoogleFontLinks(t){var _this13=this;var e=t.filter(function(s){return!_this13.injectedFonts[s.identifier];});if(e.length===0){return;}var r=this.getGoogleFamiliesString(e);var o=document.createElement("link");o.rel="stylesheet";o.href="https://fonts.googleapis.com/css?family=".concat(r);var n=document.getElementsByTagName("head")[0];n.appendChild(o);t.forEach(function(s){_this13.injectedFonts[s.identifier]=s;});}},{key:"addWebFontCSS",value:function addWebFontCSS(t,e){var _this14=this;var r=t.filter(function(a){return!_this14.injectedFonts[a.identifier];});if(r.length===0){return;}var o=_yp.createFontFacesCSS(r,e);var n="\n /* Injected by PhotoEditorSDK */\n ".concat(o.join("\n"),"\n ");var s=document.createElement("style");s.innerHTML=n;document.head.appendChild(s);t.forEach(function(a){_this14.injectedFonts[a.identifier]=a;});}}],[{key:"createFontFacesCSS",value:function createFontFacesCSS(t,e){return t.map(function(r){var o=e(r.fontURI);return"@font-face {\n font-family: \"".concat(r.fontFamily,"\";\n src: url('").concat(o,"') format('").concat(r.format||"woff","');\n font-weight: ").concat(r.fontWeight||"normal",";\n font-style: ").concat(r.fontStyle||"normal",";\n }");});}}]);return yp;}();});var _p;var PA=d(function(){R();UR();NR();HR();WR();jR();$R();KR();XR();YR();ZR();QR();gC();bC();bp();nS();_p=/*#__PURE__*/function(){function _p(t){var _this15=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,_p);this.assetResolver=r;this.basePath="assets/";this.areCustomAssetsAllowed=false;this.getAssets=function(t){switch(t){case"overlay":return _this15.overlayAssets;case"filter":return _this15.filterCategories;case"font":return _this15.fontAssets;case"focus":return _this15.focusAssets;case"adjustment":return _this15.adjustmentCategories;case"sticker":return _this15.stickerCategories;case"textdesign":return _this15.textDesignAssets;case"frame":return _this15.frameAssets;case"transform":return _this15.transformCategories;default:return[];}return[];};this.getPath=function(t,e){var _this15$assetResolver=_this15.assetResolver,r=_this15$assetResolver===void 0?{}:_this15$assetResolver;var o=e&&r.item?r.item(e,t):e;if(o==null?void 0:o.match(/data:image/g)){return o;}if((o==null?void 0:o.match(/(ftp|http|https):\/\//))&&cn(o)){return o;}if(!o&&cn(t)){return t;}var n=o?fp(t,o):fp(t);var s;if(_this15.basePath.match(/(ftp|http|https):\/\//)){var _a2=_this15.basePath.length;if(_this15.basePath[_a2-1]!=="/"){_this15.basePath="".concat(_this15.basePath,"/");}s=_this15.basePath+n;}else{s=fp(_this15.basePath,n);}return r.path?r.path(s,t,o):s;};this.getPathForCategory=function(t){return function(){for(var _len3=arguments.length,e=new Array(_len3),_key3=0;_key3<_len3;_key3++){e[_key3]=arguments[_key3];}return _this15.getPath.apply(_this15,[t].concat(e));};};this.addCustomStickerAsset=function(t,e,r){t.forEach(function(o){var n=o.thumbnailURI,s=o.name,a=o.stickerURI,l=o.identifier,c=o.tintMode,u=o.resizeMode;var m=_this15.stickerCategories.find(function(h){return h.identifier===e;});var p={identifier:l,name:s,thumbnailURI:n,stickerURI:a,tintMode:c,resizeMode:u};if(m){m.items.push(p);m.thumbnailURI=n;}else{var h={identifier:e,name:r,thumbnailURI:n,items:[p]};_this15.stickerCategories=[h].concat(_toConsumableArray(_this15.stickerCategories));}});_this15.stickerAssets=_this15.stickerCategories.reduce(_this15.allOptions,[]);};this.getItemPath=function(t,e,r){var o=t.find(function(n){return n.identifier===e;});return o?o[r]||o.path||"":"";};this.isNonExistingFont=function(t){return!mb.find(function(e){return e.identifier===t.identifier;})&&!us[t.identifier];};this.replaceDeprecatedFont=function(t){if(us[t.identifier]){return mb.find(function(e){return e.identifier===hn(t.identifier,true);});}return t;};var m,p;if(t==null?void 0:t.basePath)this.basePath=t.basePath;this.areCustomAssetsAllowed=e;var o=db.reduce(this.allOptions,[]);if(t&&t.filter){this.filterCategories=this.configuredCategory(db,t.filter,o);}else{this.filterCategories=db;}this.lutFilterAssets=this.filterCategories.reduce(this.allOptions,[]).filter(function(h){return wC(h);});this.duoToneFilterAssets=this.filterCategories.reduce(this.allOptions,[]).filter(function(h){return Yu(h);});var n=ub.reduce(this.allOptions,[]);if(t&&t.adjustment){this.adjustmentCategories=this.configuredCategory(ub,t.adjustment,n);}else{this.adjustmentCategories=ub;}this.fontAssets=mb.reduce(this.allOptions,[]);var s=GR.map(function(h){return _this15.getFontAsset(h);});if(((p=(m=t==null?void 0:t.text)==null?void 0:m.fonts)==null?void 0:p.length)>0){s=t.text.fonts.map(function(g){if(_this15.isNonExistingFont(g))return g;var x=_this15.replaceDeprecatedFont(g);return _this15.getFontAsset(x.identifier);});var h=t.text.fonts.filter(this.isNonExistingFont);this.fontAssets=t.text.fonts?[].concat(_toConsumableArray(this.fontAssets),_toConsumableArray(h)):this.fontAssets;}this.textToolFontAssets=s;var a=t&&t.focus&&t.focus.items&&t.focus.items.length?t.focus.items.map(function(h){return KC.find(function(g){return g.identifier===h.identifier;});}):KC;this.focusAssets=a;if(t&&t.overlay&&t.overlay.items){this.overlayAssets=this.configuredItem(t.overlay.items,hb,hb);}else{this.overlayAssets=hb;}if(t&&t.frame&&t.frame.items){this.frameAssets=this.configuredItem(t.frame.items,pb,pb);}else{this.frameAssets=pb;}var l=fb.reduce(this.allOptions,[]);if(t&&t.sticker){this.stickerCategories=this.configuredCategory(fb,t.sticker,l);}else{this.stickerCategories=fb;}this.stickerAssets=this.stickerCategories.reduce(this.allOptions,[]);var c=qR;if(t&&t.theme==="light"){c=JR;}this.textDesignAssets=t&&t.textdesign&&t.textdesign.items&&t.textdesign.items.length?t.textdesign.items.map(function(h){return c.find(function(g){return g.identifier===h.identifier;});}):c;this.textDesignToolFontAssets=VR.map(function(h){return _this15.getFontAsset(h);});var u=gb.reduce(this.allOptions,[]);if(t&&t.transform){this.transformCategories=this.configuredCategory(gb,t.transform,u,"transform");}else{this.transformCategories=gb;}this.transformAssets=this.transformCategories.reduce(this.allOptions,[]);this.fontManager=new _yp(this);}_createClass(_p,[{key:"getFontManager",value:function getFontManager(){return this.fontManager;}},{key:"getAssetSource",value:function getAssetSource(t,e){switch(t){case"filter":var r=this.getLUTFilterAsset(e);if(r){return this.getPath(t,this.getItemPath(this.lutFilterAssets,e,"lutURI"));}break;case"overlay":return this.getPath(t,this.getItemPath(this.overlayAssets,e,"overlayURI"));case"font":return this.getPath(t,this.getItemPath(this.fontAssets,e,"fontURI"));case"sticker":var o=this.stickerAssets.find(function(n){return n.identifier===e;});if(o){if(o.stickerURI.substr(0,10)==="data:image"){return o.stickerURI;}if(e.includes("imgly_sticker")&&o.stickerURI.includes(".svg")&&ve()){var n=this.getPath(t,this.getItemPath(this.stickerAssets,e,"stickerURI"));var s=n.split("/");s.splice(s.length-1,0,"base");s[s.length-1]=s[s.length-1].replace(".svg",".png");return s.join("/");}return this.getPath(t,this.getItemPath(this.stickerAssets,e,"stickerURI"));}throw new Error("Cannot resolve this type of sticker asset yet");case"textdesign":return this.getPath(fp(t,"engine"),e);case"frame":return this.getPath(t,e);default:break;}throw new Error("Cannot resolve this type of asset yet");}},{key:"getDuotoneFilterAsset",value:function getDuotoneFilterAsset(t){return this.duoToneFilterAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getLUTFilterAsset",value:function getLUTFilterAsset(t){return this.lutFilterAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getOverlayAsset",value:function getOverlayAsset(t){return this.overlayAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getStickerAsset",value:function getStickerAsset(t){return this.stickerAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getFontAsset",value:function getFontAsset(t){var e=this.fontAssets.filter(function(r){return r.identifier===t;})[0];if(e){return e;}console.warn("The font asset for ".concat(t," was not found."));return void 0;}},{key:"getTextDesignAssets",value:function getTextDesignAssets(t){return this.textDesignAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getFrameAsset",value:function getFrameAsset(t){return this.frameAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getFontAssets",value:function getFontAssets(){return this.fontAssets;}},{key:"getFontAssetsForText",value:function getFontAssetsForText(){return this.textToolFontAssets;}},{key:"getFontAssetsForTextDesign",value:function getFontAssetsForTextDesign(){return this.textDesignToolFontAssets;}},{key:"getFrameAssets",value:function getFrameAssets(){return this.frameAssets;}},{key:"allOptions",value:function allOptions(t,e){if(Object.prototype.hasOwnProperty.call(e,"items")){return[].concat(_toConsumableArray(t),_toConsumableArray(e.items));}return[].concat(_toConsumableArray(t),[e]);}},{key:"configuredCategory",value:function configuredCategory(t,e,r,o){var _this16=this;if(e.categories&&e.categories.length){return e.categories.reduce(function(n,s){var a=t.find(function(l){return l.identifier===s.identifier;});if(a){n.push(_objectSpread(_objectSpread(_objectSpread({},a),s),{},{items:_this16.configuredItem(s.items,r,a.items,o).filter(Boolean)}));}else if(_this16.areCustomAssetsAllowed||o==="transform"){n.push(_objectSpread(_objectSpread({},s),{},{items:_this16.configuredItem(s.items,r,s.items,o).filter(Boolean)}));}return n;},[]);}return t;}},{key:"configuredItem",value:function configuredItem(t,e,r,o){var _this17=this;if(t&&t.length){return t.reduce(function(n,s){var a=e.find(function(l){return l.identifier===s.identifier;});if(a){n.push(_objectSpread(_objectSpread({},a),s));}else if(_this17.areCustomAssetsAllowed||o==="transform"){n.push(s);}return n;},[]).filter(Boolean);}return r;}}]);return _p;}();});var sS,je;var MA=d(function(){sS=/*#__PURE__*/function(){function sS(t,e,r,o){_classCallCheck(this,sS);if(typeof t==="number"){if(typeof e==="number"&&r!==void 0&&o!==void 0){this.origin={x:t,y:e};this.size={width:r||0,height:o||0};}else{throw new Error("Invalid arguments passed to Rect. Expected (number, number, number, number)");}}else{this.origin=t;if(typeof e==="number"){throw new Error("Invalid arguments passed to Rect. Expected (Float2, Size)");}this.size=e;}}_createClass(sS,[{key:"minX",get:function get(){return this.origin.x;}},{key:"minY",get:function get(){return this.origin.y;}},{key:"midX",get:function get(){return this.origin.x+.5*this.size.width;}},{key:"midY",get:function get(){return this.origin.y+.5*this.size.height;}},{key:"maxX",get:function get(){return this.origin.x+this.size.width;}},{key:"maxY",get:function get(){return this.origin.y+this.size.height;}},{key:"width",get:function get(){return this.size.width;}},{key:"height",get:function get(){return this.size.height;}}],[{key:"contains",value:function contains(t,e){return e.x>=t.minX&&e.x<=t.maxX&&e.y>=t.minY&&e.y<=t.maxY;}}]);return sS;}();je=sS;je.ZERO=new sS({x:0,y:0},{width:0,height:0});});var _ds,wt;var LA=d(function(){_ds=/*#__PURE__*/function(){function ds(t,e,r,o,n,s){_classCallCheck(this,ds);this.a=t;this.b=e;this.c=r;this.d=o;this.tx=n;this.ty=s;}_createClass(ds,null,[{key:"fromScale",value:function fromScale(t,e){return new _ds(t,0,0,e,0,0);}},{key:"fromRotation",value:function fromRotation(t){var e=Math.cos(t);var r=Math.sin(t);return new _ds(e,-r,r,e,0,0);}},{key:"fromRotationDeg",value:function fromRotationDeg(t){var e=Math.PI*t/180;return this.fromRotation(e);}},{key:"fromTranslation",value:function fromTranslation(t,e){return new _ds(1,0,0,1,t,e);}},{key:"fromTRS",value:function fromTRS(t,e,r,o,n){var s=Math.cos(r);var a=Math.sin(r);return new _ds(o*s,-n*a,o*a,n*s,t,e);}},{key:"multiply",value:function multiply(t,e){var r=t.a*e.a+t.b*e.c;var o=t.a*e.b+t.b*e.d;var n=t.c*e.a+t.d*e.c;var s=t.c*e.b+t.d*e.d;var a=t.a*e.tx+t.b*e.ty+t.tx;var l=t.c*e.tx+t.d*e.ty+t.ty;return new _ds(r,o,n,s,a,l);}},{key:"transformPoint",value:function transformPoint(t,e){return{x:t.a*e.x+t.b*e.y+t.tx,y:t.c*e.x+t.d*e.y+t.ty};}},{key:"getInverted",value:function getInverted(t){var e=t.a*t.d-t.b*t.c;if(e===0){return t;}var r=1/e;var o=r*t.d;var n=-r*t.b;var s=-r*t.c;var a=r*t.a;var l=r*(t.b*t.ty-t.d*t.tx);var c=r*(t.c*t.tx-t.a*t.ty);return new _ds(o,n,s,a,l,c);}}]);return ds;}();wt=_ds;wt.IDENTITY=_ds.fromScale(1,1);});function Yr(i){return typeof i==="number";}var aS,lS;var cS=d(function(){aS=function aS(i){return i<0;};lS=function lS(i){return aS(i)?-i:i;};});var Gl,xb,_b,zA,xp,uS,dS,mS,UA;var NA=d(function(){var _b2;cS();bp();Gl=function Gl(i){return i*(Math.PI/180);};xb=function xb(i){return i*(180/Math.PI);};_b=(_b2={},_defineProperty(_b2,0,Gl(0)),_defineProperty(_b2,90,Gl(90)),_defineProperty(_b2,180,Gl(180)),_defineProperty(_b2,270,Gl(270)),_b2);zA=Object.values(_b);xp=function xp(i){var t=Math.round(xb(lS(i)));if(aS(i)){if(t===270){t=90;}else if(t===90){t=270;}}return _b[t%360];};uS=function uS(i){return i===0?i:360-lS(i);};dS=function dS(i){return bA(zA,xp(i));};mS=function mS(i){return yA(zA,xp(i));};UA=function UA(i){var t=xp(i);return t===_b[270]||t===_b[90];};});var HA=d(function(){tS();MA();LA();cS();NA();});var _re;var WA=d(function(){_re=/*#__PURE__*/function(){function re(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{x:1,y:1};var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,re);this.position=t;this.scale=e;this.rotation=r;}_createClass(re,null,[{key:"IDENTITY",get:function get(){return new _re({x:0,y:0});}}]);return re;}();});var U=d(function(){zF();gC();VF();bC();yC();PA();nS();HA();WA();bp();To();});var Sa,GA,VA,XQ,pS;var jA=d(function(){Sa=y(_("react"));$g();GA=y(Ku());VA=y(_("styled-components"));Sr();U();XQ=VA["default"].div(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n background: ",";\n color: ",";\n display: flex;\n flex-direction: row;\n overflow: hidden;\n -webkit-touch-callout: none;\n user-select: none;\n * {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n font-family: '","', sans-serif;\n /* css reset for a global box-sizing: border-box */\n box-sizing: content-box;\n\n scrollbar-width: thin;\n scrollbar-color: "," transparent;\n\n &::-webkit-scrollbar-track {\n border-radius: 10px;\n background-color: transparent;\n margin: 1px;\n }\n\n &::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: 10px;\n box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.4);\n background-color: ",";\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background-color: ",";\n }\n }\n\n /* This will be applied first in some cases and should be treated as such */\n h1,\n h2,\n h3,\n input,\n textarea,\n label,\n span,\n div,\n p {\n line-height: normal;\n }\n"])),function(i){return i.theme.background;},function(i){return i.theme.foreground;},function(i){return i.theme.typography.fontFamily;},function(i){return i.theme.scrollbar.handleColor;},function(i){return i.theme.scrollbar.handleColor;},function(i){return i.theme.scrollbar.handleColor;});pS=/*#__PURE__*/function(_Sa$default$Component){_inherits(pS,_Sa$default$Component);var _super5=_createSuper(pS);function pS(t){var _this18;_classCallCheck(this,pS);_this18=_super5.call(this,t);_this18.node=Sa["default"].createRef();_this18.mounted=false;_this18.saveEditorDimensions=function(t){if(_this18.mounted){_this18.setState({contextValue:{element:t,rect:t.getBoundingClientRect()}});}};var e;if((e=Sa["default"])==null?void 0:e.version){var r=Number.parseInt(Sa["default"].version.split(".")[0],10);var o=Number.parseInt(Sa["default"].version.split(".")[1],10);if(r<16||r===16&&o<8)console.error("Please be aware that the PhotoEditorSDK will require React 16.8.6 or above.");}_this18.saveEditorDimensions=(0,GA["default"])(_this18.saveEditorDimensions,100);_this18.resizeObserver=new Hl(function(_ref7){var _ref8=_slicedToArray(_ref7,1),r=_ref8[0];_this18.saveEditorDimensions(r.target);});_this18.state={contextValue:{element:null,rect:null}};return _this18;}_createClass(pS,[{key:"componentDidMount",value:function componentDidMount(){var t;this.mounted=true;if((t=this.node)==null?void 0:t.current){this.resizeObserver.observe(this.node.current);}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.mounted=false;this.resizeObserver.disconnect();}},{key:"render",value:function render(){var t=this.props.children;var e=this.state.contextValue;return Sa["default"].createElement(XQ,{ref:this.node,"data-test":N.EditorContainer},Sa["default"].createElement(Oe.Provider,{value:e},t));}}]);return pS;}(Sa["default"].Component);});var vb,vp,qQ,Cb;var Cp=d(function(){vb=y(_("styled-components"));vp=vb.css(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n height: ","px;\n width: ","px;\n border-radius: ",";\n pointer-events: none;\n"])),function(i){return i.theme.measurements.colorItem.size;},function(i){return i.theme.measurements.colorItem.size;},function(i){return i.theme.colorItem.borderRadius||"".concat(i.theme.shape.radiusSmall,"px");});qQ=vb["default"].div.attrs(function(i){return{style:{background:i.color}};})(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n ","\n z-index: ",";\n"])),vp,function(i){return i.theme.measurements.zIndex.colorItem.background;});Cb=qQ;});var Vl,Sp,YQ,hS,JQ,Sb;var fS=d(function(){Vl=y(_("react"));Sp=y(_("styled-components"));Cp();YQ=Sp["default"].div(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n ","\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: ",";\n\n box-sizing: border-box;\n border: 2px solid transparent;\n border-radius: ",";\n transition: border-color 300ms ease-in-out;\n ","\n"])),vp,function(i){return i.theme.measurements.zIndex.colorItem.overlay;},function(i){return i.theme.colorItem.borderRadius||"".concat(i.theme.shape.radiusSmall,"px");},function(i){return i.isActive&&Sp.css(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n border-color: ",";\n "])),i.theme.selectColor.activeBorderColor);});hS=Sp["default"].span(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n display: inline-block;\n height: 2px;\n width: 2px;\n border-radius: 50%;\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.6);\n background: rgba(255, 255, 255, 0.87);\n margin: 1px;\n pointer-events: none;\n"])));JQ=function JQ(_ref9){var i=_ref9.isActive,t=_ref9.className,e=_ref9.style;return Vl["default"].createElement(YQ,{isActive:i,className:t,style:e},i&&Vl["default"].createElement(Vl["default"].Fragment,null,Vl["default"].createElement(hS,null),Vl["default"].createElement(hS,null),Vl["default"].createElement(hS,null)));};Sb=JQ;});var $A,di;var KA=d(function(){$A=_("styled-components");di=$A.css(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n &:focus {\n outline: none;\n box-shadow: 0 0 2px ",";\n }\n &:-moz-focusring {\n outline: none;\n box-shadow: 0 0 2px ",";\n }\n"])),function(i){return i.theme.focusOutlineColor;},function(i){return i.theme.focusOutlineColor;});});var XA,Zu;var qA=d(function(){XA=_("styled-components");Zu=XA.css(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n position: absolute !important;\n height: 1px;\n width: 1px;\n overflow: hidden;\n clip: rect(1px 1px 1px 1px); /* IE6, IE7 */\n clip: rect(1px, 1px, 1px, 1px);\n"])));});var Jr=d(function(){KA();qA();});var YA,ZQ,wb;var gS=d(function(){YA=y(_("styled-components"));Jr();ZQ=YA["default"].button.attrs({type:"button"})(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n &&& {\n box-sizing: border-box;\n }\n position: relative;\n background: transparent;\n border: none;\n height: ","px;\n width: ","px;\n margin: ",";\n padding: 0;\n cursor: pointer;\n border-radius: ",";\n\n &:hover {\n opacity: 0.7;\n }\n\n ","\n\n &:disabled {\n opacity: ",";\n cursor: default;\n }\n"])),function(i){return i.theme.measurements.colorItem.size;},function(i){return i.theme.measurements.colorItem.size;},function(i){return i.theme.colorItem.margin;},function(i){return i.theme.colorItem.borderRadius||"".concat(i.theme.shape.radiusSmall,"px");},di,function(i){return i.theme.selectColor.inactiveOpacity;});wb=ZQ;});var JA,QQ,Tb;var bS=d(function(){JA=y(_("styled-components"));Cp();QQ=JA["default"].div.attrs(function(i){var t=i.url?{backgroundImage:"url(".concat(i.url,")")}:{};return _objectSpread({style:t},i.style);})(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n ","\n z-index: ",";\n"])),vp,function(i){return i.theme.measurements.zIndex.colorItem.tiledBackground;});Tb=QQ;});var wp,ttt,ZA;var QA=d(function(){wp=y(_("react"));B();fS();Cp();gS();bS();ttt=function ttt(_ref10){var i=_ref10.isActive,t=_ref10.onClick,e=_ref10.color,r=_ref10.label,o=_ref10.isDisabled,n=_ref10.tiledBackgroundUrl,s=_ref10.className,a=_ref10.style,l=_ref10.children;return wp["default"].createElement(wb,{disabled:o,onClick:t,"aria-label":r,className:s,style:a},wp["default"].createElement(Tb,{url:n}),wp["default"].createElement(Cb,{color:e}),wp["default"].createElement(Sb,{isActive:i}),l);};ZA=rt("config")(w(ttt));});var tB,ett,kb;var yS=d(function(){tB=y(_("styled-components"));ett=tB["default"].div(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n display: block;\n opacity: 1;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: ",";\n text-align: left;\n background: ",";\n height: 100%;\n width: 100%;\n"])),function(i){return i.theme.measurements.zIndex.dialog.backdrop;},function(i){return i.theme.modal.backdrop;});kb=ett;});var eB,Ib,itt,Db;var _S=d(function(){eB=y(_("react"));Ib=y(_("styled-components"));itt=Ib["default"].div(_templateObject15||(_templateObject15=_taggedTemplateLiteral(["\n display: none;\n visibility: hidden;\n opacity: 0;\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: ",";\n transition: opacity 100s ease-in-out;\n\n ",";\n"])),function(i){return i.theme.measurements.zIndex.dialog.base;},function(i){return i.isVisible&&Ib.css(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n opacity: 1;\n display: block;\n visibility: visible;\n "])));});Db=function Db(_ref11){var i=_ref11.isVisible,t=_ref11.className,e=_ref11.children;return eB["default"].createElement(itt,{isVisible:i,className:t},e);};});var iB,rtt,Eb;var xS=d(function(){iB=y(_("styled-components"));rtt=iB["default"].div.attrs(function(_ref12){var i=_ref12.style;return{role:"dialog","aria-hidden":false,style:i};})(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n flex-direction: column;\n transition: top 0.25s ease;\n position: absolute;\n top: calc(50% + ","px);\n left: calc(50% + ","px);\n width: ",";\n height: ",";\n transform: translate(-50%, -50%);\n border-radius: ","px;\n background: ",";\n color: ",";\n z-index: ",";\n\n @media all and (min-width: 0) and (max-width: 640px) {\n text-align: center;\n width: auto;\n min-width: 200px;\n height: auto;\n top: 50%;\n left: 50%;\n }\n"])),function(i){return i.top;},function(i){return i.left;},function(i){return i.width;},function(i){return i.height;},function(i){return i.theme.shape.radiusLarge;},function(i){return i.theme.modal.background;},function(i){return i.theme.modal.bodyForeground;},function(i){return i.theme.measurements.zIndex.dialog.container;});Eb=rtt;});var Fb,ott,rB;var oB=d(function(){Fb=y(_("react"));U();yS();_S();xS();ott=function ott(_ref13){var _ref13$isVisible=_ref13.isVisible,i=_ref13$isVisible===void 0?false:_ref13$isVisible,_ref13$width=_ref13.width,t=_ref13$width===void 0?"350px":_ref13$width,_ref13$height=_ref13.height,e=_ref13$height===void 0?"fit-content":_ref13$height,r=_ref13.position,o=_ref13.header,n=_ref13.body,s=_ref13.footer,a=_ref13.className,l=_ref13.style,c=_ref13.children;return Fb["default"].createElement(Db,{isVisible:i},Fb["default"].createElement(kb,null),Fb["default"].createElement(Eb,{height:e,width:t,left:r.x,top:r.y,className:a,style:l,"data-test":N.Dialog},o,n,c,s));};rB=ott;});var nB,ntt,ms;var Tp=d(function(){nB=y(_("styled-components"));ntt=nB["default"].div(_templateObject18||(_templateObject18=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n overflow: hidden;\n box-sizing: border-box;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n\n padding: 0px 20px 11px;\n &:first-child {\n padding-top: 11px;\n }\n\n @media all and (min-width: 0) and (max-width: 640px) {\n align-items: center;\n }\n"])),function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.modal.bodyForeground;});ms=ntt;});var sB,stt,Qu;var Ob=d(function(){sB=y(_("styled-components"));stt=sB["default"].div(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n display: flex;\n border-top: 2px solid\n ",";\n\n min-height: 40px;\n justify-content: flex-end;\n @media all and (min-width: 0) and (max-width: 640px) {\n height: auto;\n flex-direction: column;\n justify-content: space-around;\n }\n"])),function(i){return i.type==="error"?i.theme.error:i.theme.warning;});Qu=stt;});var aB,att,td;var Rb=d(function(){aB=y(_("styled-components"));att=aB["default"].h3(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n\n padding: 11px 20px 0px;\n"])),function(i){return i.theme.measurements.fontSystem.headline2.size;},function(i){return i.theme.measurements.fontSystem.headline2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.headline2["case"];},function(i){return i.theme.modal.headerForeground;});td=att;});var ed,kp,ltt,ctt,Ab,utt,Bb;var vS=d(function(){ed=y(_("react"));kp=y(_("styled-components"));ltt=kp.keyframes(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));ctt=kp["default"].div(_templateObject22||(_templateObject22=_taggedTemplateLiteral(["\n display: inline-block;\n position: relative;\n width: 45px;\n height: 45px;\n"])));Ab=kp["default"].div(_templateObject23||(_templateObject23=_taggedTemplateLiteral(["\n box-sizing: border-box;\n display: block;\n position: absolute;\n width: 40px;\n height: 40px;\n margin: 2.5px;\n border: 2.5px solid ",";\n border-radius: 50%;\n animation: "," 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n border-color: "," transparent transparent\n transparent;\n\n :nth-child(1) {\n animation-delay: -0.45s;\n }\n :nth-child(2) {\n animation-delay: -0.3s;\n }\n :nth-child(3) {\n animation-delay: -0.15s;\n }\n"])),function(i){return i.theme.primary;},ltt,function(i){return i.theme.primary;});utt=function utt(_ref14){var i=_ref14.className,t=_ref14.style;return ed["default"].createElement(ctt,{className:i,style:t},ed["default"].createElement(Ab,null),ed["default"].createElement(Ab,null),ed["default"].createElement(Ab,null),ed["default"].createElement(Ab,null));};Bb=utt;});function dtt(i){var t="";var e=true;var r;for(r=0;r0&&arguments[0]!==undefined?arguments[0]:"transform";if(typeof window==="undefined"||typeof window.document==="undefined"){return"";}var t=window.document.documentElement.style;if(i in t){return"";}var e;for(e=0;e not mounted on DragStart!");}var r=e.ownerDocument;if(_this19.props.disabled||!(t.target instanceof Node)||_this19.props.handle&&!kS(t.target,_this19.props.handle,e)||_this19.props.cancel&&kS(t.target,_this19.props.cancel,e)){return false;}var o=Hb(t,_assertThisInitialized(_this19));if(o==null){return false;}var n=o.x,s=o.y;var a=Ub(_assertThisInitialized(_this19),n,s);var l=_this19.props.onStart(t,a);if(l===false){return false;}_this19.setState({dragging:true,lastX:n,lastY:s});if(kr.move==="touchmove"){Lb(r,kr.move,_this19.onTouchDrag);}else{Lb(r,kr.move,_this19.onMouseDrag);}Lb(r,kr.stop,_this19.handleDragStop);};_this19.handleDrag=function(t){var e=Hb(t,_assertThisInitialized(_this19));if(e==null){return;}var r=e.x,o=e.y;var n=Ub(_assertThisInitialized(_this19),r,o);var s=_this19.props.onDrag(t,n);if(s===false){try{_this19.handleDragStop(new MouseEvent("mouseup"));}catch(a){var l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",true,true,window,0,0,0,0,0,false,false,false,false,0,null);_this19.handleDragStop(l);}return;}_this19.setState({lastX:r,lastY:o});};_this19.handleDragStop=function(t){if(!_this19.state.dragging){return;}var e=Hb(t,_assertThisInitialized(_this19));if(e==null){return;}var r=e.x,o=e.y;var n=Ub(_assertThisInitialized(_this19),r,o);var s=_this19.findDOMNode();_this19.setState({dragging:false,lastX:NaN,lastY:NaN});_this19.props.onStop(t,n);if(s){if(kr.move==="touchmove"){wa(s.ownerDocument,kr.move,_this19.onTouchDrag);}else{wa(s.ownerDocument,kr.move,_this19.onMouseDrag);}wa(s.ownerDocument,kr.stop,_this19.handleDragStop);}};_this19.onMouseDown=function(t){_this19.preventDefault(t);kr=fn.mouse;_this19.props.onMouseDown(t);if(t.button&&typeof t.button==="number"&&t.button!==0){return false;}return _this19.handleDragStart(t);};_this19.onMouseDrag=function(t){_this19.preventDefault(t);return _this19.handleDrag(t);};_this19.onMouseUp=function(t){_this19.preventDefault(t);kr=fn.mouse;return _this19.handleDragStop(t);};_this19.onTouchStart=function(t){_this19.preventDefault(t);kr=fn.touch;var e=_this19.getTouchFromEvent(t);return _this19.handleDragStart(e);};_this19.onTouchDrag=function(t){_this19.preventDefault(t);kr=fn.touch;var e=_this19.getTouchFromEvent(t);return _this19.handleDrag(e);};_this19.onTouchEnd=function(t){_this19.preventDefault(t);kr=fn.touch;var e=_this19.getTouchFromEvent(t);return _this19.handleDragStop(e);};return _this19;}_createClass(jl,[{key:"componentWillUnmount",value:function componentWillUnmount(){var t=this.findDOMNode();if(t){var e=t.ownerDocument;wa(e,fn.mouse.move,this.onMouseDrag);wa(e,fn.touch.move,this.onTouchDrag);wa(e,fn.mouse.stop,this.handleDragStop);wa(e,fn.touch.stop,this.handleDragStop);}}},{key:"render",value:function render(){return Wb["default"].cloneElement(Wb["default"].Children.only(this.props.children),{style:_objectSpread({touchAction:"none"},this.props.children.props.style),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd});}}]);return jl;}(Wb["default"].Component);jl.defaultProps=ES;jl.displayName="DraggableCore";});var Ip,ftt,Gb,vB;var CB=d(function(){Ip=y(_("react"));FS();zb();DS();ftt=_objectSpread(_objectSpread({},ES),{},{axis:"both",bounds:false,defaultClassName:"draggable",defaultClassNameDragging:"draggable-dragging",defaultClassNameDragged:"draggable-dragged",defaultPosition:{x:0,y:0},position:null,rotation:0,updateOnPosition:false});Gb=/*#__PURE__*/function(_Ip$default$Component){_inherits(Gb,_Ip$default$Component);var _super7=_createSuper(Gb);function Gb(t){var _this20;_classCallCheck(this,Gb);_this20=_super7.call(this,t);_this20.onDragStart=function(t,e){var r=_this20.props.onStart(t,Nb(_assertThisInitialized(_this20),e));if(r===false){return false;}_this20.setState({dragging:true,dragged:true});};_this20.onDrag=function(t,e){var _this20$props=_this20.props,r=_this20$props.position,o=_this20$props.defaultPosition,n=_this20$props.onDrag,s=_this20$props.bounds;if(!_this20.state.dragging){return false;}var a=Nb(_assertThisInitialized(_this20),e);var l=Boolean(r);var c={x:l?a.x:o.x,y:l?a.y:o.y,slackX:0,slackY:0};if(s){var m=c.x,p=c.y;c.x+=_this20.state.slackX;c.y+=_this20.state.slackY;var _yB=yB(_assertThisInitialized(_this20),c.x,c.y),_yB2=_slicedToArray(_yB,2),h=_yB2[0],g=_yB2[1];c.x=h;c.y=g;c.slackX=_this20.state.slackX+(m-c.x);c.slackY=_this20.state.slackY+(p-c.y);a.x=c.x;a.y=c.y;a.deltaX=c.x-_this20.state.x;a.deltaY=c.y-_this20.state.y;}var u=n(t,a);if(u===false){return false;}_this20.setState(c);};_this20.onDragStop=function(t,e){if(!_this20.state.dragging){return false;}var r=_this20.props.onStop(t,Nb(_assertThisInitialized(_this20),e));if(r===false){return false;}var o={dragging:false,slackX:0,slackY:0,x:0,y:0};var n=Boolean(_this20.props.position);if(n){var _this20$props$positio=_this20.props.position,s=_this20$props$positio.x,a=_this20$props$positio.y;o.x=s;o.y=a;}_this20.setState(o);};_this20.findDOMNode=function(){var t=_this20.props.nodeRef;return(t==null?void 0:t.current)||null;};_this20.state={dragging:false,dragged:false,x:t.position?t.position.x:t.defaultPosition.x,y:t.position?t.position.y:t.defaultPosition.y,slackX:0,slackY:0};return _this20;}_createClass(Gb,[{key:"componentDidUpdate",value:function componentDidUpdate(t){var e=Boolean(this.props.position);if(e){if(this.props.updateOnPosition){if(t.position&&t.position.x!==this.props.position.x||t.position.y!==this.props.position.y){this.setState({x:this.props.position.x,y:this.props.position.y});}}else{if(t.position&&this.props.position.x!==this.state.x||this.props.position.y!==this.state.y){this.setState({x:this.props.position.x,y:this.props.position.y});}}}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.setState({dragging:false});}},{key:"render",value:function render(){var _this$props=this.props,t=_this$props.position,e=_this$props.defaultPosition,r=_this$props.rotation,o=_this$props.defaultClassName,n=_this$props.defaultClassNameDragging,s=_this$props.defaultClassNameDragged,a=_objectWithoutProperties(_this$props,_excluded);var _this$state=this.state,l=_this$state.x,c=_this$state.y,u=_this$state.dragging,m=_this$state.dragged;var p={};var h=Boolean(t);var g=!h||u;var x=t||e;var v={x:_B(this)&&g?l:x.x,y:xB(this)&&g?c:x.y,rotation:r};p=fB(v);var b=Ip["default"].Children.only(this.props.children);var T=[b.props.className||"",o,u?n:"",m?s:""].join(" ").trim();var k=Ip["default"].cloneElement(b,{className:T,style:_objectSpread(_objectSpread({},b.props.style),p)});return Ip["default"].createElement(jl,_objectSpread(_objectSpread({},a),{},{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),k);}}]);return Gb;}(Ip["default"].Component);Gb.defaultProps=ftt;Gb.displayName="Draggable";vB=Gb;});var rd=Gt(function(Lvt,kB){var TB="Expected a function";var SB=0/0;var gtt="[object Symbol]";var btt=/^\s+|\s+$/g;var ytt=/^[-+]0x[0-9a-f]+$/i;var _tt=/^0b[01]+$/i;var xtt=/^0o[0-7]+$/i;var vtt=parseInt;var Ctt=(typeof global==="undefined"?"undefined":_typeof(global))=="object"&&global&&global.Object===Object&&global;var Stt=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self;var wtt=Ctt||Stt||Function("return this")();var Ttt=Object.prototype;var ktt=Ttt.toString;var Itt=Math.max;var Dtt=Math.min;var OS=function OS(){return wtt.Date.now();};function Ett(i,t,e){var r,o,n,s,a,l,c=0,u=false,m=false,p=true;if(typeof i!="function"){throw new TypeError(TB);}t=wB(t)||0;if(Vb(e)){u=!!e.leading;m="maxWait"in e;n=m?Itt(wB(e.maxWait)||0,t):n;p="trailing"in e?!!e.trailing:p;}function h(I){var F=r,Z=o;r=o=void 0;c=I;s=i.apply(Z,F);return s;}function g(I){c=I;a=setTimeout(b,t);return u?h(I):s;}function x(I){var F=I-l,Z=I-c,et=t-F;return m?Dtt(et,n-Z):et;}function v(I){var F=I-l,Z=I-c;return l===void 0||F>=t||F<0||m&&Z>=n;}function b(){var I=OS();if(v(I)){return T(I);}a=setTimeout(b,x(I));}function T(I){a=void 0;if(p&&r){return h(I);}r=o=void 0;return s;}function k(){if(a!==void 0){clearTimeout(a);}c=0;r=l=o=a=void 0;}function E(){return a===void 0?s:T(OS());}function A(){var I=OS(),F=v(I);r=arguments;o=this;l=I;if(F){if(a===void 0){return g(l);}if(m){a=setTimeout(b,t);return h(l);}}if(a===void 0){a=setTimeout(b,t);}return s;}A.cancel=k;A.flush=E;return A;}function Ftt(i,t,e){var r=true,o=true;if(typeof i!="function"){throw new TypeError(TB);}if(Vb(e)){r="leading"in e?!!e.leading:r;o="trailing"in e?!!e.trailing:o;}return Ett(i,t,{"leading":r,"maxWait":t,"trailing":o});}function Vb(i){var t=_typeof(i);return!!i&&(t=="object"||t=="function");}function Ott(i){return!!i&&_typeof(i)=="object";}function Rtt(i){return _typeof(i)=="symbol"||Ott(i)&&ktt.call(i)==gtt;}function wB(i){if(typeof i=="number"){return i;}if(Rtt(i)){return SB;}if(Vb(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=Vb(t)?t+"":t;}if(typeof i!="string"){return i===0?i:+i;}i=i.replace(btt,"");var e=_tt.test(i);return e||xtt.test(i)?vtt(i.slice(2),e?2:8):ytt.test(i)?SB:+i;}kB.exports=Ftt;});var od,jb,RS,zi,nd,$b,Kb;var $l=d(function(){od=y(_("styled-components"));tC();jb=od["default"].span(_templateObject24||(_templateObject24=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));RS=(0,od["default"])(jb)(_templateObject25||(_templateObject25=_taggedTemplateLiteral([""])));zi=(0,od["default"])(jb)(_templateObject26||(_templateObject26=_taggedTemplateLiteral([""])));nd=(0,od["default"])(jb)(_templateObject27||(_templateObject27=_taggedTemplateLiteral([""])));$b={display:"none",left:0,top:0};Kb=(0,od["default"])(jb)(_templateObject28||(_templateObject28=_taggedTemplateLiteral(["\n display: ",";\n left: ","px;\n top: ","px;\n pointer-events: none;\n border-radius: 50%;\n background-color: rgba(255, 255, 255, 0.12);\n animation: "," 1.2s;\n width: 100px;\n height: 100px;\n margin-top: -50px;\n margin-left: -50px;\n opacity: 0;\n"])),function(_ref17){var i=_ref17.display;return i;},function(_ref18){var i=_ref18.left;return i;},function(_ref19){var i=_ref19.top;return i;},Mg);});var sd,Xb,Fo,Att,yi;var Ta=d(function(){sd=y(_("react"));Xb=y(_("styled-components"));Jr();$l();Fo=Xb.css(_templateObject29||(_templateObject29=_taggedTemplateLiteral(["\n color: ",";\n border-color: ",";\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.button.activeForeground;},function(i){return i.theme.button.activeForeground;},function(i){return i.theme.button.activeForeground;});Att=Xb["default"].button(_templateObject30||(_templateObject30=_taggedTemplateLiteral(["\n &&& {\n box-sizing: border-box;\n }\n text-align: center;\n position: relative;\n padding: 4px 8px;\n min-height: 32px;\n border-radius: ","px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n font-family: ",", sans-serif;\n cursor: pointer;\n border: none;\n background-color: transparent;\n overflow: hidden;\n ","\n\n /* Active */\n\n &:active {\n ","\n }\n\n ","\n\n /* Disabled */\n\n &:disabled {\n cursor: default;\n pointer-events: none;\n\n "," {\n background-color: ",";\n }\n }\n\n /* Hover */\n\n &:hover {\n "," {\n background-color: ",";\n }\n }\n\n div {\n font-size: ","px;\n letter-spacing: ","px;\n }\n"])),function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.fontSystem.button1.size;},function(i){return i.theme.measurements.fontSystem.button1.letterSpacing;},function(i){return i.theme.measurements.fontSystem.button1["case"];},function(i){return i.theme.typography.fontFamily;},di,Fo,function(_ref20){var i=_ref20.isActive;return i&&Fo;},zi,function(i){return i.theme.button.outlinedInactiveOverlayColor;},nd,function(i){return i.theme.button.hoverOverlayColor;},function(i){return i.theme.measurements.fontSystem.button1.size;},function(i){return i.theme.measurements.fontSystem.button1.letterSpacing;});yi=/*#__PURE__*/function(_sd$default$Component){_inherits(yi,_sd$default$Component);var _super8=_createSuper(yi);function yi(){var _this21;_classCallCheck(this,yi);_this21=_super8.apply(this,arguments);_this21.state=$b;_this21.timeout=null;_this21.onClick=function(t){var e=t.currentTarget.getBoundingClientRect();var r=t.pageX-e.left;var o=t.pageY-e.top;if(_this21.state.display==="block"){_this21.setState({display:"none"},function(){_this21.setRippleState(r,o);});}else{_this21.setRippleState(r,o);}_this21.props.onClick(t);};_this21.setRippleState=function(t,e){_this21.setState({left:t,top:e,display:"block"});_this21.timeout=setTimeout(function(){_this21.setState({display:"none"});},1200);};return _this21;}_createClass(yi,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout);}},{key:"render",value:function render(){var _this$props2=this.props,t=_this$props2.isActive,e=_this$props2.isDisabled,r=_this$props2.label,o=_this$props2.ariaLabel,n=_this$props2.children,s=_this$props2.className,a=_objectWithoutProperties(_this$props2,_excluded2);var _this$state2=this.state,l=_this$state2.left,c=_this$state2.top,u=_this$state2.display;return sd["default"].createElement(Att,_objectSpread(_objectSpread({"data-test":o,className:s,isActive:t,disabled:e,"aria-label":o},a),{},{onClick:this.onClick}),r,n,sd["default"].createElement(Kb,{display:u,left:l,top:c}),sd["default"].createElement(zi,null),sd["default"].createElement(nd,null));}}]);return yi;}(sd["default"].Component);yi.defaultProps={type:"button",isDisabled:false,isActive:false};});var IB,Dp,Btt,Ptt,Ui;var ka=d(function(){IB=y(_("react"));Dp=y(_("styled-components"));Jr();Btt=Dp["default"].label(_templateObject31||(_templateObject31=_taggedTemplateLiteral(["\n ","\n"])),Zu);Ptt=Dp["default"].label(_templateObject32||(_templateObject32=_taggedTemplateLiteral(["\n display: block;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n margin: 0;\n padding-bottom: 8px;\n\n ","\n"])),function(i){return i.theme.measurements.fontSystem.label.size;},function(i){return i.theme.measurements.fontSystem.label.letterSpacing;},function(i){return i.theme.measurements.fontSystem.label["case"];},function(i){return i.theme.toolControlBar.inputLabelForeground;},function(_ref21){var i=_ref21.isDisabled;return i&&Dp.css(_templateObject33||(_templateObject33=_taggedTemplateLiteral(["\n opacity: ",";\n cursor: default;\n pointer-events: none;\n "])),function(t){return t.theme.toolControlBar.inputLabelInactiveOpacity;});});Ui=function Ui(_ref22){var i=_ref22.id,t=_ref22["data-test"],e=_ref22.label,r=_ref22.htmlFor,o=_ref22.show,n=_ref22.style,s=_ref22.isDisabled,a=_ref22.className;var l=o?Ptt:Btt;var c=r||(e?e.replace(" ","-"):void 0);return IB["default"].createElement(l,{id:i,"data-test":t,style:n,isDisabled:s,htmlFor:c,className:a},e);};Ui.defaultProps={show:true};});var Zr,FB,Qr,Mtt,Ltt,DB,ztt,Utt,Ntt,Htt,EB,AS,OB;var RB=d(function(){Zr=y(_("react"));FB=y(rd());Qr=y(_("styled-components"));U();Ta();ka();Mtt=Qr["default"].div(_templateObject34||(_templateObject34=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n"])));Ltt=(0,Qr["default"])(Ui)(_templateObject35||(_templateObject35=_taggedTemplateLiteral(["\n align-self: flex-start;\n"])));DB=(0,Qr["default"])(yi)(_templateObject36||(_templateObject36=_taggedTemplateLiteral(["\n color: ",";\n padding: 1px 7px 2px;\n"])),function(i){return i.theme.button.textSecondaryForeground;});ztt=Qr["default"].div(_templateObject37||(_templateObject37=_taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n width: ","px;\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.width-48;});Utt=Qr["default"].article(_templateObject38||(_templateObject38=_taggedTemplateLiteral(["\n /* 0.6 of width here refers to the width of the container without padding */\n width: ","px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n text-align: center;\n margin-top: 7px;\n display: inline-block;\n color: ",";\n"])),function(i){return .6*i.theme.measurements.advancedUIToolControlBar.width;},function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.toolControlBar.inputLabelForeground;});Ntt=Qr["default"].div(_templateObject39||(_templateObject39=_taggedTemplateLiteral(["\n width: ","px;\n transform: translateZ(0);\n overflow: hidden;\n transition: all 500ms ease-out;\n"])),function(i){return .6*i.theme.measurements.advancedUIToolControlBar.width;});Htt=Qr["default"].span(_templateObject40||(_templateObject40=_taggedTemplateLiteral(["\n width: ","px;\n margin-left: -","px;\n position: relative;\n display: inline-block;\n transform: translateZ(0);\n transition: all 600ms cubic-bezier(0.77, 0, 0.175, 1);\n font-family: '","', sans-serif;\n"])),function(i){return Math.round(i.length*.6*i.theme.measurements.advancedUIToolControlBar.width);},function(i){return i.activeIndex*.6*i.theme.measurements.advancedUIToolControlBar.width;},function(i){return i.theme.typography.fontFamily;});EB=Qr["default"].div(_templateObject41||(_templateObject41=_taggedTemplateLiteral(["\n border: solid ",";\n border-width: 0 2px 2px 0;\n padding: 3px;\n height: 0;\n width: 0;\n\n ","\n"])),function(i){return i.theme.card.foreground;},function(_ref23){var i=_ref23.direction;return i==="left"?Qr.css(_templateObject42||(_templateObject42=_taggedTemplateLiteral(["\n margin-left: 2px;\n transform: rotate(135deg);\n "]))):Qr.css(_templateObject43||(_templateObject43=_taggedTemplateLiteral(["\n margin-right: 2px;\n transform: rotate(-45deg);\n "])));});AS=/*#__PURE__*/function(_Zr$default$PureCompo){_inherits(AS,_Zr$default$PureCompo);var _super9=_createSuper(AS);function AS(t){var _this22;_classCallCheck(this,AS);_this22=_super9.call(this,t);_this22.updateIndex=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=t+(e?-1:1);var o=_this22.props.list.length-1;if(r>o){r=0;}if(r<0){r=o;}_this22.props.onSelect(_this22.props.list[r].identifier);};_this22.getActiveIndex=function(t){var e=_this22.props.list;var r=e.findIndex(function(o){return o.identifier===t;});return r!==-1?r:0;};_this22.throttledUpdateIndex=(0,FB["default"])(_this22.updateIndex,600);return _this22;}_createClass(AS,[{key:"render",value:function render(){var _this23=this;var _this$props3=this.props,t=_this$props3.list,e=_this$props3.label,_this$props3$showLabe=_this$props3.showLabel,r=_this$props3$showLabe===void 0?true:_this$props3$showLabe;var o=this.getActiveIndex(this.props.defaultIdentifier);var n=t.length<=1;return Zr["default"].createElement(Mtt,{"data-test":N.CarouselSlider},Zr["default"].createElement(Ltt,{show:r,label:e}),Zr["default"].createElement(ztt,{id:"photoeditorsdk-".concat(e.replace(" ","-"))},Zr["default"].createElement(DB,{ariaLabel:"Select Previous",isDisabled:n,onClick:function onClick(){return _this23.throttledUpdateIndex(o,true);}},Zr["default"].createElement(EB,{direction:"left"})),Zr["default"].createElement(Ntt,null,Zr["default"].createElement(Htt,{activeIndex:o,length:t.length},t.map(function(s){return Zr["default"].createElement(Utt,{key:s.identifier},s.value);}))),Zr["default"].createElement(DB,{ariaLabel:"Select Next",isDisabled:n,onClick:function onClick(){return _this23.throttledUpdateIndex(o);}},Zr["default"].createElement(EB,{direction:"right"}))));}}]);return AS;}(Zr["default"].PureComponent);AS.defaultProps={showLabel:true};OB=AS;});var AB,Wtt,qb;var BS=d(function(){AB=y(_("styled-components"));Wtt=AB["default"].div(_templateObject44||(_templateObject44=_taggedTemplateLiteral(["\n display: flex;\n position: relative;\n margin-bottom: 12px;\n max-width: ","px;\n"])),function(i){return i.theme.measurements.inputs.checkbox.maxWidth;});qb=Wtt;});var Ep,Gtt,Fp;var PS=d(function(){Ep=y(_("styled-components"));Jr();Gtt=Ep["default"].div(_templateObject45||(_templateObject45=_taggedTemplateLiteral(["\n position: relative;\n height: 16px;\n width: 16px;\n cursor: pointer;\n background-color: ",";\n border-radius: ","px;\n transition-timing-function: ease-in;\n transition-duration: 0.3s;\n &::after {\n content: '';\n position: absolute;\n display: inline-block;\n left: 5px;\n width: 5px;\n height: 10px;\n border-style: solid;\n border-width: 0 2px 2px 0;\n border-color: transparent;\n transform: rotate(45deg) scale(0.8);\n }\n\n &:first-child {\n margin-right: 8px;\n }\n\n &:last-child {\n margin-left: 8px;\n }\n\n ","\n\n &:hover {\n opacity: ",";\n }\n ","\n ","\n"])),function(i){return i.theme.checkbox.background;},function(i){return i.theme.shape.radiusSmall;},di,function(i){return i.theme.checkbox.hoverOpacity;},function(i){return i.isChecked&&Ep.css(_templateObject46||(_templateObject46=_taggedTemplateLiteral(["\n background-color: ",";\n &::after {\n color: ",";\n border-color: ",";\n }\n &:hover {\n background-color: ",";\n opacity: 0.8;\n }\n "])),i.theme.checkbox.activeBackground,i.theme.checkbox.activeForeground,i.theme.checkbox.foreground,i.theme.checkbox.activeBackground);},function(i){return i.isDisabled&&Ep.css(_templateObject47||(_templateObject47=_taggedTemplateLiteral(["\n opacity: 0.5;\n cursor: default;\n pointer-events: none;\n "])));});Fp=Gtt;});var BB,Vtt,Yb;var MS=d(function(){BB=y(_("styled-components"));Jr();Vtt=BB["default"].input.attrs({type:"checkbox",tabIndex:0})(_templateObject48||(_templateObject48=_taggedTemplateLiteral(["\n position: absolute;\n opacity: 0;\n cursor: pointer;\n height: 0;\n width: 0;\n margin: 0;\n padding: 0;\n ","\n"])),di);Yb=Vtt;});var ad,PB,MB;var LB=d(function(){ad=y(_("react"));U();ka();BS();PS();MS();PB=function PB(_ref24){var i=_ref24.label,t=_ref24.value,e=_ref24.checkMarkPosition,r=_ref24.onClick,o=_ref24.isDisabled,n=_ref24.className,s=_ref24.style;var a="photoeditorsdk-".concat(i.replace(" ","-"));return ad["default"].createElement(qb,{"data-test":N.Checkbox,className:n,style:s},e==="left"&&ad["default"].createElement(Fp,{onClick:r,isDisabled:o,isChecked:t}),ad["default"].createElement(Ui,{isDisabled:o,label:i,htmlFor:a}),ad["default"].createElement(Yb,{id:a,disabled:o,checked:t,"aria-checked":t,onChange:r}),e==="right"&&ad["default"].createElement(Fp,{onClick:r,isDisabled:o,isChecked:t}));};MB=PB;PB.defaultProps={value:false,checkMarkPosition:"left"};});var zB,Jb;var LS=d(function(){zB=y(_("styled-components"));Jb=zB["default"].div(_templateObject49||(_templateObject49=_taggedTemplateLiteral(["\n position: absolute;\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid ",";\n transform: rotate(","deg);\n display: inline-block;\n transition-duration: 0.3s;\n transition-timing-function: ease-in;\n right: 0;\n top: 13px;\n"])),function(i){return i.theme.dropdown.caretColor;},function(i){return i.rotation||0;});});var Zb,UB,NB;var HB=d(function(){Zb=y(_("styled-components"));UB=Zb.css(_templateObject50||(_templateObject50=_taggedTemplateLiteral(["\n opacity: ",";\n pointer-events: none;\n"])),function(i){return i.theme.dropdown.inactiveOpacity;});NB=Zb["default"].div(_templateObject51||(_templateObject51=_taggedTemplateLiteral(["\n display: block;\n position: relative;\n width: 100%;\n white-space: nowrap;\n transition-duration: 0.5s;\n\n &:disabled {\n ","\n }\n\n ","\n"])),UB,function(_ref25){var i=_ref25.isDisabled;return i&&UB;});});var Qb,WB;var GB=d(function(){Qb=y(_("styled-components"));Jr();WB=Qb["default"].li(_templateObject52||(_templateObject52=_taggedTemplateLiteral(["\n padding: 10px 16px;\n text-overflow: ellipsis;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n white-space: nowrap;\n color: ",";\n\n &:hover {\n cursor: pointer;\n background: ",";\n }\n\n ","\n\n ","\n"])),function(i){return i.theme.measurements.fontSystem.button2.size;},function(i){return i.theme.measurements.fontSystem.button2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.button2["case"];},function(i){return i.theme.dropdown.foreground;},function(i){return i.theme.dropdown.listItemHoverBackground;},function(_ref26){var i=_ref26.isActive;return i&&Qb.css(_templateObject53||(_templateObject53=_taggedTemplateLiteral(["\n border-left: 2px solid ",";\n "])),function(t){return t.theme.primary;});},di);});var zS,gn,jtt,$tt,Oo;var VB=d(function(){zS=y(_("react"));gn=y(_("styled-components"));U();jtt=gn["default"].div(_templateObject54||(_templateObject54=_taggedTemplateLiteral(["\n display: flex;\n ",";\n"])),function(i){if(ve()||wr()){return gn.css(_templateObject55||(_templateObject55=_taggedTemplateLiteral(["\n overflow: hidden;\n "])));}if(i.direction==="vertical"){return gn.css(_templateObject56||(_templateObject56=_taggedTemplateLiteral(["\n flex-direction: column;\n flex: 1 1 auto;\n overflow-y: auto;\n overflow-x: hidden;\n "])));}return gn.css(_templateObject57||(_templateObject57=_taggedTemplateLiteral(["\n overflow-y: hidden;\n overflow-x: auto;\n "])));});$tt=gn["default"].ul.attrs(function(){return{role:"menubar","aria-label":"Tool Navigation"};})(_templateObject58||(_templateObject58=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: ",";\n\n list-style: none;\n padding: 0;\n margin: 0;\n\n ","\n"])),function(i){return i.direction==="vertical"?"column":"row";},function(i){if(ve()||wr()){return gn.css(_templateObject59||(_templateObject59=_taggedTemplateLiteral(["\n ","\n\n scrollbar-face-color: ",";\n scrollbar-track-color: ",";\n scrollbar-base-color: ",";\n scrollbar-3dlight-color: ",";\n scrollbar-highlight-color: ",";\n scrollbar-arrow-color: ",";\n scrollbar-shadow-color: ",";\n scrollbar-dark-shadow-color: ",";\n "])),function(){if(i.direction==="vertical"){return gn.css(_templateObject60||(_templateObject60=_taggedTemplateLiteral(["\n width: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n\n /* hidde the arrows */\n margin-top: -10px;\n margin-bottom: -10px;\n padding-top: 10px;\n padding-bottom: 10px;\n\n /* hide the scrollbar */\n padding-right: 10px;\n margin-right: -10px;\n "])));}return gn.css(_templateObject61||(_templateObject61=_taggedTemplateLiteral(["\n height: 100%;\n overflow-y: hidden;\n overflow-x: auto;\n\n margin-right: -10px;\n margin-left: -10px;\n padding-right: 10px;\n padding-left: 10px;\n\n padding-bottom: 10px;\n margin-bottom: -10px;\n "])));},i.theme.scrollbar.handleColor,i.theme.toolbar.background,i.theme.toolbar.background,i.theme.scrollbar.handleColor,i.theme.scrollbar.handleColor,i.theme.toolbar.background,i.theme.scrollbar.handleColor,i.theme.scrollbar.handleColor);}return"";});Oo=function Oo(_ref27){var _ref27$direction=_ref27.direction,i=_ref27$direction===void 0?"horizontal":_ref27$direction,t=_ref27["data-test"],e=_ref27.className,r=_ref27.children,o=_objectWithoutProperties(_ref27,_excluded3);return zS["default"].createElement(jtt,_objectSpread(_objectSpread({},o),{},{direction:i,className:e}),zS["default"].createElement($tt,{direction:i,"data-test":t},r));};});var US=d(function(){VB();});var Op,NS;var jB=d(function(){Op=y(_("styled-components"));U();US();NS=(0,Op["default"])(Oo)(_templateObject62||(_templateObject62=_taggedTemplateLiteral(["\n position: absolute;\n\n background: ",";\n color: ",";\n border: 1px solid ",";\n box-shadow: ",";\n\n visibility: hidden;\n opacity: 0;\n ","\n\n transition: all 0.5s ease;\n\n width: 100%;\n max-height: 160px;\n margin: 5px 0;\n\n /* had to add these changes to get the dropdown working in IE11 */\n ","\n\n border-radius: 0 0 ","px\n ","px;\n z-index: ",";\n"])),function(i){return i.theme.dropdown.listBackground;},function(i){return i.theme.dropdown.listForeground;},function(i){return i.theme.dropdown.listBorderColor;},function(i){return i.theme.dropdown.listShadow;},function(i){if(i.isOpen){return Op.css(_templateObject63||(_templateObject63=_taggedTemplateLiteral(["\n visibility: visible;\n opacity: 1;\n display: flex;\n "])));}return"";},function(){if(ve()){return Op.css(_templateObject64||(_templateObject64=_taggedTemplateLiteral(["\n > ul {\n height: 160px;\n margin-bottom: 0px;\n margin-top: 0px;\n padding-bottom: 0px;\n padding-top: 0px;\n }\n "])));}return"";},function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.zIndex.input.list;});NS.defaultProps={direction:"vertical"};});var $B,KB;var XB=d(function(){$B=y(_("styled-components"));Jr();KB=$B["default"].div(_templateObject65||(_templateObject65=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n background-color: ",";\n border: none;\n border-bottom: 1px solid ",";\n padding: 5px 0;\n cursor: ",";\n transition: border-color 0.4s ease-in-out;\n\n &:hover {\n border-color: ",";\n }\n\n ","\n"])),function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.dropdown.foreground;},function(i){return i.theme.dropdown.background;},function(i){return i.theme.dropdown.borderColor;},function(i){return i.showList?"pointer":"default";},function(i){return i.theme.dropdown.hoverBorderColor;},di);});var bn,qB,Ktt,HS;var YB=d(function(){bn=y(_("react"));qB=y(_("styled-components"));U();LS();HB();GB();jB();XB();ka();Ktt=qB["default"].div(_templateObject66||(_templateObject66=_taggedTemplateLiteral([""])));HS=/*#__PURE__*/function(_bn$default$PureCompo){_inherits(HS,_bn$default$PureCompo);var _super10=_createSuper(HS);function HS(t){var _this24;_classCallCheck(this,HS);_this24=_super10.call(this,t);_this24.state={isOpen:false};_this24.dropdownId="";_this24.dropdownLabelId="";_this24.handleOutsideClick=function(t){if(_this24.node&&_this24.node.contains(t.target)){return;}_this24.setState({isOpen:false});};_this24.onSelect=function(t){var e=_this24.props.onSelect;e(t);_this24.setState({isOpen:false});};_this24.handleKeyDownItem=function(t){return function(e){if(e.nativeEvent.code==="Space"||e.nativeEvent.code==="Enter"){_this24.onSelect(t);}};};_this24.onClick=function(){_this24.setState(function(t){return{isOpen:!t.isOpen};});};_this24.listItem=function(t){var _this24$props=_this24.props,e=_this24$props.itemStyle,r=_this24$props.selectedItem;var o=_this24.state.isOpen;var n=t.value,s=t.label;var a={};if(typeof e==="function"){a=e(t);}else if(e!==null&&_typeof(e)==="object"){a=e;}return bn["default"].createElement(WB,{role:"option","aria-hidden":!o,tabIndex:0,style:a,onClick:function onClick(){return _this24.onSelect(n);},key:n,isActive:r===n,onKeyDown:_this24.handleKeyDownItem(n)},s);};_this24.onKeyDown=function(t){if(t.nativeEvent.code==="Space"||t.nativeEvent.code==="Enter"){_this24.onClick();}};_this24.nodeRef=function(e){_this24.node=e;};_this24.dropdownId=At().slice(0,8);_this24.dropdownLabelId="".concat(_this24.dropdownId,"-label");return _this24;}_createClass(HS,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener("mousedown",this.handleOutsideClick,false);}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener("mousedown",this.handleOutsideClick,false);}},{key:"render",value:function render(){var _this$props4=this.props,t=_this$props4.selectedItem,e=_this$props4.list,r=_this$props4.label,o=_this$props4.style,n=_this$props4.isDisabled;var s=this.state.isOpen;var a=e.length>1;return bn["default"].createElement(Ktt,null,bn["default"].createElement(Ui,{id:this.dropdownLabelId,isDisabled:n,style:{paddingLeft:"0px"},label:r}),bn["default"].createElement("div",{ref:this.nodeRef},bn["default"].createElement(NB,{isOpen:s,isDisabled:n},bn["default"].createElement(KB,{role:"combobox","aria-controls":this.dropdownId,"aria-expanded":s,"aria-labelledby":this.dropdownLabelId,"data-test":N.Dropdown,"aria-hidden":n,showList:a,style:o,onClick:a?this.onClick:void 0,onKeyDown:this.onKeyDown,tabIndex:n?-1:0},t,a&&bn["default"].createElement(Jb,{rotation:s?180:0})),bn["default"].createElement(NS,{id:this.dropdownId,role:"listbox",tabIndex:-1,"aria-labelledby":this.dropdownLabelId,"data-test":N.DropdownList,isOpen:s},a&&e.map(this.listItem)))));}}]);return HS;}(bn["default"].PureComponent);});var JB,ZB;var QB=d(function(){JB=y(_("styled-components"));ZB=JB["default"].input.attrs({type:"file",id:"fileUpload",accept:"image/*"})(_templateObject67||(_templateObject67=_taggedTemplateLiteral(["\n display: none;\n"])));});var t5,Xtt,e5;var i5=d(function(){t5=y(_("react"));Xtt=function Xtt(_ref28){var i=_ref28.children;var t=function t(e){e.preventDefault();};return t5["default"].createElement("form",{onSubmit:t},i);};e5=Xtt;});var r5,Kl;var ty=d(function(){r5=_("styled-components");Kl=r5.css(_templateObject68||(_templateObject68=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n height: 100%;\n width: 100%;\n min-height: 26px;\n color: ",";\n padding: 0;\n border: none;\n appearance: none;\n border-bottom: 1px solid ",";\n background: ",";\n font-family: '","', sans-serif;\n transition: border-color 0.4s ease-in-out;\n\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n margin: 0;\n }\n\n &:-moz-focusring {\n outline: none;\n border-color: ",";\n }\n\n &::-ms-clear,\n &::-ms-reveal {\n display: none;\n }\n\n &:focus {\n outline: none;\n border-color: ",";\n }\n\n &:disabled {\n opacity: ",";\n pointer-events: none;\n }\n\n &:hover {\n border-color: ",";\n }\n"])),function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.textInput.foreground;},function(i){return i.theme.textInput.borderColor;},function(i){return i.theme.textInput.background;},function(i){return i.theme.typography.fontFamily;},function(i){return i.theme.textInput.hoverBorderColor;},function(i){return i.theme.textInput.hoverBorderColor;},function(i){return i.theme.textInput.inactiveOpacity;},function(i){return i.theme.textInput.hoverBorderColor;});});var ey,GS,qtt,Ytt,WS,iy;var VS=d(function(){ey=y(_("react"));GS=y(_("styled-components"));ty();qtt=GS["default"].div(_templateObject69||(_templateObject69=_taggedTemplateLiteral(["\n ","\n position: relative;\n display: flex;\n align-items: center;\n height: unset;\n\n &:focus-within {\n border-color: ",";\n }\n"])),Kl,function(i){return i.theme.textInput.hoverBorderColor;});Ytt=GS["default"].input(_templateObject70||(_templateObject70=_taggedTemplateLiteral(["\n ","\n border-bottom: none;\n &:disabled {\n opacity: ",";\n cursor: default;\n pointer-events: none;\n }\n"])),Kl,function(i){return i.theme.textInput.inactiveOpacity;});WS=/*#__PURE__*/function(_ey$default$Component){_inherits(WS,_ey$default$Component);var _super11=_createSuper(WS);function WS(){var _this25;_classCallCheck(this,WS);_this25=_super11.apply(this,arguments);_this25.onChange=function(t){var e=_this25.props.onChange;if(e){e(t.target.value);}};return _this25;}_createClass(WS,[{key:"render",value:function render(){var _this$props5=this.props,t=_this$props5["aria-label"],e=_this$props5["aria-labeledby"],r=_this$props5.id,o=_this$props5.testId,n=_this$props5.value,s=_this$props5.type,a=_this$props5.min,l=_this$props5.max,c=_this$props5.onBlur,u=_this$props5.onFocus,m=_this$props5.onKeyUp,p=_this$props5.onKeyDown,h=_this$props5.onMouseUp,g=_this$props5.onTouchEnd,x=_this$props5.isDisabled,v=_this$props5.className,b=_this$props5.children;return ey["default"].createElement(qtt,{className:v},ey["default"].createElement(Ytt,{"aria-label":t,"aria-labelledby":e,id:r,"data-test":o,"aria-hidden":x,disabled:x,value:n,type:s,min:a,max:l,onChange:this.onChange,onBlur:c,onFocus:u,onKeyUp:m,onKeyDown:p,onMouseUp:h,onTouchEnd:g}),b);}}]);return WS;}(ey["default"].Component);WS.defaultProps={type:"text"};iy=WS;});var ld,Ap,Jtt,_Rp,jS,ry;var $S=d(function(){ld=y(_("react"));Ap=y(_("styled-components"));U();ka();VS();Jtt=Ap["default"].div(_templateObject71||(_templateObject71=_taggedTemplateLiteral(["\n ","\n"])),ve()?Ap.css(_templateObject72||(_templateObject72=_taggedTemplateLiteral([""]))):Ap.css(_templateObject73||(_templateObject73=_taggedTemplateLiteral(["\n display: flex;\n flex: 0 1 auto;\n flex-direction: column;\n "]))));_Rp=/*#__PURE__*/function(_ld$default$Component){_inherits(Rp,_ld$default$Component);var _super12=_createSuper(Rp);function Rp(t){var _this26;_classCallCheck(this,Rp);_this26=_super12.call(this,t);_this26.node=null;_this26.handleOutsideClick=function(t){if(_this26.node&&_this26.node.current&&_this26.node.current.contains(t.target)){return;}_this26.onSubmit();};_this26.onSubmit=function(){var t=_this26.props.onSubmit;var _this26$state=_this26.state,e=_this26$state.value,r=_this26$state.isActive;if(t){var o=parseFloat(_Rp.cleanValue(e));if(!Number.isNaN(o)&&r){t("".concat(o));}}_this26.setState({isActive:false});};_this26.onBlur=function(){_this26.onSubmit();};_this26.onFocus=function(){_this26.setState({isActive:true});};_this26.onKeyDown=function(t){var e=_this26.state.value;if(t.key==="Enter"){_this26.onSubmit();}else if(t.key==="ArrowUp"){var r=parseFloat(_Rp.cleanValue(e));if(typeof r==="number"){_this26.setState({value:(r+1).toString(),isActive:true});}}else if(t.key==="ArrowDown"){var _r2=parseFloat(_Rp.cleanValue(e));if(typeof _r2==="number"){_this26.setState({value:(_r2-1).toString(),isActive:true});}}};_this26.onChange=function(t){_this26.setState({value:t.replace(/[^\d.,-]/g,""),isActive:true});};_this26.state={value:_this26.props.value||"",isActive:false};_this26.node=ld["default"].createRef();return _this26;}_createClass(Rp,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener("mousedown",this.handleOutsideClick,false);document.addEventListener("touchstart",this.handleOutsideClick,false);}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener("mousedown",this.handleOutsideClick,false);document.removeEventListener("touchstart",this.handleOutsideClick,false);}},{key:"render",value:function render(){var _this$props6=this.props,t=_this$props6.id,e=_this$props6.label,r=_this$props6["aria-label"],o=_this$props6.isDisabled,n=_this$props6.showLabel,s=_this$props6.ariaHidden,a=_this$props6.onMouseUp,l=_this$props6.onTouchEnd,c=_this$props6.className,u=_this$props6.style;var m=this.state.value;return ld["default"].createElement(Jtt,{ref:this.node,"data-test":N.NummericInput,className:c,style:u},e&&n&&ld["default"].createElement(Ui,{htmlFor:t,label:e,show:!!e,isDisabled:o}),ld["default"].createElement(iy,{id:t,value:m,isDisabled:o,"aria-hidden":s,"aria-label":!e?r:void 0,"aria-labelledby":e?t:void 0,onChange:this.onChange,onKeyDown:this.onKeyDown,onBlur:this.onBlur,onFocus:this.onFocus,onMouseUp:a,onTouchEnd:l}));}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(_ref29,_ref30){var t=_ref29.value;var e=_ref30.value,r=_ref30.isActive;if(t!==e&&!r){return{value:t};}return null;}},{key:"cleanValue",value:function cleanValue(t){return t?t.replace(",",".").replace(/[a-zA-Z]/g,"").trim():"";}}]);return Rp;}(ld["default"].Component);jS=_Rp;jS.defaultProps={showLabel:true};ry=jS;});var Bp,o5,Ztt,n5;var s5=d(function(){Bp=y(_("react"));o5=y(_("styled-components"));ty();Ztt=o5["default"].input.attrs({type:"search"})(_templateObject74||(_templateObject74=_taggedTemplateLiteral(["\n ","\n"])),Kl);n5=(0,Bp.forwardRef)(function(_ref31,s){var i=_ref31.value,t=_ref31.onChange,e=_ref31.onKeyDown,r=_ref31.placeholder,o=_ref31.className,n=_ref31.style;var a=function a(l){if(t)t(l.target.value);};return Bp["default"].createElement("div",{className:o,style:n},Bp["default"].createElement(Ztt,{ref:s,value:i,onChange:a,onKeyDown:e,placeholder:r,autoComplete:"off"}));});});var oy,Pp,Qtt,a5,tet,l5;var c5=d(function(){oy=y(_("react"));Pp=y(_("styled-components"));ka();Qtt=Pp["default"].div(_templateObject75||(_templateObject75=_taggedTemplateLiteral([""])));a5=function a5(_ref32){var i=_ref32.label,t=_ref32.children,e=_ref32.inline,r=_ref32.showLabel,o=_ref32.isDisabled,n=_ref32["data-test"];var s="photoeditorsdk-".concat(i.replace(" ","-"),"-label");return oy["default"].createElement(Qtt,{"data-test":n},oy["default"].createElement(Ui,{id:s,isDisabled:o,label:i,show:r}),oy["default"].createElement(tet,{"aria-labelledby":s,inline:!!e},t));};tet=Pp["default"].div(_templateObject76||(_templateObject76=_taggedTemplateLiteral(["\n display: inline-flex;\n ","\n"])),function(i){return!i.inline&&Pp.css(_templateObject77||(_templateObject77=_taggedTemplateLiteral(["\n flex-wrap: wrap;\n "])))||"";});a5.defaultProps={showLabel:true};l5=a5;});var u5,ny;var d5=d(function(){u5=y(_("styled-components"));ny=u5["default"].div(_templateObject78||(_templateObject78=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n /* needed for IE11 to properly calculate the width */\n min-width: 1px;\n"])));});var KS=d(function(){d5();});var m5,sy;var p5=d(function(){m5=y(_("styled-components"));sy=m5["default"].div(_templateObject79||(_templateObject79=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n height: 26px;\n margin-right: ","px;\n width: ",";\n"])),function(i){return i.centerSlider?-56:0;},function(i){return i.centerSlider?"calc(100% + 56px)":"100%";});});var XS=d(function(){p5();});var ay,h5,eet,ly;var f5=d(function(){ay=y(_("react"));h5=y(_("styled-components"));$S();eet=(0,h5["default"])(ry)(_templateObject80||(_templateObject80=_taggedTemplateLiteral(["\n max-width: 50px;\n padding-left: 16px;\n > div > input {\n text-align: center;\n }\n"])));ly=function ly(_ref33){var i=_ref33.id,t=_ref33["aria-label"],e=_ref33.value,r=_ref33.min,o=_ref33.max,n=_ref33.divider,s=_ref33.suffix,a=_ref33.decimal,l=_ref33.isDisabled,c=_ref33["aria-hidden"],u=_ref33.onChange,m=_ref33.onMouseUp,p=_ref33.onTouchEnd,h=_ref33.className,g=_ref33.style;var x="".concat(i,"-input");var v="".concat((e*n).toFixed(a)).concat(s);var b=(0,ay.useCallback)(function(T){var k=T.replace(s,"");if(k){var E=parseFloat(k)/n;var A=Math.max(r,Math.min(o,E));if(!Number.isNaN(A)){u(A);if(m){m(A);}else if(p){p(A);}}}},[r,o,s,u,m,p]);return ay["default"].createElement(eet,{className:h,style:g,"aria-label":t,id:x,value:v,isDisabled:l,"aria-hidden":c,onSubmit:b});};});var qS=d(function(){f5();});var g5,cy;var b5=d(function(){g5=y(_("styled-components"));ka();cy=(0,g5["default"])(Ui)(_templateObject81||(_templateObject81=_taggedTemplateLiteral(["\n padding-bottom: 2px;\n"])));});var YS=d(function(){b5();});var Ia,ps,JS,iet,ret,uy;var y5=d(function(){Ia=y(_("react"));ps=y(_("styled-components"));Sr();U();Jr();JS=ps.css(_templateObject82||(_templateObject82=_taggedTemplateLiteral(["\n ","\n background: ",";\n border: 2px solid ",";\n border-radius: 50%;\n cursor: pointer;\n"])),wr()||ve()?ps.css(_templateObject83||(_templateObject83=_taggedTemplateLiteral(["\n width: 16px;\n height: 16px;\n "]))):ps.css(_templateObject84||(_templateObject84=_taggedTemplateLiteral(["\n width: 20px;\n height: 20px;\n "]))),function(i){return i.theme.slider.thumbBackground;},function(i){return i.theme.slider.thumbBorderColor;});iet=function iet(i){var t=(i.value-i.min)*100/(i.max-i.min);if(i.adjust){if(i.value>0){t=i.value*(i.max/2)*100;return"".concat(i.theme.slider.trackColor," 0%,\n ").concat(i.theme.slider.trackColor," 50%,\n ").concat(i.theme.slider.activeTrackColor," 50%,\n ").concat(i.theme.slider.activeTrackColor," ").concat(50+t,"%,\n ").concat(i.theme.slider.trackColor," ").concat(50+t,"%,\n ").concat(i.theme.slider.trackColor," 100%\n ");}if(i.value<0){t=i.value*(i.min/2)*100;return"".concat(i.theme.slider.trackColor," 0%,\n ").concat(i.theme.slider.trackColor," ").concat(50-t,"%,\n ").concat(i.theme.slider.activeTrackColor," ").concat(50-t,"%,\n ").concat(i.theme.slider.activeTrackColor," 50%,\n ").concat(i.theme.slider.trackColor," 50%,\n ").concat(i.theme.slider.trackColor," 100%\n ");}return"".concat(i.theme.slider.trackColor," 0%,\n ").concat(i.theme.slider.trackColor," 100%");}return"".concat(i.theme.slider.activeTrackColor," 0%,\n ").concat(i.theme.slider.activeTrackColor," ").concat(t,"%,\n ").concat(i.theme.slider.trackColor," ").concat(t,"%,\n ").concat(i.theme.slider.trackColor," 100%");};ret=ps["default"].input.attrs(function(i){return{style:!wr()&&!ve()?{background:"linear-gradient(to right, ".concat(iet(i),")")}:{}};})(_templateObject85||(_templateObject85=_taggedTemplateLiteral(["\n display: flex;\n flex: 1 0 auto;\n appearance: none;\n width: 100%;\n max-width: ",";\n outline: none;\n border-radius: 0; /* iOS */\n\n padding: 0;\n margin: 0;\n border: none;\n\n ","\n\n ","\n\n &::-moz-focus-outer {\n /** This is to remove the dotted focus lines in firefox */\n border: 0;\n }\n &:disabled {\n opacity: ",";\n pointer-events: none;\n }\n &:hover {\n opacity: ",";\n }\n &::-webkit-slider-runnable-track {\n cursor: pointer;\n appearance: none;\n }\n &::-moz-range-track {\n appearance: none;\n cursor: pointer;\n }\n &::-ms-track {\n cursor: pointer;\n height: 2px;\n appearance: none;\n background: transparent;\n color: transparent;\n border-color: transparent;\n border-width: 6px 0;\n }\n &::-webkit-slider-thumb {\n appearance: none;\n ","\n }\n &::-moz-range-thumb {\n appearance: none;\n ","\n }\n &::-ms-thumb {\n appearance: none;\n ","\n }\n &::-ms-fill-lower {\n background: ",";\n }\n &::-ms-fill-upper {\n background: ",";\n }\n &::-ms-tooltip {\n display: none;\n }\n"])),function(i){return i.showInput?"calc(100% - 50px)":"100%";},di,function(i){if(wr()||ve()){return ps.css(_templateObject86||(_templateObject86=_taggedTemplateLiteral(["\n margin-top: 10px;\n height: 20px;\n /* remove once we have a better concept for focus in all browser */\n &:focus {\n box-shadow: none;\n }\n "])));}if(i.smallContainer){return ps.css(_templateObject87||(_templateObject87=_taggedTemplateLiteral(["\n height: 4px;\n "])));}return ps.css(_templateObject88||(_templateObject88=_taggedTemplateLiteral(["\n height: 2px;\n "])));},function(i){return i.theme.slider.inactiveOpacity;},function(i){return i.theme.slider.hoverOpacity;},JS,JS,JS,function(i){return"".concat(i.theme.slider.activeTrackColor);},function(i){return"".concat(i.theme.slider.trackColor);});uy=function uy(_ref34){var i=_ref34.id,t=_ref34.label,e=_ref34.value,r=_ref34.min,o=_ref34.max,n=_ref34.step,s=_ref34.adjust,a=_ref34.showInput,l=_ref34["aria-hidden"],c=_ref34.isDisabled,u=_ref34.onChange,m=_ref34.onMouseUp,p=_ref34.onTouchEnd,h=_ref34["data-test"],g=_ref34.className,x=_ref34.style;var _ref35=(0,Ia.useContext)(Oe),v=_ref35.rect;var b=(0,Ia.useCallback)(function(E){var A=parseFloat(E.target.value);u(A);},[u]);var T=(0,Ia.useCallback)(function(E){var A=E.target.value;var I=parseFloat(A);if(p){p(I);}},[p]);var k=(0,Ia.useCallback)(function(E){var A=E.target.value;var I=parseFloat(A);if(m){m(I);}},[p]);return Ia["default"].createElement(ret,{type:"range",role:"slider","aria-valuenow":e,"aria-valuemin":r,"aria-valuemax":o,"aria-label":t,"data-test":h,id:i,name:t,tabIndex:0,value:e,min:r,max:o,step:n,style:x,className:g,adjust:s,showInput:a,disabled:c,smallContainer:!!v&&v.width<600,"aria-hidden":l,onChange:b,onKeyUp:b,onKeyDown:b,onMouseUp:k,onTouchEnd:T});};});var ZS=d(function(){y5();});var Da,_5;var x5=d(function(){Da=y(_("react"));U();KS();XS();qS();YS();ZS();_5=function _5(_ref36){var i=_ref36["data-test"],t=_ref36.label,e=_ref36.identifier,_ref36$showLabel=_ref36.showLabel,r=_ref36$showLabel===void 0?true:_ref36$showLabel,_ref36$showInput=_ref36.showInput,o=_ref36$showInput===void 0?true:_ref36$showInput,_ref36$centerSlider=_ref36.centerSlider,n=_ref36$centerSlider===void 0?false:_ref36$centerSlider,_ref36$min=_ref36.min,s=_ref36$min===void 0?-1:_ref36$min,_ref36$max=_ref36.max,a=_ref36$max===void 0?1:_ref36$max,_ref36$value=_ref36.value,l=_ref36$value===void 0?0:_ref36$value,_ref36$step=_ref36.step,c=_ref36$step===void 0?.01:_ref36$step,_ref36$decimal=_ref36.decimal,u=_ref36$decimal===void 0?0:_ref36$decimal,_ref36$divider=_ref36.divider,m=_ref36$divider===void 0?100:_ref36$divider,_ref36$suffix=_ref36.suffix,p=_ref36$suffix===void 0?"":_ref36$suffix,_ref36$adjust=_ref36.adjust,h=_ref36$adjust===void 0?false:_ref36$adjust,g=_ref36["aria-hidden"],x=_ref36.isDisabled,v=_ref36.onChange,b=_ref36.onMouseUp,T=_ref36.onTouchEnd,k=_ref36.style,E=_ref36.className;var _ref37=(0,Da.useState)("photoeditorsdk-slider-".concat(At())),_ref38=_slicedToArray(_ref37,1),A=_ref38[0];return Da["default"].createElement(ny,{className:E,"data-test":i||e||A,style:k},Da["default"].createElement(cy,{isDisabled:x,label:t,show:r}),Da["default"].createElement(sy,{centerSlider:o&&n},Da["default"].createElement(uy,{id:A,label:t,value:l,min:s,max:a,step:c,adjust:h,showInput:o,isDisabled:x,"aria-hidden":g,onChange:v,onMouseUp:b,onTouchEnd:T}),o&&Da["default"].createElement(ly,{id:A,"aria-label":t,value:l,min:s,max:a,divider:m,suffix:p,decimal:u,isDisabled:x,"aria-hidden":g,onChange:v,onMouseUp:b,onTouchEnd:T})));};});var v5=d(function(){x5();KS();XS();qS();ZS();YS();});var C5,Xl;var dy=d(function(){C5=y(_("styled-components"));Ta();$l();Xl=(0,C5["default"])(yi)(_templateObject89||(_templateObject89=_taggedTemplateLiteral(["\n color: ",";\n\n svg {\n color: ",";\n }\n\n /* Repeat active styles so they are not overwritten */\n ","\n\n "," {\n display: none;\n }\n\n &:disabled {\n opacity: ",";\n }\n"])),function(i){return i.theme.button.textPrimaryForeground;},function(i){return i.theme.button.textPrimaryForeground;},function(_ref39){var i=_ref39.isActive;return i&&Fo;},zi,function(i){return i.theme.button.textInactiveOpacity;});});var S5,Ro;var my=d(function(){S5=y(_("styled-components"));Ta();$l();Ro=(0,S5["default"])(yi)(_templateObject90||(_templateObject90=_taggedTemplateLiteral(["\n color: ",";\n\n /* Repeat active styles so they are not overwritten */\n ","\n\n "," {\n display: none;\n }\n\n &:disabled {\n opacity: ",";\n }\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.button.textSecondaryForeground;},function(_ref40){var i=_ref40.isActive;return i&&Fo;},zi,function(i){return i.theme.button.textInactiveOpacity;},function(i){return i.theme.button.textSecondaryForeground;});});var yn,QS;var w5=d(function(){yn=y(_("react"));U();dy();my();Tp();Ob();Rb();QS=/*#__PURE__*/function(_yn$default$Component){_inherits(QS,_yn$default$Component);var _super13=_createSuper(QS);function QS(){var _this27;_classCallCheck(this,QS);_this27=_super13.apply(this,arguments);_this27.onDismiss=function(){var _this27$props=_this27.props,t=_this27$props.handleClose,e=_this27$props.handleDismiss;if(t)t();if(e)e();};_this27.onConfirm=function(){var _this27$props2=_this27.props,t=_this27$props2.handleClose,e=_this27$props2.handleConfirm;if(t)t();if(e)e();};return _this27;}_createClass(QS,[{key:"render",value:function render(){var _this$props7=this.props,t=_this$props7.headerLabel,e=_this$props7.bodyLabel,r=_this$props7.confirmLabel,o=_this$props7.dismissLabel,n=_this$props7.type,s=_this$props7.children;var a=yn["default"].Children.toArray(s)[0];if(!yn["default"].isValidElement(a))throw new Error("Child is not a valid react element");return yn["default"].cloneElement(a,{handleConfirm:this.onConfirm,handleDismiss:this.onDismiss,header:yn["default"].createElement(td,null,t),body:yn["default"].createElement(ms,{"data-test":N.DialogBody},e),footer:yn["default"].createElement(Qu,{type:n},o&&yn["default"].createElement(Ro,{label:o,ariaLabel:o,onClick:this.onDismiss}),r&&yn["default"].createElement(Xl,{label:r,ariaLabel:r,onClick:this.onConfirm}))});return null;}}]);return QS;}(yn["default"].Component);});var Ao,Mp,oet,net,set,aet,t1;var T5=d(function(){Ao=y(_("react"));Mp=y(_("styled-components"));U();Tp();Rb();vS();oet=Mp["default"].div(_templateObject91||(_templateObject91=_taggedTemplateLiteral(["\n display: flex;\n"])));net=(0,Mp["default"])(td)(_templateObject92||(_templateObject92=_taggedTemplateLiteral(["\n padding: 0;\n"])));set=Mp["default"].div(_templateObject93||(_templateObject93=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n margin-left: 8px;\n @media all and (min-width: 640px) {\n margin-left: 30px;\n }\n"])));aet=(0,Mp["default"])(ms)(_templateObject94||(_templateObject94=_taggedTemplateLiteral(["\n padding: 0;\n margin: 0;\n"])));t1=/*#__PURE__*/function(_Ao$default$PureCompo){_inherits(t1,_Ao$default$PureCompo);var _super14=_createSuper(t1);function t1(){_classCallCheck(this,t1);return _super14.apply(this,arguments);}_createClass(t1,[{key:"render",value:function render(){var _this$props8=this.props,t=_this$props8.headerLabel,e=_this$props8.bodyLabel,r=_this$props8.children;var o=Ao["default"].Children.toArray(r)[0];if(!Ao["default"].isValidElement(o))throw new Error("Child is not a valid react element");return Ao["default"].cloneElement(o,{height:"90px",body:Ao["default"].createElement(ms,{"data-test":N.DialogBody},Ao["default"].createElement(oet,null,Ao["default"].createElement(Bb,null),Ao["default"].createElement(set,null,Ao["default"].createElement(net,null,t),Ao["default"].createElement(aet,null,e))))});return null;}}]);return t1;}(Ao["default"].PureComponent);});var Ir,cd,cet,uet,det,met,pet,e1,k5;var I5=d(function(){Ir=y(_("react"));cd=y(_("styled-components"));U();dy();my();Tp();Ob();ty();cet=cd["default"].form(_templateObject95||(_templateObject95=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n"])));uet=cd["default"].textarea(_templateObject96||(_templateObject96=_taggedTemplateLiteral(["\n display: flex;\n caret-color: ",";\n ","\n min-height: 100%;\n padding: 0px;\n outline-offset: -8px;\n color: ",";\n resize: none;\n font-family: '","', sans-serif;\n\n &:selection,\n &:-moz-selection {\n background-color: ",";\n color: ",";\n }\n"])),function(i){return i.theme.primary;},Kl,function(i){return i.theme.modal.bodyForeground;},function(i){return i.theme.typography.fontFamily;},function(i){return i.theme.primary;},function(i){return i.theme.foreground;});det=cd["default"].label(_templateObject97||(_templateObject97=_taggedTemplateLiteral(["\n padding: 11px 20px 8px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n"])),function(i){return i.theme.measurements.fontSystem.label.size;},function(i){return i.theme.measurements.fontSystem.label.letterSpacing;},function(i){return i.theme.measurements.fontSystem.label["case"];},function(i){return i.theme.modal.headerForeground;});met=(0,cd["default"])(ms)(_templateObject98||(_templateObject98=_taggedTemplateLiteral(["\n height: 100%;\n"])));pet=(0,cd["default"])(Qu)(_templateObject99||(_templateObject99=_taggedTemplateLiteral(["\n border-top: none;\n"])));e1=/*#__PURE__*/function(_Ir$default$Component){_inherits(e1,_Ir$default$Component);var _super15=_createSuper(e1);function e1(){var _this28;_classCallCheck(this,e1);_this28=_super15.apply(this,arguments);_this28.state={value:""};_this28.input=Ir["default"].createRef();_this28.handleKeydown=function(t){aA(_this28.handleDismiss)(t);};_this28.handleDismiss=function(){var t=_this28.props.handleDismiss;if(t)t(false);};_this28.handleConfirm=function(){var t=_this28.props.handleConfirm;var e=_this28.input.current.value;if(e){if(t)t(e);_this28.handleDismiss();}};_this28.onChange=function(t){var e=_this28.props.allowEmojis;var r=e?t.target.value:GF(t.target.value);_this28.input.current.value=r;_this28.setState({value:r});};_this28.onSubmit=function(t){t.preventDefault();};return _this28;}_createClass(e1,[{key:"componentDidMount",value:function componentDidMount(){var _this$props9=this.props,t=_this$props9.text,e=_this$props9.defaultText;this.input.current.focus();this.input.current.value=t||e||"";this.setState({value:this.input.current.value});document.addEventListener("keydown",this.handleKeydown,false);if(t===e){this.input.current.select();}}},{key:"componentDidUpdate",value:function componentDidUpdate(t){var e=this.props.isVisible;if(t.isVisible!==e){if(e){this.input.current.focus();}}}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener("keydown",this.handleKeydown,false);}},{key:"render",value:function render(){var _this$props10=this.props,t=_this$props10.headerLabel,e=_this$props10.dismissLabel,r=_this$props10.confirmLabel,o=_this$props10.maxLength,n=_this$props10.type,s=_this$props10.children;var a=this.state.value;var l=Ir["default"].Children.toArray(s)[0];if(!Ir["default"].isValidElement(l))throw new Error("Child is not a valid react element");return Ir["default"].cloneElement(l,{handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss,isConfirmDisabled:!a,height:"150px",header:Ir["default"].createElement(det,{htmlFor:"photoeditorsdk-TextInput"},t),body:Ir["default"].createElement(met,null,Ir["default"].createElement(cet,{onSubmit:this.onSubmit},Ir["default"].createElement(uet,{ref:this.input,id:"photoeditorsdk-TextInput",placeholder:"Write Something",autoFocus:true,onChange:this.onChange,maxLength:o}))),footer:Ir["default"].createElement(pet,{type:n},Ir["default"].createElement(Ro,{label:e,ariaLabel:e,onClick:this.handleDismiss}),Ir["default"].createElement(Xl,{label:r,ariaLabel:r,isDisabled:!a,onClick:this.handleConfirm}))});return null;}}]);return e1;}(Ir["default"].Component);e1.defaultProps={defaultText:"Write Something",allowEmojis:false};k5=e1;});var D5,i1;var E5=d(function(){D5=y(_("styled-components"));i1=D5["default"].div(_templateObject100||(_templateObject100=_taggedTemplateLiteral(["\n padding-bottom: ","px;\n"])),function(i){return(i.count||1)*8;});i1.defaultProps={count:1};});var ql,r1,py,hy;var F5=d(function(){ql=y(_("react"));r1=/*#__PURE__*/function(_ql$default$Component){_inherits(r1,_ql$default$Component);var _super16=_createSuper(r1);function r1(){_classCallCheck(this,r1);return _super16.apply(this,arguments);}_createClass(r1,[{key:"getChildren",value:function getChildren(){var _this29=this;var t=[];var e=[];ql["default"].Children.forEach(this.props.children,function(r){switch(r.type.componentName){case"case":if(_this29.props.type===r.props.value){t.push(r);}break;case"default":e.push(r);break;}});if(t.length>0){return t;}return e;}},{key:"render",value:function render(){var t=this.getChildren();return t.length===0?null:ql["default"].createElement(ql["default"].Fragment,null,t);}}]);return r1;}(ql["default"].Component);py=/*#__PURE__*/function(_ql$default$Component2){_inherits(py,_ql$default$Component2);var _super17=_createSuper(py);function py(){_classCallCheck(this,py);return _super17.apply(this,arguments);}_createClass(py,[{key:"render",value:function render(){return this.props.children;}}]);return py;}(ql["default"].Component);py.componentName="case";hy=/*#__PURE__*/function(_ql$default$Component3){_inherits(hy,_ql$default$Component3);var _super18=_createSuper(hy);function hy(){_classCallCheck(this,hy);return _super18.apply(this,arguments);}_createClass(hy,[{key:"render",value:function render(){return this.props.children;}}]);return hy;}(ql["default"].Component);hy.componentName="default";});var ud,het,fet,O5;var R5=d(function(){ud=y(_("styled-components"));het=ud.keyframes(_templateObject101||(_templateObject101=_taggedTemplateLiteral(["\n from { transform: translate(-50%, 0%); }\n to { transform: translate(-50%, 50%); }\n"])));fet=ud["default"].div(_templateObject102||(_templateObject102=_taggedTemplateLiteral(["\n position: absolute;\n top: ","px;\n left: ","px;\n transform: translate(-50%, 50%);\n background: black;\n color: white;\n border-radius: ","px;\n padding: 10px 16px;\n text-align: center;\n z-index: ",";\n visibility: hidden;\n\n ","\n"])),function(i){return i.position.y;},function(i){return i.position.x;},function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.zIndex.toast;},function(_ref41){var i=_ref41.show;return i&&ud.css(_templateObject103||(_templateObject103=_taggedTemplateLiteral(["\n visibility: visible;\n animation: "," 0.5s, fadeout 0.5s 2.5s;\n "])),het);});O5=fet;});var dd,to,A5,get,B5,bet,P5,yet,Bo;var Lp=d(function(){dd=y(_("react"));to=y(_("styled-components"));Sr();Ta();A5=to.css(_templateObject104||(_templateObject104=_taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n align-items: center;\n padding: 4px;\n"])));get=(0,to["default"])(yi)(_templateObject105||(_templateObject105=_taggedTemplateLiteral(["\n ","\n\n ","\n ","\n"])),function(_ref42){var i=_ref42.fullWidth;return i&&to.css(_templateObject106||(_templateObject106=_taggedTemplateLiteral(["\n width: 100%;\n "])));},function(_ref43){var i=_ref43.hasIcon,t=_ref43.smallContainer;return i&&t&&A5;},function(_ref44){var i=_ref44.hasIcon;return i&&to.css(_templateObject107||(_templateObject107=_taggedTemplateLiteral(["\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n "])),A5);});B5=to.css(_templateObject108||(_templateObject108=_taggedTemplateLiteral(["\n display: flex;\n"])));bet=to["default"].div(_templateObject109||(_templateObject109=_taggedTemplateLiteral(["\n &:focus {\n outline: none;\n }\n\n > img {\n height: 18px;\n width: 18px;\n }\n\n > svg {\n height: 18px;\n width: 18px;\n }\n display: none;\n\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&B5;},B5);P5=to.css(_templateObject110||(_templateObject110=_taggedTemplateLiteral(["\n display: none;\n"])));yet=to["default"].div(_templateObject111||(_templateObject111=_taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n &:focus {\n outline: none;\n }\n font-size: inherit;\n text-spacing: inherit;\n color: inherit;\n\n ","\n\n ","\n ","\n"])),function(_ref45){var i=_ref45.isDisabled;return i&&to.css(_templateObject112||(_templateObject112=_taggedTemplateLiteral(["\n opacity: ",";\n "])),function(t){return t.theme.button.textInactiveOpacity;});},function(_ref46){var i=_ref46.hasIcon,t=_ref46.smallContainer;return i&&t&&P5;},function(_ref47){var i=_ref47.hasIcon;return i&&to.css(_templateObject113||(_templateObject113=_taggedTemplateLiteral(["\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n "])),P5);});Bo=function Bo(_ref48){var i=_ref48.label,t=_ref48.children,e=_ref48.icon,r=_ref48.fullWidth,o=_ref48.isDisabled,n=_objectWithoutProperties(_ref48,_excluded4);var _ref49=(0,dd.useContext)(Oe),s=_ref49.rect;var a=!!s&&s.width<600;var l=dd["default"].createElement(yet,{hasIcon:!!e,isDisabled:o,smallContainer:a},i,t);return dd["default"].createElement(get,_objectSpread({fullWidth:r,isDisabled:o,hasIcon:!!e,smallContainer:a},n),e&&dd["default"].createElement(bet,{smallContainer:a},e),(t||i)&&l);};});var M5,zp;var L5=d(function(){M5=y(_("styled-components"));Lp();zp=(0,M5["default"])(Bo)(_templateObject114||(_templateObject114=_taggedTemplateLiteral(["\n background: ",";\n color: ",";\n border: 1px solid ",";\n min-width: 32px;\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.button.outlinedPrimaryBackground;},function(i){return i.theme.button.outlinedPrimaryForeground;},function(i){return i.theme.button.outlinedBorderColor;},function(i){return i.theme.button.outlinedPrimaryForeground;});});var z5,Ea;var U5=d(function(){z5=y(_("styled-components"));Ta();Lp();Ea=(0,z5["default"])(Bo)(_templateObject115||(_templateObject115=_taggedTemplateLiteral(["\n background: ",";\n color: ",";\n border: 1px solid ",";\n\n svg {\n color: ",";\n }\n\n ","\n"])),function(i){return i.theme.button.outlinedSecondaryBackground;},function(i){return i.theme.button.outlinedSecondaryForeground;},function(i){return i.theme.button.outlinedBorderColor;},function(i){return i.theme.button.outlinedSecondaryForeground;},function(_ref50){var i=_ref50.isActive;return i&&Fo;});});var o1,n1,_et,xet,hs;var N5=d(function(){o1=y(_("react"));n1=y(_("styled-components"));Ta();$l();_et=(0,n1["default"])(yi)(_templateObject116||(_templateObject116=_taggedTemplateLiteral(["\n color: ",";\n\n svg {\n color: ",";\n }\n\n /* Repeat active styles so they are not overwritten */\n ","\n\n "," {\n display: none;\n }\n\n &:disabled {\n opacity: ",";\n }\n"])),function(i){return i.theme.foreground;},function(i){return i.theme.foreground;},function(_ref51){var i=_ref51.isActive;return i&&Fo;},zi,function(i){return i.theme.button.textInactiveOpacity;});xet=n1["default"].div(_templateObject117||(_templateObject117=_taggedTemplateLiteral(["\n display: flex;\n &:focus {\n outline: none;\n }\n"])));hs=function hs(_ref52){var i=_ref52.label,t=_ref52.icon,e=_ref52.children,r=_objectWithoutProperties(_ref52,_excluded5);return o1["default"].createElement(_et,_objectSpread({},r),o1["default"].createElement(xet,null,t));};});var H5,Up;var W5=d(function(){H5=y(_("styled-components"));Lp();Up=(0,H5["default"])(Bo)(_templateObject118||(_templateObject118=_taggedTemplateLiteral(["\n background: ",";\n color: ",";\n border: 1px solid ",";\n\n &:active {\n color: ",";\n }\n\n svg {\n color: ",";\n\n &:active {\n color: ",";\n }\n }\n"])),function(i){return i.theme.button.containedPrimaryBackground;},function(i){return i.theme.button.containedPrimaryForeground;},function(i){return i.theme.button.containedPrimaryBackground;},function(i){return i.theme.button.containedPrimaryForeground;},function(i){return i.theme.button.containedPrimaryForeground;},function(i){return i.theme.button.containedPrimaryForeground;});});var Yl,Np,vet,Cet,wet,Dr;var G5=d(function(){Yl=y(_("react"));Np=y(_("styled-components"));eC();$l();Jr();vet=function vet(){return Np.css(_templateObject119||(_templateObject119=_taggedTemplateLiteral(["\n animation: "," 0.2s linear;\n "])),Lg);};Cet=Np.css(_templateObject120||(_templateObject120=_taggedTemplateLiteral(["\n border: 1px solid ",";\n "," {\n background-color: ",";\n }\n"])),function(i){return i.theme.card.activeBorderColor;},RS,function(i){return i.theme.card.activeOverlayColor;});wet=Np["default"].button.attrs(function(i){var t={};if(i.image){t.backgroundImage="url(".concat(i.image,")");}return _objectSpread({style:t},i.style);})(_templateObject121||(_templateObject121=_taggedTemplateLiteral(["\n &&& {\n box-sizing: border-box;\n }\n\n /* basic ui text items use position absolute */\n position: relative;\n\n padding: 0;\n cursor: pointer;\n /* Safari will change the height of the toolbar and position the category cards at the bottom for some reason */\n vertical-align: top;\n border: none;\n box-sizing: border-box;\n background-size: cover;\n background-position: center center;\n background-repeat: no-repeat;\n background-color: ",";\n color: ",";\n\n border-radius: ","px;\n ",";\n animation-fill-mode: both;\n overflow: hidden;\n\n ","\n\n /* Active */\n\n /* No :active styles on purpose. */\n\n ","\n\n /* Disabled */\n\n &:disabled {\n cursor: default;\n pointer-events: none;\n\n "," {\n background-color: ",";\n }\n }\n\n /* Hover */\n\n &:hover {\n "," {\n background-color: ",";\n }\n }\n"])),function(i){return i.theme.card.background;},function(i){return i.theme.card.foreground;},function(i){return i.theme.shape.radiusMedium;},vet,di,function(_ref53){var i=_ref53.isActive;return i&&Cet;},zi,function(i){return i.theme.card.inactiveOverlayColor;},nd,function(i){return i.theme.card.hoverOverlayColor;});Dr=/*#__PURE__*/function(_Yl$default$Component){_inherits(Dr,_Yl$default$Component);var _super19=_createSuper(Dr);function Dr(){var _this30;_classCallCheck(this,Dr);_this30=_super19.apply(this,arguments);_this30.state=$b;_this30.timeout=null;_this30.onKeyDown=function(t){if(t.key==="Space"||t.key==="Enter"){if(_this30.props.onClick){_this30.props.onClick();}}};_this30.onClick=function(t){var e=t.currentTarget.getBoundingClientRect();var r=t.pageX-e.left;var o=t.pageY-e.top;if(_this30.state.display==="block"){_this30.setState({display:"none"},function(){_this30.setRippleState(r,o);});}else{_this30.setRippleState(r,o);}_this30.props.onClick(t);};_this30.setRippleState=function(t,e){_this30.setState({left:t,top:e,display:"block"});_this30.timeout=setTimeout(function(){_this30.setState({display:"none"});},1200);};return _this30;}_createClass(Dr,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout);}},{key:"render",value:function render(){var _this$props11=this.props,t=_this$props11.children,e=_this$props11.label,r=_this$props11.role,o=_this$props11["aria-label"],n=_this$props11["aria-expanded"],s=_this$props11.isActive,a=_this$props11.isDisabled,l=_this$props11.image,c=_this$props11.style,u=_this$props11.className;var _this$state3=this.state,m=_this$state3.left,p=_this$state3.top,h=_this$state3.display;return Yl["default"].createElement(wet,{role:r,"aria-expanded":n,isActive:s,"aria-label":o,"data-test":e,disabled:a,image:l,onClick:this.onClick,onKeyDown:this.onKeyDown,style:c,className:u},t,Yl["default"].createElement(Kb,{display:h,left:m,top:p}),Yl["default"].createElement(RS,null),Yl["default"].createElement(zi,null),Yl["default"].createElement(nd,null));}}]);return Dr;}(Yl["default"].Component);Dr.defaultProps={isActive:false};});var md,Er,Tet,ket,Iet,Det,Eet,Se;var V5=d(function(){md=y(_("react"));Er=y(_("styled-components"));U();Jr();Tet=Er["default"].div(_templateObject122||(_templateObject122=_taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 0 4px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n ","\n"])),function(i){return i.theme.measurements.fontSystem.label.size;},function(i){return i.theme.measurements.fontSystem.label.letterSpacing;},function(i){return i.theme.measurements.fontSystem.label["case"];},function(i){return i.withBackground?Er.css(_templateObject123||(_templateObject123=_taggedTemplateLiteral(["\n color: ",";\n "])),i.theme.card.labelForeground):Er.css(_templateObject124||(_templateObject124=_taggedTemplateLiteral(["\n color: ",";\n "])),i.theme.card.foreground);});ket=Er["default"].div(_templateObject125||(_templateObject125=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n position: absolute;\n bottom: 0px;\n border-radius: ","px;\n left: 0;\n ","\n width: 100%;\n cursor: pointer;\n"])),function(i){return i.theme.shape.radiusMedium;},function(i){return i.withBackground?Er.css(_templateObject126||(_templateObject126=_taggedTemplateLiteral(["\n color: ",";\n height: 40px;\n background: ",";\n "])),i.theme.card.labelForeground,i.theme.card.labelBackground):Er.css(_templateObject127||(_templateObject127=_taggedTemplateLiteral(["\n color: ",";\n height: 32px;\n "])),i.theme.card.foreground);});Iet=Er["default"].div(_templateObject128||(_templateObject128=_taggedTemplateLiteral(["\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid ",";\n ","\n transform: rotate(","deg);\n display: inline-block;\n transition-duration: 0.3s;\n transition-timing-function: ease-in;\n"])),function(i){return i.theme.card.labelForeground;},function(i){return i.withBackground?Er.css(_templateObject129||(_templateObject129=_taggedTemplateLiteral(["\n border-top-color: ",";\n "])),i.theme.card.labelForeground):Er.css(_templateObject130||(_templateObject130=_taggedTemplateLiteral(["\n border-top-color: ",";\n "])),i.theme.card.foreground);},function(i){return i.rotation||0;});Det=Er["default"].span(_templateObject131||(_templateObject131=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding-left: 10px;\n"])));Eet=Er["default"].div(_templateObject132||(_templateObject132=_taggedTemplateLiteral(["\n ","\n"])),Zu);Se=function Se(_ref54){var i=_ref54.children,t=_ref54.className,e=_ref54.caret,r=_ref54.isActive,o=_ref54.style,n=_ref54.withBackground,s=_ref54.hidden;if(s){return md["default"].createElement(Eet,null,i);}var a=function a(){return md["default"].createElement(Det,null,md["default"].createElement(Iet,{"aria-hidden":true,rotation:r?180:0,withBackground:n}));};return md["default"].createElement(ket,{className:t,withBackground:n,style:o},md["default"].createElement(Tet,{"data-test":N.CardLabel,withBackground:n},i,e&&a()));};});var j5,Jl;var $5=d(function(){j5=y(_("styled-components"));U();Jl=j5["default"].div.attrs(function(i){return{"data-test":N.CardAvatar,style:{backgroundImage:"url(".concat(i.url,")")}};})(_templateObject133||(_templateObject133=_taggedTemplateLiteral(["\n position: absolute;\n top: 4px;\n left: 4px;\n height: 28px;\n width: 28px;\n border-radius: 50%;\n"])));});var K5,s1,fy,a1;var X5=d(function(){K5=function K5(i){var t=[];t[0]=requestAnimationFrame(function(){t[1]=requestAnimationFrame(function(){i();});});return t;};s1=function s1(i){i.forEach(function(t){return cancelAnimationFrame(t);});};fy=function fy(i){return!Number.isNaN(parseFloat(i))&&Number.isFinite(i);};a1=function a1(i){return typeof i==="string"&&i.search("%")===i.length-1&&fy(i.substr(0,i.length-1));};});var Hp,l1,c1;var q5=d(function(){Hp=y(_("react"));X5();c1=(l1=/*#__PURE__*/function(_Hp$default$Component){_inherits(l1,_Hp$default$Component);var _super20=_createSuper(l1);function l1(i){var _this31;_classCallCheck(this,l1);_this31=_super20.call(this,i);_this31.contentRef=null;_this31.contentRef=Hp["default"].createRef();_this31.animationFrameIDs=[];var t="auto";var e="visible";if(fy(i.height)){t=i.height<0||i.height==="0"?0:i.height;e="hidden";}else if(a1(i.height)){t=i.height==="0%"?0:i.height;e="hidden";}var r=typeof window!=="undefined";if(r&&window.matchMedia){_this31.prefersReducedMotion=window.matchMedia("(prefers-reduced-motion)").matches;}_this31.state={height:t,overflow:e,shouldUseTransitions:false};return _this31;}_createClass(l1,[{key:"componentDidMount",value:function componentDidMount(){var i=this.state.height;if(this.contentRef.current&&this.contentRef.current.style){this.hideContent(i);}}},{key:"componentDidUpdate",value:function componentDidUpdate(i,t){var _this32=this;var e=this.props.height;var _this$getTimings=this.getTimings(),r=_this$getTimings.duration,o=_this$getTimings.delay;if(this.contentRef.current&&e!==i.height){this.showContent(t.height);this.contentRef.current.style.overflow="hidden";var n=this.contentRef.current.offsetHeight;this.contentRef.current.style.overflow="";var s=r+o;var a=null;var l={height:null,overflow:"hidden"};var c=t.height==="auto";if(fy(e)){a=e<0||e==="0"?0:e;l.height=a;}else if(a1(e)){a=e==="0%"?0:e;l.height=a;}else{a=n;l.height="auto";l.overflow=null;}if(c){l.height=a;a=n;}this.setState({height:a,overflow:"hidden",shouldUseTransitions:!c});clearTimeout(this.timeoutID);clearTimeout(this.animationClassesTimeoutID);if(c){s1(this.animationFrameIDs);this.animationFrameIDs=K5(function(){_this32.setState({height:l.height,overflow:l.overflow,shouldUseTransitions:true});});this.animationClassesTimeoutID=setTimeout(function(){_this32.setState({shouldUseTransitions:false});_this32.hideContent(l.height);},s);}else{this.timeoutID=setTimeout(function(){_this32.setState({height:l.height,overflow:"visible",shouldUseTransitions:false});if(e!=="auto"){_this32.hideContent(a);}},s);}}}},{key:"componentWillUnmount",value:function componentWillUnmount(){s1(this.animationFrameIDs);clearTimeout(this.timeoutID);clearTimeout(this.animationClassesTimeoutID);this.timeoutID=null;}},{key:"getTimings",value:function getTimings(){if(this.prefersReducedMotion){return{delay:0,duration:0};}var _this$props12=this.props,i=_this$props12.delay,t=_this$props12.duration;return{delay:i,duration:t};}},{key:"showContent",value:function showContent(i){if(i===0){this.contentRef.current.style.display="";}}},{key:"hideContent",value:function hideContent(i){if(i===0){this.contentRef.current.style.display="none";}}},{key:"render",value:function render(){var _this$props13=this.props,i=_this$props13.animateOpacity,t=_this$props13.children,e=_this$props13.className,r=_this$props13.easing;var _this$state4=this.state,o=_this$state4.height,n=_this$state4.overflow,s=_this$state4.shouldUseTransitions;var _this$getTimings2=this.getTimings(),a=_this$getTimings2.duration,l=_this$getTimings2.delay;var c={height:o,overflow:n};if(s){c.transition="height ".concat(a,"ms ").concat(r," ").concat(l,"ms");c.WebkitTransition=c.transition;}var u={};if(i){u.transition="opacity ".concat(a,"ms ").concat(r," ").concat(l,"ms");u.WebkitTransition=u.transition;if(o===0){u.opacity=0;}}return Hp["default"].createElement("div",{"aria-hidden":o===0,className:e,style:c},Hp["default"].createElement("div",{style:u,ref:this.contentRef},t));}}]);return l1;}(Hp["default"].Component),l1.defaultProps={animateOpacity:false,duration:250,delay:0,easing:"ease"},l1);});var Y5=d(function(){q5();});var gy,J5,P;var it=d(function(){eC();jA();QA();fS();Cp();gS();bS();oB();yS();_S();Tp();xS();Ob();Rb();vS();CB();FS();RB();LB();BS();PS();MS();YB();QB();i5();ka();$S();s5();c5();v5();VS();w5();T5();I5();E5();Jr();F5();R5();$l();Ta();Lp();L5();my();dy();U5();N5();W5();G5();V5();$5();US();Y5();gy={Focused:di,VisuallyHidden:Zu};J5={ripple:Mg,scale:QE,slide:Lg};P={Container:pS,ColorItem:ZA,ColorItemBase:wb,ColorItemBackground:Cb,ColorItemTiledBackground:Tb,ColorItemActiveOverlay:Sb,Dialog:rB,DialogBase:Db,DialogContainer:Eb,DialogBackdrop:kb,DialogHeader:td,DialogBody:ms,DialogFooter:Qu,DialogSpinner:Bb,TextEditModal:k5,ActionModal:QS,InfoModal:t1,Spacer:i1,Draggable:vB,DraggableCore:jl,Toast:O5,Input:{Label:Ui,File:ZB,Search:n5,Slider:_5,SliderBase:ny,SliderContainer:sy,SliderInput:ly,SliderTrack:uy,SliderLabel:cy,CarouselSlider:OB,Selection:l5,Checkbox:MB,CheckboxBase:qb,CheckboxInput:Yb,CheckboxCheckMark:Fp,Dropdown:HS,Text:iy,NumericInput:ry,Form:e5},Switch:{Index:r1,Case:py,Default:hy}};});var Z5,by;var Q5=d(function(){Z5=y(_("styled-components"));it();by=(0,Z5["default"])(Bo)(_templateObject134||(_templateObject134=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n\n "," {\n display: none;\n }\n\n &:disabled {\n opacity: ",";\n }\n"])),function(i){return i.theme.measurements.fontSystem.button2.size;},function(i){return i.theme.measurements.fontSystem.button2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.button2["case"];},function(i){return i.theme.button.textSecondaryForeground;},zi,function(i){return i.theme.button.textInactiveOpacity;});});var u1,d1,Fet,Oet,tP;var eP=d(function(){u1=y(_("react"));d1=y(_("styled-components"));it();Fet=(0,d1["default"])(yi)(_templateObject135||(_templateObject135=_taggedTemplateLiteral(["\n width: 60px;\n height: 60px;\n background-color: gray;\n border-radius: 50%;\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n z-index: ",";\n padding: 2px;\n"])),function(i){return i.theme.measurements.zIndex.button["float"];});Oet=d1["default"].div(_templateObject136||(_templateObject136=_taggedTemplateLiteral(["\n height: 56px;\n width: 56px;\n border-radius: 50%;\n background-color: ",";\n"])),function(i){return i.theme.webcam.floatButton;});tP=function tP(i){return u1["default"].createElement(Fet,_objectSpread({},i),u1["default"].createElement(Oet,null));};});var Zl,iP,_n,Wp;var rP=d(function(){Zl=y(_("styled-components"));it();iP=Zl["default"].div(_templateObject137||(_templateObject137=_taggedTemplateLiteral(["\n display: inline-flex;\n"])));_n=(0,Zl["default"])(Bo)(_templateObject138||(_templateObject138=_taggedTemplateLiteral(["\n background: ",";\n color: ",";\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n padding: 4px 10px;\n position: relative;\n /* for safari */\n margin: 0;\n &:last-child:after {\n opacity: 0;\n }\n"])),function(i){return i.theme.canvasActionBar.background;},function(i){return i.theme.canvasActionBar.foreground;},function(i){return i.theme.measurements.fontSystem.button2.size;},function(i){return i.theme.measurements.fontSystem.button2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.button2["case"];});Wp=Zl["default"].div(_templateObject139||(_templateObject139=_taggedTemplateLiteral(["\n ",";\n position: absolute;\n transform: translate(-50%, -100%);\n background: ",";\n color: ",";\n border-radius: ","px;\n white-space: nowrap;\n transition: opacity 0.3s ease-in-out;\n z-index: ",";\n\n "," {\n &:after {\n content: '';\n position: absolute;\n right: 0px;\n top: 6px;\n height: calc(100% - 12px);\n border-right: 1px solid\n ",";\n &:last-child {\n border-right: unset;\n }\n }\n }\n"])),function(_ref55){var i=_ref55.show;return i?Zl.css(_templateObject140||(_templateObject140=_taggedTemplateLiteral(["\n opacity: 1;\n "]))):Zl.css(_templateObject141||(_templateObject141=_taggedTemplateLiteral(["\n opacity: 0;\n "])));},function(i){return i.theme.canvasActionBar.background;},function(i){return i.theme.canvasActionBar.foreground;},function(i){return i.theme.canvasActionBar.borderRadius?i.theme.canvasActionBar.borderRadius:i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.zIndex.buttonGroup;},_n,function(i){return i.theme.canvasActionBar.separatorColor;});});var yy=d(function(){Q5();eP();rP();});function D(){return(0,oP.useContext)(tp);}var oP;var W=d(function(){oP=_("react");B();});var fs,Ret,nP;var sP=d(function(){fs=y(_("react"));Ret=function Ret(){return fs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},fs["default"].createElement("defs",null,fs["default"].createElement("path",{id:"photoeditorsdk-blacks-icon",d:"M24 12c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12m0 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10m4 12c0 2.788-2.326 3.879-7 3V18.5c4.148-.459 6.516.226 6.516 2.623 0 1.207-.492 1.998-1.512 2.474C27.504 23.999 28 24.619 28 26zm-5-6v3c2.244.068 2.775-.719 2.775-1.536 0-1.22-.531-1.812-2.775-1.464zm0 7.5c2.19.193 3.038-.04 3.038-1.484 0-1.37-1.096-1.695-3.038-1.516v3z"})),fs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},fs["default"].createElement("path",{d:"M0 0H48V48H0z"}),fs["default"].createElement("mask",{fill:"currentColor"},fs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-blacks-icon"})),fs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-blacks-icon"})));};nP=Ret;});var Fa,Aet,aP;var lP=d(function(){Fa=y(_("react"));Aet=function Aet(){return Fa["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},Fa["default"].createElement("defs",null,Fa["default"].createElement("path",{id:"photoeditorsdk-brightness-icon",d:"M22.185 33.836c.594.109 1.2.164 1.815.164v2c-.735 0-1.462-.066-2.175-.197zm5.58-.568l.753 1.852c-.675.275-1.375.487-2.093.635l-.402-1.96c.597-.122 1.18-.299 1.741-.527zm-9.446-1.037c.5.346 1.03.646 1.586.895l-.82 1.824c-.666-.3-1.303-.66-1.903-1.074zm12.884-1.295l1.44 1.388a12.06 12.06 0 01-1.65 1.429l-1.167-1.625a10.06 10.06 0 001.377-1.192zm-15.758-1.754c.316.52.679 1.01 1.083 1.464l-1.493 1.33a12.038 12.038 0 01-1.3-1.756zm17.97-1.802l1.882.676a11.948 11.948 0 01-.925 1.982l-1.727-1.008a9.948 9.948 0 00.77-1.65zM24 18c.091 0 .182.002.273.006L24 18a6.071 6.071 0 01.668.037l.192.024a5.974 5.974 0 011.847.585l.01.005a5.992 5.992 0 011.154.768A5.99 5.99 0 0130 24c0 3.309-2.691 6-6 6a5.985 5.985 0 01-4.404-1.929l.163.17a6.052 6.052 0 01-1.353-2.07A5.951 5.951 0 0118 24c0-3.309 2.691-6 6-6zm2.827 3.173l-5.654 5.654A3.988 3.988 0 0024 28c2.206 0 4-1.794 4-4a3.988 3.988 0 00-1.173-2.827zM14.08 25.268c.076.606.208 1.2.392 1.777l-1.905.608a11.936 11.936 0 01-.472-2.134zm21.885-2.192a12.16 12.16 0 01-.032 2.198l-1.989-.21a10.193 10.193 0 00.027-1.836zM12.522 20.49l1.912.584a9.943 9.943 0 00-.37 1.783l-1.987-.226c.083-.73.232-1.445.445-2.14zm22.059-2.155c.345.643.63 1.316.853 2.013l-1.905.608a9.934 9.934 0 00-.71-1.676zm-19.587-2.266l1.5 1.323c-.402.456-.762.948-1.075 1.47l-1.715-1.03c.376-.625.808-1.215 1.29-1.763zm16.272-1.62c.58.442 1.12.936 1.61 1.476l-1.479 1.346c-.41-.45-.859-.862-1.343-1.23zm-12.241-1.372l.83 1.82a9.986 9.986 0 00-1.58.903l-1.147-1.638a11.986 11.986 0 011.897-1.085zm7.7-.766c.714.166 1.408.396 2.076.688L28 14.832a9.916 9.916 0 00-1.727-.573zm-2.857-.31l.021 2c-.613.006-1.22.068-1.812.184l-.383-1.964a12.046 12.046 0 012.174-.22z"})),Fa["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Fa["default"].createElement("mask",null,Fa["default"].createElement("use",{xlinkHref:"#photoeditorsdk-brightness-icon"})),Fa["default"].createElement("use",{fillOpacity:"0.9",transform:"rotate(-45 24.039 24)",xlinkHref:"#photoeditorsdk-brightness-icon"})));};aP=Aet;});var gs,Bet,cP;var uP=d(function(){gs=y(_("react"));Bet=function Bet(){return gs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},gs["default"].createElement("defs",null,gs["default"].createElement("path",{id:"photoeditorsdk-clarity-icon",d:"M24 12L13 24.001 24 36l11-11.999L24 12zm-8.29 12.001H21l3-9.041 8.29 9.041-8.28 9.029L28 24.001h-7l2.99 9.029-8.28-9.029z"})),gs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},gs["default"].createElement("path",{d:"M0 0H48V48H0z"}),gs["default"].createElement("mask",{fill:"currentColor"},gs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-clarity-icon"})),gs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-clarity-icon"})));};cP=Bet;});var bs,Pet,dP;var mP=d(function(){bs=y(_("react"));Pet=function Pet(){return bs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},bs["default"].createElement("defs",null,bs["default"].createElement("path",{id:"photoeditorsdk-contrast-icon",d:"M24 34V14c5.51 0 10 4.49 10 10s-4.49 10-10 10m0-22c-6.62 0-12 5.38-12 12s5.38 12 12 12 12-5.38 12-12-5.38-12-12-12"})),bs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},bs["default"].createElement("path",{d:"M0 0H48V48H0z"}),bs["default"].createElement("mask",{fill:"currentColor"},bs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-contrast-icon"})),bs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-contrast-icon"})));};dP=Pet;});var ys,Met,pP;var hP=d(function(){ys=y(_("react"));Met=function Met(){return ys["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},ys["default"].createElement("defs",null,ys["default"].createElement("path",{id:"photoeditorsdk-exposure-icon",d:"M24 34V14c5.51 0 10 4.49 10 10s-4.49 10-10 10m0-22c6.62 0 12 5.38 12 12s-5.38 12-12 12-12-5.38-12-12 5.38-12 12-12zm-3.536 8.464l-2.121 2.122-2.121-2.122-1.414 1.415L16.929 24l-2.121 2.121 1.414 1.415 2.121-2.122 2.121 2.122 1.415-1.415L19.757 24l2.122-2.121-1.415-1.415zm5.304 4.597l4.242-4.243 1.415 1.414-4.243 4.243-1.414-1.414z"})),ys["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},ys["default"].createElement("path",{d:"M0 0H48V48H0z"}),ys["default"].createElement("mask",{fill:"currentColor"},ys["default"].createElement("use",{xlinkHref:"#photoeditorsdk-exposure-icon"})),ys["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",transform:"rotate(45 24 24)",xlinkHref:"#photoeditorsdk-exposure-icon"})));};pP=Met;});var _s,Let,fP;var gP=d(function(){_s=y(_("react"));Let=function Let(){return _s["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},_s["default"].createElement("defs",null,_s["default"].createElement("path",{id:"photoeditorsdk-gamma-icon",d:"M22.185 33.836c.594.109 1.2.164 1.815.164v2c-.735 0-1.462-.066-2.175-.197zm5.58-.568l.753 1.852c-.675.275-1.375.487-2.093.635l-.402-1.96c.597-.122 1.18-.299 1.741-.527zm-9.446-1.037c.5.346 1.03.646 1.586.895l-.82 1.824c-.666-.3-1.303-.66-1.903-1.074zm12.884-1.295l1.44 1.388a12.06 12.06 0 01-1.65 1.429l-1.167-1.625a10.06 10.06 0 001.377-1.192zm-15.758-1.754c.316.52.679 1.01 1.083 1.464l-1.493 1.33a12.038 12.038 0 01-1.3-1.756zm17.97-1.802l1.882.676a11.948 11.948 0 01-.925 1.982l-1.727-1.008a9.948 9.948 0 00.77-1.65zM24 18c.091 0 .182.002.273.006L24 18a6.071 6.071 0 01.668.037l.192.024a5.974 5.974 0 011.847.585l.01.005a5.992 5.992 0 011.154.768A5.99 5.99 0 0130 24c0 3.309-2.691 6-6 6a5.985 5.985 0 01-4.404-1.929l.163.17a6.052 6.052 0 01-1.353-2.07A5.951 5.951 0 0118 24c0-3.309 2.691-6 6-6zm2.827 3.173l-5.654 5.654A3.988 3.988 0 0024 28c2.206 0 4-1.794 4-4a3.988 3.988 0 00-1.173-2.827zM14.08 25.268c.076.606.208 1.2.392 1.777l-1.905.608a11.936 11.936 0 01-.472-2.134zm21.885-2.192a12.16 12.16 0 01-.032 2.198l-1.989-.21a10.193 10.193 0 00.027-1.836zM12.522 20.49l1.912.584a9.943 9.943 0 00-.37 1.783l-1.987-.226c.083-.73.232-1.445.445-2.14zm22.059-2.155c.345.643.63 1.316.853 2.013l-1.905.608a9.934 9.934 0 00-.71-1.676zm-19.587-2.266l1.5 1.323c-.402.456-.762.948-1.075 1.47l-1.715-1.03c.376-.625.808-1.215 1.29-1.763zm16.272-1.62c.58.442 1.12.936 1.61 1.476l-1.479 1.346c-.41-.45-.859-.862-1.343-1.23zm-12.241-1.372l.83 1.82a9.986 9.986 0 00-1.58.903l-1.147-1.638a11.986 11.986 0 011.897-1.085zm7.7-.766c.714.166 1.408.396 2.076.688L28 14.832a9.916 9.916 0 00-1.727-.573zm-2.857-.31l.021 2c-.613.006-1.22.068-1.812.184l-.383-1.964a12.046 12.046 0 012.174-.22z"})),_s["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},_s["default"].createElement("path",{d:"M0 0H48V48H0z"}),_s["default"].createElement("mask",{fill:"#fff"},_s["default"].createElement("use",{xlinkHref:"#photoeditorsdk-gamma-icon"})),_s["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-gamma-icon"})));};fP=Let;});var xs,zet,bP;var yP=d(function(){xs=y(_("react"));zet=function zet(){return xs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},xs["default"].createElement("defs",null,xs["default"].createElement("path",{id:"photoeditorsdk-highlights-icon",d:"M31.07 31.07A9.932 9.932 0 0124 34c-2.67 0-5.18-1.04-7.07-2.93l14.14-14.14c3.9 3.9 3.9 10.24 0 14.14m1.42-15.56A11.995 11.995 0 0024 12c-3.07 0-6.14 1.17-8.49 3.51-4.68 4.69-4.68 12.29 0 16.98C17.86 34.83 20.93 36 24 36c3.07 0 6.14-1.17 8.49-3.51 4.68-4.69 4.68-12.29 0-16.98"})),xs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},xs["default"].createElement("path",{d:"M0 0H48V48H0z"}),xs["default"].createElement("mask",{fill:"currentColor"},xs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-highlights-icon"})),xs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-highlights-icon"})));};bP=zet;});var vs,Uet,_P;var xP=d(function(){vs=y(_("react"));Uet=function Uet(){return vs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},vs["default"].createElement("defs",null,vs["default"].createElement("path",{id:"photoeditorsdk-saturation-icon",d:"M17 31c1.334 1.099 2 2.177 2 3.234 0 .797-.454 1.39-1.211 1.655-.165.057-.428.094-.789.111l-.172-.01a2.54 2.54 0 01-.617-.101C15.454 35.624 15 35.03 15 34.234c0-1.057.666-2.135 2-3.234zm8.7-6l-4.24 4H17v-3.81l.2-.19h8.5zm-.7-7.59l4.24 4.25L26.76 24h-8.54L25 17.41zm7.778-3.532a3 3 0 01.135 4.1l-.135.143-1.414 1.414 1.414 1.415-1.414 1.414-7.07-7.071 1.413-1.414 1.414 1.413 1.414-1.414a3.001 3.001 0 014.243 0z"})),vs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},vs["default"].createElement("path",{d:"M0 0H48V48H0z"}),vs["default"].createElement("mask",{fill:"currentColor"},vs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-saturation-icon"})),vs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-saturation-icon"})));};_P=Uet;});var Cs,Net,vP;var CP=d(function(){Cs=y(_("react"));Net=function Net(){return Cs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},Cs["default"].createElement("defs",null,Cs["default"].createElement("path",{id:"photoeditorsdk-shadows-icon",d:"M30.365 17.637l3.076 3.076c.382 1.09.566 2.234.56 3.387l-5.05-5.049-1.414 1.414 6.123 6.124a9.674 9.674 0 01-.792 2.036l-6.746-6.745-1.414 1.414 7.036 7.036c-.212.254-.43.502-.672.742-.24.24-.488.46-.742.672l-7.036-7.036-1.414 1.414 6.745 6.746a9.674 9.674 0 01-2.036.792l-6.124-6.123-1.414 1.414L24.101 34a10.012 10.012 0 01-3.388-.558l-3.076-3.076-.707.707c-3.896-3.896-3.896-10.246 0-14.142 3.896-3.896 10.246-3.896 14.142 0l-.707.707zm-14.849-2.12c-4.688 4.687-4.688 12.281 0 16.97a12.036 12.036 0 004.108 2.693c.064.022.127.057.191.078 4.264 1.577 9.242.658 12.671-2.772 3.43-3.429 4.35-8.407 2.772-12.67-.02-.065-.056-.128-.078-.192a12.036 12.036 0 00-2.694-4.108c-4.688-4.688-12.282-4.688-16.97 0z"})),Cs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Cs["default"].createElement("path",{d:"M0 0H48V48H0z"}),Cs["default"].createElement("mask",{fill:"currentColor"},Cs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-shadows-icon"})),Cs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-shadows-icon"})));};vP=Net;});var Ss,Het,SP;var wP=d(function(){Ss=y(_("react"));Het=function Het(){return Ss["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},Ss["default"].createElement("defs",null,Ss["default"].createElement("path",{id:"photoeditorsdk-sharpness-icon",d:"M24 12l11 24H13l11-24zm0 4.8V34h7.883L24 16.8z"})),Ss["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ss["default"].createElement("path",{d:"M0 0H48V48H0z"}),Ss["default"].createElement("mask",{fill:"currentColor"},Ss["default"].createElement("use",{xlinkHref:"#photoeditorsdk-sharpness-icon"})),Ss["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-sharpness-icon"})));};SP=Het;});var ws,Wet,TP;var kP=d(function(){ws=y(_("react"));Wet=function Wet(){return ws["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},ws["default"].createElement("defs",null,ws["default"].createElement("path",{id:"photoeditorsdk-temperature-icon",d:"M24 12a4 4 0 014 4v7.255a7 7 0 11-8 0V16a4 4 0 014-4zm0 2a2 2 0 00-2 2v8.298l-.856.597a5 5 0 105.712 0L26 24.298V16a2 2 0 00-2-2zm1 6v5.126A4.002 4.002 0 0124 33a4 4 0 01-1-7.874V20h2z"})),ws["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},ws["default"].createElement("path",{d:"M0 0H48V48H0z"}),ws["default"].createElement("mask",{fill:"currentColor"},ws["default"].createElement("use",{xlinkHref:"#photoeditorsdk-temperature-icon"})),ws["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-temperature-icon"})));};TP=Wet;});var Ts,Get,IP;var DP=d(function(){Ts=y(_("react"));Get=function Get(){return Ts["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},Ts["default"].createElement("defs",null,Ts["default"].createElement("path",{id:"photoeditorsdk-whites-icon",d:"M24 12c6.627 0 12 5.373 12 12s-5.373 12-12 12-12-5.373-12-12 5.373-12 12-12zm-2 6.46h-2c.221 4.539.762 9.051 1 11.04h1.5l1.5-5.52 1.5 5.52H27c.238-1.989.779-6.501 1-11.04h-2c-.051 1.071-.432 7.446-.5 7.973-.459-1.717-.541-3.111-1-4.811h-1c-.442 1.7-.541 2.975-1 4.811-.051-.527-.466-6.902-.5-7.973z"})),Ts["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ts["default"].createElement("path",{d:"M0 0H48V48H0z"}),Ts["default"].createElement("mask",{fill:"currentColor"},Ts["default"].createElement("use",{xlinkHref:"#photoeditorsdk-whites-icon"})),Ts["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-whites-icon"})));};IP=Get;});var Oa,Vet,EP;var FP=d(function(){Oa=y(_("react"));Vet=function Vet(){return Oa["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Oa["default"].createElement("defs",null,Oa["default"].createElement("path",{id:"photoeditorsdk-close-icon",d:"M21.583 0L24 2.416 14.416 12 24 21.584 21.583 24 12 14.416 2.417 24 0 21.584 9.584 12 0 2.416 2.417 0 12 9.584 21.583 0z"})),Oa["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Oa["default"].createElement("mask",{fill:"currentColor"},Oa["default"].createElement("use",{xlinkHref:"#photoeditorsdk-close-icon"})),Oa["default"].createElement("use",{fill:"currentColor",fillRule:"nonzero",xlinkHref:"#photoeditorsdk-close-icon"})));};EP=Vet;});function jet(){return Ra["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Ra["default"].createElement("defs",null,Ra["default"].createElement("path",{id:"photoeditorsdk-export-icon",d:"M22 1.5a1.5 1.5 0 011.493 1.356L23.5 3H22h1.5v17a1.5 1.5 0 01-1.5 1.5H12a1.5 1.5 0 01-1.493-1.356L10.5 20v-6h2v5.499h9v-16h-9V9h-2V3A1.5 1.5 0 0112 1.5h10zM6.15 5.817L7.634 7.3l-3.171 3.171h13.978v2H4.47l3.171 3.17-1.483 1.483L.5 11.467l5.65-5.65z"})),Ra["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ra["default"].createElement("mask",{fill:"#fff"},Ra["default"].createElement("use",{xlinkHref:"#photoeditorsdk-export-icon"})),Ra["default"].createElement("use",{fill:"currentcolor",fillOpacity:"0.9",transform:"rotate(90 12 11.5)",xlinkHref:"#photoeditorsdk-export-icon"})));}var Ra,OP;var RP=d(function(){Ra=y(_("react"));OP=jet;});var Aa,$et,AP;var BP=d(function(){Aa=y(_("react"));$et=function $et(){return Aa["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"25",height:"25",viewBox:"0 0 25 25"},Aa["default"].createElement("defs",null,Aa["default"].createElement("path",{id:"photoeditorsdk-redo-icon",d:"M4 10.065C4 4.506 8.365 0 13.75 0s9.75 4.506 9.75 10.065v9.29h-3v-9.29c0-3.849-3.022-6.968-6.75-6.968S7 6.217 7 10.065v7.741h3L5.5 24 1 17.806h3v-7.741z"})),Aa["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Aa["default"].createElement("mask",{fill:"currentColor"},Aa["default"].createElement("use",{xlinkHref:"#photoeditorsdk-redo-icon"})),Aa["default"].createElement("use",{fill:"currentColor",transform:"matrix(0 1 1 0 .25 -.25)",xlinkHref:"#photoeditorsdk-redo-icon"})));};AP=$et;});var Ba,Ket,PP;var MP=d(function(){Ba=y(_("react"));Ket=function Ket(){return Ba["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"25",height:"25",viewBox:"0 0 25 25"},Ba["default"].createElement("defs",null,Ba["default"].createElement("path",{id:"photoeditorsdk-undo-icon",d:"M4 10.065C4 4.506 8.365 0 13.75 0s9.75 4.506 9.75 10.065v9.29h-3v-9.29c0-3.849-3.022-6.968-6.75-6.968S7 6.217 7 10.065v7.741h3L5.5 24 1 17.806h3v-7.741z"})),Ba["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ba["default"].createElement("mask",{fill:"currentColor"},Ba["default"].createElement("use",{xlinkHref:"#photoeditorsdk-undo-icon"})),Ba["default"].createElement("use",{fill:"currentColor",transform:"rotate(90 12.25 12)",xlinkHref:"#photoeditorsdk-undo-icon"})));};PP=Ket;});function Xet(){return Pa["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",focusable:"false","aria-hidden":"true","aria-label":"Center Align",width:"26",height:"26"},Pa["default"].createElement("defs",null,Pa["default"].createElement("path",{id:"photoeditorsdk-align-center-icon",d:"M31.5 30v3h-15v-3h15zm4.5-7.5v3H12v-3h24zm0-7.5v3H12v-3h24z"})),Pa["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Pa["default"].createElement("mask",{fill:"#fff"},Pa["default"].createElement("use",{xlinkHref:"#photoeditorsdk-align-center-icon"})),Pa["default"].createElement("use",{fill:"currentColor",xlinkHref:"#photoeditorsdk-align-center-icon"})));}var Pa,LP;var zP=d(function(){Pa=y(_("react"));LP=Xet;});var Ma,qet,UP;var NP=d(function(){Ma=y(_("react"));qet=function qet(){return Ma["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",focusable:"false","aria-hidden":"true","aria-label":"Left Align",width:"26",height:"26"},Ma["default"].createElement("defs",null,Ma["default"].createElement("path",{id:"photoeditorsdk-align-left-icon",d:"M27 30v3H12v-3h15zm9-7.5v3H12v-3h24zm0-7.5v3H12v-3h24z"})),Ma["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ma["default"].createElement("mask",{fill:"#fff"},Ma["default"].createElement("use",{xlinkHref:"#photoeditorsdk-align-left-icon"})),Ma["default"].createElement("use",{fill:"currentColor",xlinkHref:"#photoeditorsdk-align-left-icon"})));};UP=qet;});function Yet(){return ks["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",width:"26",height:"26",focusable:"false","aria-hidden":"true","aria-label":"Right Align"},ks["default"].createElement("defs",null,ks["default"].createElement("path",{id:"photoeditorsdk-align-right-icon",d:"M27 30v3H12v-3h15zm9-7.5v3H12v-3h24zm0-7.5v3H12v-3h24z"})),ks["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},ks["default"].createElement("path",{d:"M0 0H48V48H0z"}),ks["default"].createElement("mask",{fill:"#fff"},ks["default"].createElement("use",{xlinkHref:"#photoeditorsdk-align-right-icon"})),ks["default"].createElement("use",{fill:"currentColor",transform:"matrix(-1 0 0 1 48 0)",xlinkHref:"#photoeditorsdk-align-right-icon"})));}var ks,HP;var WP=d(function(){ks=y(_("react"));HP=Yet;});var _i,Jet,GP;var VP=d(function(){_i=y(_("react"));Jet=function Jet(){return _i["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Adjustments",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},_i["default"].createElement("g",{fill:"none",fillRule:"evenodd"},_i["default"].createElement("g",null,_i["default"].createElement("g",{fill:"#D8D8D8",opacity:"0"},_i["default"].createElement("rect",{width:"48",height:"48"})),_i["default"].createElement("g",{transform:"translate(12 12)"},_i["default"].createElement("rect",{fill:"#D8D8D8",opacity:"0",width:"24",height:"24"}),_i["default"].createElement("g",{transform:"translate(2 13)",fill:"currentColor"},_i["default"].createElement("path",{d:"M3.02746439,4 C3.00931666,4.16416693 3,4.33099545 3,4.5 C3,4.66900455 3.00931666,4.83583307 3.02746439,5 L0,5 L0,4 L3.02746439,4 Z M13,4 L20,4 L20,5 L13,5 L13,4 Z",fillOpacity:"0.2"}),_i["default"].createElement("path",{d:"M5.09842503,6.29819429 C5.0340931,6.05140089 5,5.7851211 5,5.5 C5,3.56700338 6.56700338,2 8.5,2 C8.7851211,2 9.05140089,2.0340931 9.29819429,2.09842503 C10.0278893,2.64566496 10.5,3.5176988 10.5,4.5 C10.5,6.15685425 9.15685425,7.5 7.5,7.5 C6.5176988,7.5 5.64566496,7.02788926 5.09842503,6.29819429 Z M11.1637159,7.11349161 C10.874061,7.51881791 10.5188179,7.87406095 10.1134916,8.16371592 C10.5772175,7.93004328 10.9300433,7.5772175 11.1637159,7.11349161 Z",fillOpacity:"0.2"}),_i["default"].createElement("path",{d:"M7.5,7.5 C9.15685425,7.5 10.5,6.15685425 10.5,4.5 C10.5,2.84314575 9.15685425,1.5 7.5,1.5 C5.84314575,1.5 4.5,2.84314575 4.5,4.5 C4.5,6.15685425 5.84314575,7.5 7.5,7.5 Z M7.5,9 C5.01471863,9 3,6.98528137 3,4.5 C3,2.01471863 5.01471863,0 7.5,0 C9.98528137,0 12,2.01471863 12,4.5 C12,6.98528137 9.98528137,9 7.5,9 Z",fillOpacity:"0.87"})),_i["default"].createElement("g",{transform:"rotate(-180 11 5.5)",fill:"currentColor"},_i["default"].createElement("path",{d:"M11.9725356,4 L20,4 L20,5 L11.9725356,5 C11.9906833,4.83583307 12,4.66900455 12,4.5 C12,4.33099545 11.9906833,4.16416693 11.9725356,4 Z M0,4 L2,4 L2,5 L0,5 L0,4 Z",fillOpacity:"0.2"}),_i["default"].createElement("g",{transform:"rotate(-180 5 3.5)",fillOpacity:"0.2"},_i["default"].createElement("path",{d:"M0.0984250251,4.29819429 C0.0340930963,4.05140089 0,3.7851211 0,3.5 C0,1.56700338 1.56700338,0 3.5,0 C3.7851211,0 4.05140089,0.0340930963 4.29819429,0.0984250251 C5.02788926,0.645664963 5.5,1.5176988 5.5,2.5 C5.5,4.15685425 4.15685425,5.5 2.5,5.5 C1.5176988,5.5 0.645664963,5.02788926 0.0984250251,4.29819429 Z M6.16371592,5.11349161 C5.87406095,5.51881791 5.51881791,5.87406095 5.11349161,6.16371592 C5.5772175,5.93004328 5.93004328,5.5772175 6.16371592,5.11349161 Z"})),_i["default"].createElement("path",{d:"M7.5,7.5 C9.15685425,7.5 10.5,6.15685425 10.5,4.5 C10.5,2.84314575 9.15685425,1.5 7.5,1.5 C5.84314575,1.5 4.5,2.84314575 4.5,4.5 C4.5,6.15685425 5.84314575,7.5 7.5,7.5 Z M7.5,9 C5.01471863,9 3,6.98528137 3,4.5 C3,2.01471863 5.01471863,-3.6739404e-16 7.5,-3.6739404e-16 C9.98528137,-3.6739404e-16 12,2.01471863 12,4.5 C12,6.98528137 9.98528137,9 7.5,9 Z",fillOpacity:"0.87"}))))));};GP=Jet;});function Zet(){return La["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Brush",width:"48",height:"48",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},La["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},La["default"].createElement("path",{fillOpacity:"0.87",d:"M14.73 18.86C13.293 19.503 11.624 20 10 20 2 20 0 13 0 10c.486.972 2.37 5.848 7.537 4.165C7.873 17.125 10.427 19 13 19c.6 0 1.177-.05 1.73-.14zM8.422 8.63a7.352 7.352 0 00-1.127 1.616L2.401 3.705c-.215-.287-.178-.807.072-1.056l.088-.088L8.5 8.5l-.078.13z",opacity:"0.5",transform:"translate(12 12) translate(2 2)"}),La["default"].createElement("path",{fillOpacity:"0.87",d:"M7.295 10.246c-.27.526-.48 1.09-.615 1.68L1.2 4.603c-.663-.885-.564-2.24.212-3.015l.176-.176c.78-.78 2.121-.881 3.015-.212l7.245 5.421a6.088 6.088 0 00-1.67.624L3.706 2.401c-.294-.22-.801-.184-1.056.072l-.176.176c-.25.25-.287.769-.072 1.056l4.894 6.54z",transform:"translate(12 12) translate(2 2)"}),La["default"].createElement("path",{fillOpacity:"0.87",d:"M9.702 6.554c-.185-.869-.151-.71-.207-.955C8.88 2.902 8.145 2 6 2 3.98 2 2 4.08 2 6.5c0 2.294 1.835 4 4 4 1.545 0 2.915-.342 4.544-1.088-.332-.7-.578-1.619-.842-2.858z",opacity:"0.5",transform:"translate(12 12) translate(2 2) translate(7 7)"}),La["default"].createElement("path",{fillOpacity:"0.25",d:"M10.379 9.027c.053.135.108.263.165.385C8.914 10.158 7.545 10.5 6 10.5c-2.165 0-4-1.706-4-4 0-1.528.79-2.921 1.88-3.74-.882 2.084-1.025 6.482 6.499 6.267z",transform:"translate(12 12) translate(2 2) translate(7 7)"}),La["default"].createElement("path",{fillOpacity:"0.87",d:"M9.702 6.554c-.185-.869-.151-.71-.207-.955C8.88 2.902 8.145 2 6 2 3.98 2 2 4.08 2 6.5c0 2.294 1.835 4 4 4 1.545 0 2.915-.342 4.544-1.088-.332-.7-.578-1.619-.842-2.858zM6 12C3.239 12 .5 9.842.5 6.5S3.239.5 6 .5c6.5 0 4 8 7 9.342C11 10.947 8.761 12 6 12z",transform:"translate(12 12) translate(2 2) translate(7 7)"})));}var La,jP;var $P=d(function(){La=y(_("react"));jP=Zet;});var Po,Qet,KP;var XP=d(function(){Po=y(_("react"));Qet=function Qet(){return Po["default"].createElement("svg",{"aria-hidden":"true",focusable:"false","aria-label":"Filter",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},Po["default"].createElement("g",{fill:"none",fillRule:"evenodd"},Po["default"].createElement("g",null,Po["default"].createElement("g",{fill:"#D8D8D8",opacity:"0"},Po["default"].createElement("rect",{width:"48",height:"48"})),Po["default"].createElement("g",{transform:"translate(16 14)",fill:"currentColor"},Po["default"].createElement("g",null,Po["default"].createElement("path",{d:"M1.53468397,11.3244256 C2.30584171,10.1516526 4.0927284,8.69757613 8,10 C11.5643313,11.1881104 13.1877038,10.2588113 13.9183327,9.30853287 C14.2918933,10.1286474 14.5,11.0400207 14.5,12 C14.5,15.5898509 11.5898509,18.5 8,18.5 C4.41014913,18.5 1.5,15.5898509 1.5,12 C1.5,11.7718729 1.51175212,11.5464906 1.53468397,11.3244256 Z",fillOpacity:"0.2"}),Po["default"].createElement("path",{d:"M1.53471819,12.6759057 C2.39408133,13.5811739 4.12541941,14.1109247 5.5,13.5 C9.81068889,11.5841383 9.99203585,9.66827654 14.3948028,10.8290113 C14.4639074,11.2088572 14.5,11.6002137 14.5,12 C14.5,15.5898509 11.5898509,18.5 8,18.5 C4.63838968,18.5 1.87279864,15.9481381 1.53471819,12.6759057 Z",fillOpacity:"0.25"}),Po["default"].createElement("path",{d:"M11,1.44328993e-15 L11,4.58151705 C13.9318303,5.7682918 16,8.64262245 16,12 C16,16.418278 12.418278,20 8,20 C3.581722,20 0,16.418278 0,12 C0,8.64262245 2.06816966,5.7682918 5,4.58151705 L5,1.60982339e-15 L6.5,1.44328993e-15 L6.5,5.67393184 C3.6333,6.35109564 1.5,8.92641836 1.5,12 C1.5,15.5898509 4.41014913,18.5 8,18.5 C11.5898509,18.5 14.5,15.5898509 14.5,12 C14.5,8.92641836 12.3667,6.35109564 9.5,5.67393184 L9.5,1.77635684e-15 L11,1.44328993e-15 Z",fillOpacity:"0.87"}))))));};KP=Qet;});var eo,tit,qP;var YP=d(function(){eo=y(_("react"));tit=function tit(){return eo["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Focus",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},eo["default"].createElement("g",{fill:"none",fillRule:"evenodd"},eo["default"].createElement("g",null,eo["default"].createElement("g",{fill:"#D8D8D8",opacity:"0"},eo["default"].createElement("rect",{width:"48",height:"48"})),eo["default"].createElement("g",{transform:"translate(12 12)"},eo["default"].createElement("rect",{fill:"#D8D8D8",opacity:"0",width:"24",height:"24"}),eo["default"].createElement("g",{transform:"translate(4 2)",fill:"currentColor"},eo["default"].createElement("path",{d:"M8.51312274,19.9836057 C8.77273397,19.9669655 9.02898229,19.9377873 9.2812837,19.8966625 C9.14309542,19.9643562 9.04607398,20 9,20 C8.83633495,20 8.67398178,19.9944755 8.51312274,19.9836057 Z M2.27242753,15.0235117 C2.09503729,14.4174909 2,13.7771617 2,13.115 C2,8.89625769 7.39855682,4.1952443 9.03524007,2.8669743 C9.66704719,3.45933018 10.2896864,4.09178959 10.8802638,4.75434357 C12.9939648,7.12565193 14.310818,9.45010207 14.481291,11.4644804 C14.4937541,11.6117488 14.5,11.7569175 14.5,11.9 C14.5,15.5490785 11.5855665,18.5 8,18.5 C5.525182,18.5 3.37015673,17.0943182 2.27242753,15.0235117 Z M15.999821,11.9547651 C15.9999402,11.9698392 16,11.9849176 16,12 C16,12.0581275 15.9984809,12.1163475 15.9954873,12.1746435 C15.9978914,12.1015915 15.9993401,12.0282946 15.999821,11.9547651 Z",fillOpacity:"0.2"}),eo["default"].createElement("path",{d:"M3.47269084,16.6357644 C3.47244857,13.6389249 9.59189484,15.3529683 12,11.5 C13.2066771,9.56931667 12.316614,7.05620551 11.0727604,4.97270186 C13.0737756,7.26814668 14.316054,9.51197209 14.481291,11.4644804 C14.4937541,11.6117488 14.5,11.7569175 14.5,11.9 C14.5,15.5490785 11.5855665,18.5 8,18.5 C6.2411126,18.5 4.64375705,17.7899702 3.47269084,16.6357644 Z",fillOpacity:"0.25"}),eo["default"].createElement("path",{d:"M7.73975027,2.16383649 C6.84545319,2.94914111 5.95084629,3.82194197 5.11973623,4.75434357 C3.00603518,7.12565193 1.68918197,9.45010207 1.51870896,11.4644804 C1.50624591,11.6117488 1.5,11.7569175 1.5,11.9 C1.5,15.5492218 4.41434886,18.5 8,18.5 C11.5855665,18.5 14.5,15.5490785 14.5,11.9 C14.5,11.7569175 14.4937541,11.6117488 14.481291,11.4644804 C14.310818,9.45010207 12.9939648,7.12565193 10.8802638,4.75434357 C10.0491537,3.82194197 9.15454681,2.94914111 8.26024973,2.16383649 C8.17157048,2.08596503 8.08476013,2.01060875 8,1.93784184 C7.91523987,2.01060875 7.82842952,2.08596503 7.73975027,2.16383649 Z M8,20 C3.581722,20 0,16.3735065 0,11.9 C0,6.05 8,0 8,0 C8,0 16,6.05 16,11.9 C16,16.3732777 12.418278,20 8,20 Z",fillOpacity:"0.87"}))))));};qP=tit;});var Ql,eit,JP;var ZP=d(function(){Ql=y(_("react"));eit=function eit(){return Ql["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",focusable:"false","aria-hidden":"true","aria-label":"Frames",width:"48",height:"48",viewBox:"0 0 48 48"},Ql["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(12 12)"},Ql["default"].createElement("path",{fillOpacity:"0.2",d:"M8 8L17 7 17 17 7 17z"}),Ql["default"].createElement("path",{fillOpacity:"0.87",d:"M4.5 19.5h15v-15h-15v15zM3 3h18v18H3V3z"}),Ql["default"].createElement("path",{fillOpacity:"0.87",d:"M7 17h10V7H7v10zM6 6h12v12H6V6z"}),Ql["default"].createElement("path",{fillOpacity:"0.25",d:"M9 15L11 12 13 14 14 13.5 15 15z"})));};JP=eit;});var Fr,iit,QP;var tM=d(function(){Fr=y(_("react"));iit=function iit(){return Fr["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Library",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},Fr["default"].createElement("g",{fill:"none",fillRule:"evenodd"},Fr["default"].createElement("g",{transform:"translate(15 15)",fill:"currentColor"},Fr["default"].createElement("g",null,Fr["default"].createElement("polygon",{fillOpacity:"0.2",points:"3 3 12.5 1.5 12.5 15.5 1.5 15.5"}),Fr["default"].createElement("path",{d:"M1.5,1.5 L1.5,15.5 L12.5,15.5 L12.5,1.5 L1.5,1.5 Z M0,0 L14,0 L14,17 L0,17 L0,0 Z",fillOpacity:"0.87"}),Fr["default"].createElement("polygon",{fillOpacity:"0.25",points:"3 11 6 7 8 9 9 8.5 11 11"}),Fr["default"].createElement("circle",{fillOpacity:"0.25",cx:"9",cy:"5",r:"1"}),Fr["default"].createElement("rect",{fillOpacity:"0.25",x:"3",y:"13",width:"8",height:"1"}),Fr["default"].createElement("g",{transform:"rotate(14 -2.352 56.952)",fillOpacity:"0.2"},Fr["default"].createElement("path",{d:"M1.32904158,1.07500967e-13 L5,1.07500967e-13 L5,14.7234101 L4,10.7126291 L4,1 L1.57836958,1 L1.32904158,1.07500967e-13 Z M5,14.9745817 L5,16 L0.887271787,16 L5,14.9745817 Z"}),Fr["default"].createElement("path",{d:"M1.82769758,2 L3,2 L3,6.70184819 L1.82769758,2 Z"}))))));};QP=iit;});var pd,rit,eM;var iM=d(function(){pd=y(_("react"));rit=function rit(){return pd["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Overlays",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},pd["default"].createElement("g",{fill:"none",fillRule:"evenodd"},pd["default"].createElement("g",{transform:"translate(15 15)",fill:"currentColor"},pd["default"].createElement("path",{d:"M13.5,4 L13.5,13.5 L4,13.5 L4,5 C4,4.44771525 4.44771525,4 5,4 L13.5,4 Z M15,4 L17,4 C17.5522847,4 18,4.44771525 18,5 L18,17 C18,17.5522847 17.5522847,18 17,18 L5,18 C4.44771525,18 4,17.5522847 4,17 L4,15 L14,15 C14.5522847,15 15,14.5522847 15,14 L15,4 Z",fillOpacity:"0.2"}),pd["default"].createElement("path",{d:"M1.5,1.5 L1.5,13.5 L13.5,13.5 L13.5,1.5 L1.5,1.5 Z M1,0 L14,0 C14.5522847,-1.01453063e-16 15,0.44771525 15,1 L15,14 C15,14.5522847 14.5522847,15 14,15 L1,15 C0.44771525,15 6.76353751e-17,14.5522847 0,14 L0,1 C-6.76353751e-17,0.44771525 0.44771525,1.01453063e-16 1,0 Z",fillOpacity:"0.87"}))));};eM=rit;});var xn,oit,rM;var oM=d(function(){xn=y(_("react"));oit=function oit(){return xn["default"].createElement("svg",{focusable:"false","aria-hidden":"true",width:"48px",height:"48px",version:"1.1",xmlns:"http://www.w3.org/2000/svg","aria-label":"Stickers",viewBox:"0 0 48 48"},xn["default"].createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},xn["default"].createElement("g",null,xn["default"].createElement("g",{transform:"translate(14.000000, 14.000000)",fill:"currentColor"},xn["default"].createElement("g",{transform:"translate(2.000000, 2.000000)",fillOpacity:"0.2"},xn["default"].createElement("path",{d:"M11.5840291,0.290311095 C14.1040281,1.4637822 15.9529364,3.83641178 16.3972985,6.6747443 C11.4538042,7.5567274 7.55733385,11.4556991 6.68374109,16.3973312 C3.83946575,15.9530468 1.46423317,14.1041207 0.290132399,11.5832649 C0.0988489957,10.7650202 3.01980663e-14,9.89786431 3.01980663e-14,9 C3.01980663e-14,6.64646143 0.903391324,4.50392121 2.38232909,2.90022422 C4.02683831,1.11698861 6.38297582,-3.55271368e-15 9,-3.55271368e-15 C9.89814387,-3.55271368e-15 10.7655602,0.0989105588 11.5840291,0.290311095 Z"}),xn["default"].createElement("path",{d:"M17.9877222,8 L8,17.9877222 C8.2591955,12.5923102 12.5906864,8.26470667 17.9877222,8 Z"})),xn["default"].createElement("path",{d:"M9.87290303,14.9211604 C9.09408801,14.4293124 5,11.7146562 5,9 C5,7.34 6.34,6 8,6 C8.77,6 9.47,6.52 10,7 C10.53,6.52 11.23,6 12,6 C13.66,6 15,7.34 15,9 C15,9.30171667 14.9494261,9.60343334 14.8584511,9.90209822 C12.7354304,11.0373368 10.9933363,12.7905402 9.87290303,14.9211604 Z",fillOpacity:"0.25"}),xn["default"].createElement("path",{d:"M10,1.5 C5.30557963,1.5 1.5,5.30557963 1.5,10 C1.5,14.2449983 4.61102233,17.7611603 8.68374109,18.3973312 C9.55733385,13.4556991 13.4538042,9.5567274 18.3972985,8.6747443 C17.7608961,4.60976745 14.2436106,1.5 10,1.5 Z M0,10 C0,4.4771525 4.4771525,0 10,0 C15.5228475,0 20,4.4771525 20,10 C14.5988732,10.2649073 10.2649073,14.5988732 10.0116954,19.9999933 C4.4771525,20 0,15.5228475 0,10 Z",fillOpacity:"0.87"})))));};rM=oit;});var hd,nit,nM;var sM=d(function(){hd=y(_("react"));nit=function nit(){return hd["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",focusable:"false","aria-hidden":"true","aria-label":"Texts",width:"48",height:"48"},hd["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},hd["default"].createElement("path",{fillOpacity:"0.2",d:"M17.883 19.5H16.07L11.702 6.833l1.235-1.411L17.883 19.5z",transform:"translate(12 12)"}),hd["default"].createElement("path",{fillOpacity:"0.87",d:"M10.8 8.818L8.483 14.5h4.275l-1.96-5.682zM10 6.5l3.5-4 5.973 17H21V21h-8v-1.5h1.483L13.276 16H7.873l-1.426 3.5H8V21H3v-1.5h1.704L10 6.5zm1.702.333L16.069 19.5h1.814L12.937 5.422l-1.235 1.411z",transform:"translate(12 12)"}),hd["default"].createElement("path",{fillOpacity:"0.2",d:"M19.55 15l-.35-1H21v1h-1.45zm1.05 3l-.35-1H21v1h-.4zM7.639 8L7.25 9H3V8h4.639zm1.167-3l-.39 1H7V5h1.806zm-2.334 6l-.389 1H6v-1h.472zm-1.166 3l-.39 1H3v-1h2.306zm-1.167 3l-.389 1H3v-1h1.139zM15.35 3L15 2h1v1h-.65zm3.15 9l-.35-1H21v1h-2.5zm-1.05-3l-.35-1H21v1h-3.55zM16.4 6l-.35-1H18v1h-1.6zm-5.9-3H9V2h2.5l-1 1zM3 5h3v1H3V5zm16 0h2v1h-2V5zM3 11h2v1H3v-1zm18-8h-4V2h4v1zM8 3H3V2h5v1z",transform:"translate(12 12)"})));};nM=nit;});var fd,sit,aM;var lM=d(function(){fd=y(_("react"));sit=function sit(){return fd["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Text Design",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},fd["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},fd["default"].createElement("path",{fillOpacity:"0.87",d:"M1 0h14a1 1 0 011 1v19l-8-6-8 6V1a1 1 0 011-1zm.5 1.5V17L8 12.125 14.5 17V1.5h-13z",transform:"translate(14 14) translate(2)"}),fd["default"].createElement("path",{fillOpacity:"0.2",d:"M1.5 1.5h13V17L8 12.125 1.5 17V1.5z",transform:"translate(14 14) translate(2)"}),fd["default"].createElement("path",{fillOpacity:"0.25",d:"M9 4l2.52 7H10.2l-.7-1.85H6.45L5.77 11H4.49L6.9 4H9zm-1.04.78h-.05L6.73 8.14H9.2L7.96 4.78z",transform:"translate(14 14) translate(2)"})));};aM=sit;});function ait(){return za["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Transform",width:"48",height:"48",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},za["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(12 12)"},za["default"].createElement("path",{fillOpacity:"0.2",d:"M10 10L15 9 15 15 9 15z"}),za["default"].createElement("path",{fillOpacity:"0.87",d:"M9 15h6V9H9v6zm-1.5 0V7.5H15V3h1.5v13.5H3V15h4.5zm0 2.5H9V21H7.5v-3.5zM21 7.5V9h-3.5V7.5H21z"}),za["default"].createElement("g",{fillOpacity:"0.2"},za["default"].createElement("path",{d:"M0 10h1a9.003 9.003 0 015.5-8.294L7 3 10.942.044C10.632.014 10.318 0 10 0 4.477 0 0 4.477 0 10z",transform:"translate(2 2)"}),za["default"].createElement("path",{d:"M9 20h1a9.003 9.003 0 015.5-8.294L16 13l3.942-2.956c-.31-.03-.624-.044-.942-.044-5.523 0-10 4.477-10 10z",transform:"translate(2 2) rotate(-180 14.47 15)"}))));}var za,cM;var uM=d(function(){za=y(_("react"));cM=ait;});var Ua,lit,dM;var mM=d(function(){Ua=y(_("react"));lit=function lit(){return Ua["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Ua["default"].createElement("defs",null,Ua["default"].createElement("path",{id:"photoeditorsdk-icon-add-text",d:"M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0zm1 6h-2v5H6v2h5v5h2v-5h5v-2h-5V6z"})),Ua["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ua["default"].createElement("mask",{fill:"currentColor"},Ua["default"].createElement("use",{xlinkHref:"#photoeditorsdk-icon-add-text"})),Ua["default"].createElement("use",{fill:"currentColor",fillRule:"nonzero",xlinkHref:"#photoeditorsdk-icon-add-text"})));};dM=lit;});var m1,cit,pM;var hM=d(function(){m1=y(_("react"));cit=function cit(){return m1["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},m1["default"].createElement("path",{fill:"currentColor",fillOpacity:"0.9",fillRule:"evenodd",stroke:"none",strokeWidth:"1",d:"M12 1c5.523 0 10 4.477 10 10a9.98 9.98 0 01-3.678 7.749c1.877.92 3.445 2.251 4.502 3.88l.176.283-1.743 1.02c-1.04-1.735-2.824-3.102-4.995-3.884A9.94 9.94 0 0112 21a9.962 9.962 0 01-4.255-.948c-2.076.748-3.797 2.033-4.852 3.661l-.147.237L1 22.935c1.053-1.766 2.694-3.204 4.684-4.183A9.975 9.975 0 012 11C2 5.477 6.477 1 12 1zm0 2a8 8 0 100 16 8 8 0 000-16zm0 5a5 5 0 110 10 5 5 0 010-10zm0 2a3 3 0 100 6 3 3 0 000-6zm1-4v1h-2V6h2z"}));};pM=cit;});var p1,uit,fM;var gM=d(function(){p1=y(_("react"));uit=function uit(){return p1["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},p1["default"].createElement("path",{fill:"currentColor",fillOpacity:"0.9",fillRule:"evenodd",stroke:"none",strokeWidth:"1",d:"M16.23 10.885a2.292 2.292 0 00-2.285-2.286 2.292 2.292 0 00-2.286 2.286 2.292 2.292 0 002.286 2.286 2.292 2.292 0 002.286-2.286zM13.946.599C8.265.6 3.66 5.205 3.66 10.885H.231l4.571 4.571 4.572-4.571H5.945c0-4.423 3.577-8 8-8s8 3.577 8 8a7.994 7.994 0 01-12.64 6.514l-1.623 1.646a10.3 10.3 0 006.263 2.126c5.68 0 10.286-4.606 10.286-10.286S19.625.599 13.945.599z",transform:"rotate(56 11.298 10.261)"}));};fM=uit;});function dit(){return Na["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Na["default"].createElement("defs",null,Na["default"].createElement("path",{id:"photoeditorsdk-shuffle-icon",d:"M24 10v8a3 3 0 01-3 3H6v3l-6-4 6-4v3h15a1 1 0 001-1v-8h2zM18 0l6 4-6 4V5H3a1 1 0 00-1 1v8H0V6a3 3 0 013-3h15V0z"})),Na["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Na["default"].createElement("mask",{fill:"currentColor"},Na["default"].createElement("use",{xlinkHref:"#photoeditorsdk-shuffle-icon"})),Na["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-shuffle-icon"})));}var Na,bM;var yM=d(function(){Na=y(_("react"));bM=dit;});var Ha,mit,_M;var xM=d(function(){Ha=y(_("react"));mit=function mit(){return Ha["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Ha["default"].createElement("defs",null,Ha["default"].createElement("path",{id:"photoeditorsdk-upload-icon",d:"M4.143 17.286l-.001 3.142h15.715v-3.142H23v6.285H1v-6.285h3.143zM12 0l9.429 9.429-2.2 2.2L13.57 5.97v9.743H10.43V5.971L4.77 11.63l-2.2-2.2L12 0z"})),Ha["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ha["default"].createElement("mask",{fill:"currentColor"},Ha["default"].createElement("use",{xlinkHref:"#photoeditorsdk-upload-icon"})),Ha["default"].createElement("use",{fill:"currentColor",xlinkHref:"#photoeditorsdk-upload-icon"})));};_M=mit;});var Is,pit,vM;var CM=d(function(){Is=y(_("react"));pit=function pit(){return Is["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Is["default"].createElement("defs",null,Is["default"].createElement("path",{id:"photoeditorsdk-bring-to-front-icon",d:"M21 16a2 2 0 012 2v4a2 2 0 01-2 2H3a2 2 0 01-2-2v-4a2 2 0 012-2h18zM12.006 1l5.996 5.996-1.414 1.414-3.578-3.577V12h-2.008V4.833L7.418 8.417 6.004 7.003 12.006 1z"})),Is["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Is["default"].createElement("path",{d:"M0 0H24V24H0z"}),Is["default"].createElement("mask",{fill:"currentColor"},Is["default"].createElement("use",{xlinkHref:"#photoeditorsdk-bring-to-front-icon"})),Is["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-bring-to-front-icon"})));};vM=pit;});var Je,hit,SM;var wM=d(function(){Je=y(_("react"));hit=function hit(_ref56){var _ref56$highlight=_ref56.highlight,i=_ref56$highlight===void 0?"currentColor":_ref56$highlight,_ref56$width=_ref56.width,t=_ref56$width===void 0?48:_ref56$width,_ref56$height=_ref56.height,e=_ref56$height===void 0?48:_ref56$height;return Je["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 48 48"},Je["default"].createElement("g",{fill:"none",fillOpacity:"0.9",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Je["default"].createElement("g",{fill:i,transform:"translate(13 13)"},Je["default"].createElement("path",{d:"M22 3.701h-1.642V1.644l-2.06-.001V0h2.538c.421 0 .682.174.827.32.322.322.337.748.337.83v2.551z"}),Je["default"].createElement("path",{d:"M1.643 3.701H0V1.165C0 .743.174.482.32.336.64.016 1.06 0 1.147 0H3.701v1.643H1.644l-.001 2.058z"}),Je["default"].createElement("path",{d:"M13.7232174 1.5486087L17.4249565 1.5486087 17.4249565 0 13.7232174 0z"}),Je["default"].createElement("path",{d:"M9.15008696 1.5486087L12.8508696 1.5486087 12.8508696 0 9.15008696 0z"}),Je["default"].createElement("path",{d:"M4.57504348 1.5486087L8.27678261 1.5486087 8.27678261 0 4.57504348 0z"}),Je["default"].createElement("path",{d:"M0 8.27582609L1.5486087 8.27582609 1.5486087 4.57504348 0 4.57504348z"}),Je["default"].createElement("path",{d:"M20.4513913 8.27582609L22 8.27582609 22 4.57504348 20.4513913 4.57504348z"}),Je["default"].createElement("path",{d:"M0 12.8508696L1.5486087 12.8508696 1.5486087 9.14913043 0 9.14913043z"}),Je["default"].createElement("path",{d:"M0 17.4249565L1.5486087 17.4249565 1.5486087 13.7232174 0 13.7232174z"}),Je["default"].createElement("path",{d:"M20.4513913 12.8508696L22 12.8508696 22 9.14913043 20.4513913 9.14913043z"}),Je["default"].createElement("path",{d:"M20.4513913 17.4249565L22 17.4249565 22 13.7232174 20.4513913 13.7232174z"}),Je["default"].createElement("path",{d:"M3.702 22H1.165c-.421 0-.682-.174-.828-.32-.322-.322-.337-.748-.337-.83v-2.552h1.643v2.059h2.059V22z"}),Je["default"].createElement("path",{d:"M20.853 22h-2.554v-1.642h2.057l.001-2.06H22v2.538c0 .42-.174.682-.319.827-.32.32-.742.337-.828.337"}),Je["default"].createElement("path",{d:"M4.57504348 22L8.27678261 22 8.27678261 20.4513913 4.57504348 20.4513913z"}),Je["default"].createElement("path",{d:"M9.15008696 22L12.8508696 22 12.8508696 20.4513913 9.15008696 20.4513913z"}),Je["default"].createElement("path",{d:"M13.7232174 22L17.4249565 22 17.4249565 20.4513913 13.7232174 20.4513913z"}))));};SM=hit;});var _y,fit,TM;var kM=d(function(){_y=y(_("react"));fit=function fit(_ref57){var _ref57$highlight=_ref57.highlight,i=_ref57$highlight===void 0?"currentColor":_ref57$highlight,_ref57$width=_ref57.width,t=_ref57$width===void 0?48:_ref57$width,_ref57$height=_ref57.height,e=_ref57$height===void 0?48:_ref57$height;return _y["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 48 48"},_y["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},_y["default"].createElement("path",{fill:i,d:"M29.967 13.005L26.984 13c-3.35 0-5.516 2.222-5.516 5.66v2.61h-2.999c-.26 0-.469.21-.469.47v3.78c0 .26.21.47.469.47h2.999v9.541c0 .26.21.469.469.469h3.912c.26 0 .47-.21.47-.469V25.99h3.506c.259 0 .469-.21.469-.47l.001-3.78a.47.47 0 00-.469-.47h-3.508v-2.212c0-1.064.254-1.603 1.639-1.603l2.01-.001c.258 0 .468-.21.468-.47v-3.51a.47.47 0 00-.468-.47z"})));};TM=fit;});var tc,git,IM;var DM=d(function(){tc=y(_("react"));git=function git(_ref58){var _ref58$highlight=_ref58.highlight,i=_ref58$highlight===void 0?"currentColor":_ref58$highlight,_ref58$width=_ref58.width,t=_ref58$width===void 0?48:_ref58$width,_ref58$height=_ref58.height,e=_ref58$height===void 0?48:_ref58$height;return tc["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 48 48"},tc["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},tc["default"].createElement("g",{fill:i,transform:"translate(13 13)"},tc["default"].createElement("path",{d:"M15.125 0h-8.25A6.876 6.876 0 000 6.875v8.25A6.876 6.876 0 006.875 22h8.25A6.876 6.876 0 0022 15.125v-8.25A6.876 6.876 0 0015.125 0zm4.813 15.125a4.818 4.818 0 01-4.813 4.813h-8.25a4.818 4.818 0 01-4.813-4.813v-8.25a4.818 4.818 0 014.813-4.813h8.25a4.818 4.818 0 014.813 4.813v8.25z"}),tc["default"].createElement("path",{d:"M11 5.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zm0 8.938A3.442 3.442 0 017.562 11 3.441 3.441 0 0111 7.562 3.441 3.441 0 0114.438 11 3.442 3.442 0 0111 14.438z"}),tc["default"].createElement("circle",{cx:"16.913",cy:"5.088",r:"1"}))));};IM=git;});var xy,bit,EM;var FM=d(function(){xy=y(_("react"));bit=function bit(_ref59){var _ref59$highlight=_ref59.highlight,i=_ref59$highlight===void 0?"currentColor":_ref59$highlight,_ref59$width=_ref59.width,t=_ref59$width===void 0?48:_ref59$width,_ref59$height=_ref59.height,e=_ref59$height===void 0?48:_ref59$height;return xy["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 48 48"},xy["default"].createElement("g",{fill:"none",fillOpacity:"0.9",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},xy["default"].createElement("path",{fill:i,d:"M36 17.305c-.892.402-1.843.668-2.835.797a4.997 4.997 0 002.165-2.79 9.685 9.685 0 01-3.12 1.222 4.874 4.874 0 00-3.595-1.596c-2.723 0-4.916 2.267-4.916 5.047 0 .4.032.785.113 1.151-4.09-.205-7.71-2.215-10.141-5.278a5.18 5.18 0 00-.673 2.55c0 1.748.877 3.297 2.185 4.194a4.766 4.766 0 01-2.223-.621v.055c0 2.452 1.705 4.49 3.942 4.958-.4.113-.837.167-1.29.167-.315 0-.633-.019-.931-.087.637 1.999 2.446 3.468 4.597 3.516a9.73 9.73 0 01-6.1 2.152c-.404 0-.791-.018-1.178-.07a13.601 13.601 0 007.548 2.266c9.054 0 14.004-7.693 14.004-14.36 0-.224-.008-.439-.018-.653A9.958 9.958 0 0036 17.305z"})));};EM=bit;});var OM,yit,Ni;var Wa=d(function(){OM=y(_("styled-components"));yit=OM["default"].svg.attrs({xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"})(_templateObject142||(_templateObject142=_taggedTemplateLiteral([""])));Ni=yit;});var oe,_it,RM;var AM=d(function(){oe=y(_("react"));Wa();_it=function _it(_ref60){var _ref60$highlight=_ref60.highlight,i=_ref60$highlight===void 0?"#565656":_ref60$highlight,_ref60$width=_ref60.width,t=_ref60$width===void 0?32:_ref60$width,_ref60$height=_ref60.height,e=_ref60$height===void 0?32:_ref60$height;return oe["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 32 32"},oe["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},oe["default"].createElement("g",{fill:i,transform:"translate(-8 -8)"},oe["default"].createElement("g",{transform:"translate(8 8)"},oe["default"].createElement("g",null,oe["default"].createElement("path",{d:"M.941 31.992h2.824v-.94L.941 31.05v-2.822h-.94v2.846s-.004.918.94.918"}),oe["default"].createElement("path",{d:"M31.974 31.051v-2.823h-.942v2.823h-2.823v.941h2.846s.919.003.919-.94"}),oe["default"].createElement("path",{d:"M4.62305882 31.9926588L8.38776471 31.9926588 8.38776471 31.0514824 4.62305882 31.0514824z"}),oe["default"].createElement("path",{d:"M9.32894118 31.9926588L13.0936471 31.9926588 13.0936471 31.0514824 9.32894118 31.0514824z"}),oe["default"].createElement("path",{d:"M14.0348235 31.9926588L17.7995294 31.9926588 17.7995294 31.0514824 14.0348235 31.0514824z"}),oe["default"].createElement("path",{d:"M18.7407059 31.9926588L22.5054118 31.9926588 22.5054118 31.0514824 18.7407059 31.0514824z"}),oe["default"].createElement("path",{d:"M23.4465882 31.9926588L27.2112941 31.9926588 27.2112941 31.0514824 23.4465882 31.0514824z"}),oe["default"].createElement("path",{d:"M0 .94v2.824h.941L.942.941h2.823V0H.919S0-.002 0 .94"}),oe["default"].createElement("path",{d:"M31.032 0H28.21v.94l2.823.002v2.822h.942V.92s.002-.92-.942-.92"}),oe["default"].createElement("path",{d:"M4.62305882 0.940423529L8.38776471 0.940423529 8.38776471 -0.000752941176 4.62305882 -0.000752941176z"}),oe["default"].createElement("path",{d:"M9.32894118 0.940423529L13.0936471 0.940423529 13.0936471 -0.000752941176 9.32894118 -0.000752941176z"}),oe["default"].createElement("path",{d:"M14.0348235 0.940423529L17.7995294 0.940423529 17.7995294 -0.000752941176 14.0348235 -0.000752941176z"}),oe["default"].createElement("path",{d:"M18.7407059 0.940423529L22.5054118 0.940423529 22.5054118 -0.000752941176 18.7407059 -0.000752941176z"}),oe["default"].createElement("path",{d:"M23.4465882 0.940423529L27.2112941 0.940423529 27.2112941 -0.000752941176 23.4465882 -0.000752941176z"}),oe["default"].createElement("path",{d:"M0 8.46324706L0.941176471 8.46324706 0.941176471 4.69854118 0 4.69854118z"}),oe["default"].createElement("path",{d:"M0 13.1691294L0.941176471 13.1691294 0.941176471 9.40442353 0 9.40442353z"}),oe["default"].createElement("path",{d:"M0 17.8750118L0.941176471 17.8750118 0.941176471 14.1103059 0 14.1103059z"}),oe["default"].createElement("path",{d:"M0 22.5808941L0.941176471 22.5808941 0.941176471 18.8161882 0 18.8161882z"}),oe["default"].createElement("path",{d:"M0 27.2867765L0.941176471 27.2867765 0.941176471 23.5220706 0 23.5220706z"}),oe["default"].createElement("path",{d:"M30.976 8.46324706L31.9171765 8.46324706 31.9171765 4.69854118 30.976 4.69854118z"}),oe["default"].createElement("path",{d:"M30.976 13.1691294L31.9171765 13.1691294 31.9171765 9.40442353 30.976 9.40442353z"}),oe["default"].createElement("path",{d:"M30.976 17.8750118L31.9171765 17.8750118 31.9171765 14.1103059 30.976 14.1103059z"}),oe["default"].createElement("path",{d:"M30.976 22.5808941L31.9171765 22.5808941 31.9171765 18.8161882 30.976 18.8161882z"}),oe["default"].createElement("path",{d:"M30.976 27.2867765L31.9171765 27.2867765 31.9171765 23.5220706 30.976 23.5220706z"}))))));};RM=_it;});var Gp,xit,BM;var PM=d(function(){Gp=y(_("react"));Wa();xit=function xit(_ref61){var _ref61$highlight=_ref61.highlight,i=_ref61$highlight===void 0?"#565656":_ref61$highlight,_ref61$width=_ref61.width,t=_ref61$width===void 0?32:_ref61$width,_ref61$height=_ref61.height,e=_ref61$height===void 0?48:_ref61$height;return Gp["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 42 32"},Gp["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Gp["default"].createElement("g",{fill:i,transform:"translate(-3 -8)"},Gp["default"].createElement("rect",{width:"42",height:"32",x:"3",y:"8",rx:"0.5"}))));};BM=xit;});var Vp,vit,MM;var LM=d(function(){Vp=y(_("react"));Wa();vit=function vit(_ref62){var _ref62$highlight=_ref62.highlight,i=_ref62$highlight===void 0?"#565656":_ref62$highlight,_ref62$width=_ref62.width,t=_ref62$width===void 0?26:_ref62$width,_ref62$height=_ref62.height,e=_ref62$height===void 0?46:_ref62$height;return Vp["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 26 46"},Vp["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Vp["default"].createElement("g",{fill:i,transform:"translate(-11 -1)"},Vp["default"].createElement("path",{d:"M1 11.496A.5.5 0 011.5 11h45a.5.5 0 01.5.496v25.008a.5.5 0 01-.5.496h-45a.5.5 0 01-.5-.496V11.496z",transform:"rotate(90 24 24)"}))));};MM=vit;});var jp,Cit,zM;var UM=d(function(){jp=y(_("react"));Wa();Cit=function Cit(_ref63){var _ref63$highlight=_ref63.highlight,i=_ref63$highlight===void 0?"#565656":_ref63$highlight,_ref63$width=_ref63.width,t=_ref63$width===void 0?26:_ref63$width,_ref63$height=_ref63.height,e=_ref63$height===void 0?46:_ref63$height;return jp["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 26 46"},jp["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},jp["default"].createElement("g",{fill:i,transform:"translate(-11 -1)"},jp["default"].createElement("path",{d:"M1 11.496A.5.5 0 011.5 11h45a.5.5 0 01.5.496v25.008a.5.5 0 01-.5.496h-45a.5.5 0 01-.5-.496V11.496z"}))));};zM=Cit;});var vn,Sit,NM;var HM=d(function(){vn=y(_("react"));Wa();Sit=function Sit(_ref64){var _ref64$highlight=_ref64.highlight,i=_ref64$highlight===void 0?"#565656":_ref64$highlight,_ref64$mask=_ref64.mask,t=_ref64$mask===void 0?"#fff":_ref64$mask,_ref64$width=_ref64.width,e=_ref64$width===void 0?32:_ref64$width,_ref64$height=_ref64.height,r=_ref64$height===void 0?32:_ref64$height;return vn["default"].createElement(Ni,{width:e,height:r,viewBox:"0 0 32 32"},vn["default"].createElement("defs",null,vn["default"].createElement("rect",{id:"photoeditorsdk-square-icon",width:"32",height:"32",x:"0.92",y:"0.707",rx:"1"})),vn["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},vn["default"].createElement("g",{transform:"translate(-8 -8)"},vn["default"].createElement("g",{transform:"translate(7.08 7.293)"},vn["default"].createElement("mask",{fill:t},vn["default"].createElement("use",{xlinkHref:"#photoeditorsdk-square-icon"})),vn["default"].createElement("use",{fill:i,xlinkHref:"#photoeditorsdk-square-icon"})))));};NM=Sit;});var $p,wit,WM;var GM=d(function(){$p=y(_("react"));Wa();wit=function wit(_ref65){var _ref65$highlight=_ref65.highlight,i=_ref65$highlight===void 0?"#565656":_ref65$highlight,_ref65$width=_ref65.width,t=_ref65$width===void 0?32:_ref65$width,_ref65$height=_ref65.height,e=_ref65$height===void 0?42:_ref65$height;return $p["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 32 42"},$p["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},$p["default"].createElement("g",{fill:i,transform:"translate(-8 -3)"},$p["default"].createElement("rect",{width:"42",height:"32",x:"3",y:"8",rx:"0.5",transform:"rotate(90 24 24)"}))));};WM=wit;});var Cn,Tit,VM;var jM=d(function(){Cn=y(_("react"));Tit=function Tit(_ref66){var _ref66$main=_ref66.main,i=_ref66$main===void 0?"#424242":_ref66$main,_ref66$highlight=_ref66.highlight,t=_ref66$highlight===void 0?"#565656":_ref66$highlight,_ref66$width=_ref66.width,e=_ref66$width===void 0?"48px":_ref66$width,_ref66$height=_ref66.height,r=_ref66$height===void 0?"48px":_ref66$height;return Cn["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Cn["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Cn["default"].createElement("rect",{width:"28",height:"3",x:"12",y:"41",fill:i,rx:"0.5",transform:"matrix(-1 0 0 1 52 0)"}),Cn["default"].createElement("rect",{width:"34",height:"28",x:"7",y:"8",fill:t,rx:"0.5",transform:"matrix(1 0 0 -1 0 44)"}),Cn["default"].createElement("rect",{width:"3",height:"3",x:"8",y:"41",fill:i,rx:"0.5",transform:"matrix(-1 0 0 1 19 0)"}),Cn["default"].createElement("rect",{width:"28",height:"3",x:"12",y:"37",fill:i,rx:"0.5",transform:"matrix(-1 0 0 1 52 0)"}),Cn["default"].createElement("rect",{width:"28",height:"3",x:"12",y:"4",fill:i,rx:"0.5",transform:"matrix(1 0 0 -1 0 11)"}),Cn["default"].createElement("rect",{width:"3",height:"3",x:"8",y:"37",fill:i,rx:"0.5",transform:"matrix(-1 0 0 1 19 0)"}),Cn["default"].createElement("rect",{width:"3",height:"3",x:"8",y:"4",fill:i,rx:"0.5",transform:"matrix(1 0 0 -1 0 11)"})));};VM=Tit;});var Sn,kit,$M;var KM=d(function(){Sn=y(_("react"));kit=function kit(_ref67){var _ref67$main=_ref67.main,i=_ref67$main===void 0?"#424242":_ref67$main,_ref67$highlight=_ref67.highlight,t=_ref67$highlight===void 0?"#565656":_ref67$highlight,_ref67$width=_ref67.width,e=_ref67$width===void 0?"48px":_ref67$width,_ref67$height=_ref67.height,r=_ref67$height===void 0?"48px":_ref67$height;return Sn["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Sn["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Sn["default"].createElement("g",null,Sn["default"].createElement("path",{fill:i,d:"M42 5a1 1 0 011 1v13a1 1 0 01-1 1H6a1 1 0 01-1-1V6a1 1 0 011-1h36zM21.505 18h-2.01a.494.494 0 00-.495.5c0 .268.222.5.495.5h2.01c.28 0 .495-.224.495-.5l-.008-.088a.503.503 0 00-.487-.412zm8.004 0h-5.018a.5.5 0 000 1h5.018a.5.5 0 00.491-.5l-.008-.088A.5.5 0 0029.51 18z"}),Sn["default"].createElement("rect",{width:"22",height:"11",x:"20",y:"29",fill:i,rx:"1"}),Sn["default"].createElement("rect",{width:"13",height:"10",x:"6",y:"23",fill:i,rx:"1"}),Sn["default"].createElement("rect",{width:"22",height:"5",x:"20",y:"23",fill:i,rx:"1"}),Sn["default"].createElement("rect",{width:"7",height:"7",x:"9",y:"14",fill:t,rx:"1"}),Sn["default"].createElement("rect",{width:"13",height:"9",x:"6",y:"34",fill:i,rx:"1"}))));};$M=kit;});var wn,Iit,XM;var qM=d(function(){wn=y(_("react"));Iit=function Iit(_ref68){var _ref68$main=_ref68.main,i=_ref68$main===void 0?"#424242":_ref68$main,_ref68$highlight=_ref68.highlight,t=_ref68$highlight===void 0?"#565656":_ref68$highlight,_ref68$width=_ref68.width,e=_ref68$width===void 0?"48px":_ref68$width,_ref68$height=_ref68.height,r=_ref68$height===void 0?"48px":_ref68$height;return wn["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},wn["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},wn["default"].createElement("g",{transform:"translate(5 5)"},wn["default"].createElement("path",{fill:t,d:"M37 0a1 1 0 011 1v13a1 1 0 01-1 1H1a1 1 0 01-1-1V1a1 1 0 011-1h36zM16.505 13h-2.01a.494.494 0 00-.495.5c0 .268.222.5.495.5h2.01c.28 0 .495-.224.495-.5l-.008-.088a.503.503 0 00-.487-.412zm8.004 0h-5.018a.5.5 0 000 1h5.018a.5.5 0 00.491-.5l-.008-.088A.5.5 0 0024.51 13z"}),wn["default"].createElement("rect",{width:"22",height:"11",x:"15",y:"24",fill:i,rx:"1"}),wn["default"].createElement("rect",{width:"13",height:"10",x:"1",y:"18",fill:i,rx:"1"}),wn["default"].createElement("rect",{width:"22",height:"5",x:"15",y:"18",fill:i,rx:"1"}),wn["default"].createElement("rect",{width:"7",height:"7",x:"4",y:"9",fill:i,rx:"1"}),wn["default"].createElement("rect",{width:"13",height:"9",x:"1",y:"29",fill:i,rx:"1"}))));};XM=Iit;});var Ds,Dit,YM;var JM=d(function(){Ds=y(_("react"));Dit=function Dit(_ref69){var _ref69$main=_ref69.main,i=_ref69$main===void 0?"#424242":_ref69$main,_ref69$highlight=_ref69.highlight,t=_ref69$highlight===void 0?"#565656":_ref69$highlight,_ref69$width=_ref69.width,e=_ref69$width===void 0?"48px":_ref69$width,_ref69$height=_ref69.height,r=_ref69$height===void 0?"48px":_ref69$height;return Ds["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Ds["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ds["default"].createElement("rect",{width:"26",height:"7",x:"7",y:"18",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"9",height:"7",x:"34",y:"11",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"9",height:"8",x:"34",y:"19",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"3",height:"3",x:"40",y:"6",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"26",height:"21",x:"7",y:"27",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"26",height:"16",x:"7",y:"5",fill:t,rx:"1"})));};YM=Dit;});var Es,Eit,ZM;var QM=d(function(){Es=y(_("react"));Eit=function Eit(_ref70){var _ref70$main=_ref70.main,i=_ref70$main===void 0?"#424242":_ref70$main,_ref70$highlight=_ref70.highlight,t=_ref70$highlight===void 0?"#565656":_ref70$highlight,_ref70$width=_ref70.width,e=_ref70$width===void 0?"48px":_ref70$width,_ref70$height=_ref70.height,r=_ref70$height===void 0?"48px":_ref70$height;return Es["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Es["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Es["default"].createElement("rect",{width:"26",height:"7",x:"7",y:"34",fill:i,rx:"1"}),Es["default"].createElement("rect",{width:"26",height:"32",x:"7",y:"5",fill:t,rx:"1"}),Es["default"].createElement("rect",{width:"9",height:"7",x:"34",y:"11",fill:i,rx:"1"}),Es["default"].createElement("rect",{width:"9",height:"8",x:"34",y:"19",fill:i,rx:"1"}),Es["default"].createElement("rect",{width:"3",height:"3",x:"40",y:"6",fill:i,rx:"1"}),Es["default"].createElement("rect",{width:"26",height:"5",x:"7",y:"43",fill:i,rx:"1"})));};ZM=Eit;});var Fs,Fit,tL;var eL=d(function(){Fs=y(_("react"));Fit=function Fit(_ref71){var _ref71$main=_ref71.main,i=_ref71$main===void 0?"#424242":_ref71$main,_ref71$highlight=_ref71.highlight,t=_ref71$highlight===void 0?"#565656":_ref71$highlight,_ref71$width=_ref71.width,e=_ref71$width===void 0?"48px":_ref71$width,_ref71$height=_ref71.height,r=_ref71$height===void 0?"48px":_ref71$height;return Fs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Fs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Fs["default"].createElement("rect",{width:"26",height:"7",x:"7",y:"28",fill:i,rx:"1"}),Fs["default"].createElement("rect",{width:"26",height:"26",x:"7",y:"5",fill:t,rx:"1"}),Fs["default"].createElement("rect",{width:"9",height:"7",x:"34",y:"11",fill:i,rx:"1"}),Fs["default"].createElement("rect",{width:"9",height:"8",x:"34",y:"19",fill:i,rx:"1"}),Fs["default"].createElement("rect",{width:"3",height:"3",x:"40",y:"6",fill:i,rx:"1"}),Fs["default"].createElement("rect",{width:"26",height:"11",x:"7",y:"37",fill:i,rx:"1"})));};tL=Fit;});var Kp,Oit,iL;var rL=d(function(){Kp=y(_("react"));Oit=function Oit(_ref72){var _ref72$main=_ref72.main,i=_ref72$main===void 0?"#424242":_ref72$main,_ref72$highlight=_ref72.highlight,t=_ref72$highlight===void 0?"#565656":_ref72$highlight,_ref72$width=_ref72.width,e=_ref72$width===void 0?"48px":_ref72$width,_ref72$height=_ref72.height,r=_ref72$height===void 0?"48px":_ref72$height;return Kp["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Kp["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Kp["default"].createElement("rect",{width:"20",height:"34",x:"14",y:"10",fill:t,rx:"1.5"}),Kp["default"].createElement("rect",{width:"3",height:"3",x:"14",y:"5",fill:i,rx:"1"})));};iL=Oit;});var Hi,Rit,oL;var nL=d(function(){Hi=y(_("react"));Rit=function Rit(_ref73){var _ref73$main=_ref73.main,i=_ref73$main===void 0?"#424242":_ref73$main,_ref73$highlight=_ref73.highlight,t=_ref73$highlight===void 0?"#565656":_ref73$highlight,_ref73$shadow=_ref73.shadow,e=_ref73$shadow===void 0?"#333333":_ref73$shadow,_ref73$width=_ref73.width,r=_ref73$width===void 0?"48px":_ref73$width,_ref73$height=_ref73.height,o=_ref73$height===void 0?"48px":_ref73$height;return Hi["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:o,viewBox:"0 0 48 48"},Hi["default"].createElement("defs",null,Hi["default"].createElement("filter",{id:"photoeditorsdk-twitter-post-icon",width:"166.7%",height:"166.7%",x:"-33.3%",y:"-33.3%",filterUnits:"objectBoundingBox"},Hi["default"].createElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:"1"}))),Hi["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Hi["default"].createElement("rect",{width:"38",height:"15",x:"5",y:"5",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"24",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"26",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"28",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"26",height:"13",x:"17",y:"24",fill:t,rx:"0.5"}),Hi["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"38",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"42",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"9",height:"9",x:"8",y:"13",fill:e,filter:"url(#photoeditorsdk-twitter-post-icon)",rx:"1"}),Hi["default"].createElement("rect",{width:"7",height:"7",x:"9",y:"14",fill:i,rx:"1"})));};oL=Rit;});var Mo,Ait,sL;var aL=d(function(){Mo=y(_("react"));Ait=function Ait(_ref74){var _ref74$main=_ref74.main,i=_ref74$main===void 0?"#424242":_ref74$main,_ref74$highlight=_ref74.highlight,t=_ref74$highlight===void 0?"#565656":_ref74$highlight,_ref74$width=_ref74.width,e=_ref74$width===void 0?"48px":_ref74$width,_ref74$height=_ref74.height,r=_ref74$height===void 0?"48px":_ref74$height;return Mo["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Mo["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Mo["default"].createElement("rect",{width:"38",height:"15",x:"5",y:"5",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"24",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"26",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"28",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"26",height:"13",x:"17",y:"24",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"38",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"42",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"7",height:"7",x:"9",y:"14",fill:t,rx:"1"})));};sL=Ait;});var Lo,Bit,lL;var cL=d(function(){Lo=y(_("react"));Bit=function Bit(_ref75){var _ref75$main=_ref75.main,i=_ref75$main===void 0?"#424242":_ref75$main,_ref75$highlight=_ref75.highlight,t=_ref75$highlight===void 0?"#565656":_ref75$highlight,_ref75$width=_ref75.width,e=_ref75$width===void 0?"48px":_ref75$width,_ref75$height=_ref75.height,r=_ref75$height===void 0?"48px":_ref75$height;return Lo["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Lo["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Lo["default"].createElement("rect",{width:"38",height:"15",x:"5",y:"5",fill:t,rx:"0.5"}),Lo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"24",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"26",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"28",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"26",height:"13",x:"17",y:"24",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"38",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"42",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"7",height:"7",x:"9",y:"14",fill:i,rx:"1"})));};lL=Bit;});var Ga,Pit,uL;var dL=d(function(){Ga=y(_("react"));Pit=function Pit(){return Ga["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Ga["default"].createElement("defs",null,Ga["default"].createElement("path",{id:"photoeditorsdk-delete-icon",d:"M20 6l-2.312 15.718A1.5 1.5 0 0116.204 23H5.796a1.5 1.5 0 01-1.484-1.282L2 6h18zM7 1a1 1 0 011-1h6a1 1 0 011 1v1h7v2H0V2h7V1z"})),Ga["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ga["default"].createElement("mask",{fill:"currentColor"},Ga["default"].createElement("use",{xlinkHref:"#photoeditorsdk-delete-icon"})),Ga["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-delete-icon"})));};uL=Pit;});var Or,Mit,mL;var pL=d(function(){Or=y(_("react"));Mit=function Mit(_ref76){var _ref76$height=_ref76.height,i=_ref76$height===void 0?3:_ref76$height,_ref76$width=_ref76.width,t=_ref76$width===void 0?102:_ref76$width,_ref76$x=_ref76.x,e=_ref76$x===void 0?-102:_ref76$x,r=_ref76.className,o=_ref76.style;return Or["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:i,viewBox:"0 0 102 3",className:r,style:o},Or["default"].createElement("pattern",{id:"photoeditorsdk-slider-dots",fill:"currentColor",patternUnits:"userSpaceOnUse",width:"102",height:"3"},Or["default"].createElement("rect",{width:"3",height:"3",x:"99",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"88",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"77",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"66",y:"0",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"55",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"44",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"33",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"22",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"11",y:"0",rx:"1.5"})),Or["default"].createElement("rect",{fill:"url(#photoeditorsdk-slider-dots)",x:-t*1.5,y:"0",width:t*4,height:"3",transform:"translate(".concat(e,", 0)")}));};mL=Mit;});var Va,Lit,hL;var fL=d(function(){Va=y(_("react"));Lit=function Lit(){return Va["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Va["default"].createElement("defs",null,Va["default"].createElement("path",{id:"photoeditorsdk-duplicate-icon",d:"M3.429 8.571v12h12v-12h-12zM1.714 5.143h15.429c.947 0 1.714.767 1.714 1.714v15.429c0 .946-.767 1.714-1.714 1.714H1.714A1.714 1.714 0 010 22.286V6.857c0-.947.768-1.714 1.714-1.714zM22.286 0C23.232 0 24 .768 24 1.714v15.429c0 .947-.768 1.714-1.714 1.714H20.57V3.429L5.142 3.428V1.714C5.143.768 5.91 0 6.858 0h15.429z"})),Va["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Va["default"].createElement("mask",{fill:"currentColor"},Va["default"].createElement("use",{xlinkHref:"#photoeditorsdk-duplicate-icon"})),Va["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-duplicate-icon"})));};hL=Lit;});var h1,zit,gL;var bL=d(function(){h1=y(_("react"));zit=function zit(){return h1["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},h1["default"].createElement("path",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1",d:"M2.087 7.115h7.66v15.32h5.027l.223-15.32h7.438V2.087H2.087v5.028zM14.075 24h-4.15a2.42 2.42 0 01-1.718-.711 2.423 2.423 0 01-.711-1.717V9.01H2.429c-.67 0-1.278-.273-1.718-.713A2.426 2.426 0 010 6.579V2.43C0 1.76.272 1.153.711.713A2.424 2.424 0 012.43 0h19.142c.671 0 1.278.272 1.718.713.439.44.711 1.047.711 1.718v4.148c0 .671-.272 1.278-.711 1.718-.44.44-1.047.713-1.718.713h-5.067v12.562c0 .67-.272 1.278-.711 1.717a2.42 2.42 0 01-1.718.711z"}));};gL=zit;});var Os,Uit,yL;var _L=d(function(){Os=y(_("react"));Uit=function Uit(_ref77){var i=_ref77.className;return Os["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 15 14",transform:"scale(-1, 1)",className:i},Os["default"].createElement("title",null,"Flip Horizontal"),Os["default"].createElement("defs",null,Os["default"].createElement("path",{id:"photoeditorsdk-flip-horizontal-icon",d:"M42 1v14h-1.167v-1.167H37a2 2 0 01-2-2V4.167a2 2 0 012-2l3.833-.001V1H42zm5.833 11.958a.875.875 0 01-.875.875h-3.791v-1.166l3.499-.001V3.333h-3.5V2.167h3.792c.446 0 .815.333.869.765l.006.11v9.916z"})),Os["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(-34 -1)"},Os["default"].createElement("mask",{fill:"none"},Os["default"].createElement("use",{xlinkHref:"#photoeditorsdk-flip-horizontal-icon"})),Os["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-flip-horizontal-icon"})));};yL=Uit;});var Rs,Nit,xL;var vL=d(function(){Rs=y(_("react"));Nit=function Nit(_ref78){var i=_ref78.className;return Rs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 15 14",className:i},Rs["default"].createElement("title",null,"Flip Vertical"),Rs["default"].createElement("defs",null,Rs["default"].createElement("path",{id:"photoeditorsdk-flip-vertical-icon",d:"M42 1v14h-1.167v-1.167H37a2 2 0 01-2-2V4.167a2 2 0 012-2l3.833-.001V1H42zm5.833 11.958a.875.875 0 01-.875.875h-3.791v-1.166l3.499-.001V3.333h-3.5V2.167h3.792c.446 0 .815.333.869.765l.006.11v9.916z"})),Rs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(-34 -1)"},Rs["default"].createElement("mask",{fill:"none"},Rs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-flip-vertical-icon"})),Rs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",transform:"rotate(-90 41.417 8)",xlinkHref:"#photoeditorsdk-flip-vertical-icon"})));};xL=Nit;});var As,Hit,CL;var SL=d(function(){As=y(_("react"));Hit=function Hit(_ref79){var _ref79$alt=_ref79.alt,i=_ref79$alt===void 0?"Rotate":_ref79$alt,t=_ref79.className;return As["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 16 16",className:t},As["default"].createElement("title",null,i),As["default"].createElement("defs",null,As["default"].createElement("path",{id:"photoeditorsdk-rotate-icon",d:"M132 0l1.25 1.57a8.01 8.01 0 0110.41.77 8.015 8.015 0 010 11.32c-.33.33-.67.62-1.04.859-1.38.991-3 1.481-4.62 1.481v-2c1.22 0 2.44-.37 3.47-1.111a6 6 0 00.77-9.129 5.992 5.992 0 00-7.73-.63L136 5h-5l1-5zm2.43 12.82c.5.38 1.06.67 1.66.87l-.64 1.89a7.56 7.56 0 01-1.48-.67l-.03-.01v-.01h-.02v-.01h-.01c0-.01-.01-.01-.01-.01h-.01v-.01h-.02v-.01h-.01l-.01-.01s-.01 0-.01-.01h-.01c-.2-.12-.4-.26-.6-.4zm-2.15-3.02c.18.6.47 1.17.83 1.68l-1.63 1.16v-.01s-.01 0-.01-.01c0 0 0-.01-.01-.01v-.01h-.01v-.01c-.01 0-.01-.01-.01-.01v-.01h-.01v-.01h-.01v-.01c0-.01-.01-.01-.01-.01v-.01c-.01 0-.01 0-.01-.01-.27-.39-.49-.79-.68-1.21-.01 0-.01-.01-.01-.01v-.01h-.01v-.02l-.01-.01c0-.02-.01-.02-.01-.02v-.02h-.01v-.02h-.01v-.03h-.01v-.02h-.01v-.02c-.01 0-.01 0-.01-.01v-.01c-.1-.23-.19-.47-.26-.7z"})),As["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(-130)"},As["default"].createElement("mask",{fill:"none"},As["default"].createElement("use",{xlinkHref:"#photoeditorsdk-rotate-icon"})),As["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-rotate-icon"})));};CL=Hit;});var vy,Cy,Re,Xp,Vt,wL;var we=d(function(){var _vy,_categories,_crops,_wL;R();sP();lP();uP();mP();hP();gP();yP();xP();CP();wP();kP();DP();FP();RP();BP();MP();zP();NP();WP();VP();$P();XP();YP();ZP();tM();iM();oM();sM();lM();uM();mM();hM();gM();yM();xM();CM();wM();kM();DM();FM();Wa();AM();PM();LM();UM();HM();GM();jM();KM();qM();JM();QM();eL();rL();nL();aL();cL();dL();pL();fL();bL();_L();vL();SL();vy=(_vy={},_defineProperty(_vy,"adjustment",GP),_defineProperty(_vy,"filter",KP),_defineProperty(_vy,"library",QP),_defineProperty(_vy,"overlay",eM),_defineProperty(_vy,"focus",qP),_defineProperty(_vy,"sticker",rM),_defineProperty(_vy,"text",nM),_defineProperty(_vy,"textdesign",aM),_defineProperty(_vy,"frame",JP),_defineProperty(_vy,"transform",cM),_defineProperty(_vy,"brush",jP),_vy);Cy={left:UP,right:HP,center:LP};Re={addText:dM,openWebcam:pM,reset:fM,shuffle:bM,uploadImage:_M};Xp={undo:PP,redo:AP,close:EP,"export":OP};Vt={categories:(_categories={},_defineProperty(_categories,"imgly_transforms_common",SM),_defineProperty(_categories,"imgly_transforms_facebook",TM),_defineProperty(_categories,"imgly_transforms_twitter",EM),_defineProperty(_categories,"imgly_transforms_instagram",IM),_categories),crops:(_crops={},_defineProperty(_crops,"imgly_transform_common_custom",RM),_defineProperty(_crops,"imgly_transform_common_square",NM),_defineProperty(_crops,"imgly_transform_common_3",WM),_defineProperty(_crops,"imgly_transform_common_4",BM),_defineProperty(_crops,"imgly_transform_common_9",MM),_defineProperty(_crops,"imgly_transform_common_16",zM),_defineProperty(_crops,"imgly_transform_facebook_post",VM),_defineProperty(_crops,"imgly_transform_facebook_profile",$M),_defineProperty(_crops,"imgly_transform_facebook_title",XM),_defineProperty(_crops,"imgly_transform_instagram_landscape",YM),_defineProperty(_crops,"imgly_transform_instagram_portrait",ZM),_defineProperty(_crops,"imgly_transform_instagram_square",tL),_defineProperty(_crops,"imgly_transform_instagram_story",iL),_defineProperty(_crops,"imgly_transform_twitter_post",oL),_defineProperty(_crops,"imgly_transform_twitter_profile",sL),_defineProperty(_crops,"imgly_transform_twitter_title",lL),_crops),dots:mL,duplicate:hL,edit:gL,bringToFront:vM,"delete":uL,flipHorizontal:yL,flipVertical:xL,rotate:CL};wL=(_wL={},_defineProperty(_wL,"brightness",aP),_defineProperty(_wL,"contrast",dP),_defineProperty(_wL,"saturation",_P),_defineProperty(_wL,"clarity",cP),_defineProperty(_wL,"shadows",vP),_defineProperty(_wL,"highlights",bP),_defineProperty(_wL,"exposure",pP),_defineProperty(_wL,"gamma",fP),_defineProperty(_wL,"blacks",nP),_defineProperty(_wL,"whites",IP),_defineProperty(_wL,"temperature",TP),_defineProperty(_wL,"sharpness",SP),_wL);});var TL,kL,Wit,ja;var f1=d(function(){TL=y(_("react"));kL=y(_("styled-components"));W();Wit=kL["default"].div(_templateObject143||(_templateObject143=_taggedTemplateLiteral(["\n display: flex;\n position: relative;\n flex-direction: column;\n width: 100%;\n height: 100%;\n max-width: calc(100% - ","px);\n"])),function(i){return i.maxWidth;});ja=function ja(_ref80){var i=_ref80.children;var _D2=D(),t=_D2.config;var e=0;if(t.isLayoutAdvanced){e=t.measurements.advancedUIToolbar.width+t.measurements.advancedUIToolControlBar.width;}return TL["default"].createElement(Wit,{maxWidth:e},i);};});var qp,IL;var DL=d(function(){qp=y(_("styled-components"));U();IL=qp["default"].div.attrs(function(){return{"data-test":N.MainCanvasActionBar};})(_templateObject144||(_templateObject144=_taggedTemplateLiteral(["\n &&& {\n display: ",";\n flex-direction: row;\n align-items: center;\n height: ","px;\n color: ",";\n border-bottom: 1px solid\n ",";\n padding: 8px 24px;\n box-sizing: border-box;\n position: absolute;\n width: 100%;\n z-index: ",";\n background: ",";\n ","\n }\n"])),function(i){return i.hide?"none":"flex";},function(i){return i.theme.measurements.mainCanvasActionBar.height;},function(i){return i.theme.mainCanvasActionBar.foreground;},function(i){return i.theme.mainCanvasActionBar.borderColor;},function(i){return i.theme.measurements.zIndex.canvas.bar;},function(i){return i.transparentBackgound?"transparent":i.theme.mainCanvasActionBar.background;},function(i){return i.bottom?qp.css(_templateObject145||(_templateObject145=_taggedTemplateLiteral(["\n justify-content: space-around;\n bottom: 0;\n transform: rotate(180deg);\n "]))):qp.css(_templateObject146||(_templateObject146=_taggedTemplateLiteral(["\n justify-content: space-between;\n "])));});});var EL,FL;var OL=d(function(){EL=y(_("styled-components"));FL=EL["default"].canvas(_templateObject147||(_templateObject147=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));});var RL,AL;var BL=d(function(){RL=y(_("styled-components"));AL=RL["default"].div.attrs({role:"main"})(_templateObject148||(_templateObject148=_taggedTemplateLiteral(["\n background-color: ",";\n flex-grow: 1;\n flex-shrink: 1;\n flex-basis: auto;\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n /* added this for safari, else the webcam overlay did not know the height */\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n margin-top: ","px;\n"])),function(i){return i.theme.canvas.background;},function(i){return i.theme.measurements.canvas.marginTop;});});var PL,ML;var LL=d(function(){PL=y(_("styled-components"));ML=PL["default"].div.attrs(function(_ref81){var i=_ref81.height,t=_ref81.width;return{style:{height:"".concat(i,"px"),width:"".concat(t,"px")}};})(_templateObject149||(_templateObject149=_taggedTemplateLiteral(["\n border-style: solid;\n border-width: 2px 0 2px 0;\n border-color: ",";\n box-shadow: 0 -6px 6px -6px rgba(0, 0, 0, 0.2),\n inset 0 6px 6px -6px rgba(0, 0, 0, 0.2);\n cursor: move;\n position: absolute;\n"])),function(i){return i.theme.canvas.controlsOutline;});});var zL,UL;var NL=d(function(){zL=y(_("styled-components"));UL=zL["default"].div.attrs(function(_ref82){var i=_ref82.radius;return{style:{height:"".concat(i*2,"px"),width:"".concat(i*2,"px")}};})(_templateObject150||(_templateObject150=_taggedTemplateLiteral(["\n border-radius: 50%;\n border: 2px solid ",";\n box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),\n inset 0 2px 6px 0 rgba(0, 0, 0, 0.2);\n cursor: move;\n"])),function(i){return i.theme.canvas.controlsOutline;});});var HL,WL;var GL=d(function(){HL=y(_("styled-components"));WL=HL["default"].div(_templateObject151||(_templateObject151=_taggedTemplateLiteral(["\n position: relative;\n height: inherit;\n width: inherit;\n"])));});var be,Git,Sy;var g1=d(function(){be=y(_("styled-components"));Git=be["default"].div(function(i){var _i$theme$measurements=i.theme.measurements.canvasControls.corner.touchable,t=_i$theme$measurements.desktop,e=_i$theme$measurements.mobile;var r=t/4;var o=e/2;return be.css(_templateObject152||(_templateObject152=_taggedTemplateLiteral(["\n position: absolute;\n width: ","px;\n height: ","px;\n ","\n ","\n ","\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n width: ","px;\n height: ","px;\n ","\n ","\n }\n "])),t,t,function(n){return n.vertical==="top"?be.css(_templateObject153||(_templateObject153=_taggedTemplateLiteral(["\n top: 0px;\n "]))):be.css(_templateObject154||(_templateObject154=_taggedTemplateLiteral(["\n bottom: 0px;\n "])));},function(n){return n.horizontal==="left"?be.css(_templateObject155||(_templateObject155=_taggedTemplateLiteral(["\n left: 0px;\n "]))):be.css(_templateObject156||(_templateObject156=_taggedTemplateLiteral(["\n right: 0px;\n "])));},function(n){return n.vertical==="top"?be.css(_templateObject157||(_templateObject157=_taggedTemplateLiteral(["\n margin-top: -","px;\n "])),r):be.css(_templateObject158||(_templateObject158=_taggedTemplateLiteral(["\n margin-bottom: -","px;\n "])),r);},function(n){return n.horizontal==="left"?be.css(_templateObject159||(_templateObject159=_taggedTemplateLiteral(["\n margin-left: -","px;\n "])),r):be.css(_templateObject160||(_templateObject160=_taggedTemplateLiteral(["\n margin-right: -","px;\n "])),r);},e,e,function(n){return n.vertical==="top"?be.css(_templateObject161||(_templateObject161=_taggedTemplateLiteral(["\n margin-top: -","px;\n "])),o):be.css(_templateObject162||(_templateObject162=_taggedTemplateLiteral(["\n margin-bottom: -","px;\n "])),o);},function(n){return n.horizontal==="left"?be.css(_templateObject163||(_templateObject163=_taggedTemplateLiteral(["\n margin-left: -","px;\n "])),o):be.css(_templateObject164||(_templateObject164=_taggedTemplateLiteral(["\n margin-right: -","px;\n "])),o);});});Sy=(0,be["default"])(Git)(function(i){var t=i.horizontal==="right"?i.borderWidth:0;var e=i.vertical==="bottom"?i.borderWidth:0;var r=i.horizontal==="left"?i.borderWidth:0;var o=i.vertical==="top"?i.borderWidth:0;var n="".concat(o,"px ").concat(t,"px ").concat(e,"px ").concat(r,"px");var s=i.horizontal==="left"&&i.vertical==="bottom"||i.horizontal==="right"&&i.vertical==="top"?"nesw-resize":"nwse-resize";var a=i.theme.measurements.canvasControls.corner.touchable.desktop/4-i.borderWidth;var l=i.theme.measurements.canvasControls.corner.touchable.mobile/4+i.borderWidth;return be.css(_templateObject165||(_templateObject165=_taggedTemplateLiteral(["\n &:before {\n display: block;\n position: absolute;\n content: '';\n width: ","px;\n height: ","px;\n z-index: ",";\n border-color: ",";\n border-style: solid;\n border-width: ",";\n pointer-events: auto;\n ","\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n ","\n }\n }\n cursor: ",";\n pointer-events: none;\n "])),function(c){return c.theme.measurements.canvasControls.corner.size;},function(c){return c.theme.measurements.canvasControls.corner.size;},function(c){return c.theme.measurements.zIndex.canvas.controls;},function(c){return c.theme.canvas.controlsColor;},n,i.vertical==="top"?be.css(_templateObject166||(_templateObject166=_taggedTemplateLiteral(["\n top: ","px;\n "])),a):be.css(_templateObject167||(_templateObject167=_taggedTemplateLiteral(["\n bottom: ","px;\n "])),a),i.horizontal==="left"?be.css(_templateObject168||(_templateObject168=_taggedTemplateLiteral(["\n left: ","px;\n "])),a):be.css(_templateObject169||(_templateObject169=_taggedTemplateLiteral(["\n right: ","px;\n "])),a),i.vertical==="top"?be.css(_templateObject170||(_templateObject170=_taggedTemplateLiteral(["\n margin-top: ","px;\n "])),l):be.css(_templateObject171||(_templateObject171=_taggedTemplateLiteral(["\n margin-bottom: ","px;\n "])),l),i.horizontal==="left"?be.css(_templateObject172||(_templateObject172=_taggedTemplateLiteral(["\n margin-left: ","px;\n "])),l):be.css(_templateObject173||(_templateObject173=_taggedTemplateLiteral(["\n margin-right: ","px;\n "])),l),s);});});var VL,jL;var $L=d(function(){VL=y(_("styled-components"));U();jL=VL["default"].div.attrs(function(){return{"data-test":N.Knob};})(_templateObject174||(_templateObject174=_taggedTemplateLiteral(["\n position: absolute;\n height: ","px;\n width: ","px;\n margin-left: -10px;\n margin-top: -10px;\n z-index: ",";\n will-change: transform;\n cursor: ew-resize;\n &:before {\n display: block;\n position: absolute;\n content: '';\n background: ",";\n border-radius: 50%;\n width: ","px;\n height: ","px;\n top: ","px;\n left: ","px;\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.24);\n }\n"])),function(i){return i.theme.measurements.canvasControls.knob.touchable.desktop;},function(i){return i.theme.measurements.canvasControls.knob.touchable.desktop;},function(i){return i.theme.measurements.zIndex.canvas.knob;},function(i){return i.theme.canvas.controlsColor;},function(i){return i.theme.measurements.canvasControls.knob.size;},function(i){return i.theme.measurements.canvasControls.knob.size;},function(i){return i.theme.measurements.canvasControls.knob.size/4;},function(i){return i.theme.measurements.canvasControls.knob.size/4;});});var KL,XL;var qL=d(function(){KL=y(_("styled-components"));XL=KL["default"].div(_templateObject175||(_templateObject175=_taggedTemplateLiteral(["\n position: absolute;\n color: ",";\n"])),function(i){return i.theme.canvas.controlsOutline;});});var YL,JL;var ZL=d(function(){YL=y(_("styled-components"));JL=YL["default"].div.attrs(function(i){return{style:{left:"".concat(i.x,"px")}};})(_templateObject176||(_templateObject176=_taggedTemplateLiteral(["\n position: absolute;\n bottom: -","px;\n height: ","px;\n width: 2px;\n background-color: ",";\n"])),function(i){return i.theme.measurements.canvasControls.sprite.rotateHandle.height;},function(i){return i.theme.measurements.canvasControls.sprite.rotateHandle.height;},function(i){return i.theme.canvas.controlsOutline;});});var QL,t4;var e4=d(function(){QL=y(_("styled-components"));t4=QL["default"].div.attrs(function(_ref83){var i=_ref83.height,t=_ref83.width,e=_ref83.theme;return{style:{height:"".concat(i+e.measurements.canvasControls.sprite.controlPadding,"px"),width:"".concat(t+e.measurements.canvasControls.sprite.controlPadding,"px")}};})(_templateObject177||(_templateObject177=_taggedTemplateLiteral(["\n left: -","px;\n top: -","px;\n transform-origin: center center;\n border-style: solid;\n border-width: 2px;\n border-color: ",";\n box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),\n inset 0 2px 6px 0 rgba(0, 0, 0, 0.2);\n cursor: move;\n will-change: transform;\n position: absolute;\n"])),function(i){return i.theme.measurements.canvasControls.sprite.controlPadding/2;},function(i){return i.theme.measurements.canvasControls.sprite.controlPadding/2;},function(i){return i.theme.canvas.controlsColor;});});var i4,r4;var o4=d(function(){i4=y(_("styled-components"));U();r4=i4["default"].div.attrs(function(){return{"data-test":N.TextWidth};})(_templateObject178||(_templateObject178=_taggedTemplateLiteral(["\n position: absolute;\n height: ","px;\n width: 4px;\n z-index: ",";\n background: ",";\n cursor: pointer;\n"])),function(i){return i.theme.measurements.canvasControls.width.size;},function(i){return i.theme.measurements.zIndex.canvas.controls;},function(i){return i.theme.canvas.controlsColor;});});var n4,s4;var a4=d(function(){n4=y(_("styled-components"));s4=n4["default"].div.attrs({tabIndex:0})(_templateObject179||(_templateObject179=_taggedTemplateLiteral(["\n position: absolute;\n height: ","px;\n width: ","px;\n top: 0;\n left: 0;\n &:focus {\n outline: 0;\n }\n"])),function(i){return i.height;},function(i){return i.width;});});var $a,wy,l4,c4,u4,ec;var b1=d(function(){$a=y(_("styled-components"));U();g1();wy=NF()?$a.css(_templateObject180||(_templateObject180=_taggedTemplateLiteral(["\n transition: unset;\n "]))):$a.css(_templateObject181||(_templateObject181=_taggedTemplateLiteral(["\n transition: all 0.4s ease-in-out;\n "])));l4=$a["default"].div(_templateObject182||(_templateObject182=_taggedTemplateLiteral(["\n position: absolute;\n background: ",";\n z-index: ",";\n ","\n"])),function(i){return i.theme.canvas.cropBackdrop;},function(i){return i.theme.measurements.zIndex.canvas.crop.backdrop;},wy);c4=$a["default"].div.attrs({"data-test":N.CropMask})(_templateObject183||(_templateObject183=_taggedTemplateLiteral(["\n position: absolute;\n box-shadow: inset 0 0 0 2px ",";\n cursor: move;\n ","\n"])),function(i){return i.theme.canvas.controlsOutline;},wy);u4=$a["default"].div(_templateObject184||(_templateObject184=_taggedTemplateLiteral(["\n position: absolute;\n background: ",";\n z-index: ",";\n ","\n"])),function(i){return i.theme.canvas.controlsOutline;},function(i){return i.theme.measurements.zIndex.canvas.crop.grid;},wy);ec=(0,$a["default"])(Sy)(_templateObject185||(_templateObject185=_taggedTemplateLiteral(["\n z-index: ",";\n ",";\n"])),function(i){return i.theme.measurements.zIndex.canvas.controls;},wy);});var d4,m4;var p4=d(function(){d4=y(_("styled-components"));m4=d4["default"].canvas(_templateObject186||(_templateObject186=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));});var h4,f4;var g4=d(function(){h4=y(_("styled-components"));f4=h4["default"].video(_templateObject187||(_templateObject187=_taggedTemplateLiteral(["\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n"])));});var b4,y4;var _4=d(function(){b4=y(_("styled-components"));y4=b4["default"].div(_templateObject188||(_templateObject188=_taggedTemplateLiteral(["\n position: relative;\n transition: all 0.4s cubic-bezier(0.17, 0.04, 0.03, 0.94);\n height: 100%;\n width: 100%;\n z-index: ",";\n background-color: ",";\n"])),function(i){return i.theme.measurements.zIndex.canvas.webcam.backdrop;},function(i){return i.theme.webcam.background;});});var mt;var $e=d(function(){yy();f1();DL();OL();BL();LL();NL();GL();g1();$L();qL();ZL();e4();o4();a4();b1();p4();g4();_4();mt={Index:FL,Area:ja,Bar:{Index:IL,ButtonGroup:iP},Button:{TextSecondary:by,Float:tP},Container:AL,Element:m4,Wrapper:y4,Webcam:f4,Controls:{Knob:jL,Circle:UL,Corner:Sy,Line:XL,Area:ML,Sprite:t4,RotateHandle:JL,Container:WL,Wrapper:s4,SpriteActionsWrapper:Wp,SpriteActionButton:_n,Width:r4},Crop:{Mask:c4,GridLine:u4,Backdrop:l4,Control:ec}};});var ir={};de(ir,{FragmentPrecision:function FragmentPrecision(){return Ty;},ImageFormat:function ImageFormat(){return ic;},OptionType:function OptionType(){return K;},RenderType:function RenderType(){return Rr;},RendererType:function RendererType(){return Ke;},UniformType:function UniformType(){return le;}});var Rr,ic,K,le,Ke,Ty;var Ar=d(function(){Rr={IMAGE:"image",DATAURL:"data-url",BUFFER:"buffer",BLOB:"blob",MSBLOB:"ms-blob"};ic={PNG:"image/png",JPEG:"image/jpeg",RAW:"raw"};K=function(h){h["NUMBER"]="number";h["VECTOR2"]="vector2";h["COLOR_MATRIX"]="color-matrix";h["COLOR"]="color";h["ARRAY"]="array";h["OBJECT"]="object";h["STRING"]="string";h["BOOLEAN"]="boolean";h["CONFIGURABLE"]="configurable";h["IMAGE"]="image";h["FUNCTION"]="function";h["TEXTURE"]="texture";h["ALL"]="*";return h;}(K||{});le=function(x){x["SAMPLER2D"]="sampler2d";x["INT"]="i";x["INT1"]="1i";x["INT2"]="2i";x["INT3"]="3i";x["INT4"]="4i";x["FLOAT"]="f";x["FLOAT1"]="1f";x["FLOAT2"]="2f";x["FLOAT_VECTOR2"]="2fv";x["FLOAT3"]="3f";x["FLOAT4"]="4f";x["MAT3"]="mat3";x["MAT3FV"]="mat3fv";x["MAT4"]="mat4";return x;}(le||{});Ke=function(e){e["WEBGL"]="webgl";e["CANVAS"]="canvas";return e;}(Ke||{});Ty=function(r){r["High"]="highp";r["Medium"]="mediump";r["Low"]="lowp";return r;}(Ty||{});});var Yp,x4;var v4=d(function(){Yp=function Yp(){return document.createElement("canvas");};x4=function x4(i,t){var e=t||Yp();e.width=i.width;e.height=i.height;var r=e.getContext("2d");if(!r){throw new Error("Cannot render context");}r.clearRect(0,0,e.width,e.height);r.drawImage(i,0,0,i.width,i.height);return e;};});var gd;var y1=d(function(){gd=function gd(t,e,r){_classCallCheck(this,gd);this.width=t;this.height=e;this.data=r;};});var C4={};de(C4,{glGet:function glGet(){return ky;},webUtils:function webUtils(){return Kit;}});var ky,Vit,jit,$it,Kit;var S4=d(function(){v4();To();y1();ky=function ky(i){var t={preserveDrawingBuffer:true};return i.getContext("webgl",t)||i.getContext("experimental-webgl",t);};Vit=function Vit(){var i=Yp();var t=ky(i);var e=t.getParameter(t.MAX_TEXTURE_SIZE);var r=t.getExtension("WEBGL_lose_context");if(r){r.loseContext();}$t(i);return e;};jit=function jit(i,t){if(t instanceof gd){i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t.width,t.height,0,i.RGBA,i.UNSIGNED_BYTE,t.data);}else{var e=x4(t);i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e);$t(e);}};$it=function $it(i){return Boolean(i.tagName&&i.tagName.toUpperCase()==="IMG");};Kit={isSupported:function isSupported(){return Boolean(ky(Yp()));},isCanvas:function isCanvas(i){return i.constructor.name==="Canvas"||Boolean(i.tagName&&i.tagName.toUpperCase()==="CANVAS");},isImage:$it,Image:typeof window!=="undefined"?window.Image:void 0,glMaxTexture:Vit,glGet:ky,createCanvas:Yp,glResize:function glResize(i,t){return i;},glTexImage:jit};});var w4,pi,bd,_1,T4;var Tn=d(function(){Ar();if(true){w4=(S4(),Li(C4)).webUtils;}if(false){w4=null.serverUtils;}pi=w4;bd=function bd(i){return i._type==="webgl";};_1=function _1(i){return Boolean(i&&"tagName"in i&&i.tagName&&i.tagName.toUpperCase()==="CANVAS");};T4=function T4(i){return Boolean("tagName"in i&&i.tagName.toUpperCase()==="IMG");};});var _Iy,k4;var I4=d(function(){_Iy=/*#__PURE__*/function(){function Iy(){_classCallCheck(this,Iy);}_createClass(Iy,null,[{key:"head",value:function head(t){return t[0];}},{key:"tail",value:function tail(t){return t.slice(1);}},{key:"last",value:function last(t){return t[t.length-1];}},{key:"init",value:function init(t){return t.slice(0,t.length-1);}},{key:"remove",value:function remove(t,e){return t.filter(function(r,o,n){return!e(r,o,n);});}},{key:"findIndex",value:function findIndex(t,e){for(var r=0;rt){for(var o=t;o>2;s=(e&3)<<4|r>>4;a=(r&15)<<2|o>>6;l=o&63;if(isNaN(r)){a=l=64;}else if(isNaN(o)){l=64;}t=t+Ka.charAt(n)+Ka.charAt(s)+Ka.charAt(a)+Ka.charAt(l);e=r=o="";n=s=a=l="";}while(c256||/^[a-z0-9]$/i.test(T)?T:"%"+k.toString(16).toUpperCase();}).join("");}catch(T){return b;}});}(a.pathname):a.pathname),u.protocol==="about:"&&u.pathname==="blank"&&(u.protocol="",u.pathname=""),m&&i[0]!=="/"&&(u.pathname=u.pathname.substr(1)),s&&!C1.test(s)&&i.slice(-1)!=="/"&&u.pathname==="/"&&(u.pathname=""),u.path=u.pathname+u.search,u.auth=[a.username,a.password].map(decodeURIComponent).filter(Boolean).join(":"),u.port=a.port,c&&!u.host.endsWith(c)&&(u.host+=c,u.port=c.slice(1)),u.href=p?""+u.pathname+u.search+u.hash:Qp(u);var g=/^(file)/.test(u.href)?["host","hostname"]:[];return Object.keys(u).forEach(function(x){~g.indexOf(x)||(u[x]=u[x]||null);}),u;}var k1,Qit,S1,w1,T1,trt,ert,C1,irt,rrt,ort,nrt;var M4=d(function(){k1=y(B4(),1);Qit=/https?|ftp|gopher|file/;S1="http://";w1="w.w";T1=S1+w1;trt=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i;ert=/https?|ftp|gopher|file/;xd.prototype.parse=vd,xd.prototype.format=Qp,xd.prototype.resolve=P4,xd.prototype.resolveObject=P4;C1=/^https?|ftp|gopher|file/;irt=/^(.*?)([#?].*)/;rrt=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i;ort=/^([a-z0-9.+-]*:)?\/\/\/*/i;nrt=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;});var srt,th,ro;var Cd=d(function(){M4();srt=5e3;th=typeof window!=="undefined"?window:global;ro=/*#__PURE__*/function(){function ro(t){_classCallCheck(this,ro);this._url=t;this._parsedUrl=vd(this._url,true);}_createClass(ro,[{key:"_isJSONPRequest",value:function _isJSONPRequest(){var t=this._parsedUrl.query;for(var e in t){var r=t[e];if(r==="?"){return true;}}return false;}},{key:"load",value:function load(){if(this._isJSONPRequest()){return this._loadJSONP();}return this._loadJSON();}},{key:"_loadJSON",value:function _loadJSON(){var _this36=this;return new Promise(function(t,e){var r;if(th.XDomainRequest){r=new th.XDomainRequest();r.onload=function(){var o=JSON.parse(r.responseText);t(o);};r.onerror=function(o){e(o);};r.open("GET",_this36._url,true);r.send();}else if(th.XMLHttpRequest){r=new XMLHttpRequest();r.onreadystatechange=function(o){if(r.readyState===4){if(r.status===200){var n=JSON.parse(r.responseText);t(n);}else{e(new Error("HTTP Status ".concat(r.status)));}}};r.open("GET",_this36._url,true);r.send();}});}},{key:"_loadJSONP",value:function _loadJSONP(){var _this37=this;var t=false;var e=false;var r="pesdk".concat(Math.round(Math.random()*99999999999999));return new Promise(function(o,n){var s=_this37._createJSONPNode(r);th[r]=function(a){_this37._removeJSONPNode(s);if(!t){e=true;o(a);}};th.setTimeout(function(){if(!e){_this37._removeJSONPNode(s);t=true;n(new Error("Timeout of 5 seconds exceeded."));}},srt);});}},{key:"_createJSONPNode",value:function _createJSONPNode(t){var e=this._buildJSONPUrl(t);var r=document.querySelector("head");var o=document.createElement("script");o.src=e;r.appendChild(o);return o;}},{key:"_removeJSONPNode",value:function _removeJSONPNode(t){t.parentNode.removeChild(t);}},{key:"_buildJSONPUrl",value:function _buildJSONPUrl(t){var e=this._parsedUrl.query;var r=null;for(var o in e){if(e[o]==="?"){r=o;break;}}delete this._parsedUrl.search;e[r]=t;return Qp(this._parsedUrl);}}]);return ro;}();});var I1={};de(I1,{ImageLoader:function ImageLoader(){return Wi;},JSONLoader:function JSONLoader(){return ro;}});var L4=d(function(){_d();Cd();});var _Gi,G;var oc=d(function(){_Gi=/*#__PURE__*/function(){function Gi(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;_classCallCheck(this,Gi);this.r=t;this.g=e;this.b=r;this.a=o;}_createClass(Gi,[{key:"toRGBA",value:function toRGBA(){var t=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255),this.a.toFixed(2)];return"rgba(".concat(t.join(","),")");}},{key:"set",value:function set(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this.a;this.r=t;this.g=e;this.b=r;this.a=o;return this;}},{key:"toRGB",value:function toRGB(){return[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)];}},{key:"toHex",value:function toHex(){var t=[this._componentToHex(Math.round(this.r*255)),this._componentToHex(Math.round(this.g*255)),this._componentToHex(Math.round(this.b*255))];return"#".concat(t.join(""));}},{key:"toGLColor",value:function toGLColor(){return[this.r,this.g,this.b,this.a];}},{key:"toArray",value:function toArray(){return this.toGLColor();}},{key:"toRGBGLColor",value:function toRGBGLColor(){return[this.r,this.g,this.b];}},{key:"toHSV",value:function toHSV(){var t=Math.max(this.r,this.g,this.b);var e=Math.min(this.r,this.g,this.b);var r;var o;var n=t;var s=t-e;o=t===0?0:s/t;if(t===e){r=0;}else{switch(t){case this.r:r=(this.g-this.b)/s;if(this.g3&&arguments[3]!==undefined?arguments[3]:1;var _ref87=[],n=_ref87[0],s=_ref87[1],a=_ref87[2];var l=Math.floor(t*6);var c=t*6-l;var u=r*(1-e);var m=r*(1-c*e);var p=r*(1-(1-c)*e);switch(l%6){case 0:n=r;s=p;a=u;break;case 1:n=m;s=r;a=u;break;case 2:n=u;s=r;a=p;break;case 3:n=u;s=m;a=r;break;case 4:n=p;s=u;a=r;break;case 5:n=r;s=u;a=m;break;}return new _Gi(n,s,a,o);}},{key:"fromArray",value:function fromArray(t){return new _Gi(t[0],t[1],t[2],t[3]);}},{key:"fromHex",value:function fromHex(t){var _t$match=t.match(/[0-9A-fa-f]{1,2}/g),_t$match2=_slicedToArray(_t$match,3),e=_t$match2[0],r=_t$match2[1],o=_t$match2[2];return new _Gi(parseInt(e,16)/255,parseInt(r,16)/255,parseInt(o,16)/255,1);}},{key:"TRANSPARENT",get:function get(){return new _Gi(0,0,0,0);}},{key:"WHITE",get:function get(){return new _Gi(1,1,1,1);}},{key:"BLACK",get:function get(){return new _Gi(0,0,0,1);}},{key:"RED",get:function get(){return new _Gi(1,0,0,1);}},{key:"BLUE",get:function get(){return new _Gi(0,0,1,1);}},{key:"GREEN",get:function get(){return new _Gi(0,1,0,1);}}]);return Gi;}();G=_Gi;});var art,z4,Vi;var Sd=d(function(){zo();art=12;z4=/*#__PURE__*/function(){function z4(){_classCallCheck(this,z4);this._maxListeners=art;this._events={};this._pipeDestinations=[];}_createClass(z4,[{key:"pipeEvents",value:function pipeEvents(t){this._pipeDestinations.push(t);}},{key:"unpipeEvents",value:function unpipeEvents(t){var e=this._pipeDestinations.indexOf(t);if(e===-1){return;}this._pipeDestinations.splice(e,1);}},{key:"on",value:function on(t,e){if(typeof t==="undefined"){throw new Error("Invalid event type: `".concat(t,"`"));}if(typeof e!=="function"){throw new TypeError();}var r=this._events[t]||(this._events[t]=[]);if(r.indexOf(e)!==-1){return this;}r.push(e);if(this._maxListeners&&r.length>this._maxListeners){Y.warn("EventEmitter","Possible memory leak detected, added ".concat(r.length," `").concat(t,"` listeners (current limit is ").concat(this._maxListeners,")"));if(typeof console!=="undefined"){console.trace();}}return this;}},{key:"once",value:function once(t,e){if(typeof t==="undefined"){throw new Error("Invalid event type: `".concat(t,"`"));}var r=this;function o(){r.off(t,o);e.apply(null,arguments);}return this.on(t,o);}},{key:"off",value:function off(t){if(typeof t==="undefined"){throw new Error("Invalid event type: `".concat(t,"`"));}if((arguments.length<=1?0:arguments.length-1)===0){this._events[t]=null;return this;}var r=arguments.length<=1?undefined:arguments[1];if(typeof r!=="function"){throw new TypeError();}var o=this._events[t];if(!o||!o.length){return this;}var n=o.indexOf(r);if(n===-1){return this;}o.splice(n,1);return this;}},{key:"emit",value:function emit(t){for(var _len8=arguments.length,e=new Array(_len8>1?_len8-1:0),_key8=1;_key8<_len8;_key8++){e[_key8-1]=arguments[_key8];}if(typeof t==="undefined"){throw new Error("Invalid event type: `".concat(t,"`"));}this._pipeDestinations.forEach(function(o){o.emit.apply(o,[t].concat(e));});var r=this._events[t];if(!r||!r.length){return false;}r.slice(0).forEach(function(o){return o.apply(null,e);});return true;}},{key:"setMaxListeners",value:function setMaxListeners(t){if(parseInt(t,10)!==t){throw new TypeError();}this._maxListeners=t;}}]);return z4;}();Vi=z4;});var nc;var D1=d(function(){zo();To();nc={checkFramebufferStatus:function checkFramebufferStatus(i,t){var _r5;var e=t.checkFramebufferStatus(t.FRAMEBUFFER);var r=(_r5={},_defineProperty(_r5,t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,"Incomplete attachment"),_defineProperty(_r5,t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,"Missing attachment"),_defineProperty(_r5,t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,"Incomplete dimensions"),_defineProperty(_r5,t.FRAMEBUFFER_UNSUPPORTED,"Framebuffer unsupported"),_r5);if(e!==t.FRAMEBUFFER_COMPLETE){Y.warn(i,"Framebuffer incomplete: ".concat(r[e]));}},determineGPUName:function determineGPUName(i){var t=null;var e=null;if(!i){e=document.createElement("canvas");i=e.getContext("experimental-webgl")||e.getContext("webgl");}var r=i&&i.getExtension("WEBGL_debug_renderer_info");if(r){t=i.getParameter(r.UNMASKED_RENDERER_WEBGL);e&&e.remove();}$t(e);return t;},isGPUBlacklisted:function isGPUBlacklisted(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return false;}};});var Dy;var U4=d(function(){Dy=function Dy(i){return typeof i==="number";};});var lrt,sc,Ey,_ot2;var Bs=d(function(){U4();lrt=function lrt(i){return i instanceof _ot2;};sc=function sc(i,t){if(lrt(i)){return{x:i.x,y:i.y};}return{x:i,y:Dy(t)?t:i};};Ey=function Ey(i,t){return function(e,r){var _sc=sc(e,r),o=_sc.x,n=_sc.y;i.x=t(i.x,o);i.y=t(i.y,n);return i;};};_ot2=/*#__PURE__*/function(){function ot(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,ot);this.add=Ey(this,function(t,e){return t+e;});this.subtract=Ey(this,function(t,e){return t-e;});this.divide=Ey(this,function(t,e){return t/e;});this.multiply=Ey(this,function(t,e){return t*e;});this.x=t;this.y=e;}_createClass(ot,[{key:"set",value:function set(t,e){var _sc2=sc(t,e),r=_sc2.x,o=_sc2.y;this.x=r;this.y=o;return this;}},{key:"clone",value:function clone(){return new _ot2(this.x,this.y);}},{key:"copy",value:function copy(t){this.x=t.x;this.y=t.y;return this;}},{key:"clamp",value:function clamp(t,e){if(Dy(t)){t=new _ot2(t,t);}if(Dy(e)){e=new _ot2(e,e);}if(t){this.x=Math.max(t.x,this.x);this.y=Math.max(t.y,this.y);}if(e){this.x=Math.min(e.x,this.x);this.y=Math.min(e.y,this.y);}return this;}},{key:"dot",value:function dot(t,e){var _sc3=sc(t,e),r=_sc3.x,o=_sc3.y;return this.x*r+this.y*o;}},{key:"equals",value:function equals(t,e){var _sc4=sc(t,e),r=_sc4.x,o=_sc4.y;return r===this.x&&o===this.y;}},{key:"flip",value:function flip(){var t=this.x;this.x=this.y;this.y=t;return this;}},{key:"round",value:function round(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this;}},{key:"ceil",value:function ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this;}},{key:"floor",value:function floor(){this.x|=0;this.y|=0;return this;}},{key:"abs",value:function abs(){this.x=Math.abs(this.x);this.y=Math.abs(this.y);return this;}},{key:"len",value:function len(){return Math.sqrt(this.x*this.x+this.y*this.y);}},{key:"min",value:function min(){return Math.min(this.x,this.y);}},{key:"max",value:function max(){return Math.max(this.x,this.y);}},{key:"toObject",value:function toObject(){return{x:this.x,y:this.y};}},{key:"toString",value:function toString(){return"Vector2({ x: ".concat(this.x,", y: ").concat(this.y," })");}},{key:"roundDecimal",value:function roundDecimal(t){this.x=parseFloat(this.x.toFixed(t));this.y=parseFloat(this.y.toFixed(t));return this;}},{key:"asArray",value:function asArray(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(t){return[this.y,this.x];}return[this.x,this.y];}}],[{key:"fromObject",value:function fromObject(t){return new _ot2(t.x,t.y);}},{key:"NULL",get:function get(){return new _ot2(0,0);}}]);return ot;}();});var _rr;var E1=d(function(){Bs();_rr=/*#__PURE__*/function(){function rr(){_classCallCheck(this,rr);this.a=1;this.b=0;this.c=0;this.d=1;this.tx=0;this.ty=0;this.reset();}_createClass(rr,[{key:"multiply",value:function multiply(t){var e;var r;var o;var n;var s;var a;e=this.a*t.a+this.b*t.c;r=this.a*t.b+this.b*t.d;o=this.c*t.a+this.d*t.c;n=this.c*t.b+this.d*t.d;s=this.tx*t.a+this.ty*t.c+t.tx;a=this.tx*t.b+this.ty*t.d+t.ty;this.a=e;this.b=r;this.c=o;this.d=n;this.tx=s;this.ty=a;return this;}},{key:"applyToVector",value:function applyToVector(t){var _t2=t,e=_t2.x,r=_t2.y;t=t.clone();t.x=this.a*e+this.c*r+this.tx;t.y=this.b*e+this.d*r+this.tx;return t;}},{key:"applyInverseToVector",value:function applyInverseToVector(t){var e=1/(this.a*this.d+this.c*-this.b);var _t3=t,r=_t3.x,o=_t3.y;t=t.clone();t.x=this.d*e*r+-this.c*e*o+(this.ty*this.c-this.tx*this.d)*e;t.y=this.a*e*o+-this.b*e*r+(-this.ty*this.a+this.tx*this.b)*e;return t;}},{key:"rectangleToCoordinates",value:function rectangleToCoordinates(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new _ot2(0,0);var r=t.width*(1-e.x);var o=t.width*-e.x;var n=t.height*(1-e.y);var s=t.height*-e.y;var a=[];a.push(new _ot2(this.a*o+this.c*s+this.tx,this.d*s+this.b*o+this.ty));a.push(new _ot2(this.a*r+this.c*s+this.tx,this.d*s+this.b*r+this.ty));a.push(new _ot2(this.a*r+this.c*n+this.tx,this.d*n+this.b*r+this.ty));a.push(new _ot2(this.a*o+this.c*n+this.tx,this.d*n+this.b*o+this.ty));return a;}},{key:"reset",value:function reset(){this.a=1;this.b=0;this.c=0;this.d=1;this.tx=0;this.ty=0;}},{key:"toArray",value:function toArray(){var t=[this.a,this.b,0,this.c,this.d,0,this.tx,this.ty,1];if(typeof Float32Array==="undefined"){return t;}return new Float32Array(t);}},{key:"toString",value:function toString(){return"Matrix({ a: ".concat(this.a,", b: ").concat(this.b,", c: ").concat(this.c,", d: ").concat(this.d,", tx: ").concat(this.tx,", ty: ").concat(this.ty," })");}}],[{key:"IDENTITY",get:function get(){return new _rr();}}]);return rr;}();});var _ce;var F1=d(function(){Bs();_ce=/*#__PURE__*/function(){function ce(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,ce);this.x=0;this.y=0;this.width=0;this.height=0;this.x=t;this.y=e;this.width=r;this.height=o;}_createClass(ce,[{key:"set",value:function set(t,e,r,o){this.x=t;this.y=e;this.width=r;this.height=o;return this;}},{key:"clone",value:function clone(){return new _ce(this.x,this.y,this.width,this.height);}},{key:"copy",value:function copy(t){this.x=t.x;this.y=t.y;this.width=t.width;this.height=t.height;return this;}},{key:"equals",value:function equals(t,e,r,o){if(t instanceof _ce){return t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height;}return t===this.x&&e===this.y&&r===this.width&&o===this.height;}},{key:"translate",value:function translate(t,e){var _sc5=sc(t,e),r=_sc5.x,o=_sc5.y;this.x+=r;this.y+=o;return this;}},{key:"scale",value:function scale(t,e){var _sc6=sc(t,e),r=_sc6.x,o=_sc6.y;this.width*=r;this.height*=o;return this;}},{key:"round",value:function round(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.width=Math.round(this.width);this.height=Math.round(this.height);return this;}},{key:"getPosition",value:function getPosition(){return new _ot2(this.x,this.y);}},{key:"getSize",value:function getSize(){return new _ot2(this.width,this.height);}},{key:"insetBy",value:function insetBy(t,e){this.x+=t;this.y+=e;this.width-=2*t;this.height-=2*e;return this;}},{key:"intersects",value:function intersects(t){var e=new _ot2(this.x,this.y);var r=new _ot2(this.x+this.width,this.y+this.height);var o=new _ot2(t.x,t.y);var n=new _ot2(t.x+t.width,t.y+t.height);if(o.x>r.x||e.x>n.x||n.y>tn;if(ht!==0){ht=255/ht;s[p]=(g*Qo>>tn)*ht;s[p+1]=(x*Qo>>tn)*ht;s[p+2]=(v*Qo>>tn)*ht;}else{s[p]=s[p+1]=s[p+2]=0;}g-=T;x-=k;v-=E;b-=A;T-=ae.r;k-=ae.g;E-=ae.b;A-=ae.a;u=h+((u=a+n+1)>tn;if(ht>0){ht=255/ht;s[u]=g*Qo>>tn;s[u+1]=x*Qo>>tn;s[u+2]=v*Qo>>tn;}else{s[u]=s[u+1]=s[u+2]=0;}g-=T;x-=k;v-=E;b-=A;T-=ae.r;k-=ae.g;E-=ae.b;A-=ae.a;u=a+((u=l+St)0&&arguments[0]!==undefined?arguments[0]:1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var s=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;var a=arguments.length>6&&arguments[6]!==undefined?arguments[6]:1;var l=arguments.length>7&&arguments[7]!==undefined?arguments[7]:0;var c=arguments.length>8&&arguments[8]!==undefined?arguments[8]:0;var u=arguments.length>9&&arguments[9]!==undefined?arguments[9]:0;var m=arguments.length>10&&arguments[10]!==undefined?arguments[10]:0;var p=arguments.length>11&&arguments[11]!==undefined?arguments[11]:0;var h=arguments.length>12&&arguments[12]!==undefined?arguments[12]:1;var g=arguments.length>13&&arguments[13]!==undefined?arguments[13]:0;var x=arguments.length>14&&arguments[14]!==undefined?arguments[14]:0;var v=arguments.length>15&&arguments[15]!==undefined?arguments[15]:0;var b=arguments.length>16&&arguments[16]!==undefined?arguments[16]:0;var T=arguments.length>17&&arguments[17]!==undefined?arguments[17]:0;var k=arguments.length>18&&arguments[18]!==undefined?arguments[18]:1;var E=arguments.length>19&&arguments[19]!==undefined?arguments[19]:0;_classCallCheck(this,Dn);this.set(t,e,r,o,n,s,a,l,c,u,m,p,h,g,x,v,b,T,k,E);}_createClass(Dn,[{key:"set",value:function set(t,e,r,o,n,s,a,l,c,u,m,p,h,g,x,v,b,T,k,E){this.a=t;this.b=e;this.c=r;this.d=o;this.e=n;this.f=s;this.g=a;this.h=l;this.i=c;this.j=u;this.k=m;this.l=p;this.m=h;this.n=g;this.o=x;this.p=v;this.q=b;this.r=T;this.s=k;this.t=E;}},{key:"reset",value:function reset(){this.a=1;this.b=0;this.c=0;this.d=0;this.e=0;this.f=0;this.g=1;this.h=0;this.i=0;this.j=0;this.k=0;this.l=0;this.m=1;this.n=0;this.o=0;this.p=0;this.q=0;this.r=0;this.s=1;this.t=0;}},{key:"apply",value:function apply(t){var e=this.a*t.r+this.b*t.g+this.c*t.b+this.d*t.a+this.e;var r=this.f*t.r+this.g*t.g+this.h*t.b+this.i*t.a+this.j;var o=this.k*t.r+this.l*t.g+this.m*t.b+this.n*t.a+this.o;var n=this.p*t.r+this.q*t.g+this.r*t.b+this.s*t.a+this.t;return new G(e,r,o,n);}},{key:"multiply",value:function multiply(t){var e;var r;var o;var n;var s;var a;var l;var c;var u;var m;var p;var h;var g;var x;var v;var b;var T;var k;var E;var A;var I=t;var F=this;e=I.a*F.a+I.b*F.f+I.c*F.k+I.d*F.p;r=I.a*F.b+I.b*F.g+I.c*F.l+I.d*F.q;o=I.a*F.c+I.b*F.h+I.c*F.m+I.d*F.r;n=I.a*F.d+I.b*F.i+I.c*F.n+I.d*F.s;a=I.f*F.a+I.g*F.f+I.h*F.k+I.i*F.p;l=I.f*F.b+I.g*F.g+I.h*F.l+I.i*F.q;c=I.f*F.c+I.g*F.h+I.h*F.m+I.i*F.r;u=I.f*F.d+I.g*F.i+I.h*F.n+I.i*F.s;p=I.k*F.a+I.l*F.f+I.m*F.k+I.n*F.p;h=I.k*F.b+I.l*F.g+I.m*F.l+I.n*F.q;g=I.k*F.c+I.l*F.h+I.m*F.m+I.n*F.r;x=I.k*F.d+I.l*F.i+I.m*F.n+I.n*F.s;b=I.p*F.a+I.q*F.f+I.r*F.k+I.s*F.p;T=I.p*F.b+I.q*F.g+I.r*F.l+I.s*F.q;k=I.p*F.c+I.q*F.h+I.r*F.m+I.s*F.r;E=I.p*F.d+I.q*F.i+I.r*F.n+I.s*F.s;s=I.a*F.e+I.b*F.j+I.c*F.o+I.d*F.t+I.e;m=I.f*F.e+I.g*F.j+I.h*F.o+I.i*F.t+I.j;v=I.k*F.e+I.l*F.j+I.m*F.o+I.n*F.t+I.o;A=I.p*F.e+I.q*F.j+I.r*F.o+I.s*F.t+I.t;this.a=e;this.b=r;this.c=o;this.d=n;this.e=s;this.f=a;this.g=l;this.h=c;this.i=u;this.j=m;this.k=p;this.l=h;this.m=g;this.n=x;this.o=v;this.p=b;this.q=T;this.r=k;this.s=E;this.t=A;return this;}},{key:"clone",value:function clone(){var t=new _Dn();t.set(this.a,this.b,this.c,this.d,this.e,this.f,this.g,this.h,this.i,this.j,this.k,this.l,this.m,this.n,this.o,this.p,this.q,this.r,this.s,this.t);return t;}},{key:"equals",value:function equals(t){return this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d&&this.e===t.e&&this.f===t.f&&this.g===t.g&&this.h===t.h&&this.i===t.i&&this.j===t.j&&this.k===t.k&&this.l===t.l&&this.m===t.m&&this.n===t.n&&this.o===t.o&&this.p===t.p&&this.q===t.q&&this.r===t.r&&this.s===t.s&&this.t===t.t;}},{key:"getOffsets",value:function getOffsets(){return[this.e,this.j,this.o,this.t];}},{key:"toString",value:function toString(){return"ColorMatrix( ".concat(this.a,", ").concat(this.b,", ").concat(this.c,", ").concat(this.d,", ").concat(this.e,",\n ").concat(this.f,", ").concat(this.g,", ").concat(this.h,", ").concat(this.i,", ").concat(this.j,",\n ").concat(this.k,", ").concat(this.l,", ").concat(this.m,", ").concat(this.n,", ").concat(this.o,",\n ").concat(this.p,", ").concat(this.q,", ").concat(this.r,", ").concat(this.s,", ").concat(this.t," )");}},{key:"toArray",value:function toArray(){var _this39=this;return"abcdefghijklmnopqrst".split("").map(function(t){return _this39[t];});}}],[{key:"IDENTITY",get:function get(){return new _Dn();}},{key:"createBrightnessMatrix",value:function createBrightnessMatrix(t){var e=new _Dn();e.e=t;e.j=t;e.o=t;return e;}},{key:"createContrastMatrix",value:function createContrastMatrix(t){var e=new _Dn();var r=(1-t)/2;e.a=e.g=e.m=t;e.e=e.j=e.o=r;return e;}},{key:"createSaturationMatrix",value:function createSaturationMatrix(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;var e=new _Dn();var r=1-t;var o=.213*r;var n=.715*r;var s=.072*r;e.a=o+t;e.b=n;e.c=s;e.f=o;e.g=n+t;e.h=s;e.k=o;e.l=n;e.m=s+t;return e;}},{key:"createExposureMatrix",value:function createExposureMatrix(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=Math.pow(2,t);return new _Dn(e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0);}},{key:"createLinearMatrix",value:function createLinearMatrix(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=new _Dn();r.a=r.g=r.m=t;r.e=r.j=r.o=e;return r;}}]);return Dn;}();eh=_Dn;});var _Td,_t;var kd=d(function(){Ar();Tn();oc();Sd();O1();Bs();kn();_Td=/*#__PURE__*/function(_Vi){_inherits(Td,_Vi);var _super22=_createSuper(Td);function Td(){var _this40;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Td);_this40=_super22.call(this);_this40.availableOptions=_objectSpread(_objectSpread({},Object.getPrototypeOf(_assertThisInitialized(_this40)).availableOptions),e);_this40._onConfigurableUpdate=_this40._onConfigurableUpdate.bind(_assertThisInitialized(_this40));_this40._initOptions(t);return _this40;}_createClass(Td,[{key:"_buildConfigError",value:function _buildConfigError(t){var e="";if(this.constructor.name){e="".concat(this.constructor.name,": ");}e+=t;return new Error(e);}},{key:"_onOptionsChange",value:function _onOptionsChange(){}},{key:"validateSettings",value:function validateSettings(){var _this41=this;return new Promise(function(t,e){for(var r in _this41.availableOptions){var o=_this41.availableOptions[r];if(o.required&&typeof _this41._options[r]==="undefined"){return e(_this41._buildConfigError("Option `".concat(r,"` is required.")));}}t();});}},{key:"_initOptions",value:function _initOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._options={};var e;var r;var o;var n=this;for(e in this.availableOptions){o=e.charAt(0).toUpperCase()+e.slice(1);r=this.availableOptions[e];if(["string","number","boolean","object","vector2","color","configurable","color-matrix","array","image","function","*"].indexOf(r.type)===-1){throw this._buildConfigError("Unknown option type: `".concat(r.type,"`"));}var s=function a(l){n["set".concat(o)]=function(c,u,m){n.setOption(l,c,u,m);};n["get".concat(o)]=function(){return n.getOption(l);};};s(e);if(r.type==="configurable"){this._options[e]=new _Td(void 0,r.structure||{});this._options[e].on("update",this._onConfigurableUpdate);}if(!(e in t)||typeof t[e]==="undefined"){if(typeof r["default"]!=="undefined"){var a=r["default"];if(typeof r["default"]==="function"){a=r["default"]();}this["set".concat(o)](a,false,true);}else if(r.type!=="configurable"){this._options[e]=void 0;}}}for(e in t){if(typeof this.availableOptions[e]==="undefined"){throw new Error("Invalid option: ".concat(e));}if(typeof t[e]!=="undefined"){o=e.charAt(0).toUpperCase()+e.slice(1);this["set".concat(o)](t[e],false,true);}}}},{key:"set",value:function set(t){var _this42=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;Object.keys(t).forEach(function(r){_this42.setOption(r,t[r],false);});this._onOptionsChange();if(e){this.emit("update",this,t);}}},{key:"getOption",value:function getOption(t){return this._options[t];}},{key:"hasOption",value:function hasOption(t){return!!this.availableOptions[t];}},{key:"getOptionDefault",value:function getOptionDefault(t){var e=this.availableOptions[t];if(!e){throw new Error("Invalid option: ".concat(t));}return e["default"];}},{key:"resetOptions",value:function resetOptions(){this.set(this.getDefaultOptions());}},{key:"getDefaultOptions",value:function getDefaultOptions(){var t={};for(var e in this.availableOptions){var r=this.availableOptions[e]["default"];if(typeof r==="undefined")continue;t[e]=r;}return t;}},{key:"getOptions",value:function getOptions(){return _objectSpread({},this._options);}},{key:"equals",value:function equals(t){var e=t.getOptions();return this.optionsEqual(e);}},{key:"optionsEqual",value:function optionsEqual(t){for(var e in t){var r=t[e];if(!this._optionEquals(e,r)){return false;}}return true;}},{key:"_optionEquals",value:function _optionEquals(t,e){var r=this.availableOptions[t];if(typeof r==="undefined"){throw new Error("Invalid option: ".concat(t));}var o=this.availableOptions[t].type;var n=this._options[t];if(n===e)return true;if(typeof e==="undefined"||typeof n==="undefined")return false;switch(o){case"object":if(typeof n.optionsEqual==="function"){return n.optionsEqual(e._options);}return n===e;case"string":case"number":case"boolean":case"function":case"*":return n===e;case"vector2":return n.equals(e);case"color":case"color-matrix":return e.equals(n);case"configurable":return n.optionsEqual(e);case"array":return this._arrayOptionEquals(t,e);case"image":return n.src===e.src;}}},{key:"_arrayOptionEquals",value:function _arrayOptionEquals(t,e){var r=this._options[t];if(e.length!==r.length){return false;}var o=true;for(var n=0;n0&&arguments[0]!==undefined?arguments[0]:Object.keys(this._options);var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r={};t.forEach(function(o){if(typeof _this43.availableOptions[o]==="undefined"){return Log.warn("Trying to serialize a key that does not exist: ".concat(o));}if(_this43.availableOptions[o].serializable===false)return;r[o]=_this43.serializeOption(o,e);});return r;}},{key:"serializeOption",value:function serializeOption(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=this.availableOptions[t];var o=r.type;var n=this._options[t];if(!n)return n;if(r.serializable===false){throw new Error("Option `".concat(t,"` is not serializable."));}switch(o){case"string":case"number":case"boolean":case"object":case"function":case"*":return n;case"vector2":return e?n.toObject():n.clone();case"color":case"color-matrix":return e?n.toArray():n.clone();case"configurable":return n.serializeOptions(void 0,e);case"array":return n.slice(0);case"image":return e?n.src:n;}}},{key:"setOption",value:function setOption(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=this.availableOptions[t];if(!n){throw new Error("Invalid option: ".concat(t));}if(typeof n.setter!=="undefined"){e=n.setter.call(this,e,o);}if(typeof n.validation!=="undefined"){n.validation(e);}if(e===null||typeof e==="undefined"){if(n.required){throw this._buildConfigError("Option `".concat(t,"` is required."));}this._options[t]=e;}else{switch(n.type){case"string":{if(typeof e!=="string"){throw this._buildConfigError("Option `".concat(t,"` has to be a string."));}var s=n.available;if(typeof s!=="undefined"&&s.indexOf(e)===-1){throw this._buildConfigError("Invalid value for `".concat(t,"` (valid values are: ").concat(n.available.join(", "),")"));}this._options[t]=e;break;}case"number":if(typeof e!=="number"){throw this._buildConfigError("Option `".concat(t,"` has to be a number."));}this._options[t]=e;break;case"boolean":if(typeof e!=="boolean"){throw this._buildConfigError("Option `".concat(t,"` has to be a boolean."));}this._options[t]=e;break;case"vector2":if(!(e instanceof _ot2)&&!(_typeof(e)==="object"&&"x"in e&&"y"in e)){throw this._buildConfigError("Option `".concat(t,"` has to be an instance of Vector2 or an Object holding x and y values."));}if(e instanceof _ot2){this._options[t]=e.clone();}else{this._options[t]=_ot2.fromObject(e);}break;case"color":if(!(e instanceof G)){throw this._buildConfigError("Option `".concat(t,"` has to be an instance of Color."));}this._options[t]=e;break;case"color-matrix":if(!(e instanceof eh)){throw this._buildConfigError("Option `".concat(t,"` has to be an instance of ColorMatrix."));}this._options[t]=e.clone();break;case"function":if(typeof e!=="function"){throw this._buildConfigError("Option `".concat(t,"` has to be a function."));}this._options[t]=e;break;case"object":case"*":this._options[t]=e;break;case"image":{var _pi=pi,_s3=_pi.Image;if(typeof e==="string"){var a=new _s3();if(T4(a)){a.crossOrigin=z.getCrossOriginValue(n.crossOrigin);}a.src=e;this._options[t]=a;}else if(e instanceof _s3||typeof HTMLCanvasElement!=="undefined"&&e instanceof HTMLCanvasElement||typeof HTMLImageElement!=="undefined"&&e instanceof HTMLImageElement){this._options[t]=e;}else{throw this._buildConfigError("Option `".concat(t,"` has to be an Image, Canvas or String."));}break;}case"configurable":if(e instanceof _Td){this._options[t]=e;}else{this._options[t].set(e);}break;case"array":if(!(e instanceof Array)){throw this._buildConfigError("Option `".concat(t,"` has to be an Array."));}this._options[t]=e.slice(0);break;default:throw this._buildConfigError("Unknown option type: `".concat(n.type,"`"));}}if(r){this._onOptionsChange();this.emit("update",this,_defineProperty({},t,e));}}},{key:"_onConfigurableUpdate",value:function _onConfigurableUpdate(){for(var _len9=arguments.length,t=new Array(_len9),_key9=0;_key9<_len9;_key9++){t[_key9]=arguments[_key9];}this.emit.apply(this,["update"].concat(t));}},{key:"hasChanges",value:function hasChanges(){var t=this.getDefaultOptions();return!this.optionsEqual(t);}}]);return Td;}(Vi);_t=_Td;});var ih;var R1=d(function(){Ar();Le();Le();ih=/*#__PURE__*/function(){function ih(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:[];_classCallCheck(this,ih);this._program=null;this._renderer=t;this._vertexSource=e;this._fragmentSource=r;this._uniforms=o;this._uniformLocations={};this._attributes=n;this._attributeLocations={};this._onContextChange=this._onContextChange.bind(this);this._renderer.on("context",this._onContextChange);this._init();}_createClass(ih,[{key:"_init",value:function _init(){this._compile();var t=this._renderer.getContext();t.useProgram(this._program);this._cacheUniformLocations();this._cacheAttributeLocations();}},{key:"_onContextChange",value:function _onContextChange(){this._init();}},{key:"setupBuffers",value:function setupBuffers(t,e){var r=this._renderer.getContext();r.bindBuffer(r.ARRAY_BUFFER,t);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e);r.vertexAttribPointer(this._attributeLocations.a_position,2,r.FLOAT,false,Xa,0);r.vertexAttribPointer(this._attributeLocations.a_texCoord,2,r.FLOAT,false,Xa,2*4);r.vertexAttribPointer(this._attributeLocations.a_color,4,r.UNSIGNED_BYTE,true,Xa,4*4);}},{key:"syncUniforms",value:function syncUniforms(){var _this44=this;Object.keys(this._uniforms).forEach(function(t){_this44.syncUniform(t);});}},{key:"syncUniform",value:function syncUniform(t){var e=this._renderer.getContext();var r=this._uniforms[t];var o=this._uniformLocations[t];switch(r.type){case"sampler2d":e.uniform1i(o,r.value);break;case"i":case"1i":e.uniform1i(o,r.value);break;case"2i":e.uniform2i(o,r.value[0],r.value[1]);break;case"3i":e.uniform3i(o,r.value[0],r.value[1],r.value[2]);break;case"4i":e.uniform4i(o,r.value[0],r.value[1],r.value[2],r.value[3]);break;case"f":case"1f":e.uniform1f(o,r.value);break;case"2f":e.uniform2f(o,r.value[0],r.value[1]);break;case"3f":e.uniform3f(o,r.value[0],r.value[1],r.value[2]);break;case"4f":e.uniform4f(o,r.value[0],r.value[1],r.value[2],r.value[3]);break;case"2fv":e.uniform2fv(o,r.value);break;case"mat3":case"mat3fv":e.uniformMatrix3fv(o,false,r.value);break;case"mat4":e.uniformMatrix4fv(o,false,r.value);break;default:Y.warn(this.constructor.name,"Unknown uniform type: ".concat(r.type));}}},{key:"_cacheAttributeLocations",value:function _cacheAttributeLocations(){var _this45=this;var t=this._renderer.getContext();this._attributes.forEach(function(e){if(_this45._program){_this45._attributeLocations[e]=t.getAttribLocation(_this45._program,e);}});}},{key:"_cacheUniformLocations",value:function _cacheUniformLocations(){var _this46=this;var t=this._renderer.getContext();var e=Object.keys(this._uniforms);e.forEach(function(r){if(_this46._program){var o=t.getUniformLocation(_this46._program,r);if(o){_this46._uniformLocations[r]=o;}}});}},{key:"_addPrecisionToSource",value:function _addPrecisionToSource(t){var e=this._renderer.getMaxFloatPrecision();var r="mediump";if(z.isMobile()&&e==="highp"){r="highp";}return"precision ".concat(r," float;\n").concat(t);}},{key:"_compile",value:function _compile(){var t=this._renderer.getContext();var e=this._compileShader(t.VERTEX_SHADER,this._vertexSource);this._vertexShader=e;var r=this._addPrecisionToSource(this._fragmentSource);var o=this._compileShader(t.FRAGMENT_SHADER,r);this._fragmentShader=o;var n=t.createProgram();if(!n){return;}t.attachShader(n,e);t.attachShader(n,o);t.linkProgram(n);var s=t.getProgramParameter(n,t.LINK_STATUS);if(!s){var a=t.getProgramInfoLog(n);if(t.isContextLost())a="WebGL context lost";t.deleteProgram(n);Y.error(this.constructor.name,"WebGL program linking error: ".concat(a));}else{this._program=n;}}},{key:"_compileShader",value:function _compileShader(t,e){var r=this._renderer.getContext();var o=r.createShader(t);if(!o){throw new Error("Cannot create shared: ".concat(JSON.stringify(t)));}r.shaderSource(o,e);r.compileShader(o);var n=r.getShaderParameter(o,r.COMPILE_STATUS);if(!n){var s=r.getShaderInfoLog(o);if(r.isContextLost())s="WebGL context lost";r.deleteShader(o);Y.error(this.constructor.name,"WebGL shader compilation error: ".concat(s));}return o;}},{key:"setUniform",value:function setUniform(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;this._uniforms[t].value=e;if(r){this.syncUniform(t);}}},{key:"setUniforms",value:function setUniforms(t){var _this47=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;Object.keys(t).forEach(function(r){_this47._uniforms[r].value=t[r];if(e){_this47.syncUniform(r);}});}},{key:"getUniforms",value:function getUniforms(){return this._uniforms;}},{key:"getAttributes",value:function getAttributes(){return this._attributes;}},{key:"getAttributeLocations",value:function getAttributeLocations(){return this._attributeLocations;}},{key:"getProgram",value:function getProgram(){return this._program;}},{key:"dispose",value:function dispose(){var t=this._renderer.getContext();t.deleteProgram(this._program);t.deleteShader(this._vertexShader);t.deleteShader(this._fragmentShader);this._renderer.off("context",this._onContextChange);}}]);return ih;}();});var j4;var V4=d(function(){j4="uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_texCoord) * v_color;\n}\n";});var K4;var $4=d(function(){K4="attribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\nuniform mat3 u_projMatrix;\n\nvoid main() {\n gl_Position = vec4((u_projMatrix * vec3(a_position, 1)).xy, 0, 1);\n v_texCoord = a_texCoord;\n v_color = vec4(a_color.rgb * a_color.a, a_color.a);\n}\n";});var hrt,Ps,A1;var X4=d(function(){Ar();Le();R1();V4();$4();hrt=new _rr();Ps={vertexSource:K4,fragmentSource:j4,uniforms:{u_image:{type:"sampler2d",value:0},u_projMatrix:{type:"mat3",value:hrt.toArray()}},attributes:["a_position","a_texCoord","a_color"]};A1=/*#__PURE__*/function(_ih){_inherits(A1,_ih);var _super23=_createSuper(A1);function A1(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Ps.vertexSource;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:Ps.fragmentSource;_classCallCheck(this,A1);return _super23.call(this,t,e,r,Ps.uniforms,Ps.attributes);}return A1;}(ih);});var B1=d(function(){R1();X4();});var Uo;var Id=d(function(){To();G4();Ar();kd();Le();B1();Tn();Uo=/*#__PURE__*/function(_t4){_inherits(Uo,_t4);var _super24=_createSuper(Uo);function Uo(){var _this48;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Uo);_this48=_super24.call(this,t,e);_this48._initOptions(t);return _this48;}_createClass(Uo,[{key:"_initOptions",value:function _initOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._shaders=[];this._availableUniforms=Ps.uniforms;this._attributes=Ps.attributes;this._vertexSource=Ps.vertexSource;this._fragmentSource=Ps.fragmentSource;this._initUniforms();_get(_getPrototypeOf(Uo.prototype),"_initOptions",this).call(this,t);}},{key:"_initUniforms",value:function _initUniforms(){this._uniforms={};for(var t in this._availableUniforms){var e=this._availableUniforms[t];this._uniforms[t]={type:e.type,value:e["default"]||null};}for(var _t5 in this.availableOptions){var _e2=this.availableOptions[_t5];if(!_e2.uniformType){Y.trace(this.constructor.name,"Option `".concat(_t5,"` is missing a `uniformType`!"));}else{this._uniforms["u_".concat(_t5)]={type:_e2.uniformType,value:_e2["default"]||null};}}}},{key:"setOption",value:function setOption(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;_get(_getPrototypeOf(Uo.prototype),"setOption",this).call(this,t,e,r);var o=e;var n=this.availableOptions[t];if(!n.uniformType){return;}var s="u_".concat(t);switch(n.type){case"color":if(n.uniformType==="4f"){o=e.toGLColor();}else if(n.uniformType==="3f"){o=e.toRGBGLColor();}break;case"vector2":o=[e.x,e.y];break;case"color-matrix":{o=[e.a,e.b,e.c,e.d,e.f,e.g,e.h,e.i,e.k,e.l,e.m,e.n,e.p,e.q,e.r,e.s];var a=[e.e,e.j,e.o,e.t];this._uniforms["".concat(s,"_vec")]={value:a,type:"4f"};}}this.setUniform(s,o);}},{key:"setUniform",value:function setUniform(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;this._uniforms[t].value=e;}},{key:"setUniforms",value:function setUniforms(t){var _this49=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;Object.entries(t).forEach(function(_ref88){var _ref89=_slicedToArray(_ref88,2),r=_ref89[0],o=_ref89[1];_this49._uniforms[r].value=o;if(e){_this49.syncUniform(r);}});}},{key:"syncUniform",value:function syncUniform(t){this._shaders.forEach(function(e){e.syncUniform(t);});}},{key:"syncUniforms",value:function syncUniforms(){this._shaders.forEach(function(t){t.syncUniforms();});}},{key:"getShaderForRenderer",value:function getShaderForRenderer(t){var e=t.id;if(!this._shaders)this._shaders=[];var r=this._shaders[e];if(!r){r=new ih(t,this._vertexSource,this._fragmentSource,this._uniforms,this._attributes);this._shaders[e]=r;}return r;}},{key:"apply",value:function apply(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(bd(t)){this._applyWebGL(t,e,r,o);}else{this._applyCanvas(t,e,r,o);}}},{key:"_applyWebGL",value:function _applyWebGL(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=t.getContext();var s=this.getShaderForRenderer(t);t.setRenderTarget(r);if(o){r.clear();}t.setShader(s);var a=t.getCurrentRenderTarget().getProjectionMatrix().toArray();s.setUniform("u_projMatrix",a);s.syncUniforms();n.activeTexture(n.TEXTURE0);n.bindTexture(n.TEXTURE_2D,e.getTexture());n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);}},{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=r.getContext();Y.warn(this.constructor.name,"`_applyCanvas` is not implemented. Just copying image data from `inputTarget` to `outputTarget`.");s.clearRect(0,0,n.width,n.height);s.drawImage(n,0,0);}},{key:"dispose",value:function dispose(){this._shaders.forEach(function(t){return t.dispose();});this._shaders=[];}},{key:"_blurImage",value:function _blurImage(t,e,r){var o=10;var n=t.getCanvas();var s=Math.min(1,o/(r*Math.min(n.width,n.height)));var a=z.createCanvas();a.width=Math.round(n.width*s);a.height=Math.round(n.height*s);var l=a.getContext("2d");l.drawImage(n,0,0,n.width,n.height,0,0,a.width,a.height);var c=r*Math.min(a.width,a.height);var u=l.getImageData(0,0,a.width,a.height);W4(u,0,0,a.width,a.height,c);l.putImageData(u,0,0);e.getContext().drawImage(a,0,0,a.width,a.height,0,0,n.width,n.height);$t(a);}}]);return Uo;}(_t);});var Y4;var q4=d(function(){Y4="uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\n\nvoid main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4(color.a > 0. ? color.rgb / color.a : vec3(0), color.a);\n}\n";});var Dd;var J4=d(function(){Id();q4();Dd=/*#__PURE__*/function(_Uo){_inherits(Dd,_Uo);var _super25=_createSuper(Dd);function Dd(){var _this50;_classCallCheck(this,Dd);_this50=_super25.call(this);_this50._fragmentSource=Y4;return _this50;}return Dd;}(Uo);});var Q4;var Z4=d(function(){Q4="uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform vec4 u_color;\n\nvoid main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4(mix(color.rgb, u_color.rgb, u_color.a), color.a) * color.a;\n}\n";});var brt,yrt,P1,t3;var e3=d(function(){Le();Id();Z4();brt=ir.OptionType;yrt=ir.UniformType;P1=/*#__PURE__*/function(_Uo2){_inherits(P1,_Uo2);var _super26=_createSuper(P1);function P1(){var _this51;_classCallCheck(this,P1);for(var _len10=arguments.length,t=new Array(_len10),_key10=0;_key10<_len10;_key10++){t[_key10]=arguments[_key10];}_this51=_super26.call.apply(_super26,[this].concat(t));_this51._fragmentSource=Q4;return _this51;}_createClass(P1,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=this._options.color;var c=s.getImageData(0,0,n.width,n.height);var u=a.getImageData(0,0,n.width,n.height);var m=n.width*n.height;var p=new G();var h=new G();for(var g=0;g3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var _this$_options=this._options,c=_this$_options.mode,u=_this$_options.color;var m=u.r,p=u.g,h=u.b,g=u.a;var x=[.2125,.7154,.0721];switch(c){case _qa.MODES.SOLID:for(var v=0;v3&&arguments[3]!==undefined?arguments[3]:false;var n=this._options.overlayTexture.getRenderTarget().getContext();var s=e.getCanvas();var a=e.getContext();var l=r.getContext();var c=a.getImageData(0,0,s.width,s.height);var u=n.getImageData(0,0,s.width,s.height);var _this$_options2=this._options,m=_this$_options2.blendMode,p=_this$_options2.alpha;var h=new G();var g=new G();var x=new G();for(var v=0;v3&&arguments[3]!==undefined?arguments[3]:pi.createCanvas();var n=arguments.length>4?arguments[4]:undefined;_classCallCheck(this,Ms);this._width=t;this._height=e;this._pixelRatio=r;this._baseTexture=new Ae();this._canvas=o;var s=n||this._canvas.getContext("2d");if(!s){throw new Error("Cannot get canvas context");}this._context=s;this._baseTexture.setSource(this._canvas);this._canvas.width=this._width*this._pixelRatio;this._canvas.height=this._height*this._pixelRatio;this._filterStack=[{renderTarget:this,filters:[]}];}_createClass(Ms,[{key:"clear",value:function clear(){var t=this._context;t.setTransform(1,0,0,1,0,0);t.clearRect(0,0,this._width*this._pixelRatio,this._height*this._pixelRatio);}},{key:"resizeTo",value:function resizeTo(t){this._baseTexture.resizeTo(t);if(this._width!==t.x){this._width=t.x;this._canvas.width=this._width*this._pixelRatio;}if(this._height!==t.y){this._height=t.y;this._canvas.height=this._height*this._pixelRatio;}}},{key:"getCanvas",value:function getCanvas(){return this._canvas;}},{key:"getContext",value:function getContext(){return this._context;}},{key:"getFilterStack",value:function getFilterStack(){return this._filterStack;}},{key:"getWidth",value:function getWidth(){return this._width;}},{key:"getHeight",value:function getHeight(){return this._height;}},{key:"getPixelRatio",value:function getPixelRatio(){return this._pixelRatio;}},{key:"setPixelRatio",value:function setPixelRatio(t){this._pixelRatio=t;}},{key:"getDimensions",value:function getDimensions(){return new _ot2(this._width,this._height);}},{key:"getBaseTexture",value:function getBaseTexture(){return this._baseTexture;}},{key:"dispose",value:function dispose(){delete this._canvas;delete this._context;this._baseTexture.dispose();}}]);return Ms;}();});var lc;var Ay=d(function(){Le();rh();lc=/*#__PURE__*/function(){function lc(t){_classCallCheck(this,lc);this._renderer=t;this._filterStack=[{renderTarget:t.getCurrentRenderTarget(),filters:[]}];this._textures=[];this._textureFrame=new _ce(0,0,t.getWidth(),t.getHeight());}_createClass(lc,[{key:"resizeTo",value:function resizeTo(t){this._textureFrame.width=t.x;this._textureFrame.height=t.y;this._textures.forEach(function(e){return e.resizeTo(t);});}},{key:"pushFilters",value:function pushFilters(t,e){this._currentFrame=t.getBounds();var r=this._getOrCreateRenderTarget();this._renderer.setRenderTarget(r);this._filterStack.push({renderTarget:r,filters:e});r.clear();}},{key:"popFilters",value:function popFilters(){var t=this._filterStack.pop();if(!t)return void 0;var e=t.filters,r=t.renderTarget;var o=this._filterStack[this._filterStack.length-1];var n=r;var s=o.renderTarget;if(e.length===1){var a=e[0];a.apply(this._renderer,n,s);this._textures.push(n);}else{this._applyFilters(e,n,s);}return e;}},{key:"_applyFilters",value:function _applyFilters(t,e,r){var _this56=this;var o=e;var n=this._getOrCreateRenderTarget(true);var s=t[t.length-1];t.forEach(function(a){var l=a===s;if(!l){a.apply(_this56._renderer,o,n);var c=o;o=n;n=c;}else{a.apply(_this56._renderer,o,r);}});this._textures.push(o);this._textures.push(n);}},{key:"_getOrCreateRenderTarget",value:function _getOrCreateRenderTarget(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._textures.pop();if(!e){e=new Ms(this._textureFrame.width,this._textureFrame.height,1);}if(t){e.clear();}return e;}},{key:"setFilterStack",value:function setFilterStack(t){this._filterStack=t;}},{key:"dispose",value:function dispose(){}}]);return lc;}();});var nh=Gt(function(p3,oh){(function(){var i,t,e,r,o,n;if(typeof performance!=="undefined"&&performance!==null&&performance.now){oh.exports=function(){return performance.now();};}else if(typeof process!=="undefined"&&process!==null&&process.hrtime){oh.exports=function(){return(i()-o)/1e6;};t=process.hrtime;i=function i(){var s;s=t();return s[0]*1e9+s[1];};r=i();n=process.uptime()*1e9;o=r-n;}else if(Date.now){oh.exports=function(){return Date.now()-e;};e=Date.now();}else{oh.exports=function(){return new Date().getTime()-e;};e=new Date().getTime();}}).call(p3);});var h3,f3,By;var N1=d(function(){Le();h3=typeof window!=="undefined"&&window.performance&&window.performance.now?window.performance.now.bind(window.performance):nh();f3=/*#__PURE__*/function(){function f3(t){var _this57=this;_classCallCheck(this,f3);this._context=t;this._tracking=false;var e=this;var _loop2=function _loop2(r){var o=t[r];if(typeof o==="function"){_this57[r]=function(){var s=t[r];for(var _len13=arguments.length,n=new Array(_len13),_key13=0;_key13<_len13;_key13++){n[_key13]=arguments[_key13];}if(!e._tracking){return s.apply(t,n);}var a=h3();var l=s.apply(t,n);var c=h3()-a;var u={functionName:r,arguments:n,duration:c};e._trackedCalls.push(u);return l;};}else{_this57._makePropertyWrapper(r);}};for(var r in t){_loop2(r);}}_createClass(f3,[{key:"_makePropertyWrapper",value:function _makePropertyWrapper(t){var e=["_context","_trackedCalls","_tracking"];if(e.indexOf(t)!==-1)return;var r=this._context;this.__defineGetter__(t,function(){return r[t];});this.__defineSetter__(t,function(o){r[t]=o;});}},{key:"startFrame",value:function startFrame(){this._tracking=true;this._trackedCalls=[];}},{key:"endFrame",value:function endFrame(){var t="Rendering";Y.log(t,"Frame rendering results:");Y.log(t,"Context calls: ".concat(this._trackedCalls.length));var e={};this._trackedCalls.forEach(function(_ref90){var o=_ref90.functionName,n=_ref90.duration;e[o]=e[o]||{totalDuration:0,calls:0};e[o].totalDuration+=n;e[o].calls++;});var r=[];for(var o in e){var n=e[o];n.averageDuration=n.totalDuration/n.calls;r.push({functionName:o,data:n});}r.sort(function(o,n){return n.data.totalDuration-o.data.totalDuration;});r=r.slice(0,3);r.forEach(function(o){Y.log(t,"".concat(o.functionName,": ").concat(o.data.calls," calls, ").concat(o.data.totalDuration.toFixed(2),"ms"));});}}]);return f3;}();By=f3;});var sh;var H1=d(function(){Le();sh=/*#__PURE__*/function(_Vi3){_inherits(sh,_Vi3);var _super30=_createSuper(sh);function sh(){var _this58;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:800;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:600;var r=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,sh);_this58=_super30.call(this);_this58._maxTextureSize=null;_this58._options=_objectSpread(_objectSpread({debug:false,transparent:false,clearColor:G.TRANSPARENT},r),{},{pixelRatio:1});_this58.setMaxListeners(0);_this58._width=t;_this58._height=e;_this58._dimensions=new _ot2(_this58._width,_this58._height);_this58._maxTextureSize=null;_this58._pixelRatio=_this58._options.pixelRatio;_this58._canvas=_this58._options.canvas;_this58._clearColor=_this58._options.transparent?G.TRANSPARENT:_this58._options.clearColor||G.BLACK;return _this58;}_createClass(sh,[{key:"setCanvas",value:function setCanvas(t){var e=this._canvas;this._canvas=t;if(e!==t){this._createContext();this._onBeforeContext();this._setupContext();}this.resizeTo(new _ot2(this._width,this._height));}},{key:"getCanvas",value:function getCanvas(){return this._canvas;}},{key:"_onBeforeContext",value:function _onBeforeContext(){}},{key:"resizeTo",value:function resizeTo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;this._width=t.x*this._pixelRatio;this._height=t.y*this._pixelRatio;if(e&&this._canvas){this._canvas.width=this._width;this._canvas.height=this._height;if("style"in this._canvas){this._canvas.style.width="".concat(this._width/this._pixelRatio,"px");this._canvas.style.height="".concat(this._height/this._pixelRatio,"px");}}this._dimensions=t.clone();}},{key:"_createContext",value:function _createContext(){Y.warn(this.constructor.name,"`_createContext` is abstract and not implemented in inherited class");}},{key:"_setupContext",value:function _setupContext(){Y.warn(this.constructor.name,"`_setupContext` is abstract and not implemented in inherited class");}},{key:"render",value:function render(t){Y.warn(this.constructor.name,"`render` is abstract and not implemented in inherited class");}},{key:"getMaxDimensions",value:function getMaxDimensions(){return null;}},{key:"getContext",value:function getContext(){return this._context;}},{key:"getWidth",value:function getWidth(){return this._dimensions.x;}},{key:"getHeight",value:function getHeight(){return this._dimensions.y;}},{key:"getDimensions",value:function getDimensions(){return this._dimensions;}},{key:"getPixelRatio",value:function getPixelRatio(){return this._pixelRatio;}},{key:"setPixelRatio",value:function setPixelRatio(t){this._pixelRatio=t;if(this._defaultRenderTarget){this._defaultRenderTarget.setPixelRatio(t);}}},{key:"getMaxTextureSize",value:function getMaxTextureSize(){return this._maxTextureSize;}},{key:"getFilterManager",value:function getFilterManager(){return this._filterManager;}},{key:"setFilterManager",value:function setFilterManager(t){this._filterManager=t;}},{key:"setClearColor",value:function setClearColor(t){this._clearColor=t;}},{key:"getClearColor",value:function getClearColor(){return this._clearColor;}},{key:"isOfType",value:function isOfType(t){return this._type===t;}},{key:"dispose",value:function dispose(){Y.warn(this.constructor.name,"`dispose` is abstract and not implemented in inherited class");}}]);return sh;}(Vi);});var g3,_W2,Od;var b3=d(function(){To();Fy();Le();Ay();rh();N1();Tn();H1();g3=ir.RendererType;_W2=/*#__PURE__*/function(_sh){_inherits(W1,_sh);var _super31=_createSuper(W1);function W1(){var _this59;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:800;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:600;var r=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,W1);_this59=_super31.call(this,t,e,_objectSpread({},r));_this59.id=0;_this59.setCanvas((r==null?void 0:r.canvas)||pi.createCanvas());_this59._type=g3.CANVAS;return _this59;}_createClass(W1,[{key:"_createContext",value:function _createContext(){var t=this._canvas;var e=t.getContext("2d");if(!e)return;if(this._options.debug){e=new By(e);}this.id=_W2.contextId++;this._context=e;this.emit("context",e);return e;}},{key:"_setupContext",value:function _setupContext(){var t=this._context;if(!("imageSmoothingEnabled"in t)){["moz","webkit","ms"].forEach(function(e){if(t[e]){t[e]=true;}});}else{t.imageSmoothingEnabled=true;}this._defaultRenderTarget=new Ms(this._width,this._height,this._pixelRatio,this._canvas,this._context);this.setRenderTarget(this._defaultRenderTarget);this._filterManager=new lc(this);}},{key:"render",value:function render(t){var e=this._renderTarget.getContext();var r=t.getParent();t.setParent(new ac());t.updateTransform();if(r){t.setParent(r);}e.setTransform(1,0,0,1,0,0);e.globalAlpha=1;var _this$_canvas=this._canvas,o=_this$_canvas.width,n=_this$_canvas.height;e.clearRect(0,0,o,n);if(this._clearColor.a!==0){e.save();e.fillStyle=this._clearColor.toRGBA();e.fillRect(0,0,o,n);e.restore();}this.renderDisplayObject(t,this._renderTarget);}},{key:"renderDisplayObject",value:function renderDisplayObject(t,e){var r=this._renderTarget;this._filterManager.setFilterStack(e.getFilterStack());this.setRenderTarget(e);t.renderCanvas(this);this.setRenderTarget(r);}},{key:"getCurrentRenderTarget",value:function getCurrentRenderTarget(){return this._renderTarget;}},{key:"setRenderTarget",value:function setRenderTarget(t){this._renderTarget=t;}},{key:"getContext",value:function getContext(){return this._renderTarget.getContext();}},{key:"dispose",value:function dispose(){$t(this._canvas);this._filterManager.dispose();}}]);return W1;}(sh);Od=_W2;Od.contextId=0;Od.type=g3.CANVAS;});var y3;var _3=d(function(){y3=function y3(i){if(typeof window!=="undefined"){var _window=window,t=_window.WebGLDebugUtils;if(t){var e=function e(r,o){console.error("gl.".concat(r,"(").concat(t.glFunctionArgsToString(r,o),")"));};i=t.makeDebugContext(i,null,e);}}return i;};});var G1;var x3=d(function(){G1=/*#__PURE__*/function(){function G1(t){_classCallCheck(this,G1);this.vertices=new Float32Array([0,0,100,0,100,100,0,100]);this.uvs=new Float32Array([0,0,1,0,1,1,0,1]);this.indices=new Uint16Array([0,1,2,0,3,2]);this.colors=new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]);this.vertexBuffer=null;this.indexBuffer=null;this.gl=t;this.initBuffers();this.uploadBuffers();}_createClass(G1,[{key:"map",value:function map(t,e){var r=e.x,o=e.y;this.uvs[2]=e.width/t.width;this.uvs[4]=this.uvs[2];this.uvs[5]=e.height/t.height;this.uvs[7]=this.uvs[5];this.vertices[0]=r;this.vertices[1]=o;this.vertices[2]=r+e.width;this.vertices[3]=o;this.vertices[4]=this.vertices[2];this.vertices[5]=o+e.height;this.vertices[6]=r;this.vertices[7]=this.vertices[5];this.uploadBuffers();}},{key:"getVertexBuffer",value:function getVertexBuffer(){return this.vertexBuffer;}},{key:"getIndexBuffer",value:function getIndexBuffer(){return this.indexBuffer;}},{key:"dispose",value:function dispose(){this.cleanBuffer();}},{key:"initBuffers",value:function initBuffers(){var t=this.gl;this.cleanBuffer();this.vertexBuffer=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer);t.bufferData(t.ARRAY_BUFFER,(8+8+16)*4,t.DYNAMIC_DRAW);this.indexBuffer=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW);}},{key:"uploadBuffers",value:function uploadBuffers(){var t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer);t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);t.bufferSubData(t.ARRAY_BUFFER,8*4,this.uvs);t.bufferSubData(t.ARRAY_BUFFER,(8+8)*4,this.colors);}},{key:"cleanBuffer",value:function cleanBuffer(){var t=this.gl;t.deleteBuffer(this.vertexBuffer);t.deleteBuffer(this.indexBuffer);}}]);return G1;}();});var Ls;var ah=d(function(){Le();Fd();Ls=/*#__PURE__*/function(){function Ls(t,e,r,o){var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;_classCallCheck(this,Ls);this._renderer=t;this._gl=t.getContext();this._width=e;this._height=r;this._frame=null;this._pixelRatio=o;this._projectionMatrix=new _rr();this._mipMapping=false;this._baseTexture=new Ae();var s=this._baseTexture.getFrame();s.width=e;s.height=r;this._baseTexture.setPixelRatio(o);this._baseTexture.setLoaded(true);this._framebuffer=null;this._isRoot=n;this._filterStack=[{renderTarget:this,filters:[]}];if(!n){this._initFrameBuffer();}}_createClass(Ls,[{key:"resizeTo",value:function resizeTo(t){this._width=t.x|0;this._height=t.y|0;this._baseTexture.resizeTo(t);if(!this._isRoot){this._resizeTexture();}this._baseTexture.setMinFilter(this._getMinFilter());this._baseTexture.setMagFilter(this._getMagFilter());this._calculateProjectionMatrix();}},{key:"_getMinFilter",value:function _getMinFilter(){var t=Ae.DefaultMinFilter;if(this._mipMapping){t=Ae.TrilinearFilter;}return t;}},{key:"_getMagFilter",value:function _getMagFilter(){return Ae.DefaultMagFilter;}},{key:"_resizeTexture",value:function _resizeTexture(){var t=this._gl;var e=this._width*this._pixelRatio;var r=this._height*this._pixelRatio;if(this._texture){t.deleteTexture(this._texture);this._texture=null;}this._texture=t.createTexture();t.bindTexture(t.TEXTURE_2D,this._texture);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,r,0,t.RGBA,t.UNSIGNED_BYTE,null);t.bindFramebuffer(t.FRAMEBUFFER,this._framebuffer);t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this._texture,0);if(this._texture){this._baseTexture.setGLTextureForRenderer(this._texture,this._renderer);}if(this._renderer._options.debug){nc.checkFramebufferStatus("WebGLRenderTarget#_initFramebuffer",t);}var o=new _ot2(this._width,this._height);if(z.isPowerOfTwo(o)){Y.info("WebGLRenderTarget","Mip-mapping enabled");this._mipMapping=true;}else{this._mipMapping=false;}this._baseTexture.setMipMappingEnabled(this._mipMapping);}},{key:"activate",value:function activate(){var t=this._gl;t.bindFramebuffer(t.FRAMEBUFFER,this._framebuffer);this._calculateProjectionMatrix();t.viewport(0,0,this._width*this._pixelRatio,this._height*this._pixelRatio);t.disable(t.STENCIL_TEST);}},{key:"clear",value:function clear(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:G.TRANSPARENT;var e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer);if(this._renderer._options.debug){nc.checkFramebufferStatus("WebGLRenderTarget#clear",e);}e.clearColor.apply(e,t.toGLColor());e.clear(e.COLOR_BUFFER_BIT);}},{key:"_calculateProjectionMatrix",value:function _calculateProjectionMatrix(){var t=this._projectionMatrix;t.reset();var e=this._frame||new _ce(0,0,this._width,this._height);var r=e.x,o=e.y;if(!this._isRoot){t.a=1/this._width*2;t.d=1/this._height*2;t.tx=-1-r*t.a;t.ty=-1-o*t.d;}else{t.a=1/this._width*2;t.d=-1/this._height*2;t.tx=-1-r*t.a;t.ty=1-o*t.d;}}},{key:"_initFrameBuffer",value:function _initFrameBuffer(){var t=this._gl;if(this._framebuffer){t.deleteFramebuffer(this._framebuffer);this._framebuffer=null;}if(this._texture){t.deleteTexture(this._texture);this._texture=null;}this._framebuffer=t.createFramebuffer();this._texture=t.createTexture();t.bindTexture(t.TEXTURE_2D,this._texture);t.bindFramebuffer(t.FRAMEBUFFER,this._framebuffer);t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this._texture,0);if(this._texture){this._baseTexture.setGLTextureForRenderer(this._texture,this._renderer);}this.resizeTo(new _ot2(this._width,this._height));if(this._renderer._options.debug){nc.checkFramebufferStatus("WebGLRenderTarget#_initFramebuffer",t);}}},{key:"getProjectionMatrix",value:function getProjectionMatrix(){return this._projectionMatrix;}},{key:"getTexture",value:function getTexture(){return this._texture;}},{key:"getFrame",value:function getFrame(){return this._frame;}},{key:"setFrame",value:function setFrame(t){this._frame=t;}},{key:"getFilterStack",value:function getFilterStack(){return this._filterStack;}},{key:"getPixelRatio",value:function getPixelRatio(){return this._pixelRatio;}},{key:"setPixelRatio",value:function setPixelRatio(t){this._pixelRatio=t;if(!this._isRoot){this._resizeTexture();}}},{key:"getBaseTexture",value:function getBaseTexture(){return this._baseTexture;}},{key:"dispose",value:function dispose(){var t=this._gl;this._baseTexture.dispose();if(this._framebuffer){t.deleteFramebuffer(this._framebuffer);this._framebuffer=null;}if(this._texture){t.deleteTexture(this._texture);this._texture=null;}}}]);return Ls;}();});var lh;var V1=d(function(){U1();Le();x3();Tn();ah();lh=/*#__PURE__*/function(){function lh(t){_classCallCheck(this,lh);this._renderer=t;this._filterStack=[];this._currentFrame=null;this._renderTargets=[];this._textureFrame=new _ce(0,0,t.getWidth(),t.getHeight());this._onContextChange=this._onContextChange.bind(this);this._renderer.on("context",this._onContextChange);this._onContextChange();}_createClass(lh,[{key:"resizeTo",value:function resizeTo(t){this._textureFrame.width=t.x;this._textureFrame.height=t.y;this._renderTargets.forEach(function(e){return e.resizeTo(t);});}},{key:"getFilterStack",value:function getFilterStack(){return this._filterStack;}},{key:"setFilterStack",value:function setFilterStack(t){this._filterStack=t;}},{key:"_getOrCreateRenderTarget",value:function _getOrCreateRenderTarget(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._renderTargets.pop();if(!e){e=new Ls(this._renderer,this._textureFrame.width,this._textureFrame.height,1);}if(this._currentFrame){e.setFrame(this._currentFrame);}if(t){e.clear();}return e;}},{key:"pushFilters",value:function pushFilters(t,e){var r=t.getBounds();this._currentFrame=r;var o=t.getFilterRectangle();if(o.width>0&&o.height>0){this._currentFrame=o;}var n=this._getOrCreateRenderTarget();this._renderer.setRenderTarget(n);var s=e[0]instanceof Dd;if(s){n.clear(this._renderer.getClearColor());}else{n.clear();}this._filterStack.push({renderTarget:n,filters:e});}},{key:"popFilters",value:function popFilters(){var t=this._filterStack.pop();if(!t)return void 0;var e=t.filters,r=t.renderTarget;var o=this._filterStack[this._filterStack.length-1];var n=r;var s=o.renderTarget;var a=n.getFrame();if(a){this._quad.map(this._textureFrame,a);}var l=e[0].getShaderForRenderer(this._renderer);var c=this._quad.getVertexBuffer();var u=this._quad.getIndexBuffer();var m=this._renderer.getContext();m.bindBuffer(m.ARRAY_BUFFER,c);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,u);var p=l.getAttributeLocations();m.vertexAttribPointer(p.a_position,2,m.FLOAT,false,0,0);m.vertexAttribPointer(p.a_texCoord,2,m.FLOAT,false,0,2*4*4);m.vertexAttribPointer(p.a_color,4,m.FLOAT,false,0,4*4*4);this._renderer.updateTexture(n.getBaseTexture(),false);if(e.length===1){e[0].apply(this._renderer,n,s);this._renderTargets.push(n);}else{this._applyFilters(e,n,s);}return e;}},{key:"_applyFilters",value:function _applyFilters(t,e,r){var _this60=this;var o=e;var n=this._getOrCreateRenderTarget(true);this._renderer.updateTexture(n.getBaseTexture(),false);var s=t[t.length-1];t.forEach(function(a){var l=a===s;if(!l){a.apply(_this60._renderer,o,n,true);var c=o;o=n;n=c;}else{a.apply(_this60._renderer,o,r,true);}});this._renderTargets.push(o);this._renderTargets.push(n);}},{key:"_onContextChange",value:function _onContextChange(){this._renderTargets.length=0;if(bd(this._renderer)){if(this._quad){this._quad.dispose();}this._quad=new G1(this._renderer.getContext());}}},{key:"dispose",value:function dispose(){this._renderer.off("context",this._onContextChange);if(this._quad){this._quad.dispose();}this._renderTargets.forEach(function(t){t.dispose();});}}]);return lh;}();});var v3=Gt(function(VDt,j1){var ch=function ch(){function i(u){r.appendChild(u.dom);return u;}function t(u){for(var m=0;mn+1e3&&(a.update(1e3*s/(u-n),100),n=u,s=0,c)){var m=performance.memory;c.update(m.usedJSHeapSize/1048576,m.jsHeapSizeLimit/1048576);}return u;},update:function update(){o=this.end();},domElement:r,setMode:t};};ch.Panel=function(i,t,e){var r=Infinity,o=0,n=Math.round,s=n(window.devicePixelRatio||1),a=80*s,l=48*s,c=3*s,u=2*s,m=3*s,p=15*s,h=74*s,g=30*s,x=document.createElement("canvas");x.width=a;x.height=l;x.style.cssText="width:80px;height:48px";var v=x.getContext("2d");v.font="bold "+9*s+"px Helvetica,Arial,sans-serif";v.textBaseline="top";v.fillStyle=e;v.fillRect(0,0,a,l);v.fillStyle=t;v.fillText(i,c,u);v.fillRect(m,p,h,g);v.fillStyle=e;v.globalAlpha=.9;v.fillRect(m,p,h,g);return{dom:x,update:function update(b,T){r=Math.min(r,b);o=Math.max(o,b);v.fillStyle=e;v.globalAlpha=1;v.fillRect(0,0,a,p);v.fillStyle=t;v.fillText(n(b)+" "+i+" ("+n(r)+"-"+n(o)+")",c,u);v.drawImage(x,m+s,p,h-s,g,m,p,h-s,g);v.fillRect(m+h-s,p,s,g);v.fillStyle=e;v.globalAlpha=.9;v.fillRect(m+h-s,p,s,n((1-b/T)*g));}};};_typeof(j1)==="object"&&(j1.exports=ch);});var Ya,Py;var C3=d(function(){Ya=y(v3());Py=/*#__PURE__*/function(){function Py(t){_classCallCheck(this,Py);this._context=t;this._domAvailable=typeof document!=="undefined";this._hookIntoContext();this._textures={};this._framebuffers={};this._programs={};this._shaders={};this._buffers={};this._boundTexture=null;this._id=0;this._enums={};this._setupStats();this._createEnumMap();this._updateMemoryStats=this._updateMemoryStats.bind(this);this._updateMemoryStats();}_createClass(Py,[{key:"_createEnumMap",value:function _createEnumMap(){for(var t in this._context){var e=this._context[t];if(typeof e==="number"){this._enums[e]=t;}}}},{key:"_enumValueToString",value:function _enumValueToString(t){var e=this._enums[t];return typeof e==="undefined"?t:e;}},{key:"_setupStats",value:function _setupStats(){if(!this._domAvailable)return;this._stats=new Ya["default"]();this._stats.showPanel(3);this._memPanel=this._stats.addPanel(new Ya["default"].Panel("MB [WebGL]","#43ADEB","#282828"));this._texPanel=this._stats.addPanel(new Ya["default"].Panel("Textures","#43ADEB","#282828"));this._bufPanel=this._stats.addPanel(new Ya["default"].Panel("Buffers","#43ADEB","#282828"));this._fboPanel=this._stats.addPanel(new Ya["default"].Panel("FBOs","#43ADEB","#282828"));this._prgPanel=this._stats.addPanel(new Ya["default"].Panel("Programs","#43ADEB","#282828"));this._shdPanel=this._stats.addPanel(new Ya["default"].Panel("Shaders","#43ADEB","#282828"));}},{key:"_updatePanel",value:function _updatePanel(t){if(!this._domAvailable)return;this._stats.begin();switch(t){case"tex":this._texPanel.update(this.getTexturesCount(),50);break;case"buf":this._bufPanel.update(this.getBuffersCount(),50);break;case"fbo":this._fboPanel.update(this.getFBOCount(),50);break;case"prg":this._prgPanel.update(this.getProgramCount(),50);break;case"shd":this._shdPanel.update(this.getShaderCount(),50);break;}this._stats.end();}},{key:"getTexturesCount",value:function getTexturesCount(){return Object.keys(this._textures).length;}},{key:"getBuffersCount",value:function getBuffersCount(){return Object.keys(this._buffers).length;}},{key:"getFBOCount",value:function getFBOCount(){return Object.keys(this._framebuffers).length;}},{key:"getProgramCount",value:function getProgramCount(){return Object.keys(this._programs).length;}},{key:"getShaderCount",value:function getShaderCount(){return Object.keys(this._shaders).length;}},{key:"_updateMemoryStats",value:function _updateMemoryStats(){if(!this._domAvailable)return;var t=this._getMemoryUsage()/1e3/1e3;this._memPanel.update(t,400);setTimeout(this._updateMemoryStats,1e3);}},{key:"_getMemoryUsage",value:function _getMemoryUsage(){var t=0;for(var e in this._textures){t+=this._textures[e].memory;}for(var _e3 in this._buffers){t+=this._buffers[_e3].memory;}return t;}},{key:"_hookIntoContext",value:function _hookIntoContext(){var _this61=this;var _loop3=function _loop3(t){var e=_this61._context[t];if(typeof e==="function"){_this61[t]=function(){var o=this._context[t];for(var _len14=arguments.length,r=new Array(_len14),_key14=0;_key14<_len14;_key14++){r[_key14]=arguments[_key14];}return this._trackGLCall(o,t,r);};}else{_this61._makePropertyWrapper(t);}};for(var t in this._context){_loop3(t);}}},{key:"_makePropertyWrapper",value:function _makePropertyWrapper(t){var e=["_context"];if(e.indexOf(t)!==-1)return;var r=this._context;this.__defineGetter__(t,function(){return r[t];});this.__defineSetter__(t,function(o){r[t]=o;});}},{key:"_trackGLCall",value:function _trackGLCall(t,e,r){var o=["texImage2D","bindTexture","createTexture","deleteTexture","createBuffer","bindBuffer","bufferData","deleteBuffer","createFramebuffer","deleteFramebuffer","createProgram","deleteProgram","createShader","deleteShader"];var n;if(o.indexOf(e)!==-1){n=this["_".concat(e)](r);}else{n=t.apply(this._context,r);}var s=this._context.getError();if(s!==0){var a=r.join(", ");if(a.length>100){a="".concat(a.substr(0,100),"...");}console.error(new Error("WebGL Error ".concat(this._enumValueToString(s)," in ").concat(e,"(").concat(a,")")));}return n;}},{key:"_createProgram",value:function _createProgram(){var t=this._context.createProgram();t._wmmId=this._id++;this._programs[t._wmmId]=t;this._updatePanel("prg");return t;}},{key:"_deleteProgram",value:function _deleteProgram(_ref91){var _ref92=_slicedToArray(_ref91,1),t=_ref92[0];if(!t||!this._programs[t._wmmId])return;delete this._programs[t._wmmId];this._context.deleteProgram(t);this._updatePanel("prg");}},{key:"_createShader",value:function _createShader(_ref93){var _ref94=_slicedToArray(_ref93,1),t=_ref94[0];var e=this._context.createShader(t);e._wmmId=this._id++;this._shaders[e._wmmId]=e;this._updatePanel("shd");return e;}},{key:"_deleteShader",value:function _deleteShader(_ref95){var _ref96=_slicedToArray(_ref95,1),t=_ref96[0];if(!t||!this._shaders[t._wmmId])return;delete this._shaders[t._wmmId];this._context.deleteShader(t);this._updatePanel("shd");}},{key:"_createFramebuffer",value:function _createFramebuffer(){var t=this._context.createFramebuffer();t._wmmId=this._id++;this._framebuffers[t._wmmId]=t;this._updatePanel("fbo");return t;}},{key:"_deleteFramebuffer",value:function _deleteFramebuffer(_ref97){var _ref98=_slicedToArray(_ref97,1),t=_ref98[0];if(!t||!this._framebuffers[t._wmmId])return;delete this._framebuffers[t._wmmId];this._context.deleteFramebuffer(t);this._updatePanel("fbo");}},{key:"_createBuffer",value:function _createBuffer(){var t=this._context.createBuffer();t._wmmId=this._id++;this._buffers[t._wmmId]={buffer:t,memory:0};this._updatePanel("buf");return t;}},{key:"_bindBuffer",value:function _bindBuffer(_ref99){var _ref100=_slicedToArray(_ref99,2),t=_ref100[0],e=_ref100[1];this._context.bindBuffer(t,e);this._boundBuffer=e._wmmId;}},{key:"_bufferData",value:function _bufferData(_ref101){var _ref102=_slicedToArray(_ref101,3),t=_ref102[0],e=_ref102[1],r=_ref102[2];this._context.bufferData(t,e,r);var o;if(typeof e==="number"){o=e;}else if("byteLength"in e){o=e.byteLength;}else if("length"in e){o=e.length;}this._buffers[this._boundBuffer].memory=o;}},{key:"_deleteBuffer",value:function _deleteBuffer(_ref103){var _ref104=_slicedToArray(_ref103,1),t=_ref104[0];if(!t||!this._buffers[t._wmmId])return;delete this._buffers[t._wmmId];this._context.deleteBuffer(t);this._updatePanel("buf");}},{key:"_createTexture",value:function _createTexture(){var t=this._context.createTexture();t._wmmId=this._id++;this._textures[t._wmmId]={texture:t,memory:0};this._updatePanel("tex");return t;}},{key:"_deleteTexture",value:function _deleteTexture(_ref105){var _ref106=_slicedToArray(_ref105,1),t=_ref106[0];if(!t||!this._textures[t._wmmId])return;delete this._textures[t._wmmId];this._context.deleteTexture(t);this._updatePanel("tex");}},{key:"_bindTexture",value:function _bindTexture(_ref107){var _ref108=_slicedToArray(_ref107,2),t=_ref108[0],e=_ref108[1];this._context.bindTexture(t,e);this._boundTexture=e._wmmId;}},{key:"_texImage2D",value:function _texImage2D(t){var _t6=_slicedToArray(t,9),e=_t6[2],r=_t6[3],o=_t6[4],n=_t6[5],s=_t6[8];if(typeof s==="undefined"){s=n;}this._context.texImage2D.apply(this._context,t);var a=this._calculateByteCountForTexture(e,r,o,s);this._textures[this._boundTexture].memory=a;}},{key:"_calculateByteCountForTexture",value:function _calculateByteCountForTexture(t,e,r,o){if(o!==null){if("width"in o){e=o.width;r=o.height;}else{return o.length;}}var n=1;switch(t){case this._context.ALPHA:n=1;break;case this._context.RGB:n=3;break;case this._context.RGBA:n=4;break;}return e*r*n;}}]);return Py;}();});var uh;var $1=d(function(){uh=/*#__PURE__*/function(){function uh(t){_classCallCheck(this,uh);this._renderer=t;this._onContextChange=this._onContextChange.bind(this);this._renderer.on("context",this._onContextChange);}_createClass(uh,[{key:"_onContextChange",value:function _onContextChange(){}},{key:"start",value:function start(){}},{key:"stop",value:function stop(){this.flush();}},{key:"flush",value:function flush(){}},{key:"dispose",value:function dispose(){this._renderer.off("context",this._onContextChange);delete this._renderer;}}]);return uh;}();});var K1;var S3=d(function(){Le();$1();K1=/*#__PURE__*/function(_uh){_inherits(K1,_uh);var _super32=_createSuper(K1);function K1(t){var _this62;_classCallCheck(this,K1);_this62=_super32.call(this,t);_this62._vertexBuffer=null;_this62._indexBuffer=null;_this62._maxBatchSize=wd;_this62._vertices=new ArrayBuffer(wd*4*Xa);_this62._positions=new Float32Array(_this62._vertices);_this62._colors=new Uint32Array(_this62._vertices);_this62._indices=new Uint16Array(wd*6);for(var e=0,r=0;e=this._maxBatchSize){this.flush();}var n=e.getUVs();if(!n){return;}var s=this._currentBatchSize*Xa;this._addVertexCoordinates(t,s,r);this._addTextureUVs(t,s,n);this._addColors(t,s);this._sprites[this._currentBatchSize]=t;this._currentBatchSize++;}},{key:"_addColors",value:function _addColors(t,e){var r=this._colors;var o=16777215;var n=(o>>16)+(o&65280)+((o&255)<<16)+(t.getWorldAlpha()*255<<24);r[e+4]=r[e+9]=r[e+14]=r[e+19]=n;}},{key:"_addTextureUVs",value:function _addTextureUVs(t,e,r){var o=this._positions;var _r6=_slicedToArray(r,4),n=_r6[0],s=_r6[1],a=_r6[2],l=_r6[3];o[e+2]=n.x;o[e+3]=n.y;o[e+7]=s.x;o[e+8]=s.y;o[e+12]=a.x;o[e+13]=a.y;o[e+17]=l.x;o[e+18]=l.y;}},{key:"_addVertexCoordinates",value:function _addVertexCoordinates(t,e,r){var o=this._positions;var n=t.getWorldTransform();var s=t.getAnchor();var a=n.rectangleToCoordinates(r,s);var l=5;for(var c=0;c<4;c++){o[e+c*l]=a[c].x;o[e+c*l+1]=a[c].y;}}},{key:"_onContextChange",value:function _onContextChange(){var t=this._renderer.getContext();this._shader=this._renderer.shaders["default"];if(this._vertexBuffer){this._vertexBuffer=null;}if(this._indexBuffer){this._indexBuffer=null;}this._vertexBuffer=t.createBuffer();this._indexBuffer=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this._indexBuffer);t.bufferData(t.ELEMENT_ARRAY_BUFFER,this._indices,t.STATIC_DRAW);t.bindBuffer(t.ARRAY_BUFFER,this._vertexBuffer);t.bufferData(t.ARRAY_BUFFER,this._vertices,t.DYNAMIC_DRAW);}},{key:"start",value:function start(){if(this._vertexBuffer&&this._indexBuffer){this._shader.setupBuffers(this._vertexBuffer,this._indexBuffer);}}},{key:"flush",value:function flush(){var p;var t=this._renderer;var e=t.getContext();if(this._currentBatchSize===0){return;}if(this._currentBatchSize>wd*.5){e.bufferSubData(e.ARRAY_BUFFER,0,this._vertices);}else{var h=this._positions.subarray(0,this._currentBatchSize*Xa);e.bufferSubData(e.ARRAY_BUFFER,0,h);}var r=0;var o=null;var n=null;var s=null;var a=null;var l=false;var c=false;var u=null;var m=0;for(var _h3=0,g=this._currentBatchSize;_h30&&arguments[0]!==undefined?arguments[0]:800;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:600;var r=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,X1);_this63=_super33.call(this,t,e,r);_this63.type="webgl";_this63.maxTextureDimensions=null;_this63._type="webgl";_this63._onContextLost=_this63._onContextLost.bind(_assertThisInitialized(_this63));_this63._onContextRestored=_this63._onContextRestored.bind(_assertThisInitialized(_this63));_this63.setCanvas(_this63._options.canvas||pi.createCanvas());_this63.shaders={"default":new A1(_assertThisInitialized(_this63),void 0,void 0)};_this63.renderers={sprite:new K1(_assertThisInitialized(_this63))};return _this63;}_createClass(X1,[{key:"_onContextLost",value:function _onContextLost(t){t.preventDefault();Y.warn(this.constructor.name,"WebGL context has been lost - trying to restore.");this.emit("context-lost");}},{key:"_onContextCreationError",value:function _onContextCreationError(t){t.preventDefault();Y.warn(this.constructor.name,"Failed to create WebGL context: ".concat(t.statusMessage||"Unknown error"));}},{key:"_onContextRestored",value:function _onContextRestored(){Y.warn(this.constructor.name,"WebGL context has been restored. Clearing all textures.");this._createContext();this._setupContext();this.emit("context-restored");}},{key:"_onBeforeContext",value:function _onBeforeContext(){if(this._filterManager){this._filterManager.dispose();}this._filterManager=new lh(this);this._currentObjectRenderer=new uh(this);}},{key:"setShader",value:function setShader(t){this._currentShader=t;this._context.useProgram(t.getProgram());this._setAttributesForShader(t);}},{key:"setCanvas",value:function setCanvas(t){if(this._canvas){this._removeContextEventListeners();}_get(_getPrototypeOf(X1.prototype),"setCanvas",this).call(this,t);this._addContextEventListeners();}},{key:"_addContextEventListeners",value:function _addContextEventListeners(){if(_1(this._canvas)){this._canvas.addEventListener("webglcontextlost",this._onContextLost);this._canvas.addEventListener("webglcontextrestored",this._onContextRestored);this._canvas.addEventListener("webglcontextcreationerror",this._onContextCreationError);}}},{key:"_removeContextEventListeners",value:function _removeContextEventListeners(){if(_1(this._canvas)){this._canvas.removeEventListener("webglcontextlost",this._onContextLost);this._canvas.removeEventListener("webglcontextrestored",this._onContextRestored);this._canvas.removeEventListener("webglcontextcreationerror",this._onContextCreationError);}}},{key:"_setAttributesForShader",value:function _setAttributesForShader(t){if(!this._canvas)return;var e=this._context;var r=t.getAttributes();var o=t.getAttributeLocations();r.forEach(function(n){var s=o[n];e.enableVertexAttribArray(s);});}},{key:"_createContext",value:function _createContext(){if(!this._canvas)return;var t=pi.glGet(this._canvas);if(this._options.debug){y3(t);}if(this._options.debug){t=new By(t);t=new Py(t);}this.id=_X2.contextId++;this._context=t;this._maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE);this.emit("context",t);return t;}},{key:"_setupContext",value:function _setupContext(){var t=this._context;t.disable(t.DEPTH_TEST);t.disable(t.CULL_FACE);t.enable(t.BLEND);t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA);this._defaultRenderTarget=new Ls(this,this._width,this._height,this._pixelRatio,true);this.setRenderTarget(this._defaultRenderTarget);this._getMaxPrecision();}},{key:"getContext",value:function getContext(){return this._context;}},{key:"_getMaxPrecision",value:function _getMaxPrecision(){var t=this._context;var e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);this._maxFloatPrecision=(e==null?void 0:e.precision)!==0?"highp":"mediump";var r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_INT);this._maxIntPrecision=(r==null?void 0:r.rangeMax)!==0?"highp":"lowp";}},{key:"resizeTo",value:function resizeTo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_get(_getPrototypeOf(X1.prototype),"resizeTo",this).call(this,t,e);if(this._currentRenderTarget){this._currentRenderTarget.resizeTo(t);}this._context=pi.glResize(this._context,t);}},{key:"setRenderTarget",value:function setRenderTarget(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._defaultRenderTarget;this._currentRenderTarget=t;this._currentRenderTarget.activate();}},{key:"setObjectRenderer",value:function setObjectRenderer(t){this._currentObjectRenderer.stop();this._currentObjectRenderer=t;this._currentObjectRenderer.start();}},{key:"render",value:function render(t){this.setRenderTarget(this._defaultRenderTarget);this._defaultRenderTarget.clear(this._clearColor);var e=t.getParent();t.setParent(new ac());t.updateTransform();if(e){t.setParent(e);}this.renderDisplayObject(t,this._defaultRenderTarget);}},{key:"renderDisplayObject",value:function renderDisplayObject(t,e){this.setRenderTarget(e);this._filterManager.setFilterStack(e.getFilterStack());t.renderWebGL(this);this._currentObjectRenderer.flush();}},{key:"clear",value:function clear(){var t=this._context;t.clearColor.apply(t,this._clearColor.toGLColor);t.clear(t.COLOR_BUFFER_BIT);}},{key:"save",value:function save(){return{renderTarget:this._currentRenderTarget,objectRenderer:this._currentObjectRenderer,filterStack:this._filterManager.getFilterStack()};}},{key:"restore",value:function restore(t){this.setRenderTarget(t.renderTarget);this._filterManager.setFilterStack(t.filterStack);this._currentObjectRenderer=t.objectRenderer;}},{key:"getOrCreateGLTexture",value:function getOrCreateGLTexture(t){var e=this._context;var r=t.getGLTextureForRenderer(this);if(!r){r=e.createTexture();t.setGLTextureForRenderer(r,this);}return r;}},{key:"updateTexture",value:function updateTexture(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var r=t.getSource();var o=this._context;var n=t.getGLUnit();var s=this.getOrCreateGLTexture(t);o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_2D,s);o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,true);if(e&&r){pi.glTexImage(o,r);}if(t.isMipMappingEnabled()){o.generateMipmap(o.TEXTURE_2D);}else{o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,t.getGLRepeat(o,"x"));o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,t.getGLRepeat(o,"y"));}o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,t.getGLFilter(o,"min"));o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t.getGLFilter(o,"mag"));o.activeTexture(o.TEXTURE0);}},{key:"getMaxDimensions",value:function getMaxDimensions(){if(!this.maxTextureDimensions){this.maxTextureDimensions=pi.glMaxTexture(this._context);}return this.maxTextureDimensions;}},{key:"getCurrentRenderTarget",value:function getCurrentRenderTarget(){return this._currentRenderTarget;}},{key:"getCurrentObjectRenderer",value:function getCurrentObjectRenderer(){return this._currentObjectRenderer;}},{key:"getMaxFloatPrecision",value:function getMaxFloatPrecision(){return this._maxFloatPrecision;}},{key:"getMaxIntPrecision",value:function getMaxIntPrecision(){return this._maxIntPrecision;}},{key:"dispose",value:function dispose(){if(this._canvas){$t(this._canvas);}this._filterManager.dispose();this._currentObjectRenderer.dispose();this._defaultRenderTarget.dispose();for(var r in this.shaders){this.shaders[r].dispose();delete this.shaders[r];}this._removeContextEventListeners();var t=this._context;var e=t.getExtension("WEBGL_lose_context");if(e){e.loseContext();}}}]);return X1;}(sh);My=_X2;My.contextId=0;});var vrt,Crt,q1;var T3=d(function(){Bs();vrt=function vrt(){return[new _ot2(0,0),new _ot2(1,0),new _ot2(1,1),new _ot2(0,1)];};Crt=function Crt(i,t,e){var _i2=_slicedToArray(i,4),r=_i2[0],o=_i2[1],n=_i2[2],s=_i2[3];r.x=t.x/e.width;r.y=t.y/e.height;o.x=(t.x+t.width)/e.width;o.y=t.y/e.height;n.x=(t.x+t.width)/e.width;n.y=(t.y+t.height)/e.height;s.x=t.x/e.width;s.y=(t.y+t.height)/e.height;return i;};q1={create:vrt,updateViaFrames:Crt};});var _Ja;var Y1=d(function(){T3();Le();Fd();_Ja=/*#__PURE__*/function(_Vi4){_inherits(Ja,_Vi4);var _super34=_createSuper(Ja);function Ja(t,e){var _this64;_classCallCheck(this,Ja);_this64=_super34.call(this);if(!(t instanceof Ae)){throw new Error("`baseTexture` should be an instance of BaseTexture");}_this64._uvs=q1.create();_this64._frame=e?e.clone():new _ce(0,0,1,1);_this64._frameLocked=Boolean(e);_this64._onBaseTextureLoaded=_this64._onBaseTextureLoaded.bind(_assertThisInitialized(_this64));_this64._onBaseTextureUpdated=_this64._onBaseTextureUpdated.bind(_assertThisInitialized(_this64));_this64.setBaseTexture(t);return _this64;}_createClass(Ja,[{key:"_onBaseTextureLoaded",value:function _onBaseTextureLoaded(){if(!this._frameLocked){var t=this._baseTexture.getFrame().clone();this.setFrame(t);}this._baseTexture.on("update",this._onBaseTextureUpdated);}},{key:"_onBaseTextureUpdated",value:function _onBaseTextureUpdated(){var _this$_baseTexture$ge=this._baseTexture.getFrame(),t=_this$_baseTexture$ge.width,e=_this$_baseTexture$ge.height;this._frame.width=t;this._frame.height=e;this.emit("update");}},{key:"_updateUVs",value:function _updateUVs(){this._uvs=q1.updateViaFrames(this._uvs,this._frame,this._baseTexture.getFrame());}},{key:"getBaseTexture",value:function getBaseTexture(){return this._baseTexture;}},{key:"setBaseTexture",value:function setBaseTexture(t){this._baseTexture=t;if(!this._baseTexture.isLoaded()){this._baseTexture.once("loaded",this._onBaseTextureLoaded);}else{var _t$getFrame=t.getFrame(),e=_t$getFrame.width,r=_t$getFrame.height;if(!this._frameLocked){this._frame=new _ce(0,0,e,r);}this._onBaseTextureLoaded();}}},{key:"getFrame",value:function getFrame(){return this._frame;}},{key:"setFrame",value:function setFrame(t){this._frame=t;this._updateUVs();}},{key:"getWidth",value:function getWidth(){return this._frame.width;}},{key:"getHeight",value:function getHeight(){return this._frame.height;}},{key:"getUVs",value:function getUVs(){return this._uvs;}},{key:"getDimensions",value:function getDimensions(){return new _ot2(this._frame.width,this._frame.height);}},{key:"dispose",value:function dispose(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;t&&this._baseTexture.dispose();}}],[{key:"fromImage",value:function fromImage(t){var e=new Ae(t);return new _Ja(e);}},{key:"fromCanvas",value:function fromCanvas(t){var e=new Ae(t);return new _Ja(e);}}]);return Ja;}(Vi);});var dh,mh;var J1=d(function(){Ar();Le();Ay();V1();rh();ah();Fd();Y1();dh=function dh(i){return i._type==="webgl";};mh=/*#__PURE__*/function(_Ja2){_inherits(mh,_Ja2);var _super35=_createSuper(mh);function mh(t){var _this65;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:100;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;_classCallCheck(this,mh);_this65=_super35.call(this,new Ae(),new _ce(0,0,e,r));_this65._loaded=true;_this65._width=e;_this65._height=r;_this65._pixelRatio=o;_this65._renderer=t;_this65._setupFilterManager();_this65._setupBuffer();_this65.setBaseTexture(_this65._renderTarget.getBaseTexture());_this65._updateUVs();return _this65;}_createClass(mh,[{key:"_setupFilterManager",value:function _setupFilterManager(){if(this._filterManager){this._filterManager.dispose();}if(dh(this._renderer)){this._filterManager=new lh(this._renderer);}else{this._filterManager=new lc(this._renderer);}this._filterManager.resizeTo(new _ot2(this._width,this._height));}},{key:"_setupBuffer",value:function _setupBuffer(){if(this._renderTarget){this._renderTarget.dispose();}if(dh(this._renderer)){this._renderTarget=new Ls(this._renderer,this._width,this._height,this._pixelRatio);}else{this._renderTarget=new Ms(this._width,this._height,this._pixelRatio);}}},{key:"clear",value:function clear(t){this._renderTarget.clear(t);}},{key:"resizeTo",value:function resizeTo(t){if(this._width===t.x&&this._height===t.y){return;}this._width=t.x;this._height=t.y;this._frame.width=t.x;this._frame.height=t.y;this._renderTarget.resizeTo(t);this._filterManager.resizeTo(t);}},{key:"render",value:function render(t){if(dh(this._renderer)){this._renderWebGL(t);}else{this._renderCanvas(t);}}},{key:"_renderWebGL",value:function _renderWebGL(t){if(!dh(this._renderer))return;this._renderTarget.activate();t.getWorldTransform().reset();t.getChildren().forEach(function(r){r.updateTransform();});var e=this._renderer.getFilterManager();this._renderer.setFilterManager(this._filterManager);this._renderer.renderDisplayObject(t,this._renderTarget);this._renderer.setFilterManager(e);}},{key:"_renderCanvas",value:function _renderCanvas(t){if(dh(this._renderer))return;t.getWorldTransform().reset();t.getChildren().forEach(function(r){r.updateTransform();});var e=this._renderer.getFilterManager();this._renderer.setFilterManager(this._filterManager);this._renderer.renderDisplayObject(t,this._renderTarget);this._renderer.setFilterManager(e);}},{key:"getRenderTarget",value:function getRenderTarget(){return this._renderTarget;}},{key:"dispose",value:function dispose(){this._renderTarget.dispose();this._filterManager.dispose();_get(_getPrototypeOf(mh.prototype),"dispose",this).call(this);}}]);return mh;}(_Ja);});var Rd,zs;var ph=d(function(){Rd={EXPORT:"export",CLOSE:"close",OPERATION_CREATED:"operation:created",OPERATION_UPDATED:"operation:updated",OPERATION_REMOVED:"operation:removed",EDITOR_READY:"editor:ready",WINDOW_RESIZE:"window:resize",ZOOM_DONE:"editor:zoom_done",HISTORY_UNDO:"history:undo",HISTORY_UPDATED:"history:update",FEATURES_DISABLED:"editor:features:disabled",FEATURES_ENABLED:"editor:features:enabled",FEATURES_UPDATED:"editor:features:updated",TRANSFORM_REAPPLY_RATIO:"transform:reapply_ratio"};zs={DEFAULTS:{FILTERS:[{identifier:"imgly_filters_duotone",defaultName:"DuoTone",assetFileName:"duotone",filters:[{identifier:"imgly_duotone_desert",defaultName:"Desert",lightColor:"#e1de9a",darkColor:"#cb2129"},{identifier:"imgly_duotone_peach",defaultName:"Peach",lightColor:"#e9abb8",darkColor:"#0040ff"},{identifier:"imgly_duotone_clash",defaultName:"Clash",lightColor:"#f41a0f",darkColor:"#23007c"},{identifier:"imgly_duotone_plum",defaultName:"Plum",lightColor:"#74d7ff",darkColor:"#23007c"},{identifier:"imgly_duotone_breezy",defaultName:"Breezy",lightColor:"#68fdff",darkColor:"#c20000"},{identifier:"imgly_duotone_deepblue",defaultName:"Deep Blue",lightColor:"#2de9eb",darkColor:"#58007c"},{identifier:"imgly_duotone_frog",defaultName:"Frog",lightColor:"#5bff60",darkColor:"#7f23a9"},{identifier:"imgly_duotone_sunset",defaultName:"Sunset",lightColor:"#f8ea46",darkColor:"#c400be"}]},{identifier:"imgly_filters_bw",assetFileName:"b&w",defaultName:"Black & White",filters:[{identifier:"imgly_lut_ad1920",defaultName:"1920 A.D.",lutImage:"filters/imgly_lut_ad1920_5_5_128.png"},{identifier:"imgly_lut_bw",defaultName:"Greyed",lutImage:"filters/imgly_lut_bw_5_5_128.png"},{identifier:"imgly_lut_x400",defaultName:"Dusty",lutImage:"filters/imgly_lut_dusty_5_5_128.png"},{identifier:"imgly_lut_litho",defaultName:"Litho",lutImage:"filters/imgly_lut_litho_5_5_128.png"},{identifier:"imgly_lut_sepiahigh",defaultName:"Sepia",lutImage:"filters/imgly_lut_sepia_5_5_128.png"},{identifier:"imgly_lut_plate",defaultName:"Weathered",lutImage:"filters/imgly_lut_weathered_5_5_128.png"},{identifier:"imgly_lut_sin",defaultName:"Hard Stuff",lutImage:"filters/imgly_lut_hard_stuff_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8}]},{identifier:"imgly_filters_retro",assetFileName:"vintage",defaultName:"Vintage",filters:[{identifier:"imgly_lut_blues",defaultName:"Polaroid",lutImage:"filters/imgly_lut_polaroid_5_5_128.png"},{identifier:"imgly_lut_front",defaultName:"Sunny 70s",lutImage:"filters/imgly_lut_sunny_70s_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_texas",defaultName:"Oldtimer",lutImage:"filters/imgly_lut_oldtimer_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_celsius",defaultName:"Inferno",lutImage:"filters/imgly_lut_inferno_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_cool",defaultName:"Snappy",lutImage:"filters/imgly_lut_snappy_5_5_128.png"}]},{identifier:"imgly_filters_analog",assetFileName:"smooth",defaultName:"Smooth",filters:[{identifier:"imgly_lut_chest",defaultName:"Chestnut",lutImage:"filters/imgly_lut_chestnut_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_winter",defaultName:"Softly",lutImage:"filters/imgly_lut_softly_5_5_128.png"},{identifier:"imgly_lut_kdynamic",defaultName:"Pebble",lutImage:"filters/imgly_lut_pebble_5_5_128.png"},{identifier:"imgly_lut_fall",defaultName:"Moss",lutImage:"filters/imgly_lut_moss_5_5_128.png"},{identifier:"imgly_lut_lenin",defaultName:"Lemon",lutImage:"filters/imgly_lut_lemon_5_5_128.png"},{identifier:"imgly_lut_pola669",defaultName:"Green Gap",lutImage:"filters/imgly_lut_green_gap_5_5_128.png"}]},{identifier:"imgly_filters_winter",assetFileName:"cold",defaultName:"Cold",filters:[{identifier:"imgly_lut_elder",defaultName:"Colla",lutImage:"filters/imgly_lut_colla_5_5_128.png"},{identifier:"imgly_lut_orchid",defaultName:"Solanus",lutImage:"filters/imgly_lut_solanus_5_5_128.png"},{identifier:"imgly_lut_bleached",defaultName:"Kalmen",lutImage:"filters/imgly_lut_kalmen_5_5_128.png"},{identifier:"imgly_lut_bleachedblue",defaultName:"Joran",lutImage:"filters/imgly_lut_joran_5_5_128.png"},{identifier:"imgly_lut_breeze",defaultName:"Levante",lutImage:"filters/imgly_lut_levante_5_5_128.png"},{identifier:"imgly_lut_blueshadows",defaultName:"Zephyr",lutImage:"filters/imgly_lut_zephyr_5_5_128.png"}]},{identifier:"imgly_filters_summer",assetFileName:"warm",defaultName:"Warm",filters:[{identifier:"imgly_lut_sunset",defaultName:"Golden",lutImage:"filters/imgly_lut_golden_5_5_128.png"},{identifier:"imgly_lut_eighties",defaultName:"Low Fire",lutImage:"filters/imgly_lut_low_fire_5_5_128.png"},{identifier:"imgly_lut_evening",defaultName:"Sunrise",lutImage:"filters/imgly_lut_sunrise_5_5_128.png"},{identifier:"imgly_lut_k2",defaultName:"Flat Black",lutImage:"filters/imgly_lut_flat_black_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_nogreen",defaultName:"Pumpkin",lutImage:"filters/imgly_lut_pumpkin_5_5_128.png"}]},{identifier:"imgly_filters_legacy",defaultName:"Legacy",assetFileName:"legacy",filters:[{identifier:"imgly_lut_ancient",defaultName:"Ancient",lutImage:"filters/imgly_lut_ancient_5_5_128.png"},{identifier:"imgly_lut_cottoncandy",defaultName:"Candy",lutImage:"filters/imgly_lut_cottoncandy_5_5_128.png"},{identifier:"imgly_lut_classic",defaultName:"Classic",lutImage:"filters/imgly_lut_classic_5_5_128.png"},{identifier:"imgly_lut_colorful",defaultName:"Colorful",lutImage:"filters/imgly_lut_colorful_5_5_128.png"},{identifier:"imgly_lut_creamy",defaultName:"Creamy",lutImage:"filters/imgly_lut_creamy_5_5_128.png"},{identifier:"imgly_lut_fixie",defaultName:"Fixie",lutImage:"filters/imgly_lut_fixie_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_food",defaultName:"Food",lutImage:"filters/imgly_lut_food_5_5_128.png"},{identifier:"imgly_lut_fridge",defaultName:"Fridge",lutImage:"filters/imgly_lut_fridge_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_glam",defaultName:"Glam",lutImage:"filters/imgly_lut_glam_5_5_128.png"},{identifier:"imgly_lut_gobblin",defaultName:"Gobblin",lutImage:"filters/imgly_lut_gobblin_5_5_128.png"},{identifier:"imgly_lut_highcontrast",defaultName:"Hicon",lutImage:"filters/imgly_lut_highcontrast_5_5_128.png"},{identifier:"imgly_lut_highcarb",defaultName:"High Carb",lutImage:"filters/imgly_lut_highcarb_5_5_128.png"},{identifier:"imgly_lut_k1",defaultName:"K1",lutImage:"filters/imgly_lut_k1_5_5_128.png"},{identifier:"imgly_lut_k6",defaultName:"K6",lutImage:"filters/imgly_lut_k6_5_5_128.png"},{identifier:"imgly_lut_keen",defaultName:"Keen",lutImage:"filters/imgly_lut_keen_5_5_128.png"},{identifier:"imgly_lut_lomo",defaultName:"Lomo",lutImage:"filters/imgly_lut_lomo_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_lomo100",defaultName:"Lomo 100",lutImage:"filters/imgly_lut_lomo100_5_5_128.png"},{identifier:"imgly_lut_lucid",defaultName:"Lucid",lutImage:"filters/imgly_lut_lucid_5_5_128.png"},{identifier:"imgly_lut_mellow",defaultName:"Mellow",lutImage:"filters/imgly_lut_mellow_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_neat",defaultName:"Neat",lutImage:"filters/imgly_lut_neat_5_5_128.png"},{identifier:"imgly_lut_pale",defaultName:"Pale",lutImage:"filters/imgly_lut_pale_5_5_128.png"},{identifier:"imgly_lut_pitched",defaultName:"Pitched",lutImage:"filters/imgly_lut_pitched_5_5_128.png"},{identifier:"imgly_lut_polasx",defaultName:"Pola SX",lutImage:"filters/imgly_lut_polasx_5_5_128.png"},{identifier:"imgly_lut_pro400",defaultName:"Pro 400",lutImage:"filters/imgly_lut_pro400_5_5_128.png"},{identifier:"imgly_lut_quozi",defaultName:"Quozi",lutImage:"filters/imgly_lut_quozi_5_5_128.png"},{identifier:"imgly_lut_settled",defaultName:"Settled",lutImage:"filters/imgly_lut_settled_5_5_128.png"},{identifier:"imgly_lut_seventies",defaultName:"Seventies",lutImage:"filters/imgly_lut_seventies_5_5_128.png"},{identifier:"imgly_lut_soft",defaultName:"Soft",lutImage:"filters/imgly_lut_soft_5_5_128.png"},{identifier:"imgly_lut_steel",defaultName:"Steel",lutImage:"filters/imgly_lut_steel_5_5_128.png"},{identifier:"imgly_lut_summer",defaultName:"Summer",lutImage:"filters/imgly_lut_summer_5_5_128.png"},{identifier:"imgly_lut_tender",defaultName:"Tender",lutImage:"filters/imgly_lut_tender_5_5_128.png"},{identifier:"imgly_lut_twilight",defaultName:"Twilight",lutImage:"filters/imgly_lut_twilight_5_5_128.png"}]}],OVERLAYS:[{identifier:"imgly_overlay_golden",defaultName:"Golden",image:"overlays/imgly_overlay_golden.jpg",thumbnail:"overlays/imgly_overlay_golden_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_bokeh",defaultName:"Bokeh",image:"overlays/imgly_overlay_bokeh.jpg",thumbnail:"overlays/imgly_overlay_bokeh_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_hearts",defaultName:"Hearts",image:"overlays/imgly_overlay_hearts.jpg",thumbnail:"overlays/imgly_overlay_hearts_thumb.jpg",blendMode:"screen"},{identifier:"imgly_overlay_lightleak1",defaultName:"Light Leak",image:"overlays/imgly_overlay_lightleak1.jpg",thumbnail:"overlays/imgly_overlay_lightleak1_thumb.jpg",blendMode:"screen"},{identifier:"imgly_overlay_lightleak2",defaultName:"Light Leak 2",image:"overlays/imgly_overlay_lightleak2.jpg",thumbnail:"overlays/imgly_overlay_lightleak2_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_rain",defaultName:"Rain",image:"overlays/imgly_overlay_rain.jpg",thumbnail:"overlays/imgly_overlay_rain_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_wood",defaultName:"Wood",image:"overlays/imgly_overlay_wood.jpg",thumbnail:"overlays/imgly_overlay_wood_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_mosaic",defaultName:"Mosaic",image:"overlays/imgly_overlay_mosaic.jpg",thumbnail:"overlays/imgly_overlay_mosaic_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_chop",defaultName:"Chop",image:"overlays/imgly_overlay_chop.jpg",thumbnail:"overlays/imgly_overlay_chop_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_vintage",defaultName:"Vintage",image:"overlays/imgly_overlay_vintage.jpg",thumbnail:"overlays/imgly_overlay_vintage_thumb.jpg",blendMode:"darken"},{identifier:"imgly_overlay_metal",defaultName:"Metal",image:"overlays/imgly_overlay_metal.jpg",thumbnail:"overlays/imgly_overlay_metal_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_paper",defaultName:"Paper",image:"overlays/imgly_overlay_paper.jpg",thumbnail:"overlays/imgly_overlay_paper_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_painting",defaultName:"Painting",image:"overlays/imgly_overlay_painting.jpg",thumbnail:"overlays/imgly_overlay_painting_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_grain",defaultName:"Grain",image:"overlays/imgly_overlay_grain.jpg",thumbnail:"overlays/imgly_overlay_grain_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_clouds",defaultName:"Clouds",image:"overlays/imgly_overlay_clouds.jpg",thumbnail:"overlays/imgly_overlay_clouds_thumb.jpg",blendMode:"softLight"},{identifier:"imgly_overlay_wall1",defaultName:"Wall",image:"overlays/imgly_overlay_wall1.jpg",thumbnail:"overlays/imgly_overlay_wall1_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_wall2",defaultName:"Wall 2",image:"overlays/imgly_overlay_wall2.jpg",thumbnail:"overlays/imgly_overlay_wall2_thumb.jpg",blendMode:"overlay"}],FRAME_CATEGORIES:[{identifier:"imgly_frame_generic",defaultName:"Generic",metaData:{backgroundImage:"frames/generic.png"},frames:[{identifier:"imgly_frame_dia",defaultName:"Dia",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_dia/imgly_frame_dia_thumb.png",imageGroups:{top:{mid:{image:"frames/imgly_frame_dia/imgly_frame_dia_top.png",mode:"repeat"}},left:{start:"frames/imgly_frame_dia/imgly_frame_dia_top_corner_left.png",mid:"frames/imgly_frame_dia/imgly_frame_dia_left.png",end:"frames/imgly_frame_dia/imgly_frame_dia_bottom_corner_left.png"},right:{start:"frames/imgly_frame_dia/imgly_frame_dia_top_corner_right.png",mid:"frames/imgly_frame_dia/imgly_frame_dia_right.png",end:"frames/imgly_frame_dia/imgly_frame_dia_bottom_corner_right.png"},bottom:{mid:{image:"frames/imgly_frame_dia/imgly_frame_dia_bottom.png",mode:"repeat"}}}},{identifier:"imgly_frame_art_decor",defaultName:"Art Decor",tintable:true,layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_art_decor/imgly_frame_art_decor_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_left.png",mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top.png",mode:"stretch"},end:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_left.png",mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom.png",mode:"stretch"},end:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_right.png"}}},{identifier:"imgly_frame_black_passepartout",defaultName:"Black Passepartout",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_left.png",mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top.png",mode:"stretch"},end:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_left.png",mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom.png",mode:"stretch"},end:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_right.png"}}},{identifier:"imgly_frame_lowpoly_shadow",defaultName:"Low Poly",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_left.png",mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top.png",mode:"stretch"},end:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_left.png",mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom.png",mode:"stretch"},end:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_right.png"}}},{identifier:"imgly_frame_wood_passepartout",defaultName:"Wood Passepartout",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_left.png",mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top.png",mode:"stretch"},end:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_left.png",mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom.png",mode:"stretch"},end:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_right.png"}}}]}],STICKER_CATEGORIES:[{identifier:"imgly_sticker_emoticons",defaultName:"Emoticons",metaData:{backgroundImage:"stickers/emoticons/background.png"},stickers:[{identifier:"imgly_sticker_emoticons_alien",defaultName:"Alien",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_alien.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_alien.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_alien.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_alien.png"],width:1e3,height:935}}},{identifier:"imgly_sticker_emoticons_angel",defaultName:"Angel",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angel.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_angel.png"],width:62,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angel.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_angel.png"]}}},{identifier:"imgly_sticker_emoticons_angry",defaultName:"Angry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_angry.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_angry.png"]}}},{identifier:"imgly_sticker_emoticons_anxious",defaultName:"Anxious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_anxious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_anxious.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_anxious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_anxious.png"]}}},{identifier:"imgly_sticker_emoticons_asleep",defaultName:"Asleep",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_asleep.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_asleep.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_asleep.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_asleep.png"]}}},{identifier:"imgly_sticker_emoticons_attention",defaultName:"Attention",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_attention.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_attention.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_attention.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_attention.png"]}}},{identifier:"imgly_sticker_emoticons_baby_chicken",defaultName:"Baby Chicken",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_baby_chicken.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_baby_chicken.png"],width:61,height:42},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_baby_chicken.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_baby_chicken.png"]}}},{identifier:"imgly_sticker_emoticons_batman",defaultName:"Batman",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_batman.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_batman.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_batman.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_batman.png"]}}},{identifier:"imgly_sticker_emoticons_beer",defaultName:"Beer",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_beer.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_beer.png"],width:62,height:59},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_beer.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_beer.png"]}}},{identifier:"imgly_sticker_emoticons_blush",defaultName:"Blush",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_blush.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_blush.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_blush.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_blush.png"]}}},{identifier:"imgly_sticker_emoticons_boxer",defaultName:"Boxer",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_boxer.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_boxer.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_boxer.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_boxer.png"]}}},{identifier:"imgly_sticker_emoticons_business",defaultName:"Business",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_business.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_business.png"],width:60,height:63},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_business.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_business.png"]}}},{identifier:"imgly_sticker_emoticons_chicken",defaultName:"Chicken",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_chicken.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_chicken.png"],width:63,height:55},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_chicken.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_chicken.png"]}}},{identifier:"imgly_sticker_emoticons_cool",defaultName:"Cool",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cool.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_cool.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cool.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_cool.png"]}}},{identifier:"imgly_sticker_emoticons_cry",defaultName:"Cry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_cry.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_cry.png"]}}},{identifier:"imgly_sticker_emoticons_deceased",defaultName:"Deceased",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_deceased.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_deceased.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_deceased.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_deceased.png"]}}},{identifier:"imgly_sticker_emoticons_devil",defaultName:"Devil",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_devil.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_devil.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_devil.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_devil.png"]}}},{identifier:"imgly_sticker_emoticons_duckface",defaultName:"Duckface",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_duckface.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_duckface.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_duckface.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_duckface.png"]}}},{identifier:"imgly_sticker_emoticons_furious",defaultName:"Furious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_furious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_furious.png"],width:62,height:61},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_furious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_furious.png"]}}},{identifier:"imgly_sticker_emoticons_grin",defaultName:"Grin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_grin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_grin.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_grin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_grin.png"]}}},{identifier:"imgly_sticker_emoticons_guitar",defaultName:"Guitar",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_guitar.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_guitar.png"],width:64,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_guitar.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_guitar.png"]}}},{identifier:"imgly_sticker_emoticons_harry_potter",defaultName:"Harry Potter",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_harry_potter.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_harry_potter.png"],width:64,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_harry_potter.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_harry_potter.png"]}}},{identifier:"imgly_sticker_emoticons_hippie",defaultName:"Hippie",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hippie.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_hippie.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hippie.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_hippie.png"]}}},{identifier:"imgly_sticker_emoticons_hitman",defaultName:"Hitman",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hitman.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_hitman.png"],width:64,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hitman.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_hitman.png"]}}},{identifier:"imgly_sticker_emoticons_humourous",defaultName:"Humourous",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_humourous.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_humourous.png"],width:64,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_humourous.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_humourous.png"]}}},{identifier:"imgly_sticker_emoticons_idea",defaultName:"Idea",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_idea.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_idea.png"],width:64,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_idea.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_idea.png"]}}},{identifier:"imgly_sticker_emoticons_impatient",defaultName:"Impatient",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_impatient.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_impatient.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_impatient.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_impatient.png"]}}},{identifier:"imgly_sticker_emoticons_kiss",defaultName:"Kiss",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kiss.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_kiss.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kiss.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_kiss.png"]}}},{identifier:"imgly_sticker_emoticons_kisses",defaultName:"Kisses",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kisses.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_kisses.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kisses.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_kisses.png"]}}},{identifier:"imgly_sticker_emoticons_laugh",defaultName:"Laugh",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_laugh.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_laugh.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_laugh.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_laugh.png"]}}},{identifier:"imgly_sticker_emoticons_loud_cry",defaultName:"Loud Cry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loud_cry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_loud_cry.png"],width:64,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loud_cry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_loud_cry.png"]}}},{identifier:"imgly_sticker_emoticons_loving",defaultName:"Loving",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loving.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_loving.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loving.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_loving.png"]}}},{identifier:"imgly_sticker_emoticons_masked",defaultName:"Masked",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_masked.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_masked.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_masked.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_masked.png"]}}},{identifier:"imgly_sticker_emoticons_music",defaultName:"Music",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_music.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_music.png"],width:62,height:54},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_music.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_music.png"]}}},{identifier:"imgly_sticker_emoticons_nerd",defaultName:"Nerd",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_nerd.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_nerd.png"]},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_nerd.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_nerd.png"]}}},{identifier:"imgly_sticker_emoticons_ninja",defaultName:"Ninja",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_ninja.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_ninja.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_ninja.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_ninja.png"]}}},{identifier:"imgly_sticker_emoticons_not_speaking_to_you",defaultName:"Not Speaking To You",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_not_speaking_to_you.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_not_speaking_to_you.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_not_speaking_to_you.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_not_speaking_to_you.png"]}}},{identifier:"imgly_sticker_emoticons_pig",defaultName:"Pig",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pig.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_pig.png"],width:63,height:41},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pig.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_pig.png"]}}},{identifier:"imgly_sticker_emoticons_pumpkin",defaultName:"Pumpkin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pumpkin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_pumpkin.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pumpkin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_pumpkin.png"]}}},{identifier:"imgly_sticker_emoticons_question",defaultName:"Question",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_question.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_question.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_question.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_question.png"]}}},{identifier:"imgly_sticker_emoticons_rabbit",defaultName:"Rabbit",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_rabbit.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_rabbit.png"],width:65,height:47},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_rabbit.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_rabbit.png"]}}},{identifier:"imgly_sticker_emoticons_sad",defaultName:"Sad",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sad.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sad.png"]},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sad.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sad.png"]}}},{identifier:"imgly_sticker_emoticons_sick",defaultName:"Sick",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sick.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sick.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sick.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sick.png"]}}},{identifier:"imgly_sticker_emoticons_skateboard",defaultName:"Skateboard",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skateboard.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_skateboard.png"],width:62,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skateboard.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_skateboard.png"]}}},{identifier:"imgly_sticker_emoticons_skull",defaultName:"Skull",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skull.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_skull.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skull.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_skull.png"]}}},{identifier:"imgly_sticker_emoticons_sleepy",defaultName:"Sleepy",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sleepy.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sleepy.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sleepy.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sleepy.png"]}}},{identifier:"imgly_sticker_emoticons_smile",defaultName:"Smile",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smile.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_smile.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smile.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_smile.png"]}}},{identifier:"imgly_sticker_emoticons_smoking",defaultName:"Smoking",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smoking.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_smoking.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smoking.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_smoking.png"]}}},{identifier:"imgly_sticker_emoticons_sobbing",defaultName:"Sobbing",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sobbing.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sobbing.png"],width:62,height:59},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sobbing.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sobbing.png"]}}},{identifier:"imgly_sticker_emoticons_star",defaultName:"Star",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_star.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_star.png"],width:64,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_star.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_star.png"]}}},{identifier:"imgly_sticker_emoticons_steaming_furious",defaultName:"Steaming Furious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_steaming_furious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_steaming_furious.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_steaming_furious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_steaming_furious.png"]}}},{identifier:"imgly_sticker_emoticons_sunbathing",defaultName:"Sunbathing",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sunbathing.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sunbathing.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sunbathing.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sunbathing.png"]}}},{identifier:"imgly_sticker_emoticons_tired",defaultName:"Tired",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tired.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_tired.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tired.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_tired.png"]}}},{identifier:"imgly_sticker_emoticons_tongue_out_wink",defaultName:"Tongue Out Wink",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tongue_out_wink.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_tongue_out_wink.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tongue_out_wink.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_tongue_out_wink.png"]}}},{identifier:"imgly_sticker_emoticons_wave",defaultName:"Wave",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wave.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wave.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wave.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wave.png"]}}},{identifier:"imgly_sticker_emoticons_wide_grin",defaultName:"Wide Grin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wide_grin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wide_grin.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wide_grin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wide_grin.png"]}}},{identifier:"imgly_sticker_emoticons_wink",defaultName:"Wink",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wink.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wink.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wink.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wink.png"]}}},{identifier:"imgly_sticker_emoticons_wrestler",defaultName:"Wrestler",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wrestler.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wrestler.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wrestler.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wrestler.png"]}}}]},{identifier:"imgly_sticker_shapes",defaultName:"Shapes",metaData:{backgroundImage:"stickers/shapes/background.png"},stickers:[{identifier:"imgly_sticker_shapes_arrow_02",defaultName:"Arrow 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_02.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_arrow_02.png"],width:2e3,height:1236},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_02.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_arrow_02.png"],width:2e3,height:1236}}},{identifier:"imgly_sticker_shapes_arrow_03",defaultName:"Arrow 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_03.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_arrow_03.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_03.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_arrow_03.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_01",defaultName:"Badge 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_01.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_01.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_01.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_01.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_04",defaultName:"Badge 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_04.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_04.png"],width:2e3,height:1589},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_04.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_04.png"],width:2e3,height:1589}}},{identifier:"imgly_sticker_shapes_badge_06",defaultName:"Badge 3",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_06.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_06.png"],width:2e3,height:1733},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_06.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_06.png"],width:2e3,height:1733}}},{identifier:"imgly_sticker_shapes_badge_08",defaultName:"Badge 4",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_08.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_08.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_08.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_08.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_11",defaultName:"Badge 5",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_11.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_11.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_11.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_11.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_12",defaultName:"Badge 6",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_12.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_12.png"],width:2001,height:1903},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_12.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_12.png"],width:2001,height:1903}}},{identifier:"imgly_sticker_shapes_badge_13",defaultName:"Badge 7",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_13.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_13.png"],width:2e3,height:1718},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_13.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_13.png"],width:2e3,height:1718}}},{identifier:"imgly_sticker_shapes_badge_15",defaultName:"Badge 8",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_15.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_15.png"],width:1618,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_15.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_15.png"],width:1618,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_18",defaultName:"Badge 9",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_18.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_18.png"],width:1198,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_18.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_18.png"],width:1198,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_19",defaultName:"Badge 10",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_19.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_19.png"],width:2127,height:481},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_19.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_19.png"],width:2127,height:481}}},{identifier:"imgly_sticker_shapes_badge_20",defaultName:"Badge 11",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_20.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_20.png"],width:2e3,height:1404},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_20.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_20.png"],width:2e3,height:1404}}},{identifier:"imgly_sticker_shapes_badge_28",defaultName:"Badge 12",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_28.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_28.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_28.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_28.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_32",defaultName:"Badge 13",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_32.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_32.png"],width:1960,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_32.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_32.png"],width:1960,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_35",defaultName:"Badge 14",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_35.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_35.png"],width:2e3,height:2002},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_35.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_35.png"],width:2e3,height:2002}}},{identifier:"imgly_sticker_shapes_badge_36",defaultName:"Badge 15",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_36.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_36.png"],width:2e3,height:1668},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_36.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_36.png"],width:2e3,height:1668}}},{identifier:"imgly_sticker_shapes_spray_01",defaultName:"Spray 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_01.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_01.png"],width:1912,height:2039},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_01.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_01.png"],width:1912,height:2039}}},{identifier:"imgly_sticker_shapes_spray_03",defaultName:"Spray 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_03.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_03.png"],width:1681,height:1779},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_03.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_03.png"],width:1681,height:1779}}},{identifier:"imgly_sticker_shapes_spray_04",defaultName:"Spray 3",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_04.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_04.png"],width:1407,height:2248},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_04.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_04.png"],width:1407,height:2248}}}]}]}};});function X(i,t,e){if(i!=null)if(typeof i=="number")this.fromNumber(i,t,e);else if(t==null&&typeof i!="string")this.fromString(i,256);else this.fromString(i,t);}function Nt(){return new X(null);}function wrt(i,t,e,r,o,n){while(--n>=0){var s=t*this[i++]+e[r]+o;o=Math.floor(s/67108864);e[r++]=s&67108863;}return o;}function Trt(i,t,e,r,o,n){var s=t&32767,a=t>>15;while(--n>=0){var l=this[i]&32767;var c=this[i++]>>15;var u=a*l+c*s;l=s*l+((u&32767)<<15)+e[r]+(o&1073741823);o=(l>>>30)+(u>>>15)+a*c+(o>>>30);e[r++]=l&1073741823;}return o;}function krt(i,t,e,r,o,n){var s=t&16383,a=t>>14;while(--n>=0){var l=this[i]&16383;var c=this[i++]>>14;var u=a*l+c*s;l=s*l+((u&16383)<<14)+e[r]+o;o=(l>>28)+(u>>14)+a*c;e[r++]=l&268435455;}return o;}function I3(i){return Irt.charAt(i);}function D3(i,t){var e=Ly[i.charCodeAt(t)];return e==null?-1:e;}function Drt(i){for(var t=this.t-1;t>=0;--t){i[t]=this[t];}i.t=this.t;i.s=this.s;}function Ert(i){this.t=1;this.s=i<0?-1:0;if(i>0)this[0]=i;else if(i<-1)this[0]=i+this.DV;else this.t=0;}function Za(i){var t=Nt();t.fromInt(i);return t;}function Frt(i,t){var e;if(t==16)e=4;else if(t==8)e=3;else if(t==256)e=8;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else{this.fromRadix(i,t);return;}this.t=0;this.s=0;var r=i.length,o=false,n=0;while(--r>=0){var s=e==8?i[r]&255:D3(i,r);if(s<0){if(i.charAt(r)=="-")o=true;continue;}o=false;if(n==0)this[this.t++]=s;else if(n+e>this.DB){this[this.t-1]|=(s&(1<>this.DB-n;}else this[this.t-1]|=s<=this.DB)n-=this.DB;}if(e==8&&(i[0]&128)!=0){this.s=-1;if(n>0)this[this.t-1]|=(1<0&&this[this.t-1]==i){--this.t;}}function Rrt(i){if(this.s<0)return"-"+this.negate().toString(i);var t;if(i==16)t=4;else if(i==8)t=3;else if(i==2)t=1;else if(i==32)t=5;else if(i==4)t=2;else return this.toRadix(i);var e=(1<0){if(a>a)>0){o=true;n=I3(r);}while(s>=0){if(a>(a+=this.DB-t);}else{r=this[s]>>(a-=t)&e;if(a<=0){a+=this.DB;--s;}}if(r>0)o=true;if(o)n+=I3(r);}}return o?n:"0";}function Art(){var i=Nt();X.ZERO.subTo(this,i);return i;}function Brt(){return this.s<0?this.negate():this;}function Prt(i){var t=this.s-i.s;if(t!=0)return t;var e=this.t;t=e-i.t;if(t!=0)return this.s<0?-t:t;while(--e>=0){if((t=this[e]-i[e])!=0)return t;}return 0;}function zy(i){var t=1,e;if((e=i>>>16)!=0){i=e;t+=16;}if((e=i>>8)!=0){i=e;t+=8;}if((e=i>>4)!=0){i=e;t+=4;}if((e=i>>2)!=0){i=e;t+=2;}if((e=i>>1)!=0){i=e;t+=1;}return t;}function Mrt(){if(this.t<=0)return 0;return this.DB*(this.t-1)+zy(this[this.t-1]^this.s&this.DM);}function Lrt(i,t){var e;for(e=this.t-1;e>=0;--e){t[e+i]=this[e];}for(e=i-1;e>=0;--e){t[e]=0;}t.t=this.t+i;t.s=this.s;}function zrt(i,t){for(var e=i;e=0;--a){t[a+n+1]=this[a]>>r|s;s=(this[a]&o)<=0;--a){t[a]=0;}t[n]=s;t.t=this.t+n+1;t.s=this.s;t.clamp();}function Nrt(i,t){t.s=this.s;var e=Math.floor(i/this.DB);if(e>=this.t){t.t=0;return;}var r=i%this.DB;var o=this.DB-r;var n=(1<>r;for(var s=e+1;s>r;}if(r>0)t[this.t-e-1]|=(this.s&n)<>=this.DB;}if(i.t>=this.DB;}r+=this.s;}else{r+=this.s;while(e>=this.DB;}r-=i.s;}t.s=r<0?-1:0;if(r<-1)t[e++]=this.DV+r;else if(r>0)t[e++]=r;t.t=e;t.clamp();}function Wrt(i,t){var e=this.abs(),r=i.abs();var o=e.t;t.t=o+r.t;while(--o>=0){t[o]=0;}for(o=0;o=0){i[e]=0;}for(e=0;e=t.DV){i[e+t.t]-=t.DV;i[e+t.t+1]=1;}}if(i.t>0)i[i.t-1]+=t.am(e,t[e],i,2*e,0,1);i.s=0;i.clamp();}function Vrt(i,t,e){var r=i.abs();if(r.t<=0)return;var o=this.abs();if(o.t0){r.lShiftTo(l,n);o.lShiftTo(l,e);}else{r.copyTo(n);o.copyTo(e);}var c=n.t;var u=n[c-1];if(u==0)return;var m=u*(1<1?n[c-2]>>this.F2:0);var p=this.FV/m,h=(1<=0){e[e.t++]=1;e.subTo(b,e);}X.ONE.dlShiftTo(c,b);b.subTo(n,n);while(n.t=0){var T=e[--x]==u?this.DM:Math.floor(e[x]*p+(e[x-1]+g)*h);if((e[x]+=n.am(0,T,e,v,0,c))0)e.rShiftTo(l,e);if(s<0)X.ZERO.subTo(e,e);}function jrt(i){var t=Nt();this.abs().divRemTo(i,null,t);if(this.s<0&&t.compareTo(X.ZERO)>0)i.subTo(t,t);return t;}function cc(i){this.m=i;}function $rt(i){if(i.s<0||i.compareTo(this.m)>=0)return i.mod(this.m);else return i;}function Krt(i){return i;}function Xrt(i){i.divRemTo(this.m,null,i);}function qrt(i,t,e){i.multiplyTo(t,e);this.reduce(e);}function Yrt(i,t){i.squareTo(t);this.reduce(t);}function Jrt(){if(this.t<1)return 0;var i=this[0];if((i&1)==0)return 0;var t=i&3;t=t*(2-(i&15)*t)&15;t=t*(2-(i&255)*t)&255;t=t*(2-((i&65535)*t&65535))&65535;t=t*(2-i*t%this.DV)%this.DV;return t>0?this.DV-t:-t;}function uc(i){this.m=i;this.mp=i.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<0)this.m.subTo(t,t);return t;}function Qrt(i){var t=Nt();i.copyTo(t);this.reduce(t);return t;}function tot(i){while(i.t<=this.mt2){i[i.t++]=0;}for(var t=0;t>15)*this.mpl&this.um)<<15)&i.DM;e=t+this.m.t;i[e]+=this.m.am(0,r,i,t,0,this.m.t);while(i[e]>=i.DV){i[e]-=i.DV;i[++e]++;}}i.clamp();i.drShiftTo(this.m.t,i);if(i.compareTo(this.m)>=0)i.subTo(this.m,i);}function eot(i,t){i.squareTo(t);this.reduce(t);}function iot(i,t,e){i.multiplyTo(t,e);this.reduce(e);}function rot(){return(this.t>0?this[0]&1:this.s)==0;}function oot(i,t){if(i>4294967295||i<1)return X.ONE;var e=Nt(),r=Nt(),o=t.convert(this),n=zy(i)-1;o.copyTo(e);while(--n>=0){t.sqrTo(e,r);if((i&1<0)t.mulTo(r,o,e);else{var s=e;e=r;r=s;}}return t.revert(e);}function not(i,t){var e;if(i<256||t.isEven())e=new cc(t);else e=new uc(t);return this.exp(i,e);}function sot(){var i=Nt();this.copyTo(i);return i;}function aot(){if(this.s<0){if(this.t==1)return this[0]-this.DV;else if(this.t==0)return-1;}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<>24;}function cot(){return this.t==0?this.s:this[0]<<16>>16;}function uot(i){return Math.floor(Math.LN2*this.DB/Math.log(i));}function dot(){if(this.s<0)return-1;else if(this.t<=0||this.t==1&&this[0]<=0)return 0;else return 1;}function mot(i){if(i==null)i=10;if(this.signum()==0||i<2||i>36)return"0";var t=this.chunkSize(i);var e=Math.pow(i,t);var r=Za(e),o=Nt(),n=Nt(),s="";this.divRemTo(r,o,n);while(o.signum()>0){s=(e+n.intValue()).toString(i).substr(1)+s;o.divRemTo(r,o,n);}return n.intValue().toString(i)+s;}function pot(i,t){this.fromInt(0);if(t==null)t=10;var e=this.chunkSize(t);var r=Math.pow(t,e),o=false,n=0,s=0;for(var a=0;a=e){this.dMultiply(r);this.dAddOffset(s,0);n=0;s=0;}}if(n>0){this.dMultiply(Math.pow(t,n));this.dAddOffset(s,0);}if(o)X.ZERO.subTo(this,this);}function hot(i,t,e){if(typeof t=="number"){if(i<2)this.fromInt(1);else{this.fromNumber(i,e);if(!this.testBit(i-1))this.bitwiseTo(X.ONE.shiftLeft(i-1),tw,this);if(this.isEven())this.dAddOffset(1,0);while(!this.isProbablePrime(t)){this.dAddOffset(2,0);if(this.bitLength()>i)this.subTo(X.ONE.shiftLeft(i-1),this);}}}else{var r=new Array(),o=i&7;r.length=(i>>3)+1;t.nextBytes(r);if(o>0)r[0]&=(1<0){if(e>e)!=(this.s&this.DM)>>e)t[o++]=r|this.s<=0){if(e<8){r=(this[i]&(1<>(e+=this.DB-8);}else{r=this[i]>>(e-=8)&255;if(e<=0){e+=this.DB;--i;}}if((r&128)!=0)r|=-256;if(o==0&&(this.s&128)!=(r&128))++o;if(o>0||r!=this.s)t[o++]=r;}}return t;}function got(i){return this.compareTo(i)==0;}function bot(i){return this.compareTo(i)<0?this:i;}function yot(i){return this.compareTo(i)>0?this:i;}function _ot(i,t,e){var r,o,n=Math.min(i.t,this.t);for(r=0;r>=16;t+=16;}if((i&255)==0){i>>=8;t+=8;}if((i&15)==0){i>>=4;t+=4;}if((i&3)==0){i>>=2;t+=2;}if((i&1)==0)++t;return t;}function Eot(){for(var i=0;i=this.t)return this.s!=0;return(this[t]&1<>=this.DB;}if(i.t>=this.DB;}r+=this.s;}else{r+=this.s;while(e>=this.DB;}r+=i.s;}t.s=r<0?-1:0;if(r>0)t[e++]=r;else if(r<-1)t[e++]=this.DV+r;t.t=e;t.clamp();}function zot(i){var t=Nt();this.addTo(i,t);return t;}function Uot(i){var t=Nt();this.subTo(i,t);return t;}function Not(i){var t=Nt();this.multiplyTo(i,t);return t;}function Hot(){var i=Nt();this.squareTo(i);return i;}function Wot(i){var t=Nt();this.divRemTo(i,t,null);return t;}function Got(i){var t=Nt();this.divRemTo(i,null,t);return t;}function Vot(i){var t=Nt(),e=Nt();this.divRemTo(i,t,e);return new Array(t,e);}function jot(i){this[this.t]=this.am(0,i-1,this,0,0,this.t);++this.t;this.clamp();}function $ot(i,t){if(i==0)return;while(this.t<=t){this[this.t++]=0;}this[t]+=i;while(this[t]>=this.DV){this[t]-=this.DV;if(++t>=this.t)this[this.t++]=0;++this[t];}}function hh(){}function O3(i){return i;}function Kot(i,t,e){i.multiplyTo(t,e);}function Xot(i,t){i.squareTo(t);}function qot(i){return this.exp(i,new hh());}function Yot(i,t,e){var r=Math.min(this.t+i.t,t);e.s=0;e.t=r;while(r>0){e[--r]=0;}var o;for(o=e.t-this.t;r=0){e[r]=0;}for(r=Math.max(t-this.t,0);r2*this.m.t)return i.mod(this.m);else if(i.compareTo(this.m)<0)return i;else{var t=Nt();i.copyTo(t);this.reduce(t);return t;}}function Qot(i){return i;}function tnt(i){i.drShiftTo(this.m.t-1,this.r2);if(i.t>this.m.t+1){i.t=this.m.t+1;i.clamp();}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(i.compareTo(this.r2)<0){i.dAddOffset(1,this.m.t+1);}i.subTo(this.r2,i);while(i.compareTo(this.m)>=0){i.subTo(this.m,i);}}function ent(i,t){i.squareTo(t);this.reduce(t);}function _int(i,t,e){i.multiplyTo(t,e);this.reduce(e);}function rnt(i,t){var e=i.bitLength(),r,o=Za(1),n;if(e<=0)return o;else if(e<18)r=1;else if(e<48)r=3;else if(e<144)r=4;else if(e<768)r=5;else r=6;if(e<8)n=new cc(t);else if(t.isEven())n=new Bd(t);else n=new uc(t);var s=new Array(),a=3,l=r-1,c=(1<1){var u=Nt();n.sqrTo(s[1],u);while(a<=c){s[a]=Nt();n.mulTo(u,s[a-2],s[a]);a+=2;}}var m=i.t-1,p,h=true,g=Nt(),x;e=zy(i[m])-1;while(m>=0){if(e>=l)p=i[m]>>e-l&c;else{p=(i[m]&(1<0)p|=i[m-1]>>this.DB+e-l;}a=r;while((p&1)==0){p>>=1;--a;}if((e-=a)<0){e+=this.DB;--m;}if(h){s[p].copyTo(o);h=false;}else{while(a>1){n.sqrTo(o,g);n.sqrTo(g,o);a-=2;}if(a>0)n.sqrTo(o,g);else{x=o;o=g;g=x;}n.mulTo(g,s[p],o);}while(m>=0&&(i[m]&1<0){t.rShiftTo(n,t);e.rShiftTo(n,e);}while(t.signum()>0){if((o=t.getLowestSetBit())>0)t.rShiftTo(o,t);if((o=e.getLowestSetBit())>0)e.rShiftTo(o,e);if(t.compareTo(e)>=0){t.subTo(e,t);t.rShiftTo(1,t);}else{e.subTo(t,e);e.rShiftTo(1,e);}}if(n>0)e.lShiftTo(n,e);return e;}function nnt(i){if(i<=0)return 0;var t=this.DV%i,e=this.s<0?i-1:0;if(this.t>0)if(t==0)e=this[0]%i;else for(var r=this.t-1;r>=0;--r){e=(t*e+this[r])%i;}return e;}function snt(i){var t=i.isEven();if(this.isEven()&&t||i.signum()==0)return X.ZERO;var e=i.clone(),r=this.clone();var o=Za(1),n=Za(0),s=Za(0),a=Za(1);while(e.signum()!=0){while(e.isEven()){e.rShiftTo(1,e);if(t){if(!o.isEven()||!n.isEven()){o.addTo(this,o);n.subTo(i,n);}o.rShiftTo(1,o);}else if(!n.isEven())n.subTo(i,n);n.rShiftTo(1,n);}while(r.isEven()){r.rShiftTo(1,r);if(t){if(!s.isEven()||!a.isEven()){s.addTo(this,s);a.subTo(i,a);}s.rShiftTo(1,s);}else if(!a.isEven())a.subTo(i,a);a.rShiftTo(1,a);}if(e.compareTo(r)>=0){e.subTo(r,e);if(t)o.subTo(s,o);n.subTo(a,n);}else{r.subTo(e,r);if(t)s.subTo(o,s);a.subTo(n,a);}}if(r.compareTo(X.ONE)!=0)return X.ZERO;if(a.compareTo(i)>=0)return a.subtract(i);if(a.signum()<0)a.addTo(i,a);else return a;if(a.signum()<0)return a.add(i);else return a;}function lnt(i){var t,e=this.abs();if(e.t==1&&e[0]<=$i[$i.length-1]){for(t=0;t<$i.length;++t){if(e[0]==$i[t])return true;}return false;}if(e.isEven())return false;t=1;while(t<$i.length){var r=$i[t],o=t+1;while(o<$i.length&&r>1;if(i>$i.length)i=$i.length;var o=Nt();for(var n=0;n>16)+(b>>16)+(T>>16);return k<<16|T&65535;}function o(v,b){return v>>>b|v<<32-b;}function n(v,b){return v>>>b;}function s(v,b,T){return v&b^~v&T;}function a(v,b,T){return v&b^v&T^b&T;}function l(v){return o(v,2)^o(v,13)^o(v,22);}function c(v){return o(v,6)^o(v,11)^o(v,25);}function u(v){return o(v,7)^o(v,18)^n(v,3);}function m(v){return o(v,17)^o(v,19)^n(v,10);}function p(v,b){var T=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298);var k=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225);var E=new Array(64);var A,I,F,Z,et,pt,yt,bt,ht,Qt;var gi,ii;v[b>>5]|=128<<24-b%32;v[(b+64>>9<<4)+15]=b;for(var ht=0;ht>5]|=(v.charCodeAt(k/t)&T)<<24-k%32;}return b;}function g(v){v=v.replace(/\r\n/g,"\n");var b="";for(var T=0;T127&&k<2048){b+=String.fromCharCode(k>>6|192);b+=String.fromCharCode(k&63|128);}else{b+=String.fromCharCode(k>>12|224);b+=String.fromCharCode(k>>6&63|128);b+=String.fromCharCode(k&63|128);}}return b;}function x(v){var b=e?"0123456789ABCDEF":"0123456789abcdef";var T="";for(var k=0;k>2]>>(3-k%4)*8+4&15)+b.charAt(v[k>>2]>>(3-k%4)*8&15);}return T;}i=g(i);return x(p(h(i),i.length*t));}var P3=d(function(){});var unt,dnt,dc;var M3=d(function(){unt=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/g;dnt=/^(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/g;dc=/*#__PURE__*/function(){function dc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;_classCallCheck(this,dc);var r=e?dnt:unt;var o=r.exec(t);r.lastIndex=0;this._major=o[1];this._minor=o[2];this._patch=o[3]||0;}_createClass(dc,[{key:"major",get:function get(){return this._major;}},{key:"minor",get:function get(){return this._minor;}},{key:"patch",get:function get(){return this._patch;}},{key:"equals",value:function equals(t){return this._major===t._major&&this._minor===t._minor&&this._patch===t._patch;}},{key:"isMoreRecentThan",value:function isMoreRecentThan(t){if(this._majort.major)return true;if(this._minort.minor)return true;if(this._patch<=t.patch)return false;if(this._patch>t.patch)return true;}}]);return dc;}();});function mnt(i){return i.map(function(t){return"0".concat((t&255).toString(16)).slice(-2);}).join("");}var xi,pnt,hnt,L3,fnt,z3,ew,gnt,bnt,iw,ynt,U3,rw,Uy;var ow=d(function(){Cd();A3();P3();yd();M3();kn();xi=function xi(i){return z.byteArrayToString(io.decode(i));};pnt="TDNSeVlXTnJQMkZ3YVV0bGVUMD0=";hnt="ZW50ZXJwcmlzZV9saWNlbnNl";L3="YXBwX2lkZW50aWZpZXJz";fnt="cGxhdGZvcm0=";z3="ZmVhdHVyZXM=";ew="ZXhwaXJlc19hdA==";gnt="ZG9tYWlucw==";bnt="YXBpX3Rva2Vu";iw="c2lnbmF0dXJl";ynt="dmVyc2lvbg==";U3=/*#__PURE__*/function(){function U3(t){_classCallCheck(this,U3);this._version="2.4";this._l=typeof t==="string"?t.trim():t;this._e=this._parseBigInt("65537",10);this._n=this._parseBigInt("681984042382424091378806337544846672160292647422517223678775230983366046720611873368204040735766698395282492937192783016867164773742859209434481353888637963692711665138989982680829529436715362566735813634679619274059040232728883894511099669775400556584329435375723951309340934658571478665059403241851229195311069345899870108307225910988692123234379186643268583453907260879685992156955936561142314233983397819356937109343127504441076920088455337597736475086676246750168976219763398350254797168313954762459542746440628077261880980924552698138857743609502132632199713575442848784271304503226045319991689413234228439044522583790713890093165912455428688507463773064216328753265963237930998706891042679105987175588970202082466871461192706070321938250462103821558100761330890228135620208935801286878657384108721268761878694436895194628411397454202904351577771506916746612289964053490210990342857409030179406810634136188751670648983222653319056818302012063874664196648868156305696644664362171542503665321455971335955948698828939948786720193132672749776162913092000667953299803216404664087988046584107737900256954976744353601826341965438148646041640662195744770544094748295945844184507459808803114917301124088082458306086473490516969815873631",10);this._parseLicense();}_createClass(U3,[{key:"v",value:function v(){return this._sigValid()&&!this.isExp();}},{key:"_jsonValid",value:function _jsonValid(){try{this._decLic=JSON.parse(this._l);}catch(t){this._decLic={};return false;}return true;}},{key:"_hostnameValid",value:function _hostnameValid(){if(typeof window==="undefined")return true;if(!this._decLic[xi(L3)].length)return true;var t=window.location.hostname;var e=false;this._decLic[xi(L3)].forEach(function(r){if(z.wildCardMatch(t,r)){e=true;}});return e;}},{key:"_platformValid",value:function _platformValid(){var t=this._decLic[xi(fnt)];var e=true?"HTML5":"Server";return e===t;}},{key:"c",value:function c(){var _this66=this;return new Promise(function(t,e){var r=_this66._validateError();if(r!==null){e(r);}t();});}},{key:"validate",value:function validate(){var t=this._validateError();if(t!==null){return false;}return true;}},{key:"_validateError",value:function _validateError(){var t=_typeof(this._l);if(t!=="string"||!this._jsonValid()){var e=new Error();e.code="ELICINVFMT";return e;}if(!this._sigValid()){var _e4=new Error();_e4.code="ELICINV";return _e4;}if(!this._hostnameValid()){var _e5=new Error();_e5.code="ELICINVHOST";return _e5;}if(!this._platformValid()){var _e6=new Error();_e6.code="ELICINVPLAT";return _e6;}if(this.isExp()){var _e7=new Error();_e7.code="ELICEXP";return _e7;}return null;}},{key:"isToolAllowed",value:function isToolAllowed(t){return this._includesFeature(t);}},{key:"isWhiteLabel",value:function isWhiteLabel(){return this._includesFeature("whitelabel",new dc("2.4",true));}},{key:"areCustomAssetsAllowed",value:function areCustomAssetsAllowed(){return this._includesFeature("customassets",new dc("2.4",true));}},{key:"t",value:function t(){if(this._decLic.enterprise_license)return Promise.resolve();if(this._includesFeature("noexporttracking",new dc("2.4",true)))return Promise.resolve();var t=this._decLic[xi(gnt)][0]+xi(xi(pnt))+this._decLic[xi(bnt)];var e=new ro(t);return e.load()["catch"](function(){});}},{key:"isENT",value:function isENT(){if(!this._decLic)return false;return this._decLic[xi(hnt)];}},{key:"_sigValid",value:function _sigValid(){return this._verify(this._message,this._sig);}},{key:"exp",value:function exp(){return!!this._decLic[xi(ew)];}},{key:"dl",value:function dl(){return Math.ceil((this._expAt()-Date.now())/(60*60*24*1e3));}},{key:"isExp",value:function isExp(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Date.now();if(this._decLic[xi(ew)]===null)return false;return t>this._expAt();}},{key:"_expAt",value:function _expAt(){return this._decLic[xi(ew)]*1e3;}},{key:"_verify",value:function _verify(t,e){var r;var o;o=this._encodeMessage(t);r=this._decodeSignature(e);r=r.substr(-64);var n=o===r;return n;}},{key:"_encodeMessage",value:function _encodeMessage(t){var e=B3(t);return e;}},{key:"_decodeSignature",value:function _decodeSignature(t){var e;t=io.decode(t);t=mnt(t);t=this._parseBigInt(t,16);e=t.modPowInt(this._e,this._n);e=e.toString(16);return e;}},{key:"_parseBigInt",value:function _parseBigInt(t,e){return new R3(t,e);}},{key:"_parseLicense",value:function _parseLicense(){if(typeof this._l!=="string")return;if(!this._jsonValid())return;this._sig=this._decLic[xi(iw)]||"";delete this._decLic[xi(iw)];this._sig=this._sig.replace(/[^A-Za-z0-9+/=]/g,"");this._message=this._l.replace(new RegExp(",\"".concat(xi(iw),"\":\"([^\"]*)\"")),"");}},{key:"_includesFeature",value:function _includesFeature(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new dc("1.0",true);var r=new dc(this._decLic[xi(ynt)],true);if(e.isMoreRecentThan(r))return true;return this._decLic[xi(z3)]&&this._decLic[xi(z3)].indexOf(t)!==-1;}}]);return U3;}();rw=/*#__PURE__*/function(){function rw(){_classCallCheck(this,rw);}_createClass(rw,[{key:"v",value:function v(){return true;}},{key:"c",value:function c(){return Promise.resolve();}},{key:"isToolAllowed",value:function isToolAllowed(t){return true;}},{key:"isWhiteLabel",value:function isWhiteLabel(){return false;}},{key:"areCustomAssetsAllowed",value:function areCustomAssetsAllowed(){return true;}},{key:"t",value:function t(){return Promise.resolve();}},{key:"isENT",value:function isENT(){return false;}},{key:"exp",value:function exp(){return false;}},{key:"dl",value:function dl(){return 0;}},{key:"isExp",value:function isExp(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Date.now();return false;}}]);return rw;}();Uy=U3;});var mc,Us,tl,N3,Ny;var H3=d(function(){mc=typeof window==="undefined"?global:window;Us=mc.requestAnimationFrame;tl=mc.cancelAnimationFrame;N3=0;Ny=["ms","moz","webkit","o"];for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:new _ot2(0,0);var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new _ot2(1,1);var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:new _ot2(2,-1);var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new _ot2(2,0);_classCallCheck(this,W3);this._p0=t.clone();this._p1=e.clone();this._p2=r.clone();this._p3=o.clone();this._segments=[];this._length=-1;this._sample=[];}_createClass(W3,[{key:"set",value:function set(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:new _ot2(0,0);var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new _ot2(1,1);var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:new _ot2(2,1);var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new _ot2(2,0);this._p0=t.clone();this._p1=e.clone();this._p2=r.clone();this._p3=o.clone();}},{key:"getLength",value:function getLength(){return this._length;}},{key:"calculateSegments",value:function calculateSegments(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:100;var e=0;var r=0;var o=[];var n=1/t;var s=this._p0.clone();for(var a=1;a<=t;a++){var l=[];l.push({t:e,s:r,point:s});e+=n;e=Math.min(e,1);var c=this.evalAt(e);var u=c.clone().subtract(s);r+=u.len();l.push({t:e,s:r,point:c});o.push(l);s=c;}this._segments=o;this._length=r;return r;}},{key:"evalAt",value:function evalAt(t){t=this.normalizeParameter(t);var e=this._p0.clone().multiply(Math.pow(1-t,3));var r=this._p1.clone().multiply(3*(1-t)*(1-t)*t);var o=this._p2.clone().multiply(3*(1-t)*t*t);var n=this._p3.clone().multiply(t*t*t);return e.add(r).add(o).add(n);}},{key:"isInSegment",value:function isInSegment(t,e){t=this.normalizeArcLength(t);return t>=e[0].s&&t<=e[1].s;}},{key:"getArcLengthSegment",value:function getArcLengthSegment(t){t=this.normalizeArcLength(t);for(var e=0;e0&&arguments[0]!==undefined?arguments[0]:100;var e=1/t;var r=[];var o=0;for(var n=0;n<=t+1;n++){r.push(this.evalAt(o));o+=e;}this._sample=r;return[].concat(r);}},{key:"arcLengthApproxSample",value:function arcLengthApproxSample(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:100;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var o=this._length/t;var n=[];var s=0;for(var a=e?1:0;aa.x||e.ya.y){return false;}return true;}},{key:"getLocalBounds",value:function getLocalBounds(){if(this._localBoundsNeedUpdate&&this._texture){var t=this._localBounds;var e=this._texture.getFrame();t.x=-e.width*this._anchor.x;t.y=-e.height*this._anchor.y;t.width=e.width;t.height=e.height;this._localBoundsNeedUpdate=false;}return this._localBounds.clone();}},{key:"getBounds",value:function getBounds(){if(this._boundsNeedUpdate&&this._texture){var t=this._bounds;var e=this._texture.getFrame();var r=this._worldTransform;var o=this._anchor;var n=r.rectangleToCoordinates(e,o);var s=n[0].x;var a=n[0].y;var l=s;var c=a;n.forEach(function(_ref109){var u=_ref109.x,m=_ref109.y;s=Math.min(s,u);a=Math.min(a,m);l=Math.max(l,u);c=Math.max(c,m);});t.x=s;t.width=Math.abs(l-s);t.y=a;t.height=Math.abs(c-a);this._boundsNeedUpdate=false;}return this._bounds.clone();}},{key:"getTexture",value:function getTexture(){return this._texture;}},{key:"clearTexture",value:function clearTexture(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(!this._texture){return;}this._texture.off("update",this._onTextureUpdate);t&&this._texture.dispose();this._texture=null;if(this._potRenderer){t&&this._potRenderer.dispose();delete this._potRenderer;}}},{key:"setTexture",value:function setTexture(t){if(!t)return;if(this._texture){this._texture.off("update",this._onTextureUpdate);}if(this._potRenderer){this._potRenderer.getRenderTexture().getBaseTexture().setDirty(true);}this._texture=t;if(t.getBaseTexture().isLoaded()){this._onTextureUpdate();}t.on("update",this._onTextureUpdate);}},{key:"getShader",value:function getShader(){return this._shader;}},{key:"setShader",value:function setShader(t){this._shader=t;}},{key:"getWidth",value:function getWidth(){return this._width;}},{key:"setWidth",value:function setWidth(t){if(!this._texture)return;this._scale.x=t/this._texture.getFrame().width;this._width=t;this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true;}},{key:"getHeight",value:function getHeight(){return this._height;}},{key:"setHeight",value:function setHeight(t){if(!this._texture)return;this._scale.y=t/this._texture.getFrame().height;this._height=t;this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true;}},{key:"getDimensions",value:function getDimensions(){return new _ot2(this._width,this._height);}},{key:"getAnchor",value:function getAnchor(){return this._anchor;}},{key:"setAnchor",value:function setAnchor(t,e){this._anchor.set(t,e);this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true;}},{key:"isSmoothDownscaling",value:function isSmoothDownscaling(){return this._smoothDownscaling;}},{key:"setSmoothDownscaling",value:function setSmoothDownscaling(t){this._smoothDownscaling=t;}},{key:"dispose",value:function dispose(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(this._texture){this._texture.off("update",this._onTextureUpdate);}(t||e)&&this._texture&&this._texture.dispose(e);if(this._potRenderer){this._potRenderer.dispose();}}}]);return bh;}(_In);});var _nt,L;var gh=d(function(){Oy();U1();Id();Ay();b3();w3();uw();Fd();J1();Y1();rh();y1();Tn();ah();_nt={CanvasFilterManager:lc,Container:_In,BaseTexture:Ae,Texture:_Ja,RenderTexture:mh,WebGLRenderTarget:Ls,CanvasRenderTarget:Ms,Sprite:bh,Filter:Uo,Filters:z1,PixelArrayImage:gd,autoDetectRenderer:function autoDetectRenderer(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(pi.isSupported()){return new My(i,t,e);}return new Od(i,t,e);},canvasRenderer:function canvasRenderer(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return new Od(i,t,e);}};L=_nt;});var X3,q3;var Y3=d(function(){X3=/*#__PURE__*/function(){function X3(){_classCallCheck(this,X3);}_createClass(X3,null,[{key:"current",value:function current(){return process.env.ENV;}},{key:"isTest",value:function isTest(){return process.env.ENV==="test";}},{key:"isDevelopment",value:function isDevelopment(){return process.env.ENV==="development";}},{key:"isProduction",value:function isProduction(){return process.env.ENV==="production"||!this.isTest()&&!this.isDevelopment();}}]);return X3;}();q3=X3;});var J3,hc;var Hy=d(function(){J3=/*#__PURE__*/function(){function J3(t){_classCallCheck(this,J3);this._head=0;this._buf=t;}_createClass(J3,[{key:"peekInt8",value:function peekInt8(){return this._buf[this._head];}},{key:"peekInt16",value:function peekInt16(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._buf[this._head];var r=this._buf[this._head+1];if(!t){return(e<<8)+r;}return(r<<8)+e;}},{key:"peekInt24",value:function peekInt24(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._buf[this._head];var r=this._buf[this._head+1];var o=this._buf[this._head+2];if(!t){return(e<<16)+(r<<8)+o;}return(o<<16)+(r<<8)+e;}},{key:"peekInt32",value:function peekInt32(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._buf[this._head];var r=this._buf[this._head+1];var o=this._buf[this._head+2];var n=this._buf[this._head+3];if(!t){return(e<<32)+(r<<16)+(o<<8)+n;}return(n<<32)+(o<<16)+(r<<8)+e;}},{key:"writeInt8",value:function writeInt8(t){this._buf[this._head]=t&255;}},{key:"writeInt16",value:function writeInt16(t){this._buf[this._head]=t>>8;this._buf[this._head+1]=t&255;}},{key:"readInt8",value:function readInt8(){var t=this.peekInt8();this._head+=1;return t;}},{key:"readInt16",value:function readInt16(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.peekInt16(t);this._head+=2;return e;}},{key:"readInt24",value:function readInt24(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.peekInt24(t);this._head+=3;return e;}},{key:"readInt32",value:function readInt32(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.peekInt32(t);this._head+=4;return e;}},{key:"readString",value:function readString(t){var e="";for(var r=0;r0)){return false;}var r=this._stream.readString(4);if(r!=="Exif"){return false;}return true;}},{key:"_parse",value:function _parse(){if(!this.isValid()){return;}this._stream.setHead(10);var t=this._stream.getHead();this._bigEndian=false;var e=this._stream.readInt16();if(e===18761){this._bigEndian=false;}else if(e===19789){this._bigEndian=true;}else{dw(false,"Invalid TIFF data: No endian type found");}dw(this._stream.readInt16(!this._bigEndian)===42,"Invalid TIFF data: No 0x002A");var r=this._stream.readInt32(!this._bigEndian);dw(r>=8,"Invalid TIFF data: First IFD offset < 8");var o=t+r;var n=this._readTags(this._stream,t,o,this._bigEndian);this._tags=n.tags;this._tagData=n.tagData;}},{key:"getTags",value:function getTags(){return this._tags;}},{key:"getTagData",value:function getTagData(){return this._tagData;}},{key:"setOrientation",value:function setOrientation(t){if(this._tagData.Orientation){var e=this._tagData.Orientation.entryOffset;this._stream.setHead(e+8);this._stream.writeInt16(this._bigEndian?t:(t&255)<<8|t>>8&255);}}},{key:"_readTags",value:function _readTags(t,e,r,o){t.setHead(r);var n=t.readInt16(!o);var s={};var a=[];for(var l=0;l4?h:c+8);g=t.readString(p);break;case 3:t.setHead(p>2?h:c+8);if(p===1){g=t.readInt16(!o);}else{g=[];for(var _x8=0;_x81?h:c+8);if(p===1){g=t.readInt32(!o);}else{g=[];for(var _x9=0;_x9=16)){return false;}var r=this._stream.readString(4);var o=this._stream.readInt8();if(!(r==="JFIF")){return false;}if(!(o===0)){return false;}return true;}},{key:"setUnitDensity",value:function setUnitDensity(t){this._stream.setHead(11);this._stream.writeInt8(t);}},{key:"setDensityX",value:function setDensityX(t){this._stream.setHead(12);this._stream.writeInt16(t);}},{key:"setDensityY",value:function setDensityY(t){this._stream.setHead(14);this._stream.writeInt16(t);}},{key:"getUnitDensity",value:function getUnitDensity(){this._stream.setHead(11);return this._stream.readInt8();}},{key:"getDensityX",value:function getDensityX(){this._stream.setHead(12);return this._stream.readInt16();}},{key:"getDensityY",value:function getDensityY(){this._stream.setHead(14);return this._stream.readInt16();}},{key:"getBuffer",value:function getBuffer(){return this._buf;}}]);return iz;}();mw=iz;});var KFt,yh,Gy,wnt,_En,_h;var pw=d(function(){Hy();yd();Wy();ez();rz();kn();var _z3=z;KFt=_z3.invariant;var _Pd3=Pd;yh=_Pd3.MARKERS;Gy="data:image/jpeg;base64,";wnt=new RegExp("^".concat(Gy),"i");_En=/*#__PURE__*/function(){function En(t){_classCallCheck(this,En);this._buf=t;this._stream=new hc(this._buf);this._stream.setHead(0);this._segments=this._sliceIntoSegments(this._buf);this._exifData=new tz(this._getMarkerBuffer(yh.EXIF));this._jfifData=new mw(this._getMarkerBuffer(yh.JFIF));}_createClass(En,[{key:"restoreSegmentsInArray",value:function restoreSegmentsInArray(t){t=this.restoreExifTagsToImageData(t);return this.restoreJfifSegmentToImageData(t);}},{key:"restoreSegments",value:function restoreSegments(t){var e=_En.fromDataURL(t);e=this.restoreSegmentsInArray(e);return _En.toDataURL(e);}},{key:"restoreExifTagsToImageData",value:function restoreExifTagsToImageData(t){if(!this._exifData.isValid()){return t;}var e=this._sliceIntoSegments(t);var r=e[1][0];var o=t.slice(0,r);var n=t.slice(r);var s=o.concat(this._exifData.getBuffer());s=s.concat(n);return s;}},{key:"restoreJfifSegmentToImageData",value:function restoreJfifSegmentToImageData(t){if(!this._jfifData.isValid()){return t;}var e=this._sliceIntoSegments(t);var r=this._findSegment(yh.JFIF,e);var o=[];if(r){var n=r[0];var s=r[1];var a=t.slice(0,n);var l=t.slice(n,s);var c=t.slice(s);var u=new mw(l);u.setDensityX(this._jfifData.getDensityX());u.setDensityY(this._jfifData.getDensityY());u.setUnitDensity(this._jfifData.getUnitDensity());o=a.concat(l).concat(c);}else{return t;}return o;}},{key:"restoreExifTags",value:function restoreExifTags(t){var e=_En.fromDataURL(t);var r=this.restoreExifTagsToImageData(e);return _En.toDataURL(r);}},{key:"restoreJfifSegment",value:function restoreJfifSegment(t){if(!this._jfifData.isValid()){return t;}var e=_En.fromDataURL(t);var r=this.restoreJfifSegmentToImageData(e);return _En.toDataURL(r);}},{key:"setOrientation",value:function setOrientation(t){return this._exifData.setOrientation(t);}},{key:"_findSegment",value:function _findSegment(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._segments;for(var r=0;r0&&arguments[0]!==undefined?arguments[0]:this._segments;return t[t.length-1];}},{key:"_getMarkerBuffer",value:function _getMarkerBuffer(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._segments;var r=this._findSegment(t,e);if(r){var o=r[0];var n=r[1];return this._buf.slice(o,n);}return false;}},{key:"_sliceIntoSegments",value:function _sliceIntoSegments(t){var e=new hc(t);var r=[];while(e.getHead()=65280&&o<=65535){var n=e.readInt16();var s=e.getHead()+n-2;r.push([e.getHead()-4,s]);e.setHead(s);}else{throw new Error("Invalid marker: 0x".concat(o.toString(16)));}}this._stream.setHead(0);return r;}},{key:"getTags",value:function getTags(){return this._exifData.getTags();}},{key:"getTagData",value:function getTagData(){return this._exifData.getTagData();}},{key:"dispose",value:function dispose(){this._buf=[];this._segments=[];}}],[{key:"toDataURL",value:function toDataURL(t){return Gy+io.encode(t);}},{key:"fromDataURL",value:function fromDataURL(t){var e=t.replace(Gy,"");var r=io.decode(e);return r;}},{key:"isJPEG",value:function isJPEG(t){return wnt.test(t);}},{key:"bufferIsJPEG",value:function bufferIsJPEG(t){return t[0]===255&&t[1]===216&&t[2]===255;}},{key:"fromBase64String",value:function fromBase64String(t){var e=t.replace(Gy,"");var r=io.decode(e);return new _En(r);}}]);return En;}();_h=_En;});var oz,Xi;var Vy=d(function(){if(true){oz=typeof window!=="undefined"&&window.Image;}if(false){oz=null.Image;}Xi=oz;});var _jy,$y;var hw=d(function(){pc();Sd();_jy=/*#__PURE__*/function(_Vi5){_inherits(jy,_Vi5);var _super37=_createSuper(jy);function jy(){var _this68;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];_classCallCheck(this,jy);_this68=_super37.call(this);_this68._onOperationUpdate=_this68._onOperationUpdate.bind(_assertThisInitialized(_this68));_this68._cacheEnabled=true;_this68._stack=t;_this68._stack.forEach(function(e){e.on("update",_this68._onOperationUpdate);});return _this68;}_createClass(jy,[{key:"clear",value:function clear(){var _this69=this;this.forEach(function(t){return _this69.remove(t);});this._stack=[];}},{key:"hasChanges",value:function hasChanges(){return this._stack.filter(function(t){return!!t;}).some(function(t){return t.hasChanges();});}},{key:"_onOperationUpdate",value:function _onOperationUpdate(t,e){this.emit(Rd.OPERATION_UPDATED,t,e);}},{key:"enableCache",value:function enableCache(){this._cacheEnabled=true;}},{key:"disableCache",value:function disableCache(){this._cacheEnabled=false;}},{key:"forEach",value:function forEach(t){return this._stack.filter(function(e){return!!e;}).forEach(t);}},{key:"render",value:function render(t,e){var _this70=this;var r=e;var o=this._stack.filter(function(c){return!!c;}).filter(function(c){return c.getEnabled();});o.reverse();var n=o.filter(function(c){return!c.isDirtyForRenderer(t.getRenderer());})[0];var s=o.indexOf(n);o.reverse();var a=0;if(s!==-1){a=o.length-s-1;}for(var c=0;c0&&arguments[0]!==undefined?arguments[0]:false;this.forEach(function(e){return e.setDirty(true,t);});}},{key:"updateDirtinessForRenderer",value:function updateDirtinessForRenderer(t){var e=false;for(var r=0;r1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,gw);_this71=_super38.call(this,e,{enabled:{type:"boolean","default":true,serializable:false}});_this71._sdk=t;_this71._cacheEnabled=false;_this71._dirtiness={};_this71._sprite=new L.Sprite();_this71._container=new L.Container();_this71._container.addChild(_this71._sprite);return _this71;}_createClass(gw,[{key:"_onOptionsChange",value:function _onOptionsChange(){this.setDirty(true);}},{key:"render",value:function render(t){var _this72=this;if(!this.getEnabled()){Y.info(this.constructor.name,"Disabled - skipping");return Promise.resolve(t);}if(!this._renderTexture){var n=t.getDimensions().floor();this._renderTexture=new L.RenderTexture(this._sdk.getRenderer(),n.x,n.y);}var e=this._sdk.getRenderer();var r;var o;if(Y.canLog("info")){o=new Ky(this.constructor.name,"Rendering");}if(this.isDirtyForRenderer(e)){this._sprite.setTexture(t);var _n3=this.getNewDimensions(t.getDimensions()).floor();this._renderTexture.resizeTo(_n3);this._renderTexture.clear();r=this._render(t).then(function(){var s=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;_this72.setDirtyForRenderer(s,e);return _this72._renderTexture;});}else{Y.info(this.constructor.name,"Rendering from cache");r=Promise.resolve(this._renderTexture);}return r.then(function(n){if(o)o.stop();return n;});}},{key:"_render",value:function _render(t){var e;if(this._sdk.getRenderer().isOfType("webgl")){e=this._renderWebGL.bind(this);}else{e=this._renderCanvas.bind(this);}return e(t);}},{key:"_renderWebGL",value:function _renderWebGL(t){throw new Error("Operation#_renderWebGL is abstract and not implemented in inherited class.");}},{key:"_renderCanvas",value:function _renderCanvas(t){throw new Error("Operation#_renderCanvas is abstract and not implemented in inherited class.");}},{key:"getNewDimensions",value:function getNewDimensions(t){return t.clone();}},{key:"onBeforeExport",value:function onBeforeExport(){if(this.transform&&this._tempTransformChange){this.transform(this._tempTransformChange);}this._onBeforeExport();}},{key:"onAfterExport",value:function onAfterExport(){if(this.transform&&this._tempInverseTransformChange){this.transform(this._tempInverseTransformChange);}this._onAfterExport();}},{key:"_onBeforeExport",value:function _onBeforeExport(){}},{key:"_onAfterExport",value:function _onAfterExport(){}},{key:"setTemporaryTransformChange",value:function setTemporaryTransformChange(t,e){this._tempTransformChange=t;this._tempInverseTransformChange=e;}},{key:"reset",value:function reset(){this._dirty=true;this._glslPrograms={};}},{key:"isDirtyForRenderer",value:function isDirtyForRenderer(t){var e=this._dirtiness[t.id];return typeof e==="undefined"?true:e;}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;this._dirtiness[e.id]=t;}},{key:"setDirty",value:function setDirty(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;for(var r in this._dirtiness){this.setDirtyForRenderer(t,{id:r},e);}}},{key:"getSDK",value:function getSDK(){return this._sdk;}},{key:"getInputDimensions",value:function getInputDimensions(){var _this73=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var e=this._sdk.getInputDimensions();if(t){e.multiply(this._sdk.getZoom()).floor();}var r;this._sdk.getOperationsStack().forEach(function(o){if(r)return;if(o===_this73){r=true;return;}e=o.getNewDimensions(e);});return e.floor();}},{key:"clone",value:function clone(){var t=this.constructor;return new t(this._sdk,this.serializeOptions());}},{key:"disposeRenderTextures",value:function disposeRenderTextures(){if(this._renderTexture){this._renderTexture.dispose();}this._renderTexture=null;}},{key:"dispose",value:function dispose(){this.disposeRenderTextures();this._sprite.dispose();}}]);return gw;}(_t);gw.identifier=null;Lt=gw;});var Tnt,Xy,az;var lz=d(function(){pc();Bs();bw();Tnt=ir.OptionType;Xy=/*#__PURE__*/function(_Lt){_inherits(Xy,_Lt);var _super39=_createSuper(Xy);function Xy(){_classCallCheck(this,Xy);return _super39.apply(this,arguments);}_createClass(Xy,[{key:"getRotation",value:function getRotation(){var t=0;switch(this.getTags().Orientation){case 7:case 8:t=-90;break;case 3:case 4:t=-180;break;case 5:case 6:t=90;break;}return t;}},{key:"_getFlipVertically",value:function _getFlipVertically(){var _this$getTags=this.getTags(),t=_this$getTags.Orientation;return[5,7].indexOf(t)!==-1;}},{key:"_getFlipHorizontally",value:function _getFlipHorizontally(){var _this$getTags2=this.getTags(),t=_this$getTags2.Orientation;return[2,4].indexOf(t)!==-1;}},{key:"_getFinalOptions",value:function _getFinalOptions(){return{rotation:this.getRotation(),flipVertically:this._getFlipVertically(),flipHorizontally:this._getFlipHorizontally()};}},{key:"_render",value:function _render(t){var e=this._getFinalOptions();var r=e.rotation%360;var o=r*(Math.PI/180);this._sprite.setScale(e.flipHorizontally?-1:1,e.flipVertically?-1:1);this._sprite.setRotation(o);this._sprite.setAnchor(.5,.5);this._sprite.updateTransform();var n=this._sprite.getBounds();this._renderTexture.resizeTo(new _ot2(n.width,n.height));this._sprite.setPosition(this._renderTexture.getDimensions().divide(2));this._renderTexture.render(this._container);return Promise.resolve();}},{key:"getNewDimensions",value:function getNewDimensions(t){var e=this._getFinalOptions();t=t.clone();if(e.rotation%180){t.flip();}return t;}},{key:"applyTo",value:function applyTo(t){var e=this._getFinalOptions();var r=z.createCanvas();if(Math.abs(e.rotation%180)===90){r.width=t.height;r.height=t.width;}else{r.width=t.width;r.height=t.height;}var o=r.getContext("2d");var n=e.rotation*Math.PI/180;var s=.5*(r.width-t.width);var a=.5*(r.height-t.height);o.translate(s,a);o.translate(.5*t.width,.5*t.height);o.rotate(n);o.translate(-.5*t.width,-.5*t.height);if(e.flipVertically){o.translate(0,t.height);o.scale(1,-1);}if(e.flipHorizontally){o.translate(t.width,0);o.scale(-1,1);}o.drawImage(t,0,0);return r;}}]);return Xy;}(Lt);Xy.identifier="exif-orientation";Xy.prototype.availableOptions={tags:{type:Tnt.OBJECT,"default":{}}};az=Xy;});var Md={};de(Md,{ExifOrientationOperation:function ExifOrientationOperation(){return az;}});var yw=d(function(){lz();});var _w,cz;var uz=d(function(){To();Ar();gh();oc();kd();Vy();kn();_w=/*#__PURE__*/function(_t8){_inherits(_w,_t8);var _super40=_createSuper(_w);function _w(t){var _this74;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,_w);_this74=_super40.call(this,e);_this74._sdk=t;return _this74;}_createClass(_w,[{key:"export",value:function _export(){var _this75=this;var _this$_options3=this._options,t=_this$_options3.imageFormat,e=_this$_options3.transparent;var r=function r(o){if(!o.renderDone){return _this75._sdk.render().then(function(n){return r(n);});}return o;};return this.validateSettings().then(function(){return _this75._prepareSDK().then(function(o){return r(o);});}).then(function(o){var n=o.outputTexture,s=o.renderDone;var a=_this75._sdk.getRenderer();var l=a.getClearColor();if(t==="image/png"&&e){a.setClearColor(new G(0,0,0,0));}var c=a.getCanvas();if(a.isOfType("webgl")){c=_this75._createCanvasFromTexture(n);}a.setClearColor(l);return _this75._encodeImageFormat(c);}).then(function(o){return _this75._restoreExifMetadata(o,t);}).then(function(o){return _this75._restoreSDK().then(function(){return o;});});}},{key:"_restoreExifMetadata",value:function _restoreExifMetadata(t,e,r){if(e===ic.JPEG){var o=this._sdk.getExif();if(o){if(true){if(typeof t==="string"){t=o.restoreSegments(t);}}if(false){var n=this._options.renderType;if(n===Rr.BUFFER){t=Buffer.from(o.restoreSegmentsInArray(_toConsumableArray(t)));}else if(n===Rr.DATAURL&&typeof t==="string"){t=o.restoreSegments(t);}}}}return Promise.resolve(t);}},{key:"_encodeAsDataURL",value:function _encodeAsDataURL(t,e,r){if(z.isBrowser){var o=t.toDataURL(e,r);$t(t);return Promise.resolve(o);}try{var _o4=t.toDataURL(e,r);$t(t);return Promise.resolve(_o4);}catch(o){return Promise.error(o);}}},{key:"_encodeAsHTMLImage",value:function _encodeAsHTMLImage(t,e,r){return this._encodeAsDataURL(t,e,r).then(function(o){var n=new Xi();n.src=o;$t(t);return Promise.resolve(n);});}},{key:"_encodeAsBuffer",value:function _encodeAsBuffer(t,e,r){if(false){if(e===ic.JPEG){var o=t.toBuffer(e,{quality:r,progressive:true,chromaSubsampling:false});$t(t);return Promise.resolve(o);}if(e===ic.PNG){var _o5=t.toBuffer(e,{quality:r});$t(t);return Promise.resolve(_o5);}if(e===ic.RAW){var _o6=t.toBuffer(e);$t(_o6);return Promise.resolve(_o6);}return Promise.reject(new Error("Unsupported imageFormat: ".concat(e)));}return Promise.reject(new Error("Unsupported platform for RenderType"));}},{key:"_encodeAsMSBlob",value:function _encodeAsMSBlob(t,e,r){var o=t.msToBlob();$t(t);return Promise.resolve(o);}},{key:"_encodeAsBLOB",value:function _encodeAsBLOB(t,e,r){return new Promise(function(o,n){t.toBlob(function(s){o(s);},e,r);});}},{key:"_encodeImageFormat",value:function _encodeImageFormat(t){var _this$_options4=this._options,e=_this$_options4.imageFormat,r=_this$_options4.quality;var o=this._options.renderType;if(o===Rr.BLOB&&t.msToBlob&&!t.toBlob){o=Rr.MSBLOB;}switch(o){case Rr.IMAGE:{return this._encodeAsHTMLImage(t,e,r);}case Rr.DATAURL:{return this._encodeAsDataURL(t,e,r);}case Rr.BUFFER:{return this._encodeAsBuffer(t,e,r);}case Rr.MSBLOB:{return this._encodeAsMSBlob(t,e,r);}case Rr.BLOB:{return this._encodeAsBLOB(t,e,r);}}return Promise.reject(new Error("Unsupported RenderType: ".concat(o,"!")));}},{key:"_prepareSDK",value:function _prepareSDK(){var t=this._sdk.getRenderer();this._sdkSettings={dimensions:t.getDimensions().clone(),textureQuality:this._sdk.getTextureQuality(),rendererPixelRatio:t.getPixelRatio(),renderMode:this._sdk.getRenderMode()};this._sdk.setRenderMode("export");this._sdk.setTextureQuality(1);var e=t.isOfType("canvas");t.setPixelRatio(1);t.resizeTo(this._sdk.getFinalDimensions(),e);this._sdk.setAllOperationsToDirty(true);var r=this._sdk.getOperationsStack();r.forEach(function(o){o.disposeRenderTextures();});r.disableCache();return this._sdk.render();}},{key:"_restoreSDK",value:function _restoreSDK(){var t=this._sdk.getOperationsStack();t.enableCache();this._sdk.setRenderMode(this._sdkSettings.renderMode);var e=this._sdk.getRenderer();var r=e.isOfType("canvas");e.setPixelRatio(this._sdkSettings.rendererPixelRatio);e.resizeTo(this._sdkSettings.dimensions,r);this._sdk.setTextureQuality(this._sdkSettings.textureQuality);this._sdk.setAllOperationsToDirty(true);return this._sdk.render();}},{key:"_createCanvasFromTexture",value:function _createCanvasFromTexture(t){var e=this._sdk.getRenderer();var r=this._sdk.getFinalDimensions();var o=this._sdk.getRenderer().getContext();var n=o.createFramebuffer();o.bindFramebuffer(o.FRAMEBUFFER,n);var s=t.getBaseTexture().getGLTextureForRenderer(e);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,s,0);var a=new Uint8Array(r.x*r.y*4);o.readPixels(0,0,r.x,r.y,o.RGBA,o.UNSIGNED_BYTE,a);var l=this._checkPixelsForTransparency(a);var c;if(l){var h=new L.Sprite(t);h.setFilters([new L.Filters.UnpremultiplyFilter()]);var g=new L.Container();g.addChild(h);c=new L.RenderTexture(e,r.x,r.y);c.render(g);var x=c.getBaseTexture().getGLTextureForRenderer(e);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,x,0);o.readPixels(0,0,r.x,r.y,o.RGBA,o.UNSIGNED_BYTE,a);e.setRenderTarget();c.dispose();}var u=z.createCanvas();u.width=r.x;u.height=r.y;var m=u.getContext("2d");var p=m.createImageData(r.x,r.y);p.data.set(a);m.putImageData(p,0,0);o.deleteFramebuffer(n);return u;}},{key:"_checkPixelsForTransparency",value:function _checkPixelsForTransparency(t){var e=this._sdk.getFinalDimensions();var r=e.x*e.y*4;var o;for(var n=3;n1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,pz);_this76=_super41.call(this);q(_assertThisInitialized(_this76),"_onContextLost",function(){_this76.emit("context-lost");});q(_assertThisInitialized(_this76),"_initWatermark",function(){if(_this76._options.watermark&&_this76._options.watermark.watermarkURI){_this76._watermarkOperation=_this76.createOperation("watermark",{watermarkURI:_this76._options.watermark.watermarkURI,alignment:_this76._options.watermark.alignment,inset:_this76._options.watermark.inset,size:_this76._options.watermark.size,crossOrigin:_this76._options.crossOrigin});}});_this76._onOperationUpdate=_this76._onOperationUpdate.bind(_assertThisInitialized(_this76));_this76._onContextRestored=_this76._onContextRestored.bind(_assertThisInitialized(_this76));_this76.version="3.9.0";_this76[ye("VG04Z1lHRndhVXRsZVdBZ2IzQjBhVzl1SUdkcGRtVnU=")]=true;_this76._preferredRenderer=t;_this76._options=_objectSpread(_objectSpread({},e),{},{extensions:{},renderMode:"dynamic",versionCheck:true,displayWelcomeMessage:true,image:null,canvas:null,transparent:false,textureQuality:1,zoom:1,spriteScale:1,rotation:0,smoothDownscaling:false,smoothUpscaling:false,crossOrigin:"anonymous",logLevel:"warn",pixelRatio:Math.max(typeof window!=="undefined"&&window.devicePixelRatio||1,1)});if(_this76._options.smoothUpscaling){no.BaseTexture.DefaultMagFilter=no.BaseTexture.LinearFilter;}_this76._options.extensions=Object.assign(_this76._options.extensions,{operations:[],controls:[],languages:[]});Ns.setLevel(_this76._options.logLevel);_this76[ye("Wm5KbFpVeHBZMlZ1YzAxdlpHVT0=")]=false;if(!_this76[ye("X29wdGlvbnM=")][ye("bGljZW5zZQ==")]){_this76[ye("Wm5KbFpVeHBZMlZ1YzAxdlpHVT0=")]=true;_this76._l=new fh[ye("RnJlZUxpY2Vuc2VDaGVja2Vy")]();}else{var o=fh[ye("TGljZW5zZUNoZWNrZXI=")];_this76._l=new o(_this76[ye("X29wdGlvbnM=")][ye("bGljZW5zZQ==")]);_this76._cv(true).then(function(){_this76._ct();})["catch"](function(n){Ns.error(ye("TGljZW5zaW5n"),n.message);});}_this76._defaultRenderMode=_this76._options.renderMode;_this76._renderMode=_this76._options.renderMode;_this76._textureQuality=_this76._options.textureQuality;_this76._offset=new vw();_this76._zoom=_this76._options.zoom;_this76._spriteScale=_this76._options.spriteScale;_this76._rotation=_this76._options.rotation;_this76._operations={};_this76._operationsStack=null;_this76.setOperationsStack(new $y());_this76._container=new no.Container();_this76._sprite=new no.Sprite();_this76._container.addChild(_this76._sprite);_this76._inputTexture=_this76._options.inputTexture;_this76._currentInputTexture=null;_this76._currentTexture=null;_this76._resizedTexture=null;_this76._resizedContainer=new no.Container();_this76._resizedSprite=new no.Sprite();_this76._resizedContainer.addChild(_this76._resizedSprite);_this76._texturesToDispose=[];_this76.setSmoothDownscaling(_this76._options.smoothDownscaling);_this76._registerOperations();_this76._initRenderer();var r=_this76._renderer.constructor.type;if(_this76._options.displayWelcomeMessage){if(false){Ns.log("Version:","".concat(_this76.version," (").concat(r,") - https://img.ly/photo-sdk"));}}if(_this76[ye("Wm5KbFpVeHBZMlZ1YzAxdlpHVT0=")]){Ns.log(ye("VGhlIFBob3RvRWRpdG9yIFNESyBpcyBhIGNvbW1lcmNpYWwgcHJvZHVjdC4gQmVmb3JlIGJlaW5nIGFibGUgdG8gdXNlIGl0IHdpdGhvdXQgbGltaXRhdGlvbnMsIHlvdSBuZWVkIHRvIHVubG9jayB0aGUgU0RLIHdpdGggYSBsaWNlbnNlIGZpbGUuIFlvdSBjYW4gb2J0YWluIGEgdGltZS1saW1pdGVkIGV2YWx1YXRpb24gbGljZW5zZSBieSBzdGFydGluZyBhIHRyaWFsIGF0IGh0dHBzOi8vd3d3LmltZy5seS9zaWdudXAgb3IgeW91IGNhbiBwdXJjaGFzZSBhIGxpY2Vuc2UgYnkgcmVxdWVzdGluZyBhIHF1b3RlIGF0IGh0dHBzOi8vd3d3LmltZy5seS9wcmljaW5nLgoKQmVjYXVzZSB5b3UgZGlkIG5vdCBzcGVjaWZ5IGEgbGljZW5zZSBmaWxlIHlldCwgdGhlIFNESyB3aWxsIG5vdyBkaXNwbGF5IGEgd2F0ZXJtYXJrIGltYWdlIG9uIHRvcCBvZiBhbnkgcGhvdG9zIHlvdSBkaXNwbGF5IG9yIGV4cG9ydCB3aXRoIGl0LiBGb3IgaW5zdHJ1Y3Rpb25zIGZvciBob3cgdG8gdW5sb2NrIHRoZSBTREssIHBsZWFzZSB2aXNpdCBodHRwczovL2ltZy5seS9kb2NzL3Blc2RrL3dlYi9pbnRyb2R1Y3Rpb24vZ2V0dGluZ19zdGFydGVkLg=="));}if(_this76._options.image){_this76.setImage(_this76._options.image,_this76._options.exif);}return _this76;}_createClass(pz,[{key:"_ct",value:function _ct(){if(this._l.exp()){var t=this._l.isExp();if(t){Ns.error(ye("TGljZW5zaW5n"),ye("WW91ciB0cmlhbCBsaWNlbnNlIGhhcyBleHBpcmVkLiBQbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAaW1nLmx5Lg=="));}else{Ns.warn(ye("TGljZW5zaW5n"),ye("WW91ciB0cmlhbCBsaWNlbnNlIHdpbGwgZXhwaXJlIGluICVkIGRheXMu").replace("%d",this._l.dl()));}}}},{key:"_cv",value:function _cv(){var _this77=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this._l.c()["catch"](function(e){_this77[ye("VG04Z1lHRndhVXRsZVdBZ2IzQjBhVzl1SUdkcGRtVnU=")]=false;var r=ye("SW52YWxpZCBsaWNlbnNlLg==");if(t){if(e.code==="ELICEXP"){r=ye("WW91ciB0cmlhbCBsaWNlbnNlIGhhcyBleHBpcmVkLiBQbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAaW1nLmx5Lg==");}else if(e.code==="ELICINVHOST"){r=ye("VGhlIGJ1bmRsZSBpZGVudGlmaWVycyB0aGF0IHlvdSBzcGVjaWZpZWQgaW4geW91ciBsaWNlbnNlIGZpbGUgZG8gbm90IG1hdGNoIHRoZSBhcHAncyBidW5kbGUgaWRlbnRpZmllci4gUGxlYXNlIHVwZGF0ZSBhbmQgcmVkb3dubG9hZCB5b3VyIGxpY2Vuc2UgZnJvbSB5b3VyIGN1c3RvbWVyIGRhc2hib2FyZCBhdCBodHRwczovL3d3dy5pbWcubHkvbG9naW4u");}else if(e.code==="ELICINVPLAT"){r=ye("VGhlIGxpY2Vuc2UgdGhhdCB5b3Ugc3BlY2lmaWVkIGlzIGZvciBhbm90aGVyIHBsYXRmb3JtLiBQbGVhc2UgZG93bmxvYWQgeW91ciBsaWNlbnNlIGZvciB0aGUgd2ViIHBsYXRmb3JtIGZyb20geW91ciBjdXN0b21lciBkYXNoYm9hcmQgYXQgaHR0cHM6Ly93d3cuaW1nLmx5L2xvZ2luLg==");}else if(e.code==="ELICINVFMT"){r=ye("SW52YWxpZCBsaWNlbnNlIGZvcm1hdC4gUGxlYXNlIG1ha2Ugc3VyZSB5b3UncmUgcGFzc2luZyB5b3VyIGxpY2Vuc2UgYXMgYSBzdHJpbmcsIG5vdCBhcyBgJGZvcm1hdGAu").replace("$format",_typeof(_this77._options.license));}else if(e.code==="ELICINV"){r=ye("VGhlIHNpZ25hdHVyZSBvZiB5b3VyIGxpY2Vuc2UgaXMgbm90IHZhbGlkLiBQbGVhc2UgdHJ5IHRvIHJlZG93bmxvYWQgeW91ciBsaWNlbnNlIGZyb20geW91ciBjdXN0b21lciBkYXNoYm9hcmQgYXQgaHR0cHM6Ly93d3cuaW1nLmx5L2xvZ2luLg==");}else{r=ye("SW4gY2FzZSB5b3UgZG9uJ3QgaGF2ZSBhIGxpY2Vuc2UgeWV0LCBwbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAaW1nLmx5IHRvIG9idGFpbiBhIGxpY2Vuc2Ugb3IgbG9nIGluIHRvIHlvdXIgY3VzdG9tZXIgZGFzaGJvYXJkLg==");}}e.message=r;throw new Error(e);});}},{key:"_t",value:function _t(){this._l.t();}},{key:"_fl",value:function _fl(){return this[ye("Wm5KbFpVeHBZMlZ1YzAxdlpHVT0=")];}},{key:"_onOperationUpdate",value:function _onOperationUpdate(){for(var _len15=arguments.length,t=new Array(_len15),_key15=0;_key15<_len15;_key15++){t[_key15]=arguments[_key15];}this.emit.apply(this,[xw.OPERATION_UPDATED].concat(t));}},{key:"_onContextRestored",value:function _onContextRestored(){Ns.warn(this.constructor.name,"Trying to re-render after WebGL context has been restored.");this.setAllOperationsToDirty();this._operationsStack.forEach(function(t){t.disposeRenderTextures();});this.render();}},{key:"export",value:function _export(){var _this78=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Fnt.DATAURL;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Ont.PNG;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:.8;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;return this._cv(true).then(function(){if(_this78.hasChanges()&&!n){_this78._t();}_this78._operationsStack.forEach(function(a){a.onBeforeExport();});var s=new cz(_this78,{renderType:t,imageFormat:e,quality:r,transparent:o});return s["export"]().then(function(a){_this78._operationsStack.forEach(function(l){l.onAfterExport();});return Promise.resolve(a);});});}},{key:"render",value:function render(){var _this79=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(!this._inputTexture){throw new Error("You need to set an image before calling PhotoEditorSDK#render.");}var e=this._renderer.getContext();if(e.startFrame){e.startFrame();}var r;if(Ns.canLog("info")){r=new Ky("\u26A1\u26A1\u26A1","Frame rendering");}Ns.info("\u26A1\u26A1\u26A1","Rendering starts");var o=this._operationsStack;o.updateDirtinessForRenderer(this._renderer);return this._prepareTexture().then(function(n){if(_this79._renderMode==="export"){n=_this79._inputTexture;}_this79._currentTexture=n;_this79._sprite.setTexture(n);_this79._container.updateTransform();}).then(function(){return o.validateSettings();}).then(function(){if(_this79._fl()||!_this79[ye("VG04Z1lHRndhVXRsZVdBZ2IzQjBhVzl1SUdkcGRtVnU=")]){if(!o.getByIdentifier("license-watermark")){_this79.createOperation("license-watermark");}else{o.moveToTop("license-watermark");}}if(!o.getByIdentifier("watermark")){_this79._initWatermark();}else{o.moveToTop("watermark");}return o.render(_this79,_this79._currentTexture);}).then(function(n){var s=n.outputTexture;_this79._currentTexture=s;_this79._sprite.setTexture(_this79._currentTexture);switch(_this79._renderMode){case"dynamic":{var a=_this79._renderer.getDimensions().clone().divide(2).add(_this79._offset);_this79._container.setScale(_this79._zoom/_this79.getTextureScale(),_this79._zoom/_this79.getTextureScale());_this79._container.setPosition(a);_this79._sprite.setAnchor(.5,.5);_this79._sprite.setScale(_this79._spriteScale,_this79._spriteScale);_this79._sprite.setRotation(_this79._rotation);break;}case"export":_this79._container.setScale(1,1);_this79._container.setPosition(0,0);_this79._sprite.setAnchor(0,0);_this79._sprite.setPosition(0,0);_this79._sprite.setScale(_this79._spriteScale,_this79._spriteScale);_this79._sprite.setRotation(0);break;case"adapter":_this79._container.setScale(1,1);_this79._container.setPosition(0,0);_this79._sprite.setAnchor(0,0);_this79._sprite.setPosition(0,0);_this79._sprite.setScale(1,1);_this79._sprite.setRotation(0);break;}if(t){_this79._renderer.render(_this79._container);}return n;}).then(function(n){if(r){r.stop();}if(e.endFrame){e.endFrame();}_this79._disposeTextures();return n;});}},{key:"getTextureScale",value:function getTextureScale(){return Math.min(1,this._textureQuality*this._options.pixelRatio);}},{key:"_prepareTexture",value:function _prepareTexture(){var _this80=this;return new Promise(function(t,e){var r=_this80.getTextureScale();if(_this80._textureQuality===1){return t(_this80._inputTexture);}var o=_this80.getInputDimensions().multiply(r).floor();var n;if(!_this80._resizedTexture){_this80._resizedTexture=new no.RenderTexture(_this80._renderer,o.x,o.y);n=true;}else if(!_this80._resizedTexture.getDimensions().equals(o)){_this80._resizedTexture.resizeTo(o);n=true;}if(n){_this80._resizedSprite.setScale(r,r);_this80._resizedSprite.setTexture(_this80._inputTexture);_this80._resizedTexture.render(_this80._resizedContainer);}t(_this80._resizedTexture);});}},{key:"_registerOperations",value:function _registerOperations(){this._operations={};for(var t in Md){var e=Md[t];this._operations[e.identifier]=e;}this._operations=_objectSpread(_objectSpread({},this._operations),this._options.extensions.operations);}},{key:"registerOperations",value:function registerOperations(t){var _this81=this;t.forEach(function(e){_this81._operations[e.identifier]=e;});}},{key:"setAllOperationsToDirty",value:function setAllOperationsToDirty(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;this._operationsStack.setAllToDirty(t);}},{key:"createOperation",value:function createOperation(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var o=this._operations[t];if(!o){throw new Error("No operation with identifier `".concat(t,"` found."));}var n=new o(this,e);if(r){this.addOperation(n);}return n;}},{key:"addOperation",value:function addOperation(t){this._operationsStack.push(t);}},{key:"removeOperation",value:function removeOperation(t){this._operationsStack.remove(t);}},{key:"getInputDimensions",value:function getInputDimensions(){var t=this._inputTexture.getFrame();return new vw(t.width,t.height);}},{key:"getFinalDimensions",value:function getFinalDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.getInputDimensions();var r=this._operationsStack;r.forEach(function(o){if(!o.getEnabled())return;e=o.getNewDimensions(e);});if(t){e.multiply(this._spriteScale);}return e.floor();}},{key:"getOutputDimensions",value:function getOutputDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this.getFinalDimensions(t).clone().multiply(this._zoom).floor();}},{key:"getOutputTextureDimensions",value:function getOutputTextureDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.getTextureScale();var r=this.getInputDimensions().multiply(e).floor();this._operationsStack.forEach(function(o){r=o.getNewDimensions(r);});return r;}},{key:"getCrossOrigin",value:function getCrossOrigin(){return mz.getCrossOrigin(this._options.crossOrigin||"Anonymous");}},{key:"_initRenderer",value:function _initRenderer(){var t={canvas:this._options.canvas,pixelRatio:this._options.pixelRatio,debug:this._options.debug,transparent:this._options.transparent,clearColor:this._options.clearColor};var e;var r;if(this._renderMode!=="export"&&this._options.canvas){var o=this._options.canvas;e=o.width;r=o.height;}else if(this._inputTexture){var _o7=this.getFinalDimensions();e=_o7.x;r=_o7.y;}else{e=1;r=1;}switch(this._preferredRenderer){case dz.WEBGL:this._renderer=no.autoDetectRenderer(e,r,t);this._renderer.on("context-restored",this._onContextRestored);this._renderer.on("context-lost",this._onContextLost);break;case dz.CANVAS:this._renderer=no.canvasRenderer(e,r,t);this._renderer.on("context-restored",this._onContextRestored);break;default:Ns.warn("PhotoEditorSDK","PhotoEditorSDK Error: Renderer `".concat(this._preferredRenderer,"` not supported. Falling back to automatically detected renderer."));this._renderer=no.autoDetectRenderer(e,r,t);}}},{key:"resizeTo",value:function resizeTo(t){this._renderer.resizeTo(t,true);}},{key:"reset",value:function reset(){this._operationsStack.clear();}},{key:"parseExif",value:function parseExif(t){if(!t){return;}var e=t.src;var r=false;var o=null;if(true){r=_h.isJPEG(e);o=e;}else if(t instanceof Xi&&t.rawSource){var n=t.rawSource;if(!(t.rawSource instanceof Buffer)){var s=t.rawSource.replace("data:image/jpeg;base64,","");n=Buffer.from(s,"base64");e=t.rawSource;}else{e=t.rawSource.toString("base64");}r=_h.bufferIsJPEG(n);if(r){o=e;}}if(r){var _n4=null;try{_n4=_h.fromBase64String(o);}catch(s){}if(!_n4){return;}return _n4;}}},{key:"_handleExifOrientation",value:function _handleExifOrientation(){var t=this._exif.getTags();if(t&&t.Orientation){var e=t.Orientation!==1&&t.Orientation!==2;var r=[2,4,5,7].indexOf(t.Orientation)!==-1;if(e||r){if(typeof navigator==="undefined"){if(!this._exifOperation){this._exifOperation=this.createOperation("exif-orientation");}this._exifOperation.setTags(t);}else{var o=window&&window.navigator&&window.navigator.userAgent||"";if(!!o.match(/msie|trident/i)||o.indexOf("Edge")!==-1||!CSS.supports("image-orientation","from-image")){if(!this._exifOperation){this._exifOperation=this.createOperation("exif-orientation");}this._exifOperation.setTags(t);}}this._exif.setOrientation(1);}}}},{key:"correctExifOrientation",value:function correctExifOrientation(t){var e=this.parseExif(t);if(!e){return t;}var r=e.getTags();if(r&&r.Orientation){var o=r.Orientation!==1&&r.Orientation!==2;var n=[2,4,5,7].indexOf(r.Orientation)!==-1;if(o||n){if(typeof navigator==="undefined"){var s=this.createOperation("exif-orientation",{},false);s.setTags(r);t=s.applyTo(t);}else{var _s4=window&&window.navigator&&window.navigator.userAgent||"";if(!!_s4.match(/msie|trident/i)||_s4.indexOf("Edge")!==-1||!CSS.supports("image-orientation","from-image")){var a=this.createOperation("exif-orientation",{},false);a.setTags(r);t=a.applyTo(t);}}e.setOrientation(1);r.Orientation=1;return t;}}return t;}},{key:"hasImage",value:function hasImage(){return this._image!==null&&typeof this._image!=="undefined";}},{key:"getImage",value:function getImage(){return this._image;}},{key:"disposeTexture",value:function disposeTexture(t){this._texturesToDispose.push(t);}},{key:"_disposeTextures",value:function _disposeTextures(){for(var t=0;t1&&arguments[1]!==undefined?arguments[1]:null;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;this._disposeTextures();if(this._exifOperation){this.removeOperation(this._exifOperation);this._exifOperation=null;}this._options.image=t;this._image=t;this._exif=e||this.parseExif(t);if(this._exif){this._handleExifOrientation();}var o=new no.BaseTexture(this._image);var n=new knt(0,0,this._image.naturalWidth||this._image.width,this._image.naturalHeight||this._image.height);if(r){n.width=r.x;n.height=r.y;}if(this._resizedTexture){this._resizedTexture.dispose();}this._resizedTexture=null;if(this._inputTexture){this.disposeTexture(this._inputTexture.getBaseTexture());}this._inputTexture=new no.Texture(o,n);this._currentTexture=this._inputTexture;this._sprite.clearTexture(false);this._sprite.setTexture(this._inputTexture);this.emit("new-image");this.setAllOperationsToDirty(true);}},{key:"setInputTexture",value:function setInputTexture(t){this._inputTexture=t;}},{key:"getCanvas",value:function getCanvas(){return this._renderer.getCanvas();}},{key:"setCanvas",value:function setCanvas(t){this._renderer.setCanvas(t);}},{key:"getSprite",value:function getSprite(){return this._sprite;}},{key:"getContainer",value:function getContainer(){return this._container;}},{key:"getOperationsStack",value:function getOperationsStack(){return this._operationsStack;}},{key:"setOperationsStack",value:function setOperationsStack(t){if(this._operationsStack){this._operationsStack.off(xw.OPERATION_UPDATED,this._onOperationUpdate);}this._operationsStack=t;this._operationsStack.on(xw.OPERATION_UPDATED,this._onOperationUpdate);}},{key:"getOperations",value:function getOperations(){return this._operations;}},{key:"getRenderer",value:function getRenderer(){return this._renderer;}},{key:"getOffset",value:function getOffset(){return this._offset;}},{key:"setOffset",value:function setOffset(t,e){if(t instanceof vw){this._offset.copy(t);}else{this._offset.set(t,e);}}},{key:"getRenderMode",value:function getRenderMode(){return this._renderMode;}},{key:"setRenderMode",value:function setRenderMode(t){this._renderMode=t;}},{key:"getZoom",value:function getZoom(){return this._zoom;}},{key:"setZoom",value:function setZoom(t){this._zoom=t;this._container.setScale(this._zoom,this._zoom);this._container.updateTransform();}},{key:"getTextureQuality",value:function getTextureQuality(){if(this._renderMode==="export"){return 1;}return this._textureQuality;}},{key:"setTextureQuality",value:function setTextureQuality(t){if(t!==this._textureQuality){this.setAllOperationsToDirty(true);}this._textureQuality=Math.min(1,t);if(this._textureQuality===1&&this._resizedTexture){this._resizedTexture.dispose();this._resizedTexture=null;}}},{key:"getSpriteScale",value:function getSpriteScale(){return this._spriteScale;}},{key:"setSpriteScale",value:function setSpriteScale(t){this._spriteScale=t;this._sprite.setScale(t,t);this._sprite.updateTransform();}},{key:"getPixelRatio",value:function getPixelRatio(){return this._options.pixelRatio;}},{key:"getExif",value:function getExif(){return this._exif;}},{key:"getOptions",value:function getOptions(){return this._options;}},{key:"getInputTexture",value:function getInputTexture(){return this._inputTexture;}},{key:"setSmoothDownscaling",value:function setSmoothDownscaling(t){this._options.smoothDownscaling=t;this._sprite.setSmoothDownscaling(t);this._resizedSprite.setSmoothDownscaling(t);}},{key:"setRotation",value:function setRotation(t){this._rotation=t;}},{key:"getRotation",value:function getRotation(){return this._rotation;}},{key:"hasChanges",value:function hasChanges(){return this.getOperationsStack().hasChanges();}},{key:"dispose",value:function dispose(){this._operationsStack.dispose();this._renderer.dispose();if(this._exif){this._exif.dispose();}if(this._resizedTexture){this._resizedTexture.dispose();}}}]);return pz;}(Dnt);Te=pz;});var Rnt,ft;var xh=d(function(){zo();L4();Ar();gh();yd();oc();kd();Y3();Sd();pw();Vy();ow();lw();hw();kn();yw();bw();hz();Te.version="3.9.0";Te.Math=J;Te.Operations=Md;Te.Engine=L;Te.Color=G;Te.LicenseChecker=Uy;Te.Operation=Lt;Te.EventEmitter=Vi;Te.Utils=z;Te.Env=q3;Te.OperationsStack=$y;Te.EXIF=_h;Te.Image=Xi;Te.Configurable=_t;Te.Log=Y;Te.Loaders=I1;Te.RenderType=Rr;Te.ImageFormat=ic;Te.OptionType=K;Te.RendererType=Ke;Te.UniformType=le;Te.Base64=io;Rnt={};Te.UI=Rnt;ft=Te;});var $=d(function(){xh();xh();});var gz;var fz=d(function(){gz="precision highp float;\n\nvarying vec2 v_texCoord;\nuniform sampler2D u_image;\n\nuniform float u_gamma;\nuniform float u_shadows;\nuniform float u_highlights;\nuniform float u_whites;\nuniform float u_blacks;\n\nuniform mat4 u_colorMatrix;\nuniform vec4 u_colorOffset;\n\nconst float EPSILON = 0.0000001;\n\nfloat calculateLuminance(vec3 rgb) {\n // This is the luminance calculation part of the RGB to HSL formular.\n vec4 p = mix(\n vec4(rgb.gb, 0.0, -1.0 / 3.0),\n vec4(rgb.bg, -1.0, 2.0 / 3.0),\n vec4(rgb.g < rgb.b)\n );\n\n vec4 q = mix(\n vec4(rgb.r, p.yzx),\n vec4(p.xyw, rgb.r),\n vec4(rgb.r < p.x)\n );\n\n float croma = q.x - min(q.w, q.y);\n float luminance = q.x - croma * 0.5;\n return luminance;\n}\n\nvec3 map(vec3 x, float in_min, float in_max, float out_min, float out_max){\n return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;\n}\n\nvoid main() {\n\n vec4 color = clamp(texture2D(u_image, v_texCoord), 0.0, 1.0);\n color.rgb /= max(color.a, EPSILON); // Revert premultiplied alpha\n\n // Apply gamma\n if (u_gamma != 1.0) {\n color.rgb = pow(color.rgb, vec3(1.0 / max(u_gamma, EPSILON)));\n }\n\n // Apply shadows and highlights\n float luminance = calculateLuminance(color.rgb);\n\n float shadow = u_shadows >= 0.0\n ? clamp(\n pow(luminance, 1.0 / (u_shadows + 1.0))\n + pow(luminance, 2.0 / (u_shadows + 1.0)) * -0.76\n - luminance\n , 0.0, max(u_shadows, 1.0))\n : -clamp(\n pow(luminance, 1.0 / (-u_shadows + 1.0))\n + pow(luminance, 2.0 / (-u_shadows + 1.0)) * -0.76\n - luminance\n , 0.0, max(-u_shadows, 1.0));\n\n float highlight = u_highlights < 0.0\n ? clamp(\n 1.0\n - pow(1.0 - luminance, 1.0 / (1.0 - u_highlights))\n - pow(1.0 - luminance, 2.0 / (1.0 - u_highlights)) * -0.8\n - luminance\n , -1.0, 0.0)\n : -clamp(\n 1.0\n - pow(1.0 - luminance, 1.0 / (1.0 + u_highlights))\n - pow(1.0 - luminance, 2.0 / (1.0 + u_highlights)) * -0.8\n - luminance\n , -1.0, 0.0);\n\n // Bright color need more contrast and dark color need more brightness.\n // This is to keep saturatation because the color information of a dark colors is lost.\n float shadowContrast = shadow * luminance * luminance;\n float shadowBrightness = shadow - shadowContrast;\n\n float offset = luminance + shadowContrast + highlight;\n color.rgb = clamp(offset * ((color.rgb + shadowBrightness) / max(luminance, EPSILON)), 0.0, 1.0);\n \n // Apply Color Matrix\n color.rgb = clamp(color * u_colorMatrix + u_colorOffset, 0.0, 1.0).rgb;\n color.rgb = map(color.rgb, 0.0, 1.0, u_blacks / 2.0, 1.0 + u_whites / 2.0);\n color = clamp(color, 0.0, 1.0);\n color.rgb *= color.a; // Reset premultiplied alpha\n\n gl_FragColor = color;\n}\n";});function Cw(i,t,e,r,o){return(i-t)*(o-r)/(e-t)+r;}var Bnt,Ld,Pnt,Sw,qy;var ww=d(function(){$();fz();Bnt=J.ColorMatrix;Ld=1e-7;Pnt=function Pnt(i){var t=Math.max(i.r,i.g,i.b);var e=Math.min(i.r,i.g,i.b);return(t+e)/2;};Sw=/*#__PURE__*/function(_L$Filter){_inherits(Sw,_L$Filter);var _super42=_createSuper(Sw);function Sw(){var _this82;_classCallCheck(this,Sw);_this82=_super42.call(this);_this82._fragmentSource=gz;return _this82;}_createClass(Sw,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var _this$_options5=this._options,c=_this$_options5.colorMatrix,u=_this$_options5.gamma,m=_this$_options5.shadows,p=_this$_options5.highlights,h=_this$_options5.whites,g=_this$_options5.blacks;var x=u!==1;var v=m!==0||p!==0;var b=new G(0,0,0,0);for(var T=0;T=0?z.clamp(Math.pow(E,1/(m+1))+Math.pow(E,2/(m+1))*-.76-E,0,Math.max(m,1)):-z.clamp(Math.pow(E,1/(-m+1))+Math.pow(E,2/(-m+1))*-.76-E,0,Math.max(-m,1));var I=p<0?z.clamp(1-Math.pow(1-E,1/(1-p))-Math.pow(1-E,2/(1-p))*-.8-E,-1,0):-z.clamp(1-Math.pow(1-E,1/(1+p))-Math.pow(1-E,2/(1+p))*-.8-E,-1,0);var F=A*E*E;var Z=A-F;var et=E+F+I;b.r=z.clamp(et*((b.r+Z)/Math.max(E,Ld)),0,1);b.g=z.clamp(et*((b.g+Z)/Math.max(E,Ld)),0,1);b.b=z.clamp(et*((b.b+Z)/Math.max(E,Ld)),0,1);}b=c.apply(b).clamp(0,1);b.r=Cw(b.r,0,1,g/2,1+h/2);b.g=Cw(b.g,0,1,g/2,1+h/2);b.b=Cw(b.b,0,1,g/2,1+h/2);l.data[k]=b.r*255;l.data[k+1]=b.g*255;l.data[k+2]=b.b*255;}a.putImageData(l,0,0);}}]);return Sw;}(L.Filter);Sw.prototype.availableOptions={gamma:{type:"number","default":1,uniformType:"f"},shadows:{type:"number","default":0,uniformType:"f"},highlights:{type:"number","default":1,uniformType:"f"},whites:{type:"number","default":0,uniformType:"f"},blacks:{type:"number","default":0,uniformType:"f"},colorMatrix:{type:"color-matrix","default":new Bnt(),uniformType:"mat4"},colorOffset:{type:"array","default":[],uniformType:"4f"}};qy=Sw;});var yz;var bz=d(function(){yz="precision mediump float;\n\n// Input Image with config WRAP_S and WRAP_T: CLAMP_TO_EDGE\nuniform sampler2D u_image;\n\n// Size of one pixel == vec2(1.0 / u_image.width, 1.0 / u_image.height)\nuniform vec2 u_pixelDimension;\n\n// Range (-1.0 - 1.0)\nuniform float u_clarity;\n\nvarying vec2 v_texCoord;\n\nuniform mat4 u_colorMatrix;\nuniform vec4 u_colorOffset;\n\nconst float EPSILON = 0.000001;\n\nvec4 unpremultiply(vec4 col) {\n col.rgb /= max(col.a, EPSILON);\n return col;\n}\n\nvoid main() {\n vec4 color = texture2D(u_image, v_texCoord);\n color = unpremultiply(color);\n\n // L = Left, R = Right, C = Center, T = Top, B = Bottom\n vec4 colLB = texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x, -u_pixelDimension.y));\n vec4 colLC = texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x, 0.0));\n vec4 colLT = texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x, u_pixelDimension.y));\n\n vec4 colCL = texture2D(u_image, v_texCoord + vec2( 0.0, -u_pixelDimension.y));\n vec4 colCR = texture2D(u_image, v_texCoord + vec2( 0.0, u_pixelDimension.y));\n \n vec4 colRB = texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x, -u_pixelDimension.y));\n vec4 colRC = texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x, 0.0));\n vec4 colRT = texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x, u_pixelDimension.y));\n\n vec4 mergedColor = color;\n mergedColor.rgb += unpremultiply(colLB).rgb + unpremultiply(colLC).rgb + unpremultiply(colLT).rgb;\n mergedColor.rgb += unpremultiply(colCL).rgb + unpremultiply(colCR).rgb;\n mergedColor.rgb += unpremultiply(colRB).rgb + unpremultiply(colRC).rgb + unpremultiply(colRT).rgb;\n\n mergedColor /= 9.0;\n\n float grayValue = clamp(color.r * 0.3 + color.g * 0.59 + color.b * 0.1, 0.111111, 0.999999);\n // 1.0 and 0.0 result in white not black, therefore we clamp\n\n // Here we create a function that will map values below 0.1 to 0. Values above 0.2 will be mapped to 1,\n // and for values between 0.1 and 0.2 it will produce a gradient.\n // The funtion is mirror at 0.5, meaning values between 0.8 and 0.9 will result in a decending gradient.\n // And values above 0.9 will be mapped to 0.\n float frequenceFactor = min(smoothstep(1.0 - grayValue, 0.0, 0.11), smoothstep(grayValue, 0.0, 0.11));\n\n // here we apply the high pass filter. Its strength is determined by the uniform ,\n // and the frequence factor. That means the only the mid tones are affected by this filter.\n // Clarity input is ranging from -1 to 1. But we want to strengthen the effect.\n // Therefore we see this little magic number '3.7'.\n color.rgb = clamp(color + clamp((color - mergedColor) * u_clarity * 3.7 * frequenceFactor, 0.0, 10.0), 0.0, 1.0).rgb;\n\n // apply exposure but only to the mid tones.\n color.rgb = color.rgb * pow(2.0, u_clarity * 0.27 * frequenceFactor);\n\n // apply contrast and desaturation matrix\n color.rgb = clamp(color * u_colorMatrix + u_colorOffset, 0.0, 1.0).rgb;\n\n color.rgb *= color.a; // Premultiply alpha\n\n gl_FragColor = clamp(color, 0.0, 1.0);\n}\n";});var Lnt,znt,Tw,_z;var xz=d(function(){$();bz();Lnt=J.Vector2;znt=J.ColorMatrix;Tw=/*#__PURE__*/function(_L$Filter2){_inherits(Tw,_L$Filter2);var _super43=_createSuper(Tw);function Tw(){var _this83;_classCallCheck(this,Tw);_this83=_super43.call(this);_this83._fragmentSource=yz;return _this83;}_createClass(Tw,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=r.getContext();var s=e.getCanvas();var a=e.getContext();var l=this._options.clarity;var c=this._options.colorMatrix;var u=new G(this._options.colorOffset[0],this._options.colorOffset[1],this._options.colorOffset[2],this._options.colorOffset[3]);var m=s.width;var p=s.height;var h=a.getImageData(0,0,m,p);var g=n.createImageData(m,p);this.canvasShader(h,g,l,c,u);n.putImageData(g,0,0);}},{key:"canvasShader",value:function canvasShader(t,e,r,o,n){var s=function s(b,T,k){return Math.min(Math.max(b,T),k);};var a=function a(b,T,k){var E=s((k-b)/(T-b),0,1);return E*E*(3-2*E);};var l=t.width*4;var c=t.data.length;var u=c-1;var m=0;var p=t.data;var h=e.data;var g=new G();var x=255*9;var v=function v(b){b=bu?u:b;return p[b];};for(var b=0;b 0.0));\n vec4 sharpenedColor = mix(0.2, 5.0, float(u_sharpness > 0.0)) * color;\n \n sharpenedColor += factor * clamp(texture2D(u_image, v_texCoord + u_pixelDimension * vec2(-1.0, 0.0)), 0.0, 1.0);\n sharpenedColor += factor * clamp(texture2D(u_image, v_texCoord + u_pixelDimension * vec2( 0.0, -1.0)), 0.0, 1.0);\n sharpenedColor += factor * clamp(texture2D(u_image, v_texCoord + u_pixelDimension * vec2( 0.0, 1.0)), 0.0, 1.0);\n sharpenedColor += factor * clamp(texture2D(u_image, v_texCoord + u_pixelDimension * vec2( 1.0, 0.0)), 0.0, 1.0);\n \n color.rgb /= max(color.a, EPSILON); // unpremultiply\n sharpenedColor.rgb /= max(sharpenedColor.a, EPSILON); // unpremultiply\n \n sharpenedColor = clamp(sharpenedColor, 0.0, 1.0);\n \n color = clamp(mix(color, sharpenedColor, abs(u_sharpness)), 0.0, 1.0);\n \n gl_FragColor = vec4(color.rgb * color.a, color.a); // premultiply\n}";});var Nnt,kw,Sz;var wz=d(function(){$();vz();Nnt=J.Vector2;kw=/*#__PURE__*/function(_L$Filter3){_inherits(kw,_L$Filter3);var _super44=_createSuper(kw);function kw(){var _this84;_classCallCheck(this,kw);_this84=_super44.call(this);_this84._fragmentSource=Cz;return _this84;}_createClass(kw,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=r.getContext();var s=e.getCanvas();var a=e.getContext();var l=this._options.sharpness;var c=s.width;var u=s.height;var m=a.getImageData(0,0,c,u);var p=n.createImageData(c,u);this.canvasShader(m,p,l);n.putImageData(p,0,0);}},{key:"canvasShader",value:function canvasShader(t,e,r){var o=function o(E,A,I){return Math.min(Math.max(E,A),I);};var n=1e-6;var s=t.width;var a=t.height;var l=t.data;var c=e.data;var u=function u(E,A,I){return E*(1-I)+A*I;};var m=function m(E){return o(l[E]/255,0,1);};var p=function p(E,A){var I=o(E,0,s-1);var F=o(A,0,a-1);return 4*(I+s*F);};var h=[];var g=[];var x=[-1,0,0,1];var v=[0,-1,1,0];var b=r>0?-1:.2;var T=r>0?5:.2;var k=Math.abs(r);for(var E=0;E3&&arguments[3]!==undefined?arguments[3]:false;var n=r.getContext();var s=e.getCanvas();var a=e.getContext();var l=this._options.temperature;var c=s.width;var u=s.height;var m=a.getImageData(0,0,c,u);var p=n.createImageData(c,u);this.canvasShader(m,p,l);n.putImageData(p,0,0);}},{key:"canvasShader",value:function canvasShader(t,e,r){var o=function o(b,T,k){return Math.min(Math.max(b,T),k);};var n=function n(b,T,k){return b*(1-k)+T*k;};var s=function s(b,T){var k=b[0]*T[0]+b[3]*T[1]+b[6]*T[2];var E=b[1]*T[0]+b[4]*T[1]+b[7]*T[2];var A=b[2]*T[0]+b[5]*T[1]+b[8]*T[2];return[k,E,A];};var a=t.data.length;var l=a-1;var c=0;var u=t.data;var m=e.data;var p=function p(b){b=bl?l:b;return u[b];};var h=[.93,.54,0];var g=[.299,.587,.114,.596,-.274,-.322,.212,-.523,.311];var x=[1,.956,.621,1,-.272,-.647,1,-1.105,1.702];var v=0;for(var b=0;b0?this._options.contrast*2:this._options.contrast)+1));o.multiply(el.createBrightnessMatrix(this._options.brightness));this._filter.set({gamma:this._options.gamma,shadows:this._options.shadows,highlights:this._options.highlights,whites:this._options.whites,blacks:this._options.blacks,colorMatrix:o,colorOffset:o.getOffsets()});var n=[];if(this._options.clarity!==0){n.push(this._clarityFilter);}if(this._options.sharpness!==0){n.push(this._sharpnessFilter);}if(this._options.temperature!==0){n.push(this._temperatureFilter);}n.push(this._filter);this._sprite.setFilters(n);this._renderTexture.render(this._container);return Promise.resolve();}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(vh.prototype),"dispose",this).call(this);this._filter.dispose();this._clarityFilter.dispose();this._temperatureFilter.dispose();this._sharpnessFilter.dispose();}}]);return vh;}(Lt);vh.identifier="adjustments";vh.prototype.availableOptions={brightness:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},saturation:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},contrast:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},gamma:{type:"number","default":1,minValue:.5,midValue:1,maxValue:2},exposure:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},shadows:{type:"number","default":0,minValue:-2,midValue:0,maxValue:2},highlights:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},clarity:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},whites:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},blacks:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},temperature:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},sharpness:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1}};ft.Operations.AdjustmentsOperation=vh;Ez=vh;});var Rz;var Oz=d(function(){Rz="/*\n * Based on evanw's glfx.js tilt shift shader:\n * https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js\n * @license\n */\n\nuniform sampler2D u_image;\nuniform float u_blurRadius;\nuniform vec2 u_delta;\nuniform vec2 u_texSize;\nvarying vec2 v_texCoord;\n\nfloat random(vec2 co)\n{\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float dt = dot(co.xy,vec2(a,b));\n highp float sn = mod(dt, 3.14);\n return fract(sin(sn) * c);\n}\n\nvoid main() {\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(gl_FragCoord.xy / u_texSize.xy);\n float radius = u_blurRadius;\n\n const float steps = 30.0;\n\n for (float t = -steps; t <= steps; t++) {\n float percent = (t + offset - 0.5) / steps;\n float weight = 1.0 - abs(percent);\n\n // Somehow `sample` is a keyword in headless-gl\n vec4 _sample = texture2D(u_image, v_texCoord + u_delta * percent * radius / u_texSize);\n\n color += _sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n}\n";});var Yy,Dw,or;var zd=d(function(){$();Oz();Yy=J.Vector2;Dw=/*#__PURE__*/function(_L$Filter5){_inherits(Dw,_L$Filter5);var _super47=_createSuper(Dw);function Dw(){var _this87;_classCallCheck(this,Dw);for(var _len17=arguments.length,t=new Array(_len17),_key17=0;_key17<_len17;_key17++){t[_key17]=arguments[_key17];}_this87=_super47.call.apply(_super47,[this].concat(t));_this87._fragmentSource=Rz;_this87._lastBlurRadius=null;_this87._lastDimensions=new Yy(0,0);_this87._blurredRenderTarget=new L.CanvasRenderTarget(100,100,1);return _this87;}_createClass(Dw,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;if(this._options.blurQuality==="low"){this._renderLQBlur(t,e,r,o);return;}var s=e.getCanvas();var a=e.getContext();var l=r.getContext();if(this._lastBlurRadius===this._options.blurRadius){l.drawImage(s,0,0);}var c=a.getImageData(0,0,s.width,s.height);var u=l.getImageData(0,0,s.width,s.height);var m=this._options.blurRadius;var p=this._options.delta;var h=30;for(var g=0;g3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=r.getContext();var a=this._options.filteredCanvas;s.save();s.drawImage(n,0,0);s.globalAlpha=this._options.intensity;s.drawImage(a,0,0);s.restore();}}]);return Ew;}(L.Filter);Ew.prototype.availableOptions={filteredImage:{type:"number","default":1,uniformType:"i"},filteredCanvas:{type:"object","default":null},intensity:{type:"number","default":1,uniformType:"f"}};zz=/*#__PURE__*/function(){function zz(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;_classCallCheck(this,zz);this._intensity=t;this._stack=[];this._dirtiness={};this._renderTextures={};this._container=new L.Container();this._sprite=new L.Sprite();this._container.addChild(this._sprite);this._blendFilter=new Ew();}_createClass(zz,[{key:"push",value:function push(t){this._stack.push(t);}},{key:"clear",value:function clear(){this._stack=[];}},{key:"render",value:function render(t,e,r){if(this.isEmpty()){return Promise.resolve();}var o=t.getRenderer();this._sprite.setTexture(e);var n=this._renderTextures[o.id];if(!n){var l=t.getSprite().getTexture().getFrame();n=new L.RenderTexture(t.getRenderer(),l.width,l.height);this._renderTextures[o.id]=n;}var s=r.getDimensions();n.resizeTo(s);var a=this.isDirtyForRenderer(o);if(a){this._stack.forEach(function(c){c.update(t);});var _l2=this._stack.map(function(c){return c.getFilter();});this._sprite.setFilters(_l2);n.render(this._container);this.setDirtyForRenderer(false,o);}this._blendFilter.setIntensity(this._intensity);if(o.isOfType("canvas")){this._blendFilter.setFilteredCanvas(n.getRenderTarget().getCanvas());}else if(o.isOfType("webgl")){var _l3=n.getBaseTexture();_l3.setGLUnit(this._blendFilter.getFilteredImage());o.updateTexture(_l3,false);}this._sprite.setFilters([this._blendFilter]);r.clear(G.TRANSPARENT);r.render(this._container);if(a){this.disposeRenderTextures();}return Promise.resolve();}},{key:"setIntensity",value:function setIntensity(t){this._intensity=t;}},{key:"isEmpty",value:function isEmpty(){return this._stack.length===0;}},{key:"isDirtyForRenderer",value:function isDirtyForRenderer(t){if(!(t.id in this._dirtiness)){this._dirtiness[t.id]=true;}return this._dirtiness[t.id];}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e){this._dirtiness[e.id]=t;}},{key:"setDirty",value:function setDirty(t){for(var e in this._dirtiness){this._dirtiness[e]=t;}}},{key:"disposeRenderTextures",value:function disposeRenderTextures(){for(var t in this._renderTextures){this._renderTextures[t].dispose();delete this._renderTextures[t];}}},{key:"dispose",value:function dispose(){this.disposeRenderTextures();this._stack.forEach(function(t){return t.dispose();});this._stack=[];this._blendFilter.dispose();this._sprite.dispose();}}]);return zz;}();Fw=zz;});var Ud,dt;var Ht=d(function(){$();Uz();Ud=/*#__PURE__*/function(_t9){_inherits(Ud,_t9);var _super50=_createSuper(Ud);function Ud(){var _this90;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Ud);_this90=_super50.call(this,t,_objectSpread({intensity:{type:"number","default":1,setter:function setter(r){this._stack&&this._stack.setIntensity(r);return r;}},dirty:{type:"boolean","default":true}},e));_this90._stack=new Fw(_this90._options.intensity);return _this90;}_createClass(Ud,[{key:"render",value:function render(t,e,r){var _this91=this;return this._stack.render(t,e,r).then(function(o){_this91.setDirty(false);return o;});}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e){this._stack.setDirtyForRenderer(t,e);}},{key:"disposeRenderTextures",value:function disposeRenderTextures(){this._stack.disposeRenderTextures();}},{key:"dispose",value:function dispose(){this._stack.dispose();}}]);return Ud;}(_t);Ud.identifier=null;Ud.isIdentity=false;Ud.displayName=null;Ud.PrimitivesStack=Fw;dt=Ud;});var Hz;var Nz=d(function(){Hz="varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform float u_brightness;\n\nvoid main() {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4((texColor.rgb + vec3(u_brightness) * texColor.a), texColor.a);;\n}\n";});var Wz,ne;var ki=d(function(){$();Wz=/*#__PURE__*/function(_t10){_inherits(Wz,_t10);var _super51=_createSuper(Wz);function Wz(){_classCallCheck(this,Wz);return _super51.apply(this,arguments);}_createClass(Wz,[{key:"update",value:function update(){}},{key:"getFilter",value:function getFilter(){return this._filter;}},{key:"dispose",value:function dispose(){if(this._filter){this._filter.dispose();this._filter=null;}}}]);return Wz;}(_t);ne=Wz;});var Jy,Ow,fc;var Gz=d(function(){$();Nz();ki();Jy=/*#__PURE__*/function(_L$Filter7){_inherits(Jy,_L$Filter7);var _super52=_createSuper(Jy);function Jy(){var _this92;_classCallCheck(this,Jy);_this92=_super52.call(this);_this92._fragmentSource=Hz;return _this92;}_createClass(Jy,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.brightness;if(c===0){a.putImageData(l,0,0);return;}c*=255;for(var u=0;u3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.contrast;if(c===1){return;}for(var u=0;u3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.colorMatrix;var u=new G(0,0,0,0);for(var m=0;m3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=[.3,.59,.11];var u=this._options.desaturation;for(var m=0;m 0.0) {\n color.rgb = 1.0 - pow(1.0 - color.rgb, vec3(max(intensity + 1.0, EPSILON)));\n } else {\n color.rgb = pow(color.rgb, vec3(max(-intensity + 1.0, EPSILON)));\n }\n \n // Colorimetric (perceptual luminance-preserving) RGB to grayscale conversion\n // https://en.wikipedia.org/wiki/Grayscale#Colorimetric_(perceptual_luminance-preserving)_conversion_to_grayscale\n float luminance = dot(GRAYSCALE_WEIGHTS, color.rgb);\n \n // Apply DuoTone\n vec4 duotone = mix(dark, light, clamp(luminance, 0.0, 1.0));\n duotone.a *= color.a;\n \n duotone.rgb *= duotone.a;\n\n return duotone;\n}\n\nvoid main() {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor = duotoneKernel(texColor, u_lightColor, u_darkColor, u_intensity);\n}';});var i_,Pw,r_;var e8=d(function(){$();Qz();ki();i_=/*#__PURE__*/function(_L$Filter11){_inherits(i_,_L$Filter11);var _super60=_createSuper(i_);function i_(){var _this100;_classCallCheck(this,i_);_this100=_super60.call(this);_this100._fragmentSource=t8;return _this100;}_createClass(i_,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var _this$_options6=this._options,c=_this$_options6.lightColor,u=_this$_options6.darkColor,m=_this$_options6.intensity;for(var p=0;p0){var c=Math.max(o+1,n);t.r=1-Math.pow(1-t.r,c);t.g=1-Math.pow(1-t.g,c);t.b=1-Math.pow(1-t.b,c);}else{var _c4=Math.max(-o+1,n);t.r=Math.pow(t.r,_c4);t.g=Math.pow(t.g,_c4);t.b=Math.pow(t.b,_c4);}var s=.2126*t.r+.7152*t.g+.0722*t.b;var a=Math.min(Math.max(s,0),1);var l=r.clone().mix(e,a);l.a*=t.a;return l;}}]);return i_;}(L.Filter);i_.prototype.availableOptions={lightColor:{type:"color","default":G.RED,uniformType:"4f"},darkColor:{type:"color","default":G.BLACK,uniformType:"4f"},intensity:{type:"number","default":.5,uniformType:"f"}};Pw=/*#__PURE__*/function(_ne6){_inherits(Pw,_ne6);var _super61=_createSuper(Pw);function Pw(){var _this101;_classCallCheck(this,Pw);for(var _len23=arguments.length,t=new Array(_len23),_key23=0;_key23<_len23;_key23++){t[_key23]=arguments[_key23];}_this101=_super61.call.apply(_super61,[this].concat(t));_this101._filter=new i_();return _this101;}_createClass(Pw,[{key:"update",value:function update(){this._filter.setLightColor(this._options.lightColor);this._filter.setDarkColor(this._options.darkColor);var t=2*this._options.intensity-1;this._filter.setIntensity(t);}}]);return Pw;}(ne);Pw.prototype.availableOptions=i_.prototype.availableOptions;r_=Pw;});var r8;var i8=d(function(){r8="varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform vec3 u_gamma;\n\nvoid main() {\n vec4 texColor = texture2D(u_image, v_texCoord);\n vec3 rgb = vec3(texColor.r, texColor.g, texColor.b);\n rgb = pow(rgb, u_gamma);\n gl_FragColor = vec4(rgb * texColor.a, texColor.a);;\n}\n";});var o_,Mw,n_;var o8=d(function(){$();i8();ki();o_=/*#__PURE__*/function(_L$Filter12){_inherits(o_,_L$Filter12);var _super62=_createSuper(o_);function o_(){var _this102;_classCallCheck(this,o_);_this102=_super62.call(this);_this102._fragmentSource=r8;return _this102;}_createClass(o_,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.gamma;var u=new Float32Array(256);for(var h=0;h<256;h++){u[h]=255*Math.pow(h/255,c.r);}var m=new Float32Array(256);for(var _h4=0;_h4<256;_h4++){m[_h4]=255*Math.pow(_h4/255,c.g);}var p=new Float32Array(256);for(var _h5=0;_h5<256;_h5++){p[_h5]=255*Math.pow(_h5/255,c.b);}for(var _h6=0;_h63&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.color;var u;for(var m=0;m3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);for(var c=0;c3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);for(var c=0;c3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.lookupTableData;for(var u=0;u3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=this._options.lookupTableImage;var c=this._createImageCanvas(l);var u=c.getContext("2d");var m=s.getImageData(0,0,n.width,n.height);var p=u.getImageData(0,0,l.width,l.height);var h=new S8();for(var g=0;g3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.saturation;for(var u=0;u3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);for(var c=0;ca[0];});var e=this._getSplineCurve(t);var r=e[0];var o;if(r[0]>0){for(o=0;os[1]){l=-l;}n.push(l);}return n;}},{key:"_getSplineCurve",value:function _getSplineCurve(t){var e=this._secondDerivative(t);var r=e.length;var o=[];var n;for(n=0;n255){g=255;}else if(g<0){g=0;}s.push([c,g]);}}if(s.length===255){s.push(t[t.length-1]);}return s;}},{key:"_secondDerivative",value:function _secondDerivative(t){var e=t.length;if(e<=0||e===1){return null;}var r=[];var o=[];var n;var s;r[0]=[0,1,0];for(n=1;n0;n--){s=r[n][2]/r[n+1][1];r[n][1]-=s*r[n+1][0];r[n][2]=0;o[n]-=s*o[n+1];}var a=[];for(n=0;n3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);for(var c=0;c3&&arguments[3]!==undefined?arguments[3]:false;var _this$_options7=this._options,n=_this$_options7.resolution,s=_this$_options7.horizontalTileCount,a=_this$_options7.verticalTileCount;var l=e.getCanvas();var c=e.getContext();var u=r.getContext();var m=this._options.lookupTableImage;var p=this._createImageCanvas(m);var h=p.getContext("2d");var g={width:128,height:128};if(n){g={width:n,height:n};}else if(m.width&&m.height){g={width:m.width,height:m.height};}var x=c.getImageData(0,0,l.width,l.height);var v=h.getImageData(0,0,g.width,g.height);var b=new N8(g.width/s-1|0,g.height/a-1|0,s*a-1|0);var T=new G();var k=new G();var E=new G();var A=new G();var I=new G();var F=new G();var Z=new G();var et=new G();var pt=new h_();var yt=new h_();var bt=function bt(St,fe,se,ee){St.r=fe.r*(1-ee)+se.r*ee;St.g=fe.g*(1-ee)+se.g*ee;St.b=fe.b*(1-ee)+se.b*ee;};var ht=function ht(St,fe,se){fe=.5+fe|0;se=.5+se|0;var ee=(se*g.width+fe)*4;St.r=v.data[ee]/255;St.g=v.data[ee+1]/255;St.b=v.data[ee+2]/255;St.a=v.data[ee+3]/255;};var Qt=new G();var gi=new G();var ii=function ii(St,fe,se,ee,Et,ae,ui){bt(Qt,fe,ee,ae);bt(gi,se,Et,ae);bt(St,Qt,gi,ui);};var Xr=new h_(g.width,g.height).divide(s,a).floor();for(var St=0;St2&&arguments[2]!==undefined?arguments[2]:0;var o=t.getDimensions();var n=this._layoutMode==="vertical-inside";var s=this._spriteGroups[e].start;var a=this._spriteGroups[e].mid;var l=this._spriteGroups[e].end;var c=0;var u=0;var m;var p;if(s){m=s.getTexture().getDimensions();p=m.y/m.x;c=Math.floor(this._frameWidth/p);var h=new Wd(0,r);h.x=n?this._frameWidth:0;s.setPosition(h);s.setHeight(this._frameWidth);s.setWidth(c);}if(l){m=l.getTexture().getDimensions();p=m.y/m.x;u=Math.floor(this._frameWidth*p);var _h7=new Wd(o.x-u,r);_h7.x-=n?this._frameWidth:0;l.setPosition(_h7);l.setHeight(this._frameWidth);l.setWidth(u);}if(a){m=a.getTexture().getDimensions();p=m.y/m.x;var _h8=new Wd(c,r);var g=o.x-c-u;if(n){_h8.x+=this._frameWidth;g-=this._frameWidth*2;}a.setPosition(_h8);a.setWidth(g);a.setHeight(this._frameWidth);if(false){a._canvasSmoothingEnabled=false;}if(this._options.frame.imageGroups[e].mid.mode==="repeat"){var x=this._frameWidth/p;var v=Math.ceil(g/x);var b=0;if(v!==-1){var T=Math.round(g/v);a.setWidth(T);b+=T;this._ensureRepeatSpritesExist(v-1,e,a);for(var k=0;ko){var n=t-o;for(var s=0;s2&&arguments[2]!==undefined?arguments[2]:0;var o=t.getDimensions();var n=this._layoutMode==="horizontal-inside";var s=this._spriteGroups[e].start;var a=this._spriteGroups[e].mid;var l=this._spriteGroups[e].end;var c=0;var u=0;var m;var p;if(s){m=s.getTexture().getDimensions();p=m.y/m.x;c=Math.floor(this._frameWidth*p);var h=new Wd(r,0);h.y=n?this._frameWidth:0;s.setPosition(h);s.setWidth(this._frameWidth);s.setHeight(c);}if(l){m=l.getTexture().getDimensions();p=m.y/m.x;u=Math.floor(this._frameWidth*p);var _h9=new Wd(r,o.y-u);_h9.y-=n?this._frameWidth:0;l.setPosition(_h9);l.setWidth(this._frameWidth);l.setHeight(u);}if(a){m=a.getTexture().getDimensions();p=m.y/m.x;var _h10=new Wd(r,c);var g=o.y-c-u;if(n){_h10.y+=this._frameWidth;g-=this._frameWidth*2;}a.setPosition(_h10);a.setHeight(g);a.setWidth(this._frameWidth);if(false){a._canvasSmoothingEnabled=false;}if(this._options.frame.imageGroups[e].mid.mode==="repeat"){var x=this._frameWidth*p;var v=Math.ceil(g/x);var b=0;if(v!==-1){var T=Math.round(g/v);a.setHeight(T);b+=T;this._ensureRepeatSpritesExist(v-1,e,a);for(var k=0;k 0.8) {\n gl_FragColor = mix(color, watermarkColor, 0.3);\n } else {\n gl_FragColor = color;\n }\n}\n";});var v_;var u9=d(function(){$();l9();v_=/*#__PURE__*/function(_L$Filter22){_inherits(v_,_L$Filter22);var _super119=_createSuper(v_);function v_(){var _this161;_classCallCheck(this,v_);for(var _len71=arguments.length,t=new Array(_len71),_key71=0;_key71<_len71;_key71++){t[_key71]=arguments[_key71];}_this161=_super119.call.apply(_super119,[this].concat(t));_this161._fragmentSource=c9;return _this161;}_createClass(v_,[{key:"_applyWebGL",value:function _applyWebGL(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=t.getContext();var s=n.canvas;var a=this.getShaderForRenderer(t);var l=e.getFrame();var c=this._watermarkCanvas;if(!c||l.width!==c.width||l.height!==c.height){this._createWatermarkCanvas(l.width,l.height);}var u=L.Texture.fromCanvas(this._watermarkCanvas);var m=u.getBaseTexture();t.updateTexture(m);m.setGLUnit(1);t.setRenderTarget(r);if(o){r.clear();}t.setShader(a);var p=t.getCurrentRenderTarget().getProjectionMatrix().toArray();a.setUniform("u_projMatrix",p);a.syncUniforms();n.uniform1i(n.getUniformLocation(a.getProgram(),"u_watermarkTex"),1);n.activeTexture(n.TEXTURE0);n.bindTexture(n.TEXTURE_2D,e.getTexture());n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,m.getGLTextureForRenderer(t));n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);u.dispose();}},{key:"_createWatermarkCanvas",value:function _createWatermarkCanvas(t,e){var r=this._options.watermarkImage;var o=z.createCanvas();o.width=t;o.height=e;var n=o.getContext("2d");var s=n.createPattern(r,"repeat");n.fillStyle=s;n.fillRect(0,0,o.width,o.height);this._watermarkCanvas=o;this._watermarkContext=n;}},{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=this._options.watermarkImage;this._createWatermarkCanvas(n.width,n.height);var c=s.getImageData(0,0,n.width,n.height);var u=this._watermarkContext.getImageData(0,0,n.width,n.height);var m=new G();var p=new G();var h=new G();for(var g=0;g.8){h.copy(m.clone().mix(p,.3));}else{h.copy(m);}c.data[g]=h.r*255;c.data[g+1]=h.g*255;c.data[g+2]=h.b*255;c.data[g+3]=h.a*255;}a.putImageData(c,0,0);}}]);return v_;}(L.Filter);v_.prototype.availableOptions={watermarkImage:{type:"object",required:true}};});var wh,d9;var m9=d(function(){$();a9();u9();wh=/*#__PURE__*/function(_Lt7){_inherits(wh,_Lt7);var _super120=_createSuper(wh);function wh(){var _this162;_classCallCheck(this,wh);for(var _len72=arguments.length,t=new Array(_len72),_key72=0;_key72<_len72;_key72++){t[_key72]=arguments[_key72];}_this162=_super120.call.apply(_super120,[this].concat(t));q(_assertThisInitialized(_this162),"_applyWatermarkFilter",function(){if(!_this162._watermarkFilter){_this162._watermarkFilter=new v_({watermarkImage:_this162._watermarkImage});}_this162._sprite.setFilters([_this162._watermarkFilter]);_this162._renderTexture.render(_this162._container);return Promise.resolve();});q(_assertThisInitialized(_this162),"_loadWatermarkImage",function(){if(!_this162._watermarkImage){return new Promise(function(t,e){_this162._watermarkImage=new Xi();_this162._watermarkImage.onload=t;_this162._watermarkImage.src=s9;});}return Promise.resolve();});_this162._watermarkFilter=null;_this162._watermarkImage=null;return _this162;}_createClass(wh,[{key:"_render",value:function _render(t){return this._loadWatermarkImage().then(this._applyWatermarkFilter);}},{key:"dispose",value:function dispose(){if(this._watermarkFilter){this._watermarkFilter.dispose();}_get(_getPrototypeOf(wh.prototype),"dispose",this).call(this);}}]);return wh;}(Lt);wh.identifier="license-watermark";wh.prototype.availableOptions={};ft.Operations.LicenseWatermarkOperation=wh;d9=wh;});var h9;var p9=d(function(){h9="/*!\n * Based on evanw's glfx.js tilt shift shader:\n * https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js\n */\n\nuniform sampler2D u_image;\nuniform float u_blurRadius;\nuniform vec2 u_controlPoint1;\nuniform vec2 u_controlPoint2;\nuniform vec2 u_delta;\nuniform vec2 u_texSize;\nvarying vec2 v_texCoord;\n\nfloat random(vec2 co)\n{\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float dt = dot(co.xy,vec2(a,b));\n highp float sn = mod(dt, 3.14);\n return fract(sin(sn) * c);\n}\n\nvoid main() {\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n vec2 vector = u_controlPoint2 - u_controlPoint1;\n float offset = random(gl_FragCoord.xy / u_texSize.xy);\n\n float radius = smoothstep(0.0, 1.0,\n abs(\n clamp(dot(v_texCoord - u_controlPoint1, vector) / dot(vector, vector), 0.0, 1.0)\n )\n ) * u_blurRadius;\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 _sample = texture2D(u_image, v_texCoord + u_delta * percent * radius / u_texSize);\n\n color += _sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n}\n";});var Hs,wT,C_;var f9=d(function(){$();zd();p9();Hs=J.Vector2;wT=/*#__PURE__*/function(_L$Filter23){_inherits(wT,_L$Filter23);var _super121=_createSuper(wT);function wT(){var _this163;_classCallCheck(this,wT);for(var _len73=arguments.length,t=new Array(_len73),_key73=0;_key73<_len73;_key73++){t[_key73]=arguments[_key73];}_this163=_super121.call.apply(_super121,[this].concat(t));_this163._fragmentSource=h9;_this163._lastBlurRadius=null;_this163._lastControlPoint1=new Hs();_this163._lastControlPoint2=new Hs();_this163._blurFilter=new or();_this163._blurredRenderTarget=new L.CanvasRenderTarget(100,100,1);_this163._maskRenderTarget=new L.CanvasRenderTarget(100,100,1);return _this163;}_createClass(wT,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var _this164=this;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(this._options.blurQuality==="low"){this._renderLQBlur(t,e,r,o);return;}var n=e.getDimensions();var s=!r.getDimensions().equals(n);var a=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){var l=new Hs(this._options.delta.x,this._options.delta.y);this._blurFilter.setDelta(l);var c={blurRadius:this._options.blurRadius,texSize:n};var u=function u(x,v,b){return Math.min(Math.max(x,v),b);};var m=function m(x,v,b){var T=u((b-x)/(v-x),0,1);return T*T*(3-2*T);};var p=this._options.controlPoint2.clone().subtract(this._options.controlPoint1.clone());var h=this._options.blurRadius;var g=function g(x,v){return m(0,1,Math.abs(u(new Hs(x,v).subtract(_this164._options.controlPoint1).dot(p)/p.dot(p),0,1)))*h;};this._blurFilter.set(c);this._blurFilter._applyCanvas(t,e,r,o,g);this._lastBlurRadius=this._options.blurRadius;}}},{key:"_renderLQBlur",value:function _renderLQBlur(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getDimensions();var s=!this._blurredRenderTarget.getDimensions().equals(n);this._blurredRenderTarget.setPixelRatio(e.getPixelRatio());this._blurredRenderTarget.resizeTo(e.getDimensions());this._maskRenderTarget.setPixelRatio(e.getPixelRatio());this._maskRenderTarget.resizeTo(e.getDimensions());var a=!this._lastControlPoint1.equals(this._options.controlPoint1)||!this._lastControlPoint2.equals(this._options.controlPoint2)||s;var l=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){this._renderMask();this._lastControlPoint1=this._options.controlPoint1.clone();this._lastControlPoint2=this._options.controlPoint2.clone();}if(l){this._blurImage(e,this._blurredRenderTarget,this._options.blurRadius);this._lastBlurRadius=this._options.blurRadius;}this._applyMask(e,r);}},{key:"_renderMask",value:function _renderMask(){var t=this._maskRenderTarget.getCanvas();var e=this._maskRenderTarget.getContext();var r=new Hs(t.width,t.height);var o=this._options.controlPoint1.clone().multiply(r);var n=this._options.controlPoint2.clone().multiply(r);var s=e.createLinearGradient(o.x,o.y,n.x,n.y);s.addColorStop(0,"#FFFFFF");s.addColorStop(1,"#000000");e.fillStyle=s;e.fillRect(0,0,t.width,t.height);}},{key:"_applyMask",value:function _applyMask(t,e){var r=e.getContext();var o=t.getCanvas();var n=t.getContext();var s=this._blurredRenderTarget.getContext();var a=this._maskRenderTarget.getContext();var l=n.getImageData(0,0,o.width,o.height);var c=l.data;var u=s.getImageData(0,0,o.width,o.height).data;var m=a.getImageData(0,0,o.width,o.height).data;var p;for(var h=0;h3&&arguments[3]!==undefined?arguments[3]:false;if(this._options.blurQuality==="low"){this._renderLQBlur(t,e,r,o);return;}var n=e.getDimensions();var s=!r.getDimensions().equals(n);var a=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){var l=new Ws(this._options.delta.x,this._options.delta.y);this._blurFilter.setDelta(l);var c={blurRadius:this._options.blurRadius,texSize:n};var u=function u(E,A,I){return Math.min(Math.max(E,A),I);};var m=function m(E,A,I){var F=u((I-E)/(A-E),0,1);return F*F*(3-2*F);};var _this$_options12=this._options,p=_this$_options12.blurRadius,h=_this$_options12.gradientSize,g=_this$_options12.size,x=_this$_options12.start,v=_this$_options12.end,b=_this$_options12.texSize;var T=new Ws(x.y-v.y,v.x-x.x);T.divide(T.len());var k=function k(E,A){return m(0,1,(Math.abs(b.clone().multiply(E,A).subtract(x).dot(T))-g)/h)*p;};this._blurFilter.set(c);this._blurFilter._applyCanvas(t,e,r,o,k);this._lastBlurRadius=this._options.blurRadius;}}},{key:"_renderLQBlur",value:function _renderLQBlur(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getDimensions();var s=!this._blurredRenderTarget.getDimensions().equals(n);this._blurredRenderTarget.setPixelRatio(e.getPixelRatio());this._blurredRenderTarget.resizeTo(e.getDimensions());this._maskRenderTarget.setPixelRatio(e.getPixelRatio());this._maskRenderTarget.resizeTo(e.getDimensions());var a=!this._lastStart.equals(this._options.start)||!this._lastEnd.equals(this._options.end)||this._lastGradientRadius!==this._options.size||s;var l=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){this._renderMask();this._lastStart=this._options.start.clone();this._lastEnd=this._options.end.clone();this._lastGradientRadius=this._options.size;}if(l){this._blurImage(e,this._blurredRenderTarget,this._options.blurRadius);this._lastBlurRadius=this._options.blurRadius;}this._applyMask(e,r);}},{key:"_renderMask",value:function _renderMask(){var t=this._maskRenderTarget.getCanvas();var e=this._maskRenderTarget.getContext();var r=this._maskRenderTarget.getPixelRatio();var o=new Ws(t.width,t.height);var n=this._options.size*o.min()*r;var s=this._options.gradientSize*o.min()*r;var a=this._options.start.clone().multiply(o);var l=this._options.end.clone().multiply(o);var c=l.clone().subtract(a);var u=a.clone().add(c.clone().divide(2));var m=c.len();var p=c.clone().divide(m);var h=u.clone().add((n+s)*p.y,-(n+s)*p.x);var g=u.clone().add(-(n+s)*p.y,(n+s)*p.x);var x=e.createLinearGradient(h.x,h.y,g.x,g.y);var v=g.clone().subtract(h).len();x.addColorStop(0,"#000000");x.addColorStop(s/2/v,"#FFFFFF");x.addColorStop(1-s/2/v,"#FFFFFF");x.addColorStop(1,"#000000");e.fillStyle=x;e.fillRect(0,0,t.width,t.height);}},{key:"_applyMask",value:function _applyMask(t,e){var r=e.getContext();var o=t.getCanvas();var n=t.getContext();var s=this._blurredRenderTarget.getContext();var a=this._maskRenderTarget.getContext();var l=n.getImageData(0,0,o.width,o.height);var c=l.data;var u=s.getImageData(0,0,o.width,o.height).data;var m=a.getImageData(0,0,o.width,o.height).data;var p;for(var h=0;h3&&arguments[3]!==undefined?arguments[3]:false;if(this._options.blurQuality==="low"){this._renderLQBlur(t,e,r,o);return;}var n=e.getDimensions();var s=!r.getDimensions().equals(n);var _this$_options18=this._options,a=_this$_options18.blurRadius,l=_this$_options18.position,c=_this$_options18.texSize,u=_this$_options18.gradientRadius;var m=e.getBaseTexture().isDirty()||this._lastBlurRadius!==a||s;if(m){var p=new jd(this._options.delta.x,this._options.delta.y);this._blurFilter.setDelta(p);var h={blurRadius:a,texSize:n};var g=function g(b,T,k){return Math.min(Math.max(b,T),k);};var x=function x(b,T,k){var E=g((k-b)/(T-b),0,1);return E*E*(3-2*E);};var v=function v(b,T){return x(0,1,(Math.abs(c.clone().multiply(b,T).subtract(l).len())-_this173._options.radius)/(u*2))*a;};this._blurFilter.set(h);this._blurFilter._applyCanvas(t,e,r,o,v);this._lastBlurRadius=a;}}},{key:"_renderLQBlur",value:function _renderLQBlur(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getDimensions();var s=!this._blurredRenderTarget.getDimensions().equals(n);this._blurredRenderTarget.setPixelRatio(e.getPixelRatio());this._blurredRenderTarget.resizeTo(e.getDimensions());this._maskRenderTarget.setPixelRatio(e.getPixelRatio());this._maskRenderTarget.resizeTo(e.getDimensions());var a=!this._lastPosition.equals(this._options.position)||this._lastGradientRadius!==this._options.gradientRadius||s;var l=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){this._renderMask();this._lastPosition=this._options.position.clone();this._lastGradientRadius=this._options.gradientRadius;}if(l){this._blurImage(e,this._blurredRenderTarget,this._options.blurRadius);this._lastBlurRadius=this._options.blurRadius;}this._applyMask(e,r);}},{key:"_renderMask",value:function _renderMask(){var t=this._maskRenderTarget.getCanvas();var e=this._maskRenderTarget.getContext();var r=new jd(t.width,t.height);var o=this._maskRenderTarget.getPixelRatio();var n=this._options.position.clone().multiply(r);var _this$_options19=this._options,s=_this$_options19.radius,a=_this$_options19.gradientRadius;s*=t.height;a*=t.height;var l=e.createRadialGradient(n.x,n.y,0,n.x,n.y,(s+a)*o);l.addColorStop(0,"#FFFFFF");l.addColorStop(s/(s+a),"#FFFFFF");l.addColorStop(1,"#000000");e.fillStyle=l;e.fillRect(0,0,r.x,r.y);}},{key:"_applyMask",value:function _applyMask(t,e){var r=e.getContext();var o=t.getCanvas();var n=t.getContext();var s=this._blurredRenderTarget.getContext();var a=this._maskRenderTarget.getContext();var l=n.getImageData(0,0,o.width,o.height);var c=l.data;var u=s.getImageData(0,0,o.width,o.height).data;var m=a.getImageData(0,0,o.width,o.height).data;var p;for(var h=0;h3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var _this$_options22=this._options,l=_this$_options22.maskCanvas,c=_this$_options22.filterCanvas;var u=l.getContext("2d");var m=c.getContext("2d");var p=u.getImageData(0,0,n.width,n.height).data;var h=s.getImageData(0,0,n.width,n.height);var g=h.data;var x=m.getImageData(0,0,n.width,n.height).data;var v;for(var b=0;b1&&arguments[1]!==undefined?arguments[1]:new E_(100,100);if(!this._renderTextures[t.id]){this._renderTextures[t.id]=new L.RenderTexture(t,e.x,e.y,1);}return this._renderTextures[t.id];}},{key:"dispose",value:function dispose(){this._isDisposed=true;for(var t in this._renderTextures){this._renderTextures[t].dispose();}}},{key:"canBeDuplicated",value:function canBeDuplicated(){return true;}},{key:"canBeDeleted",value:function canBeDeleted(){return true;}},{key:"canMaskCanvas",value:function canMaskCanvas(){return false;}},{key:"canAdjustPadding",value:function canAdjustPadding(){return false;}},{key:"canBeTakenToFront",value:function canBeTakenToFront(){return true;}},{key:"canBeFlippedHorizontally",value:function canBeFlippedHorizontally(){return true;}}]);return U9;}(_t);On=U9;});var hst,rl;var ET=d(function(){$();hst=J.Vector2;rl=/*#__PURE__*/function(_t12){_inherits(rl,_t12);var _super132=_createSuper(rl);function rl(){var _this179;_classCallCheck(this,rl);for(var _len81=arguments.length,t=new Array(_len81),_key81=0;_key81<_len81;_key81++){t[_key81]=arguments[_key81];}_this179=_super132.call.apply(_super132,[this].concat(t));_this179._lastOptions={};_this179._lastInputDimensions=new hst(0,0);_this179._brush=null;return _this179;}_createClass(rl,[{key:"getBrushImage",value:function getBrushImage(t){if(this._brush&&this.optionsEqual(this._lastOptions)&&t.equals(this._lastInputDimensions)){return this._brush;}var _this$_options23=this._options,e=_this$_options23.image,r=_this$_options23.size;e.width=e.height=Math.ceil(r*t.min());var o=z.createCanvas();o.width=e.width;o.height=e.height;var n=o.getContext("2d");n.drawImage(e,0,0,o.width,o.height);var s=this._tintImageData(n.getImageData(0,0,o.width,o.height),o.width,o.height);n.putImageData(s,0,0);this._lastOptions=this.serializeOptions(["size","color"]);this._brush=o;this._lastInputDimensions=t.clone();return o;}},{key:"_tintImageData",value:function _tintImageData(t){var e=this._options.color;for(var r=0;r2&&arguments[2]!==undefined?arguments[2]:3;_classCallCheck(this,H9);this._path=t;this._drawnCanvases=[];this._position=e;this._smooth=r;}_createClass(H9,[{key:"getBezierCurve",value:function getBezierCurve(t,e,r,o){if(!e){return null;}var n;var s;if(!o){n=(r.x-e.x)/this._smooth;s=(r.y-e.y)/this._smooth;}else{n=(o.x-e.x)/this._smooth;s=(o.y-e.y)/this._smooth;}var a;var l;if(!t){a=(r.x-e.x)/this._smooth;l=(r.y-e.y)/this._smooth;}else{a=(r.x-t.x)/this._smooth;l=(r.y-t.y)/this._smooth;}var c=e.clone().add(a,l);var u=r.clone().subtract(n,s);return new gst(e,c,u,r);}},{key:"renderToCanvas",value:function renderToCanvas(t,e,r,o,n){var s=arguments.length>5&&arguments[5]!==undefined?arguments[5]:1;if(this._drawnCanvases.indexOf(e)!==-1){return;}var a=new fst(e.width,e.height);var l=e.getContext("2d");var c=this._position.clone().multiply(a);var u=o?o.getPosition().clone().multiply(a):null;var m=r?r.getPosition().clone().multiply(a):null;var p=n?n.getPosition().clone().multiply(a):null;var h=c.clone().subtract(u).len();var g=t.width/10;var x=this.getBezierCurve(m,u,c,p);var v;if(!x){v=[c];}else{x.calculateSegments(20);var b=x.getLength();v=x.arcLengthApproxSample(Math.ceil(b/g));}for(var _b4=0;_b41&&arguments[1]!==undefined?arguments[1]:false;if(t==="controlPoints"){return this._options.controlPoints.map(function(r){var o=r.getPosition();return e?o.toObject():o.clone();});}return _get(_getPrototypeOf(FT.prototype),"serializeOption",this).call(this,t,e);}},{key:"_optionEquals",value:function _optionEquals(t,e){if(t==="controlPoints"){var r=this._options.controlPoints;for(var o=0,n=r.length;o1&&arguments[1]!==undefined?arguments[1]:false;var r=_get(_getPrototypeOf(bc.prototype),"serializeOptions",this).call(this,t,e);if(!t)r.type="brush";return r;}},{key:"serializeOption",value:function serializeOption(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t==="paths"){return this._options.paths.map(function(r){return r.serializeOptions(void 0,e);});}return _get(_getPrototypeOf(bc.prototype),"serializeOption",this).call(this,t,e);}},{key:"createPath",value:function createPath(t){var e=new Fh(this._operation,{brush:t},this._nextCanvas);e.on("update",this._onPathUpdate);this._options.paths.push(e);this.setDirty(true);return e;}},{key:"_onPathUpdate",value:function _onPathUpdate(){this._operation.setDirty(true);this.setDirty(true);}},{key:"_onPathPersist",value:function _onPathPersist(t){t.renderToCanvas(this._persistCanvas);this._nextCanvas=t.getCanvas();var e=this._nextCanvas.getContext("2d");e.clearRect(0,0,this._nextCanvas.width,this._nextCanvas.height);this._persistedPaths.push(t);}},{key:"_getTexture",value:function _getTexture(){return this._texture;}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;_get(_getPrototypeOf(bc.prototype),"setDirtyForRenderer",this).call(this,t,e,r);if(t&&r){this._persistedPaths=[];this.clearPersistCanvas();this._options.paths.forEach(function(o){o.setDirty(true);});}}},{key:"setDirty",value:function setDirty(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;for(var r in this._dirtiness){this.setDirtyForRenderer(t,this._renderers[r],e);}}},{key:"render",value:function render(t){var _this182=this;var e=this._operation.getSDK().getRenderer();if(!this.isDirtyForRenderer(e)){return;}z.ensureCanvasDimensions(this._outputCanvas,t);z.ensureCanvasDimensions(this._persistCanvas,t);this._options.paths.forEach(function(r){r.render(t);if(r.getClosed()&&_this182._persistedPaths.indexOf(r)===-1){_this182._onPathPersist(r);}});this.clearCanvas();this._outputContext.drawImage(this._persistCanvas,0,0);this._options.paths.forEach(function(r){if(!r.getClosed()){r.renderToCanvas(_this182._outputCanvas);}});this.setDirtyForRenderer(false,e);}},{key:"update",value:function update(t,e){if(e){z.ensureCanvasDimensions(this._outputCanvas,e);z.ensureCanvasDimensions(this._persistCanvas,e);this._texture.getBaseTexture().update();}this.render(e);var r=t.getRenderer();if(r.isOfType("webgl")){r.updateTexture(this._texture.getBaseTexture());}_get(_getPrototypeOf(bc.prototype),"update",this).call(this,t,e);}},{key:"_reset",value:function _reset(){this._persistedPaths=[];if(this._operation){this._operation.setDirty(true);}this.setDirty(true);this.clearCanvas();this.clearPersistCanvas();}},{key:"getCanvas",value:function getCanvas(){return this._outputCanvas;}},{key:"_createRadialBrush",value:function _createRadialBrush(){return new gc();}},{key:"_getTempCanvas",value:function _getTempCanvas(){return this._nextCanvas;}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(bc.prototype),"dispose",this).call(this);this._texture&&this._texture.getBaseTexture().dispose();}}]);return bc;}(On);bc.prototype.availableOptions={id:{type:"string","default":function _default(){return z.getUUID();}},position:{type:"vector2","default":new F_(0,0)},scale:{type:"vector2","default":new F_(1,1)},anchor:{type:"vector2","default":new F_(0,0)},pivot:{type:"vector2","default":new F_(0,0)},rotation:{type:"number","default":0},paths:{type:"array","default":[],setter:function setter(i){var _this183=this;i=i.map(function(t){if(t instanceof Fh)return t;var e=t.brush,r=t.closed;var o=new Fh(_this183._operation,{brush:e,closed:r},_this183._nextCanvas);t.controlPoints.forEach(function(n){o.addControlPoint(n);});return o;});this._reset();return i;}}};bc.type="brush";bc.Brush=rl;bc.Path=Fh;bc.Brushes={RadialBrush:gc};yc=bc;});var j9,Oh,$9;var K9=d(function(){$();zd();z9();OT();j9=J.Vector2;Oh=/*#__PURE__*/function(_Lt14){_inherits(Oh,_Lt14);var _super136=_createSuper(Oh);function Oh(){var _this184;_classCallCheck(this,Oh);for(var _len83=arguments.length,t=new Array(_len83),_key83=0;_key83<_len83;_key83++){t[_key83]=arguments[_key83];}_this184=_super136.call.apply(_super136,[this].concat(t));var e=_this184._sdk.getRenderer();_this184._lastBlurRadius=null;_this184._blurredRenderTexture=new L.RenderTexture(e,100,100,1);_this184._maskRenderTexture=new L.RenderTexture(e,100,100,1);_this184._brushSprite=new yc(_assertThisInitialized(_this184));_this184._brushSpriteContainer=new L.Container();var r=_this184._brushSprite.getDisplayObject();_this184._brushSpriteContainer.addChild(r);_this184._outputSprite=new L.Sprite();_this184._outputContainer=new L.Container();_this184._outputContainer.addChild(_this184._outputSprite);_this184._maskFilter=new L9();if(e.isOfType("webgl")){_this184._horizontalFilter=new or();_this184._verticalFilter=new or();_this184._sprite.setFilters([_this184._horizontalFilter,_this184._verticalFilter]);_this184._horizontalFilter.setDelta(new j9(1,1));_this184._verticalFilter.setDelta(new j9(-1,1));var o=_this184._maskRenderTexture.getBaseTexture();o.setGLUnit(_this184._maskFilter.getMaskImage());e.updateTexture(o,false);o=_this184._blurredRenderTexture.getBaseTexture();o.setGLUnit(_this184._maskFilter.getFilterImage());e.updateTexture(o,false);}else if(e.isOfType("canvas")){_this184._blurFilter=new or();_this184._sprite.setFilters([_this184._blurFilter]);_this184._maskFilter.setMaskCanvas(_this184._maskRenderTexture.getRenderTarget().getCanvas());_this184._maskFilter.setFilterCanvas(_this184._blurredRenderTexture.getRenderTarget().getCanvas());}_this184._outputSprite.setFilters([_this184._maskFilter]);return _this184;}_createClass(Oh,[{key:"flip",value:function flip(t){this._brushSprite.applyFlip(t);this.setDirty(true,true);this._lastBlurRadius=null;}},{key:"rotate",value:function rotate(t){this._brushSprite.applyRotation(t);this.setDirty(true,true);this._lastBlurRadius=null;}},{key:"transform",value:function transform(t,e){this._brushSprite.applyTransform(t,e);this.setDirty(true,true);this._lastBlurRadius=null;}},{key:"_render",value:function _render(t){this._renderBlur(t);this._renderMask(t);this._outputSprite.setTexture(t);this._renderTexture.render(this._outputContainer);return Promise.resolve();}},{key:"_renderMask",value:function _renderMask(t){var e=t.getDimensions();var r=this._maskRenderTexture.getDimensions();if(!r.equals(e)){this._maskRenderTexture.resizeTo(e);}this._brushSprite.update(this._sdk,e);this._maskRenderTexture.clear(G.BLACK);this._maskRenderTexture.render(this._brushSpriteContainer);var o=this._sdk.getRenderer();if(o.isOfType("webgl")){o.updateTexture(this._maskRenderTexture.getBaseTexture(),false);}}},{key:"_renderBlur",value:function _renderBlur(t){var e=t.getDimensions();var r=this._blurredRenderTexture.getDimensions();if(!r.equals(e)){this._blurredRenderTexture.resizeTo(e);}var o=this._options.blurRadius;if(this._lastBlurRadius!==o||!r.equals(e)){var s=this._sdk.getRenderer();var a;if(s.isOfType("webgl")){var l=e.min();a={blurRadius:o*l,texSize:e};this._horizontalFilter.set(a);this._verticalFilter.set(a);}else if(s.isOfType("canvas")){a={blurRadius:o};this._blurFilter.set(a);}this._blurredRenderTexture.render(this._container);this._lastBlurRadius=o;}var n=this._sdk.getRenderer();if(n.isOfType("webgl")){n.updateTexture(this._blurredRenderTexture.getBaseTexture(),false);}}},{key:"getBrush",value:function getBrush(){return this._brushSprite;}},{key:"createPath",value:function createPath(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var r=new yc.Brushes.RadialBrush({size:t,hardness:e,color:G.WHITE});var o=this._brushSprite.createPath(r);this._options.paths.push(o);this.setDirty(true);return o;}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e,r){_get(_getPrototypeOf(Oh.prototype),"setDirtyForRenderer",this).call(this,t,e,r);this._brushSprite.setDirtyForRenderer(t,e,r);}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(Oh.prototype),"dispose",this).call(this);var t=this._sdk.getRenderer();if(t.isOfType("webgl")){this._verticalFilter.dispose();this._horizontalFilter.dispose();}else{this._blurFilter.dispose();}this._brushSprite.dispose();this._maskFilter.dispose();this._blurredRenderTexture.dispose();this._maskRenderTexture.dispose();}},{key:"hasChanges",value:function hasChanges(){return true;}}]);return Oh;}(Lt);Oh.identifier="selective-blur";Oh.prototype.availableOptions={blurRadius:{type:"number","default":.05},paths:{type:"array","default":[],setter:function setter(i){if(this._brushSprite){this._brushSprite.setPaths(i);}return i;}}};ft.Operations.SelectiveBlurOperation=Oh;$9=Oh;});var _c,O_,R_,A_;var X9=d(function(){$();ww();$d();_c=J.Vector2;O_=J.ColorMatrix;R_=/*#__PURE__*/function(_On2){_inherits(R_,_On2);var _super137=_createSuper(R_);function R_(){var _this185;_classCallCheck(this,R_);for(var _len84=arguments.length,t=new Array(_len84),_key84=0;_key84<_len84;_key84++){t[_key84]=arguments[_key84];}_this185=_super137.call.apply(_super137,[this].concat(t));var e=_this185._options.image;var r=e.src||e.filePath||e.toDataUrl&&e.toDataURL();_this185._isSVG=r&&(!!r.match(/\w+\.svg(?=\?|$)/i)||r.match(/data:image\/svg/i));if(_this185._isSVG){_this185._canvas=z.createCanvas();_this185._context=_this185._canvas.getContext("2d");_this185._options.smoothDownscaling=false;}if(e){_this185._onImageUpdate();}_this185._tintFilter=new L.Filters.TintFilter();_this185._adjustmentsFilter=new qy();_this185._lastRenderedDimensions=_c.NULL;_this185._lastRenderedInputDimensions=_c.NULL;_this185._onOptionsChange=_this185._onOptionsChange.bind(_assertThisInitialized(_this185));_this185._options.adjustments.on("update",_this185._onOptionsChange);return _this185;}_createClass(R_,[{key:"applyScale",value:function applyScale(t){this.setDimensions(this.getDimensions().multiply(t));}},{key:"serializeOptions",value:function serializeOptions(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=_get(_getPrototypeOf(R_.prototype),"serializeOptions",this).call(this,t,e);if(!t)r.type="sticker";return r;}},{key:"_rendersToRenderTexture",value:function _rendersToRenderTexture(t){var e=this._options.smoothDownscaling&&!this._isSVG&&t.getRenderer().isOfType("webgl");return e||this._hasAdjustments()||this._options.tintMode!=="none";}},{key:"_getTexture",value:function _getTexture(){return this._inputTexture;}},{key:"update",value:function update(t,e){var _this$_options27=this._options,r=_this$_options27.dimensions,o=_this$_options27.image;if(r.equals(_c.NULL)){r.set(o.width,o.height);}this._sprite.setSmoothDownscaling(this._isSVG?false:this.getSmoothDownscaling());var n=!this._lastRenderedInputDimensions.equals(e)||!this._lastRenderedDimensions.equals(r)||this._lastRenderedImage!==o;if(n&&this._isSVG&&t.getRenderer().isOfType("webgl")){o.width=Math.round(r.x);o.height=Math.round(r.y);var a=4096;var l=o.width/o.height;if(o.width>a){o.width=a;o.height=Math.round(o.width/l);}if(o.height>a){o.height=a;o.width=Math.round(o.height*l);}this._canvas.width=o.width;this._canvas.height=o.height;this._context.clearRect(0,0,o.width,o.height);this._context.drawImage(o,0,0,o.width,o.height);this._inputTexture.getBaseTexture().update();}if(this._rendersToRenderTexture(t)){this._prepareRenderTexture(t);}var s=[];if(this._rendersToRenderTexture(t)){if(this._hasAdjustments()){s.push(this._adjustmentsFilter);var _a3=this._options.adjustments;var _l4=new O_();_l4.multiply(O_.createBrightnessMatrix(_a3.getBrightness()));_l4.multiply(O_.createSaturationMatrix(_a3.getSaturation()));_l4.multiply(O_.createContrastMatrix(_a3.getContrast()));this._adjustmentsFilter.set({colorMatrix:_l4});}if(this._options.tintMode&&this._options.tintMode!=="none"){s.push(this._tintFilter);this._tintFilter.set({mode:L.Filters.TintFilter.MODES[this._options.tintMode.toUpperCase()],color:this._options.tintColor});if(this._sprite.getTexture()&&this._sprite.getTexture()._baseTexture){this._sprite.getTexture()._baseTexture.setDirty(true);}}this._renderTextureSprite.setFilters(s);}if(this._rendersToRenderTexture(t)){this._renderToRenderTexture(t);}else{this._sprite.setTexture(this._inputTexture);}this._updateSprite(e);this._applyFlip();this._lastRenderedDimensions.copy(r);this._lastRenderedInputDimensions.copy(e);this._lastRenderedImage=o;}},{key:"_applyFlip",value:function _applyFlip(){var t=this._sprite.getScale();var _this$_options28=this._options,e=_this$_options28.flipHorizontally,r=_this$_options28.flipVertically;if(e&&t.x>0||!e&&t.x<0){t.x*=-1;}if(r&&t.y>0||!r&&t.y<0){t.y*=-1;}this._sprite.setScale(t);}},{key:"applyFlip",value:function applyFlip(t){_get(_getPrototypeOf(R_.prototype),"applyFlip",this).call(this,t);var e={rotation:this._options.rotation};var r=e.rotation/Math.PI*180;var o=r*-1;e.rotation=o*Math.PI/180;switch(t){case"horizontal":e.flipHorizontally=!this._options.flipHorizontally;this.set(e);break;case"vertical":e.flipVertically=!this._options.flipVertically;this.set(e);break;}}},{key:"_hasAdjustments",value:function _hasAdjustments(){var t=this._options.adjustments;return t.getBrightness()!==0||t.getSaturation()!==1||t.getContrast()!==1;}},{key:"_onImageUpdate",value:function _onImageUpdate(){var t=this._options.image;var e=this._operation.getSDK().getRenderer();if(this._isSVG&&e.isOfType("webgl")){t=this._canvas;}if(this._inputTexture){this._inputTexture.dispose();this._inputTexture=null;}this._inputTexture=L.Texture.fromImage(t);this._identitySprite.setTexture(this._inputTexture);this._sprite.setTexture(this._inputTexture);if(this._renderTexture){this._renderTextureSprite.setTexture(this._inputTexture);this._renderTexture.resizeTo(this._inputTexture.getDimensions());}this.setDirty(true);}},{key:"scalesUniformly",value:function scalesUniformly(){return this._options.resizeMode==="keepAspect";}},{key:"setOption",value:function setOption(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;_get(_getPrototypeOf(R_.prototype),"setOption",this).call(this,t,e,r);if(t==="image"&&this._identitySprite){this._onImageUpdate();}}},{key:"_onOptionsChange",value:function _onOptionsChange(){var t=this._dirtiness;for(var e in t){t[e]=true;}}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(R_.prototype),"dispose",this).call(this);if(this._inputTexture){this._inputTexture.dispose();this._inputTexture=null;}this._tintFilter.dispose();this._adjustmentsFilter.dispose();this._options.adjustments.off("updated",this._onOptionsChange);}}]);return R_;}(On);R_.prototype.availableOptions={id:{type:"string","default":function _default(){return z.getUUID();}},identifier:{type:"string","default":""},image:{type:"image",required:true},position:{type:"vector2","default":_c.NULL},dimensions:{type:"vector2","default":_c.NULL},anchor:{type:"vector2","default":new _c(0,0)},pivot:{type:"vector2","default":new _c(.5,.5)},rotation:{type:"number","default":0},flipHorizontally:{type:"boolean","default":false},flipVertically:{type:"boolean","default":false},smoothDownscaling:{type:"boolean","default":false},tintColor:{type:"color","default":G.WHITE},tintMode:{type:"string","default":"none",available:["none","solid","colorized"]},resizeMode:{type:"string","default":"keepAspect",available:["keepAspect","unrestricted"]},alpha:{type:"number","default":1},adjustments:{type:"configurable",structure:{brightness:{type:"number","default":0},saturation:{type:"number","default":1},contrast:{type:"number","default":1}}}};R_.type="sticker";A_=R_;});var _Rn,It;var Br=d(function(){_Rn=/*#__PURE__*/function(){function Rn(t){_classCallCheck(this,Rn);this._seed=t===void 0?_Rn.TimeSeed():t;}_createClass(Rn,[{key:"seed",value:function seed(t){this._seed=t===void 0?_Rn.TimeSeed():t;}},{key:"next",value:function next(){var t=this._seed|0;var e=t/_Rn.SEED_DIVIDER|0;var r=t%_Rn.SEED_DIVIDER|0;t=_Rn.SEED_LOW_MULTIPLY*r-_Rn.SEED_HIGH_MULTIPLY*e;if(t<=0){t+=_Rn.MAX;}if(t===-1){t=_Rn.MAX-1;}this._seed=t;return t;}},{key:"nextInRange",value:function nextInRange(t,e){if(e===void 0){e=t;t=0;}return t+this.next()%(e-t+1);}},{key:"nextBool",value:function nextBool(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return this.nextInRange(t+e-1)>=t;}},{key:"pickNext",value:function pickNext(t){if(!Array.isArray(t)){return null;}return t[this.next()%t.length];}}],[{key:"TimeSeed",value:function TimeSeed(){return Date.now();}}]);return Rn;}();It=_Rn;q(It,"MAX",2147483647);q(It,"SEED_DIVIDER",127773);q(It,"SEED_LOW_MULTIPLY",16807);q(It,"SEED_HIGH_MULTIPLY",2836);});var bst,_e8;var An=d(function(){$();bst=J.Rectangle;_e8=/*#__PURE__*/function(){function _e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,_e);this.width=t;this.height=e;}_createClass(_e,[{key:"set",value:function set(t,e){this.width=t;this.height=e;}},{key:"aspect",value:function aspect(){return this.width/this.height;}},{key:"rectangle",value:function rectangle(t,e){return new bst(t,e,this.width,this.height);}},{key:"clone",value:function clone(){return new _e8(this.width,this.height);}},{key:"scale",value:function scale(t,e){if(e===void 0){e=t;}this.width*=t;this.height*=e;return this;}},{key:"copy",value:function copy(t){this.width=t.width;this.height=t.height;return this;}},{key:"fitInWidthWithOther",value:function fitInWidthWithOther(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new _e8();this.copy(_e8.fitTwoInWidth(t,this,e)[0]);return this;}}],[{key:"fitTwoInWidth",value:function fitTwoInWidth(t,e,r){var o=e.width*r.height+e.height*r.width;var n=r.height*t/o;var s=e.width*n;var a=e.height*n;return[new _e8(s,a),new _e8(t-s,a)];}}]);return _e;}();});var q9,RT,Kt;var so=d(function(){$();q9=y(Ju());RT=/*#__PURE__*/function(_t14){_inherits(RT,_t14);var _super138=_createSuper(RT);function RT(){_classCallCheck(this,RT);return _super138.apply(this,arguments);}_createClass(RT,[{key:"loadImages",value:function(){var _loadImages=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee9(t){var _this186=this;return regeneratorRuntime.wrap(function _callee9$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:return _context10.abrupt("return",(0,q9["default"])(t,/*#__PURE__*/function(){var _ref110=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee8(e){return regeneratorRuntime.wrap(function _callee8$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:return _context9.abrupt("return",_this186.addImage(e.path,e.fullPath,e.image));case 1:case"end":return _context9.stop();}}},_callee8);}));return function(_x13){return _ref110.apply(this,arguments);};}()));case 1:case"end":return _context10.stop();}}},_callee9);}));function loadImages(_x12){return _loadImages.apply(this,arguments);}return loadImages;}()},{key:"addImage",value:function addImage(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"anonymous";var n=this.getImages();if(!r){return new Promise(function(s,a){r=new Xi();r.onload=function(){n[t]={fullPath:e,image:r};s({fullPath:e,image:r});};r.crossOrigin=z.getCrossOriginValue(o);r.onerror=a;r.src=e;});}n[t]={fullPath:e,image:r};return Promise.resolve({fullPath:e,image:r});}},{key:"getImage",value:function getImage(t){var e=this.getImages();var r=e[t];return r?r.image:null;}},{key:"getVariation",value:function getVariation(t){return this.getFonts()[t];}},{key:"addFont",value:function addFont(t,e){var r=this.getFonts();r[t]=e;return e;}}]);return RT;}(_t);RT.prototype.availableOptions={images:{type:"object","default":{}},fonts:{type:"object","default":{}}};Kt=new RT();});var yst,_st,Y9,xst,vst,Cst,Sst,wst,qi;var Kd=d(function(){$();An();so();yst=function yst(i,t,e,r){var o=e*(r*4)+t*4;var n={r:i[o],g:i[o+1],b:i[o+2],a:i[o+3]};return n;};_st=function _st(i){return i.a<=254;};Y9=function Y9(i,t,e){var r=true;for(var o=0;o4&&arguments[4]!==undefined?arguments[4]:false;var n=0;for(var s=r+1;s4&&arguments[4]!==undefined?arguments[4]:false;var n=0;for(var s=r-1;s>=0;s--){if(!Y9(i,s,t)){n=r-s;}else if(o){break;}}return n;};Cst=function Cst(i,t,e,r,o){i.beginPath();i.moveTo(t,e);i.lineTo(r,o);i.stroke();};Sst=function Sst(i,t,e,r){var o=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"red";i.save();i.strokeStyle=o;Cst(i,e,t,r,t);i.restore();};wst=function wst(i,t,e,r,o){var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:"blue";i.save();i.strokeStyle=n;i.strokeRect(t,e,r,o);i.restore();};qi=/*#__PURE__*/function(_t15){_inherits(qi,_t15);var _super139=_createSuper(qi);function qi(t){var _this187;_classCallCheck(this,qi);_this187=_super139.call(this,t);var e=Kt.getVariation(_this187.getFontIdentifier());if(!e){Y.warn("TextDesignFont: Unable to find font '".concat(_this187._fontIdentifier,"'"));}_this187.set({fontVariation:e});_this187._metrics=null;_this187._canvas=z.createCanvas();_this187._context=_this187._canvas.getContext("2d");_this187._isDirty=true;return _this187;}_createClass(qi,[{key:"_onOptionsChange",value:function _onOptionsChange(){this._isDirty=true;}},{key:"setOption",value:function setOption(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;_get(_getPrototypeOf(qi.prototype),"setOption",this).call(this,t,e,r,o);if(t==="fontIdentifier"&&!o){this.updateFontVariation();}}},{key:"updateFontVariation",value:function updateFontVariation(){var t=Kt.getVariation(this.getFontIdentifier());if(!t){Y.warn("TextDesignFont: Unable to find font '".concat(this._fontIdentifier,"'"));}this.setFontVariation(t);return t;}},{key:"setOptions",value:function setOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._options=_objectSpread(_objectSpread({},this._options),t);this._isDirty=true;}},{key:"_applyTextOptions",value:function _applyTextOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._context;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _this$_options$e=_objectSpread(_objectSpread({},this._options),e),r=_this$_options$e.fontSize,o=_this$_options$e.fontVariation,n=_this$_options$e.lineHeight,s=_this$_options$e.textColor,a=_this$_options$e.alignment;var _o$serializeOptions=o.serializeOptions(),l=_o$serializeOptions.fontStyle,c=_o$serializeOptions.fontWeight,u=_o$serializeOptions.fontFamily;if(false){t.font="".concat(l," ").concat(c," ").concat(r,"px ").concat(u);}if(true){t.font="".concat(l," ").concat(c," ").concat(r,"px / ").concat(n," ").concat(u);}t.fillStyle=s;t.textBaseline="alphabetic";t.textAlign=a||"left";}},{key:"getTextMetrics",value:function getTextMetrics(){if(!this._metrics||this._isDirty){this._calculateTextMetrics();}return _objectSpread({},this._metrics);}},{key:"getSizeValue",value:function getSizeValue(){if(!this._metrics||this._isDirty){this._calculateTextMetrics();}return new _e8(this._metrics.width,this._metrics.height);}},{key:"fitWidth",value:function fitWidth(t){var e=this.getFontVariation();if(!e){Y.warn("TextDesignFont#fitText: missing font variation");return;}this._applyTextOptions(this._context,{fontSize:50});var r=this._context.measureText(this.getText()).width;var o=t/r;var n=Math.floor(o*50);this.setFontSize(n);this._calculateTextMetrics();return this.getTextMetrics();}},{key:"fitHeight",value:function fitHeight(t){var e=this.getFontVariation();if(!e){Y.warn("TextDesignFont#fitText: missing font variation");return;}var r=this._calculateTextMetrics({fontSize:50}).height;var o=t/r;var n=Math.floor(o*50);this.setFontSize(n);this._calculateTextMetrics();return this.getTextMetrics();}},{key:"_calculateTextMetrics",value:function _calculateTextMetrics(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=this._canvas;var r=this._context;var o=_objectSpread(_objectSpread({},this._options),t);var n=this.getText();this._applyTextOptions(r,o);var s=Math.ceil(r.measureText(n).width);var a=Math.floor(s+o.fontSize*2);var l=Math.floor(o.fontSize*3);e.width=a;e.height=l;var c=Math.floor(o.fontSize);var u=Math.floor(l*(3/5));this._applyTextOptions(r,o);r.fillText(n,c,u);var m=r.getImageData(0,0,e.width,e.height).data;var p=vst(m,a,l,u,this._options.excludeAccents);var h=xst(m,a,l,u,this._options.excludeAccents);var g=s;var x=p+h;this._metrics={width:g,height:x,ascender:p,descender:h};this._isDirty=false;return _objectSpread({},this._metrics);}},{key:"draw",value:function draw(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._context;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var o=arguments.length>3?arguments[3]:undefined;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;t.save();if(!this._metrics||this._isDirty){this._calculateTextMetrics();}this._applyTextOptions(t,o);t.fillText(this.getText(),e,r+this._metrics.ascender);if(n){wst(t,e,r,this._metrics.width,this._metrics.height);Sst(t,r+this._metrics.ascender,e,e+this._metrics.width);}t.restore();}}]);return qi;}(_t);qi.prototype.availableOptions={text:{type:"string","default":""},fontIdentifier:{type:"string","default":"imgly_font_open_sans_bold"},fontVariation:{type:"object","default":null},lineHeight:{type:"number","default":1},fontSize:{type:"number","default":22},textColor:{type:"string","default":"black"},strokeStyle:{type:"string","default":"black"},outlineWidth:{type:"number","default":0},textBaseline:{type:"string","default":"alphabetic"},excludeAccents:{type:"boolean","default":false}};});var Yi;var xc=d(function(){$();Yi=/*#__PURE__*/function(_t16){_inherits(Yi,_t16);var _super140=_createSuper(Yi);function Yi(){_classCallCheck(this,Yi);return _super140.apply(this,arguments);}return Yi;}(_t);Yi.prototype.availableOptions={text:{type:"string","default":""},frame:{type:"object","default":null},font:{type:"object","default":null}};});var ao;var Xd=d(function(){$();ao=/*#__PURE__*/function(_t17){_inherits(ao,_t17);var _super141=_createSuper(ao);function ao(){_classCallCheck(this,ao);return _super141.apply(this,arguments);}return ao;}(_t);ao.prototype.availableOptions={tintColor:{type:"color","default":G.BLACK},textColor:{type:"color","default":G.BLACK},alignment:{type:"string","default":"left",available:["left","center","right"]},lineSpacing:{type:"number","default":1},fontIdentifier:{type:"string","default":"imgly_font_open_sans_bold"}};});var Tst,ar;var Rh=d(function(){$();An();Xd();Tst=J.Rectangle;ar=/*#__PURE__*/function(_t18){_inherits(ar,_t18);var _super142=_createSuper(ar);function ar(t){var _this188;_classCallCheck(this,ar);_this188=_super142.call(this,t);_this188.setSize(new _e8(_this188.getWidth(),0));_this188.serverImageSmoothingFix=false;return _this188;}_createClass(ar,[{key:"_getFrame",value:function _getFrame(){var t=this.getSize();return new Tst(0,0,t.width,t.height);}},{key:"_getTextFrame",value:function _getTextFrame(){return this._getFrame();}},{key:"_getTextFrameForElement",value:function _getTextFrameForElement(t){return t.getFrame().clone();}},{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){Y.warn("TextDesignRow is an abstract class.");}},{key:"_getLayoutElements",value:function _getLayoutElements(){if(this._options.elements.length<=0){this.layout();}return this.getElements();}},{key:"_fontSize",value:function _fontSize(t){Y.warn("TextDesignRow#_fontSize not implemented. @TODO: Is it necessary?");return 0;}},{key:"layout",value:function layout(){this.setElements(this._calculateLayoutElements());return this;}},{key:"textFrame",value:function textFrame(t,e){return t.getFrame().clone();}},{key:"willRender",value:function willRender(t){}},{key:"didRender",value:function didRender(t){}},{key:"render",value:function render(t){var _this189=this;t.save();this._getLayoutElements().forEach(function(e){var _e$serializeOptions=e.serializeOptions(),r=_e$serializeOptions.text,o=_e$serializeOptions.frame,n=_e$serializeOptions.font;var s=_this189.getAttributes();n.draw(t,o.x,o.y,{textColor:s.getTextColor().toRGBA(),alignment:s.getAlignment()});});t.restore();}}]);return ar;}(_t);ar.prototype.availableOptions={words:{type:"object","default":null},width:{type:"number","default":100},attributes:{type:"configurable","default":new ao()},shearingAngle:{type:"number","default":0},elements:{type:"array","default":[]},size:{type:"object","default":null}};});var kst,_Ah,No;var J9=d(function(){$();Kd();xc();Rh();kst=J.Rectangle;_Ah=/*#__PURE__*/function(_ar){_inherits(Ah,_ar);var _super143=_createSuper(Ah);function Ah(){_classCallCheck(this,Ah);return _super143.apply(this,arguments);}_createClass(Ah,[{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){if(this.getWords().size()<=0){return[];}var _this$serializeOption=this.serializeOptions(),t=_this$serializeOption.orientation,e=_this$serializeOption.width,r=_this$serializeOption.size,o=_this$serializeOption.relativeRowOffset,n=_this$serializeOption.attributes;var s=n.fontIdentifier;var a=this.getWords().joined(3);var l=t===_Ah.Orientations.Left?[a[0],a[1],a[2]]:[a[1],a[2],a[0]];var c=z.Array.range(0,2).map(function(bt){return new qi({text:l[bt],fontIdentifier:s,fontSize:60});});var u=c.map(function(bt){return bt.getSizeValue();});var m=u[0].width>u[1].width?0:1;var p=(m+1)%2;c[p].fitWidth(u[m].width);u[p]=c[p].getSizeValue();var h=(u[p].height+u[m].height)/(1-o);var g=new qi({text:l[2],fontIdentifier:s});g.fitHeight(h);var x=g.getSizeValue().width;var v=u[m].width;var b=e/(x+v);var T=b*x;var k=b*v;var E=b*h;var A=o*E;r.set(e,E);var I=z.Array.range(0,3).map(function(bt){return new qi({text:l[bt],fontIdentifier:s});});I[0].fitWidth(k);I[1].fitWidth(k);I[2].fitWidth(T);var F=t===_Ah.Orientations.Left?0:T;var Z=t===_Ah.Orientations.Left?k:0;var et=[F,F,Z];var pt=[0,I[0].getSizeValue().height+A,0];var yt=I.map(function(bt,ht){return new kst(et[ht],pt[ht],bt.getSizeValue().width,bt.getSizeValue().height);});return I.map(function(bt,ht){return new Yi({text:l[ht],font:I[ht],frame:yt[ht]});});}}]);return Ah;}(ar);No=_Ah;q(No,"Orientations",{Right:"RIGHT",Left:"LEFT"});No.prototype.availableOptions=_objectSpread(_objectSpread({},ar.prototype.availableOptions),{},{orientation:{type:"string","default":No.Orientations.Left,available:[No.Orientations.Right,No.Orientations.Left]},relativeRowOffset:{type:"number","default":.05}});});var Ist,_vt;var Pr=d(function(){$();Ist=J.Rectangle;_vt=/*#__PURE__*/function(){function vt(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,vt);this.top=t;this.left=e;this.bottom=r;this.right=o;}_createClass(vt,[{key:"multiply",value:function multiply(t){this.top*=t;this.left*=t;this.bottom*=t;this.right*=t;}},{key:"toObject",value:function toObject(){return _objectSpread({},this);}},{key:"equals",value:function equals(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Math.abs(t.top-this.top)<=e&&Math.abs(t.left-this.left)<=e&&Math.abs(t.bottom-this.bottom)<=e&&Math.abs(t.right-this.right)<=e;}},{key:"scale",value:function scale(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;var e=arguments.length>1?arguments[1]:undefined;if(e===void 0){e=t;}this.top*=e;this.bottom*=e;this.left*=t;this.right*=t;return this;}},{key:"clone",value:function clone(){return new _vt(this.top,this.left,this.bottom,this.right);}},{key:"applyToRectangle",value:function applyToRectangle(t){return new Ist(t.x+this.left,t.y+this.top,t.width-this.left-this.right,t.height-this.top-this.bottom);}}],[{key:"ZERO",get:function get(){return new _vt(0,0,0,0);}}]);return vt;}();});var xe;var lo=d(function(){$();Kd();Pr();xc();Rh();xe=/*#__PURE__*/function(_ar2){_inherits(xe,_ar2);var _super144=_createSuper(xe);function xe(){_classCallCheck(this,xe);return _super144.apply(this,arguments);}_createClass(xe,[{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){var _this$serializeOption2=this.serializeOptions(),t=_this$serializeOption2.attributes,e=_this$serializeOption2.imageInsets,r=_this$serializeOption2.size,o=_this$serializeOption2.width;var n=this.getWords().joined(1)[0]||"";var s=t.fontIdentifier;var a=new qi({text:n,fontIdentifier:s});a.fitWidth(this._getTextFrame().width);var l=a.getTextMetrics().height+e.top+e.bottom;r.height=l;var c=this._getTextFrame();var u=new Yi({text:n,frame:c,font:a});return[u];}}]);return xe;}(ar);xe.prototype.availableOptions=_objectSpread(_objectSpread({},ar.prototype.availableOptions),{},{imageInsets:{type:"object","default":new _vt()}});});var Gs,Ii,AT,co,B_,qd,BT,Z9,Q9,Vs;var ol=d(function(){$();Gs=J.Rectangle;Ii=J.Vector2;AT=function AT(i,t,e,r){i.drawImage(t,e.x,e.y,e.width,e.height,r.x,r.y,r.width,r.height);};co=function co(i,t,e){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"source-over";var o=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;i.save();i.fillStyle=e.toRGBA();i.globalCompositeOperation=r;i.fillRect(t.x,t.y,t.width,t.height);if(o){i.strokeStyle=e.toRGBA();i.strokeWith=1;i.strokeRect(t.x,t.y,t.width,t.height);}i.restore();};B_=function B_(i,t,e,r){var o=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"source-over";var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;i.save();i.fillStyle=r.toRGBA();i.globalCompositeOperation=o;e=Math.min(Math.max(e,0),Math.min(t.height,t.width)*.5);var s=t.x;var a=t.x+t.width;var l=t.y;var c=t.y+t.height;i.beginPath();i.moveTo(s+e,l);i.arcTo(a,l,a,c,e);i.arcTo(a,c,s,c,e);i.arcTo(s,c,s,l,e);i.arcTo(s,l,a,l,e);i.closePath();i.fill();if(n){i.stroke();}i.restore();};qd=function qd(i,t,e){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:4;i.save();i.strokeStyle=e.toRGBA();i.lineWidth=r;i.strokeRect(t.x,t.y,t.width,t.height);i.restore();};BT=function BT(i,t,e){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"source-over";i.save();var o=t.height/2;var n=t.y+o;var s=t.x+o;var a=t.x+t.width;i.fillStyle=e.toRGBA();i.globalCompositeOperation=r;while(s4&&arguments[4]!==undefined?arguments[4]:"source-atop";i.save();if(r){i.globalAlpha=r.a;}i.drawImage(t,e.x,e.y,e.width,e.height);if(r){i.globalAlpha=1;}if(r){var n=r.clone();n.a=1;co(i,e,n,o);}i.restore();};});var js;var P_=d(function(){$();ol();Pr();lo();js=/*#__PURE__*/function(_xe){_inherits(js,_xe);var _super145=_createSuper(js);function js(){_classCallCheck(this,js);return _super145.apply(this,arguments);}_createClass(js,[{key:"_getTextColor",value:function _getTextColor(){if(this.getAutoAdjustTextColor()&&!this.getIsMasked()){if(this.getBackgroundColor().equals(G.WHITE)){return G.BLACK;}return G.WHITE;}return this.getAttributes().getTextColor().clone();}},{key:"_getTextFrame",value:function _getTextFrame(){return this.getImageInsets().applyToRectangle(this._getFrame());}},{key:"_getTextFrameForElement",value:function _getTextFrameForElement(t){var e=_get(_getPrototypeOf(js.prototype),"_getTextFrameForElement",this).call(this,t);var r=this.getImageInsets();if(this.getIsMasked()||this.getIsUsedInInvertedLayout()){e.y-=r.top;}return e;}},{key:"willRender",value:function willRender(t){if(false){if(this.serverImageSmoothingFix){t.imageSmoothingEnabled=true;}}var e=this.getAttributes();e.setTextColor(this._getTextColor());var r=this.getImage();if(r){var o=this.getCapInsets();var n=this._getFrame();if(o&&!o.equals(_vt.ZERO)){Q9(t,r,n,o);}else{t.drawImage(r,n.x,n.y,n.width,n.height);}co(t,n,this.getBackgroundColor(),"source-atop",true);}if((this.getIsMasked()||this.getIsUsedInInvertedLayout())&&r){t.save();t.globalCompositeOperation="destination-out";}}},{key:"didRender",value:function didRender(t){_get(_getPrototypeOf(js.prototype),"didRender",this).call(this,t);if(this.getIsMasked()||this.getIsUsedInInvertedLayout()){t.restore();}}}]);return js;}(xe);js.prototype.availableOptions=_objectSpread(_objectSpread({},xe.prototype.availableOptions),{},{image:{type:"image","default":null},capInsets:{type:"object","default":new _vt()},backgroundColor:{type:"color","default":G.WHITE},autoAdjustTextColor:{type:"boolean","default":true},isMasked:{type:"boolean","default":true},isUsedInInvertedLayout:{type:"boolean","default":false}});});var _lr;var M_=d(function(){$();Pr();_lr=/*#__PURE__*/function(_t19){_inherits(lr,_t19);var _super146=_createSuper(lr);function lr(){_classCallCheck(this,lr);return _super146.apply(this,arguments);}_createClass(lr,[{key:"insetsForWidth",value:function insetsForWidth(t){return this.getRelativeInsets().clone().scale(t);}}],[{key:"Small",get:function get(){return new _lr({imagePath:"text-design/images/imgly_text_design_asset_banderole_small.png",fontIdentifier:"imgly_font_outfit_bold",relativeInsets:new _vt(.05,.2,.05,.2)});}},{key:"Rectangle",get:function get(){return new _lr({imagePath:"text-design/images/imgly_text_design_asset_black_background.png",fontIdentifier:"imgly_font_outfit_bold",relativeInsets:new _vt(.05,.05,.05,.05),needsImageSmoothingFix:true});}},{key:"Celebrate1",get:function get(){return new _lr({imagePath:"text-design/images/imgly_text_design_asset_celebrate_01.png",fontIdentifier:"imgly_font_rasa_500",relativeInsets:new _vt(.05,.2,.05,.2)});}},{key:"Celebrate2",get:function get(){return new _lr({imagePath:"text-design/images/imgly_text_design_asset_celebrate_02.png",fontIdentifier:"imgly_font_rasa_500",relativeInsets:new _vt(.05,.2,.05,.2)});}}]);return lr;}(_t);_lr.prototype.availableOptions={image:{type:"image","default":null},imagePath:{type:"string","default":null},relativeInsets:{type:"object","default":new _vt()},fontIdentifier:{type:"string","default":"imgly_font_open_sans_bold"},needsImageSmoothingFix:{type:"boolean","default":false}};});var L_;var tU=d(function(){$();Pr();An();L_=/*#__PURE__*/function(_t20){_inherits(L_,_t20);var _super147=_createSuper(L_);function L_(){_classCallCheck(this,L_);return _super147.apply(this,arguments);}_createClass(L_,[{key:"getSize",value:function getSize(){var t=this.getRows();var e=this.getWidth();var r=t.length-1;var o=t.reduce(function(s,a){return s+a.getSize().height;},0);o+=(r+1)*this.getRelativeLineSpacing()*e;var n=this.getRelativeInsets().clone().scale(e);o+=n.top+n.bottom;return new _e8(e,o);}}]);return L_;}(_t);L_.prototype.availableOptions={text:{type:"string","default":""},lines:{type:"array","default":[]},relativeInsets:{type:"object","default":new _vt()},relativeLineSpacing:{type:"number","default":0},rows:{type:"object","default":[]},background:{type:"object","default":null},width:{type:"number","default":0}};});var _hi;var nl=d(function(){$();_hi=/*#__PURE__*/function(){function hi(t){_classCallCheck(this,hi);this.words=[];if(t){this.splitIntoWords(t);}}_createClass(hi,[{key:"splitIntoWords",value:function splitIntoWords(t){this.words=t.match(/\S+/g)||[];return _toConsumableArray(this.words);}},{key:"get",value:function get(){return _toConsumableArray(this.words);}},{key:"getWord",value:function getWord(t){return this.words[t];}},{key:"set",value:function set(t){this.words=_toConsumableArray(t);return this;}},{key:"slice",value:function slice(t,e){return _hi.fromWords(this.words.slice(t,e));}},{key:"getLowerCase",value:function getLowerCase(){return this.words.map(function(t){return t.toLowerCase();});}},{key:"getUpperCase",value:function getUpperCase(){return this.words.map(function(t){return t.toUpperCase();});}},{key:"size",value:function size(){return this.words.length;}},{key:"countNumberOfCharacters",value:function countNumberOfCharacters(){return this.words.reduce(function(t,e){return t+e.length;},0);}},{key:"joined",value:function joined(t){var _this190=this;var e=this.size();var r=Math.floor(e/t);var o=e%t;var n=0;var s=0;return z.Array.range(0,t).map(function(a){n=s;var l=r+(a=this.getMinLineCountOfRandom()){var r=Math.floor(Math.max(1,e*this.getRandomAdditionalLinePercentage()));e+=this._lineNumberRandomizer.nextInRange(0,r);}return Math.min(e,this._maximumNumberOfLines(t));}},{key:"_randomizedNumberOfWordsPerLine",value:function _randomizedNumberOfWordsPerLine(t,e){var _this192=this;if(t>e){Y.warn("TextDesign#_randomizedNumberOfWordsPerLine: Invalid number of lines");return e;}var r=z.Array.repeat(1,t);z.Array.range(t,e).forEach(function(o){var n=_this192._wordsPerLineRandomizer.nextInRange(0,t-1);r[n]+=1;});return r;}},{key:"_textLines",value:function _textLines(t){var e=new _hi(t);var r=this._calculatedNumberOfLines(e);var o=this._randomizedNumberOfWordsPerLine(r,e.size());return o.reduce(function(n,s){return{index:n.index+s,lines:[].concat(_toConsumableArray(n.lines),[e.slice(n.index,Math.min(n.index+s,e.size()))])};},{index:0,lines:[]}).lines;}},{key:"_validTextLines",value:function _validTextLines(t){var e=this._textLines(t);var r=0;do{r=z.Array.findIndex(e,function(o){return o.countNumberOfCharacters()<3;});if(r>=0){var o=e[r-1];var n=e[r+1];var s=o?o.countNumberOfCharacters():Number.MAX_SAFE_INTEGER;var a=n?n.countNumberOfCharacters():Number.MAX_SAFE_INTEGER;if(s-1&&e.length>1);return e;}},{key:"_modifiedLines",value:function _modifiedLines(t){return t;}},{key:"_getBackground",value:function _getBackground(){return this._background;}},{key:"generateLayoutData",value:function generateLayoutData(t,e){var r=this._modifiedText(t);var o=this._modifiedLines(this._validTextLines(r));var n=e*(1-this._relativeInsets.left-this._relativeInsets.right);var s=this._layoutRows(o,n);return new L_({text:r,relativeInsets:this._relativeInsets.clone(),relativeLineSpacing:this.getRelativeLineSpacing(),background:this._background||this._getBackground(),lines:o,rows:s,width:e});}},{key:"_layoutRows",value:function _layoutRows(t,e){var _this193=this;return t.map(function(r,o){return _this193._randomLayoutRow(r,o,e,new ao({fontIdentifier:_this193._fontForRow(o,r)})).layout();});}},{key:"_randomLayoutRow",value:function _randomLayoutRow(t,e,r,o){return new xe({words:t,width:r,attributes:o});}}]);return ri;}(_t);q(ri,"defaultFontIdentifiers",[]);q(ri,"identifier","textdesign");ri.prototype.availableOptions={fontIdentifiers:{type:"array","default":[]},relativeLineSpacing:{type:"number","default":0}};});var oi;var Jd=d(function(){$();Br();J9();lo();P_();Xd();M_();so();Yd();oi=/*#__PURE__*/function(_ri){_inherits(oi,_ri);var _super149=_createSuper(oi);function oi(){var _this194;_classCallCheck(this,oi);for(var _len85=arguments.length,t=new Array(_len85),_key85=0;_key85<_len85;_key85++){t[_key85]=arguments[_key85];}_this194=_super149.call.apply(_super149,[this].concat(t));q(_assertThisInitialized(_this194),"getImagePaths",function(){var t=_this194.getBanderoles();return t&&t.map(function(e){return e.getImagePath();})||[];});q(_assertThisInitialized(_this194),"onImagesLoaded",function(){var t=_this194.getBanderoles();if(t){t.forEach(function(e){var r=Kt.getImage(e.getImagePath());if(!r){Y.warn("TextDesignBlocks#onImagesLoaded: Image not found '".concat(e.getImagePath(),"'"));return;}e.setImage(r);});}});_this194._rowTypeLessThan3WordsRandomizer=new It(0);_this194._rowTypeMoreThan3WordsRandomizer=new It(0);_this194._banderolesRandomizer=new It(0);_this194._seedPool=[].concat(_toConsumableArray(_this194._seedPool),[_this194._rowTypeLessThan3WordsRandomizer,_this194._rowTypeMoreThan3WordsRandomizer,_this194._banderolesRandomizer]);return _this194;}_createClass(oi,[{key:"_modifiedText",value:function _modifiedText(t){return _get(_getPrototypeOf(oi.prototype),"_modifiedText",this).call(this,t).toUpperCase();}},{key:"generateLayoutData",value:function generateLayoutData(t,e){this._options.hasMaskedText=false;return _get(_getPrototypeOf(oi.prototype),"generateLayoutData",this).call(this,t,e);}},{key:"_randomLayoutRow",value:function _randomLayoutRow(t,e,r,o){if(t.size()<3){var s=this._rowTypeLessThan3WordsRandomizer.nextInRange(0,2)===0;return this._layoutRow(t,r,o,s);}var n=this._rowTypeMoreThan3WordsRandomizer.nextInRange(0,3);switch(n){case 0:return new No({words:t,width:r,attributes:o,orientation:No.Orientations.Left});case 1:return new No({words:t,width:r,attributes:o,orientation:No.Orientations.Right});case 2:return this._layoutRow(t,r,o,true);case 3:return new xe({words:t,width:r,attributes:o});default:throw new Error("TextDesignBlocks#_randomLayoutRow: Invalid randomValue generated: ".concat(n,"."));}}},{key:"_layoutRow",value:function _layoutRow(t,e,r,o){if(this.getHasMaskedText()){o=false;}if(o){this.setHasMaskedText(true);var n=this._banderolesRandomizer.pickNext(this.getBanderoles());var s=new js({words:t,width:e,attributes:new ao({alignment:"left",fontIdentifier:n.getFontIdentifier()}),image:n.getImage(),imageInsets:n.insetsForWidth(e),capInsets:null,backgroundColor:G.WHITE});if(n.getNeedsImageSmoothingFix()){s.serverImageSmoothingFix=true;}return s;}return new xe({words:t,width:e,attributes:r});}}]);return oi;}(ri);q(oi,"defaultFontIdentifiers",["imgly_font_outfit_bold"]);q(oi,"identifier","imgly_text_design_blocks");q(oi,"defaultBanderoles",[_lr.Rectangle,_lr.Small]);oi.prototype.availableOptions=_objectSpread(_objectSpread({},ri.prototype.availableOptions),{},{fontIdentifiers:{type:"array","default":oi.defaultFontIdentifiers},relativeLineSpacing:{type:"number","default":.025/3},hasMaskedText:{type:"boolean","default":false},banderoles:{type:"array","default":oi.defaultBanderoles}});});var vc;var eU=d(function(){$();lo();Jd();vc=/*#__PURE__*/function(_oi){_inherits(vc,_oi);var _super150=_createSuper(vc);function vc(){var _this195;_classCallCheck(this,vc);for(var _len86=arguments.length,t=new Array(_len86),_key86=0;_key86<_len86;_key86++){t[_key86]=arguments[_key86];}_this195=_super150.call.apply(_super150,[this].concat(t));_this195._exclusiveFont=null;return _this195;}_createClass(vc,[{key:"generateLayoutData",value:function generateLayoutData(t,e){this._exclusiveFont=this._fontRandomizer.pickNext(this.getFontIdentifiers());return _get(_getPrototypeOf(vc.prototype),"generateLayoutData",this).call(this,t,e);}},{key:"_fontForRow",value:function _fontForRow(t,e){return this._exclusiveFont||_get(_getPrototypeOf(vc.prototype),"_fontForRow",this).call(this,t,e);}},{key:"_layoutRow",value:function _layoutRow(t,e,r,o){return new xe({words:t,width:e,attributes:r});}}]);return vc;}(oi);q(vc,"defaultFontIdentifiers",["imgly_font_ostrich_sans_heavy","imgly_font_ostrich_sans_bold","imgly_font_ostrich_sans_black"]);q(vc,"identifier","imgly_text_design_blocks_condensed");vc.prototype.availableOptions=_objectSpread(_objectSpread({},oi.prototype.availableOptions),{},{fontIdentifiers:{type:"array","default":vc.defaultFontIdentifiers}});});var Bh,_sl,cr;var PT=d(function(){$();ol();An();xc();Rh();Bh=J.Rectangle;_sl=/*#__PURE__*/function(_ar3){_inherits(sl,_ar3);var _super151=_createSuper(sl);function sl(){var _this196;_classCallCheck(this,sl);for(var _len87=arguments.length,t=new Array(_len87),_key87=0;_key87<_len87;_key87++){t[_key87]=arguments[_key87];}_this196=_super151.call.apply(_super151,[this].concat(t));_this196.setSize(new _e8(_this196.getWidth(),_this196.getHeight()));return _this196;}_createClass(sl,[{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){return[new Yi({frame:this._getTextFrame()})];}},{key:"render",value:function render(t){var e=this._getFrame();var r=this.getType();var o=this.getAttributes();var n=o.getTextColor();var s=e.height/3;var a=new Bh(e.x,e.y,e.width,s);var l=new Bh(e.x,e.y+s*2,e.width,s);switch(r){case _sl.FormType.Rect:co(t,e,n);break;case _sl.FormType.DoubleRect:co(t,a,n);co(t,l,n);break;case _sl.FormType.DoubleRectFirstPunctuated:BT(t,a,n);co(t,l,n);break;case _sl.FormType.DoubleRectSecondPunctuated:co(t,a,n);BT(t,l,n);break;case _sl.FormType.LongLine:{var c=e.height/2;var u=new Bh(e.x,e.y,e.width,c);B_(t,u,u.height*.5,n);break;}case _sl.FormType.LongAndShortLine:{var _c5=e.height*.2;var _u3=_c5*.75;a=new Bh(e.x,e.y+_c5,e.width,_c5);var m=e.x+e.width*.25;var p=e.y+e.height-_u3;l=new Bh(m,p,e.width*.5,_u3);B_(t,a,a.height*.5,n);B_(t,l,l.height*.5,n);break;}default:break;}}}]);return sl;}(ar);cr=_sl;q(cr,"FormType",{Rect:"RECT",DoubleRect:"DOUBLE_RECT",DoubleRectFirstPunctuated:"DOUBLE_RECT_FIRST_PUNCTUATED",DoubleRectSecondPunctuated:"DOUBLE_RECT_SECOND_PUNCTUATED",LongLine:"LONG_LINE",LongAndShortLine:"LONG_AND_SHORT_LINE"});cr.prototype.availableOptions=_objectSpread(_objectSpread({},ar.prototype.availableOptions),{},{height:{type:"number","default":100},type:{type:"string","default":cr.FormType.Rect,available:z.values(cr.FormType)}});});var Bn;var MT=d(function(){$();lo();PT();Jd();Bn=/*#__PURE__*/function(_oi2){_inherits(Bn,_oi2);var _super152=_createSuper(Bn);function Bn(){_classCallCheck(this,Bn);return _super152.apply(this,arguments);}_createClass(Bn,[{key:"_layoutRow",value:function _layoutRow(t,e,r,o){return new xe({words:t,width:e,attributes:r});}},{key:"_layoutRows",value:function _layoutRows(t,e){var r=_get(_getPrototypeOf(Bn.prototype),"_layoutRows",this).call(this,t,e);var o=.032*e;var n=.08*e;var s=new cr({width:e,height:o,type:cr.FormType.LongLine,shearingAngle:0}).layout();var a=new cr({width:e,height:n,type:cr.FormType.LongAndShortLine,shearingAngle:0}).layout();return[s].concat(_toConsumableArray(r),[a]);}}]);return Bn;}(oi);q(Bn,"defaultFontIdentifiers",["imgly_font_sue_ellen_francisco"]);q(Bn,"identifier","imgly_text_design_blocks_light");Bn.prototype.availableOptions=_objectSpread(_objectSpread({},oi.prototype.availableOptions),{},{fontIdentifiers:{type:"array","default":Bn.defaultFontIdentifiers}});});var Cc;var iU=d(function(){$();lo();Xd();MT();Cc=/*#__PURE__*/function(_Bn){_inherits(Cc,_Bn);var _super153=_createSuper(Cc);function Cc(){_classCallCheck(this,Cc);return _super153.apply(this,arguments);}_createClass(Cc,[{key:"_layoutRows",value:function _layoutRows(t,e){var _this197=this;return t.map(function(r,o){return _this197._randomLayoutRow(r,o,e,new ao({fontIdentifier:_this197._fontForRow(o,r)})).layout();});}},{key:"_layoutRow",value:function _layoutRow(t,e,r,o){return new xe({words:t,width:e,attributes:r});}}]);return Cc;}(Bn);q(Cc,"defaultFontIdentifiers",["imgly_font_sue_ellen_francisco"]);q(Cc,"identifier","imgly_text_design_blocks_light-v3_1_0");Cc.prototype.availableOptions=_objectSpread(_objectSpread({},Bn.prototype.availableOptions),{},{fontIdentifiers:{type:"array","default":Cc.defaultFontIdentifiers}});});var Ost,_z_,Ho;var U_=d(function(){$();Kd();ol();An();xc();lo();Ost=J.Rectangle;_z_=/*#__PURE__*/function(_xe2){_inherits(z_,_xe2);var _super154=_createSuper(z_);function z_(){_classCallCheck(this,z_);return _super154.apply(this,arguments);}_createClass(z_,[{key:"getImageSize",value:function getImageSize(){var t=this.getLeftImage();var e=this.getRightImage();var r=this.getWords();var o=this.getAttributes();var n=o.getFontIdentifier();var s=t?new _e8(t.width,t.height):new _e8();var a=r.joined(1)[0];if(!a){return s;}var l=new qi({text:a,fontIdentifier:n,fontSize:50});var c=l.getSizeValue();var u=e?2:1;s.scale(u,1);var m=s.clone().fitInWidthWithOther(this._getFrame().width,c);m.scale(1/u,1);return m;}},{key:"_getTextFrame",value:function _getTextFrame(){var t=_get(_getPrototypeOf(z_.prototype),"_getTextFrame",this).call(this).clone();var e=this.getImageSize();var r=this.getRightImage();var o=this.getImagePosition();if(!r){if(o===_z_.ImagePosition.Left){t.x+=e.width;}}else{t.x+=e.width;t.width-=2*e.width;}return t;}},{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){var t=_get(_getPrototypeOf(z_.prototype),"_calculateLayoutElements",this).call(this);var e=this._getFrame();var r=this.getRightImage();var o=this.getImageSize();var n=this.getImagePosition();var s=this._getTextFrame();var a=this.getAttributes();var l=a.getFontIdentifier();var c=new qi({text:"stickerClock",fontIdentifier:l});c.fitWidth(this._getTextFrame().width);var u=new Ost().set(e.x,e.y,o.width,o.height);if(!r&&n===_z_.ImagePosition.Right){u.x+=s.width;}t.push(new Yi({text:"stickerClock",frame:u,font:c}));if(r){var m=t[0];if(m){var p=u.clone();p.translate(m.getFrame().width+p.width,0);t.push(new Yi({text:"stickerClock",frame:p,font:c}));}}return t;}},{key:"render",value:function render(t){var e=this._getLayoutElements();var r=this.getAttributes();var o=r.getTextColor();var n=this.getLeftImage();var s=this.getRightImage();var a=e[0];var l=e[1];var _a$serializeOptions=a.serializeOptions(),c=_a$serializeOptions.font;var u=this._getTextFrameForElement(a);c.draw(t,u.x,u.y,{textColor:r.getTextColor().toRGBA(),alignment:r.getAlignment()});if(n){var m=l.getFrame();t.drawImage(n,m.x,m.y,m.width,m.height);co(t,m,o,"source-atop");}if(e.length>2){var _m3=e[2];var p=_m3.getFrame().clone();t.drawImage(s,p.x,p.y,p.width,p.height);co(t,p,o,"source-atop");}}}]);return z_;}(xe);Ho=_z_;q(Ho,"ImagePosition",{Left:"LEFT",right:"RIGHT"});Ho.prototype.availableOptions=_objectSpread(_objectSpread({},xe.prototype.availableOptions),{},{leftImage:{type:"image","default":null},rightImage:{type:"image","default":null},imagePosition:{type:"string","default":Ho.ImagePosition.Left,available:[Ho.ImagePosition.Left,Ho.ImagePosition.Right]}});});var _Ph,Mr;var LT=d(function(){$();lo();U_();M_();nl();Jd();_Ph=/*#__PURE__*/function(_oi3){_inherits(Ph,_oi3);var _super155=_createSuper(Ph);function Ph(){_classCallCheck(this,Ph);return _super155.apply(this,arguments);}_createClass(Ph,[{key:"_fontForRow",value:function _fontForRow(t,e){var r=this.getFontIdentifiers();return r[t%r.length];}},{key:"_minimumNumberOfLines",value:function _minimumNumberOfLines(t){return Math.max(Math.floor(_get(_getPrototypeOf(Ph.prototype),"_minimumNumberOfLines",this).call(this,t)*.7),1);}},{key:"_maximumNumberOfLines",value:function _maximumNumberOfLines(t){return Math.max(Math.floor(t.countNumberOfCharacters()/5),1);}},{key:"_randomLayoutRow",value:function _randomLayoutRow(t,e,r,o){return this._createSingleRow(_Ph.RowType.Single,t,r,o);}},{key:"_createSingleRow",value:function _createSingleRow(t,e,r,o){var n=o.getFontIdentifier();var s=n==="imgly_font_allison_regular"||n==="imgly_font_handycheera_regular"?new _hi().set(e.getLowerCase()):e;switch(t){case _Ph.RowType.Single:return new xe({words:s,width:r,attributes:o});case _Ph.RowType.SingleImage:return new Ho({words:s,width:r,attributes:o});default:Y.warn("TextDesignCelebrate#_createSingleRow: Invalid row type '".concat(t,"'"));return null;}}}]);return Ph;}(oi);Mr=_Ph;q(Mr,"defaultFontIdentifiers",["imgly_font_handycheera_regular","imgly_font_rasa_regular"]);q(Mr,"defaultBanderoles",[_lr.Celebrate1,_lr.Celebrate2]);q(Mr,"identifier","imgly_text_design_celebrate");q(Mr,"RowType",{Single:"SINGLE",SingleImage:"SINGLE_IMAGE"});Mr.prototype.availableOptions=_objectSpread(_objectSpread({},oi.prototype.availableOptions),{},{relativeLineSpacing:{type:"number","default":.01875},fontIdentifiers:{type:"array","default":Mr.defaultFontIdentifiers},banderoles:{type:"array","default":Mr.defaultBanderoles}});});var ni;var N_=d(function(){$();Kd();nl();ol();An();Xd();xc();Rh();ni=/*#__PURE__*/function(_ar4){_inherits(ni,_ar4);var _super156=_createSuper(ni);function ni(){var _this198;_classCallCheck(this,ni);for(var _len88=arguments.length,t=new Array(_len88),_key88=0;_key88<_len88;_key88++){t[_key88]=arguments[_key88];}_this198=_super156.call.apply(_super156,[this].concat(t));_this198.setSize(new _e8(_this198.getWidth(),_this198.getHeight()));return _this198;}_createClass(ni,[{key:"_getImageFrame",value:function _getImageFrame(){var t=this._getTextFrame().clone();var e=this.getImage();if(this.getDrawingModeAspectFit()&&e){var r=Math.min(t.width/e.width,t.height/e.height);var o=e.width*r;var n=e.height*r;t.x+=(t.width-o)/2;t.y+=(t.height-n)/2;t.width=o;t.height=n;}return t;}},{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){return[new Yi({text:"",frame:this._getImageFrame(),font:new qi()})];}},{key:"render",value:function render(t){var e=this.getImage();var r=this._getImageFrame();var o=this.getAttributes();var n=o.getTextColor();Vs(t,e,r,n);}}]);return ni;}(ar);q(ni,"RowImages",{decorative1:"text-design/images/imgly_text_design_asset_decorative_01.png",decorative2:"text-design/images/imgly_text_design_asset_decorative_02.png",decorative3:"text-design/images/imgly_text_design_asset_decorative_05.png",decorative4:"text-design/images/imgly_text_design_asset_decorative_06.png",celebrate1:"text-design/images/imgly_text_design_asset_celebrate_03.png",celebrate2:"text-design/images/imgly_text_design_asset_celebrate_04.png",celebrate3:"text-design/images/imgly_text_design_asset_celebrate_05.png"});ni.prototype.availableOptions=_objectSpread(_objectSpread({},ar.prototype.availableOptions),{},{words:{type:"object","default":new _hi()},height:{type:"number","default":0},image:{type:"image","default":null},imagePath:{type:"string","default":ni.RowImages.decorative1},drawingModeAspectFit:{type:"boolean","default":false},attributes:{type:"configurable","default":new ao()}});});var Sc;var rU=d(function(){$();Br();lo();U_();N_();M_();so();nl();Jd();LT();Sc=/*#__PURE__*/function(_Mr){_inherits(Sc,_Mr);var _super157=_createSuper(Sc);function Sc(){var _this199;_classCallCheck(this,Sc);for(var _len89=arguments.length,t=new Array(_len89),_key89=0;_key89<_len89;_key89++){t[_key89]=arguments[_key89];}_this199=_super157.call.apply(_super157,[this].concat(t));q(_assertThisInitialized(_this199),"getImagePaths",function(){var t=_this199.getBanderoles();return[].concat(_toConsumableArray(t&&t.map(function(e){return e.getImagePath();})||[]),_toConsumableArray(_this199._celebrateTypes));});q(_assertThisInitialized(_this199),"onImagesLoaded",function(){var t=_this199.getBanderoles();if(t){t.forEach(function(e){var r=Kt.getImage(e.getImagePath());if(!r){Y.warn("TextDesignBlocks#onImagesLoaded: Image not found '".concat(e.getImagePath(),"'"));return;}e.setImage(r);});}});_this199._celebrateTypes=[ni.RowImages.celebrate1,ni.RowImages.celebrate2,ni.RowImages.celebrate3];_this199._exclusiveFont=null;_this199._typeRandomizer=new It(0);_this199._useMaskedRandomizer=new It(0);_this199._seedPool.push(_this199._typeRandomizer);_this199._seedPool.push(_this199._useMaskedRandomizer);return _this199;}_createClass(Sc,[{key:"_fontForRow",value:function _fontForRow(t,e){var r=this.getFontIdentifiers();return r[t%(r.length-1)];}},{key:"_layoutRows",value:function _layoutRows(t,e){var r=this._typeRandomizer.pickNext(this._celebrateTypes);var o=Kt.getImage(r);if(!o){Y.warn("TextDesignCelebrateSimple#_layoutRows: Image not fount '".concat(r,"'"));}var n=new ni({width:e,height:e*.5,drawingModeAspectFit:true,image:o}).layout();var s=_get(_getPrototypeOf(Sc.prototype),"_layoutRows",this).call(this,t,e);return[n].concat(_toConsumableArray(s));}},{key:"_randomLayoutRow",value:function _randomLayoutRow(t,e,r,o){var n=t.countNumberOfCharacters();var s=13;var a=4;if(nthis._maxWidth){if(e.length>0){t.push(e.join(""));e=[c];}var p=c.replace(/\s+$/i,"");if(this._getWidth(p)>this._maxWidth){var h=this._splitWord(c);t=t.concat(h.lines);if(h.rest){e=[h.rest];}}}else{e.push(c);}}t.push(e.join(""));e=[];}return t.map(function(o){return _this202._trimLine(o,_this202._context.textAlign);});}},{key:"_trimLine",value:function _trimLine(t,e){return t;}},{key:"_buildWords",value:function _buildWords(t){var e=[];var r="";var o=t.length;for(var n=0;nthis._maxWidth){if(n.length>0){e.lines.push(n.join(""));}n=[a];}else{n.push(a);}if(s===o-1&&n.length>0){e.rest=n.join("");}}return e;}},{key:"_fontStyleChanged",value:function _fontStyleChanged(){if(this._context.font!==this._lastFontStyle){this._lastFontStyle=this._context.font;return true;}return false;}},{key:"_getWidth",value:function _getWidth(t){return this._context.measureText(t).width;}},{key:"setText",value:function setText(t){this._text=t;this._lines=t.split("\n");}},{key:"setMaxWidth",value:function setMaxWidth(t){this._maxWidth=t;}}]);return BU;}();rx=BU;});var WT,PU,GT;var VT=d(function(){$();HT();WT=J.Vector2;PU=/*#__PURE__*/function(){function PU(t,e){_classCallCheck(this,PU);this._text=t;this._operation=e;this._textOptions={};this.rotation=0;this._createCanvas();this._createTexture();}_createClass(PU,[{key:"_createCanvas",value:function _createCanvas(){this._canvas=z.createCanvas();this._context=this._canvas.getContext("2d");this._textSplitter=new rx(this._context);this._finalCanvas=z.createCanvas();this._finalContext=this._finalCanvas.getContext("2d");}},{key:"_createTexture",value:function _createTexture(){this._texture=L.Texture.fromCanvas(this._canvas);this._finalTexture=L.Texture.fromCanvas(this._finalCanvas);}},{key:"_applyTextOptions",value:function _applyTextOptions(t,e){e.font="".concat(this._text.getFontStyle()," ").concat(this._text.getFontWeight()," ").concat(t.fontSize,"px \"").concat(this._text.getFontFamily(),"\"");if(this._text.getTextMetrics()){e.textBaseline="alphabetic";}else{e.textBaseline="top";}e.textAlign=this._text.getAlignment();e.fillStyle=this._text.getColor().toRGBA();e.strokeStyle=this._text.getOutlineColor().toRGBA();var r=this._text.getOutlineWidth();if(r>0){e.lineWidth=r;}}},{key:"_buildOutputLines",value:function _buildOutputLines(t){this._textSplitter.setText(this._text.getText());this._textSplitter.setMaxWidth(t);return this._textSplitter.getLines().map(function(e){return e.replace(/\s+$/i,"");});}},{key:"_renderTextLine",value:function _renderTextLine(t,e,r){var o=this._text.getAlignment();var n=new WT(0,e);switch(o){case"left":n.x=r;break;case"center":n.x=this._canvas.width/2;break;case"right":n.x=this._canvas.width-r;break;}this._context.save();this._context.translate(n.x,n.y);this._context.fillText(t,0,0);this._context.restore();var s=this._text.getOutlineWidth();if(s>0){this._context.miterLimit=2;this._context.strokeText(t,n.x,n.y);}}},{key:"update",value:function update(t,e){var r=this.calculateFontStyles(t,e);if(r){var _this$_calculateText=this._calculateText(t,r,e),o=_this$_calculateText.dimensions,n=_this$_calculateText.lines;this._renderText(t,o,n,r,e);this._updateFinalTexture();}}},{key:"_updateFinalTexture",value:function _updateFinalTexture(){var _this$_canvas2=this._canvas,t=_this$_canvas2.width,e=_this$_canvas2.height;var r=this.rotation;var o=Math.cos(r);var n=Math.sin(r);var s=new WT(Math.abs(t*o)+Math.abs(e*n),Math.abs(t*n)+Math.abs(e*o));this._finalCanvas.width=s.x;this._finalCanvas.height=s.y;this._finalContext.save();this._finalContext.translate(this._finalCanvas.width/2,this._finalCanvas.height/2);this._finalContext.rotate(r);this._finalContext.drawImage(this._canvas,-t/2,-e/2);this._finalContext.restore();}},{key:"_renderText",value:function _renderText(t,e,r,o,n){this._canvas.width=e.x;this._canvas.height=e.y;if(this._text.getMaxHeight()){this._canvas.height=Math.min(this._text.getMaxHeight()*n.y,this._canvas.height);}this._context=this._canvas.getContext("2d");this._context.fillStyle=this._text.getBackgroundColor().toRGBA();this._context.fillRect(0,0,e.x,e.y);this._applyTextOptions(o,this._context);var s=this._padding(n);var a=this._text.getTextMetrics();var l=this._text.getFontSize()*n.y;var c=1/a.unitsPerEm*l;var u=a.ascender*c;for(var m=0;m2&&arguments[2]!==undefined?arguments[2]:true;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;_get(_getPrototypeOf(Mh.prototype),"setOption",this).call(this,t,e,r,o);if(t==="fontIdentifier"&&!o){this.updateFontVariation();}}},{key:"updateFontVariation",value:function updateFontVariation(){var t=Kt.getVariation(this.getFontIdentifier());if(!t){Y.warn("TextDesignFont: Unable to find font '".concat(this._fontIdentifier,"'"));}this.setFontVariation(t);return t;}},{key:"_applyTextOptions",value:function _applyTextOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._context;var _this$_options$t=_objectSpread(_objectSpread({},this._options),t),r=_this$_options$t.fontSize,o=_this$_options$t.fontVariation,n=_this$_options$t.lineHeight,s=_this$_options$t.textColor,a=_this$_options$t.alignment;var _o$serializeOptions2=o.serializeOptions(),l=_o$serializeOptions2.fontStyle,c=_o$serializeOptions2.fontWeight,u=_o$serializeOptions2.fontFamily;e.font="".concat(l," ").concat(c," ").concat(r,"px \"").concat(u,"\"");e.fillStyle=s;e.textBaseline="top";e.textAlign=a||"left";}},{key:"_buildOutputLines",value:function _buildOutputLines(t){this._textSplitter.setText(this.getText());this._textSplitter.setMaxWidth(t);return this._textSplitter.getLines();}},{key:"_renderTextLine",value:function _renderTextLine(t,e){var r=this.getAlignment();var o=new MU(0,e);switch(r){case"center":o.x=this._canvas.width/2;break;case"right":o.x=this._canvas.width;break;}this._context.fillText(t,o.x,o.y);}},{key:"update",value:function update(){var t=this.calculateFontStyles();if(t){var _this$_calculateText3=this._calculateText(t),e=_this$_calculateText3.dimensions,r=_this$_calculateText3.lines;this._dimensions=e;this._renderText(e,r,t);}}},{key:"draw",value:function draw(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;this.update();t.drawImage(this._canvas,e,r,this._dimensions.x,this._dimensions.y);}},{key:"_renderText",value:function _renderText(t,e,r){this._canvas.width=t.x;this._canvas.height=t.y;this._context=this._canvas.getContext("2d");this._applyTextOptions(r,this._context);for(var o=0;oc){a.x=c;a.y=Math.round(a.x/this._aspect);}if(a.y>c){a.y=c;a.x=Math.round(a.y*this._aspect);}var u=z.ensureCanvasDimensions(this._canvas,a);if(r||u){this._context.clearRect(0,0,this._canvas.width,this._canvas.height);this._renderer.draw(this._context,new _e8(a.x,a.y),this.getColor(),this.getInverted());this.setDimensions(s);this._texture.getBaseTexture().update();if(l.isOfType("webgl")){l.updateTexture(this._texture.getBaseTexture());}}_get(_getPrototypeOf(rm.prototype),"update",this).call(this,t,e);this._applyFlip();}},{key:"_applyFlip",value:function _applyFlip(){var t=this._sprite.getScale();var _this$_options31=this._options,e=_this$_options31.flipHorizontally,r=_this$_options31.flipVertically;if(e&&t.x>0||!e&&t.x<0){t.x*=-1;}if(r&&t.y>0||!r&&t.y<0){t.y*=-1;}this._sprite.setScale(t);}},{key:"_optionEquals",value:function _optionEquals(t,e){if(t==="layout"){var r=this._options.layout;if(!r&&e||!e&&r){return false;}if(!e.constructor||!r.constructor){return false;}if(r.constructor.identifier!==e.constructor.identifier){return false;}return true;}return _get(_getPrototypeOf(rm.prototype),"_optionEquals",this).call(this,t,e);}},{key:"serializeOptions",value:function serializeOptions(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t&&this.getPadding()<0){var o=t.indexOf("padding");if(o>-1){t.splice(o,1);}}var r=_get(_getPrototypeOf(rm.prototype),"serializeOptions",this).call(this,t,e);if(!t)r.type="textdesign";return r;}},{key:"_getTexture",value:function _getTexture(){return this._texture;}},{key:"canBeFlippedHorizontally",value:function canBeFlippedHorizontally(){return false;}},{key:"canBeDuplicated",value:function canBeDuplicated(){return true;}},{key:"canMaskCanvas",value:function canMaskCanvas(){return true;}},{key:"canAdjustPadding",value:function canAdjustPadding(){return true;}},{key:"dispose",value:function dispose(){this._isDisposed=true;this._texture.dispose();this._sprite.dispose();}}]);return rm;}(On);rm.Layouts={TextDesignBlocks:oi,TextDesignBlocksCondensed:vc,TextDesignBlocksLight:Bn,TextDesignCelebrate:Mr,TextDesignCelebrateSimple:Sc,TextDesignEqualWidth:Mn,TextDesignEqualWidthFat:Tc,TextDesignMasked:ke,TextDesignMaskedBadge:cl,TextDesignMaskedSpeechBubble:Lr,TextDesignMaskedSpeechBubbleComic:Ic,TextDesignMultiline:Dc,TextDesignWatercolor:Fc,TextDesignSunshine:vi,TextDesignParticles:$s,TextDesignRotated:Ec};rm.LegacyLayouts={TextDesignBlocksLightV310:Cc,TextDesignSunshineV310:cx};rm.AssetManager=Kt;rm.prototype.availableOptions={id:{type:"string","default":function _default(){return z.getUUID();}},position:{type:"vector2","default":new ml(.5,.5)},dimensions:{type:"vector2","default":ml.NULL},anchor:{type:"vector2","default":new ml(0,0)},pivot:{type:"vector2","default":new ml(.5,.5)},rotation:{type:"number","default":0},flipHorizontally:{type:"boolean","default":false},flipVertically:{type:"boolean","default":false},layout:{type:"object","default":null,setter:function setter(i){this._isLayoutDirty=true;return i;}},text:{type:"string","default":"",setter:function setter(i){this._isLayoutDirty=true;return i;}},color:{type:"color","default":G.BLACK,setter:function setter(i){this._isLayoutDirty=true;return i;}},padding:{type:"number","default":.01,minValue:.01},width:{type:"number","default":.8},inverted:{type:"boolean","default":false,setter:function setter(i){this._isLayoutDirty=true;return i;}},seed:{type:"number","default":-1}};dx=rm;});var $T,mx,px;var ZU=d(function(){$();$d();VT();$T=J.Vector2;mx=/*#__PURE__*/function(_On4){_inherits(mx,_On4);var _super181=_createSuper(mx);function mx(){var _this218;_classCallCheck(this,mx);for(var _len102=arguments.length,t=new Array(_len102),_key102=0;_key102<_len102;_key102++){t[_key102]=arguments[_key102];}_this218=_super181.call.apply(_super181,[this].concat(t));_this218._textRenderer=new GT(_assertThisInitialized(_this218),_this218._operation);_this218._textRenderer.rotation=_this218.getRotation();_this218._sprite.setTexture(_this218._textRenderer.getFinalTexture());_this218._hitTestSprite.setTexture(_this218._textRenderer.getTexture());return _this218;}_createClass(mx,[{key:"serializeOptions",value:function serializeOptions(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=_get(_getPrototypeOf(mx.prototype),"serializeOptions",this).call(this,t,e);if(!t)r.type="text";return r;}},{key:"getDOMStyle",value:function getDOMStyle(t,e){var r=this.getFontSize()*e.y;return{fontWeight:this._options.fontWeight,fontSize:"".concat(r,"px"),fontStyle:this._options.fontStyle,fontFamily:this._options.fontFamily,lineHeight:"".concat(this.getAbsoluteTextHeight(e)*this.getLineHeight(),"px"),color:this._options.color.toRGBA(),backgroundColor:this._options.backgroundColor.toRGBA(),textAlign:this._options.alignment};}},{key:"getAbsoluteTextHeight",value:function getAbsoluteTextHeight(t){var e=this.getFontSize()*t.y;var r=this.getTextMetrics();if(r){var o=1/r.unitsPerEm*e;var n=r.ascender*o;var s=r.descender*o;return n+Math.abs(s);}return e*this.getLineHeight()*1.1;}},{key:"getDimensions",value:function getDimensions(t,e){return this._textRenderer.getDimensions(t,e);}},{key:"applyFlip",value:function applyFlip(t){_get(_getPrototypeOf(mx.prototype),"applyFlip",this).call(this,t);var e=this._options.rotation;switch(t){case"horizontal":e+=(Math.PI-e)*2;this.setRotation(e);break;case"vertical":e+=(Math.PI/2-e)*2;this.setRotation(e);break;}}},{key:"applyTransform",value:function applyTransform(t){_get(_getPrototypeOf(mx.prototype),"applyTransform",this).call(this,t);this.set({fontSize:t.scaleSize(this.getFontSize(),"y"),maxWidth:t.scaleSize(this.getMaxWidth(),"x")},false);}},{key:"applyRotation",value:function applyRotation(t){_get(_getPrototypeOf(mx.prototype),"applyRotation",this).call(this,t);var e=(t+360)%360;var r=this._operation.getInputDimensions();if(e===90||e===270){this.setMaxWidth(this.getMaxWidth()/r.x*r.y);this.setFontSize(this.getFontSize()/r.y*r.x);}}},{key:"setOption",value:function setOption(t,e){var _this$_options32=this._options,r=_this$_options32.flipHorizontally,o=_this$_options32.flipVertically;if(t==="rotation"){var n=e;if(r){n=Math.PI*2-n;}if(o){n=Math.PI*2-n;}this._options.rotation=n;if(this._textRenderer){this._textRenderer.rotation=n;}this._rotation=n;this.emit("update");return;}_get(_getPrototypeOf(mx.prototype),"setOption",this).call(this,t,e);}},{key:"getOption",value:function getOption(t){if(t==="rotation"){return this._rotation;}return _get(_getPrototypeOf(mx.prototype),"getOption",this).call(this,t);}},{key:"getHitTestDisplayObject",value:function getHitTestDisplayObject(){return this._hitTestSprite;}},{key:"update",value:function update(t,e){this._sprite.setVisible(this._options.visible);if(!this._options.visible)return;this._textRenderer.update(t,e);var r=this._textRenderer.getFinalTexture();var o=r.getBaseTexture();o.update();var n=t.getRenderer();if(n.isOfType("webgl")){n.updateTexture(r.getBaseTexture());}_get(_getPrototypeOf(mx.prototype),"update",this).call(this,t,e);this._sprite.setRotation(0);this._textRenderer.getTexture().getBaseTexture().update();this._hitTestSprite.setRotation(this._rotation);this._hitTestSprite.updateTransform();this._applyFlip();}},{key:"_applyFlip",value:function _applyFlip(){var t=this._sprite.getScale();var _this$_options33=this._options,e=_this$_options33.flipHorizontally,r=_this$_options33.flipVertically;if(e&&t.x>0||!e&&t.x<0){t.x*=-1;this.setRotation(this._rotation);}if(r&&t.y>0||!r&&t.y<0){t.y*=-1;this.setRotation(this._rotation);}this._sprite.setScale(t);}},{key:"_getTexture",value:function _getTexture(){return this._textRenderer.getFinalTexture();}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(mx.prototype),"dispose",this).call(this);this._textRenderer.dispose();this._hitTestSprite.dispose();this._sprite.dispose();}},{key:"canBeFlippedHorizontally",value:function canBeFlippedHorizontally(){return false;}},{key:"canAdjustPadding",value:function canAdjustPadding(){return false;}}]);return mx;}(On);mx.prototype.availableOptions={id:{type:"string","default":function _default(){return z.getUUID();}},fontSize:{type:"number","default":.1},characterSpacing:{type:"number","default":0},lineHeight:{type:"number","default":1.1},fontIdentifier:{type:"string"},fontFamily:{type:"string","default":"Times New Roman"},fontWeight:{type:"*","default":"normal"},fontStyle:{type:"string","default":"normal"},textMetrics:{type:"object","default":null},outlineWidth:{type:"number","default":0},outlineColor:{type:"color","default":G.BLACK},alignment:{type:"string","default":"left",available:["left","center","right"]},verticalAlignment:{type:"string","default":"top",available:["top","center","bottom"]},color:{type:"color","default":new G(1,0,0,1)},backgroundColor:{type:"color","default":G.TRANSPARENT},position:{type:"vector2","default":new $T(.5,.5)},anchor:{type:"vector2","default":new $T(0,0)},pivot:{type:"vector2","default":new $T(.5,.5)},rotation:{type:"number","default":0},text:{type:"string",required:true},maxWidth:{type:"number","default":.5},maxHeight:{type:"number","default":0},visible:{type:"boolean","default":true},flipHorizontally:{type:"boolean","default":false},flipVertically:{type:"boolean","default":false}};mx.type="text";px=mx;});var KT,Ks,QU;var t7=d(function(){$();$d();OT();X9();JU();ZU();KT=J.Vector2;Ks=/*#__PURE__*/function(_Lt15){_inherits(Ks,_Lt15);var _super182=_createSuper(Ks);function Ks(){var _this219;_classCallCheck(this,Ks);for(var _len103=arguments.length,t=new Array(_len103),_key103=0;_key103<_len103;_key103++){t[_key103]=arguments[_key103];}_this219=_super182.call.apply(_super182,[this].concat(t));_this219.setSmoothDownscaling(_this219._sdk.getOptions().smoothDownscaling);_this219._onSpriteUpdate=_this219._onSpriteUpdate.bind(_assertThisInitialized(_this219));_this219._maskCanvas=z.createCanvas();var e=_this219._options.sprites.slice();e.forEach(function(r){_this219.removeSprite(r);_this219.addSprite(r);});return _this219;}_createClass(Ks,[{key:"getSpritesOfType",value:function getSpritesOfType(t){return this._options.sprites.filter(function(e){return e instanceof t;});}},{key:"rotate",value:function rotate(t){this._options.sprites.forEach(function(e){e.applyRotation(t);});}},{key:"flip",value:function flip(t){this._options.sprites.forEach(function(e){e.applyFlip(t);});}},{key:"_onSpriteUpdate",value:function _onSpriteUpdate(t,e){this.emit("update",this);this.setDirty(true);}},{key:"_applyRotation",value:function _applyRotation(t,e){this._options.sprites.forEach(function(r){return r.applyRotation(t,e);});}},{key:"transform",value:function transform(t){this._options.sprites.forEach(function(e){return e.applyTransform(t);});}},{key:"scale",value:function scale(t){this._options.sprites.forEach(function(e){return e.applyScale(t);});}},{key:"serializeOption",value:function serializeOption(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t==="sprites"){return this._options.sprites.map(function(r){return r.serializeOptions(void 0,e);});}return _get(_getPrototypeOf(Ks.prototype),"serializeOption",this).call(this,t,e);}},{key:"createSticker",value:function createSticker(t){return new A_(this,t);}},{key:"createText",value:function createText(t){return new px(this,t);}},{key:"createBrush",value:function createBrush(t){return new yc(this,t);}},{key:"createTextDesign",value:function createTextDesign(t){return new dx(this,t);}},{key:"addSprite",value:function addSprite(t){this._options.sprites.push(t);var e=this.getSmoothDownscaling();if(t.setSmoothDownscaling)t.setSmoothDownscaling(e);this._container.addChild(t.getDisplayObject());this.setDirty(true);t.on("update",this._onSpriteUpdate);this.emit("update",this,this._options.sprites);}},{key:"removeSprite",value:function removeSprite(t){var e=this._options.sprites;var r=e.indexOf(t);if(r!==-1){t.off("update",this._onSpriteUpdate);this._container.removeChild(t.getDisplayObject());e.splice(r,1);this.setDirty(true);return true;}return false;}},{key:"_getOrientatedStageSize",value:function _getOrientatedStageSize(){var t=this._sdk.getSprite().getTexture().getFrame();var e=this._sdk.getOperationsStack().getByIdentifier("orientation");if(e){var o=e?e.getRotation():0;var n=o===270||o===90;return n?new KT(t.height,t.width):new KT(t.width,t.height);}var r=this._sdk.getOperationsStack().getByIdentifier("output");if(r){return r.getOutputResolution();}return new KT(t.width,t.height);}},{key:"_render",value:function _render(t){var _this220=this;var e=this._container;var r=this._options.sprites;var o=t.getDimensions().clone().floor();var n=new L.Container();n.addChild(this._sprite);return Promise.all(r.map(function(s){return s.validateSettings();})).then(function(){r.forEach(function(s){return s.update(_this220._sdk,o);});}).then(function(){_this220._renderTexture.clear();r.forEach(function(s){if(s.getInverted&&s.getInverted()){_this220._renderTexture.render(n);_this220._renderTexture.render(_this220._renderMaskedSprite(s.getDisplayObject(),s.getColor?s.getColor():G.WHITE,s.getPadding?s.getPadding():-1));n=new L.Container();}else{n.addChild(s.getDisplayObject());}});_this220._renderTexture.render(n);e.addChild(_this220._sprite);r.forEach(function(s){return e.addChild(s.getDisplayObject());});});}},{key:"_renderMaskedSprite",value:function _renderMaskedSprite(t,e,r){var o=this._maskCanvas;var n=t.getWorldTransform();var s=this._getOrientatedStageSize();z.ensureCanvasDimensions(o,s);var a=o.getContext("2d");a.clearRect(0,0,o.width,o.height);a.save();a.fillStyle=e.toRGBA();if(r<0){a.fillRect(0,0,s.x,s.y);}else{var u=Math.abs(t.getWidth()/t.getScale().x);var m=Math.abs(t.getHeight()/t.getScale().y);var p=u*r;a.transform(n.a,n.b,n.c,n.d,n.tx,n.ty);a.fillRect(-p,-p,u+p*2,m+p*2);}a.restore();a.save();a.globalCompositeOperation="destination-out";t._renderCanvas({getCurrentRenderTarget:function getCurrentRenderTarget(){return{getPixelRatio:function getPixelRatio(){return 1;}};},beforeDraw:function beforeDraw(u){var m=t.getWidth();var p=t.getHeight();var h=t.getScale();var g=h.x<0;var x=h.y<0;u.translate(m,p);u.scale(g?-1:1,x?-1:1);u.translate(-m,-p);},getContext:function getContext(){return a;}});a.restore();var l=new L.Container();var c=new L.Sprite(L.Texture.fromCanvas(o));l.addChild(c);return l;}},{key:"takeSpriteToFront",value:function takeSpriteToFront(t){var e=this._options.sprites;var r=e.indexOf(t);if(r===-1)return;z.moveArrayItem(e,r,e.length-1);var o=t.getDisplayObject();this._container.removeChild(o);this._container.addChild(o);this.setDirty(true);}},{key:"getSpritesAtPosition",value:function getSpritesAtPosition(t,e){var _this221=this;var r=[];this._options.sprites.forEach(function(u){return u.update(_this221._sdk,e);});var o=this._sdk.getSprite();var n=o.getWorldTransform().applyInverseToVector(t);var _o$getTexture$getFram=o.getTexture().getFrame(),s=_o$getTexture$getFram.width,a=_o$getTexture$getFram.height;var l=o.getAnchor().clone().multiply(-s,-a);n.subtract(l);var c=this._options.sprites.slice(0).reverse();for(var u=0,m=c.length;u1&&arguments[1]!==undefined?arguments[1]:"y";return t/this._sizeFactor[e];}},{key:"applyToRotation",value:function applyToRotation(t){return(t+this._rotationDelta)%(Math.PI*2);}},{key:"invert",value:function invert(){var t=this._options.start.clone();var e=this._options.end.clone();var r=this._inputDimensions;var o=-this._rotationDelta;var n=Math.cos(o);var s=Math.sin(o);var a=this._oldAbsoluteSize;var l=this._newAbsoluteSize;var c=t.clone().subtract(e).multiply(r);var u=1/this._scaleRatio;var m=new e7(1/this._sizeFactor.x,1/this._sizeFactor.y);var p=1/this._textureScaleFactor;var h=this._oldOptions;this._oldOptions=this._options;this._options=h;this._inputDimensions=r;this._rotationDelta=o;this._deltaCos=n;this._deltaSin=s;this._oldAbsoluteSize=l;this._newAbsoluteSize=a;this._absoluteStartDiff=c;this._scaleRatio=u;this._sizeFactor=m;this._textureScaleFactor=p;return this;}}]);return i7;}();r7=i7;});var XT,om,n7;var s7=d(function(){$();o7();XT=J.Vector2;om=/*#__PURE__*/function(_Lt16){_inherits(om,_Lt16);var _super183=_createSuper(om);function om(){_classCallCheck(this,om);return _super183.apply(this,arguments);}_createClass(om,[{key:"_render",value:function _render(t){this._sprite.setRotation(0);var e=t.getDimensions();var _this$_options34=this._options,r=_this$_options34.start,o=_this$_options34.end,n=_this$_options34.rotation,s=_this$_options34.textureScale;var a=o.clone().subtract(r);var l=a.clone().divide(2);var c=r.clone().add(l);var u=this.calculateScale();var m=u*s;var p=e.clone().multiply(m).multiply(l);this._sprite.setAnchor(c);this._sprite.setRotation(n);this._sprite.setScale(m,m);this._sprite.setPosition(p);this._renderTexture.render(this._container);return Promise.resolve();}},{key:"calculateScale",value:function calculateScale(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._options.rotation;var e=this.getInputDimensions(false);var r=new XT(Math.abs(e.x*Math.cos(t))+Math.abs(e.y*Math.sin(t)),Math.abs(e.x*Math.sin(t))+Math.abs(e.y*Math.cos(t)));var o=e.clone().subtract(r.clone()).divide(2).abs();var n=1;if(o.y>o.x){n=o.y*2/e.y+1;}else{n=o.x*2/e.x+1;}return n;}},{key:"getNewDimensions",value:function getNewDimensions(t){var _this$_options35=this._options,e=_this$_options35.start,r=_this$_options35.end,o=_this$_options35.textureScale;var n=this.calculateScale();var s=t.clone().multiply(o*n).multiply(r.clone().subtract(e));return s.round();}},{key:"flip",value:function flip(t){var _this$_options36=this._options,e=_this$_options36.start,r=_this$_options36.end;var o=e.clone();if(t==="horizontal"){e.set(1-r.x,e.y);r.set(1-o.x,r.y);}else if(t==="vertical"){e.set(e.x,1-r.y);r.set(r.x,1-o.y);}}},{key:"rotate",value:function rotate(t){var _this$_options37=this._options,e=_this$_options37.start,r=_this$_options37.end;var o=(t+360)%360;var n=Math.floor(o/90);for(var s=0;s2&&arguments[2]!==undefined?arguments[2]:{};var r=this.fetch(i,t);if(!r){Y.info("Utils#translate","Unable to translate `".concat(t,"`"));return null;}for(var o in e){r=r.replace("${".concat(o,"}"),e[o]);}return r;},fetch:function fetch(i,t,e){t=t.replace(/\[(\w+)]/g,".$1");t=t.replace(/^\./,"");var r=t.split(".");for(var o=0;o2&&arguments[2]!==undefined?arguments[2]:null;if(!e)e=function e(o){return o;};var r=[];t.forEach(function(o){i.forEach(function(n){var s=e(n);if(s===o){r.push(n);}});});return r;},getJSONP:function getJSONP(i){var t=new ro(i);return t.load();},cloneCategories:function cloneCategories(i,t){return i.map(function(e){e=olt.clone(e);e[t]=e[t].slice(0);return e;});},mergeCategories:function mergeCategories(i,t,e){i=this.cloneCategories(i,e);var r=null;t.forEach(function(o){i.forEach(function(n){if(o.identifier===n.identifier){r=n;}});if(!r){i.push(o);}else{r[e]=r[e].concat(o[e]);}});return i;},wrapFiltersInCategories:function wrapFiltersInCategories(i,t){return i.map(function(e){var r=e;if(!(t in r)){r=_defineProperty({identifier:"imgly_filters_wrapped-".concat(e.identifier),displayFlat:true},t,[e]);}return r;});},getStyleObject:function getStyleObject(i){var t=window.getComputedStyle(i);var e={};for(var r in t){var o=t.getPropertyValue(r);var n=r.replace(/-([a-z])/g,function(s,a){return a.toUpperCase();});if(o!==""){e[n]=o;}}return e;},styleElement:function styleElement(i,t){for(var e in t){i.style[e]=t[e];}},debounce:function debounce(i,t,e){var r;return function(){var _this225=this;for(var _len105=arguments.length,o=new Array(_len105),_key105=0;_key105<_len105;_key105++){o[_key105]=arguments[_key105];}var n=function n(){r=null;if(!e)i.apply(_this225,o);};var s=e&&!r;clearTimeout(r);r=setTimeout(n,t);if(s)i.apply(this,o);};},getScrollbarWidth:function getScrollbarWidth(){var i=document.createElement("div");i.style.visibility="hidden";i.style.width="100px";i.style.msOverflowStyle="scrollbar";document.body.appendChild(i);var t=i.offsetWidth;i.style.overflow="scroll";var e=document.createElement("div");e.style.width="100%";i.appendChild(e);var r=e.offsetWidth;i.parentNode.removeChild(i);return t-r;},findIntegerFraction:function findIntegerFraction(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100;var e=Number.MAX_VALUE;var r=0;var o=0;var n=1;var s=1;for(var a=0;a0){s++;}else{return new hx(n,s);}var c=Math.abs(n/s-i);if(c1&&arguments[1]!==undefined?arguments[1]:2;var e=i.toFixed(t);return parseFloat(e);},capitalize:function capitalize(i){return i.charAt(0).toUpperCase()+i.slice(1);},flipObject:function flipObject(i){var t={};for(var e in i){t[i[e]]=e;}return t;},Browser:C7};Ji=nlt;});var qT,Ut,m9t,zh,p9t,h9t,Jt,pl,YT,st,f9t,Dt,g9t,b9t,y9t;var ue=d(function(){Ln();ph();_d();zo();v7();w7();var _ft=ft;qT=_ft.Base64;var _ft2=ft;Ut=_ft2.Color;m9t=ft.Math.ColorMatrix;var _ft3=ft;zh=_ft3.EventEmitter;var _ft4=ft;p9t=_ft4.EXIF;var _ft5=ft;h9t=_ft5.OptionType;Jt=ft.Utils;var _ft6=ft;pl=_ft6.RenderType;var _ft7=ft;YT=_ft7.ImageFormat;st=ft;var _ft8=ft;f9t=_ft8.UniformType;Dt=ft.Math.Vector2;g9t=ft.Math.Rectangle;b9t=ft.Math.Range;y9t=typeof window!=="undefined"&&window.performance&&window.performance.now?window.performance.now.bind(window.performance):nh();});var _nm,Oc;var JT=d(function(){ue();_nm=/*#__PURE__*/function(){function nm(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;_classCallCheck(this,nm);this._ui=t;this._options=e;this._categoriesById={};this._filtersByIdentifier={identity:st.Operations.FilterOperation.Filters.IdentityFilter};this._categories=Ji.wrapFiltersInCategories(zs.DEFAULTS.FILTERS.slice(0),_nm.CATEGORY_ITEMS_PROPERTY);this._customAssetsAllowed=r||t.getEditor().getSDK()._l.areCustomAssetsAllowed();if(this._customAssetsAllowed&&this._options.categories){this._options.categories=Ji.wrapFiltersInCategories(this._options.categories,_nm.CATEGORY_ITEMS_PROPERTY);}this._initCategories();}_createClass(nm,[{key:"instantiateFilterWithIdentifier",value:function instantiateFilterWithIdentifier(t){var _this226=this;var e={value:this._ui._options.crossOrigin,cors:true};var r=this.getFilterByIdentifier(t);if(!r){return Promise.reject(new Error("Unknown filter with identifier `".concat(t,"`!")));}if(!(r.prototype instanceof st.Operations.FilterOperation.Filter)){var o=r.lutImage,n=r.resolution,s=r.horizontalTileCount,a=r.verticalTileCount;var l=r.lightColor,c=r.darkColor;if(l&&c){l=Ut.fromHex(l);c=Ut.fromHex(c);return Promise.resolve(new st.Operations.FilterOperation.Filters.DuoToneFilter({lightColor:l,darkColor:c}));}var u;if(this._ui.getPreloader){u=this._ui.getPreloader().getAsset(o);}var m;if(u){m=Promise.resolve(u);}else{m=Wi.loadImage(this._ui.getAssetPath(o),e);}return m.then(function(){return Wi.loadImage(_this226._ui.getAssetPath(o),e).then(function(p){return new st.Operations.FilterOperation.Filters.ThreeDLUTFilter({image:p,resolution:n,horizontalTileCount:s,verticalTileCount:a});});});}return Promise.resolve(new r());}},{key:"_initCategories",value:function _initCategories(){var _this227=this;if(this._customAssetsAllowed&&this._options.categories){if(this._options.replaceCategories){this._categories=Ji.wrapFiltersInCategories(this._options.categories,_nm.CATEGORY_ITEMS_PROPERTY);}else{this._categories=Ji.mergeCategories(this._categories,this._options.categories,_nm.CATEGORY_ITEMS_PROPERTY);}}if(this._customAssetsAllowed&&this._options.availableFilters){var e=[];this._categories.forEach(function(r){var o=r.filters.filter(function(n){return _this227._options.availableFilters.indexOf(n.identifier)!==-1;});if(o.length>0){e.push({identifier:r.identifier,defaultName:r.defaultName,filters:o});}});this._categories=e;}var t={identifier:"all",defaultName:"All",visible:false,filters:this._categories.length<=0?[]:this._categories.map(function(e){return e.filters;}).reduce(function(e,r){return e.concat(r);})};this._categories.unshift(t);this._categoriesById.all=t;this._categories.forEach(function(e){_this227._categoriesById[e.identifier]=e;});t.filters.forEach(function(e){_this227._filtersByIdentifier[e.identifier]=e;});}},{key:"getFiltersForCategory",value:function getFiltersForCategory(t){if(!this._categoriesById[t]){throw new Error("Unknown filter category '".concat(t,"'"));}return this._categoriesById[t].filters;}},{key:"getItemsByCategory",value:function getItemsByCategory(t){return this.getFiltersForCategory(t);}},{key:"getFilterByIdentifier",value:function getFilterByIdentifier(t){return this._filtersByIdentifier[t];}},{key:"getCategories",value:function getCategories(){return this._categories;}},{key:"getCategoryByIdentifier",value:function getCategoryByIdentifier(t){return this._categoriesById[t];}}]);return nm;}();Oc=_nm;q(Oc,"CATEGORY_ITEMS_PROPERTY","filters");});var Uh;var T7=d(function(){Ln();Uh=/*#__PURE__*/function(_t27){_inherits(Uh,_t27);var _super185=_createSuper(Uh);function Uh(){_classCallCheck(this,Uh);return _super185.apply(this,arguments);}return Uh;}(_t);Uh.prototype.availableOptions={fontFamily:{type:"string",required:true},variations:{type:"array",required:true}};});var slt,Rc;var ZT=d(function(){Ln();slt={100:"Extra Light",200:"Light",300:"Book",400:"Regular",500:"Medium",600:"Semibold",700:"Bold",800:"Black",900:"Extra Black",bold:"Bold",normal:"Regular"};Rc=/*#__PURE__*/function(_t28){_inherits(Rc,_t28);var _super186=_createSuper(Rc);function Rc(){_classCallCheck(this,Rc);return _super186.apply(this,arguments);}_createClass(Rc,[{key:"getLabel",value:function getLabel(){var t=slt[this._options.fontWeight];switch(this._options.fontStyle){case"italic":t+=" Italic";break;}return t;}}]);return Rc;}(_t);Rc.prototype.availableOptions={identifier:{type:"string",required:true},fontFamily:{type:"string",required:true},fontWeight:{type:"*","default":400},fontStyle:{type:"string","default":"normal"},textMetrics:{type:"object","default":null},provider:{type:"string",available:["google","file"]},filePath:{type:"string"},"default":{type:"boolean","default":false},font:{type:"object"}};});var Di;var hl=d(function(){ue();T7();ZT();zo();XC();Di=/*#__PURE__*/function(){function Di(t,e){_classCallCheck(this,Di);this._ui=t;this._options=e;this._fonts=[];this._variationsByIdentifier={};this._fontsByFontFamily={};this._initFonts();}_createClass(Di,[{key:"_initFonts",value:function _initFonts(){var _this228=this;var _this$_options39=this._options,t=_this$_options39.fonts,e=_this$_options39.replaceFonts,r=_this$_options39.availableVariations,o=_this$_options39.isTextDesign;var n=true;if(true){n=this._ui.getEditor().getSDK()._l.areCustomAssetsAllowed();}if(t&&n){t.forEach(function(_ref115,c){var l=_ref115.variations;if(l){l.forEach(function(u,m){if(us[u.identifier]){var p=hn(u.identifier,true);t[c].variations[m].identifier=p;var _pe$DEFAULTS$FONTS$fi=pe.DEFAULTS.FONTS.find(function(g){return g.variations.some(function(x){return x.identifier===p;});}),h=_pe$DEFAULTS$FONTS$fi.fontFamily;t[c].fontFamily=h;}});}});}var s=o?pe.DEFAULTS.TEXT_DESIGN_FONTS:pe.DEFAULTS.FONTS;if(n){if(e){s=t;}else{s=s.concat(t||[]);}}var a;s=s.map(function(l){var c=l.fontFamily;var u=l.variations;if(n&&r){u=u.filter(function(p){return r.indexOf(p.identifier)!==-1;});}if(u.length===0)return null;var m=new Uh({fontFamily:c});u=u.map(function(p){var h=new Rc(p);h.setFontFamily(c);h.setFont(m);if(p["default"]&&!a){a=h;}if(h.getTextMetrics()==null){Y.warn("Missing font metrics for ".concat(h.getIdentifier(),". The SDK will fall back to basic font rendering, which may lead to layout issues. Please provide font metrics for your custom fonts. See https://docs.photoeditorsdk.com/guides/html5/ for more details."));}_this228._variationsByIdentifier[h.getIdentifier()]=h;return h;});m.setVariations(u);_this228._fontsByFontFamily[c]=m;return m;}).filter(function(l){return l;});if(!a){var _s$0$getVariations=s[0].getVariations();var _s$0$getVariations2=_slicedToArray(_s$0$getVariations,1);a=_s$0$getVariations2[0];}this._defaultVariation=a;this._fonts=s;}},{key:"getFonts",value:function getFonts(){return this._fonts;}},{key:"getFontByFontFamily",value:function getFontByFontFamily(t){return this._fontsByFontFamily[t];}},{key:"getVariationByIdentifier",value:function getVariationByIdentifier(t){return this._variationsByIdentifier[hn(t)];}},{key:"getVariationsByIdentifier",value:function getVariationsByIdentifier(){return _objectSpread({},this._variationsByIdentifier);}},{key:"getDefaultVariation",value:function getDefaultVariation(){return this._defaultVariation;}}]);return Di;}();});var uo;var sm=d(function(){ue();uo=/*#__PURE__*/function(){function uo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,uo);this._ui=t;this._options=e;this._defaultLayouts=st.Operations.SpriteOperation.TextDesignSprite.Layouts;this._legacyLayouts=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts;this._layouts=[];this._init();}_createClass(uo,[{key:"_init",value:function _init(){var t=this._options.availableLayouts;var e=_objectSpread(_objectSpread({},this._defaultLayouts),this._legacyLayouts);this._layouts=Object.keys(e).map(function(r){return{identifier:e[r].identifier,layout:e[r]};});if(t){t.push.apply(t,_toConsumableArray(Object.values(this._legacyLayouts).map(function(r){return r.identifier;})));this._layouts=this._layouts.filter(function(r){return t.indexOf(r.identifier)>=0;});}}},{key:"getLayoutByIdentifier",value:function getLayoutByIdentifier(t){var e=Jt.Array.find(this._layouts,function(r){return r.identifier===t;});return e&&e.layout;}},{key:"getLayouts",value:function getLayouts(){return _toConsumableArray(this._layouts);}},{key:"getDefaultLayout",value:function getDefaultLayout(){return this.getLayouts()[0];}}]);return uo;}();});var Ac;var QT=d(function(){ue();Ac=/*#__PURE__*/function(){function Ac(){_classCallCheck(this,Ac);}_createClass(Ac,null,[{key:"downloadDataURL",value:function downloadDataURL(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"photoeditorsdk-export";var r=this.createBlobURLFromDataURL(t);var o=this.getExtensionFromDataURL(t);var n=document.createElement("a");n.download="".concat(e,".").concat(o);n.href=r;document.body.appendChild(n);n.click();document.body.removeChild(n);}},{key:"downloadMSBlob",value:function downloadMSBlob(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"photoeditorsdk-export";if(navigator.msSaveBlob){navigator.msSaveBlob(t,"".concat(e,".png"));}}},{key:"getExtensionFromDataURL",value:function getExtensionFromDataURL(t){var e=t.split(",")[0].split(":")[1].split(";")[0];return e.split("/").pop();}},{key:"createBlobURLFromDataURL",value:function createBlobURLFromDataURL(t){if(!window.Blob||!window.URL||!ArrayBuffer||!Uint8Array){return t;}var e=qT.decode(t.split(",")[1]);var r=t.split(",")[0].split(":")[1].split(";")[0];var o=new ArrayBuffer(e.length);var n=new Uint8Array(o);for(var a=0;a1&&arguments[1]!==undefined?arguments[1]:true;var r=_typeof(t)==="object"?t.constructor.identifier:t;var o=this._stack.getStack();t=this.get(r);delete this._map[r];var n=o.map(function(s){return s.constructor.identifier;}).indexOf(r);if(n!==-1){this._stack.removeAt(n);for(var s=n+1;s1&&arguments[1]!==undefined?arguments[1]:{};if(this._map[t]){var n=this._map[t];n.set(e,false);return n;}var r=this._available[t];var o=new r(this._sdk,e);this.add(o);return o;}},{key:"getStack",value:function getStack(){return this._stack;}},{key:"reset",value:function reset(){this._map={};}},{key:"_fixStack",value:function _fixStack(){var _this231=this;var t=this._stack.getStack().slice();this._stack.clear();t.forEach(function(e){_this231.add(e);});}}]);return gx;}();});var bx;var D7=d(function(){ue();bx=/*#__PURE__*/function(){function bx(t,e,r){_classCallCheck(this,bx);this._image=t;this._maxPixels=e;this._maxDimensions=r;}_createClass(bx,[{key:"needsResize",value:function needsResize(){var t=new Dt(this._image.width,this._image.height);var e=t.x*t.y;var r=e>this._maxPixels;var o=this._maxDimensions!==null&&(t.x>this._maxDimensions||t.y>this._maxDimensions);return r||o;}},{key:"resize",value:function resize(){var _this232=this;var t=null;var e=null;var r=this._maxDimensions;return new Promise(function(o,n){window.setTimeout(function(){var s=new Dt(_this232._image.width,_this232._image.height);var a=s.clone();if(a.x*a.y>_this232._maxPixels){a.copy(_this232._getDimensionsByMaxPixels());t="maxMegaPixels";}if(r!==null&&(a.x>r||a.y>r)){var l=Math.min(r/a.x,r/a.y);a.multiply(l);t="maxDimensions";}a.floor();e=_this232._createResizedImageCanvas(a);o({canvas:e,dimensions:a,reason:t});},1e3);});}},{key:"_createResizedImageCanvas",value:function _createResizedImageCanvas(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;var r=this._image;var o=document.createElement("canvas");o.width=t.x;o.height=t.y;var n=t.clone().subtract(e).divide(2);var s=o.getContext("2d");s.drawImage(r,0,0,r.width,r.height,n.x,n.y,e.x,e.y);return o;}},{key:"_getDimensionsByMaxPixels",value:function _getDimensionsByMaxPixels(){var t=this._image;var e=this._maxPixels;var r=t.width/t.height;var o=t.height/t.width;return new Dt(Math.sqrt(e*r),Math.sqrt(e*o)).floor();}}]);return bx;}();});var alt,llt,Nh;var E7=d(function(){ZT();alt=30;llt="abcdefghijklmnopqrstuvwxzy";Nh=/*#__PURE__*/function(){function Nh(t){_classCallCheck(this,Nh);this._fontVariation=t||new Rc({fontFamily:"Times New Roman",fontWeight:"normal",fontStyle:"normal"});this._createRuler();}_createClass(Nh,[{key:"_createRuler",value:function _createRuler(){this._ruler=document.createElement("div");this._ruler.innerText=llt;document.body.appendChild(this._ruler);this._setRulerStyle();}},{key:"_setRulerStyle",value:function _setRulerStyle(){this._ruler.style.cssText="\n position: absolute;\n top: -9999px;\n left: -9999px;\n opacity: 0;\n display: inline-block;\n font: ".concat(this._fontVariation.getFontStyle()," ").concat(this._fontVariation.getFontWeight()," ").concat(alt,"px ").concat(this._fontVariation.getFontFamily(),";\n ");}},{key:"setFontVariation",value:function setFontVariation(t){this._fontVariation=t;this._setRulerStyle();}},{key:"getWidth",value:function getWidth(){return!this._ruler?-1:this._ruler.offsetWidth;}},{key:"dispose",value:function dispose(){if(this._ruler){this._ruler.parentNode.removeChild(this._ruler);this._ruler=null;}}}]);return Nh;}();});var F7,clt,ult,yx;var O7=d(function(){E7();F7=typeof window!=="undefined"&&window.performance&&window.performance.now?window.performance.now.bind(window.performance):nh();clt=50;ult=5e3;yx=/*#__PURE__*/function(){function yx(t){_classCallCheck(this,yx);this._fontVariation=t;this._defaultFontRuler=new Nh();this._customFontRuler=new Nh(this._fontVariation);}_createClass(yx,[{key:"observe",value:function observe(){var _this233=this;var t=F7();return new Promise(function(e,r){var o=window.setInterval(function(){var n=_this233._defaultFontRuler.getWidth()!==_this233._customFontRuler.getWidth();if(n){window.clearInterval(o);return e();}if(F7()-t>=ult){var s=new Error("Failed to load font ".concat(_this233._fontVariation.getFontFamily(),"."));s.font=_this233._fontVariation;return r(s);}},clt);});}},{key:"dispose",value:function dispose(){this._defaultFontRuler.dispose();this._customFontRuler.dispose();}}]);return yx;}();});var am;var t2=d(function(){Ln();O7();am=/*#__PURE__*/function(){function am(t){_classCallCheck(this,am);this._ui=t;this._fonts=[];this._observers=[];}_createClass(am,[{key:"add",value:function add(t){this._fonts.push(t);}},{key:"load",value:function load(){var _this234=this;if(this._fonts.length===0){return Promise.resolve();}this._observers=[];this._fonts.forEach(function(t){_this234._observers.push(new yx(t));});return z.executePromises(this._observers.map(function(t){return t.observe();}));}},{key:"dispose",value:function dispose(){this._observers.forEach(function(t){return t.dispose();});}}]);return am;}();});var _x;var R7=d(function(){t2();_x=/*#__PURE__*/function(_am){_inherits(_x,_am);var _super187=_createSuper(_x);function _x(){_classCallCheck(this,_x);return _super187.apply(this,arguments);}_createClass(_x,[{key:"load",value:function load(){return Promise.resolve();}}]);return _x;}(am);});var dlt,xx;var A7=d(function(){t2();dlt={italic:"i"};xx=/*#__PURE__*/function(_am2){_inherits(xx,_am2);var _super188=_createSuper(xx);function xx(){_classCallCheck(this,xx);return _super188.apply(this,arguments);}_createClass(xx,[{key:"load",value:function load(){if(this._fonts.length){this._addStylesheetTag();}return _get(_getPrototypeOf(xx.prototype),"load",this).call(this);}},{key:"_addStylesheetTag",value:function _addStylesheetTag(){var t=this._getFamiliesString();var e=document.createElement("link");e.rel="stylesheet";e.href="https://fonts.googleapis.com/css?family=".concat(t);var r=document.getElementsByTagName("head")[0];r.appendChild(e);}},{key:"_getFamiliesString",value:function _getFamiliesString(){var t={};this._fonts.forEach(function(r){var o=r.getFontFamily();var n=r.getFontStyle();var s=r.getFontWeight();t[o]=t[o]||[];if(typeof s!=="undefined"){t[o].push("".concat(s).concat(dlt[n]||""));}else{t[o].push(400);}});var e=[];for(var r in t){var o=t[r];var n=o.length?":".concat(o.join(",")):"";var s=r.replace(" ","+")+n;e.push(s);}return e.join("|");}}]);return xx;}(am);});var fl;var vx=d(function(){R7();A7();fl=/*#__PURE__*/function(){function fl(t,e){_classCallCheck(this,fl);this._ui=t;this._fonts=e;this._loadedFonts=[];}_createClass(fl,[{key:"setFonts",value:function setFonts(t){this._fonts=t;}},{key:"needsToLoad",value:function needsToLoad(){var _this235=this;var _loop5=function _loop5(t){var e=void 0;_this235._fonts[t].getVariations().forEach(function(r){e=e||r.getProvider();});if(!e)return"continue";return{v:true};};for(var t=0;t2&&arguments[2]!==undefined?arguments[2]:false;if(!this._assetsByGroupId[t]){this._assetsByGroupId[t]=[e];}else if(r){this._assetsByGroupId[t].unshift(e);}else{this._assetsByGroupId[t].push(e);}}},{key:"setAssets",value:function setAssets(t,e){this._assetsByGroupId[t]=e;}},{key:"getAssets",value:function getAssets(t){this._assetsByGroupId[t]=this._assetsByGroupId[t]||[];return this._assetsByGroupId[t];}}]);return P7;}();M7=P7;});var e2,gl;var Sx=d(function(){ue();Ln();L7();ph();Cd();e2="imgly_sticker_custom";gl=/*#__PURE__*/function(){function gl(t,e,r){_classCallCheck(this,gl);this._ui=t;this._options=e;this._dynamicAssetsLibrary=r||this._ui.getEditor().getDynamicAssetsLibrary()||new M7();this._categoriesById={};this._categories=[];this._stickersById={};this._customStickerCanvas=z.createCanvas();this.reload();}_createClass(gl,[{key:"reload",value:function reload(){this._categoriesById={};this._categories=[];this._stickersById={};var t=this._ui.getEditor().getSDK()._l.areCustomAssetsAllowed();this._addCategories(zs.DEFAULTS.STICKER_CATEGORIES);var _this$_options41=this._options,e=_this$_options41.categories,r=_this$_options41.replaceCategories;if(t&&this._options.categories){this._addCategories(e,r);}else{this._updateCategoriesMap();this._updateAllCategory();}if(t){var o=this._dynamicAssetsLibrary.getAssets("sticker");if(o.length>0){var n=this._createCustomStickerCategory(o);this._addCategories([n],false,true);}}}},{key:"loadExternal",value:function loadExternal(t){var _this238=this;var e=new ro(t);return e.load().then(function(r){_this238._addCategories(r.categories,_this238._options.replaceCategories);});}},{key:"_addCategories",value:function _addCategories(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(e){this._categories=t.slice(0);}else if(r){this._categories=this._mergeCategories(t,this._categories);}else{this._categories=this._mergeCategories(this._categories,t);}this._updateCategoriesMap();this._updateAllCategory();}},{key:"_mergeCategories",value:function _mergeCategories(t,e){t=Ji.cloneCategories(t,"stickers");var _iterator3=_createForOfIteratorHelper(e),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var r=_step3.value;var o=false;var _iterator4=_createForOfIteratorHelper(t),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var n=_step4.value;if(r.identifier===n.identifier){var _iterator5=_createForOfIteratorHelper(r.stickers),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var s=_step5.value;var a=false;var _iterator6=_createForOfIteratorHelper(n.stickers),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var l=_step6.value;if(s.identifier===l.identifier){Object.assign(l,s);a=true;break;}}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}if(!a){n.stickers.push(s);}}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}o=true;break;}}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}if(!o){t.push(r);}}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}return t;}},{key:"_updateCategoriesMap",value:function _updateCategoriesMap(){var _this239=this;this._categoriesById={};this._categories.forEach(function(t){_this239._categoriesById[t.identifier]=t;});this._categories.forEach(function(t){t.stickers.forEach(function(e){_this239._stickersById[e.identifier]=e;});});if(typeof this._options.availableStickers!=="undefined"&&this._options.availableStickers!==null){this._categories.forEach(function(t){if(t.identifier!==e2){t.stickers=t.stickers.filter(function(e){return _this239._options.availableStickers.indexOf(e.identifier)!==-1;});}});this._categories=this._categories.filter(function(t){return t.stickers.length>0;});}this._updateAllCategory();}},{key:"_updateAllCategory",value:function _updateAllCategory(){this._allCategory={identifier:"all",defaultName:"All",stickers:this._categories.map(function(t){return t.stickers;}).reduce(function(t,e){return t.concat(e);},[])};this._categoriesById.all=this._allCategory;}},{key:"renderStickerThumbnailFromImage",value:function renderStickerThumbnailFromImage(t){var e=this._customStickerCanvas;var r=e.getContext("2d");r.save();var o=62;var n=o/t.width;var s=n*t.height;e.width=o;e.height=o;r.clearRect(0,0,t.width,t.height);r.translate(0,.5*(e.height-s));r.scale(n,n);r.drawImage(t,0,0);var a=e.toDataURL("image/png");r.restore();return{data:a,width:o,height:s};}},{key:"addCustomStickerFromImage",value:function addCustomStickerFromImage(t,e){var _this240=this;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"none";var o=function o(b){var T=_this240._ui.getEditor().getSDK();var k=T.getRenderer();var E=new Dt(b.width,b.height);var A=_this240._ui.getEditor().getMaxMegapixels()*1e6;var I=k.getMaxDimensions();var F=E.x*E.y>A;var Z=I!==null&&(E.x>I||E.y>I);if(F){var pt=b.width/b.height;var yt=b.height/b.width;I=new Dt(Math.sqrt(A*pt),Math.sqrt(A*yt)).floor().max();}var et=E.clone();if(F||Z){if(E.x/E.y>1){et.x=I;et.y=I/E.x*E.y;}else{et.x=I/E.y*E.x;et.y=I;}}return et;};var n=function n(b,T){var k=b.x/b.y;if(k>1){return new Dt(T,T/k);}return new Dt(T*k,T);};var s=t.src.substring(0,14)==="data:image/svg";var a=this._ui.getEditor().getSDK();t=a.correctExifOrientation(t);var l=n(new Dt(t.width,t.height),2048);var c=s?l:o(t);var u=this._customStickerCanvas;var m=u.getContext("2d");m.save();var p=this.renderStickerThumbnailFromImage(t);if(s){if(t.width>t.height){u.width=2048;u.height=2048/t.width*t.height;}else{u.height=2048;u.width=2048/t.height*t.width;}t.width=u.width;t.height=u.height;}else{u.width=c.x;u.height=c.y;m.scale(c.x/t.width,c.y/t.height);}m.drawImage(t,0,0,t.width,t.height);var h=u.toDataURL();m.restore();var g={identifier:z.generateUUID(),defaultName:e||"",tintMode:r,images:{mediaThumb:{uris:[p.data],rawData:true,width:p.width,height:p.height},mediaBase:{uris:s?[h,t.src]:[h],rawData:true,isSVG:s,width:c.x,height:c.y}}};var x=this._dynamicAssetsLibrary;x.addAsset("sticker",g,true);var v=x.getAssets("sticker");if(v.length===1){var b=this._createCustomStickerCategory(v);this._addCategories([b],false,true);}else{this.getCategory(e2).stickers=v;this._updateAllCategory();}this._updateCategoriesMap();}},{key:"_createCustomStickerCategory",value:function _createCustomStickerCategory(t){return{identifier:e2,defaultName:"Custom",metaData:{backgroundImage:t[t.length-1].images.mediaBase.uris[0],rawData:true},stickers:t};}},{key:"getStickersForCategory",value:function getStickersForCategory(t){if(!this._categoriesById[t]){throw new Error("Unknown sticker category '".concat(t,"'"));}return this._categoriesById[t].stickers;}},{key:"getStickerByIdentifier",value:function getStickerByIdentifier(t){return this._stickersById[t];}},{key:"getCategories",value:function getCategories(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(t){return[this._allCategory].concat(this._categories);}return this._categories;}},{key:"getCategory",value:function getCategory(t){return this._categoriesById[t];}}],[{key:"getURLForSticker",value:function getURLForSticker(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"base";var r=t.images;var o=e==="base"?r.mediaBase||r.mediaThumb:r.mediaThumb;var n=o.uris||[o.uri];if(true){if(!Ji.Browser.getIEVersion()){var a=n.filter(function(l){return /\.svg$/i.test(l);});return a.length?a[0]:n[0];}}var s=n.filter(function(a){return!/\.svg$/i.test(a);});return s.length?s[0]:n[0];}}]);return gl;}();});var z7,i2,Bc;var r2=d(function(){ue();vx();B7();JT();hl();Sx();z7=y(Ju());if(typeof st.Operations.SpriteOperation!=="undefined"){i2=st.Operations.SpriteOperation.BrushSprite;}Bc=/*#__PURE__*/function(){function Bc(t,e){_classCallCheck(this,Bc);this._editor=t;this._ui=this._editor.getUI();this._data=e;this._filterManager=new Oc(this._ui,this._getOptions("filter"));this._stickerManager=new gl(this._ui,this._getOptions("sticker"));this._brushManager=new Cx(this._ui,this._getOptions("brush"));this._fontManager=new Di(this._ui,this._getOptions("text"));}_createClass(Bc,[{key:"_getOptions",value:function _getOptions(t){var e=this._editor.controls;var r={};if(e&&e.get(t)){r=e.get(t).defaultOptions;}var o=this._editor.getOptions();return Jt.deepDefaults({},o.editor.controlsOptions[t]||{},r);}},{key:"deserialize",value:function deserialize(){var _this241=this;return this._validateVersion().then(function(){return _this241._deserializeInputImage();}).then(function(){return _this241._deserializeOperations();});}},{key:"_validateVersion",value:function _validateVersion(){if(this._data.version!==this.constructor.version){return Promise.reject(new Error("Invalid version ".concat(this._data.version,", expected ").concat(this.constructor.version)));}return Promise.resolve();}},{key:"_deserializeInputImage",value:function _deserializeInputImage(){var _this242=this;return new Promise(function(t,e){var _this242$_data$inputI=_this242._data.inputImage,r=_this242$_data$inputI.data,o=_this242$_data$inputI.type;if(r&&o){var n=new window.Image();n.addEventListener("load",function(){_this242._editor.setImage(n);t();});n.src="data:".concat(o,";base64,").concat(r);}else{t();}});}},{key:"_deserializeOperations",value:function(){var _deserializeOperations2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee11(){var _this243=this;var t;return regeneratorRuntime.wrap(function _callee11$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:t=this._data.operations;return _context12.abrupt("return",(0,z7["default"])(t,/*#__PURE__*/function(){var _ref116=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee10(e){return regeneratorRuntime.wrap(function _callee10$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:return _context11.abrupt("return",_this243._deserializeOperation(e));case 1:case"end":return _context11.stop();}}},_callee10);}));return function(_x18){return _ref116.apply(this,arguments);};}()));case 2:case"end":return _context12.stop();}}},_callee11,this);}));function _deserializeOperations(){return _deserializeOperations2.apply(this,arguments);}return _deserializeOperations;}()},{key:"_deserializeOperation",value:function _deserializeOperation(t){switch(t.type){case"crop":return this._deserializeCropOperation(t);case"orientation":return this._deserializeOrientationOperation(t);case"filter":return this._deserializeFilterOperation(t);case"adjustments":return this._deserializeAdjustmentsOperation(t);case"sprite":return this._deserializeSpriteOperation(t);case"focus":return this._deserializeFocusOperation(t);}}},{key:"_deserializeCropOperation",value:function _deserializeCropOperation(t){var e=t.options;var r=e.rotation;var o=Dt.fromObject(e.start);var n=Dt.fromObject(e.end);if(r>Math.PI){r-=Math.PI*2;}var s={start:o,end:n};if(typeof r!=="undefined"){s.rotation=r;}var a=this._editor.operations.getOrCreate("transform");this._editor.broadcastTransform(a,s);a.set(s);return Promise.resolve(a);}},{key:"_deserializeOrientationOperation",value:function _deserializeOrientationOperation(t){var e=t.options;var r=this._editor.operations.getOrCreate("orientation");if(!r)return Promise.resolve();r.set(e);return Promise.resolve(r);}},{key:"_deserializeFilterOperation",value:function _deserializeFilterOperation(t){var _this244=this;var e=t.options;if(!this._filterManager.getFilterByIdentifier(e.name)){Y.warn("Deserializer","Unknown filter `".concat(e.name,"`"));return Promise.resolve();}return this._filterManager.instantiateFilterWithIdentifier(e.name).then(function(r){var o=_this244._editor.operations.getOrCreate("filter");o.set({identifier:e.name,filter:r,intensity:e.intensity});return o;});}},{key:"_deserializeAdjustmentsOperation",value:function _deserializeAdjustmentsOperation(t){var e=st.Operations.AdjustmentsOperation;var r=t.options;var o=["brightness","saturation","contrast","exposure","shadows","highlights","clarity"];var n={};o.forEach(function(s){if(typeof r[s]==="undefined")return;var _e$prototype$availabl=e.prototype.availableOptions[s],a=_e$prototype$availabl.minValue,l=_e$prototype$availabl.midValue,c=_e$prototype$availabl.maxValue;var u=r[s];u=u<0?l+(l-a)*u:l+(c-l)*u;n[s]=u;});return Promise.resolve(this._editor.operations.getOrCreate("adjustments",n));}},{key:"_deserializeSpriteOperation",value:function _deserializeSpriteOperation(t){var _this245=this;var e=t.options;var r=this._editor.operations.getOrCreate("sprite");if(!r)return Promise.resolve();var o=e.sprites.map(function(n){return _this245._deserializeSprite(r,n);}).filter(function(n){return n;});return Promise.all(o).then(function(n){r.setSprites(n.filter(function(s){return s;}));return r;});}},{key:"_deserializeSprite",value:function _deserializeSprite(t,e){switch(e.type){case"sticker":return this._deserializeSticker(t,e);case"text":return this._deserializeText(t,e);case"brush":return this._deserializeBrush(t,e);case"textdesign":return this._deserializeTextDesign&&this._deserializeTextDesign(t,e);}}},{key:"_deserializeSticker",value:function _deserializeSticker(t,e){var _this246=this;var r=st.Operations.SpriteOperation;var o=e.options;var n=this._stickerManager.getStickerByIdentifier(o.name);var s=this._stickerManager.getURLForSticker(n);if(!n){Y.warn("Deserializer","Unknown sticker '".concat(o.name,"'. Skipping sprite."));return Promise.resolve();}return new Promise(function(a,l){var c=new window.Image();c.addEventListener("load",function(){var u=r.StickerSprite.prototype.availableOptions.adjustments.structure;var m=o.rotation,p=o.flipHorizontally,h=o.flipVertically;var g={identifier:o.name,image:c,position:Dt.fromObject(o.position),dimensions:Dt.fromObject(o.dimensions),rotation:m,flipHorizontally:p,flipVertically:h,adjustments:{}};if(typeof o.adjustments!=="undefined"){["brightness","contrast","saturation"].forEach(function(x){if(typeof o.adjustments[x]!=="undefined"){g.adjustments[x]=o.adjustments[x]+u[x]["default"];}});}a(t.createSticker(g));});c.crossOrigin=_this246._editor.getCrossOrigin();c.src=_this246._editor.getUI().getAssetPath(s);});}},{key:"_deserializeText",value:function _deserializeText(t,e){var r=e.options;var o=r.fontSize,n=r.lineHeight,s=r.fontFamily,a=r.fontWeight,l=r.alignment,c=r.rotation,u=r.maxWidth,m=r.color,p=r.backgroundColor;var h=new fl(this._ui);var g=this._fontManager.getFontByFontFamily(s);if(!g)g=this._fontManager.getDefaultFont();h.setFonts([g]);return h.load().then(function(){var x=t.createText({fontSize:o,lineHeight:n,fontFamily:s,fontWeight:a,alignment:l,rotation:c,maxWidth:u,text:r.text,color:Ut.fromArray(m),backgroundColor:Ut.fromArray(p),position:Dt.fromObject(r.position)});x._edited=true;return x;});}},{key:"_deserializeBrush",value:function _deserializeBrush(t,e){var _this247=this;var r=e.options;var o=r.paths;var n=t.createBrush();o.forEach(function(s){_this247._deserializeBrushPath(n,s);});return Promise.resolve(n);}},{key:"_deserializeBrushPath",value:function _deserializeBrushPath(t,e){var r=e.points;var o=this._createBrushForPath(e);var n=t.createPath(o);n.setClosed(true);r.forEach(function(s){n.addControlPoint(Dt.fromObject(s));});}},{key:"_createBrushForPath",value:function _createBrushForPath(t){var e=t.color,r=t.size;var o=Ut.fromArray(e);var n={color:o,size:r};var s=this._brushManager.getFirstBrush();if(s.prototype&&s.prototype instanceof i2){var c=s;return new c(n);}var a=_objectSpread({},s);delete a.image;var l=/*#__PURE__*/function(_i3){_inherits(l,_i3);var _super189=_createSuper(l);function l(){_classCallCheck(this,l);return _super189.apply(this,arguments);}return l;}(i2);l.identifier=s.identifier;return new l(_objectSpread(_objectSpread({},a),n));}},{key:"_deserializeFocusOperation",value:function _deserializeFocusOperation(t){var e=t.options.options;switch(t.options.type){case"radial":{var r=e.position,o=e.radius,n=e.gradientRadius,s=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("radial-focus",{position:Dt.fromObject(r),radius:o,gradientRadius:n,blurRadius:s}));}case"linear":{var _r8=e.start,_o8=e.end,_n6=e.size,_s5=e.gradientSize,a=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("mirrored-focus",{start:Dt.fromObject(_r8),end:Dt.fromObject(_o8),size:_n6,gradientSize:_s5,blurRadius:a}));}}}},{key:"_getInputDimensionsForOperation",value:function _getInputDimensionsForOperation(t){var e=false;var r=this._editor.getInputDimensions();this._editor.operations.getStack().forEach(function(o){if(o===t)e=true;if(e)return;r=o.getNewDimensions(r);});return r;}}]);return Bc;}();Bc.version="1.0.0";});var lm,Pc;var o2=d(function(){ue();lm=Math.PI*2;Pc=/*#__PURE__*/function(){function Pc(t){_classCallCheck(this,Pc);this._editor=t;this._serializeOperations=this._serializeOperations.bind(this);}_createClass(Pc,[{key:"serialize",value:function serialize(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._options=_objectSpread(_objectSpread({},t),{},{image:true});var e={version:this.constructor.version};return this._serializeInputImage(e).then(this._serializeOperations);}},{key:"_serializeInputImage",value:function _serializeInputImage(t){var e=this._editor.getImage();var r=e.width,o=e.height;if(!this._options.image){t.inputImage={width:r,height:o};return Promise.resolve(t);}var n=Jt.createCanvas();n.width=e.width;n.height=e.height;var s=n.getContext("2d");s.drawImage(e,0,0);var a=n.toDataURL(YT.PNG);t.inputImage={type:YT.PNG,data:a.replace(/^data:image\/(.*?);base64,/,""),width:r,height:o};return Promise.resolve(t);}},{key:"_serializeOperations",value:function _serializeOperations(t){var _this248=this;var e=[];var r=this._editor.operations.getStack();r.forEach(function(o){var n=_this248._serializeOperation(o,e);if(n){e.push(n);}});t.operations=e.filter(function(o){return o;});return Promise.resolve(t);}},{key:"_serializeOperation",value:function _serializeOperation(t,e){switch(t.constructor.identifier){case"transform":return this._serializeTransformOperation(t);case"orientation":return this._serializeOrientationOperation(t);case"filter":return this._serializeFilterOperation(t);case"adjustments":return this._serializeAdjustmentsOperation(t);case"sprite":return this._serializeSpriteOperation(t,e);case"radial-focus":return this._serializeRadialFocusOperation(t);case"mirrored-focus":return this._serializeLinearFocusOperation(t);default:Y.warn("Unable to serialize operation of type ".concat(t.constructor.identifier));}}},{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=t.serializeOptions(["start","end","rotation"],true);e.rotation=(e.rotation+lm)%lm;return{type:"crop",options:e};}},{key:"_serializeOrientationOperation",value:function _serializeOrientationOperation(t){return{type:"orientation",options:t.serializeOptions(["flipVertically","flipHorizontally","rotation"],true)};}},{key:"_serializeFilterOperation",value:function _serializeFilterOperation(t){if(t.getIdentifier()==="identity")return null;return{type:"filter",options:{intensity:t.getIntensity(),name:t.getIdentifier()}};}},{key:"_serializeAdjustmentsOperation",value:function _serializeAdjustmentsOperation(t){var e=t.availableOptions;var r=["brightness","saturation","contrast","exposure","shadows","highlights","clarity"];var o={};r.forEach(function(n){var s=e[n];var a=t.getOption(n);var l=s.minValue,c=s.midValue,u=s.maxValue;o[n]=a<=c?(a-l)/(c-l)-1:(a-c)/(u-c);});return{type:"adjustments",options:o};}},{key:"_serializeSpriteOperation",value:function _serializeSpriteOperation(t,e){var _this249=this;var r=e.filter(function(s){return s.type==="sprite";});var o;var n=true;if(r.length){o=r.pop();n=false;}else{o={type:"sprite",options:{sprites:[]}};}t.getSprites().forEach(function(s){var a=null;if(s instanceof t.constructor.StickerSprite){a=_this249._serializeSticker(t,s);}else if(s instanceof t.constructor.TextSprite){a=_this249._serializeText(t,s);}else if(s instanceof t.constructor.BrushSprite){a=_this249._serializeBrush(t,s);}else if(s instanceof t.constructor.TextDesignSprite){a=_this249._serializeTextDesign&&_this249._serializeTextDesign(t,s);}if(a){o.options.sprites.push(a);}});if(n){return o;}}},{key:"_serializeSticker",value:function _serializeSticker(t,e){var r=e.getAdjustments();var o=e.serializeOptions(["identifier","position","dimensions","flipVertically","flipHorizontally","rotation"],true);o.name=o.identifier;delete o.identifier;o.rotation=(o.rotation+lm)%lm;var n=r.availableOptions;o.adjustments={brightness:r.getBrightness()-n.brightness["default"],saturation:r.getSaturation()-n.saturation["default"],contrast:r.getContrast()-n.contrast["default"]};return{type:"sticker",options:o};}},{key:"_serializeText",value:function _serializeText(t,e){var r=e.serializeOptions(["fontSize","lineHeight","fontFamily","fontWeight","alignment","color","backgroundColor","position","rotation","text","maxWidth"],true);r.rotation=(r.rotation+lm)%lm;return{type:"text",options:r};}},{key:"_serializeBrush",value:function _serializeBrush(t,e){var _this250=this;return{type:"brush",options:{paths:e.getPaths().map(function(r){return _this250._serializePath(r);})}};}},{key:"_serializePath",value:function _serializePath(t){var e=t.getBrush().serializeOptions(["color","size"],true);e.points=t.getControlPoints().map(function(r){return r.getPosition().toObject();});return e;}},{key:"_serializeRadialFocusOperation",value:function _serializeRadialFocusOperation(t){return{type:"focus",options:{type:"radial",options:t.serializeOptions(["position","radius","gradientRadius","blurRadius"],true)}};}},{key:"_serializeLinearFocusOperation",value:function _serializeLinearFocusOperation(t){return{type:"focus",options:{type:"linear",options:t.serializeOptions(["start","end","blurRadius","size","gradientSize"],true)}};}},{key:"_getInputDimensionsForOperation",value:function _getInputDimensionsForOperation(t){var e=false;var r=this._editor.getInputDimensions();this._editor.operations.getStack().forEach(function(o){if(o===t)e=true;if(e)return;r=o.getNewDimensions(r);});return r;}}]);return Pc;}();Pc.version="1.0.0";});var U7={};de(U7,{"default":function _default(){return wx;}});var wx;var N7=d(function(){r2();o2();wx=/*#__PURE__*/function(){function wx(t){_classCallCheck(this,wx);this._editor=t;}_createClass(wx,[{key:"serialize",value:function serialize(){var e=new Pc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Bc(this._editor,t);return e.deserialize();}}]);return wx;}();wx.version="1.0.0";});var Mc;var n2=d(function(){ue();r2();Mc=/*#__PURE__*/function(_Bc){_inherits(Mc,_Bc);var _super190=_createSuper(Mc);function Mc(){_classCallCheck(this,Mc);return _super190.apply(this,arguments);}_createClass(Mc,[{key:"_deserializeOperation",value:function _deserializeOperation(t){if(t.type==="selective-blur"){return this._deserializeSelectiveBlurOperation(t);}return _get(_getPrototypeOf(Mc.prototype),"_deserializeOperation",this).call(this,t);}},{key:"_deserializeCropOperation",value:function _deserializeCropOperation(t){var e=t.options;var r=e.rotation;var o=Dt.fromObject(e.start);var n=Dt.fromObject(e.end);var s=e.dimensions?Dt.fromObject(e.dimensions):null;if(n.x-o.x<=0||n.y-o.y<=0){throw new Error("A crop should not result in negative or zero dimensions - start: ".concat(o," - end: ").concat(n));}if(r>Math.PI){r-=Math.PI*2;}var a={start:o,end:n};if(typeof r!=="undefined")a.rotation=r;var l=this._editor.operations.getOrCreate("transform");if(!l)return Promise.resolve();this._editor.broadcastTransform(l,a);l.set(a);if(s){var c=n.clone().subtract(o);var u=l.getInputDimensions(false).multiply(c);l.setTextureScale(s.x/u.x);}return Promise.resolve(l);}}]);return Mc;}(Bc);Mc.version="1.0.1";});var H7,Lc;var s2=d(function(){o2();H7=Math.PI*2;Lc=/*#__PURE__*/function(_Pc){_inherits(Lc,_Pc);var _super191=_createSuper(Lc);function Lc(){_classCallCheck(this,Lc);return _super191.apply(this,arguments);}_createClass(Lc,[{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=t.serializeOptions(["start","end","rotation","textureScale"],true);e.rotation=(e.rotation+H7)%H7;if(e.textureScale!==1){e.dimensions=t.getNewDimensions(t.getInputDimensions(false));}delete e.textureScale;return{type:"crop",options:e};}}]);return Lc;}(Pc);Lc.version="1.0.1";});var W7={};de(W7,{"default":function _default(){return Tx;}});var Tx;var G7=d(function(){n2();s2();Tx=/*#__PURE__*/function(){function Tx(t){_classCallCheck(this,Tx);this._editor=t;}_createClass(Tx,[{key:"serialize",value:function serialize(){var e=new Lc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Mc(this._editor,t);return e.deserialize();}}]);return Tx;}();Tx.version="1.0.1";});var cm,Hh;var V7=d(function(){_d();ue();var _st2=st;cm=_st2.OptionType;Hh=/*#__PURE__*/function(_st$Configurable){_inherits(Hh,_st$Configurable);var _super192=_createSuper(Hh);function Hh(t){var _this251;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Hh);_this251=_super192.call(this,e);_this251._loaded=false;_this251._loading=false;_this251._ui=t;_this251._frame=st.Utils.deepClone(_this251._options);return _this251;}_createClass(Hh,[{key:"load",value:function load(){var _this252=this;if(this._loaded)return Promise.resolve();if(this._loading)return Promise.reject(new Error("Called Frame#load while it's already loading"));this._loading=true;var t=this._frame.imageGroups;var e=[];["top","left","right","bottom"].forEach(function(r){if(!(r in t))return;var o=t[r];["start","mid","end"].forEach(function(n){if(!(n in o))return;e.push(_this252._loadPart(r,n));});});return Promise.all(e).then(function(){_this252._loaded=true;_this252._loading=false;})["catch"](function(r){_this252._loaded=false;_this252._loading=false;});}},{key:"_loadPart",value:function _loadPart(t,e){var _this253=this;var r=this._frame.imageGroups;var o=r[t][e];var n=o;if(typeof o!=="string"&&"image"in o){n=o.image;}return Wi.load(this._ui.getAssetPath(n)).then(function(s){if(typeof o!=="string"){_this253._frame.imageGroups[t][e].image=s;}else{_this253._frame.imageGroups[t][e]=s;}return s;});}},{key:"getFrame",value:function getFrame(){return this._frame;}}]);return Hh;}(st.Configurable);Hh.prototype.availableOptions={identifier:{type:cm.STRING,required:true},defaultName:{type:cm.STRING},thumbnail:{type:cm.STRING},tintable:{type:cm.BOOLEAN,"default":false},layoutMode:{type:cm.STRING,"default":"horizontal-inside",available:["horizontal-inside","vertical-inside"]},imageGroups:{type:cm.OBJECT,required:true}};});var kx;var j7=d(function(){ue();kx=/*#__PURE__*/function(){function kx(t,e){_classCallCheck(this,kx);this._ui=t;this._options=e;this._categoriesById={};this._categories=[];this._framesById={};this._addCategories(zs.DEFAULTS.FRAME_CATEGORIES);this._customAssetsAllowed=t.getEditor().getSDK()._l.areCustomAssetsAllowed();var _this$_options42=this._options,r=_this$_options42.categories,o=_this$_options42.replaceCategories;if(this._customAssetsAllowed&&this._options.categories){this._addCategories(r,o);}else{this._updateAllCategory();}}_createClass(kx,[{key:"_addCategories",value:function _addCategories(t){var _this254=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(e){this._categories=t.slice(0);}else{this._categories=Ji.mergeCategories(this._categories,t,"frames");}this._categoriesById={};this._categories.forEach(function(o){_this254._categoriesById[o.identifier]=o;});var r=this._options.availableFrames;if(this._customAssetsAllowed&&r){this._categories.forEach(function(o){o.frames=o.frames.filter(function(n){return r.indexOf(n.identifier)!==-1;});});}this._categories.forEach(function(o){o.frames.forEach(function(n){_this254._framesById[n.identifier]=n;});});this._updateAllCategory();}},{key:"_updateAllCategory",value:function _updateAllCategory(){this._allCategory={identifier:"all",defaultName:"All",frames:this._categories.map(function(t){return t.frames;}).reduce(function(t,e){return t.concat(e);},[])};this._categoriesById.all=this._allCategory;}},{key:"getFramesForCategory",value:function getFramesForCategory(t){if(!this._categoriesById[t]){throw new Error("Unknown frame category '".concat(t,"'"));}return this._categoriesById[t].frames;}},{key:"getFrameByIdentifier",value:function getFrameByIdentifier(t){return this._framesById[t];}},{key:"getCategories",value:function getCategories(){return this._categories;}},{key:"getCategory",value:function getCategory(t){return this._categoriesById[t];}}]);return kx;}();});var Ix;var $7=d(function(){ue();Ix=/*#__PURE__*/function(){function Ix(t,e){var _this255=this;_classCallCheck(this,Ix);this._ui=t;this._options=e;this._overlays=zs.DEFAULTS.OVERLAYS.slice(0);this._overlaysByIdentifier={};var r=t.getEditor().getSDK()._l.areCustomAssetsAllowed();if(r&&e.overlays){if(e.replaceOverlays){this._overlays=e.overlays;}else{this._overlays=this._overlays.concat(e.overlays);}}if(r&&e.availableOverlays){this._overlays=this._overlays.filter(function(o){return e.availableOverlays.indexOf(o.identifier)!==-1;});}this._overlays.forEach(function(o){_this255._overlaysByIdentifier[o.identifier]=o;});}_createClass(Ix,[{key:"getOverlays",value:function getOverlays(){return this._overlays;}},{key:"getOverlayByIdentifier",value:function getOverlayByIdentifier(t){return this._overlaysByIdentifier[t];}}]);return Ix;}();});var Xs,um;var Dx=d(function(){var _um;ue();Xs=st.Engine.Filters.OverlayFilter;um=(_um={},_defineProperty(_um,Xs.BLEND_MODES.NORMAL,"normal"),_defineProperty(_um,Xs.BLEND_MODES.OVERLAY,"overlay"),_defineProperty(_um,Xs.BLEND_MODES.HARD_LIGHT,"hard light"),_defineProperty(_um,Xs.BLEND_MODES.SOFT_LIGHT,"soft light"),_defineProperty(_um,Xs.BLEND_MODES.MULTIPLY,"multiply"),_defineProperty(_um,Xs.BLEND_MODES.DARKEN,"darken"),_defineProperty(_um,Xs.BLEND_MODES.LIGHTEN,"lighten"),_defineProperty(_um,Xs.BLEND_MODES.SCREEN,"screen"),_defineProperty(_um,Xs.BLEND_MODES.COLOR_BURN,"color burn"),_um);});var mlt,zc;var a2=d(function(){ue();vx();V7();_d();j7();$7();Sx();n2();Dx();mlt=Jt.flipObject(um);zc=/*#__PURE__*/function(_Mc){_inherits(zc,_Mc);var _super193=_createSuper(zc);function zc(){var _this256;_classCallCheck(this,zc);for(var _len106=arguments.length,t=new Array(_len106),_key106=0;_key106<_len106;_key106++){t[_key106]=arguments[_key106];}_this256=_super193.call.apply(_super193,[this].concat(t));_this256._frameManager=new kx(_this256._ui,_this256._getOptions("frame"));var e=_this256._getOptions("overlay");if(e){_this256._overlayManager=new Ix(_this256._ui,e);}return _this256;}_createClass(zc,[{key:"_deserializeSprite",value:function _deserializeSprite(t,e){if(e.type==="frame"){return this._deserializeFrame(t,e);}if(e.type==="overlay"){return this._deserializeOverlay(t,e);}return _get(_getPrototypeOf(zc.prototype),"_deserializeSprite",this).call(this,t,e);}},{key:"_deserializeOperation",value:function _deserializeOperation(t){if(t.type==="transform"){return this._deserializeTransformOperation(t);}return _get(_getPrototypeOf(zc.prototype),"_deserializeOperation",this).call(this,t);}},{key:"_deserializeOrientationOperation",value:function _deserializeOrientationOperation(t){if(this._data.meta&&this._data.meta.platform!=="html5"){return _get(_getPrototypeOf(zc.prototype),"_deserializeOrientationOperation",this).call(this,t);}var _t$options=t.options,e=_t$options.rotation,r=_t$options.flipHorizontally,o=_t$options.flipVertically;var n=e===90&&!r&&!o;n|=e===90&&r&&o;n|=e===270&&!r&&!o;n|=e===270&&r&&o;if(n){t.options.flipHorizontally=!t.options.flipHorizontally;t.options.flipVertically=!t.options.flipVertically;}return _get(_getPrototypeOf(zc.prototype),"_deserializeOrientationOperation",this).call(this,t);}},{key:"_deserializeTransformOperation",value:function _deserializeTransformOperation(t){var _this257=this;return _get(_getPrototypeOf(zc.prototype),"_deserializeCropOperation",this).call(this,t).then(function(e){if(!e)return;var r=Jt.Array.find(_this257._data.operations,function(o){return o.type==="orientation";});if(r){var o=r.options;var n=o.rotation,s=o.flipHorizontally,a=o.flipVertically;if(n===90||n===270){if(!s&&a||s&&!a){s=!s;a=!a;}}e.rotate(o.rotation);if(s){e.flip("horizontal");e.setRotation(e.getRotation()*-1);}if(a){e.flip("vertical");e.setRotation(e.getRotation()*-1);}}return e;});}},{key:"_deserializeFrame",value:function _deserializeFrame(t,e){var _this258=this;var r=e.options.identifier;var o=this._frameManager.getFrameByIdentifier(r);if(!o){Y.warn("Deserializer","Unknown frame `".concat(r,"`. Skipping frame."));return Promise.resolve();}var n=new Hh(this._ui,o);return n.load().then(function(){_this258._editor.operations.getOrCreate("frame",{frame:n.getFrame()});});}},{key:"_deserializeOverlay",value:function _deserializeOverlay(t,e){var _this259=this;var _e$options=e.options,r=_e$options.blendMode,o=_e$options.intensity,n=_e$options.identifier;var s=this._overlayManager.getOverlayByIdentifier(n);if(!s){Y.warn("Deserializer","Unknown overlay `".concat(n,"`. Skipping overlay."));return Promise.resolve();}var a=this._editor.getUI().getAssetPath(s.image);return Wi.load(a).then(function(l){_this259._editor.operations.getOrCreate("overlay",{alpha:o,identifier:n,blendMode:parseInt(mlt[r||s.blendMode],10),image:l});});}},{key:"_createBrushForPath",value:function _createBrushForPath(t){var e=_get(_getPrototypeOf(zc.prototype),"_createBrushForPath",this).call(this,t);if(typeof t.hardness!=="undefined"&&e.hasOption("hardness")){e.setHardness(t.hardness);}return e;}},{key:"_deserializeSticker",value:function _deserializeSticker(t,e){var _this260=this;var r=st.Operations.SpriteOperation;var o=e.options;var n=this._stickerManager.getStickerByIdentifier(o.identifier);var s=gl.getURLForSticker(n,"base");if(!n){Y.warn("Deserializer","Unknown sticker `".concat(o.identifier,"`. Skipping sprite."));return Promise.resolve();}var a=t.getInputDimensions(false);return new Promise(function(l,c){var u=new window.Image();u.addEventListener("load",function(){var m=r.StickerSprite.prototype.availableOptions.adjustments.structure;var p=o.rotation,h=o.flipHorizontally,g=o.flipVertically;var x={identifier:o.identifier,image:u,position:Dt.fromObject(o.position),dimensions:Dt.fromObject(o.dimensions).multiply(a.min()),rotation:p,flipHorizontally:h,flipVertically:g,adjustments:{}};if(typeof o.adjustments!=="undefined"){["brightness","contrast","saturation"].forEach(function(v){if(typeof o.adjustments[v]!=="undefined"){x.adjustments[v]=o.adjustments[v]+m[v]["default"];}});}if(typeof o.tintColor!=="undefined"&&typeof n.tintMode!=="undefined"){x.tintColor=Ut.fromArray(o.tintColor);x.tintMode=n.tintMode;}l(t.createSticker(x));});u.crossOrigin=_this260._editor.getCrossOrigin();u.src=_this260._editor.getUI().getAssetPath(s);});}},{key:"_deserializeFilterOperation",value:function _deserializeFilterOperation(t){var _this261=this;var e=t.options;if(!this._filterManager.getFilterByIdentifier(e.identifier)){Y.warn("Deserializer","Unknown filter `".concat(e.identifier,"`"));return Promise.resolve();}return this._filterManager.instantiateFilterWithIdentifier(e.identifier).then(function(r){var o=_this261._editor.operations.getOrCreate("filter");if(!o)return;o.set({identifier:e.identifier,filter:r,intensity:e.intensity});return o;});}},{key:"_deserializeFocusOperation",value:function _deserializeFocusOperation(t){var _t$options2=t.options,e=_t$options2.options,r=_t$options2.type;if(r!=="radial")return _get(_getPrototypeOf(zc.prototype),"_deserializeFocusOperation",this).call(this,t);var o=this._editor.getImage();var n=o.width/o.height;var s=e.start,a=e.end,l=e.gradientRadius,c=e.blurRadius;var u=Dt.fromObject(a).subtract(Dt.fromObject(s)).multiply(n,1).len();return Promise.resolve(this._editor.operations.getOrCreate("radial-focus",{position:Dt.fromObject(s),radius:u,gradientRadius:l,blurRadius:c}));}},{key:"_deserializeText",value:function _deserializeText(t,e){var r=e.options;var o=r.fontSize,n=r.lineHeight,s=r.fontIdentifier,a=r.alignment,l=r.rotation,c=r.maxWidth,u=r.color,m=r.backgroundColor;var p=new fl(this._ui);var h=this._fontManager.getVariationByIdentifier(s);if(!h){h=this._fontManager.getDefaultFont();}else{p.setFonts([h.getFont()]);}return p.load().then(function(){var g=t.getInputDimensions(false);var x=c*g.min()/g.x;var v=t.createText({fontSize:o,lineHeight:n,fontFamily:h.getFontFamily(),fontWeight:h.getFontWeight(),fontIdentifier:h.getIdentifier(),alignment:a,rotation:l,maxWidth:x,text:r.text,color:Ut.fromArray(u),backgroundColor:Ut.fromArray(m),position:Dt.fromObject(r.position)});v._edited=true;return v;});}}]);return zc;}(Mc);zc.version="2.0.0";});var Uc;var l2=d(function(){s2();Dx();Uc=/*#__PURE__*/function(_Lc){_inherits(Uc,_Lc);var _super194=_createSuper(Uc);function Uc(){_classCallCheck(this,Uc);return _super194.apply(this,arguments);}_createClass(Uc,[{key:"_serializeSticker",value:function _serializeSticker(t,e){var r=t.getInputDimensions(false);var o=_get(_getPrototypeOf(Uc.prototype),"_serializeSticker",this).call(this,t,e);if(e.getTintMode()!=="none"){o.options.tintColor=e.serializeOption("tintColor",true);}o.options.dimensions=e.getDimensions().clone().divide(r.min()).toObject();o.options.identifier=o.options.name;delete o.options.name;return o;}},{key:"_serializePath",value:function _serializePath(t){var e=_get(_getPrototypeOf(Uc.prototype),"_serializePath",this).call(this,t);var r=t.getBrush();if(r.hasOption("hardness")){e.hardness=r.getOption("hardness");}return e;}},{key:"_serializeOperation",value:function _serializeOperation(t,e){if(t.constructor.identifier==="frame"){this._serializeFrameOperation(t,e);return null;}if(t.constructor.identifier==="overlay"){this._serializeOverlayOperation(t,e);return null;}return _get(_getPrototypeOf(Uc.prototype),"_serializeOperation",this).call(this,t,e);}},{key:"_serializeFrameOperation",value:function _serializeFrameOperation(t,e){var r=e.filter(function(n){return n.type==="sprite";});var o;if(r.length){o=r.pop();}else{o={type:"sprite",options:{sprites:[]}};e.push(o);}o.options.sprites.push({type:"frame",options:this._getFrameOptions(t)});}},{key:"_serializeOverlayOperation",value:function _serializeOverlayOperation(t,e){if(!t.getIdentifier())return;var r=e.filter(function(n){return n.type==="sprite";});var o;if(r.length){o=r.pop();}else{o={type:"sprite",options:{sprites:[]}};e.push(o);}o.options.sprites.push({type:"overlay",options:{identifier:t.getIdentifier(),intensity:t.getAlpha(),blendMode:um[t.getBlendMode()]}});}},{key:"_getFrameOptions",value:function _getFrameOptions(t){return{identifier:t.getFrame().identifier};}},{key:"_serializeOrientationOperation",value:function _serializeOrientationOperation(t){var e=_get(_getPrototypeOf(Uc.prototype),"_serializeOrientationOperation",this).call(this,t);if(e.options.rotation===90||e.options.rotation===270){e.options.flipHorizontally=!e.options.flipHorizontally;e.options.flipVertically=!e.options.flipVertically;}return e;}},{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=this._editor.operations;if(e.exists("orientation")){t=t.clone();var o=e.get("orientation");t.rotate(-o.getRotation());if(o.getFlipVertically()){t.flip("vertical");t.setRotation(t.getRotation()*-1);}if(o.getFlipHorizontally()){t.flip("horizontal");t.setRotation(t.getRotation()*-1);}}var r=_get(_getPrototypeOf(Uc.prototype),"_serializeTransformOperation",this).call(this,t);r.type="transform";return r;}},{key:"_serializeText",value:function _serializeText(t,e){var r=_get(_getPrototypeOf(Uc.prototype),"_serializeText",this).call(this,t,e);var o=t.getInputDimensions(false);r.options.fontIdentifier=e.getFontIdentifier();r.options.maxWidth=r.options.maxWidth*o.x/o.min();delete r.options.fontFamily;return r;}},{key:"_serializeFilterOperation",value:function _serializeFilterOperation(t){var e=_get(_getPrototypeOf(Uc.prototype),"_serializeFilterOperation",this).call(this,t);if(!e)return null;e.options.identifier=e.options.name;delete e.options.name;return e;}},{key:"_serializeRadialFocusOperation",value:function _serializeRadialFocusOperation(t){var e=_get(_getPrototypeOf(Uc.prototype),"_serializeRadialFocusOperation",this).call(this,t);var r=e.options.options;r.start=r.position;delete r.position;r.end={x:r.start.x+r.radius,y:r.start.y};delete r.radius;return e;}}]);return Uc;}(Lc);Uc.version="2.0.0";});var K7={};de(K7,{"default":function _default(){return Ex;}});var Ex;var X7=d(function(){a2();l2();Ex=/*#__PURE__*/function(){function Ex(t){_classCallCheck(this,Ex);this._editor=t;}_createClass(Ex,[{key:"serialize",value:function serialize(){var e=new Uc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new zc(this._editor,t);return e.deserialize();}}]);return Ex;}();Ex.version="2.0.0";});var c2,Nc;var u2=d(function(){ue();_d();hl();Sx();sm();a2();if(typeof st.Operations.SpriteOperation!=="undefined"){c2=st.Operations.SpriteOperation.BrushSprite.Brush;}Nc=/*#__PURE__*/function(_zc){_inherits(Nc,_zc);var _super195=_createSuper(Nc);function Nc(){_classCallCheck(this,Nc);return _super195.apply(this,arguments);}_createClass(Nc,[{key:"_deserializeSticker",value:function _deserializeSticker(t,e){var r=st.Operations.SpriteOperation;var o=e.options;var n=this._stickerManager.getStickerByIdentifier(o.identifier);if(!n){Y.warn("Deserializer","Unknown sticker `".concat(o.identifier,"`. Skipping sprite."));return Promise.resolve();}var s=n.images.mediaBase;var a=gl.getURLForSticker(n,"base");var l=s.rawData?s.uris[0]:this._editor.getUI().getAssetPath(a);var c=t.getInputDimensions(false);return Wi.load(l).then(function(u){var m=r.StickerSprite.prototype.availableOptions.adjustments.structure;var p=o.rotation,h=o.flipHorizontally,g=o.flipVertically;var x={identifier:o.identifier,image:u,position:Dt.fromObject(o.position),dimensions:Dt.fromObject(o.dimensions).multiply(c.min()),rotation:p||0,flipHorizontally:h,flipVertically:g,resizeMode:n.resizeMode||"keepAspect",adjustments:{}};if(typeof o.adjustments!=="undefined"){["brightness","contrast","saturation"].forEach(function(v){if(typeof o.adjustments[v]!=="undefined"){x.adjustments[v]=o.adjustments[v]+m[v]["default"];}});}if(typeof o.tintMode!=="undefined"&&typeof o.tintColor!=="undefined"){x.tintColor=Ut.fromArray(o.tintColor.rgba);x.tintMode=o.tintMode;}else if(typeof o.tintColor!=="undefined"&&typeof n.tintMode!=="undefined"){x.tintColor=Ut.fromArray(o.tintColor.rgba);x.tintMode=n.tintMode;}if(typeof o.alpha!=="undefined"){x.alpha=o.alpha;}return t.createSticker(x);});}},{key:"_deserializeTransformOperation",value:function _deserializeTransformOperation(t){return _get(_getPrototypeOf(Nc.prototype),"_deserializeTransformOperation",this).call(this,t).then(function(e){if(!e)return;e._ratio=null;return e;});}},{key:"_deserializeInputImage",value:function _deserializeInputImage(){var _this262=this;var _this$_data$image=this._data.image,t=_this$_data$image.data,e=_this$_data$image.type,r=_this$_data$image.uri;if(t&&e){r="data:".concat(e,";base64,").concat(t);}if(r){return Wi.load(r).then(function(o){_this262._editor.setImage(o);});}return Promise.resolve();}},{key:"_deserializeAdjustmentsOperation",value:function _deserializeAdjustmentsOperation(t){var e=st.Operations.AdjustmentsOperation;return _get(_getPrototypeOf(Nc.prototype),"_deserializeAdjustmentsOperation",this).call(this,t).then(function(r){if(!r)return null;var o=t.options;var n=["gamma","whites","blacks","temperature"];var s={};n.forEach(function(a){if(typeof o[a]==="undefined")return;var _e$prototype$availabl2=e.prototype.availableOptions[a],l=_e$prototype$availabl2.minValue,c=_e$prototype$availabl2.midValue,u=_e$prototype$availabl2.maxValue;var m=o[a];m=m<0?c+(c-l)*m:c+(u-c)*m;s[a]=m;});r.set(s);return r;});}},{key:"_deserializeFocusOperation",value:function _deserializeFocusOperation(t){var e=t.options.options;switch(t.options.type){case"radial":return _get(_getPrototypeOf(Nc.prototype),"_deserializeFocusOperation",this).call(this,t);case"linear":{var r=e.start,o=e.end,n=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("linear-focus",{controlPoint1:Dt.fromObject(r),controlPoint2:Dt.fromObject(o),blurRadius:n}));}case"mirrored":{var _r9=e.start,_o9=e.end,_n7=e.size,s=e.gradientSize,a=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("mirrored-focus",{start:Dt.fromObject(_r9),end:Dt.fromObject(_o9),size:_n7,gradientSize:s,blurRadius:a}));}case"gaussian":{var _r10=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("blur",{blurRadius:_r10}));}}}},{key:"_deserializeText",value:function _deserializeText(t,e){var r=e.options;var o=r.fontSize,n=r.lineHeight,s=r.fontIdentifier,a=r.alignment,l=r.rotation,c=r.maxWidth,u=r.color,m=r.backgroundColor;var p=this._ui.getFontLoader();var h=this._fontManager.getVariationByIdentifier(s);if(!h){h=this._fontManager.getDefaultVariation();}else{p.setFonts([h.getFont()]);}return p.load().then(function(){var g=t.getInputDimensions(false);var x=c*g.min()/g.x;var v=t.createText({fontSize:o,lineHeight:n,fontFamily:h.getFontFamily(),fontWeight:h.getFontWeight(),fontIdentifier:h.getIdentifier(),textMetrics:h.getTextMetrics(),alignment:a,rotation:l,maxWidth:x,text:r.text,color:Ut.fromArray(u.rgba),backgroundColor:Ut.fromArray(m.rgba),position:Dt.fromObject(r.position)});v._edited=true;return v;});}},{key:"_createBrushForPath",value:function _createBrushForPath(t){var _t$brush=t.brush,e=_t$brush.identifier,r=_t$brush.color,o=_t$brush.size,n=_t$brush.hardness;var s=Ut.fromArray(r.rgba);var a={color:s,size:o};if(typeof n!=="undefined"){a.hardness=n;}var l=this._brushManager.getBrushByIdentifier(e);if(!l){l=this._brushManager.getFirstBrush();}if(l.prototype&&l.prototype instanceof c2){var m=l;return new m(a);}var c=_objectSpread({},l);delete c.image;var u=/*#__PURE__*/function(_c6){_inherits(u,_c6);var _super196=_createSuper(u);function u(){_classCallCheck(this,u);return _super196.apply(this,arguments);}return u;}(c2);u.identifier=l.identifier;return new u(_objectSpread(_objectSpread({},c),a));}},{key:"_deserializeFrame",value:function _deserializeFrame(t,e){var _this263=this;return _get(_getPrototypeOf(Nc.prototype),"_deserializeFrame",this).call(this,t,e).then(function(){var r=_this263._editor.operations.get("frame");var _e$options2=e.options,o=_e$options2.size,n=_e$options2.alpha,s=_e$options2.tintColor;var a={};if(typeof o!=="undefined"){a.scale=o;}if(typeof n!=="undefined"){a.alpha=n;}if(typeof s!=="undefined"){a.tintColor=Ut.fromArray(s.rgba);}r.set(a);});}},{key:"_deserializeTextDesign",value:function _deserializeTextDesign(t,e){var _this264=this;var r=e.options;var o=r.position,n=r.rotation,s=r.flipHorizontally,a=r.flipVertically,l=r.text,c=r.color,u=r.width,m=r.seed,p=r.inverted;var h=r.identifier;if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier;}else if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier;}var g=new uo(this._ui,this._getOptions("textdesign"));var x=new Di(this._ui,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true});var v=t.constructor.TextDesignSprite.AssetManager;var b=this._ui.getFontLoader();var T=g.getLayoutByIdentifier(h);var k=new T();b.setFonts(x.getFonts());v.setFonts(_objectSpread(_objectSpread({},v.getFonts()),x.getVariationsByIdentifier()));return b.load().then(function(){var E=k.getImagePaths().map(function(A){return{path:A,fullPath:_this264._ui.getAssetPath(A),image:null};});return v.loadImages(E).then(function(){k.onImagesLoaded();return t.createTextDesign({position:o,rotation:n,flipHorizontally:s,flipVertically:a,text:l,color:Ut.fromArray(c.rgba),width:u,seed:m,inverted:p,layout:k});});});}}]);return Nc;}(zc);Nc.version="3.0.0";});var Hc;var d2=d(function(){Ln();Hc=/*#__PURE__*/function(_t29){_inherits(Hc,_t29);var _super197=_createSuper(Hc);function Hc(){_classCallCheck(this,Hc);return _super197.apply(this,arguments);}return Hc;}(_t);Hc.prototype.availableOptions={identifier:{type:"string",required:true},defaultName:{type:"string",required:true},ratio:{type:"*",required:false,"default":null},selected:{type:"boolean",required:false},dimensions:{type:"vector2",required:false},lockDimensions:{type:"boolean",required:false,"default":null},forceDimensions:{type:"boolean",required:false,"default":null}};});var Wc;var m2=d(function(){ue();d2();l2();Wc=/*#__PURE__*/function(_Uc){_inherits(Wc,_Uc);var _super198=_createSuper(Wc);function Wc(){_classCallCheck(this,Wc);return _super198.apply(this,arguments);}_createClass(Wc,[{key:"serialize",value:function serialize(){var _this265=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return _get(_getPrototypeOf(Wc.prototype),"serialize",this).call(this,t).then(function(e){e.meta={platform:"html5",version:_this265._editor.getSDK().version,createdAt:Jt.ISODateString(new Date())};e.image=e.inputImage;delete e.inputImage;return e;});}},{key:"_serializeSticker",value:function _serializeSticker(t,e){var r=_get(_getPrototypeOf(Wc.prototype),"_serializeSticker",this).call(this,t,e);r.options.alpha=e.getAlpha();if(r.options.tintColor){r.options.tintColor={rgba:r.options.tintColor};}return r;}},{key:"_serializeText",value:function _serializeText(t,e){var r=_get(_getPrototypeOf(Wc.prototype),"_serializeText",this).call(this,t,e);r.options.color={rgba:r.options.color};r.options.backgroundColor={rgba:r.options.backgroundColor};r.options.flipHorizontally=false;r.options.flipVertically=false;delete r.options.fontWeight;return r;}},{key:"_serializePath",value:function _serializePath(t){var e=_get(_getPrototypeOf(Wc.prototype),"_serializePath",this).call(this,t);delete e.hardness;delete e.size;delete e.color;var r=t.getBrush();e.brush=r.serializeOptions(["identifier","size","color"],true);if(typeof e.brush.identifier==="undefined"){delete e.brush.identifier;}e.brush.color={rgba:e.brush.color};var o=r.getOption("hardness");if(o!=="undefined"){e.brush.hardness=o;}return e;}},{key:"_serializeFrameOperation",value:function _serializeFrameOperation(t,e){_get(_getPrototypeOf(Wc.prototype),"_serializeFrameOperation",this).call(this,t,e);var r=e.filter(function(n){return n.type==="sprite";});var o;if(r.length){o=r.pop();var n=o.options.sprites.filter(function(l){return l.type==="frame";})[0];var s=t.getTintColor();if(!s.equals(new Ut(1,1,1,0))){n.options.tintColor={rgba:t.serializeOption("tintColor",true)};}var a=t.serializeOptions(["scale","alpha"],true);n.options=_objectSpread(_objectSpread({},n.options),a);n.options.size=n.options.scale;delete n.options.scale;}}},{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=_get(_getPrototypeOf(Wc.prototype),"_serializeTransformOperation",this).call(this,t);if(t._ratio){var r;if(t._ratio instanceof Hc){r=t._ratio.getIdentifier();}else{r=t._ratio.identifier;}e.options.meta={identifier:r};}delete e.options.scale;return e;}},{key:"_serializeAdjustmentsOperation",value:function _serializeAdjustmentsOperation(t){var e=_get(_getPrototypeOf(Wc.prototype),"_serializeAdjustmentsOperation",this).call(this,t);var r=["gamma","whites","blacks","temperature"];var o=t.availableOptions;var n={};r.forEach(function(s){var a=o[s];var l=t.getOption(s);var c=a.minValue,u=a.midValue,m=a.maxValue;n[s]=l<=u?(l-c)/(u-c)-1:(l-u)/(m-u);});e.options=_objectSpread(_objectSpread({},e.options),n);return e;}},{key:"_serializeOperation",value:function _serializeOperation(t,e){switch(t.constructor.identifier){case"mirrored-focus":return this._serializeMirroredFocusOperation(t);case"linear-focus":return this._serializeLinearFocusOperation(t);case"blur":return this._serializeBlurOperation(t);default:return _get(_getPrototypeOf(Wc.prototype),"_serializeOperation",this).call(this,t,e);}}},{key:"_serializeMirroredFocusOperation",value:function _serializeMirroredFocusOperation(t){return{type:"focus",options:{type:"mirrored",options:t.serializeOptions(["start","end","blurRadius","size","gradientSize"],true)}};}},{key:"_serializeLinearFocusOperation",value:function _serializeLinearFocusOperation(t){var e=t.serializeOptions(["controlPoint1","controlPoint2","blurRadius"],true);e.start=e.controlPoint1;delete e.controlPoint1;e.end=e.controlPoint2;delete e.controlPoint2;return{type:"focus",options:{type:"linear",options:e}};}},{key:"_serializeBlurOperation",value:function _serializeBlurOperation(t){return{type:"focus",options:{type:"gaussian",options:t.serializeOptions(["blurRadius"],true)}};}}]);return Wc;}(Uc);Wc.version="3.0.0";});var q7={};de(q7,{"default":function _default(){return Fx;}});var Fx;var Y7=d(function(){u2();m2();Fx=/*#__PURE__*/function(){function Fx(t){_classCallCheck(this,Fx);this._editor=t;}_createClass(Fx,[{key:"serialize",value:function serialize(){var e=new Wc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Nc(this._editor,t);return e.deserialize();}}]);return Fx;}();Fx.version="3.0.0";});var Gc;var p2=d(function(){ue();hl();sm();u2();Gc=/*#__PURE__*/function(_Nc){_inherits(Gc,_Nc);var _super199=_createSuper(Gc);function Gc(){_classCallCheck(this,Gc);return _super199.apply(this,arguments);}_createClass(Gc,[{key:"_deserializeTextDesign",value:function _deserializeTextDesign(t,e){var _this266=this;var r=e.options;var o=r.position,n=r.rotation,s=r.flipHorizontally,a=r.flipVertically,l=r.text,c=r.color,u=r.width,m=r.seed,p=r.inverted;var h=r.identifier;if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier;}else if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier;}var g=new uo(this._ui,this._getOptions("textdesign"));var x=new Di(this._ui,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true});var v=t.constructor.TextDesignSprite.AssetManager;var b=this._ui.getFontLoader();var T=g.getLayoutByIdentifier(h);var k=new T();b.setFonts(x.getFonts());v.setFonts(_objectSpread(_objectSpread({},v.getFonts()),x.getVariationsByIdentifier()));return b.load().then(function(){var E=k.getImagePaths().map(function(A){return{path:A,fullPath:_this266._ui.getAssetPath(A),image:null};});return v.loadImages(E).then(function(){k.onImagesLoaded();return t.createTextDesign({position:o,rotation:n,flipHorizontally:s,flipVertically:a,text:l,color:Ut.fromArray(c.rgba),width:u,seed:m,inverted:p,layout:k});});});}}]);return Gc;}(Nc);Gc.version="3.1.0";});var Vc;var h2=d(function(){ue();m2();Vc=/*#__PURE__*/function(_Wc){_inherits(Vc,_Wc);var _super200=_createSuper(Vc);function Vc(){_classCallCheck(this,Vc);return _super200.apply(this,arguments);}_createClass(Vc,[{key:"_serializeTextDesign",value:function _serializeTextDesign(t,e){var r=e.serializeOptions(["position","rotation","flipHorizontally","flipVertically","text","color","width","seed","inverted"],true);r.color={rgba:r.color};var o=e.getLayout();if(o){r.identifier=o.constructor.identifier;}return{type:"textdesign",options:r};}}]);return Vc;}(Wc);Vc.version="3.1.0";});var J7={};de(J7,{"default":function _default(){return Ox;}});var Ox;var Z7=d(function(){p2();h2();Ox=/*#__PURE__*/function(){function Ox(t){_classCallCheck(this,Ox);this._editor=t;}_createClass(Ox,[{key:"serialize",value:function serialize(){var e=new Vc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Gc(this._editor,t);return e.deserialize();}}]);return Ox;}();Ox.version="3.1.0";});var jc;var f2=d(function(){ue();hl();sm();p2();jc=/*#__PURE__*/function(_Gc){_inherits(jc,_Gc);var _super201=_createSuper(jc);function jc(){_classCallCheck(this,jc);return _super201.apply(this,arguments);}_createClass(jc,[{key:"_deserializeTextDesign",value:function _deserializeTextDesign(t,e){var _this267=this;var r=e.options;var o=r.position,n=r.rotation,s=r.flipHorizontally,a=r.flipVertically,l=r.text,c=r.color,u=r.width,m=r.seed,p=r.inverted;var h=r.identifier;if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier;}else if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier;}var g="padding"in r?r.padding/u:-1;var x=new uo(this._ui,this._getOptions("textdesign"));var v=new Di(this._ui,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true});var b=t.constructor.TextDesignSprite.AssetManager;var T=this._ui.getFontLoader();var k=x.getLayoutByIdentifier(h);var E=new k();T.setFonts(v.getFonts());b.setFonts(_objectSpread(_objectSpread({},b.getFonts()),v.getVariationsByIdentifier()));return T.load().then(function(){var A=E.getImagePaths().map(function(I){return{path:I,fullPath:_this267._ui.getAssetPath(I),image:null};});return b.loadImages(A).then(function(){E.onImagesLoaded();return t.createTextDesign({position:o,rotation:n,flipHorizontally:s,flipVertically:a,text:l,color:Ut.fromArray(c.rgba),width:u,seed:m,inverted:p,layout:E,padding:g});});});}}]);return jc;}(Gc);jc.version="3.2.0";});var $c;var g2=d(function(){h2();$c=/*#__PURE__*/function(_Vc){_inherits($c,_Vc);var _super202=_createSuper($c);function $c(){_classCallCheck(this,$c);return _super202.apply(this,arguments);}_createClass($c,[{key:"_serializeTextDesign",value:function _serializeTextDesign(t,e){var r=e.serializeOptions(["position","rotation","flipHorizontally","flipVertically","text","color","width","seed","inverted","padding"],true);r.color={rgba:r.color};var o=e.getLayout();if(o){r.identifier=o.constructor.identifier;}r.padding*=r.width;return{type:"textdesign",options:r};}}]);return $c;}(Vc);$c.version="3.2.0";});var Q7={};de(Q7,{"default":function _default(){return Rx;}});var Rx;var tN=d(function(){f2();g2();Rx=/*#__PURE__*/function(){function Rx(t){_classCallCheck(this,Rx);this._editor=t;}_createClass(Rx,[{key:"serialize",value:function serialize(){var e=new $c(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new jc(this._editor,t);return e.deserialize();}}]);return Rx;}();Rx.version="3.2.0";});var Kc;var b2=d(function(){f2();Kc=/*#__PURE__*/function(_jc){_inherits(Kc,_jc);var _super203=_createSuper(Kc);function Kc(){_classCallCheck(this,Kc);return _super203.apply(this,arguments);}_createClass(Kc,[{key:"_deserializeOperation",value:function _deserializeOperation(t){return _get(_getPrototypeOf(Kc.prototype),"_deserializeOperation",this).call(this,t);}},{key:"_deserializeOrientationOperation",value:function _deserializeOrientationOperation(t){var e=t.options;var r=this._editor.operations.getOrCreate("orientation");if(!r)return Promise.resolve();r.set(e);return Promise.resolve(r);}}]);return Kc;}(jc);Kc.version="3.4.0";});var Xc;var y2=d(function(){Dx();g2();Xc=/*#__PURE__*/function(_$c){_inherits(Xc,_$c);var _super204=_createSuper(Xc);function Xc(){_classCallCheck(this,Xc);return _super204.apply(this,arguments);}_createClass(Xc,[{key:"_serializeOperation",value:function _serializeOperation(t,e){switch(t.constructor.identifier){case"artfilter":return this._serializeStyle(t);default:return _get(_getPrototypeOf(Xc.prototype),"_serializeOperation",this).call(this,t,e);}}},{key:"_serializeOrientationOperation",value:function _serializeOrientationOperation(t){return{type:"orientation",options:t.serializeOptions(["flipVertically","flipHorizontally","rotation"],true)};}},{key:"_serializeStyle",value:function _serializeStyle(t){var _t$getOptions=t.getOptions(),e=_t$getOptions.identifier,r=_t$getOptions.intensity,o=_t$getOptions.blendMode;var _t$getStyleTransferMo=t.getStyleTransferModel().getOptions(),n=_t$getStyleTransferMo.tileEdgeLength,s=_t$getStyleTransferMo.overlappingFactor;return{type:"artFilter",options:{identifier:e,intensity:r,blendMode:um[o],tileEdgeLength:n,overlappingFactor:s}};}}]);return Xc;}($c);Xc.version="3.4.0";});var eN={};de(eN,{"default":function _default(){return Ax;}});var Ax;var iN=d(function(){b2();y2();Ax=/*#__PURE__*/function(){function Ax(t){_classCallCheck(this,Ax);this._editor=t;}_createClass(Ax,[{key:"serialize",value:function serialize(){var e=new Xc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Kc(this._editor,t);return e.deserialize();}}]);return Ax;}();Ax.version="3.4.0";});var qc;var _2=d(function(){ue();hl();sm();b2();qc=/*#__PURE__*/function(_Kc){_inherits(qc,_Kc);var _super205=_createSuper(qc);function qc(){_classCallCheck(this,qc);return _super205.apply(this,arguments);}_createClass(qc,[{key:"_deserializeTextDesign",value:function _deserializeTextDesign(t,e){var _this268=this;var r=e.options;var o=r.position,n=r.rotation,s=r.flipHorizontally,a=r.flipVertically,l=r.text,c=r.color,u=r.width,m=r.seed,p=r.inverted,h=r.identifier;var g="padding"in r?r.padding/u:-1;var x=new uo(this._ui,this._getOptions("textdesign"));var v=new Di(this._ui,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true});var b=t.constructor.TextDesignSprite.AssetManager;var T=this._ui.getFontLoader();var k=x.getLayoutByIdentifier(h);var E=new k();T.setFonts(v.getFonts());b.setFonts(_objectSpread(_objectSpread({},b.getFonts()),v.getVariationsByIdentifier()));return T.load().then(function(){var A=E.getImagePaths().map(function(I){return{path:I,fullPath:_this268._ui.getAssetPath(I),image:null};});return b.loadImages(A).then(function(){E.onImagesLoaded();return t.createTextDesign({position:o,rotation:n,flipHorizontally:s,flipVertically:a,text:l,color:Ut.fromArray(c.rgba),width:u,seed:m,inverted:p,layout:E,padding:g});});});}}]);return qc;}(Kc);qc.version="3.5.0";});var Yc;var x2=d(function(){y2();Yc=/*#__PURE__*/function(_Xc){_inherits(Yc,_Xc);var _super206=_createSuper(Yc);function Yc(){_classCallCheck(this,Yc);return _super206.apply(this,arguments);}return Yc;}(Xc);Yc.version="3.5.0";});var rN={};de(rN,{"default":function _default(){return Bx;}});var Bx;var oN=d(function(){_2();x2();Bx=/*#__PURE__*/function(){function Bx(t){_classCallCheck(this,Bx);this._editor=t;}_createClass(Bx,[{key:"serialize",value:function serialize(){var e=new Yc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new qc(this._editor,t);return e.deserialize();}}]);return Bx;}();Bx.version="3.5.0";});var Jc;var v2=d(function(){ue();_2();Jc=/*#__PURE__*/function(_qc){_inherits(Jc,_qc);var _super207=_createSuper(Jc);function Jc(){_classCallCheck(this,Jc);return _super207.apply(this,arguments);}_createClass(Jc,[{key:"_deserializeAdjustmentsOperation",value:function _deserializeAdjustmentsOperation(t){var e=st.Operations.AdjustmentsOperation;return _get(_getPrototypeOf(Jc.prototype),"_deserializeAdjustmentsOperation",this).call(this,t).then(function(r){if(!r)return null;var o=t.options;var n="sharpness";var s={};if(typeof o[n]==="undefined")return;var _e$prototype$availabl3=e.prototype.availableOptions[n],a=_e$prototype$availabl3.minValue,l=_e$prototype$availabl3.midValue,c=_e$prototype$availabl3.maxValue;var u=o[n];u=u<0?l+(l-a)*u:l+(c-l)*u;s[n]=u;r.set(s);return r;});}}]);return Jc;}(qc);Jc.version="3.6.0";});var Zc;var C2=d(function(){x2();Zc=/*#__PURE__*/function(_Yc){_inherits(Zc,_Yc);var _super208=_createSuper(Zc);function Zc(){_classCallCheck(this,Zc);return _super208.apply(this,arguments);}_createClass(Zc,[{key:"_serializeAdjustmentsOperation",value:function _serializeAdjustmentsOperation(t){var e=_get(_getPrototypeOf(Zc.prototype),"_serializeAdjustmentsOperation",this).call(this,t);var r="sharpness";var o=t.availableOptions;var n={};var s=o[r];var a=t.getOption(r);var l=s.minValue,c=s.midValue,u=s.maxValue;n[r]=a<=c?(a-l)/(c-l)-1:(a-c)/(u-c);e.options=_objectSpread(_objectSpread({},e.options),n);return e;}}]);return Zc;}(Yc);Zc.version="3.6.0";});var nN={};de(nN,{"default":function _default(){return Px;}});var Px;var sN=d(function(){v2();C2();Px=/*#__PURE__*/function(){function Px(t){_classCallCheck(this,Px);this._editor=t;}_createClass(Px,[{key:"serialize",value:function serialize(){var e=new Zc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Jc(this._editor,t);return e.deserialize();}}]);return Px;}();Px.version="3.6.0";});var Qc;var S2=d(function(){Ln();v2();Qc=/*#__PURE__*/function(_Jc){_inherits(Qc,_Jc);var _super209=_createSuper(Qc);function Qc(){_classCallCheck(this,Qc);return _super209.apply(this,arguments);}_createClass(Qc,[{key:"deserialize",value:function deserialize(){var _this269=this;return this._validateVersion().then(function(){return _this269._deserializeAssetLibrary();}).then(function(){return _this269._deserializeInputImage();}).then(function(){return _this269._deserializeOperations();});}},{key:"_deserializeAssetLibrary",value:function _deserializeAssetLibrary(){var _this270=this;return new Promise(function(t,e){var r=_this270._data;if(!r.assetLibrary){t();return;}var o=r.assetLibrary.assets;var n=[];for(var s in o){n.push(_this270._deserializeCustomAssets(s,o[s]));}return Promise.all(n).then(function(){t();})["catch"](function(s){console.error(s);e(s);});});}},{key:"_deserializeCustomAssets",value:function _deserializeCustomAssets(t,e){switch(t){case"stickers":return this._deserializeCustomStickerAssets(e);default:return Promise.reject(new Error("Unknown asset type: ".concat(t)));}}},{key:"_deserializeCustomStickerAssets",value:function _deserializeCustomStickerAssets(t){var _this271=this;var e="none";var r=this._editor.getOptions().editor;if(r&&r.controlsOptions&&r.controlsOptions.sticker){e=r.controlsOptions.sticker.customStickerTintMode||"none";}var o=t.map(function(n){return new Promise(function(s,a){var l=n.identifier,c=n.raster;var u=n.svg!==void 0;var m="data:".concat(c.type,";base64,").concat(c.data);var p=new Xi();p.onload=function(){var h=_this271._editor.getSDK();p=h.correctExifOrientation(p);if(p.toDataURL){m=p.toDataURL();}var g={data:"",width:1,height:1};if(true){g=_this271._stickerManager.renderStickerThumbnailFromImage(p);}var x={identifier:l,defaultName:n.name||"",tintMode:e,images:{mediaBase:{uris:[m],rawData:true,isSVG:u,width:p.width,height:p.height},mediaThumb:{uris:[g.data],rawData:true,width:g.width,height:g.height}}};if(u){var v="data:image/svg+xml;base64,".concat(n.svg.data);x.images.mediaBase.uris.push(v);}s(x);};p.onerror=function(){a(new Error("Invalid base64 data: ".concat(m)));};p.src=m;});});return Promise.all(o).then(function(n){var s=_this271._editor.getDynamicAssetsLibrary();s.setAssets("sticker",n);_this271._stickerManager.reload();});}}]);return Qc;}(Jc);Qc.version="3.7.0";});var tu;var w2=d(function(){C2();tu=/*#__PURE__*/function(_Zc){_inherits(tu,_Zc);var _super210=_createSuper(tu);function tu(){_classCallCheck(this,tu);return _super210.apply(this,arguments);}_createClass(tu,[{key:"serialize",value:function serialize(){var _this272=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return _get(_getPrototypeOf(tu.prototype),"serialize",this).call(this,t).then(function(e){return _this272._serializeAssetLibrary(e).then(function(r){return r;});});}},{key:"_serializeAssetLibrary",value:function _serializeAssetLibrary(t){if(!this._editor.getDynamicAssetsLibrary){return Promise.resolve(t);}var e=this._editor.getDynamicAssetsLibrary();var r=this._serializeCustomStickerAssets(t,e);if(r.length===0){return Promise.resolve(t);}t.assetLibrary={assets:{stickers:r}};return Promise.resolve(t);}},{key:"_serializeCustomStickerAssets",value:function _serializeCustomStickerAssets(t,e){var r=e.getAssets("sticker");if(r.length===0){return[];}var o=t.operations.filter(function(a){return a.type==="sprite";}).flatMap(function(a){return a.options.sprites;}).filter(function(a){return a.type==="sticker";}).map(function(a){return a.options.identifier;});var n={};o.forEach(function(a){n[a]=true;});var s=r.filter(function(a){return n[a.identifier];});return s.map(function(a){var l=a.identifier,c=a.defaultName,u=a.images;var m=u.mediaBase.uris[0];var p=u.mediaBase.isSVG;var h=/^data:(image\/(jpeg|png));base64,(.*)$/g;var g=h.exec(m);var x=g[1];var v=g[3];var b={identifier:l,name:c,raster:{type:x,data:v}};if(c){b.name=c;}if(p){b.svg={data:u.mediaBase.uris[1].replace(/^data:image\/svg\+xml;base64,/g,"")};}return b;});}}]);return tu;}(Zc);tu.version="3.7.0";});var aN={};de(aN,{"default":function _default(){return Mx;}});var Mx;var lN=d(function(){S2();w2();Mx=/*#__PURE__*/function(){function Mx(t){_classCallCheck(this,Mx);this._editor=t;}_createClass(Mx,[{key:"serialize",value:function serialize(){var e=new tu(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Qc(this._editor,t);return e.deserialize();}}]);return Mx;}();Mx.version="3.7.0";});var eu;var T2=d(function(){S2();eu=/*#__PURE__*/function(_Qc){_inherits(eu,_Qc);var _super211=_createSuper(eu);function eu(){_classCallCheck(this,eu);return _super211.apply(this,arguments);}return eu;}(Qc);eu.version="3.8.0";});var iu;var k2=d(function(){w2();iu=/*#__PURE__*/function(_tu){_inherits(iu,_tu);var _super212=_createSuper(iu);function iu(){_classCallCheck(this,iu);return _super212.apply(this,arguments);}_createClass(iu,[{key:"_serializeSticker",value:function _serializeSticker(t,e){var r=_get(_getPrototypeOf(iu.prototype),"_serializeSticker",this).call(this,t,e);r.options.tintMode=e.getTintMode();return r;}}]);return iu;}(tu);iu.version="3.8.0";});var cN={};de(cN,{"default":function _default(){return Lx;}});var Lx;var uN=d(function(){T2();k2();Lx=/*#__PURE__*/function(){function Lx(t){_classCallCheck(this,Lx);this._editor=t;}_createClass(Lx,[{key:"serialize",value:function serialize(){var e=new iu(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new eu(this._editor,t);return e.deserialize();}}]);return Lx;}();Lx.version="3.8.0";});var ru;var I2=d(function(){ue();T2();ru=/*#__PURE__*/function(_eu){_inherits(ru,_eu);var _super213=_createSuper(ru);function ru(){_classCallCheck(this,ru);return _super213.apply(this,arguments);}_createClass(ru,[{key:"_deserializeTransformOperation",value:function _deserializeTransformOperation(t){var _this273=this;return _get(_getPrototypeOf(ru.prototype),"_deserializeCropOperation",this).call(this,t).then(function(e){if(!e)return;var r=Jt.Array.find(_this273._data.operations,function(o){return o.type==="orientation";});if(r){var o=r.options;e.rotate(o.rotation);if(o.flipHorizontally){e.flip("horizontal");e.setRotation(e.getRotation()*-1);}if(o.flipVertically){e.flip("vertical");e.setRotation(e.getRotation()*-1);}}e._ratio=null;return e;});}},{key:"_deserializeText",value:function _deserializeText(t,e){var r=e.options;var o=r.fontSize,n=r.lineHeight,s=r.fontIdentifier,a=r.alignment,l=r.rotation,c=r.maxWidth,u=r.color,m=r.backgroundColor;var p=this._ui.getFontLoader();var h=this._fontManager.getVariationByIdentifier(s);if(!h){h=this._fontManager.getDefaultVariation();}else{p.setFonts([h.getFont()]);}return p.load().then(function(){var g=t.getInputDimensions(false);var x=g.min();var v=g.x;var b=g.y;var T=c*x/v;var k=o*x/b;var E=t.createText({fontSize:k,lineHeight:n,fontFamily:h.getFontFamily(),fontWeight:h.getFontWeight(),fontIdentifier:h.getIdentifier(),textMetrics:h.getTextMetrics(),alignment:a,rotation:l,maxWidth:T,text:r.text,color:Ut.fromArray(u.rgba),backgroundColor:Ut.fromArray(m.rgba),position:Dt.fromObject(r.position)});E._edited=true;return E;});}}]);return ru;}(eu);ru.version="3.9.0";});var dN,ou;var D2=d(function(){d2();k2();dN=Math.PI*2;ou=/*#__PURE__*/function(_iu){_inherits(ou,_iu);var _super214=_createSuper(ou);function ou(){_classCallCheck(this,ou);return _super214.apply(this,arguments);}_createClass(ou,[{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=this._editor.operations;if(e.exists("orientation")){t=t.clone();var n=e.get("orientation");if(n.getFlipVertically()){t.flip("vertical");t.setRotation(t.getRotation()*-1);}if(n.getFlipHorizontally()){t.flip("horizontal");t.setRotation(t.getRotation()*-1);}t.rotate(-n.getRotation());}var r=t.serializeOptions(["start","end","rotation","textureScale"],true);r.rotation=(r.rotation+dN)%dN;if(r.textureScale!==1){r.dimensions=t.getNewDimensions(t.getInputDimensions(false));}delete r.textureScale;var o={type:"transform",options:r};if(t._ratio){var _n8;if(t._ratio instanceof Hc){_n8=t._ratio.getIdentifier();}else{_n8=t._ratio.identifier;}o.options.meta={identifier:_n8};}delete o.options.scale;return o;}},{key:"_serializeText",value:function _serializeText(t,e){var r=t.getInputDimensions(false);var o=_get(_getPrototypeOf(ou.prototype),"_serializeText",this).call(this,t,e);o.options.fontSize=o.options.fontSize*r.y/r.min();return o;}}]);return ou;}(iu);ou.version="3.9.0";});var mN={};de(mN,{"default":function _default(){return zx;}});var zx;var pN=d(function(){I2();D2();zx=/*#__PURE__*/function(){function zx(t){_classCallCheck(this,zx);this._editor=t;}_createClass(zx,[{key:"serialize",value:function serialize(){var e=new ou(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new ru(this._editor,t);return e.deserialize();}}]);return zx;}();zx.version="3.9.0";});var Wh;var hN=d(function(){I2();Wh=/*#__PURE__*/function(_ru){_inherits(Wh,_ru);var _super215=_createSuper(Wh);function Wh(){_classCallCheck(this,Wh);return _super215.apply(this,arguments);}return Wh;}(ru);Wh.version="3.12.0";});var Gh;var fN=d(function(){D2();Gh=/*#__PURE__*/function(_ou){_inherits(Gh,_ou);var _super216=_createSuper(Gh);function Gh(){_classCallCheck(this,Gh);return _super216.apply(this,arguments);}_createClass(Gh,[{key:"_serializeCustomStickerAssets",value:function _serializeCustomStickerAssets(t,e){var r=e.getAssets("sticker");if(r.length===0){return[];}var o=t.operations.filter(function(a){return a.type==="sprite";}).flatMap(function(a){return a.options.sprites;}).filter(function(a){return a.type==="sticker";}).map(function(a){return a.options.identifier;});var n={};o.forEach(function(a){n[a]=true;});var s=r.filter(function(a){return n[a.identifier];});return s.map(function(a){var l=a.identifier,c=a.defaultName,u=a.images;var m=u.mediaBase.uris[0];var p=u.mediaBase.isSVG;var h=/^data:(image\/(jpeg|png|gif));base64,(.*)$/g;var g=h.exec(m);var x=g[1];var v=g[3];var b={identifier:l,name:c,raster:{type:x,data:v}};if(c){b.name=c;}if(p){b.svg={data:u.mediaBase.uris[1].replace(/^data:image\/svg\+xml;base64,/g,"")};}return b;});}}]);return Gh;}(ou);Gh.version="3.12.0";});var gN={};de(gN,{"default":function _default(){return Ux;}});var Ux;var bN=d(function(){hN();fN();Ux=/*#__PURE__*/function(){function Ux(t){_classCallCheck(this,Ux);this._editor=t;}_createClass(Ux,[{key:"serialize",value:function serialize(){var e=new Gh(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Wh(this._editor,t);return e.deserialize();}}]);return Ux;}();Ux.version="3.12.0";});var yN,_N;var xN=d(function(){QT();k7();hl();To();ue();I7();D7();yN=/*#__PURE__*/function(_zh){_inherits(yN,_zh);var _super217=_createSuper(yN);function yN(t,e,r){var _this274;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;_classCallCheck(this,yN);_this274=_super217.call(this);_this274._ui=t;_this274._options=e;_this274._mediator=r;_this274._shallow=o;if(!o){_this274._initSDK();_this274.operations=new gx(_assertThisInitialized(_this274),_this274._sdk,_this274._mediator);}return _this274;}_createClass(yN,[{key:"_initFonts",value:function _initFonts(){var t=Jt.defaults(this._options.editor.controlsOptions.text,{additionalFonts:[],replaceFonts:false,availableVariations:null});this._fontManager=new Di(this._ui,t);var e=this._fontManager.getFonts();var r=this._ui.getFontLoader();r.setFonts(e);r.load();}},{key:"setImage",value:function setImage(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._options.editor.image;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(e){this.reset();}var r=null;r=this._sdk.parseExif(t);this._setImage(t,r);}},{key:"_initSDK",value:function _initSDK(){var _this$_options43=this._options,t=_this$_options43.logLevel,e=_this$_options43.displayWelcomeMessage,r=_this$_options43.debug,o=_this$_options43.license,n=_this$_options43.crossOrigin,s=_this$_options43.watermark;var _this$_options$editor=this._options.editor,a=_this$_options$editor.smoothDownscaling,l=_this$_options$editor.smoothUpscaling,c=_this$_options$editor.preferredRenderer,u=_this$_options$editor.pixelRatio,m=_this$_options$editor.transparent,p=_this$_options$editor.clearColor;var h;if(Array.isArray(p)){h=Ut.fromArray(p);}else if(typeof p==="string"){h=Ut.fromHex(p);}else if(p instanceof Ut){h=p.clone();}var g={logLevel:t,debug:r,displayWelcomeMessage:e,pixelRatio:u,smoothDownscaling:a,smoothUpscaling:l,transparent:m,crossOrigin:n,clearColor:h,license:o,watermark:s};this._sdk=new st(c,g);}},{key:"getMaxMegapixels",value:function getMaxMegapixels(){var t=this._options.editor.maxMegaPixels;return t;}},{key:"getCrossOrigin",value:function getCrossOrigin(){return Jt.getCrossOriginValue(this._options.crossOrigin||"anonymous");}},{key:"getOutputDimensions",value:function getOutputDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this._sdk.getOutputDimensions(t);}},{key:"getOutputTextureDimensions",value:function getOutputTextureDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this._sdk.getOutputTextureDimensions(t);}},{key:"getFinalDimensions",value:function getFinalDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this._sdk.getFinalDimensions(t);}},{key:"_setImage",value:function _setImage(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._options.editor.image;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;this._sdk.setAllOperationsToDirty();this._options.editor.image=t;this._sdk.setImage(t,e);}},{key:"_ensureImageIsResized",value:function _ensureImageIsResized(){var _this275=this;var t=this._sdk.getImage();var e=this._sdk.getRenderer();var r=this.getMaxMegapixels();var o=r?r*1e6:null;var n=e.getMaxDimensions();var s=new bx(t,o,n);if(!this._resizedImage&&s.needsResize()){return s.resize().then(function(_ref117){var a=_ref117.canvas,l=_ref117.dimensions,c=_ref117.reason;_this275._resizedImage=a;_this275._sdk.setImage(a);return a;});}return Promise.resolve(t);}},{key:"export",value:function _export(){var _this276=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(this._watermarkOperation){this._watermarkOperation.setEnabled(false);}this._sdk.setAllOperationsToDirty();return this._ensureImageIsResized().then(function(e){var r=_this276._options.editor["export"];var o=new fx(_this276._sdk,r,t);return o["export"]().then(function(n){_this276.emit("export",n);_this276._mediator.emit(pe.EVENTS.EXPORT,n,_this276);if(_this276._watermarkOperation){_this276._watermarkOperation.setEnabled(true);_this276._sdk.render();}_this276._sdk.setAllOperationsToDirty();return n;});});}},{key:"broadcastTransform",value:function broadcastTransform(t,e){var _this277=this;var r=new st.Operations.TransformOperation.TransformChange(t,e);var o=["sprite","selective-blur","radial-focus","mirrored-focus","linear-focus","blur"];o.forEach(function(n){var s=_this277.operations.get(n);if(!s){return;}s.transform(r);});}},{key:"broadcastFlip",value:function broadcastFlip(t){var _this278=this;var e=["mirrored-focus","radial-focus","linear-focus","sprite","selective-blur"];e.forEach(function(r){var o=_this278.operations.get(r);if(!o){return;}o.flip(t);});}},{key:"broadcastRotate",value:function broadcastRotate(t){var _this279=this;var e=["transform","mirrored-focus","linear-focus","radial-focus","sprite","selective-blur"];e.forEach(function(r){var o=_this279.operations.get(r);if(!o){return;}o.rotate(t);});}},{key:"_initSerializers",value:function _initSerializers(){this._serializers={"1.0.0":(N7(),Li(U7))["default"],"1.0.1":(G7(),Li(W7))["default"],"2.0.0":(X7(),Li(K7))["default"],"3.0.0":(Y7(),Li(q7))["default"],"3.1.0":(Z7(),Li(J7))["default"],"3.2.0":(tN(),Li(Q7))["default"],"3.4.0":(iN(),Li(eN))["default"],"3.5.0":(oN(),Li(rN))["default"],"3.6.0":(sN(),Li(nN))["default"],"3.7.0":(lN(),Li(aN))["default"],"3.8.0":(uN(),Li(cN))["default"],"3.9.0":(pN(),Li(mN))["default"],"3.12.0":(bN(),Li(gN))["default"]};}},{key:"serialize",value:function serialize(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"3.12.0";var r=this._serializers[e];if(!r){return Promise.reject(new Error("No serializer for version ".concat(e," found.")));}var o=new r(this);return o.serialize(t);}},{key:"deserialize",value:function deserialize(t){var e=this._serializers[t.version];if(!e){return Promise.reject(new Error("No serializer for version ".concat(t.version," found.")));}var r=new e(this);return r.deserialize(t);}},{key:"save",value:function save(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=this._options.editor.save;return this.serialize({image:e}).then(function(o){var n=JSON.stringify(o,null,2);if(t){var s="data:text/json;charset=utf-8;base64,".concat(window.encodeURI(window.btoa(n)));Ac.downloadDataURL(s,r.fileBasename);}return n;});}},{key:"reset",value:function reset(){this._sdk.reset();this.operations.reset();}},{key:"dispose",value:function dispose(){this.stop();if(this._resizedImage){$t(this._resizedImage);}this._sdk.dispose();}},{key:"getRenderer",value:function getRenderer(){return this._sdk.getRenderer();}},{key:"getSDK",value:function getSDK(){return this._sdk;}},{key:"getInputDimensions",value:function getInputDimensions(){return this._sdk.getInputDimensions();}},{key:"getImage",value:function getImage(){return this._sdk.getImage();}},{key:"getOptions",value:function getOptions(){return this._options;}},{key:"getUI",value:function getUI(){return this._ui;}},{key:"getMediator",value:function getMediator(){return this._mediator;}}]);return yN;}(zh);_N=yN;});var qs;var vN=d(function(){ue();Cd();JT();hl();sm();xN();vx();qs=/*#__PURE__*/function(_zh2){_inherits(qs,_zh2);var _super218=_createSuper(qs);function qs(){var _this280;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,qs);_this280=_super218.call(this);_this280._mediator=new zh();_this280._fontLoader=new fl(_assertThisInitialized(_this280));_this280._options=t;_this280._initOptions();_this280._initEvents();_this280._disposed=false;_this280._isReady=false;_this280._editor=new _N(_assertThisInitialized(_this280),_this280._options,_this280._mediator);if(_this280._options.editor.image){_this280._editor.setImage(_this280._options.editor.image);}_this280._mediator.once(pe.EVENTS.EDITOR_READY,function(){_this280._isReady=true;});Y.setLevel(_this280._options.logLevel);return _this280;}_createClass(qs,[{key:"export",value:function _export(){var _this$_editor;return(_this$_editor=this._editor)["export"].apply(_this$_editor,arguments);}},{key:"serialize",value:function serialize(){var _this$_editor2;return(_this$_editor2=this._editor).serialize.apply(_this$_editor2,arguments);}},{key:"deserialize",value:function deserialize(t){return this._editor.deserialize(t);}},{key:"getEditor",value:function getEditor(){return this._editor;}},{key:"isReady",value:function isReady(){return this._isReady;}},{key:"onReady",value:function onReady(t){if(!this._isReady){this._mediator.once(pe.EVENTS.EDITOR_READY,t);}else{t();}}},{key:"createFilter",value:function createFilter(t){var e=new Oc(this,this._getOptions("filter"));return e.instantiateFilterWithIdentifier(t);}},{key:"getTextDesignLayoutByID",value:function getTextDesignLayoutByID(t){var e=new uo(this,this._getOptions("textDesign"));return new(e.getLayoutByIdentifier(t))();}},{key:"getTextDesignAssetManager",value:function getTextDesignAssetManager(){return st.Operations.SpriteOperation.TextDesignSprite.AssetManager;}},{key:"getTextDesignFontManager",value:function getTextDesignFontManager(){var t=new Di(this,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true,isTextDesign:true});return t;}},{key:"_getOptions",value:function _getOptions(t){var e=this.getEditor();var r=e.controls;var o={};if(r&&r.get(t)){o=r.get(t).defaultOptions;}var n=e.getOptions();return Jt.deepDefaults({},n.editor.controlsOptions[t]||{},o);}},{key:"_initOptions",value:function _initOptions(){this._options=Jt.defaults(this._options,{language:"en",logLevel:"warn",crossOrigin:"anonymous",editor:{},assets:{},responsive:false,preloader:true,autoRun:true});this._options.editor=Jt.defaults(this._options.editor||{},{enableZoom:true,enableDrag:true,enableExport:true,enableKeyboardControls:true,enablePositionSnapping:true,enableRotationSnapping:true,enableSave:false,enableLoad:false,pixelRatio:Math.max(typeof window!=="undefined"&&window.devicePixelRatio||1,1),preferredRenderer:"webgl",transparent:true,clearColor:[0,0,0,0],displayResizeMessage:true,maxMegaPixels:{},displayCloseButton:false,undoMode:"global",defaultControl:"filter",forceCrop:false,snappingOptions:{},tools:["transform","filter","adjustments","focus","text","textdesign","sticker","brush","frame","overlay","library","artfilter"],controlsOrder:[["library"],["artfilter","transform","filter","adjustments","focus"],["text","textdesign","sticker","brush","frame","overlay"]],operationsOrder:["exif-orientation","artfilter","orientation","transform","filter","adjustments","radial-focus","mirrored-focus","linear-focus","blur","selective-blur","overlay","sprite","frame"],controlsOptions:{focus:{highQualityCanvasBlur:false}}});this._options.editor.snappingOptions=Jt.defaults(this._options.editor.snappingOptions,{position:{},rotation:{}});this._options.editor.snappingOptions.position=Jt.defaults(this._options.editor.snappingOptions.position,{padding:{},threshold:20});this._options.editor.snappingOptions.position.padding=Jt.defaults(this._options.editor.snappingOptions.position.padding,{left:.1,right:.1,top:.1,bottom:.1});this._options.editor.snappingOptions.rotation=Jt.defaults(this._options.editor.snappingOptions.rotation,{angles:[0,45,90,135,180,225,270,315],threshold:20});this._options.editor.controlsOptions.focus=Jt.defaults(this._options.editor.controlsOptions.focus,{highQualityCanvasBlur:false});this._options.editor.maxMegaPixels=Jt.defaults(this._options.editor.maxMegaPixels,{mobile:5,desktop:10});this._options.editor["export"]=Jt.defaults(this._options.editor["export"]||{},{format:"image/png",type:pl.IMAGE,download:true,fileBasename:"photoeditorsdk-export",quality:.8});this._options.editor.save=Jt.defaults(this._options.editor.save||{},{format:"text/json",download:true,fileBasename:"photoeditorsdk-save"});this._options.extensions=Jt.defaults(this._options.extensions||{},{languages:{},operations:[],controls:[]});this._options.assets=Jt.defaults(this._options.assets||{},{baseUrl:"assets",resolver:null});if(!(this._options.editor.image instanceof window.Image)){var t=new window.Image();if(this._options.editor.image){t.src=this._options.editor.image;this._options.editor.image=t;}}}},{key:"_initEvents",value:function _initEvents(){this._mediator.pipeEvents(this);}},{key:"_disposeEvents",value:function _disposeEvents(){this._mediator.unpipeEvents(this);}},{key:"setImage",value:function setImage(t){this._editor.setImage(t);}},{key:"getAssetPath",value:function getAssetPath(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var _this$_options$assets=this._options.assets,o=_this$_options$assets.baseUrl,n=_this$_options$assets.resolver;var s="".concat(o,"/").concat(t);n=n||function(u){return u;};if(t.match(/(ftp|http|https):\/\//)){s=t;}var a=t.replace(/assets\//,"").split("/");var l=a[0];var c={};switch(l){case"art-filters":c={identifier:a[1],type:a[2].split(".")[0]};return n("art-filter",c);case"filters":c={identifier:a[1].replace(/\.png$/g,"")};return n("filter",c);case"fonts":c={identifier:a[1].replace(/\.(woff|otf|ttf)$/g,"")};return n("font",c);case"frames":c={identifier:a[1],filename:a[2]};return n("frame",c);case"overlays":c={identifier:a[1].replace(/\.(png|jpg|jpeg)$/g,"")};return n("overlay",c);case"stickers":{var u=a[3].endsWith(".svg");var m=a[3]==="thumbs";c={category:a[1],identifier:(u?a[3]:a[4]).replace(/\.(png|svg)$/g,""),variant:u?"svg":m?"thumb":"base"};return n("sticker",c);}case"text-design":c={type:a[1]==="fonts"?"font":"image",identifier:a[2].replace(/\.(png|otf|ttf|woff2?)$/g,"")};return n("text-design",c);}if(typeof n!=="undefined"&&n!==null){s=n(s);}return s;}},{key:"getFontLoader",value:function getFontLoader(){return this._fontLoader;}},{key:"dispose",value:function dispose(){if(this._disposed){throw new Error("This instance of PhotoEditorSDK is already disposed.");}this._disposed=true;this._disposeEvents();}},{key:"render",value:function render(t){var _this281=this;return this.deserialize(t).then(function(){return _this281["export"]();});}}]);return qs;}(zh);qs.prototype.identifier="engine-wrapper";qs.Constants=pe;qs.Events=pe.EVENTS;qs.Utils=Ji;qs.JSONLoader=ro;qs.SDK=st;});var Vh=d(function(){vN();});var at={};de(at,{absoluteToRelativePoint:function absoluteToRelativePoint(){return xlt;},absoluteToRelativeSize:function absoluteToRelativeSize(){return ylt;},getBaseLocalToWorldMatrix:function getBaseLocalToWorldMatrix(){return Nx;},getLocalToParentMatrix:function getLocalToParentMatrix(){return SN;},getLocalToWorldMatrix:function getLocalToWorldMatrix(){return dm;},getPointInWorldSpace:function getPointInWorldSpace(){return F2;},getRotationBetweenCoordinateSpaces:function getRotationBetweenCoordinateSpaces(){return vlt;},getScalarInWorldSpace:function getScalarInWorldSpace(){return flt;},getSizeInOutputSpace:function getSizeInOutputSpace(){return glt;},getSizeInWorldSpace:function getSizeInWorldSpace(){return wN;},pointFromSpaceToSpace:function pointFromSpaceToSpace(){return jh;},rectTransformToAffineTransform:function rectTransformToAffineTransform(){return O2;},relativeToAbsolutePoint:function relativeToAbsolutePoint(){return _lt;},relativeToAbsoluteSize:function relativeToAbsoluteSize(){return blt;},scalarFromSpaceToSpace:function scalarFromSpaceToSpace(){return E2;},sizeFromSpaceToSpace:function sizeFromSpaceToSpace(){return hlt;}});function CN(i){return i.x!==void 0;}function O2(i){return wt.fromTRS(i.position.x,i.position.y,i.rotation,i.scale.x,i.scale.y);}function plt(i){if(i.getBaseLocalToParentMatrix){return i.getBaseLocalToParentMatrix();}return O2(i.getTransform());}function Nx(i){var t=i.getParent();var e=plt(i);if(t===void 0){return e;}var r=Nx(t);return wt.multiply(r,e);}function SN(i){if(i.getLocalToParentMatrix){return i.getLocalToParentMatrix();}return O2(i.getTransform());}function dm(i){var t=i.getParent();var e=SN(i);if(t===void 0){return e;}var r=dm(t);return wt.multiply(r,e);}function jh(i,t,e){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var o=t.type==="output"&&r?Nx(t):dm(t);var n=e.type==="output"&&r?Nx(e):dm(e);var s=wt.getInverted(n);return wt.transformPoint(s,wt.transformPoint(o,i));}function E2(i,t,e){var r=new O(i,0);var o=new O(jh(r,t,e));var n=new O(jh(O.ZERO,t,e));return O.distance(n,o);}function hlt(i,t,e){var r=CN(i)?i.x:i.width;var o=CN(i)?i.y:i.height;var n=E2(r,t,e);var s=E2(o,t,e);return{width:n,height:s};}function F2(i,t){var e=dm(t);return wt.transformPoint(e,i);}function flt(i,t){var e=new O(i,0);var r=new O(F2(e,t));var o=new O(F2(O.ZERO,t));return O.distance(r,o);}function wN(i){var t=dm(i);var e=i.getBounds();var r={x:e.width,y:0};var o={x:0,y:e.height};var n=new O(wt.transformPoint(t,O.ZERO));var s=new O(wt.transformPoint(t,r));var a=new O(wt.transformPoint(t,o));var l=O.distance(n,s);var c=O.distance(n,a);return{width:l,height:c};}function glt(i,t){var e=wN(i);var r=t.getTransform().scale;var o={x:1/r.x,y:1/r.y};var n={width:e.width*o.x,height:e.height*o.y};return n;}function blt(i,t){var e=t.getBounds();return{width:i.width*e.width,height:i.height*e.height};}function ylt(i,t){var e=t.getBounds();return{width:i.width/e.width,height:i.height/e.height};}function _lt(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var r=t.getBounds();return{x:i.x*r.width+(e?0:r.minX),y:i.y*r.height+(e?0:r.minY)};}function xlt(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var r=t.getBounds();return{x:(i.x-(e?0:r.minX))/r.width,y:(i.y-(e?0:r.minY))/r.height};}function vlt(i,t){var e={x:1,y:0};var r=jh(e,i,t,true);var o=jh(O.ZERO,i,t,true);return Math.atan2(r.y-o.y,r.x-o.x);}var TN=d(function(){U();});function Hx(i){return typeof i!=="string"&&!Array.isArray(i)&&i.a===void 0;}function Wx(i){return typeof i!=="string"&&Array.isArray(i)&&i.length===3;}function Gx(i){return typeof i!=="string"&&!Array.isArray(i)&&i.a!==void 0;}function Vx(i){return typeof i!=="string"&&Array.isArray(i)&&i.length===4;}function kN(i){return typeof i==="string";}var R2=d(function(){});var IN=d(function(){});var A2;var DN=d(function(){U();A2=/*#__PURE__*/function(){function A2(t,e){_classCallCheck(this,A2);this.engine=e;this.transform=_re.IDENTITY;this.canvasPivot={x:0,y:0};this.previewQuality=1;this.canvas=t;}_createClass(A2,[{key:"quality",get:function get(){return this.previewQuality;}},{key:"setQuality",value:function setQuality(t){this.previewQuality=Math.min(Math.max(t,.01),1);}},{key:"getTransform",value:function getTransform(){return this.transform;}},{key:"setTransform",value:function setTransform(t){this.transform=t;}},{key:"getPosition",value:function getPosition(){return this.transform.position;}},{key:"setPosition",value:function setPosition(t,e){var r;if(typeof t==="number"){r={x:t,y:e===void 0?t:e};}else{r=t;}var o=this.transform.scale;var n=this.transform.rotation;this.setTransform(new _re(r,o,n));}},{key:"getScale",value:function getScale(){return this.transform.scale;}},{key:"setScale",value:function setScale(t,e){var r;if(typeof t!=="number"){r=t;}else{r={x:t,y:e===void 0?t:e};}var o=this.transform.position;var n=this.transform.rotation;this.setTransform(new _re(o,r,n));}},{key:"getRotation",value:function getRotation(){return this.transform.rotation;}},{key:"setRotation",value:function setRotation(t){var e=this.transform.position;var r=this.transform.scale;this.setTransform(new _re(e,r,t));}},{key:"getCanvasPivot",value:function getCanvasPivot(){return this.canvasPivot;}},{key:"setCanvasPivot",value:function setCanvasPivot(t,e){if(typeof t==="number"){this.canvasPivot={x:t,y:_typeof(e)===void 0?t:e};}else{this.canvasPivot=t;}}},{key:"getCanvasBounds",value:function getCanvasBounds(){var t=this.canvasPivot;var _this$canvas=this.canvas,e=_this$canvas.width,r=_this$canvas.height;return new je(-t.x*e,-t.y*r,e,r);}}]);return A2;}();});function jx(i){return i.getTransform!==void 0;}function EN(i){return i.getContainer!==void 0;}var FN=d(function(){});var ON=d(function(){});var RN=d(function(){});var AN=d(function(){});var BN=d(function(){});var PN=d(function(){});var MN=d(function(){});var LN=d(function(){});var zN=d(function(){});var UN=d(function(){});var NN=d(function(){});var HN=d(function(){});var WN=d(function(){});var GN=d(function(){});var VN=d(function(){});var jN=d(function(){});var $N=d(function(){});var B2=d(function(){TN();R();R2();IN();DN();FN();ON();RN();AN();BN();PN();MN();LN();zN();UN();NN();HN();WN();GN();VN();jN();$N();});var P2;var KN=d(function(){U();B2();P2=/*#__PURE__*/function(_Tr2){_inherits(P2,_Tr2);var _super219=_createSuper(P2);function P2(t){var _this282;_classCallCheck(this,P2);_this282=_super219.call(this);_this282.config=t;return _this282;}_createClass(P2,[{key:"getOutputDimensions",value:function getOutputDimensions(){var t=this.getOutputContainer();if(!t){return{width:0,height:0};}return t.getResolution();}},{key:"getSmallerOutputSide",value:function getSmallerOutputSide(){var t=this.getOutputContainer();if(!t){return 0;}var e=t.getResolution();return Math.min(e.width,e.height);}},{key:"convertPointFromPreviewIntoOutputSpace",value:function convertPointFromPreviewIntoOutputSpace(t,e){var r=wt.getInverted(at.rectTransformToAffineTransform(e));return wt.transformPoint(r,t);}},{key:"convertPointFromPreviewIntoWorldSpace",value:function convertPointFromPreviewIntoWorldSpace(t,e,r){var o=wt.getInverted(at.rectTransformToAffineTransform(e));var n=r?this.getOutputContainer().getBaseLocalToParentMatrix():this.getOutputContainer().getLocalToParentMatrix();var s=wt.multiply(n,o);return wt.transformPoint(s,t);}},{key:"convertPointFromPreviewIntoFlippedPreviewSpace",value:function convertPointFromPreviewIntoFlippedPreviewSpace(t){var e=this.getOutputContainer().getFlipTransformMatrix();return wt.transformPoint(e,t);}},{key:"convertPointFromWorldIntoPreviewSpace",value:function convertPointFromWorldIntoPreviewSpace(t,e){var r=at.rectTransformToAffineTransform(e);var o=wt.getInverted(this.getOutputContainer().getLocalToParentMatrix());var n=wt.multiply(r,o);return wt.transformPoint(n,t);}},{key:"convertPointFromOutputIntoPreviewSpace",value:function convertPointFromOutputIntoPreviewSpace(t,e){var r=at.rectTransformToAffineTransform(e);return wt.transformPoint(r,t);}},{key:"getContainersAtPreviewPoint",value:function getContainersAtPreviewPoint(t,e){var r=new Array();var o=this.convertPointFromPreviewIntoWorldSpace(t,e);var n=this.getRootContainers();var _iterator7=_createForOfIteratorHelper(n),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var s=_step7.value;this.accumulateContainersAtWorldPointInHierarchy(o,s,r);}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}return r;}},{key:"isPreviewPointInContainer",value:function isPreviewPointInContainer(t,e,r){var o=this.convertPointFromPreviewIntoWorldSpace(t,r);return this.isWorldPointInContainer(o,e);}},{key:"isWorldPointInContainer",value:function isWorldPointInContainer(t,e){var r=at.getLocalToWorldMatrix(e);var o=wt.getInverted(r);var n=wt.transformPoint(o,t);return je.contains(e.getBounds(),n);}},{key:"accumulateContainersAtWorldPointInHierarchy",value:function accumulateContainersAtWorldPointInHierarchy(t,e,r){if(this.isWorldPointInContainer(t,e)){r.push(e);}var o=e.getChildren();var _iterator8=_createForOfIteratorHelper(o),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var n=_step8.value;if(jx(n)){this.accumulateContainersAtWorldPointInHierarchy(t,n,r);}}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}}]);return P2;}(Tr);});var ur=d(function(){B2();KN();});var si;var Go=d(function(){U();si=/*#__PURE__*/function(){function si(t){_classCallCheck(this,si);this.engine=t;this.id=At();}_createClass(si,[{key:"getID",value:function getID(){return this.id;}},{key:"getContainer",value:function getContainer(){return this.engine.getRootContainers()[0];}},{key:"getIndexInParent",value:function getIndexInParent(){var t=this.engine.rootOperations;for(var e=0;e0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,jt);this._x=t;this._y=e;}_createClass(jt,[{key:"x",get:function get(){return this._x;}},{key:"y",get:function get(){return this._y;}},{key:"set",value:function set(t,e){this._x=t;this._y=e;return this;}},{key:"clone",value:function clone(){return new _jt(this._x,this._y);}},{key:"copy",value:function copy(t){this._x=t.x;this._y=t.y;return this;}},{key:"clamped",value:function clamped(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this;var r=typeof t==="number"?{x:t,y:t}:t;var o=typeof e==="number"?{x:e,y:e}:e;this._x=Math.max(r.x,this._x);this._y=Math.max(r.y,this._y);this._x=Math.min(o.x,this._x);this._y=Math.min(o.y,this._y);return this;}},{key:"divide",value:function divide(t,e){if(typeof t==="number"||t===null){this._x/=t;this._y/=typeof e==="undefined"?t:e;}else{this._x/=t.x;this._y/=t.y;}return this;}},{key:"subtract",value:function subtract(t,e){if(typeof t==="number"||t===null){this._x-=t;this._y-=typeof e==="undefined"?t:e;}else{this._x-=t.x;this._y-=t.y;}return this;}},{key:"multiply",value:function multiply(t,e){if(typeof t==="number"||t===null){this._x*=t;this._y*=typeof e==="undefined"?t:e;}else{this._x*=t.x;this._y*=t.y;}return this;}},{key:"add",value:function add(t,e){if(typeof t==="number"||t===null){this._x+=t;this._y+=typeof e==="undefined"?t:e;}else{this._x+=t.x;this._y+=t.y;}return this;}},{key:"dot",value:function dot(t,e){if(typeof t==="number"||t===null){return this._x*t+this._y*(typeof e==="undefined"?t:e);}else{return this._x*t.x+this._y*t.y;}}},{key:"equals",value:function equals(t,e){if(typeof t==="number"||t===null){return t===this._x&&e===this._y;}else{return t.x===this._x&&t.y===this._y;}}},{key:"flip",value:function flip(){var t=this._x;this._x=this._y;this._y=t;return this;}},{key:"round",value:function round(){this._x=Math.round(this._x);this._y=Math.round(this._y);return this;}},{key:"ceil",value:function ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y);return this;}},{key:"floor",value:function floor(){this._x=this._x|0;this._y=this._y|0;return this;}},{key:"abs",value:function abs(){this._x=Math.abs(this._x);this._y=Math.abs(this._y);return this;}},{key:"len",value:function len(){return Math.sqrt(this._x*this._x+this._y*this._y);}},{key:"min",value:function min(){return Math.min(this._x,this._y);}},{key:"max",value:function max(){return Math.max(this._x,this._y);}},{key:"toObject",value:function toObject(){return{x:this._x,y:this._y};}},{key:"toString",value:function toString(){return"Vector2({ x: ".concat(this._x,", y: ").concat(this._y," })");}},{key:"roundDecimal",value:function roundDecimal(t){this._x=parseFloat(this._x.toFixed(t));this._y=parseFloat(this._y.toFixed(t));return this;}},{key:"asArray",value:function asArray(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(t){return[this._y,this._x];}return[this._x,this._y];}}],[{key:"fromObject",value:function fromObject(t){return new _jt(t.x,t.y);}},{key:"fromSize",value:function fromSize(t){return new _jt(t.width,t.height);}},{key:"NULL",get:function get(){return new _jt(0,0);}}]);return jt;}();});var zr;var yl=d(function(){U();ur();bl();zr=/*#__PURE__*/function(){function zr(t){_classCallCheck(this,zr);this.engine=t;this.id=At();this.transform=_re.IDENTITY;this.bounds=je.ZERO;}_createClass(zr,[{key:"getID",value:function getID(){return this.id;}},{key:"getParent",value:function getParent(){var t=this.engine.getRootContainers();if(t.length===0||this.id===t[0].id){return void 0;}return t[0];}},{key:"getIndexInParent",value:function getIndexInParent(){var t=this.engine.rootOperations;for(var e=0;e0&&(this.id===t[0].id||this.id===this.engine.getOutputContainer().id)){return this.engine.rootOperations;}return[];}},{key:"getBounds",value:function getBounds(){return this.bounds;}},{key:"setPivotOnSelfAndSprite",value:function setPivotOnSelfAndSprite(t,e,r){if(typeof e==="number"){this.setPivotInternal(e,r);t.setPivot(new _jt(e,r));}else{this.setPivotInternal(e);t.setPivot(_jt.fromObject(e));}}},{key:"setPivot",value:function setPivot(t,e){this.setPivotInternal(t,e);}},{key:"getPivot",value:function getPivot(){var t=this.getBounds();return{x:-t.minX/t.width,y:-t.minY/t.height};}},{key:"getTransform",value:function getTransform(){return this.transform;}},{key:"setTransform",value:function setTransform(t){this.transform=t;}},{key:"updateTransform",value:function updateTransform(){this.setTransform(this.transform);}},{key:"getPosition",value:function getPosition(){return this.transform.position;}},{key:"setPosition",value:function setPosition(t,e){var r;if(typeof t==="number"){r={x:t,y:e===void 0?t:e};}else{r=t;}var o=this.transform.scale;var n=this.transform.rotation;this.setTransform(new _re(r,o,n));}},{key:"getScale",value:function getScale(){return this.transform.scale;}},{key:"setScale",value:function setScale(t,e){var r;if(typeof t!=="number"){r=t;}else{r={x:t,y:e===void 0?t:e};}var _this$transform=this.transform,o=_this$transform.position,n=_this$transform.rotation;this.setTransform(new _re(o,r,n));}},{key:"getRotation",value:function getRotation(){return this.transform.rotation;}},{key:"setRotation",value:function setRotation(t){var _this$transform2=this.transform,e=_this$transform2.position,r=_this$transform2.scale;this.setTransform(new _re(e,r,t));}},{key:"getSizeInWorldSpace",value:function getSizeInWorldSpace(){return at.getSizeInWorldSpace(this);}},{key:"getSizeInOutputSpace",value:function getSizeInOutputSpace(){return at.getSizeInOutputSpace(this,this.engine.getOutputContainer());}},{key:"setSizeInWorldSpace",value:function setSizeInWorldSpace(t){var e=this.getBounds();this.setScale(t.width/e.width,t.height/e.height);}},{key:"setSizeInOutputSpace",value:function setSizeInOutputSpace(t){var e=this.engine.getOutputContainer().getScale();this.setSizeInWorldSpace({width:t.width/e.x,height:t.height/e.y});}},{key:"isValid",value:function isValid(){return this.getIndexInParent()!==-1;}},{key:"setPivotInternal",value:function setPivotInternal(t,e){var r=this.getBounds();if(typeof t==="number"){this.setBoundsFromSize(r.width,r.height,{x:t,y:e});}else{this.setBoundsFromSize(r.width,r.height,t);}}},{key:"setBoundsFromSize",value:function setBoundsFromSize(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.getPivot();this.bounds=new je(-r.x*t,-r.y*e,t,e);}}]);return zr;}();});var z2;var XN=d(function(){U();ur();mm();yl();bl();z2=/*#__PURE__*/function(_zr){_inherits(z2,_zr);var _super221=_createSuper(z2);function z2(t,e){var _this284;_classCallCheck(this,z2);_this284=_super221.call(this,e);_this284.type="drawing";_this284.drawing=t;_this284.operation=e.createSpriteOperation();_this284.sprite=_this284.operation.createBrush({});_this284.operation.addSprite(_this284.sprite);_this284.radialBrush=_this284.sprite._createRadialBrush();var r=e.getRootContainers()[0];var o=r.getBounds();_this284.bounds=new je(0,0,o.width,o.height);_this284.setTransform(_re.IDENTITY);_this284.operation.setDirty(true);_this284.setData(t);return _this284;}_createClass(z2,[{key:"beginStroke",value:function beginStroke(t){if(this.currentStroke){throw new Error("A brush stroke has already been started but not finished.");}if(t.id!=="imgly_brush_radial"){throw new Error("This adapter does not support any brush faces other than the radial img.ly brush.");}this.currentBrush=t;this.currentStroke={brush:t,path:{controlPoints:[]}};this.radialBrush.setColor(dr(t.color));this.radialBrush.setHardness(t.hardness);this.radialBrush.setSize(t.size);this.currentPath=this.sprite.createPath(this.radialBrush.clone());}},{key:"addPointToCurrentStroke",value:function addPointToCurrentStroke(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(!this.currentStroke||!this.currentBrush||!this.currentPath){throw new Error('A brush stroke has to first be started with a call to "beginStroke(brush:Brush)"');}if(this.currentStroke.path.controlPoints.length){var l=this.currentStroke.path.controlPoints;var c=l[l.length-1];var u=this.currentBrush.size/10;var m=Math.sqrt(t.x-Math.pow(c.x,2)+(t.y-Math.pow(c.y,2)));if(m=0){this.sprite.setAlpha(t.opacity);}if(t.tintColor){this.sprite.setTintColor(dr(t.tintColor));}if(t.tintMode){this.sprite.setTintMode(t.tintMode);}this.operation.setDirty(true);}},{key:"getData",value:function getData(){return this.data;}},{key:"updateData",value:function updateData(){this.setData(this.getData());}},{key:"setTransform",value:function setTransform(t){_get(_getPrototypeOf(qx.prototype),"setTransform",this).call(this,t);var e=this.engine.getOutputContainer();var r=this.getParent();var o={width:this.bounds.width*t.scale.x,height:this.bounds.height*t.scale.y};var n=at.sizeFromSpaceToSpace(o,r,e);this.sprite.setDimensions(_jt.fromSize(n));var s=at.pointFromSpaceToSpace(t.position,r,e,true);var a=at.absoluteToRelativePoint(s,e,false);this.sprite.setPosition(new _jt(a.x,a.y));var l=at.getRotationBetweenCoordinateSpaces(r,e);var c=t.rotation+l;this.sprite.setRotation(c);this.operation.setDirty(true);}},{key:"setPivot",value:function setPivot(t,e){this.setPivotOnSelfAndSprite(this.sprite,t,e);}},{key:"getOperation",value:function getOperation(){return this.operation;}},{key:"setFlipHorizontally",value:function setFlipHorizontally(t){this.sprite.setFlipHorizontally(t);}},{key:"setFlipVertically",value:function setFlipVertically(t){this.sprite.setFlipVertically(t);}},{key:"getFlipHorizontally",value:function getFlipHorizontally(){return this.sprite.getFlipHorizontally();}},{key:"getFlipVertically",value:function getFlipVertically(){return this.sprite.getFlipVertically();}}]);return qx;}(zr);});var pm,Slt,$h;var hm=d(function(){pm=function pm(i){return 2*Math.PI-i;};Slt=function Slt(i){return-i;};$h=function $h(_ref119){var i=_ref119.rotation,_ref119$outputRotatio=_ref119.outputRotation,t=_ref119$outputRotatio===void 0?0:_ref119$outputRotatio,e=_ref119.flipHorizontally,r=_ref119.flipVertically;var o=i;if(e){o=pm(o);}if(r){o=Slt(o);}return o+t;};});function wlt(i,t){if(t){var e=1/t.unitsPerEm*i;var r=t.ascender*e;var o=t.descender*e;return r+Math.abs(o);}return i*1.1;}function nu(i,t,e,r,o,n,s){i.font="".concat(e.fontStyle||"normal"," ").concat(e.fontWeight||"normal"," ").concat(r,"px \"").concat(e.fontFamily,"\"");var a=new _Yx(i);a.setText(t);a.setMaxWidth(n);var l=a.getLines().map(function(p){return p.replace(/\s+$/i,"");});var c=wlt(r,s);var u=c*o;var m=c/5;return{width:n+m*2,height:l.length*u+m*2};}var _Yx;var ik=d(function(){_Yx=/*#__PURE__*/function(){function Yx(t){_classCallCheck(this,Yx);this.context=t;this.sourceLines=[];this.maxWidth=100;}_createClass(Yx,[{key:"getLines",value:function getLines(){var t=[];var e=[];var r=this.sourceLines.length;for(var o=0;othis.maxWidth){if(e.length>0){t.push(e.join(""));e=[c];}var p=c.replace(/\s+$/i,"");if(this.getWidth(p)>this.maxWidth){var h=this.splitWord(c);t=t.concat(h.lines);if(h.rest){e=[h.rest];}}}else{e.push(c);}}t.push(e.join(""));e=[];}return t;}},{key:"splitWord",value:function splitWord(t){var e={lines:[],rest:null};var r=t.length;var o=[];for(var n=0;nthis.maxWidth){if(o.length>0){e.lines.push(o.join(""));}o=[s];}else{o.push(s);}if(n===r-1&&o.length>0){e.rest=o.join("");}}return e;}},{key:"getWidth",value:function getWidth(t){return this.context.measureText(t).width;}},{key:"setText",value:function setText(t){this.sourceLines=t.split("\n");}},{key:"setMaxWidth",value:function setMaxWidth(t){this.maxWidth=t;}}],[{key:"buildWords",value:function buildWords(t){var e=[];var r="";var o=t.length;for(var n=0;n2&&arguments[2]!==undefined?arguments[2]:true;var o=t.inverted&&r?Math.max(0,2*t.padding):0;var n=t.width/rk;if(this.currentLayoutSize===void 0){e.seed(t.seed);var s=e.generateLayoutData(t.text,rk);this.currentLayoutData=s;this.currentLayoutSize=s.getSize();}return new je(0,0,this.currentLayoutSize.width*n+o,this.currentLayoutSize.height*n+o);}},{key:"findNextUniqueSeed",value:function findNextUniqueSeed(t,e,r){var o=r;var n=this.currentLayoutData?_su.stringify(this.currentLayoutData.getRows()):"";var s;for(var a=0;a<20;a+=1){e.seed(o);s=e.generateLayoutData(t.text,rk);if(n===_su.stringify(s.getRows())){o+=1;}else{break;}}e.seed(o);this.currentLayoutData=s;return o;}},{key:"setData",value:function setData(t){this.textDesign=_objectSpread(_objectSpread({},this.textDesign),t);if(t.id){this.id=t.id;}if(t.padding!==void 0){var e=this.textDesign.width;this.sprite.setPadding(t.padding/e);}else if(t.width){this.textDesign.padding=this.sprite.getPadding()*this.textDesign.width;}if(t.seed!==void 0){if(t.seed<0){t.seed=this.findNextUniqueSeed(this.textDesign,this.layout,Date.now());this.textDesign.seed=t.seed;}this.currentLayoutSize=void 0;this.layout.seed(t.seed);this.sprite.setSeed(t.seed);this.sprite.setLayout(this.layout);}if(t.color){this.sprite.setColor(dr(t.color));}if(t.inverted!==void 0){this.sprite.setInverted(t.inverted);}if(t.text){this.currentLayoutSize=void 0;this.sprite.setText(t.text);}if(t.width){var _e10=this.engine.getOutputContainer();var r=this.getParent();var o=_e10.getBounds();var n=Math.min(o.width,o.height);var s=at.scalarFromSpaceToSpace(t.width/n,r,_e10);this.sprite.setWidth(s);}if(t.padding!==void 0||t.seed!==void 0||t.inverted!==void 0||t.text||t.width){var _e11=this.calculateBounds(this.textDesign,this.layout);this.setBoundsFromSize(_e11.width,_e11.height);this.updatePivot();}this.operation.setDirty(true);}},{key:"getData",value:function getData(){return this.textDesign;}},{key:"updateData",value:function updateData(){this.setData(this.getData());}},{key:"setTransform",value:function setTransform(t){_get(_getPrototypeOf(su.prototype),"setTransform",this).call(this,t);var e=this.engine.getOutputContainer();var r=this.getParent();if(t.scale.x!==1||t.scale.y!==1){throw new Error("This engine doesn't support scaling TextDesign containers! You can change the bounds using the width property of the TextDesign data.");}var o=at.pointFromSpaceToSpace(t.position,r,e,true);var n=at.absoluteToRelativePoint(o,e,false);this.sprite.setPosition(new _jt(n.x,n.y));var s=at.getRotationBetweenCoordinateSpaces(r,e);this.sprite.setRotation(t.rotation+s);this.operation.setDirty(true);}},{key:"setPivot",value:function setPivot(t,e){if(typeof t==="number"){_get(_getPrototypeOf(su.prototype),"setPivot",this).call(this,t,e);}else{_get(_getPrototypeOf(su.prototype),"setPivot",this).call(this,t);}this.updatePivot();}},{key:"getOperation",value:function getOperation(){return this.operation;}},{key:"getLayoutID",value:function getLayoutID(){return this.layoutID;}},{key:"setFlipHorizontally",value:function setFlipHorizontally(t){this.sprite.setFlipHorizontally(t);}},{key:"setFlipVertically",value:function setFlipVertically(t){this.sprite.setFlipVertically(t);}},{key:"getFlipHorizontally",value:function getFlipHorizontally(){return this.sprite.getFlipHorizontally();}},{key:"getFlipVertically",value:function getFlipVertically(){return this.sprite.getFlipVertically();}},{key:"updatePivot",value:function updatePivot(){var t=this.textDesign.inverted?Math.max(0,this.textDesign.padding):0;var e=new O(this.bounds.width-2*t,this.bounds.height-2*t);var r=this.getPivot();var o=new O(r.x*this.bounds.width,r.y*this.bounds.height);var n=new O(t,t);var s=o.subtract(n);var a=s.divide(e);this.sprite.setPivot(new _jt(a.x,a.y));}}],[{key:"stringify",value:function stringify(t){return JSON.stringify(t,_su.serializer());}},{key:"serializer",value:function serializer(){var t=[];var e=[];var r=function r(o,n){if(t[0]===n)return"[Circular ~]";return"[Circular ~.".concat(e.slice(0,t.indexOf(n)).join("."),"]");};return function o(n,s){var a=this;if(t.length>0){var l=t.indexOf(a);if(~l){t.splice(l+1);e.splice(l,Infinity,n);}else{t.push(a);e.push(n);}if(~t.indexOf(s)){s=r.call(a,n,s);}}else{t.push(s);}return s;};}}]);return su;}(zr);});var ai,Jx,fm;var tH=d(function(){Vh();Tt();R();U();ur();L2();XN();N2();qN();YN();V2();j2();K2();q2();J2();Z2();Q2();ek();JN();ZN();QN();bl();ai=st.Operations.OverlayOperation.BLEND_MODES;Jx="imgly_font_open_sans_bold";fm=/*#__PURE__*/function(_P2){_inherits(fm,_P2);var _super235=_createSuper(fm);function fm(t){var _this302;_classCallCheck(this,fm);_this302=_super235.call(this,t);_this302.previews=Array();_this302.rootOperationStack=[];_this302.deferredRenderQueue=[];_this302.operationStackOffset=1;_this302.enforceOperationOrder=function(){_this302.refreshFlipIndex();_this302.refreshFrameIndex();};_this302.isSpriteTop=function(t){var e=_this302.rootOperationStack.findIndex(function(_ref121){var o=_ref121.id;return t===o;});var r=1;if(_this302.rootOperationStack.find(function(o){return o.type==="frame";})){r+=1;}return e+r===_this302.rootOperationStack.length;};_this302.setWatermarkOpacity=function(t){var e=_this302.sdk.getOperationsStack();var r=e.getByIdentifier("watermark");if(r){r.set({alpha:t});}};var r,o;_this302.assetProvider=t.assetProvider||new _p();var e;if(((r=t==null?void 0:t.watermark)==null?void 0:r.watermarkURI)&&typeof t.watermark.watermarkURI==="string"&&t.watermark.watermarkURI.slice(0,5)==="data:"){e=t.watermark.watermarkURI;}else if(((o=t==null?void 0:t.watermark)==null?void 0:o.watermarkURI)&&typeof t.watermark.watermarkURI==="string"&&t.watermark.watermarkURI.trim()){e=cn(t.watermark.watermarkURI)?t.watermark.watermarkURI:_this302.assetProvider.getPath(t.watermark.watermarkURI);}_this302.wrapper=new qs({license:t.license,crossOrigin:t.crossOrigin,assets:{resolver:function resolver(n,s){return _this302.resolveAssetForSDK(n,s);}},editor:{preferredRenderer:t.preferredRenderer,pixelRatio:1,clearColor:ct(t.backgroundColor)},watermark:_objectSpread(_objectSpread({},ct(t.watermark)),{},{watermarkURI:e})});_this302.editor=_this302.wrapper.getEditor();_this302.sdk=_this302.editor.getSDK();_this302.sdk.setRenderMode("adapter");_this302.tempCanvas=document.createElement("canvas");_this302.sdk.setCanvas(_this302.tempCanvas);if(t.preferredRenderer==="webgl"){var n=document.createElement("canvas");var s=n.getContext("webgl")||n.getContext("experimental-webgl");_this302.maxTextureDimension=s.getParameter(s.MAX_TEXTURE_SIZE);$t(n);}else{_this302.maxTextureDimension=Infinity;}return _this302;}_createClass(fm,[{key:"configuration",get:function get(){return this.config;}},{key:"pesdk",get:function get(){return this.sdk;}},{key:"rootOperations",get:function get(){return this.rootOperationStack;}},{key:"dispose",value:function dispose(){$t(this.tempCanvas);this.rootContainer.dispose();this.pesdk.dispose();this.wrapper.dispose();}},{key:"render",value:function render(t){var _this303=this;return new Promise(function(e){var r=function r(){return new Promise(function(o){var n=t.canvas;var s=t.getTransform();var a=_this303.outputContainer.getPivot();var l=t.getCanvasBounds();var c=t.quality;var u=_this303.tempCanvas;_this303.sdk.setTextureQuality(c);var m=_this303.sdk.getOutputDimensions();u.width=m.x;u.height=m.y;_this303.sdk.getRenderer().resizeTo(new _jt(u.width,u.height));return _this303.sdk.render(true).then(function(){var p=n.getContext("2d");p.clearRect(0,0,n.width,n.height);p.save();p.translate(-l.minX,-l.minY);p.translate(s.position.x,s.position.y);p.rotate(s.rotation);p.scale(s.scale.x,s.scale.y);p.translate(-a.x*u.width,-a.y*u.height);p.scale(1/t.quality,1/t.quality);p.drawImage(u,0,0);p.restore();e();_this303.deferredRenderQueue.shift();if(_this303.deferredRenderQueue.length){_this303.sdk.setAllOperationsToDirty();Promise.resolve(_this303.deferredRenderQueue[0]().then(o));}else{o();}});});};_this303.deferredRenderQueue.push(r);if(_this303.deferredRenderQueue.length===1){r();}});}},{key:"createPreview",value:function createPreview(t){var e=new A2(t,this);this.previews.push(e);return e;}},{key:"export",value:function(){var _export2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee14(){var _this304=this;var t,e,r,o,n,_args15=arguments;return regeneratorRuntime.wrap(function _callee14$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:t=_args15.length>0&&_args15[0]!==undefined?_args15[0]:"image";e=_args15.length>1&&_args15[1]!==undefined?_args15[1]:"image/png";r=_args15.length>2&&_args15[2]!==undefined?_args15[2]:1;o=_args15.length>3&&_args15[3]!==undefined?_args15[3]:true;n=_args15.length>4&&_args15[4]!==undefined?_args15[4]:false;return _context15.abrupt("return",new Promise(function(s){var a=function a(){return new Promise(function(l){return _this304.sdk["export"](_this304.mapToRenderType(t),_this304.mapToImageFormat(e),r,o,n).then(function(c){s(c);_this304.deferredRenderQueue.shift();if(_this304.deferredRenderQueue.length){Promise.resolve(_this304.deferredRenderQueue[0]().then(l));}else{l();}});});};_this304.deferredRenderQueue.push(a);if(_this304.deferredRenderQueue.length===1){a();}}));case 6:case"end":return _context15.stop();}}},_callee14);}));function _export(){return _export2.apply(this,arguments);}return _export;}()},{key:"getRootContainers",value:function getRootContainers(){return[this.rootContainer];}},{key:"getOutputContainer",value:function getOutputContainer(){return this.outputContainer;}},{key:"findContainerByID",value:function findContainerByID(t){if(t===this.rootContainer.getID()){return this.rootContainer;}return this.rootOperationStack.find(function(e){return e.getID()===t;});}},{key:"findEffectByID",value:function findEffectByID(t){return this.rootOperationStack.find(function(e){return e.getID()===t;});}},{key:"addImage",value:function addImage(t,e,r){if(this.rootContainer){throw new Error("A background image already exists - did you mean to use addSticker?");}var o=new $x(t,this);this.rootContainer=o;if(!this.outputContainer){var _o$getBounds=o.getBounds(),n=_o$getBounds.width,s=_o$getBounds.height;var a={resolution:{width:n,height:s},flipHorizontally:false,flipVertically:false};var l=this.sdk.createOperation("output",{},false);var c=this.sdk.createOperation("flip",{},false);this.insertIntoOperationsStack(l,this.operationStackOffset-1);this.insertIntoOperationsStack(c,this.operationStackOffset);this.outputContainer=new Kx(a,l,c,this);}return o;}},{key:"addSticker",value:function addSticker(t,e,r){if(!e){throw new Error("This engine does not support adding stickers as root elements.");}this.ensureContainerIsRoot(e);var o=new qx(t,this);this.addToStackAtIndex(o,r);return o;}},{key:"addStickerFromAssets",value:function addStickerFromAssets(t,e,r){var _this305=this;if(!e){throw new Error("This engine does not support adding stickers as root elements.");}this.ensureContainerIsRoot(e);return new Promise(function(o,n){var s=new Image();s.onload=function(){var a={image:s,opacity:1};var l=new qx(a,_this305);_this305.addToStackAtIndex(l,r);o(l);};s.onerror=function(a){n(a);};s.crossOrigin=_this305.config.crossOrigin||null;s.src=_this305.assetProvider.getAssetSource("sticker",t);});}},{key:"addText",value:function addText(t,e,r){if(!e){throw new Error("This engine does not support adding text as root elements.");}var o=this.assetProvider.getFontManager();if(!o.isFontLoaded(t.fontIdentifier||Jx)){throw new Error("Adding text synchronously only works if the required font is already loded! Consider using the asynchronous addTextWithFontLoading function instead!");}this.ensureContainerIsRoot(e);var n=_objectSpread({text:"",fontIdentifier:Jx,fontSize:20,lineHeight:1,alignment:"center",textColor:[1,1,1],backgroundColor:[0,0,0,0],width:100},t);var s=new _Ys(n,this);this.addToStackAtIndex(s,r);return s;}},{key:"addTextWithFontLoading",value:function addTextWithFontLoading(t,e,r){var _this306=this;if(!e){throw new Error("This engine does not support adding text as root elements.");}var o=this.assetProvider.getFontManager();var n=t.fontIdentifier||Jx;return new Promise(function(s,a){o.loadFontWithIdentifier(n).then(function(){_this306.ensureContainerIsRoot(e);var l=_objectSpread({text:"",fontIdentifier:Jx,fontSize:20,lineHeight:1,alignment:"center",textColor:[1,1,1],backgroundColor:[0,0,0,0],width:100},t);var c=new _Ys(l,_this306);_this306.addToStackAtIndex(c,r);s(c);})["catch"](a);});}},{key:"addTextDesignAsync",value:function(){var _addTextDesignAsync=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee15(){var _this307=this;var t,e,r,o,n,s,a,l,c,u,m,p,_args16=arguments;return regeneratorRuntime.wrap(function _callee15$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:t=_args16.length>0&&_args16[0]!==undefined?_args16[0]:"imgly_text_design_blocks";e=_args16.length>1?_args16[1]:undefined;r=_args16.length>2?_args16[2]:undefined;o=_args16.length>3?_args16[3]:undefined;if(r){_context16.next=6;break;}throw new Error("This engine does not support adding TextDesign as a root element.");case 6:n=_objectSpread({seed:Date.now(),padding:0,text:"",color:[0,0,0],inverted:false,width:100},e);s=this.wrapper.getTextDesignLayoutByID(t);if(s){_context16.next=10;break;}throw new Error("The layout could not be loaded for the given id: ".concat(t));case 10:a=s.getImagePaths().map(function(h){var g=h.split("/").pop()||"";return{path:h,fullPath:_this307.assetProvider.getAssetSource("textdesign",g)};});l=this.wrapper.getTextDesignAssetManager();c=this.wrapper.getTextDesignFontManager();u=c.getVariationsByIdentifier();l.setFonts(u);_context16.next=17;return l.loadImages(a);case 17:s.onImagesLoaded();m=Object.keys(u);p=this.assetProvider.getFontManager();return _context16.abrupt("return",p.loadFontsWithIdentifiers(m).then(function(){_this307.ensureContainerIsRoot(r);var h=new _su(n,s,_this307);_this307.addToStackAtIndex(h,o);return Promise.resolve(h);}));case 21:case"end":return _context16.stop();}}},_callee15,this);}));function addTextDesignAsync(){return _addTextDesignAsync.apply(this,arguments);}return addTextDesignAsync;}()},{key:"addDrawing",value:function addDrawing(t,e,r){if(!e){throw new Error("This engine does not support DrawingContainers as root elements.");}this.ensureContainerIsRoot(e);var o=new z2(t,this);this.addToStackAtIndex(o,r);return o;}},{key:"addGaussianBlur",value:function addGaussianBlur(t,e,r){this.ensureContainerIsRoot(e);var o=new G2(t,this,this.sdk.createOperation("blur",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addRadialBlur",value:function addRadialBlur(t,e,r){this.ensureContainerIsRoot(e);var o=new tk(t,this,this.sdk.createOperation("radial-focus",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addMirroredBlur",value:function addMirroredBlur(t,e,r){this.ensureContainerIsRoot(e);var o=new Y2(t,this,this.sdk.createOperation("mirrored-focus",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addLinearBlur",value:function addLinearBlur(t,e,r){this.ensureContainerIsRoot(e);var o=new $2(t,this,this.sdk.createOperation("linear-focus",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addDuoToneFilter",value:function addDuoToneFilter(t,e,r){throw new Error("Not supported! Use addDuoToneFilterFromAssets instead");}},{key:"addDuoToneFilterFromAssets",value:function addDuoToneFilterFromAssets(t,e,r){var _this308=this;this.ensureContainerIsRoot(e);var o=this.sdk.getOperationsStack();var n=o.getByIdentifier("filter");if(n&&n.getIdentifier()!==t){this.sdk.removeOperation(n);}var s=n||this.sdk.createOperation("filter",{identifier:t},false);return new Promise(function(a,l){try{var c=_this308.assetProvider.getDuotoneFilterAsset(t);var u={colorIntensity:c.defaultIntensity||0};var m=new st.Operations.FilterOperation.Filters.DuoToneFilter({intensity:u.colorIntensity,lightColor:st.Color.fromHex(c.lightColor),darkColor:st.Color.fromHex(c.darkColor)});var p=new U2(m,s,u,_this308);_this308.addToStackAtIndex(p,r);a(p);}catch(c){if(c){l(c);}}});}},{key:"addLUTFilter",value:function addLUTFilter(t,e,r){throw new Error("Not supported! Use addLUTFilterFromAssets instead");}},{key:"addLUTFilterFromAssets",value:function addLUTFilterFromAssets(t,e,r){var _this309=this;this.ensureContainerIsRoot(e);var o=this.sdk.getOperationsStack();var n=o.getByIdentifier("filter");if(n&&n.getIdentifier()!==t){this.sdk.removeOperation(n);}var s=n||this.sdk.createOperation("filter",{identifier:t},false);return this.getLutFilterImage(t).then(function(a){var l=_this309.assetProvider.getLUTFilterAsset(t);var c={horizontalTileCount:l.horizontalTileCount||5,verticalTileCount:l.verticalTileCount||5,intensity:l.defaultIntensity||1};var u=new st.Operations.FilterOperation.Filters.ThreeDLUTFilter(_objectSpread(_objectSpread({},c),{},{image:a}));var m=_objectSpread(_objectSpread({},c),{},{lutImage:new Image()});var p=new X2(u,s,m,_this309);_this309.addToStackAtIndex(p,r);return p;});}},{key:"getLutFilterImage",value:function getLutFilterImage(t){var _this310=this;return new Promise(function(e,r){oS({src:_this310.assetProvider.getAssetSource("filter",t),crossOrigin:_this310.config.crossOrigin||null,key:"filter",resolve:e,reject:r});});}},{key:"addAdjustments",value:function addAdjustments(t,e,r){this.ensureContainerIsRoot(e);var o=new M2(t,this,this.sdk.createOperation("adjustments",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addOverlay",value:function addOverlay(t,e,r){this.ensureContainerIsRoot(e);var o=new Xx(this.sdk.createOperation("overlay",{},false),t,this);this.addToStackAtIndex(o,r);return o;}},{key:"addOverlayFromAssets",value:function addOverlayFromAssets(t,e,r){var _this311=this;this.ensureContainerIsRoot(e);return new Promise(function(o,n){oS({src:_this311.assetProvider.getAssetSource("overlay",t),crossOrigin:_this311.config.crossOrigin||null,key:"overlay",resolve:function resolve(s){var a=_this311.sdk.getOperationsStack();var l=a.getByIdentifier("overlay");if(l&&l.getIdentifier()!==t){a.remove(l);}var c=l||_this311.sdk.createOperation("overlay",{},false);var u={image:s,opacity:1,blendMode:"normal"};var m=new Xx(c,u,_this311);_this311.addToStackAtIndex(m,r);o(m);},reject:n});});}},{key:"addFrame",value:function addFrame(t,e,r){throw new Error("Not supported!");}},{key:"addFrameFromAssets",value:function(){var _addFrameFromAssets=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee16(t,e,r){var o,n,s,a,l,c,u;return regeneratorRuntime.wrap(function _callee16$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:this.ensureContainerIsRoot(e);o=this.assetProvider.getFrameAsset(t);if(o){_context17.next=4;break;}throw new Error("The requested asset does not exist! ".concat(t));case 4:n=new H2(o,this);_context17.next=7;return n.load();case 7:s=this.getOutputContainer().getBounds();a=Math.min(s.width,s.height);l=this.sdk.createOperation("frame",{},false);l.setFrame(n.getFrame());c={opacity:1,tintColor:[1,1,1],tintable:false,width:Math.max(1,.1*a),imageGroups:n.getFrame().imageGroups};u=new W2(l,c,this);this.addToStackAtIndex(u,r);return _context17.abrupt("return",Promise.resolve(u));case 15:case"end":return _context17.stop();}}},_callee16,this);}));function addFrameFromAssets(_x21,_x22,_x23){return _addFrameFromAssets.apply(this,arguments);}return addFrameFromAssets;}()},{key:"removeEffect",value:function removeEffect(t){if(!t.isValid()){return;}var e=t;var r=e.getOperation();this.sdk.removeOperation(r);this.sdk.setAllOperationsToDirty();this.rootOperationStack.splice(t.getIndexInParent(),1);}},{key:"removeContainer",value:function removeContainer(t){if(!t.isValid()||t.type==="output"){return;}var e=t;var r=e.getOperation();this.sdk.removeOperation(r);this.sdk.setAllOperationsToDirty();this.rootOperationStack.splice(t.getIndexInParent(),1);}},{key:"refreshOutputIndex",value:function refreshOutputIndex(){var t=this.sdk.getOperationsStack().getIndexByIdentifier("output");this.moveInOperationsStack(t,this.operationStackOffset-1);}},{key:"refreshFlipIndex",value:function refreshFlipIndex(){var t=this.sdk.getOperationsStack().getIndexByIdentifier("flip");var e=this.sdk.getOperationsStack().getStack().length-1;if(t!==e){this.moveInOperationsStack(t,e);}}},{key:"refreshFrameIndex",value:function refreshFrameIndex(){var t=this.sdk.getOperationsStack().getIndexByIdentifier("frame");var e=this.sdk.getOperationsStack().getStack().length-1;if(t!==-1&&t!==e){this.moveInOperationsStack(t,e);}}},{key:"mapToRenderType",value:function mapToRenderType(t){switch(t){case"image":return st.RenderType.IMAGE;case"data-url":return st.RenderType.DATAURL;case"blob":return st.RenderType.BLOB;case"ms-blob":return st.RenderType.MSBLOB;default:return st.RenderType.IMAGE;}}},{key:"mapToImageFormat",value:function mapToImageFormat(t){switch(t){case"image/png":return st.ImageFormat.PNG;case"image/jpeg":return st.ImageFormat.JPEG;default:return null;}}},{key:"mapBlendMode",value:function mapBlendMode(t){switch(t){case ai.NORMAL:return"normal";case ai.OVERLAY:return"overlay";case ai.HARD_LIGHT:return"hardLight";case ai.SOFT_LIGHT:return"softLight";case ai.MULTIPLY:return"multiply";case ai.DARKEN:return"darken";case ai.LIGHTEN:return"lighten";case ai.SCREEN:return"screen";case ai.COLOR_BURN:return"colorBurn";default:return"normal";}}},{key:"reverseMapBlendMode",value:function reverseMapBlendMode(t){switch(t){case"normal":return ai.NORMAL;case"overlay":return ai.OVERLAY;case"hardLight":return ai.HARD_LIGHT;case"softLight":return ai.SOFT_LIGHT;case"multiply":return ai.MULTIPLY;case"darken":return ai.DARKEN;case"lighten":return ai.LIGHTEN;case"screen":return ai.SCREEN;case"colorBurn":return ai.COLOR_BURN;default:return ai.NORMAL;}}},{key:"createSpriteOperation",value:function createSpriteOperation(){return this.sdk.createOperation("sprite",{},false);}},{key:"moveIndex",value:function moveIndex(t,e){var r=this.getSiblingIndex(t);if(r===-1){throw new Error("The item to be moved is not part of any stack.");}this.moveInStack(this.rootOperationStack,r,e);var o=this.operationStackOffset;this.moveInOperationsStack(r+o,e+o);this.enforceOperationOrder();}},{key:"ensureContainerIsRoot",value:function ensureContainerIsRoot(t){var e=t.getID();if(e!==this.rootContainer.getID()){throw new Error("This engine doesn't support adding this effect/container to anything other than the root image container");}}},{key:"addToStackAtIndex",value:function addToStackAtIndex(t,e){if(e&&e<0){throw new Error("The given index may not be negative: ".concat(e));}if(e===void 0){this.rootOperationStack.push(t);}else{this.rootOperationStack.splice(e,0,t);}var r=this.rootOperationStack.length-1;var o=e!==void 0?e:r;o+=this.operationStackOffset;if(EN(t)){this.insertIntoOperationsStack(t.getOperation(),o);}else{this.insertIntoOperationsStack(t.getOperation(),o);}this.sdk.setAllOperationsToDirty();}},{key:"insertIntoOperationsStack",value:function insertIntoOperationsStack(t,e){var r=this.sdk.getOperationsStack().getStack();var o=r.length;var n=Math.max(Math.min(e,o),0);for(var s=o-1;s>=n;s-=1){var a=r[s];r[s+1]=a;}r[n]=t;this.sdk.setAllOperationsToDirty();this.enforceOperationOrder();}},{key:"moveInStack",value:function moveInStack(t,e,r){var o=t.length;var n=Math.max(Math.min(e,o-1),0);var s=Math.max(Math.min(r,o-1),0);if(n===s){return;}var a=t[n];if(n=s;_l5-=1){t[_l5+1]=t[_l5];}}t[s]=a;}},{key:"moveInOperationsStack",value:function moveInOperationsStack(t,e){var r=this.sdk.getOperationsStack().getStack();var o=r.length;var n=Math.min(Math.max(0,t),o-1);var s=Math.min(Math.max(0,e),o-1);if(n===s){return;}var a=r[n];if(n=s;_l6-=1){r[_l6+1]=r[_l6];}}r[s]=a;this.sdk.getOperationsStack().setAllToDirty();}},{key:"getSiblingIndex",value:function getSiblingIndex(t){return t.getIndexInParent();}},{key:"resolveAssetForSDK",value:function resolveAssetForSDK(t,e){e=e;switch(t){case"filter":return this.assetProvider.getAssetSource("filter",e.identifier);case"overlay":return this.assetProvider.getAssetSource("overlay",e.identifier);case"font":return this.assetProvider.getAssetSource("font",e.identifier);default:return"";}return"";}}]);return fm;}(P2);});var Zx;var eH=d(function(){Vh();R();Zx=/*#__PURE__*/function(){function Zx(t){var _this312=this;_classCallCheck(this,Zx);this.isEmpty=false;this.isValid=false;this.isWhiteLabel=function(){return _this312.isValid&&_this312.licenseChecker.isWhiteLabel();};this.areCustomAssetsAllowed=function(){return _this312.isEmpty||!_this312.isValid||_this312.licenseChecker.areCustomAssetsAllowed();};if(t&&t.length!==0){this.licenseChecker=new st.LicenseChecker(t);this.isValid=this.licenseChecker.validate();}else if(t===""){this.isEmpty=true;}}_createClass(Zx,[{key:"isToolAllowed",value:function isToolAllowed(t){if(this.licenseChecker&&this.isValid&&t!=="customTool"){return this.licenseChecker.isToolAllowed(t);}return true;}}]);return Zx;}();});var iH=d(function(){tH();yl();Go();j2();Z2();V2();ek();J2();K2();N2();q2();L2();Q2();ik();eH();});var zn=d(function(){iH();ur();});var ok,rH,Un,Vo,mr,nk;var pr=d(function(){zn();ok=function ok(i){var t=Number(i).toString(16);if(t.length<2){t="0".concat(t);}return t;};rH=function rH(i,t,e){var r=ok(i*255);var o=ok(t*255);var n=ok(e*255);return"#".concat(r).concat(o).concat(n);};Un=function Un(i){if(Vx(i)){var _i4=_slicedToArray(i,4),t=_i4[0],e=_i4[1],r=_i4[2],o=_i4[3];return"rgba(".concat(t*255,", ").concat(e*255,", ").concat(r*255,", ").concat(o,")");}if(Gx(i)){var _t30=i.r,_e12=i.g,_r11=i.b,_o11=i.a;return"rgba(".concat(_t30*255,", ").concat(_e12*255,", ").concat(_r11*255,", ").concat(_o11,")");}if(Wx(i)){var _i5=_slicedToArray(i,3),_t31=_i5[0],_e13=_i5[1],_r12=_i5[2];return rH(_t31,_e13,_r12);}if(Hx(i)){var _t32=i.r,_e14=i.g,_r13=i.b;return rH(_t32,_e14,_r13);}return i;};Vo=function Vo(i){return i.map(function(t){return{identifier:t.name,color:t.color,colorString:Un(t.color)};});};mr={black:[0/255,0/255,0/255,1],white:[255/255,255/255,255/255,1],gray:[191/255,191/255,191/255,1],blue:[102/255,134/255,255/255,1],skyBlue:[102/255,204/255,255/255,1],red:[231/255,80/255,80/255,1],orange:[242/255,136/255,85/255,1],yellow:[255/255,247/255,99/255,1]};nk={transparent:[0/255,0/255,0/255,0],black:[0/255,0/255,0/255,1],white:[255/255,255/255,255/255,1],blue:[102/255,134/255,255/255,1],skyBlue:[102/255,204/255,255/255,1],red:[231/255,80/255,80/255,1],orange:[242/255,136/255,85/255,1],yellow:[255/255,247/255,99/255,1]};});var Qx;var sk=d(function(){R();Qx=["library",["transform","filter","adjustment"],["focus","frame","overlay"],["text","textdesign","sticker","brush"]];});var _l;var tv=d(function(){R();U();sk();_l={image:"",license:"",order:"default",language:"en",theme:"dark",layout:"advanced",mainCanvasActions:["undo","redo","export","close"],displayResizeWarning:false,displayCloseWarning:true,displayCanvasRendererWarning:true,displayToolControlBarTitle:true,displaySerializationModal:true,displayDiscardChangesWarning:true,engine:{crossOrigin:"anonymous",downscaleOptions:{maxMegaPixels:{desktop:10,mobile:5}},preferredRenderer:WF()?"webgl":"canvas",backgroundColor:[0,0,0,1]},enableZoom:true,scaleImageToFit:true,restrictZoomOutToDefault:true,forceCrop:false,assetBaseUrl:"assets/",defaultTool:"filter",tools:Qx,snapping:new Kg(),filter:new Yg(),focus:new Jg(),adjustment:new qg(),library:new rb(),overlay:new ob(),sticker:new nb(),text:new sb(),textdesign:new lb(),frame:new Zg(),brush:new ab(),transform:new cb(),"export":{image:{exportType:"image",format:"image/png",quality:.9,enableDownload:true,transparent:true},filename:"photoeditorsdk-export"},custom:{},watermark:new Xg()};});var oH=d(function(){});var au;var ev=d(function(){var _au;R();au=(_au={},_defineProperty(_au,"brightness",0),_defineProperty(_au,"saturation",0),_defineProperty(_au,"contrast",0),_defineProperty(_au,"gamma",0),_defineProperty(_au,"clarity",0),_defineProperty(_au,"exposure",0),_defineProperty(_au,"shadows",0),_defineProperty(_au,"highlights",0),_defineProperty(_au,"whites",0),_defineProperty(_au,"blacks",0),_defineProperty(_au,"temperature",0),_defineProperty(_au,"sharpness",0),_au);});var Zi=d(function(){});var _Ne;var Nn=d(function(){U();_Ne=/*#__PURE__*/function(){function Ne(t,e){var _this313=this;_classCallCheck(this,Ne);this.assets=[];this.entityMapper=function(t){if("items"in t){return _this313.categoryMapper(t);}return _this313.itemMapper(t);};this.categoryMapper=function(t){return t?_objectSpread(_objectSpread({},t),{},{thumbnailURI:_this313.getCategoryThumbnailURI(t),name:_this313.config.locale[t.identifier]||t.name,items:t.items.map(_this313.itemMapper)}):null;};this.itemMapper=function(t){return _objectSpread(_objectSpread({},t),{},{thumbnailURI:_this313.getItemThumbnailURI(t),name:_this313.config.locale[t.identifier]||("name"in t?t.name:"")});};this.getCategoryThumbnailURI=function(t){if(t.thumbnailURI){if(cn(t.thumbnailURI)||t.thumbnailURI.substr(0,10)==="data:image"){return t.thumbnailURI;}return _this313.config.getAssetPath(t.thumbnailURI||"");}return"";};this.getItemThumbnailURI=function(t){var r;if((r=t.thumbnailURI)==null?void 0:r.trim()){if(cn(t.thumbnailURI)||t.thumbnailURI.substr(0,10)==="data:image"){return t.thumbnailURI;}return _this313.config.getAssetPath(t.thumbnailURI||"");}var e=t[_this313.config.itemFallbackKey];if(!e)return"";return _this313.config.getAssetPath(e);};this.config=e;this.assets=t.map(this.entityMapper).filter(Boolean);}_createClass(Ne,[{key:"categories",get:function get(){return this.assets.reduce(function(t,e){if(_Ne.isCategory(e)){return[].concat(_toConsumableArray(t),[e]);}return void 0;},[]).filter(Boolean);}},{key:"items",get:function get(){return this.assets.reduce(function(t,e){if(_Ne.isCategory(e)){return[].concat(_toConsumableArray(t),_toConsumableArray(e.items));}return[].concat(_toConsumableArray(t),[e]);},[]).filter(Boolean);}}],[{key:"isCategory",value:function isCategory(t){return Object.prototype.hasOwnProperty.call(t,"items");}}]);return Ne;}();});var Js;var Kh=d(function(){Js=/*#__PURE__*/function(){function Js(t,e){_classCallCheck(this,Js);this.from=t;this.to=e;}_createClass(Js,[{key:"contains",value:function contains(t){return this.from<=t&&t<=this.to;}},{key:"clamp",value:function clamp(t){return Math.min(Math.max(this.from,t),this.to);}}]);return Js;}();});var Tlt,gm;var nH=d(function(){Tt();R();Kh();ev();Tlt=new Js(-1,1);gm=/*#__PURE__*/function(){function gm(t){var _this314=this;_classCallCheck(this,gm);this.editAdjustments=function(_ref122){var t=_ref122.type,e=_ref122.value;var r=Tlt.clamp(e);_this314.state[t]=r;};this.reset=function(){Ve(function(){if(_this314.indexInContainer===-1){Object.keys(au).forEach(function(t){_this314.state[t]=au[t];});_this314.orderHelper.removeIndex("adjustment");}});};this.setAdjustmentEffect=function(t){var e=_this314.orderHelper.addIndex("adjustment");if(_this314.effect){_this314.effect.setProperties(t);}else{_this314.effect=_this314.engineMediator.engine.addAdjustments(t,_this314.engineMediator.image.container,e);}return _this314.effect.getProperties();};this.removeAdjustmentEffect=function(){if(_this314.effect){_this314.engineMediator.engine.removeEffect(_this314.effect);if(_this314.indexInContainer===-1){_this314.effect=void 0;}}};this.engineMediator=t;this.state=au;}_createClass(gm,[{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}},{key:"orderHelper",get:function get(){return this.engineMediator.orderHelper;}}]);return gm;}();f([Q],gm.prototype,"state",2);f([C],gm.prototype,"editAdjustments",2);f([C],gm.prototype,"reset",2);});var Zt;var sH=d(function(){Tt();R();U();Zi();Nn();ev();nH();Zt=/*#__PURE__*/function(){function Zt(t){var _this315=this;_classCallCheck(this,Zt);this.dirty=Q.box(false);this.isHistoryChanged=false;this.editAdjustments=function(_ref123){var t=_ref123.type,e=_ref123.value;_this315.isHistoryChanged=!(0,Ye["default"])(_this315.state[t],e);_this315.pureSetAdjustment({type:t,value:e});_this315.editor.render();};this.toolSnapshot=function(){if((0,Ye["default"])(_this315.state,au)){_this315.dirty.set(false);}else{_this315.dirty.set(true);}if(_this315.isHistoryChanged){_this315.addSnapshot("edit","adjustment");_this315.isHistoryChanged=false;}};this.addSnapshot=function(t,e){_this315.editor.addSnapshot(void 0,t,e);};this.toggleOptionSelection=function(t){_this315.selectedOption=t;};this.pureSetAdjustment=function(_ref124){var t=_ref124.type,e=_ref124.value;var r=_this315.adjustmentsStore.setAdjustmentEffect(_defineProperty({},t,e));_this315.adjustmentsStore.editAdjustments({type:t,value:r[t]});};this.pureReset=function(){_this315.dirty.set(false);_this315.adjustmentsStore.removeAdjustmentEffect();_this315.adjustmentsStore.reset();_this315.selectedOption="";};this.reset=function(){_this315.pureReset();_this315.addSnapshot("delete",_this315.locale.controls.buttonReset);_this315.editor.render();};this.updateStateFromHistory=function(t){if((0,Ye["default"])(t,_this315.state)){return;}if((0,Ye["default"])(t,au)){_this315.pureReset();return;}Ve(function(){_this315.dirty.set(Object.values(t).some(function(e){return e!==0;}));Object.keys(t).forEach(function(e){_this315.pureSetAdjustment({type:e,value:t[e]});});});};this.updateStateFromSerialization=function(t){_this315.updateStateFromHistory(t);};this.editor=t;this.adjustmentsStore=new gm(this.editor.engineMediator);this.selectedOption="";var e=this.editor.assetProvider.getAssets("adjustment");this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},this.config),{},{locale:_objectSpread(_objectSpread({},this.locale.items),this.locale.categories),getAssetPath:this.editor.getAssetPath("adjustment")}));}_createClass(Zt,[{key:"selectedAdjustmentType",get:function get(){return this.selectedOption;}},{key:"isDirty",get:function get(){return this.dirty.get();}},{key:"state",get:function get(){return this.adjustmentsStore.state;}},{key:"selectedOptionLabel",get:function get(){var _this316=this;var t=this.items.find(function(e){return e?e.identifier===_this316.selectedOption:false;});return t?t.name:"";}},{key:"brightness",get:function get(){return this.state.brightness;}},{key:"saturation",get:function get(){return this.state.saturation;}},{key:"contrast",get:function get(){return this.state.contrast;}},{key:"gamma",get:function get(){return this.state.gamma;}},{key:"clarity",get:function get(){return this.state.clarity;}},{key:"exposure",get:function get(){return this.state.exposure;}},{key:"shadows",get:function get(){return this.state.shadows;}},{key:"highlights",get:function get(){return this.state.highlights;}},{key:"whites",get:function get(){return this.state.whites;}},{key:"blacks",get:function get(){return this.state.blacks;}},{key:"temperature",get:function get(){return this.state.temperature;}},{key:"sharpness",get:function get(){return this.state.sharpness;}},{key:"categories",get:function get(){return this.entityManager.categories;}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"config",get:function get(){return this.editor.configStore.config["adjustment"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["adjustment"];}}]);return Zt;}();f([Q],Zt.prototype,"selectedOption",2);f([Q],Zt.prototype,"dirty",2);f([C],Zt.prototype,"editAdjustments",2);f([C],Zt.prototype,"toggleOptionSelection",2);f([C],Zt.prototype,"pureSetAdjustment",2);f([C],Zt.prototype,"pureReset",2);f([C],Zt.prototype,"reset",2);f([C],Zt.prototype,"updateStateFromHistory",2);f([C],Zt.prototype,"updateStateFromSerialization",2);f([S],Zt.prototype,"selectedAdjustmentType",1);f([S],Zt.prototype,"isDirty",1);f([S],Zt.prototype,"state",1);f([S],Zt.prototype,"selectedOptionLabel",1);f([S],Zt.prototype,"brightness",1);f([S],Zt.prototype,"saturation",1);f([S],Zt.prototype,"contrast",1);f([S],Zt.prototype,"gamma",1);f([S],Zt.prototype,"clarity",1);f([S],Zt.prototype,"exposure",1);f([S],Zt.prototype,"shadows",1);f([S],Zt.prototype,"highlights",1);f([S],Zt.prototype,"whites",1);f([S],Zt.prototype,"blacks",1);f([S],Zt.prototype,"temperature",1);f([S],Zt.prototype,"sharpness",1);f([S],Zt.prototype,"categories",1);f([S],Zt.prototype,"items",1);f([S],Zt.prototype,"config",1);f([S],Zt.prototype,"locale",1);});var ak=d(function(){ev();sH();});var iv;var lk=d(function(){iv={identifier:"identity",intensity:1,isDuotone:false};});var klt,xl;var aH=d(function(){Tt();R();Kh();lk();klt=new Js(0,1);xl=/*#__PURE__*/function(){function xl(t){var _this317=this;_classCallCheck(this,xl);this.changeIdentifier=function(t){_this317.state.identifier=t;};this.changeIfDuotone=function(t){_this317.state.isDuotone=t;};this.changeIntensity=function(t){var e=klt.clamp(t);_this317.state.intensity=e;};this.reset=function(){if(_this317.indexInContainer===-1){_this317.state.identifier=iv.identifier;_this317.state.intensity=iv.intensity;_this317.removeIndex();}};this.setFilterEffect=function(_ref125){var t=_ref125.identifier,e=_ref125.intensity,r=_ref125.isDuotone;var o=_this317.state;var n=function n(){_this317.changeIdentifier(t);_this317.changeIntensity(e);_this317.changeIfDuotone(r);};_this317.removeFilterEffect();var s=_this317.engineMediator.orderHelper.addIndex("filter");if(r){return new Promise(function(a,l){_this317.engineMediator.engine.addDuoToneFilterFromAssets(t,_this317.engineMediator.image.container,s).then(function(c){n();_this317.effect=c;_this317.effect.setProperties({colorIntensity:e});a();})["catch"](function(c){_this317.fallbackOnError(o);l(c);});});}return new Promise(function(a,l){_this317.engineMediator.engine.addLUTFilterFromAssets(t,_this317.engineMediator.image.container,s).then(function(c){n();_this317.effect=c;_this317.effect.setProperties({intensity:e});a();})["catch"](function(c){_this317.fallbackOnError(o);l(c);});});};this.removeFilterEffect=function(){if(_this317.effect){_this317.engineMediator.engine.removeEffect(_this317.effect);if(_this317.indexInContainer===-1){_this317.effect=void 0;}}};this.setEffectProperties=function(_ref126){var t=_ref126.intensity;if(_this317.effect){if(_this317.state.isDuotone){_this317.effect.setProperties({colorIntensity:t});}else{_this317.effect.setProperties({intensity:t});}return _this317.effect.getProperties();}return null;};this.removeIndex=function(){_this317.engineMediator.orderHelper.removeIndex("filter");};this.fallbackOnError=function(t){_this317.changeIdentifier(t.identifier);_this317.changeIntensity(t.intensity);if(t.identifier==="identity"){_this317.removeIndex();}};this.engineMediator=t;this.state=iv;}_createClass(xl,[{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}}]);return xl;}();f([Q],xl.prototype,"state",2);f([C],xl.prototype,"changeIdentifier",2);f([C],xl.prototype,"changeIfDuotone",2);f([C],xl.prototype,"changeIntensity",2);f([C],xl.prototype,"reset",2);});var lH,rv,He;var cH=d(function(){lH=y(rd());Tt();R();U();Zi();Nn();aH();rv="identity";He=/*#__PURE__*/function(){function He(t){var _this318=this;_classCallCheck(this,He);this.throttledRender=(0,lH["default"])(function(){if(_this318.editor){_this318.editor.render();}},10,{trailing:true});this.selectFilter=/*#__PURE__*/function(){var _ref127=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee17(t){var e,_r14,_args18=arguments;return regeneratorRuntime.wrap(function _callee17$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:e=_args18.length>1&&_args18[1]!==undefined?_args18[1]:1;if(!(t!==_this318.identifier)){_context18.next=8;break;}_r14=_this318.selectedCategory;_context18.next=5;return _this318.filterStore.setFilterEffect({identifier:t,intensity:e,isDuotone:_this318.isOptionDuoTone(t)});case 5:if(_this318.selectedCategory===rv){_this318.selectedCategory=_r14;}_this318.editor.render();_this318.addSnapshot("add","filter");case 8:case"end":return _context18.stop();}}},_callee17);}));return function(_x24){return _ref127.apply(this,arguments);};}();this.changeIntensity=function(t){var e=_this318.isOptionDuoTone(_this318.identifier);var r=_this318.filterStore.setEffectProperties({intensity:t});if(r){var o=e?r.colorIntensity:r.intensity;_this318.filterStore.changeIntensity(o);_this318.throttledRender();}};this.setImageAndGetPreviews=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee18(){var t;return regeneratorRuntime.wrap(function _callee18$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:t=_this318.editor.activeStore.state.image;_context19.next=3;return _this318.editor.previewThumbnails.addImageToContainer(t);case 3:_context19.next=5;return _this318.getAllFilterPreview();case 5:case"end":return _context19.stop();}}},_callee18);}));this.getAllFilterPreview=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee19(){var t,e,r,o;return regeneratorRuntime.wrap(function _callee19$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:t=_this318.entityManager.items.map(function(n){return{identifier:n.identifier,isDuotone:_this318.isOptionDuoTone(n.identifier)};});_context20.next=3;return _this318.editor.previewThumbnails.getAllFilterPreviewThumbnails(t);case 3:e=_context20.sent;_context20.next=6;return _this318.editor.wait();case 6:r=_this318.config;o=_this318.editor.configStore.assetProvider.getAssets("filter").map(function(n){return _objectSpread(_objectSpread({},n),{},{items:n.items.map(function(s){return _objectSpread(_objectSpread({},s),{},{thumbnailURI:e[s.identifier]});})});});_this318.entityManager=new _Ne(o,_objectSpread(_objectSpread({},r),{},{locale:_this318.locale.items,getAssetPath:_this318.editor.getAssetPath("filter")}));case 9:case"end":return _context20.stop();}}},_callee19);}));this.toolSnapshot=function(){_this318.addSnapshot("edit",_this318.locale.controls.sliderIntensity);};this.addSnapshot=function(t,e){_this318.editor.addSnapshot(void 0,t,e);};this.pureReset=function(){_this318.selectedCategory=rv;_this318.filterStore.removeFilterEffect();_this318.filterStore.reset();};this.reset=function(){_this318.pureReset();_this318.addSnapshot("delete",_this318.locale.controls.buttonReset);_this318.editor.render();};this.toggleCategorySelection=function(t){_this318.selectedCategory=_this318.selectedCategory===t?rv:t;};this.updateStateFromSerialization=function(_ref130){var t=_ref130.identifier,e=_ref130.intensity;var r=_this318.doesFilterAssetExist(t);if(r){var o=Yu(r);return _this318.filterStore.setFilterEffect({identifier:t,intensity:e,isDuotone:o});}throw new Do(t);};this.updateStateFromHistory=/*#__PURE__*/function(){var _ref131=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee20(t){return regeneratorRuntime.wrap(function _callee20$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:if(!(t.identifier==="identity")){_context21.next=3;break;}_this318.pureReset();return _context21.abrupt("return",new Promise(function(e){e();}));case 3:return _context21.abrupt("return",_this318.filterStore.setFilterEffect(t));case 4:case"end":return _context21.stop();}}},_callee20);}));return function(_x25){return _ref131.apply(this,arguments);};}();this.doesFilterAssetExist=function(t){return _this318.entityManager.items.find(function(e){return t===e.identifier;});};this.isOptionDuoTone=function(t){var e=_this318.doesFilterAssetExist(t);if(e){return Yu(e);}return false;};this.editor=t;this.selectedCategory=rv;this.filterStore=new xl(this.editor.engineMediator);var e=this.config;var r=this.editor.configStore.assetProvider.getAssets("filter");this.entityManager=new _Ne(r,_objectSpread(_objectSpread({},e),{},{locale:this.locale.items,getAssetPath:this.editor.getAssetPath("filter")}));}_createClass(He,[{key:"state",get:function get(){return this.filterStore.state;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"intensity",get:function get(){return this.state.intensity;}},{key:"isDuotone",get:function get(){return this.state.isDuotone;}},{key:"selectedCategoryIdentifier",get:function get(){return this.selectedCategory;}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}},{key:"config",get:function get(){return this.editor.configStore.config["filter"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["filter"];}},{key:"categories",get:function get(){return this.entityManager.categories;}},{key:"items",get:function get(){return this.entityManager.items;}}]);return He;}();f([Q],He.prototype,"selectedCategory",2);f([Q],He.prototype,"entityManager",2);f([C],He.prototype,"selectFilter",2);f([C],He.prototype,"changeIntensity",2);f([C],He.prototype,"pureReset",2);f([C],He.prototype,"reset",2);f([C],He.prototype,"toggleCategorySelection",2);f([C],He.prototype,"updateStateFromSerialization",2);f([C],He.prototype,"updateStateFromHistory",2);f([S],He.prototype,"state",1);f([S],He.prototype,"identifier",1);f([S],He.prototype,"intensity",1);f([S],He.prototype,"isDuotone",1);f([S],He.prototype,"selectedCategoryIdentifier",1);f([S],He.prototype,"isOptionSelected",1);f([S],He.prototype,"config",1);f([S],He.prototype,"locale",1);f([S],He.prototype,"categories",1);f([S],He.prototype,"items",1);});var ck=d(function(){cH();lk();});var bm;var uH=d(function(){bm=function bm(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3;var r=Math.tan(t);var o=Math.sqrt(Math.pow(r,2)+1);return{x:i.x+e/o,y:i.y+e*r/o};};});var ov,Ilt,Dlt,Elt,Flt,lu;var nv=d(function(){ov={blurRadius:40,gradientSize:.2};Ilt=_objectSpread({start:{x:0,y:0},end:{x:0,y:0}},ov);Dlt=_objectSpread({center:{x:0,y:0},radius:0},ov);Elt=_objectSpread({origin:{x:0,y:0},rotation:0,size:0},ov);Flt=ov;lu={identifier:"identity",linear:Ilt,radial:Dlt,mirrored:Elt,gaussian:Flt};});var Ei;var dH=d(function(){Tt();R();U();nv();Ei=/*#__PURE__*/function(){function Ei(t){var _this319=this;_classCallCheck(this,Ei);this.selectFocus=function(t,e){Ve(function(){_this319.state.identifier=t;if(e){_this319.state[t].blurRadius=e;}});};this.changeBlurRadius=function(t,e){if(t!=="identity"){_this319.state[t].blurRadius=e;}};this.reset=function(){if(_this319.indexInContainer===-1){_this319.state.identifier=lu.identifier;if(_this319.state.identifier!=="identity"){_this319.state[_this319.state.identifier].blurRadius=lu[_this319.state.identifier].blurRadius;}}};this.setLinear=function(_ref132){var t=_ref132.start,e=_ref132.end;_this319.state.linear.start.x=t.x;_this319.state.linear.start.y=t.y;_this319.state.linear.end.x=e.x;_this319.state.linear.end.y=e.y;};this.setLinearStart=function(t){_this319.state.linear.start.x=t.x;_this319.state.linear.start.y=t.y;};this.setLinearEnd=function(t){_this319.state.linear.end.x=t.x;_this319.state.linear.end.y=t.y;};this.setRadialCenter=function(t){_this319.state.radial.center.x=t.x;_this319.state.radial.center.y=t.y;};this.setRadialRadius=function(t){_this319.state.radial.radius=t;};this.setMirroredOrigin=function(t){_this319.state.mirrored.origin.x=t.x;_this319.state.mirrored.origin.y=t.y;};this.setMirroredRotation=function(t){_this319.state.mirrored.rotation=t;};this.setMirroredSize=function(t){_this319.state.mirrored.size=t;};this.getEffectProperties=function(){if(_this319.effect){return _this319.effect.getProperties();}return null;};this.setLinearFocus=function(t){_this319.effect=_this319.engineMediator.engine.addLinearBlur(t,_this319.imageContainer,_this319.order);_this319.updateLinearState(_this319.effect.getProperties());};this.setGaussianFocus=function(t){_this319.effect=_this319.engineMediator.engine.addGaussianBlur(t,_this319.imageContainer,_this319.order);_this319.updateGaussianState(_this319.effect.getProperties());};this.setRadialFocus=function(t){_this319.effect=_this319.engineMediator.engine.addRadialBlur(t,_this319.imageContainer,_this319.order);_this319.updateRadialState(_this319.effect.getProperties());};this.setMirroredFocus=function(t){_this319.effect=_this319.engineMediator.engine.addMirroredBlur(t,_this319.imageContainer,_this319.order);_this319.updateMirroredState(_this319.effect.getProperties());};this.updateFromEngineState=function(t){var e=_this319.getEffectProperties();if(e&&t!=="identity"){switch(t){case"linear":_this319.updateLinearState(e);break;case"radial":_this319.updateRadialState(e);break;case"mirrored":_this319.updateMirroredState(e);break;default:break;}}};this.updateGaussianState=function(t){_this319.changeBlurRadius("gaussian",t.blurRadius);};this.updateMirroredState=function(t){var e=_this319.editor.worldToPreview(t.mirrorAxisOrigin);var r=new O(_this319.editor.worldToPreview(t.mirrorAxisDirection));var o=r.subtract(e);var n=Math.atan2(o.y,o.x);_this319.setMirroredOrigin(_this319.editor.worldToPreview(t.mirrorAxisOrigin));_this319.setMirroredRotation(n);_this319.setMirroredSize(_this319.editor.worldToPreview(t.clearAreaWidth));_this319.changeBlurRadius("mirrored",t.blurRadius);};this.updateRadialState=function(t){_this319.setRadialCenter(_this319.editor.worldToPreview(t.center));_this319.setRadialRadius(_this319.editor.worldToPreview(t.radius));_this319.changeBlurRadius("radial",t.blurRadius);};this.updateLinearState=function(t){_this319.setLinearStart(_this319.editor.worldToPreview(t.start));_this319.setLinearEnd(_this319.editor.worldToPreview(t.end));_this319.changeBlurRadius("linear",t.blurRadius);};this.setEffectProperties=function(t){if(_this319.effect){_this319.effect.setProperties(t);return _this319.effect.getProperties();}return null;};this.removeFocus=function(){if(_this319.effect){_this319.engineMediator.engine.removeEffect(_this319.effect);_this319.engineMediator.orderHelper.removeIndex("focus");}};this.editor=t;this.engineMediator=this.editor.engineMediator;this.state=lu;}_createClass(Ei,[{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}},{key:"order",get:function get(){return this.engineMediator.orderHelper.addIndex("focus");}},{key:"imageContainer",get:function get(){return this.engineMediator.image.container;}}]);return Ei;}();f([Q],Ei.prototype,"state",2);f([C],Ei.prototype,"selectFocus",2);f([C],Ei.prototype,"changeBlurRadius",2);f([C],Ei.prototype,"reset",2);f([C],Ei.prototype,"setLinear",2);f([C],Ei.prototype,"setLinearStart",2);f([C],Ei.prototype,"setLinearEnd",2);f([C],Ei.prototype,"setRadialCenter",2);f([C],Ei.prototype,"setRadialRadius",2);f([C],Ei.prototype,"setMirroredOrigin",2);f([C],Ei.prototype,"setMirroredRotation",2);f([C],Ei.prototype,"setMirroredSize",2);f([C],Ei.prototype,"updateFromEngineState",2);});var mH,_cu,Bt;var pH=d(function(){mH=y(rd());Tt();R();U();Zi();hm();Nn();uH();nv();dH();_cu=/*#__PURE__*/function(){function cu(t){var _this320=this;_classCallCheck(this,cu);this.throttledRender=(0,mH["default"])(function(){if(_this320.editor){_this320.editor.render();}},10,{trailing:true});this.selectFocus=function(t){if(t!==_this320.identifier){_this320.focusStore.removeFocus();var _e15=_this320.maxIntensity*.2;var _this320$editor$engin=_this320.editor.engine.getOutputContainer().getBounds(),r=_this320$editor$engin.width;var o=_this320.editor.shortestOutputSide*.2;switch(t){case"linear":var n=_this320.editor.outputToWorld({x:-r/2,y:0});var s=_this320.editor.outputToWorld({x:r/2,y:0});_this320.setLinearFocus({start:n,end:s,blurRadius:_e15});break;case"radial":var a=_this320.editor.outputToWorld({x:0,y:0});_this320.setRadialFocus({center:a,radius:o,blurRadius:_e15});break;case"mirrored":var l=_this320.editor.outputToWorld({x:0,y:0});var c=o;var u=_this320.editor.outputToWorld(bm({x:0,y:0},0));_this320.setMirroredFocus({mirrorAxisOrigin:l,clearAreaWidth:c,blurRadius:_e15,mirrorAxisDirection:u});break;case"gaussian":_this320.setGaussianFocus({blurRadius:_e15});break;default:break;}_this320.focusStore.selectFocus(t,_e15);_this320.editor.render();_this320.addSnapshot("add","focus");}};this.changeIntensity=function(t){var e=_this320.focusStore.setEffectProperties({blurRadius:t});if(e){_this320.focusStore.changeBlurRadius(_this320.identifier,e.blurRadius);_this320.throttledRender();}};this.changeRelativeIntensity=function(t){var e=(_this320.maxIntensity-_cu.minIntensity)*t/100+_cu.minIntensity;var r=_this320.focusStore.setEffectProperties({blurRadius:e});if(r){_this320.focusStore.changeBlurRadius(_this320.identifier,r.blurRadius);_this320.throttledRender();}};this.toolSnapshot=function(t){_this320.addSnapshot("edit",t);};this.addSnapshot=function(t,e){_this320.editor.addSnapshot(void 0,t,e);};this.clickableCanvas=function(t){_this320.editor.clickableCanvas(t);};this.pureReset=function(){_this320.focusStore.removeFocus();_this320.focusStore.reset();};this.reset=function(){_this320.pureReset();_this320.editor.render();_this320.addSnapshot("delete",_this320.locale.controls.buttonReset);};this.setStart=function(t){var e=_this320.focusStore.setEffectProperties({start:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setLinearStart(_this320.editor.worldToPreview(e.start));_this320.throttledRender();}};this.setEnd=function(t){var e=_this320.focusStore.setEffectProperties({end:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setLinearEnd(_this320.editor.worldToPreview(e.end));_this320.throttledRender();}};this.setCenter=function(t){var e=_this320.focusStore.setEffectProperties({center:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setRadialCenter(_this320.editor.worldToPreview(e.center));_this320.throttledRender();}};this.setRadius=function(t){var e=_this320.focusStore.setEffectProperties({radius:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setRadialRadius(_this320.editor.worldToPreview(e.radius));_this320.throttledRender();}};this.setOrigin=function(t){var e=_this320.focusStore.setEffectProperties({mirrorAxisOrigin:_this320.editor.previewToWorld(t),mirrorAxisDirection:_this320.editor.previewToWorld(bm(t,_this320.rotation))});if(e){_this320.focusStore.setMirroredOrigin(_this320.editor.worldToPreview(e.mirrorAxisOrigin));_this320.throttledRender();}};this.setSize=function(t){var e=_this320.focusStore.setEffectProperties({clearAreaWidth:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setMirroredSize(_this320.editor.worldToPreview(e.clearAreaWidth));_this320.throttledRender();}};this.setRotation=function(t){_this320.focusStore.setEffectProperties({mirrorAxisDirection:_this320.editor.previewToWorld(bm(_this320.origin,t))});_this320.focusStore.setMirroredRotation(t);_this320.throttledRender();};this.updateStateFromHistory=function(t,e){_this320.focusStore.removeFocus();var r=e.magnitude;Ve(function(){_this320.focusStore.selectFocus(t.identifier);switch(t.identifier){case"linear":_this320.setLinearFocus({start:_this320.editor.previewToWorld(new O(t.linear.start).multiply(e)),end:_this320.editor.previewToWorld(new O(t.linear.end).multiply(e)),blurRadius:t.linear.blurRadius});break;case"gaussian":_this320.setGaussianFocus({blurRadius:t.gaussian.blurRadius});break;case"radial":_this320.setRadialFocus({center:_this320.editor.previewToWorld(new O(t.radial.center).multiply(e)),radius:_this320.editor.previewToWorld(t.radial.radius*r),blurRadius:t.radial.blurRadius});break;case"mirrored":{var o=new O(t.mirrored.origin).multiply(e);_this320.setMirroredFocus({mirrorAxisOrigin:_this320.editor.previewToWorld(o),mirrorAxisDirection:_this320.editor.previewToWorld(bm(o,t.mirrored.rotation)),clearAreaWidth:_this320.editor.previewToWorld(t.mirrored.size*r),blurRadius:t.mirrored.blurRadius});break;}case"identity":_this320.pureReset();break;default:break;}});};this.updateStateFromSerialization=/*#__PURE__*/function(){var _ref133=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee21(t){return regeneratorRuntime.wrap(function _callee21$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:if(!_cu.doesFocusIdentifierExist(t.identifier)){_context22.next=5;break;}_this320.focusStore.removeFocus();Ve(function(){_this320.focusStore.selectFocus(t.identifier);switch(t.identifier){case"linear":_this320.setLinearFocus(t.linear);break;case"gaussian":_this320.setGaussianFocus(t.gaussian);break;case"radial":_this320.setRadialFocus(t.radial);break;case"mirrored":_this320.setMirroredFocus({mirrorAxisOrigin:t.mirrored.origin,clearAreaWidth:t.mirrored.size,blurRadius:t.mirrored.blurRadius,mirrorAxisDirection:bm(t.mirrored.origin,t.mirrored.rotation)});break;default:break;}});_context22.next=6;break;case 5:throw new Do(t.identifier);case 6:case"end":return _context22.stop();}}},_callee21);}));return function(_x26){return _ref133.apply(this,arguments);};}();this.updateCanvasControls=function(){_this320.focusStore.updateFromEngineState(_this320.identifier);};this.getFocusStateForHistory=function(){var t=_this320.editor.canvasStore.sizeVector;var e=_this320.focusStore.state.linear;var r=_this320.focusStore.state.radial;var o=_this320.focusStore.state.mirrored;var n=t;var s=n.magnitude;return _objectSpread(_objectSpread({},_this320.focusStore.state),{},{linear:_objectSpread(_objectSpread({},e),{},{start:new O(e.start).divide(n),end:new O(e.end).divide(n)}),radial:_objectSpread(_objectSpread({},r),{},{center:new O(r.center).divide(n),radius:r.radius/s}),mirrored:_objectSpread(_objectSpread({},o),{},{origin:new O(o.origin).divide(n),size:o.size/s}),gaussian:_objectSpread({},_this320.focusStore.state.gaussian)});};this.editor=t;this.focusStore=new Ei(this.editor);var e=this.editor.assetProvider.getAssets("focus");this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},this.config),{},{flattenCategories:true,locale:this.locale.items,getAssetPath:this.editor.getAssetPath("focus")}));}_createClass(cu,[{key:"state",get:function get(){return this.focusStore.state;}},{key:"serializableState",get:function get(){switch(this.identifier){case"linear":return{identifier:this.identifier,linear:this.focusStore.getEffectProperties()};case"radial":return{identifier:this.identifier,radial:this.focusStore.getEffectProperties()};case"mirrored":var t=this.focusStore.getEffectProperties();return{identifier:this.identifier,mirrored:{blurRadius:t.blurRadius,origin:t.mirrorAxisOrigin,rotation:ct(this.state.mirrored.rotation),size:t.clearAreaWidth}};case"gaussian":return{identifier:this.identifier,gaussian:this.focusStore.getEffectProperties()};default:return lu;}}},{key:"start",get:function get(){return this.focusStore.state.linear.start;}},{key:"startOnPreview",get:function get(){var t=this.editor.applyFlipToPreview(this.focusStore.state.linear.start);return{x:Math.abs(t.x),y:Math.abs(t.y)};}},{key:"end",get:function get(){return this.focusStore.state.linear.end;}},{key:"endOnPreview",get:function get(){var t=this.editor.applyFlipToPreview(this.focusStore.state.linear.end);return{x:Math.abs(t.x),y:Math.abs(t.y)};}},{key:"center",get:function get(){return this.focusStore.state.radial.center;}},{key:"radius",get:function get(){return this.focusStore.state.radial.radius;}},{key:"origin",get:function get(){return this.focusStore.state.mirrored.origin;}},{key:"rotation",get:function get(){return this.focusStore.state.mirrored.rotation;}},{key:"rotationOnPreview",get:function get(){var _this$editor$outputCo=this.editor.outputContainer.getData(),t=_this$editor$outputCo.flipHorizontally,e=_this$editor$outputCo.flipVertically;return $h({rotation:this.focusStore.state.mirrored.rotation,flipHorizontally:t,flipVertically:e});}},{key:"size",get:function get(){return this.focusStore.state.mirrored.size;}},{key:"mirroredAreaWidth",get:function get(){var _this$editor$canvasSt=this.editor.canvasStore.canvasSize,t=_this$editor$canvasSt.width,e=_this$editor$canvasSt.height;return Math.sqrt(Math.pow(t,2)+Math.pow(e,2))*2;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"intensity",get:function get(){if(this.identifier==="identity"){return lu.gaussian.blurRadius;}return this.state[this.identifier].blurRadius;}},{key:"relativeIntensity",get:function get(){var _ref134=this.identifier==="identity"?this.state.gaussian:this.state[this.identifier],t=_ref134.blurRadius;return(t-_cu.minIntensity)*100/(this.maxIntensity-_cu.minIntensity);}},{key:"maxIntensity",get:function get(){return this.editor.shortestOutputSide/10;}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}},{key:"config",get:function get(){return this.editor.configStore.config["focus"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["focus"];}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"setGaussianFocus",value:function setGaussianFocus(_ref135){var t=_ref135.blurRadius;this.focusStore.setGaussianFocus({blurRadius:t});}},{key:"setLinearFocus",value:function setLinearFocus(_ref136){var t=_ref136.start,e=_ref136.end,r=_ref136.blurRadius;this.focusStore.setLinearFocus({start:t,end:e,blurRadius:r});}},{key:"setRadialFocus",value:function setRadialFocus(_ref137){var t=_ref137.center,e=_ref137.radius,r=_ref137.blurRadius;this.focusStore.setRadialFocus({center:t,radius:e,blurRadius:r});}},{key:"setMirroredFocus",value:function setMirroredFocus(_ref138){var t=_ref138.mirrorAxisOrigin,e=_ref138.clearAreaWidth,r=_ref138.blurRadius,o=_ref138.mirrorAxisDirection;this.focusStore.setMirroredFocus({mirrorAxisOrigin:t,clearAreaWidth:e,blurRadius:r,mirrorAxisDirection:o});}}],[{key:"minIntensity",get:function get(){return 0;}},{key:"doesFocusIdentifierExist",value:function doesFocusIdentifierExist(t){return Object.keys(cs).map(function(e){return cs[e];}).findIndex(function(e){return e===t;})!==-1;}}]);return cu;}();Bt=_cu;f([C],Bt.prototype,"selectFocus",2);f([C],Bt.prototype,"changeIntensity",2);f([C],Bt.prototype,"changeRelativeIntensity",2);f([C],Bt.prototype,"clickableCanvas",2);f([C],Bt.prototype,"pureReset",2);f([C],Bt.prototype,"reset",2);f([C],Bt.prototype,"setStart",2);f([C],Bt.prototype,"setEnd",2);f([C],Bt.prototype,"setCenter",2);f([C],Bt.prototype,"setRadius",2);f([C],Bt.prototype,"setOrigin",2);f([C],Bt.prototype,"setSize",2);f([C],Bt.prototype,"setRotation",2);f([C],Bt.prototype,"updateStateFromHistory",2);f([C],Bt.prototype,"updateStateFromSerialization",2);f([C],Bt.prototype,"updateCanvasControls",2);f([S],Bt.prototype,"state",1);f([S],Bt.prototype,"start",1);f([S],Bt.prototype,"startOnPreview",1);f([S],Bt.prototype,"end",1);f([S],Bt.prototype,"endOnPreview",1);f([S],Bt.prototype,"center",1);f([S],Bt.prototype,"radius",1);f([S],Bt.prototype,"origin",1);f([S],Bt.prototype,"rotation",1);f([S],Bt.prototype,"rotationOnPreview",1);f([S],Bt.prototype,"size",1);f([S],Bt.prototype,"mirroredAreaWidth",1);f([S],Bt.prototype,"identifier",1);f([S],Bt.prototype,"intensity",1);f([S],Bt.prototype,"relativeIntensity",1);f([S],Bt.prototype,"maxIntensity",1);f([S],Bt.prototype,"isOptionSelected",1);f([S],Bt.prototype,"config",1);f([S],Bt.prototype,"locale",1);f([S],Bt.prototype,"items",1);});var uk=d(function(){pH();nv();});var Xh;var dk=d(function(){R();Xh={identifier:"identity",opacity:1,blendMode:"lighten"};});var Olt,Zs;var hH=d(function(){Tt();R();Kh();dk();Olt=new Js(0,1);Zs=/*#__PURE__*/function(){function Zs(t,e){var _this321=this;_classCallCheck(this,Zs);this.changeIdentifier=function(t){_this321.state.identifier=t;};this.changeOpacity=function(t){var e=Olt.clamp(t);_this321.state.opacity=e;};this.changeBlendMode=function(t){_this321.state.blendMode=t;};this.reset=function(){if(_this321.indexInContainer===-1){_this321.state.identifier=Xh.identifier;_this321.state.opacity=Xh.opacity;_this321.state.blendMode=Xh.blendMode;_this321.removeIndex();}};this.correctOverlayFlip=function(){var _this321$editor$outpu=_this321.editor.outputContainer.getData(),t=_this321$editor$outpu.flipHorizontally,e=_this321$editor$outpu.flipVertically;if(_this321.effect){_this321.effect.setFlipHorizontally(t);_this321.effect.setFlipVertically(e);}};this.removeOverlayEffect=function(){if(_this321.effect){_this321.engineMediator.engine.removeEffect(_this321.effect);_this321.removeIndex();_this321.effect=void 0;}};this.setEffectProperties=function(t){if(_this321.effect){_this321.effect.setProperties(t);return _this321.effect.getProperties();}return null;};this.setOverlayEffect=function(_ref139){var t=_ref139.identifier,e=_ref139.blendMode,r=_ref139.opacity;var o=_objectSpread({},_this321.state);_this321.removeOverlayEffect();var n=_this321.engineMediator.orderHelper.addIndex("overlay");return new Promise(function(s,a){_this321.engineMediator.engine.addOverlayFromAssets(t,_this321.engineMediator.image.container,n).then(function(l){_this321.changeIdentifier(t);_this321.changeOpacity(r);_this321.changeBlendMode(e);_this321.effect=l;_this321.effect.setProperties({blendMode:e,opacity:r});_this321.correctOverlayFlip();s();})["catch"](function(l){_this321.changeIdentifier(o.identifier);_this321.changeOpacity(o.opacity);_this321.changeBlendMode(o.blendMode);if(o.identifier==="identity"){_this321.removeIndex();}a(l);});});};this.removeIndex=function(){_this321.engineMediator.orderHelper.removeIndex("overlay");};this.engineMediator=t;this.editor=e;this.state=Xh;}_createClass(Zs,[{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}}]);return Zs;}();f([Q],Zs.prototype,"state",2);f([C],Zs.prototype,"changeIdentifier",2);f([C],Zs.prototype,"changeOpacity",2);f([C],Zs.prototype,"changeBlendMode",2);f([C],Zs.prototype,"reset",2);f([C],Zs.prototype,"correctOverlayFlip",2);});var fH,Ze;var gH=d(function(){fH=y(rd());Tt();R();U();Zi();Nn();hH();Ze=/*#__PURE__*/function(){function Ze(t){var _this322=this;_classCallCheck(this,Ze);this.throttledRender=(0,fH["default"])(function(){if(_this322.editor){_this322.editor.render();}},10,{trailing:true});this.selectOverlay=/*#__PURE__*/function(){var _ref140=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee22(t){var _e16;return regeneratorRuntime.wrap(function _callee22$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:if(!(t!==_this322.identifier)){_context23.next=6;break;}_e16=_this322.defaultBlendModeForIdentifier(t);_context23.next=4;return _this322.overlayStore.setOverlayEffect({identifier:t,opacity:1,blendMode:_e16});case 4:_this322.addSnapshot("add","overlay");_this322.editor.render();case 6:case"end":return _context23.stop();}}},_callee22);}));return function(_x27){return _ref140.apply(this,arguments);};}();this.changeOpacity=function(t){var e=_this322.overlayStore.setEffectProperties({opacity:t});if(e){_this322.overlayStore.changeOpacity(e.opacity);_this322.throttledRender();}};this.toolSnapshot=function(){_this322.addSnapshot("edit",_this322.locale.controls.sliderOpacity);};this.addSnapshot=function(t,e){_this322.editor.addSnapshot(void 0,t,e);};this.changeBlendMode=function(t){var e=_this322.overlayStore.setEffectProperties({blendMode:t});if(e){_this322.overlayStore.changeBlendMode(e.blendMode);_this322.addSnapshot("edit",_this322.locale.controls.carouselBlendMode);_this322.editor.render();}};this.pureReset=function(){_this322.overlayStore.removeOverlayEffect();_this322.overlayStore.reset();};this.reset=function(){_this322.pureReset();_this322.addSnapshot("delete",_this322.locale.controls.buttonReset);_this322.editor.render();};this.updateStateFromSerialization=/*#__PURE__*/function(){var _ref141=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee23(t){var e;return regeneratorRuntime.wrap(function _callee23$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:e=_this322.entityManager.items.find(function(r){return r.identifier===t.identifier;});if(!e){_context24.next=3;break;}return _context24.abrupt("return",_this322.overlayStore.setOverlayEffect(t).then(function(){_this322.editor.transformToolStore.setOverlayOpacity(t.opacity);}));case 3:throw new Do(t.identifier);case 4:case"end":return _context24.stop();}}},_callee23);}));return function(_x28){return _ref141.apply(this,arguments);};}();this.updateStateFromHistory=/*#__PURE__*/function(){var _ref142=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee24(t){return regeneratorRuntime.wrap(function _callee24$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:if(!(t.identifier==="identity")){_context25.next=3;break;}_this322.pureReset();return _context25.abrupt("return",new Promise(function(e){e();}));case 3:return _context25.abrupt("return",_this322.overlayStore.setOverlayEffect(t));case 4:case"end":return _context25.stop();}}},_callee24);}));return function(_x29){return _ref142.apply(this,arguments);};}();this.correctOverlayFlip=function(){_this322.overlayStore.correctOverlayFlip();};this.defaultBlendModeForIdentifier=function(t){var e=_this322.entityManager.items.findIndex(function(r){return r.identifier===t;});return e!==-1?_this322.entityManager.items[e].defaultBlendMode:"lighten";};this.editor=t;this.overlayStore=new Zs(this.editor.engineMediator,t);var e=this.editor.assetProvider.getAssets("overlay");var r=this.config;this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},r),{},{flattenCategories:true,locale:this.locale.items,getAssetPath:this.editor.getAssetPath("overlay")}));}_createClass(Ze,[{key:"state",get:function get(){return this.overlayStore.state;}},{key:"identifier",get:function get(){return this.overlayStore.state.identifier;}},{key:"opacity",get:function get(){return this.overlayStore.state.opacity;}},{key:"blendMode",get:function get(){return this.overlayStore.state.blendMode;}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}},{key:"config",get:function get(){return this.editor.configStore.config["overlay"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["overlay"];}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"allBlendModes",get:function get(){var t=this.locale.controls;return Object.keys(pn).map(function(e){var r=pn[e];var o="blendMode".concat(r.charAt(0).toUpperCase()).concat(r.slice(1));return{identifier:r,value:t[o]};});}}]);return Ze;}();f([C],Ze.prototype,"selectOverlay",2);f([C],Ze.prototype,"changeOpacity",2);f([C],Ze.prototype,"changeBlendMode",2);f([C],Ze.prototype,"pureReset",2);f([C],Ze.prototype,"reset",2);f([C],Ze.prototype,"updateStateFromSerialization",2);f([C],Ze.prototype,"updateStateFromHistory",2);f([C],Ze.prototype,"correctOverlayFlip",2);f([S],Ze.prototype,"state",1);f([S],Ze.prototype,"identifier",1);f([S],Ze.prototype,"opacity",1);f([S],Ze.prototype,"blendMode",1);f([S],Ze.prototype,"isOptionSelected",1);f([S],Ze.prototype,"config",1);f([S],Ze.prototype,"locale",1);f([S],Ze.prototype,"items",1);f([S],Ze.prototype,"allBlendModes",1);});var mk=d(function(){gH();dk();});var Rlt,Nr,pk;var hk=d(function(){pr();Rlt="white";Nr={identifier:"identity",opacity:1,tintColor:mr[Rlt],tintMode:"none",resizeMode:"keepAspect"};pk={};});var Hn;var ym=d(function(){Xt();pr();Hn=function Hn(){return Object.keys(mr).map(function(i){var t=mr[i];return{identifier:i,color:t,colorString:Un(t)};});};});function sv(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return new Promise(function(e,r){var o=new Image();o.addEventListener("load",function(){var n=document.createElement("canvas");var s=n.getContext("2d");n.width=o.width;n.height=o.height;if(t){n.width=t;n.height=t*o.height/o.width;}s.drawImage(o,0,0,n.width,n.height);var a=n.toDataURL("image/png");$t(n);e(a);});o.addEventListener("error",function(){r();});o.src=i;});}var bH;var fk=d(function(){R();U();bH=function bH(i){return new Promise(function(t,e){var r=new FileReader();r.onload=/*#__PURE__*/function(){var _ref143=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee25(o){var n,s;return regeneratorRuntime.wrap(function _callee25$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:_context26.prev=0;n=o.target.result;_context26.next=4;return sv(n,150);case 4:s=_context26.sent;t({stickerURI:n,thumbnailURI:s,name:i.name||"",type:i.type,identifier:At()});_context26.next=11;break;case 8:_context26.prev=8;_context26.t0=_context26["catch"](0);e(_context26.t0);case 11:case"end":return _context26.stop();}}},_callee25,null,[[0,8]]);}));return function(_x30){return _ref143.apply(this,arguments);};}();r.onerror=function(o){e(o);};r.readAsDataURL(i);});};});var yH,gk,Pt;var bk=d(function(){Tt();R();U();ym();Zi();Nn();fk();pr();hk();yH="identity";gk="imgly_sticker_custom";Pt=/*#__PURE__*/function(){function Pt(t){var _this323=this;_classCallCheck(this,Pt);this.state=Q.map(pk);this.customStickers=[];this.colorList=Hn();this.selectLast=function(){_this323.editor.spriteStore.selectHighestOrderSprite(Array.from(_this323.state.keys()));};this.doesStickerAssetExist=function(t){return _this323.entityManager.items.findIndex(function(e){return e.identifier===t;})!==-1;};this.add=function(t){var e=_this323.entityManager.items.find(function(n){return n.identifier===t;});var r=e?e.tintMode:Nr.tintMode;var o=e?e.resizeMode:Nr.resizeMode;_this323.editor.spriteStore.addSticker({state:{identifier:t,tintMode:r,tintColor:Nr.tintColor,opacity:Nr.opacity,resizeMode:o}});};this.duplicate=function(){if(_this323.id){var _t33=_this323.editor.spriteStore.getDuplicateContainerTransform(_this323.id);var _e17=_this323.editor.spriteStore.getDuplicateContainerFlip(_this323.id);var _this323$editor$outpu=_this323.editor.outputContainer.getData(),_r15=_this323$editor$outpu.flipHorizontally,o=_this323$editor$outpu.flipVertically;_this323.editor.spriteStore.addSticker({state:{identifier:_this323.identifier,tintColor:ct(_this323.tintColor),tintMode:_this323.tintMode,resizeMode:_this323.resizeMode,opacity:_this323.opacity,flipHorizontally:_r15!==_e17.flipHorizontally,flipVertically:o!==_e17.flipVertically},transform:_t33});}};this.bringToFront=function(){if(_this323.id){_this323.editor.spriteStore.bringToFront(_this323.id);}};this.flipHorizontally=function(){if(_this323.id){_this323.editor.spriteStore.flipHorizontally(_this323.id);}};this["delete"]=function(){if(_this323.id){var _t34=_this323.id;_this323.editor.spriteStore.removeSprite(_t34);_this323.state["delete"](_t34);_this323.selectLast();}};this.updateStateFromHistory=function(t,e){if((0,Ye["default"])(e,_this323.state.get(t))){return;}_this323.setState(t,e);_this323.editor.spriteStore.setContainerProperties(t,e);};this.setState=function(t,e){var r=_this323.state.get(t);if(r){if("opacity"in e){r.opacity=e.opacity;}if(e.tintColor){r.tintColor=e.tintColor;}if(e.tintMode){r.tintMode=e.tintMode;}if(e.resizeMode){r.resizeMode=e.resizeMode;}_this323.state.set(t,r);}else{_this323.state.set(t,{identifier:e.identifier,opacity:e.opacity,tintMode:e.tintMode,resizeMode:e.resizeMode,tintColor:e.tintColor?e.tintColor:Nr.tintColor});}};this.changeOpacity=function(t){if(_this323.id){var _e18=_this323.state.get(_this323.id);if(_e18){_this323.editor.spriteStore.setContainerProperties(_this323.id,{opacity:t});var _r16=_this323.editor.spriteStore.getContainerProperties(_this323.id);_e18.opacity=_r16.opacity;_this323.state.set(_this323.id,_e18);}}};this.changeTintColor=function(t){if(_this323.id){var _e19=_this323.state.get(_this323.id);if(_e19){var _this323$entityManage=_this323.entityManager.items.find(function(n){return n.identifier===_this323.identifier;}),_r17=_this323$entityManage.tintMode;_this323.editor.spriteStore.setContainerProperties(_this323.id,{tintColor:t,tintMode:_r17});var o=_this323.editor.spriteStore.getContainerProperties(_this323.id);_e19.tintColor=o.tintColor;_e19.tintMode=o.tintMode||Nr.tintMode;_this323.state.set(_this323.id,_e19);}}};this.tintColorSnapshot=function(){_this323.addSnapshot("edit",_this323.locale.history.color);};this.addFiles=/*#__PURE__*/function(){var _ref144=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee26(t){var _e20,_r18,o;return regeneratorRuntime.wrap(function _callee26$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:_this323.editor.modalStore.showInfoModal("loading");if(!t.length){_context27.next=17;break;}_e20=0;_r18=[];for(_e20=0;_e200){this.colorList=Vo(ct(this.config.colors));}}_createClass(Pt,[{key:"isStickerSelected",get:function get(){return this.editor.spriteStore.isSpriteSticker;}},{key:"isCustomStickerEnabled",get:function get(){return this.config.enableCustomUpload;}},{key:"customStickerTintMode",get:function get(){return this.config.customStickerTintMode;}},{key:"customStickerResizeMode",get:function get(){return this.config.customStickerResizeMode;}},{key:"currentSticker",get:function get(){if(this.isStickerSelected){var t=this.state.get(this.id);if(t){return t;}}return void 0;}},{key:"identifier",get:function get(){if(this.isStickerSelected){var t=this.state.get(this.id);if(t){return t.identifier;}}return"none";}},{key:"id",get:function get(){if(this.isStickerSelected){return this.editor.spriteStore.id;}return void 0;}},{key:"opacity",get:function get(){if(this.currentSticker){return this.currentSticker.opacity;}return Nr.opacity;}},{key:"tintMode",get:function get(){if(this.currentSticker){return this.currentSticker.tintMode;}return Nr.tintMode;}},{key:"resizeMode",get:function get(){if(this.currentSticker){return this.currentSticker.resizeMode;}return Nr.resizeMode;}},{key:"tintable",get:function get(){if(this.currentSticker){return this.currentSticker.tintMode==="solid"||this.currentSticker.tintMode==="colorized";}return false;}},{key:"tintColor",get:function get(){if(this.currentSticker){return this.currentSticker.tintColor;}return Nr.tintColor;}},{key:"config",get:function get(){return this.editor.configStore.config["sticker"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["sticker"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"selectedCategoryIdentifier",get:function get(){return this.selectedCategory;}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"categories",get:function get(){return this.entityManager.categories;}}]);return Pt;}();f([Q],Pt.prototype,"selectedCategory",2);f([Q],Pt.prototype,"entityManager",2);f([C],Pt.prototype,"selectLast",2);f([C],Pt.prototype,"add",2);f([C],Pt.prototype,"duplicate",2);f([C],Pt.prototype,"bringToFront",2);f([C],Pt.prototype,"flipHorizontally",2);f([C],Pt.prototype,"delete",2);f([C],Pt.prototype,"updateStateFromHistory",2);f([C],Pt.prototype,"setState",2);f([C],Pt.prototype,"changeOpacity",2);f([C],Pt.prototype,"changeTintColor",2);f([C],Pt.prototype,"addFiles",2);f([C],Pt.prototype,"addCustomStickerAsset",2);f([C],Pt.prototype,"toggleCategorySelection",2);f([C],Pt.prototype,"pureReset",2);f([C],Pt.prototype,"dispose",2);f([S],Pt.prototype,"isStickerSelected",1);f([S],Pt.prototype,"isCustomStickerEnabled",1);f([S],Pt.prototype,"customStickerTintMode",1);f([S],Pt.prototype,"customStickerResizeMode",1);f([S],Pt.prototype,"currentSticker",1);f([S],Pt.prototype,"identifier",1);f([S],Pt.prototype,"id",1);f([S],Pt.prototype,"opacity",1);f([S],Pt.prototype,"tintMode",1);f([S],Pt.prototype,"resizeMode",1);f([S],Pt.prototype,"tintable",1);f([S],Pt.prototype,"tintColor",1);f([S],Pt.prototype,"config",1);f([S],Pt.prototype,"locale",1);f([S],Pt.prototype,"localeColor",1);f([S],Pt.prototype,"selectedCategoryIdentifier",1);f([S],Pt.prototype,"items",1);f([S],Pt.prototype,"categories",1);});var _H=d(function(){hk();bk();});var Alt,te,yk;var _k=d(function(){pr();Alt="imgly_font_open_sans_bold";te={text:"Write Something",identifier:Alt,fontSize:73.3,defaultFontSize:73.3,fontFamily:"Open Sans",fontStyle:"",fontWeight:"bold",lineHeight:1,alignment:"center",textColor:mr.white,backgroundColor:mr.transparent||[0,0,0,0],width:0};yk={};});var xH;var vH=d(function(){pr();xH=function xH(){return Object.keys(nk).map(function(i){var t=nk[i];return{identifier:i,color:t,colorString:Un(t)};});};});var CH,_m10,gt;var xk=d(function(){Tt();R();zn();U();vH();ym();Zi();pr();_k();CH={100:"Extra Light",200:"Light",300:"Book",400:"Regular",500:"Medium",600:"SemiBold",700:"Bold",800:"Black",900:"Extra Black",bold:"Bold",normal:"Regular",lighter:"Lighter"};_m10=/*#__PURE__*/function(){function _m(t){var _this324=this;_classCallCheck(this,_m);this.state=Q.map(yk);this.colorList=Hn();this.backgroundColorList=xH();this.fontsLoadStatus=Q.object({pending:false,loaded:false});this.doesTextAssetExist=function(t){return _this324.editor.assetProvider.getFontAssets().findIndex(function(e){return e.identifier===t;})!==-1;};this.validFontWithConfig=function(t){return _this324.fonts.find(function(e){return e.identifier===t;})||_this324.fonts[0];};this.addOrselect=function(){if(!_this324.state.size){_this324.add();}else{_this324.selectLast();_this324.loadFonts();}};this.selectLast=function(){_this324.editor.spriteStore.selectHighestOrderSprite(Array.from(_this324.state.keys()));};this.add=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee28(){var t,e,r;return regeneratorRuntime.wrap(function _callee28$(_context29){while(1){switch(_context29.prev=_context29.next){case 0:t=_this324.fontsLoadStatus;e=function e(){_this324.editor.spriteStore.addText({state:{identifier:te.identifier,text:te.text,textColor:te.textColor,backgroundColor:te.backgroundColor,lineHeight:te.lineHeight,alignment:te.alignment,fontSize:0}});};if(!(!t.pending&&!t.loaded)){_context29.next=18;break;}_this324.fontsLoadStatus.pending=true;r=_this324.editor.assetProvider.getFontManager();_context29.prev=5;_context29.next=8;return r.loadFontsWithIdentifiers([te.identifier]);case 8:e();_context29.next=14;break;case 11:_context29.prev=11;_context29.t0=_context29["catch"](5);_this324.editor.modalStore.showActionModal({type:"error",identifier:"fontLoading",error:te.identifier});case 14:_context29.next=16;return _this324.loadFonts();case 16:_context29.next=19;break;case 18:e();case 19:case"end":return _context29.stop();}}},_callee28,null,[[5,11]]);}));this.duplicate=function(){if(_this324.id){var _t35=_this324.editor.spriteStore.getDuplicateContainerTransform(_this324.id);_this324.editor.spriteStore.addText({state:{identifier:_this324.identifier,text:_this324.text,textColor:ct(_this324.textColor),lineHeight:_this324.lineHeight,alignment:_this324.alignment,fontSize:_this324.fontSize,backgroundColor:ct(_this324.backgroundColor),width:_this324.width},transform:_t35});}};this.bringToFront=function(){if(_this324.id){_this324.editor.spriteStore.bringToFront(_this324.id);}};this["delete"]=function(){if(_this324.id){var _t36=_this324.id;_this324.editor.spriteStore.removeSprite(_t36);_this324.state["delete"](_t36);_this324.selectLast();}};this.setEditMode=function(t){_this324.editor.spriteStore.setEditMode(t);};this.changeFont=function(t){var e=_this324.fonts.find(function(r){return r.identifier===t;});_this324.changeIdentifier(e,_this324.id);if(_this324.id){_this324.addSnapshot("edit",_this324.locale.history.fontFamily);}};this.changeIdentifier=function(t,e){Ve(function(){if(t&&e){var r=_this324.state.get(e);if(r){_this324.editor.spriteStore.setContainerProperties(e,{fontIdentifier:t.identifier},true);var o=_this324.editor.spriteStore.getContainerProperties(e);r.identifier=o.fontIdentifier;r.fontFamily=t.fontFamily;r.fontStyle=t.fontStyle;r.fontWeight=t.fontWeight;r.fontSize=o.fontSize;r.width=o.width;r.defaultFontSize=r.fontSize;_this324.state.set(e,r);}}});};this.changeFontSize=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(_this324.id){var r=_this324.state.get(_this324.id);if(r){r.fontSize=t;if(e){r.defaultFontSize=t;}_this324.state.set(_this324.id,r);}}};this.updateDefaultFontSize=function(){if(_this324.id){var _t37=_this324.state.get(_this324.id);if(_t37){_t37.defaultFontSize=_t37.fontSize;_this324.state.set(_this324.id,_t37);}}};this.changeSize=function(t,e){var r=_this324.state.get(t);if(r){r.width=e.width;r.fontSize=e.fontSize;r.defaultFontSize=e.fontSize;_this324.state.set(t,r);}};this.changeWidth=function(t){if(_this324.id){var e=_this324.state.get(_this324.id);if(e){e.width=t;_this324.state.set(_this324.id,e);}}};this.changeText=function(t){if(_this324.id){var e=_this324.state.get(_this324.id);if(e){_this324.editor.spriteStore.setContainerProperties(_this324.id,{text:t},true);var r=_this324.editor.spriteStore.getContainerProperties(_this324.id);var o=_this324.editor.outputContainer.getSizeInOutputSpace();var n=_this324.editor.spriteStore.getSize(_this324.id);if(!_this324.config.disableAutoScaling){if(n.height>o.height){_this324.editor.spriteStore.setContainerProperties(_this324.id,{fontSize:_this324.calculateFitFontSize(_this324.id,o.height)},true);}}r=_this324.editor.spriteStore.getContainerProperties(_this324.id);e.text=r.text;e.fontSize=r.fontSize;e.defaultFontSize=r.fontSize;_this324.state.set(_this324.id,e);_this324.addSnapshot("edit",_this324.locale.history.edit);}}};this.calculateFitFontSize=function(t,e){if(!_m10.measureContext){var h=document.createElement("canvas");_m10.measureContext=h.getContext("2d");}var r=_this324.editor.spriteStore.getContainerProperties(t);var o=_this324.editor.engine.assetProvider.getFontManager().getFontWithId(r.fontIdentifier);var n=_this324.config.minFontSizeForAutoScaling;var s=nu(_m10.measureContext,r.text,o,r.fontSize,r.lineHeight,r.width,o.textMetrics);var a=Math.min(Math.floor(r.fontSize*(e/s.height)),1);var l=Math.round(r.fontSize);var c=0;var u=l-a;var m=Math.floor((l-a)*2);var p=u;while(c<=m){u=c+Math.floor((m-c)/2);var _h15=nu(_m10.measureContext,r.text,o,u,r.lineHeight,r.width,o.textMetrics);if(e<_h15.height){m=u-1;p=u-1;}else if(e>_h15.height){c=u+1;if(a+u>=l){return l;}}else{p=u;break;}}if(n&&p0){this.colorList=Vo(ct(this.config.colors));}if(this.config.backgroundColors&&this.config.backgroundColors.length>0){this.backgroundColorList=Vo(ct(this.config.backgroundColors));}}_createClass(_m,[{key:"loadFonts",value:function(){var _loadFonts2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee29(){var t,e,r,n;return regeneratorRuntime.wrap(function _callee29$(_context30){while(1){switch(_context30.prev=_context30.next){case 0:t=this.fontsLoadStatus;if(!t.loaded){_context30.next=3;break;}return _context30.abrupt("return");case 3:e=this.editor.assetProvider.getFontManager();r=this.editor.assetProvider.getFontAssetsForText().filter(Boolean).map(function(o){return o.identifier;});_context30.prev=5;_context30.next=8;return e.loadFontsWithIdentifiers(r);case 8:_context30.next=14;break;case 10:_context30.prev=10;_context30.t0=_context30["catch"](5);n=r.filter(function(s){return!e.isFontLoaded(s);}).join(", ");this.editor.modalStore.showActionModal({type:"error",identifier:"fontLoading",error:n});case 14:t.loaded=true;case 15:case"end":return _context30.stop();}}},_callee29,this,[[5,10]]);}));function loadFonts(){return _loadFonts2.apply(this,arguments);}return loadFonts;}()},{key:"isEditMode",get:function get(){return this.editor.spriteStore.isEditMode;}},{key:"isTextSelected",get:function get(){return this.editor.spriteStore.isSpriteText;}},{key:"fontsLoaded",get:function get(){return this.fontsLoadStatus.loaded;}},{key:"currentText",get:function get(){if(this.isTextSelected){var t=this.state.get(this.id);if(t){return t;}}return void 0;}},{key:"text",get:function get(){if(this.currentText){return this.currentText.text;}return te.text;}},{key:"fontSize",get:function get(){if(this.currentText){return this.currentText.fontSize;}return te.fontSize;}},{key:"defaultFontSize",get:function get(){if(this.currentText){return this.currentText.defaultFontSize;}return te.defaultFontSize;}},{key:"width",get:function get(){if(this.currentText){return this.currentText.width;}return te.width;}},{key:"fontFamily",get:function get(){if(this.currentText){return this.currentText.fontFamily;}return te.fontFamily;}},{key:"fontStyle",get:function get(){if(this.currentText){return this.currentText.fontStyle;}return te.fontStyle;}},{key:"fontWeight",get:function get(){if(this.currentText){return this.currentText.fontWeight;}return te.fontWeight;}},{key:"lineHeight",get:function get(){if(this.currentText){return this.currentText.lineHeight;}return te.lineHeight;}},{key:"identifier",get:function get(){if(this.currentText){return this.currentText.identifier;}return te.identifier;}},{key:"id",get:function get(){if(this.isTextSelected){return this.editor.spriteStore.id;}return void 0;}},{key:"alignment",get:function get(){if(this.currentText){return this.currentText.alignment;}return te.alignment;}},{key:"textColor",get:function get(){if(this.currentText){return this.currentText.textColor;}return te.textColor;}},{key:"backgroundColor",get:function get(){if(this.currentText){return this.currentText.backgroundColor;}return te.backgroundColor;}},{key:"config",get:function get(){return this.editor.configStore.config["text"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["text"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"rawOptions",get:function get(){return this.editor.assetProvider.getFontAssetsForText();}},{key:"availableOptions",get:function get(){if(this.config.fonts.length){return this.config.fonts.map(function(t){return t.identifier;});}return this.rawOptions.filter(Boolean).map(function(t){return t.identifier;});}},{key:"fonts",get:function get(){var _this325=this;return this.rawOptions.filter(Boolean).reduce(function(t,e){if(_this325.availableOptions.indexOf(e.identifier)!==-1){return[].concat(_toConsumableArray(t),[{identifier:e.identifier,fontFamily:e.fontFamily,fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||""}]);}return t;},[]);}},{key:"fontFamilies",get:function get(){return _toConsumableArray(new Set(this.fonts));}}],[{key:"defaultText",value:function defaultText(){return te.text;}},{key:"getDisplayFontStyle",value:function getDisplayFontStyle(t){var e=t.fontWeight&&CH[t.fontWeight].toLowerCase()!=="regular"?CH[t.fontWeight]:"";var r=t.fontStyle&&t.fontStyle.toLowerCase()!=="normal"?t.fontStyle:"";return"".concat(t.fontFamily.toLowerCase().includes(e.toLowerCase())?"":e," ").concat(r).trim();}}]);return _m;}();gt=_m10;f([C],gt.prototype,"addOrselect",2);f([C],gt.prototype,"selectLast",2);f([C],gt.prototype,"add",2);f([C],gt.prototype,"duplicate",2);f([C],gt.prototype,"bringToFront",2);f([C],gt.prototype,"delete",2);f([C],gt.prototype,"setEditMode",2);f([C],gt.prototype,"changeFont",2);f([C],gt.prototype,"changeIdentifier",2);f([C],gt.prototype,"changeFontSize",2);f([C],gt.prototype,"updateDefaultFontSize",2);f([C],gt.prototype,"changeSize",2);f([C],gt.prototype,"changeWidth",2);f([C],gt.prototype,"changeText",2);f([C],gt.prototype,"changeLineHeight",2);f([C],gt.prototype,"changeColor",2);f([C],gt.prototype,"changeBackgroundColor",2);f([C],gt.prototype,"changeAlignment",2);f([C],gt.prototype,"updateStateFromHistory",2);f([C],gt.prototype,"setState",2);f([C],gt.prototype,"setFontSize",2);f([C],gt.prototype,"pureReset",2);f([C],gt.prototype,"dispose",2);f([S],gt.prototype,"isEditMode",1);f([S],gt.prototype,"isTextSelected",1);f([S],gt.prototype,"fontsLoaded",1);f([S],gt.prototype,"currentText",1);f([S],gt.prototype,"text",1);f([S],gt.prototype,"fontSize",1);f([S],gt.prototype,"defaultFontSize",1);f([S],gt.prototype,"width",1);f([S],gt.prototype,"fontFamily",1);f([S],gt.prototype,"fontStyle",1);f([S],gt.prototype,"fontWeight",1);f([S],gt.prototype,"lineHeight",1);f([S],gt.prototype,"identifier",1);f([S],gt.prototype,"id",1);f([S],gt.prototype,"alignment",1);f([S],gt.prototype,"textColor",1);f([S],gt.prototype,"backgroundColor",1);f([S],gt.prototype,"config",1);f([S],gt.prototype,"locale",1);f([S],gt.prototype,"localeColor",1);f([S],gt.prototype,"rawOptions",1);f([S],gt.prototype,"availableOptions",1);f([S],gt.prototype,"fonts",1);f([S],gt.prototype,"fontFamilies",1);});var SH=d(function(){_k();xk();});var Blt,Qe,vk,Ck;var Sk=d(function(){pr();Blt="imgly_text_design_blocks";Qe={identifier:Blt,color:mr.white,isInverted:false,text:"Write Something With Style",seed:0,padding:0,width:0};vk={imgly_text_design_blocks:835,imgly_text_design_rotated:6,imgly_text_design_blocks_light:3,imgly_text_design_equal_width:727,imgly_text_design_masked:259,imgly_text_design_celebrate:579,imgly_text_design_sunshine:77,imgly_text_design_masked_badge:683,imgly_text_design_blocks_condensed:673,imgly_text_design_celebrate_simple:425,imgly_text_design_equal_width_fat:961,imgly_text_design_watercolor:671,imgly_text_design_particles:683,imgly_text_design_masked_speech_bubble:317,imgly_text_design_masked_speech_bubble_comic:229,imgly_text_design_multiline:831};Ck={};});var Mt;var wk=d(function(){Tt();R();U();ym();Zi();Nn();pr();Sk();Mt=/*#__PURE__*/function(){function Mt(t){var _this326=this;_classCallCheck(this,Mt);this.state=Q.map(Ck);this.colorList=Hn();this.fontsLoaded=false;this.doesTextDesignAssetExist=function(t){return _this326.entityManager.items.findIndex(function(e){return e.identifier===t;})!==-1;};this.addOrselect=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee30(){return regeneratorRuntime.wrap(function _callee30$(_context31){while(1){switch(_context31.prev=_context31.next){case 0:_context31.next=2;return _this326.loadFonts();case 2:if(!_this326.state.size){_this326.add();}else{_this326.selectLast();}case 3:case"end":return _context31.stop();}}},_callee30);}));this.selectLast=function(){_this326.editor.spriteStore.selectHighestOrderSprite(Array.from(_this326.state.keys()));};this.add=function(){_this326.editor.spriteStore.addTextDesign({state:{identifier:Qe.identifier,text:Qe.text,color:Qe.color,isInverted:Qe.isInverted,seed:vk[Qe.identifier]||Qe.seed,padding:0}});};this.updateStateFromHistory=function(t,e){if((0,Ye["default"])(e,_this326.state.get(t))){return;}var r=_this326.state.get(t);if(e.identifier===r.identifier){_this326.setState(t,e);_this326.editor.spriteStore.setContainerProperties(t,e);}else{_this326.changeIdentifier(e.identifier,false,e.seed,t);}};this.setState=function(t,e){var r=_this326.state.get(t);if(r){if(e.inverted){r.isInverted=e.inverted;}if(e.seed){r.seed=e.seed;}if(e.color){r.color=e.color;}if(e.padding){r.padding=e.padding;}if(e.width){r.width=e.width;}}else{_this326.state.set(t,{width:e.width,text:e.text,isInverted:e.inverted,identifier:e.identifier,seed:e.seed,color:e.color?e.color:Qe.color,padding:e.padding});}};this.changeText=function(t){if(_this326.id){var _e21=_this326.state.get(_this326.id);if(_e21){_this326.editor.spriteStore.setContainerProperties(_this326.id,{text:t},true);var r=_this326.editor.spriteStore.getContainerProperties(_this326.id);_e21.text=r.text;_this326.state.set(_this326.id,_e21);_this326.addSnapshot("edit",_this326.locale.history.edit);}}};this.setEditMode=function(t){_this326.editor.spriteStore.setEditMode(t);};this.duplicate=function(){if(_this326.id){var _t38=_this326.editor.spriteStore.getDuplicateContainerTransform(_this326.id);_this326.editor.spriteStore.addTextDesign({state:{identifier:_this326.identifier,text:_this326.text,color:ct(_this326.color),isInverted:_this326.isInverted,seed:_this326.seed,padding:_this326.padding,width:_this326.width},transform:_t38});}};this.bringToFront=function(){if(_this326.id){_this326.editor.spriteStore.bringToFront(_this326.id);}};this.addSnapshot=function(t,e){var r=_this326.editor.historyStore.getCurrentSpritesState();if((r==null?void 0:r.textdesign)&&(0,Ye["default"])(r.textdesign,ct(_this326.state))){return;}if(_this326.currentTextDesign){_this326.editor.spriteStore.addSnapshot(t,e);}};this["delete"]=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this326.id;if(t){_this326.editor.spriteStore.removeSprite(t);_this326.state["delete"](t);_this326.selectLast();}};this.changeSeed=function(){if(_this326.id){var _t39=_this326.state.get(_this326.id);if(_t39){_this326.editor.spriteStore.setContainerProperties(_this326.id,{seed:-1},true);var _e22=_this326.editor.spriteStore.getContainerProperties(_this326.id);_t39.seed=_e22.seed;_this326.state.set(_this326.id,_t39);_this326.addSnapshot("edit",_this326.locale.history.shuffle);}}};this.changeIdentifier=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:_this326.id;if(o&&t!==_this326.identifier){var n=_this326.state.get(o);var s=_this326.editor.spriteStore.getContainerTransform(o);_this326.editor.spriteStore.addTextDesign({spriteId:o,state:{identifier:t,text:n.text,color:ct(n.color),isInverted:n.isInverted,seed:r||vk[t]||n.seed,padding:n.padding,width:n.width},transform:s},e,true);}};this.changeColor=function(t){if(_this326.id){var _e23=_this326.state.get(_this326.id);if(_e23){_this326.editor.spriteStore.setContainerProperties(_this326.id,{color:t});var r=_this326.editor.spriteStore.getContainerProperties(_this326.id);_e23.color=r.color;_this326.state.set(_this326.id,_e23);}}};this.colorSnapshot=function(){_this326.addSnapshot("edit",_this326.locale.history.color);};this.invertBackground=function(){if(_this326.id){var _t40=_this326.state.get(_this326.id);if(_t40){_this326.editor.spriteStore.setContainerProperties(_this326.id,{inverted:!_t40.isInverted},true);var _e24=_this326.editor.spriteStore.getContainerProperties(_this326.id);_t40.isInverted=_e24.inverted;_this326.state.set(_this326.id,_t40);_this326.addSnapshot("edit",_this326.locale.history.invert);}}};this.changeWidth=function(t){if(_this326.id){var _e25=_this326.state.get(_this326.id);if(_e25){_e25.width=t;_this326.state.set(_this326.id,_e25);}}};this.changePadding=function(t){if(_this326.id){var _e26=_this326.state.get(_this326.id);if(_e26){_e26.padding=t;_this326.state.set(_this326.id,_e26);}}};this.pureReset=function(){_this326.state=Q.map(Ck);};this.dispose=function(){_this326.state=null;_this326.fontsLoaded=null;_this326.editor=null;_this326.colorList=null;};this.editor=t;var e=this.editor.assetProvider.getAssets("textdesign");this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},this.config),{},{flattenCategories:true,locale:{},getAssetPath:this.editor.getAssetPath("textdesign")}));if(!this.entityManager.items.find(function(r){return r.identifier===Qe.identifier;})){Qe.identifier=this.entityManager.items[0].identifier;}Qe.text=this.locale.canvasControls.placeholderText;Qe.color=ct(Io(this.config,"defaultColor",Qe.color));if(this.config.colors&&this.config.colors.length>0){this.colorList=Vo(ct(this.config.colors));}}_createClass(Mt,[{key:"loadFonts",value:function(){var _loadFonts3=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee31(){var t,e,o;return regeneratorRuntime.wrap(function _callee31$(_context32){while(1){switch(_context32.prev=_context32.next){case 0:if(!this.fontsLoaded){_context32.next=2;break;}return _context32.abrupt("return");case 2:t=this.editor.assetProvider.getFontManager();e=this.editor.assetProvider.getFontAssetsForTextDesign().map(function(r){return r.identifier;});_context32.prev=4;_context32.next=7;return t.loadFontsWithIdentifiers(e);case 7:_context32.next=13;break;case 9:_context32.prev=9;_context32.t0=_context32["catch"](4);o=e.filter(function(n){return!t.isFontLoaded(n);}).join(", ");this.editor.modalStore.showActionModal({type:"error",identifier:"fontLoading",error:o});case 13:this.fontsLoaded=true;case 14:case"end":return _context32.stop();}}},_callee31,this,[[4,9]]);}));function loadFonts(){return _loadFonts3.apply(this,arguments);}return loadFonts;}()},{key:"isTextDesignSelected",get:function get(){return this.editor.spriteStore.isSpriteTextDesign;}},{key:"isEditMode",get:function get(){return this.editor.spriteStore.isEditMode;}},{key:"currentTextDesign",get:function get(){if(this.isTextDesignSelected&&this.id){var t=this.state.get(this.id);if(t){return t;}}return void 0;}},{key:"id",get:function get(){if(this.isTextDesignSelected){return this.editor.spriteStore.id;}return void 0;}},{key:"text",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.text;}return Qe.text;}},{key:"seed",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.seed;}return Qe.seed;}},{key:"padding",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.padding;}return Qe.padding;}},{key:"width",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.width;}return Qe.width;}},{key:"identifier",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.identifier;}return null;}},{key:"isInverted",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.isInverted;}return Qe.isInverted;}},{key:"color",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.color;}return Qe.color;}},{key:"config",get:function get(){return this.editor.configStore.config["textdesign"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["textdesign"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"items",get:function get(){return this.entityManager.items;}}],[{key:"defaultText",value:function defaultText(){return Qe.text;}}]);return Mt;}();f([C],Mt.prototype,"addOrselect",2);f([C],Mt.prototype,"selectLast",2);f([C],Mt.prototype,"add",2);f([C],Mt.prototype,"updateStateFromHistory",2);f([C],Mt.prototype,"setState",2);f([C],Mt.prototype,"changeText",2);f([C],Mt.prototype,"setEditMode",2);f([C],Mt.prototype,"duplicate",2);f([C],Mt.prototype,"bringToFront",2);f([C],Mt.prototype,"delete",2);f([C],Mt.prototype,"changeSeed",2);f([C],Mt.prototype,"changeIdentifier",2);f([C],Mt.prototype,"changeColor",2);f([C],Mt.prototype,"invertBackground",2);f([C],Mt.prototype,"changeWidth",2);f([C],Mt.prototype,"changePadding",2);f([C],Mt.prototype,"pureReset",2);f([C],Mt.prototype,"dispose",2);f([S],Mt.prototype,"isTextDesignSelected",1);f([S],Mt.prototype,"isEditMode",1);f([S],Mt.prototype,"currentTextDesign",1);f([S],Mt.prototype,"id",1);f([S],Mt.prototype,"text",1);f([S],Mt.prototype,"seed",1);f([S],Mt.prototype,"padding",1);f([S],Mt.prototype,"width",1);f([S],Mt.prototype,"identifier",1);f([S],Mt.prototype,"isInverted",1);f([S],Mt.prototype,"color",1);f([S],Mt.prototype,"config",1);f([S],Mt.prototype,"locale",1);f([S],Mt.prototype,"localeColor",1);f([S],Mt.prototype,"items",1);});var wH=d(function(){Sk();wk();});var Wn;var av=d(function(){pr();Wn={identifier:"identity",opacity:1,width:0,color:mr.white};});var Plt,Qs;var TH=d(function(){Tt();Kh();av();Plt=new Js(0,1);Qs=/*#__PURE__*/function(){function Qs(t){var _this327=this;_classCallCheck(this,Qs);this.changeIdentifier=function(t){_this327.state.identifier=t;};this.changeOpacity=function(t){var e=Plt.clamp(t);_this327.state.opacity=e;};this.changeWidth=function(t){_this327.state.width=t;};this.changeColor=function(t){_this327.state.color=t;};this.reset=function(){if(_this327.indexInContainer===-1){_this327.state.identifier=Wn.identifier;_this327.state.opacity=Wn.opacity;_this327.state.width=Wn.width;_this327.state.color=Wn.color;_this327.removeIndex();}};this.removeFrameEffect=function(){if(_this327.effect){_this327.engine.removeEffect(_this327.effect);_this327.effect=void 0;}};this.setEffectProperties=function(t){if(_this327.effect){_this327.removeIndex();_this327.effect.setProperties(t);return _this327.effect.getProperties();}return null;};this.setFrameEffect=function(_ref150){var t=_ref150.identifier,e=_ref150.width,r=_ref150.opacity,o=_ref150.color;var n=_objectSpread({},_this327.state);_this327.changeIdentifier(t);_this327.changeWidth(e);_this327.changeOpacity(r);_this327.changeColor(o);_this327.removeFrameEffect();return new Promise(function(s,a){_this327.engine.addFrameFromAssets(t,_this327.engineMediator.image.container).then(function(l){_this327.effect=l;_this327.effect.setProperties({tintColor:o,opacity:r,width:e});s();})["catch"](function(l){_this327.changeIdentifier(n.identifier);_this327.changeOpacity(n.opacity);_this327.changeWidth(n.width);_this327.changeColor(n.color);if(n.identifier==="identity"){_this327.removeIndex();}a(l);});});};this.removeIndex=function(){_this327.engineMediator.orderHelper.removeSprite(_this327.state.identifier);};this.engineMediator=t;this.state=Wn;}_createClass(Qs,[{key:"engine",get:function get(){return this.engineMediator.engine;}},{key:"imageContainer",get:function get(){return this.engineMediator.image.container;}},{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}}]);return Qs;}();f([Q],Qs.prototype,"state",2);f([C],Qs.prototype,"changeIdentifier",2);f([C],Qs.prototype,"changeOpacity",2);f([C],Qs.prototype,"changeWidth",2);f([C],Qs.prototype,"changeColor",2);f([C],Qs.prototype,"reset",2);});var kH,Be;var IH=d(function(){kH=y(rd());Tt();R();U();ym();Zi();Nn();pr();av();TH();Be=/*#__PURE__*/function(){function Be(t){var _this328=this;_classCallCheck(this,Be);this.colorList=Hn();this.throttledRender=(0,kH["default"])(function(){if(_this328.editor){_this328.editor.render();}},10,{trailing:true});this.selectFrame=/*#__PURE__*/function(){var _ref151=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee32(t){var _e27;return regeneratorRuntime.wrap(function _callee32$(_context33){while(1){switch(_context33.prev=_context33.next){case 0:if(!(t!==_this328.identifier)){_context33.next=6;break;}_e27=.1*_this328.editor.shortestOutputSide;_context33.next=4;return _this328.frameStore.setFrameEffect({identifier:t,width:_e27,opacity:1,color:Wn.color});case 4:_this328.editor.render();_this328.addSnapshot("add","frame");case 6:case"end":return _context33.stop();}}},_callee32);}));return function(_x33){return _ref151.apply(this,arguments);};}();this.changeOpacity=function(t){var e=_this328.frameStore.setEffectProperties({opacity:t});if(e){_this328.frameStore.changeOpacity(e.opacity);_this328.throttledRender();}};this.changeWidth=function(t){var e=_this328.frameStore.setEffectProperties({width:t});if(e){_this328.frameStore.changeWidth(e.width);_this328.throttledRender();}};this.changeColor=function(t){var e=_this328.frameStore.setEffectProperties({tintColor:t});if(e){_this328.frameStore.changeColor(e.tintColor);_this328.throttledRender();}};this.colorSnapshot=function(){_this328.addSnapshot("edit",_this328.locale.controls.selectColor);};this.toolSnapshot=function(t){_this328.addSnapshot("edit",t);};this.addSnapshot=function(t,e){_this328.editor.addSnapshot(void 0,t,e);};this.pureReset=function(){_this328.frameStore.removeFrameEffect();_this328.frameStore.reset();};this.reset=function(){_this328.pureReset();_this328.addSnapshot("delete",_this328.locale.controls.buttonReset);_this328.editor.render();};this.updateStateFromHistory=function(t){if(t.identifier==="identity"){_this328.pureReset();return new Promise(function(e){e();});}return _this328.frameStore.setFrameEffect(t);};this.updateStateFromSerialization=/*#__PURE__*/function(){var _ref152=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee33(t){var e;return regeneratorRuntime.wrap(function _callee33$(_context34){while(1){switch(_context34.prev=_context34.next){case 0:e=_this328.entityManager.items.find(function(r){return r.identifier===t.identifier;});if(!e){_context34.next=3;break;}return _context34.abrupt("return",_this328.frameStore.setFrameEffect(t).then(function(){_this328.editor.transformToolStore.setFrameOpacity(t.opacity);}));case 3:return _context34.abrupt("return",new Promise(function(r,o){o(new Error("Frame Asset doesn't exist"));}));case 4:case"end":return _context34.stop();}}},_callee33);}));return function(_x34){return _ref152.apply(this,arguments);};}();this.editor=t;this.frameStore=new Qs(this.editor.engineMediator);var e=this.editor.assetProvider.getAssets("frame");var r=this.config;this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},r),{},{flattenCategories:true,locale:this.locale.items,getAssetPath:this.editor.getAssetPath("frame")}));Wn.color=ct(Io(this.config,"defaultColor",Wn.color));if(this.config.colors&&this.config.colors.length>0){this.colorList=Vo(ct(this.config.colors));}}_createClass(Be,[{key:"state",get:function get(){return this.frameStore.state;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"color",get:function get(){return this.state.color;}},{key:"size",get:function get(){return this.state.width;}},{key:"tintable",get:function get(){var _this329=this;var t=this.entityManager.items.find(function(e){return e.identifier===_this329.identifier;});return t&&t.tintable||false;}},{key:"opacity",get:function get(){return this.state.opacity;}},{key:"minSize",get:function get(){return this.editor.shortestOutputSide*.05;}},{key:"maxSize",get:function get(){return this.editor.shortestOutputSide*.3;}},{key:"config",get:function get(){return this.editor.configStore.config["frame"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["frame"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}}]);return Be;}();f([C],Be.prototype,"selectFrame",2);f([C],Be.prototype,"changeOpacity",2);f([C],Be.prototype,"changeWidth",2);f([C],Be.prototype,"changeColor",2);f([C],Be.prototype,"pureReset",2);f([C],Be.prototype,"reset",2);f([C],Be.prototype,"updateStateFromHistory",2);f([C],Be.prototype,"updateStateFromSerialization",2);f([S],Be.prototype,"state",1);f([S],Be.prototype,"identifier",1);f([S],Be.prototype,"color",1);f([S],Be.prototype,"size",1);f([S],Be.prototype,"tintable",1);f([S],Be.prototype,"opacity",1);f([S],Be.prototype,"minSize",1);f([S],Be.prototype,"maxSize",1);f([S],Be.prototype,"config",1);f([S],Be.prototype,"locale",1);f([S],Be.prototype,"localeColor",1);f([S],Be.prototype,"items",1);f([S],Be.prototype,"isOptionSelected",1);});var Tk=d(function(){av();IH();});var qh;var kk=d(function(){pr();qh={size:0,color:mr.white,hardness:0,maximumSize:.125,minimumSize:0,maximumHardness:1,minimumHardness:0};});var Ie;var Ik=d(function(){Tt();R();U();ym();Zi();pr();kk();Ie=/*#__PURE__*/function(){function Ie(t){var _this330=this;_classCallCheck(this,Ie);this.strokes={strokes:[]};this.colorList=Hn();this.dirty=Q.box(false);this.id="";this.containerId=function(){return _this330.id;};this.initSize=function(){var _this330$state=_this330.state,t=_this330$state.minimumSize,e=_this330$state.maximumSize;var r=_this330.size;if(r===0){_this330.changeSize(rS(_this330.config,"defaultSize",[t,e]));}};this.changeColor=function(t){_this330.state.color=t;};this.changeSize=function(t){_this330.state.size=t;};this.changeRelativeSize=function(t){var _this330$state2=_this330.state,e=_this330$state2.maximumSize,r=_this330$state2.minimumSize;_this330.state.size=(e-r)*t/100+r;};this.changeHardness=function(t){_this330.state.hardness=t;};this.reset=function(){_this330.pureReset();_this330.addSnapshot("delete",_this330.locale.controls.buttonReset);_this330.editor.render();};this.editor=t;this.state=_objectSpread(_objectSpread({},qh),{},{hardness:rS(this.config,"defaultHardness",[qh.minimumHardness,qh.maximumHardness]),color:ct(Io(this.config,"defaultColor",qh.color))});if(this.config.colors&&this.config.colors.length>0){this.colorList=Vo(ct(this.config.colors));}}_createClass(Ie,[{key:"addSnapshot",value:function addSnapshot(t,e){this.editor.addSnapshot(void 0,t,e);}},{key:"clickableCanvas",value:function clickableCanvas(t){this.editor.clickableCanvas(t);}},{key:"beginStroke",value:function beginStroke(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];if(!this.drawingContainer){var e=this.editor.orderHelper.addSprite("brush");this.drawingContainer=this.editor.engine.addDrawing({strokes:t},this.editor.imageContainer,e);}this.id=this.drawingContainer.getID();this.drawingContainer.beginStroke({id:"imgly_brush_radial",color:ct(this.state.color),size:this.state.size,hardness:this.state.hardness});}},{key:"strokePosition",value:function strokePosition(t){if(this.drawingContainer){var e=this.editor.previewToWorld(t,false);this.drawingContainer.addPointToCurrentStroke(e);this.editor.render();}}},{key:"endStroke",value:function endStroke(){if(this.drawingContainer){this.drawingContainer.endStroke();this.editor.render();this.strokes=this.drawingContainer.getData();this.addSnapshot("edit",this.locale.history.brushStroke);this.dirty.set(true);}}},{key:"updateStateFromHistory",value:function updateStateFromHistory(t){if((0,Ye["default"])(t,this.strokes)){return;}if((0,Ye["default"])(t,{strokes:[]})||!t){this.pureReset();return;}if(this.drawingContainer){if(this.strokes&&this.strokes.strokes.length===t.strokes.length){this.dirty.set(false);return;}this.strokes=t;this.drawingContainer.setData(this.strokes);}else{var e=this.editor.orderHelper.addSprite("brush");this.drawingContainer=this.editor.engine.addDrawing({strokes:t.strokes},this.editor.imageContainer,e);this.strokes=this.drawingContainer.getData();}this.dirty.set(this.strokes.strokes.length!==0);this.id=this.drawingContainer.getID();}},{key:"pureReset",value:function pureReset(){this.dirty.set(false);this.strokes={strokes:[]};if(this.drawingContainer){this.editor.engine.removeContainer(this.drawingContainer);this.drawingContainer=void 0;}}},{key:"config",get:function get(){return this.editor.configStore.config["brush"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["brush"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"color",get:function get(){return this.state.color;}},{key:"size",get:function get(){return this.state.size;}},{key:"relativeSize",get:function get(){var _this$state5=this.state,t=_this$state5.size,e=_this$state5.maximumSize,r=_this$state5.minimumSize;return(t-r)*100/(e-r);}},{key:"sizeOnScreenSpace",get:function get(){var t=this.editor.engineMediator.engine.getSmallerOutputSide();return this.editor.worldToPreview(this.state.size*t);}},{key:"hardness",get:function get(){return this.state.hardness;}},{key:"isDirty",get:function get(){return this.dirty.get();}}]);return Ie;}();f([Q],Ie.prototype,"state",2);f([Q],Ie.prototype,"dirty",2);f([C],Ie.prototype,"initSize",2);f([C],Ie.prototype,"changeColor",2);f([C],Ie.prototype,"changeSize",2);f([C],Ie.prototype,"changeRelativeSize",2);f([C],Ie.prototype,"changeHardness",2);f([C],Ie.prototype,"clickableCanvas",1);f([C],Ie.prototype,"beginStroke",1);f([C],Ie.prototype,"strokePosition",1);f([C],Ie.prototype,"endStroke",1);f([C],Ie.prototype,"updateStateFromHistory",1);f([C],Ie.prototype,"reset",2);f([S],Ie.prototype,"config",1);f([S],Ie.prototype,"locale",1);f([S],Ie.prototype,"localeColor",1);f([S],Ie.prototype,"color",1);f([S],Ie.prototype,"size",1);f([S],Ie.prototype,"relativeSize",1);f([S],Ie.prototype,"sizeOnScreenSpace",1);f([S],Ie.prototype,"hardness",1);f([S],Ie.prototype,"isDirty",1);});var DH=d(function(){kk();Ik();});var jo;var Dk=d(function(){jo={position:{x:0,y:0},size:{height:0,width:0},lockResolution:false,forceDimensions:false,ratio:"*"};});function Ek(i){var t=i&&_typeof(i)==="object";return t&&!Llt(i)&&!Ult(i)&&!zlt(i);}function Nlt(i){return Array.isArray(i)?[]:{};}function Fk(i,t){var e=t&&t.clone===true;return e&&Ek(i)?Ok(Nlt(i),i,t):i;}function Hlt(i,t,e){var r={};if(Ek(i)){Object.keys(i).forEach(function(o){r[o]=Fk(i[o],e);});}Object.keys(t).forEach(function(o){var n=Ek(t[o])&&i[o];r[o]=n?Ok(i[o],t[o],e):Fk(t[o],e);});return r;}function Ok(i,t,e){var r=Array.isArray(t);if(r){return Array.isArray(i)?t:Fk(t,e);}return Hlt(i,t,e);}function Fi(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(!Array.isArray(i)||i.length<2){throw new Error("first argument should be an array with at least two elements");}return i.reduce(function(e,r){return Ok(e,r,t);});}var Mlt,Llt,zlt,Ult;var vl=d(function(){Mlt=typeof Symbol==="function"&&Symbol["for"];Llt=function Llt(i){return Object.prototype.toString.call(i)==="[object RegExp]"||Object.prototype.toString.call(i)==="[object Date]"||Object.prototype.toString.call(i).includes("HTML")||Object.prototype.toString.call(i)==="[object Array]";};zlt=function zlt(i){if(Mlt&&Object.hasOwnProperty.call(i,"$$typeof")){return i.$$typeof===Symbol["for"]("react.element")||i.$$typeof===Symbol["for"]("react.forward_ref");}return false;};Ult=function Ult(i){return Object.hasOwnProperty.call(i,"__ngContext__");};});var Rk;var Ak=d(function(){R();Rk=/*#__PURE__*/function(_Tr3){_inherits(Rk,_Tr3);var _super236=_createSuper(Rk);function Rk(){var _this331;_classCallCheck(this,Rk);_this331=_super236.apply(this,arguments);_this331.prevDimensions={width:0,height:0};return _this331;}_createClass(Rk,[{key:"onExport",value:function onExport(t){this.emit("export",t);}},{key:"onClose",value:function onClose(){this.emit("close");}},{key:"onUndo",value:function onUndo(){this.emit("historyUndo");}},{key:"onRedo",value:function onRedo(){this.emit("historyRedo");}},{key:"onHistoryChange",value:function onHistoryChange(){this.emit("historyChange");}},{key:"onEditorReady",value:function onEditorReady(){this.emit("editorReady");}},{key:"onErrorImageLoading",value:function onErrorImageLoading(t){this.emit("errorImageLoading",t);}},{key:"onImageLoaded",value:function onImageLoaded(){this.emit("imageLoad");}},{key:"onStickerUploadedAdd",value:function onStickerUploadedAdd(t){this.emit("stickerUploadAdd",t);}},{key:"onToolChanged",value:function onToolChanged(t){this.emit("toolEnter",t);}},{key:"onErrorWebGLContextLost",value:function onErrorWebGLContextLost(){this.emit("errorWebGLContextLost");}},{key:"onCropDimensionsChanged",value:function onCropDimensionsChanged(t){if(this.prevDimensions.width!==t.width||this.prevDimensions.height!==t.height){this.emit("cropDimensionsChange",t);this.prevDimensions=t;}}}]);return Rk;}(Tr);});var Bk;var EH=d(function(){vl();tv();Bk=Fi([_l,{layout:"basic",defaultTool:null}]);});var FH=d(function(){tv();EH();});var Pk;var OH=d(function(){var _categories2,_items,_items2;R();Pk=_defineProperty({common:{error:"Fehler",warning:"Warnung",color:{colorPicker:{hex:"Hex",r:"R",g:"G",b:"B",sliderHue:"Farbe",sliderOpacity:"Farbe Transparenz"}}},mainCanvasActions:{buttonExport:"Bild Exportieren",buttonUndo:"R\xFCckg\xE4ngig machen",buttonRedo:"Wiederholen",buttonClose:"Schlie\xDFen"},infoModals:{exporting:{heading:"Exportieren...",body:"Einen Moment bitte..."},saving:{heading:"Speichere...",body:"Einen Moment bitte..."},loading:{heading:"Lade...",body:"Einen Moment bitte..."},resizing:{heading:"Bild wird bearbeitet...",body:"Einen Moment bitte..."},loadingFonts:{heading:"Lade Schriftarten...",body:"Einen Moment bitte..."},stickerLoading:{heading:"Lade Sticker...",body:"Einen Moment bitte..."}},errorModals:{imageLoading:{headingDelimiter:":",body:"Laden des Bildes fehlgeschlagen. Dies kann verschiedene Gr\xFCnde haben, beispielsweise kann die Datei defekt sein oder der Dateityp wird nicht unterst\xFCtzt",buttonYes:"Neu Laden",buttonNo:"Schlie\xDFen"},rendering:{headingDelimiter:":",body:"Beim Rendern des Bildes ist ein Fehler aufgetreten",buttonYes:"Neu Laden",buttonNo:"Schlie\xDFen"},fontLoading:{headingDelimiter:":",heading:"Laden von Schriftarten ist fehlgeschlagen",body:"Die folgenden Schriftarten konnten nicht geladen werden: ${error}",buttonNo:"Schlie\xDFen"},webcamUnavailable:{headingDelimiter:":",body:"Webcam-Bild kann nicht dargestellt werden. (Fehler: ${error})",buttonYes:"Schlie\xDFen"},stickerLoading:{headingDelimiter:":",body:"Laden des Stickers fehlgeschlagen.",buttonNo:"Schlie\xDFen"},unexpectedError:{headingDelimiter:":",body:"Ein unerwarteter Fehler ist aufgetreten, ${error}",buttonYes:"Neu Laden",buttonNo:"Schlie\xDFen"}},warningModals:{imageResized:{headingDelimiter:":",heading:"Bild verkleinert",body:"Ihr Bild \xFCbersteigt die maximale Gr\xF6sse von ${megapixels} megapixels und wurde auf ${width}x${height} Pixel verkleinert",buttonYes:"Weiter"},discardChanges:{headingDelimiter:":",body:"Sind Sie sicher, dass Sie die \xC4nderungen verwerfen wollen?",buttonYes:"\xC4nderungen verwerfen",buttonNo:"\xC4nderungen beibehalten"},unsavedChanges:{headingDelimiter:":",body:"Sind Sie sicher, dass Sie die \xC4nderungen verwerfen wollen?",buttonYes:"Beenden ohne zu speichern",buttonNo:"Schlie\xDFen"},unsupportedSerializationVersion:{headingDelimiter:":",body:"Ihre Daten wurden von einem veralteten Format geladen und k\xF6nnten anders aussehen",buttonYes:"\xC4nderungen anwenden",buttonNo:"Abbrechen"},unsupportedWebGLRenderer:{body:"Es wurde ein Problem im Browser festgestellt, welches zu langen Ladezeiten f\xFChren kann. Bitte probieren sie einen anderen Browser.",buttonYes:"Weiter"}},library:{title:"Bibliothek",controls:{buttonUpload:"Bild Hochladen",buttonWebcamOpen:"Webcam \xD6ffnen",buttonWebcamClose:"Webcam Schlie\xDFen",placeholderSearch:"Bibliothek durchsuchen",noResults:"Keine Ergebnisse",itemAriaLabel:"Bild mit ${label} ersetzen"}},filter:{title:"Filter",controls:{buttonReset:"Zur\xFCcksetzen",sliderIntensity:"Filter Intensit\xE4t",itemAriaLabel:"${label} Filter hinzuf\xFCgen"},categories:(_categories2={},_defineProperty(_categories2,"imgly_filter_category_duotone","DuoTone"),_defineProperty(_categories2,"imgly_filter_category_bw","B & W"),_defineProperty(_categories2,"imgly_filter_category_vintage","Vintage"),_defineProperty(_categories2,"imgly_filter_category_smooth","Smooth"),_defineProperty(_categories2,"imgly_filter_category_cold","Cold"),_defineProperty(_categories2,"imgly_filter_category_warm","Warm"),_defineProperty(_categories2,"imgly_filter_category_legacy","Legacy"),_categories2),items:(_items={},_defineProperty(_items,"imgly_lut_celsius","Inferno"),_defineProperty(_items,"imgly_lut_chest","Chestnut"),_defineProperty(_items,"imgly_lut_fixie","Fixie"),_defineProperty(_items,"imgly_lut_fridge","Fridge"),_defineProperty(_items,"imgly_lut_front","Sunny 70s"),_defineProperty(_items,"imgly_lut_k2","Flat Black"),_defineProperty(_items,"imgly_lut_mellow","Mellow"),_defineProperty(_items,"imgly_lut_sin","Hard Stuff"),_defineProperty(_items,"imgly_lut_texas","Oldtimer"),_defineProperty(_items,"imgly_lut_ad1920","1920 A.D."),_defineProperty(_items,"imgly_lut_ancient","Ancient"),_defineProperty(_items,"imgly_lut_bleached","Kalmen"),_defineProperty(_items,"imgly_lut_bleachedblue","Joran"),_defineProperty(_items,"imgly_lut_blues","Polaroid"),_defineProperty(_items,"imgly_lut_blueshadows","Zephyr"),_defineProperty(_items,"imgly_lut_breeze","Levante"),_defineProperty(_items,"imgly_lut_bw","Greyed"),_defineProperty(_items,"imgly_lut_classic","Classic"),_defineProperty(_items,"imgly_lut_colorful","Colorful"),_defineProperty(_items,"imgly_lut_cool","Snappy"),_defineProperty(_items,"imgly_lut_cottoncandy","Candy"),_defineProperty(_items,"imgly_lut_creamy","Creamy"),_defineProperty(_items,"imgly_lut_eighties","Low Fire"),_defineProperty(_items,"imgly_lut_elder","Colla"),_defineProperty(_items,"imgly_lut_evening","Sunrise"),_defineProperty(_items,"imgly_lut_fall","Moss"),_defineProperty(_items,"imgly_lut_food","Food"),_defineProperty(_items,"imgly_lut_glam","Glam"),_defineProperty(_items,"imgly_lut_gobblin","Gobblin"),_defineProperty(_items,"imgly_lut_highcarb","High Carb"),_defineProperty(_items,"imgly_lut_highcontrast","Hicon"),_defineProperty(_items,"imgly_lut_k1","K1"),_defineProperty(_items,"imgly_lut_k6","K6"),_defineProperty(_items,"imgly_lut_kdynamic","Pebble"),_defineProperty(_items,"imgly_lut_keen","Keen"),_defineProperty(_items,"imgly_lut_lenin","Lemon"),_defineProperty(_items,"imgly_lut_litho","Litho"),_defineProperty(_items,"imgly_lut_lomo","Lomo"),_defineProperty(_items,"imgly_lut_lomo100","Lomo 100"),_defineProperty(_items,"imgly_lut_lucid","Lucid"),_defineProperty(_items,"imgly_lut_neat","Neat"),_defineProperty(_items,"imgly_lut_nogreen","Pumpkin"),_defineProperty(_items,"imgly_lut_orchid","Solanus"),_defineProperty(_items,"imgly_lut_pale","Pale"),_defineProperty(_items,"imgly_lut_pitched","Pitched"),_defineProperty(_items,"imgly_lut_plate","Weathered"),_defineProperty(_items,"imgly_lut_pola669","Green Gap"),_defineProperty(_items,"imgly_lut_polasx","Pola SX"),_defineProperty(_items,"imgly_lut_pro400","Pro 400"),_defineProperty(_items,"imgly_lut_quozi","Quozi"),_defineProperty(_items,"imgly_lut_sepiahigh","Sepia"),_defineProperty(_items,"imgly_lut_settled","Settled"),_defineProperty(_items,"imgly_lut_seventies","Seventies"),_defineProperty(_items,"imgly_lut_soft","Soft"),_defineProperty(_items,"imgly_lut_steel","Steel"),_defineProperty(_items,"imgly_lut_summer","Summer"),_defineProperty(_items,"imgly_lut_sunset","Golden"),_defineProperty(_items,"imgly_lut_tender","Tender"),_defineProperty(_items,"imgly_lut_twilight","Twilight"),_defineProperty(_items,"imgly_lut_winter","Softy"),_defineProperty(_items,"imgly_lut_x400","Dusty"),_defineProperty(_items,"imgly_duotone_desert","Desert"),_defineProperty(_items,"imgly_duotone_peach","Peach"),_defineProperty(_items,"imgly_duotone_clash","Clash"),_defineProperty(_items,"imgly_duotone_plum","Plum"),_defineProperty(_items,"imgly_duotone_breezy","Breezy"),_defineProperty(_items,"imgly_duotone_deepblue","Deep Blue"),_defineProperty(_items,"imgly_duotone_frog","Frog"),_defineProperty(_items,"imgly_duotone_sunset","Sunset"),_items)},adjustment:{title:"Korrekturen",controls:{buttonReset:"Zur\xFCcksetzen"},categories:{basics:"Grundlagen",refinements:"Feinheiten"},items:{brightness:"Helligkeit",saturation:"S\xE4ttigung",contrast:"Kontrast",gamma:"Gamma",sharpness:"Sch\xE4rfe",clarity:"Klarheit",exposure:"Belichtung",shadows:"Schatten",highlights:"Lichter",whites:"Wei\xDF",blacks:"Schwarz",temperature:"Temperatur"}},focus:{title:"Weichzeichnen",controls:{buttonReset:"Zur\xFCcksetzen",sliderIntensity:"Focus Intensit\xE4t",itemAriaLabel:"${label} Fokus hinzuf\xFCgen"},items:{radial:"Kreisf\xF6rmig",mirrored:"Gespiegelt",linear:"Linear",gaussian:"Gau\xDFsch"},history:{focusPosition:"Focus Position",focusSize:"Focus Gr\xF6\xDFe"}},overlay:{title:"Overlays",controls:{buttonReset:"Zur\xFCcksetzen",sliderOpacity:"Overlay Transparenz",carouselBlendMode:"Overlay Mischmodus",blendModeNormal:"Normal",blendModeOverlay:"\xDCberblenden",blendModeHardLight:"Hartes Licht",blendModeSoftLight:"Weiches Licht",blendModeMultiply:"Multiplizieren",blendModeDarken:"Abdunkeln",blendModeLighten:"Aufhellen",blendModeScreen:"Screen",blendModeColorBurn:"Color Burn",tabOpacity:"Transparenz",tabBlendMode:"Mischmodus",itemAriaLabel:"Overlay ${label} hinzuf\xFCgen"},items:(_items2={},_defineProperty(_items2,"imgly_overlay_bokeh","Bokeh"),_defineProperty(_items2,"imgly_overlay_chop","Chop"),_defineProperty(_items2,"imgly_overlay_clouds","Clouds"),_defineProperty(_items2,"imgly_overlay_golden","Golden"),_defineProperty(_items2,"imgly_overlay_grain","Grain"),_defineProperty(_items2,"imgly_overlay_hearts","Hearts"),_defineProperty(_items2,"imgly_overlay_lightleak1","Light Leak 1"),_defineProperty(_items2,"imgly_overlay_lightleak2","Light Leak 2"),_defineProperty(_items2,"imgly_overlay_metal","Metal"),_defineProperty(_items2,"imgly_overlay_mosaic","Mosaic"),_defineProperty(_items2,"imgly_overlay_painting","Painting"),_defineProperty(_items2,"imgly_overlay_paper","Paper"),_defineProperty(_items2,"imgly_overlay_rain","Rain"),_defineProperty(_items2,"imgly_overlay_vintage","Vintage"),_defineProperty(_items2,"imgly_overlay_wall1","Wall"),_defineProperty(_items2,"imgly_overlay_wall2","Wall 2"),_defineProperty(_items2,"imgly_overlay_wood","Wood"),_items2)},sticker:{title:"Sticker",controls:{buttonUpload:"Sticker Hochladen",sliderOpacity:"Sticker Transparenz",selectColor:"Stickerfarbe",tabColor:"Farbe",tabOpacity:"Transparenz",itemAriaLabel:"Sticker ${label} hinzuf\xFCgen"},categories:{imgly_sticker_emoticons:"Emoticons",imgly_sticker_shapes:"Shapes",imgly_sticker_custom:"Custom"},items:{imgly_sticker_emoticons_alien:"Alien",imgly_sticker_emoticons_angel:"Angel",imgly_sticker_emoticons_angry:"Angry",imgly_sticker_emoticons_anxious:"Anxious",imgly_sticker_emoticons_asleep:"Asleep",imgly_sticker_emoticons_attention:"Attention",imgly_sticker_emoticons_baby_chicken:"Baby Chicken",imgly_sticker_emoticons_batman:"Batman",imgly_sticker_emoticons_beer:"Beer",imgly_sticker_emoticons_black:"Black",imgly_sticker_emoticons_blue:"Blue",imgly_sticker_emoticons_blush:"Blush",imgly_sticker_emoticons_boxer:"Boxer",imgly_sticker_emoticons_business:"Business",imgly_sticker_emoticons_chicken:"Chicken",imgly_sticker_emoticons_cool:"Cool",imgly_sticker_emoticons_cry:"Cry",imgly_sticker_emoticons_deceased:"Deceased",imgly_sticker_emoticons_devil:"Devil",imgly_sticker_emoticons_duckface:"Duckface",imgly_sticker_emoticons_furious:"Furious",imgly_sticker_emoticons_grin:"Grin",imgly_sticker_emoticons_guitar:"Guitar",imgly_sticker_emoticons_harry_potter:"Harry Potter",imgly_sticker_emoticons_hippie:"Hippie",imgly_sticker_emoticons_hitman:"Hitman",imgly_sticker_emoticons_humourous:"Humourous",imgly_sticker_emoticons_idea:"Idea",imgly_sticker_emoticons_impatient:"Impatient",imgly_sticker_emoticons_kiss:"Kiss",imgly_sticker_emoticons_kisses:"Kisses",imgly_sticker_emoticons_laugh:"Laugh",imgly_sticker_emoticons_loud_cry:"Loud Cry",imgly_sticker_emoticons_loving:"Loving",imgly_sticker_emoticons_masked:"Masked",imgly_sticker_emoticons_music:"Music",imgly_sticker_emoticons_nerd:"Nerd",imgly_sticker_emoticons_ninja:"Ninja",imgly_sticker_emoticons_not_speaking_to_you:"Not speaking to you",imgly_sticker_emoticons_pig:"Pig",imgly_sticker_emoticons_pumpkin:"Pumpkin",imgly_sticker_emoticons_question:"Question",imgly_sticker_emoticons_rabbit:"Rabbit",imgly_sticker_emoticons_sad:"Sad",imgly_sticker_emoticons_sick:"Sick",imgly_sticker_emoticons_skateboard:"Skateboard",imgly_sticker_emoticons_skull:"Skull",imgly_sticker_emoticons_sleepy:"Sleepy",imgly_sticker_emoticons_smile:"Smile",imgly_sticker_emoticons_smoking:"Smoking",imgly_sticker_emoticons_sobbing:"Sobbing",imgly_sticker_emoticons_star:"Star",imgly_sticker_emoticons_steaming_furious:"Steaming Furious",imgly_sticker_emoticons_sunbathing:"Sunbathing",imgly_sticker_emoticons_tired:"Tired",imgly_sticker_emoticons_tongue_out_wink:"Tongue out wink",imgly_sticker_emoticons_wave:"Wave",imgly_sticker_emoticons_wide_grin:"Wide Grin",imgly_sticker_emoticons_wink:"Wink",imgly_sticker_emoticons_wrestler:"Wrestler",imgly_sticker_shapes_arrow_02:"Arrow 1",imgly_sticker_shapes_arrow_03:"Arrow 2",imgly_sticker_shapes_badge_01:"Badge 1",imgly_sticker_shapes_badge_11:"Badge 5",imgly_sticker_shapes_badge_12:"Badge 6",imgly_sticker_shapes_badge_13:"Badge 7",imgly_sticker_shapes_badge_15:"Badge 8",imgly_sticker_shapes_badge_18:"Badge 9",imgly_sticker_shapes_badge_19:"Badge 10",imgly_sticker_shapes_badge_20:"Badge 11",imgly_sticker_shapes_badge_28:"Badge 12",imgly_sticker_shapes_badge_32:"Badge 13",imgly_sticker_shapes_badge_35:"Badge 14",imgly_sticker_shapes_badge_36:"Badge 15",imgly_sticker_shapes_badge_04:"Badge 2",imgly_sticker_shapes_badge_06:"Badge 3",imgly_sticker_shapes_badge_08:"Badge 4",imgly_sticker_shapes_spray_01:"Spray 1",imgly_sticker_shapes_spray_03:"Spray 2",imgly_sticker_shapes_spray_04:"Spray 3"},canvasActions:{buttonDelete:"L\xF6schen",buttonBringToFront:"In den Vordergrund",buttonDuplicate:"Duplizieren",buttonFlipHorizontal:"Horizontal spiegeln",buttonFlipVertical:"Vertikal spiegeln"},history:{add:"Sticker",resize:"Sticker resize",position:"Sticker position",color:"Sticker color","delete":"Sticker delete",order:"Sticker order",opacity:"Sticker opacity",flip:"Sticker flip"}},text:{title:"Text",controls:{buttonNew:"Neuer Text",dropdownFontFamily:"Schriftart",textFontSize:"Schriftgr\xF6\xDFe",selectAlignment:"Ausrichtung",selectFontColor:"Schriftfarbe",selectBackgroundColor:"Hintergrundfarbe",sliderLineSpacing:"Zeilenabstand",tabColor:"Farbe",tabBgColor:"Hintergrund",tabAlignment:"Ausrichtung",tabLineHeight:"Zeilenh\xF6he",tabFontSize:"Schriftgr\xF6\xDFe"},canvasControls:{placeholderText:"Etwas aufschreiben",buttonSave:"Fertig",buttonClose:"Abbrechen",inputText:"Texteingabe"},canvasActions:{buttonEdit:"Bearbeiten",buttonDelete:"L\xF6schen",buttonBringToFront:"In den Vordergrund",buttonDuplicate:"Duplizieren"},history:{add:"Text",edit:"Text edit",resize:"Text resize",position:"Text position",alignment:"Text alignment",textColor:"Text color",backgroundColor:"Text background color",fontFamily:"Font family",fontStyle:"Font style",lineSpacing:"Line spacing",width:"Text width","delete":"Text delete",order:"Text order"}},textdesign:{title:"Text Design",controls:{buttonNew:"Neues Text Design",buttonShuffle:"Shuffle Layout",selectColor:"Textfarbe",tabColor:"Farbe",tabShuffle:"Shuffle",itemAriaLabel:"Text Design ${label} hinzuf\xFCgen"},canvasControls:{placeholderText:"Etwas aufschreiben mit Style",buttonSave:"Done",buttonClose:"Schlie\xDFen",inputText:"Texteingabe"},canvasActions:{buttonEdit:"Bearbeiten",buttonInvert:"Invertieren",buttonDelete:"L\xF6schen",buttonBringToFront:"In den Vordergrund",buttonDuplicate:"Duplizieren"},history:{add:"Text design",edit:"Text design edit",resize:"Text design resize",position:"Text design position",color:"Text design color",shuffle:"Text design shuffle",invert:"Text design invert",padding:"Text design padding",order:"Text design order","delete":"Text design delete"}},frame:{title:"Rahmen",controls:{buttonReset:"Zur\xFCcksetzen",sliderOpacity:"Rahmen Transparenz",sliderSize:"Rahmen Dicke",selectColor:"Rahmen Farbe",tabColor:"Farbe",tabOpacity:"Transparenz",tabSize:"Dicke",itemAriaLabel:"Rahmen ${label} hinzuf\xFCgen"},items:{imgly_frame_dia:"Dia",imgly_frame_art_decor:"Art Decor",imgly_frame_black_passepartout:"Black",imgly_frame_lowpoly_shadow:"Low Poly",imgly_frame_wood_passepartout:"Wood"}},brush:{title:"Malen",controls:{buttonReset:"Zur\xFCcksetzen",sliderSize:"Dicke",sliderHardness:"H\xE4rte",selectColor:"Farbe",tabSize:"Dicke",tabHardness:"H\xE4rte",tabColor:"Farbe"},history:{brushStroke:"Brush Stroke"}},transform:{title:"Zuschneiden",controls:{buttonReset:"Zur\xFCcksetzen",checkboxKeepResolution:"Fixiere Aufl\xF6sung",inputCropSize:"Bildgr\xF6\xDFe",inputHeight:"h",inputWidth:"b",tabFlipAndRotate:"Spiegeln & Drehen",tabResolution:"Aufl\xF6sung",tabCropSize:"Bildgr\xF6\xDFe",itemAriaLabel:"Zuschneiden ${label}",inputHeightAriaLabel:"H\xF6he",inputWidthAriaLabel:"Breite"},categories:{imgly_transforms_common:"Standard",imgly_transforms_facebook:"Facebook",imgly_transforms_twitter:"Twitter",imgly_transforms_instagram:"Instagram"},items:{imgly_transform_common_custom:"Frei",imgly_transform_common_square:"Quadratisch",imgly_transform_common_4:"4:3",imgly_transform_common_16:"16:9",imgly_transform_common_3:"3:4",imgly_transform_common_9:"9:16",imgly_transform_facebook_profile:"Profile",imgly_transform_facebook_title:"Titel",imgly_transform_facebook_post:"Post",imgly_transform_instagram_story:"Story",imgly_transform_instagram_landscape:"Landscape",imgly_transform_instagram_portrait:"Portrait",imgly_transform_instagram_square:"Square",imgly_transform_twitter_profile:"Profile",imgly_transform_twitter_title:"Title",imgly_transform_twitter_post:"Post"},transformActions:{buttonFlipHorizontal:"Horizontal spiegeln",buttonFlipVertical:"Vertikal spiegeln",buttonRotateClockwise:"Drehe im Uhrzeigersinn",buttonRotateAntiClockwise:"Drehe gegen Uhrzeigersinn"}}},"customTool",{title:"Benutzerdefiniert"});});var uu;var RH=d(function(){var _categories3,_items3,_items4;R();uu=_defineProperty({common:{error:"Error",warning:"Warning",color:{colorPicker:{hex:"Hex",r:"R",g:"G",b:"B",sliderHue:"Color",sliderOpacity:"Color Opacity"}}},mainCanvasActions:{buttonExport:"Export Image",buttonUndo:"Undo",buttonRedo:"Redo",buttonClose:"Close"},infoModals:{exporting:{heading:"Exporting...",body:"Just a few seconds..."},saving:{heading:"Saving...",body:"Just a few seconds..."},loading:{heading:"Loading...",body:"Just a few seconds..."},resizing:{heading:"Resizing...",body:"Just a few seconds..."},loadingFonts:{heading:"Loading Fonts...",body:"Just a few seconds..."},stickerLoading:{heading:"Loading Sticker...",body:"Just a few seconds..."}},errorModals:{imageLoading:{headingDelimiter:":",body:"Failed to load image. This can have multiple reasons, e.g. the file is corrupted or the file type is not supported",buttonYes:"Retry",buttonNo:"Close"},rendering:{headingDelimiter:":",body:"An error has occurred while rendering the image",buttonYes:"Retry",buttonNo:"Close"},fontLoading:{headingDelimiter:":",heading:"Failed to load font",body:"The following fonts could not be loaded: ${error}",buttonNo:"Close"},webcamUnavailable:{headingDelimiter:":",body:"Unable to display webcam image (Error: ${error})",buttonYes:"Close"},stickerLoading:{headingDelimiter:":",body:"Unable to load the sticker",buttonNo:"Close"},unexpectedError:{headingDelimiter:":",body:"An unexpected error has occured ${error}",buttonYes:"Retry",buttonNo:"Close"}},warningModals:{imageResized:{headingDelimiter:":",heading:"Image resized",body:"Your image exceeds the maximum size of ${megapixels} megapixels and has been resized to ${width}x${height} pixels",buttonYes:"Continue"},unsupportedSerializationVersion:{headingDelimiter:":",body:"Your data was restored from a legacy data format and might look different",buttonYes:"Apply changes",buttonNo:"Cancel"},discardChanges:{headingDelimiter:":",body:"You have unsaved changes. Are you sure you want to discard the changes?",buttonYes:"Discard changes",buttonNo:"Keep Changes"},unsavedChanges:{headingDelimiter:":",body:"You have unsaved changes. Are you sure you want to exit?",buttonYes:"Exit without saving",buttonNo:"Cancel"},unsupportedWebGLRenderer:{body:"A problem has been detected in the browser that could cause long loading times. Please try a different browser.",buttonYes:"Continue"}},library:{title:"Library",controls:{buttonUpload:"Upload Image",buttonWebcamOpen:"Open Webcam",buttonWebcamClose:"Close Webcam",placeholderSearch:"Search Library",noResults:"No Results",itemAriaLabel:"Replace image with ${label}"}},filter:{title:"Filters",controls:{buttonReset:"Remove Filter",sliderIntensity:"Filter Intensity",itemAriaLabel:"Add ${label} filter"},categories:(_categories3={},_defineProperty(_categories3,"imgly_filter_category_duotone","DuoTone"),_defineProperty(_categories3,"imgly_filter_category_bw","B & W"),_defineProperty(_categories3,"imgly_filter_category_vintage","Vintage"),_defineProperty(_categories3,"imgly_filter_category_smooth","Smooth"),_defineProperty(_categories3,"imgly_filter_category_cold","Cold"),_defineProperty(_categories3,"imgly_filter_category_warm","Warm"),_defineProperty(_categories3,"imgly_filter_category_legacy","Legacy"),_categories3),items:(_items3={},_defineProperty(_items3,"imgly_lut_celsius","Inferno"),_defineProperty(_items3,"imgly_lut_chest","Chestnut"),_defineProperty(_items3,"imgly_lut_fixie","Fixie"),_defineProperty(_items3,"imgly_lut_fridge","Fridge"),_defineProperty(_items3,"imgly_lut_front","Sunny 70s"),_defineProperty(_items3,"imgly_lut_k2","Flat Black"),_defineProperty(_items3,"imgly_lut_mellow","Mellow"),_defineProperty(_items3,"imgly_lut_sin","Hard Stuff"),_defineProperty(_items3,"imgly_lut_texas","Oldtimer"),_defineProperty(_items3,"imgly_lut_ad1920","1920 A.D."),_defineProperty(_items3,"imgly_lut_ancient","Ancient"),_defineProperty(_items3,"imgly_lut_bleached","Kalmen"),_defineProperty(_items3,"imgly_lut_bleachedblue","Joran"),_defineProperty(_items3,"imgly_lut_blues","Polaroid"),_defineProperty(_items3,"imgly_lut_blueshadows","Zephyr"),_defineProperty(_items3,"imgly_lut_breeze","Levante"),_defineProperty(_items3,"imgly_lut_bw","Greyed"),_defineProperty(_items3,"imgly_lut_classic","Classic"),_defineProperty(_items3,"imgly_lut_colorful","Colorful"),_defineProperty(_items3,"imgly_lut_cool","Snappy"),_defineProperty(_items3,"imgly_lut_cottoncandy","Candy"),_defineProperty(_items3,"imgly_lut_creamy","Creamy"),_defineProperty(_items3,"imgly_lut_eighties","Low Fire"),_defineProperty(_items3,"imgly_lut_elder","Colla"),_defineProperty(_items3,"imgly_lut_evening","Sunrise"),_defineProperty(_items3,"imgly_lut_fall","Moss"),_defineProperty(_items3,"imgly_lut_food","Food"),_defineProperty(_items3,"imgly_lut_glam","Glam"),_defineProperty(_items3,"imgly_lut_gobblin","Gobblin"),_defineProperty(_items3,"imgly_lut_highcarb","High Carb"),_defineProperty(_items3,"imgly_lut_highcontrast","Hicon"),_defineProperty(_items3,"imgly_lut_k1","K1"),_defineProperty(_items3,"imgly_lut_k6","K6"),_defineProperty(_items3,"imgly_lut_kdynamic","Pebble"),_defineProperty(_items3,"imgly_lut_keen","Keen"),_defineProperty(_items3,"imgly_lut_lenin","Lemon"),_defineProperty(_items3,"imgly_lut_litho","Litho"),_defineProperty(_items3,"imgly_lut_lomo","Lomo"),_defineProperty(_items3,"imgly_lut_lomo100","Lomo 100"),_defineProperty(_items3,"imgly_lut_lucid","Lucid"),_defineProperty(_items3,"imgly_lut_neat","Neat"),_defineProperty(_items3,"imgly_lut_nogreen","Pumpkin"),_defineProperty(_items3,"imgly_lut_orchid","Solanus"),_defineProperty(_items3,"imgly_lut_pale","Pale"),_defineProperty(_items3,"imgly_lut_pitched","Pitched"),_defineProperty(_items3,"imgly_lut_plate","Weathered"),_defineProperty(_items3,"imgly_lut_pola669","Green Gap"),_defineProperty(_items3,"imgly_lut_polasx","Pola SX"),_defineProperty(_items3,"imgly_lut_pro400","Pro 400"),_defineProperty(_items3,"imgly_lut_quozi","Quozi"),_defineProperty(_items3,"imgly_lut_sepiahigh","Sepia"),_defineProperty(_items3,"imgly_lut_settled","Settled"),_defineProperty(_items3,"imgly_lut_seventies","Seventies"),_defineProperty(_items3,"imgly_lut_soft","Soft"),_defineProperty(_items3,"imgly_lut_steel","Steel"),_defineProperty(_items3,"imgly_lut_summer","Summer"),_defineProperty(_items3,"imgly_lut_sunset","Golden"),_defineProperty(_items3,"imgly_lut_tender","Tender"),_defineProperty(_items3,"imgly_lut_twilight","Twilight"),_defineProperty(_items3,"imgly_lut_winter","Softy"),_defineProperty(_items3,"imgly_lut_x400","Dusty"),_defineProperty(_items3,"imgly_duotone_desert","Desert"),_defineProperty(_items3,"imgly_duotone_peach","Peach"),_defineProperty(_items3,"imgly_duotone_clash","Clash"),_defineProperty(_items3,"imgly_duotone_plum","Plum"),_defineProperty(_items3,"imgly_duotone_breezy","Breezy"),_defineProperty(_items3,"imgly_duotone_deepblue","Deep Blue"),_defineProperty(_items3,"imgly_duotone_frog","Frog"),_defineProperty(_items3,"imgly_duotone_sunset","Sunset"),_items3)},adjustment:{title:"Adjust",controls:{buttonReset:"Reset Adjustment"},categories:{basics:"Basic",refinements:"Refinements"},items:{brightness:"Brightness",saturation:"Saturation",contrast:"Contrast",gamma:"Gamma",sharpness:"Sharpness",clarity:"Clarity",exposure:"Exposure",shadows:"Shadows",highlights:"Highlights",whites:"Whites",blacks:"Blacks",temperature:"Temperature"}},focus:{title:"Focus",controls:{buttonReset:"Remove Focus",sliderIntensity:"Focus Intensity",itemAriaLabel:"Add ${label} focus"},items:{radial:"Radial",mirrored:"Mirrored",linear:"Linear",gaussian:"Gaussian"},history:{focusPosition:"Focus Position",focusSize:"Focus Size"}},overlay:{title:"Overlays",controls:{buttonReset:"Remove Overlay",sliderOpacity:"Overlay Opacity",carouselBlendMode:"Overlay Blend mode",blendModeNormal:"Normal",blendModeOverlay:"Overlay",blendModeHardLight:"Hard Light",blendModeSoftLight:"Soft Light",blendModeMultiply:"Multiply",blendModeDarken:"Darken",blendModeLighten:"Lighten",blendModeScreen:"Screen",blendModeColorBurn:"Color Burn",tabOpacity:"Opacity",tabBlendMode:"Blend Mode",itemAriaLabel:"Add ${name} overlay"},items:(_items4={},_defineProperty(_items4,"imgly_overlay_bokeh","Bokeh"),_defineProperty(_items4,"imgly_overlay_chop","Chop"),_defineProperty(_items4,"imgly_overlay_clouds","Clouds"),_defineProperty(_items4,"imgly_overlay_golden","Golden"),_defineProperty(_items4,"imgly_overlay_grain","Grain"),_defineProperty(_items4,"imgly_overlay_hearts","Hearts"),_defineProperty(_items4,"imgly_overlay_lightleak1","Light Leak 1"),_defineProperty(_items4,"imgly_overlay_lightleak2","Light Leak 2"),_defineProperty(_items4,"imgly_overlay_metal","Metal"),_defineProperty(_items4,"imgly_overlay_mosaic","Mosaic"),_defineProperty(_items4,"imgly_overlay_painting","Painting"),_defineProperty(_items4,"imgly_overlay_paper","Paper"),_defineProperty(_items4,"imgly_overlay_rain","Rain"),_defineProperty(_items4,"imgly_overlay_vintage","Vintage"),_defineProperty(_items4,"imgly_overlay_wall1","Wall"),_defineProperty(_items4,"imgly_overlay_wall2","Wall 2"),_defineProperty(_items4,"imgly_overlay_wood","Wood"),_items4)},sticker:{title:"Stickers",controls:{buttonUpload:"Upload Sticker",sliderOpacity:"Sticker Opacity",selectColor:"Sticker Color",tabColor:"Color",tabOpacity:"Opacity",itemAriaLabel:"Add ${label} sticker"},categories:{imgly_sticker_emoticons:"Emoticons",imgly_sticker_shapes:"Shapes",imgly_sticker_custom:"Custom"},items:{imgly_sticker_emoticons_alien:"Alien",imgly_sticker_emoticons_angel:"Angel",imgly_sticker_emoticons_angry:"Angry",imgly_sticker_emoticons_anxious:"Anxious",imgly_sticker_emoticons_asleep:"Asleep",imgly_sticker_emoticons_attention:"Attention",imgly_sticker_emoticons_baby_chicken:"Baby Chicken",imgly_sticker_emoticons_batman:"Batman",imgly_sticker_emoticons_beer:"Beer",imgly_sticker_emoticons_black:"Black",imgly_sticker_emoticons_blue:"Blue",imgly_sticker_emoticons_blush:"Blush",imgly_sticker_emoticons_boxer:"Boxer",imgly_sticker_emoticons_business:"Business",imgly_sticker_emoticons_chicken:"Chicken",imgly_sticker_emoticons_cool:"Cool",imgly_sticker_emoticons_cry:"Cry",imgly_sticker_emoticons_deceased:"Deceased",imgly_sticker_emoticons_devil:"Devil",imgly_sticker_emoticons_duckface:"Duckface",imgly_sticker_emoticons_furious:"Furious",imgly_sticker_emoticons_grin:"Grin",imgly_sticker_emoticons_guitar:"Guitar",imgly_sticker_emoticons_harry_potter:"Harry Potter",imgly_sticker_emoticons_hippie:"Hippie",imgly_sticker_emoticons_hitman:"Hitman",imgly_sticker_emoticons_humourous:"Humourous",imgly_sticker_emoticons_idea:"Idea",imgly_sticker_emoticons_impatient:"Impatient",imgly_sticker_emoticons_kiss:"Kiss",imgly_sticker_emoticons_kisses:"Kisses",imgly_sticker_emoticons_laugh:"Laugh",imgly_sticker_emoticons_loud_cry:"Loud Cry",imgly_sticker_emoticons_loving:"Loving",imgly_sticker_emoticons_masked:"Masked",imgly_sticker_emoticons_music:"Music",imgly_sticker_emoticons_nerd:"Nerd",imgly_sticker_emoticons_ninja:"Ninja",imgly_sticker_emoticons_not_speaking_to_you:"Not speaking to you",imgly_sticker_emoticons_pig:"Pig",imgly_sticker_emoticons_pumpkin:"Pumpkin",imgly_sticker_emoticons_question:"Question",imgly_sticker_emoticons_rabbit:"Rabbit",imgly_sticker_emoticons_sad:"Sad",imgly_sticker_emoticons_sick:"Sick",imgly_sticker_emoticons_skateboard:"Skateboard",imgly_sticker_emoticons_skull:"Skull",imgly_sticker_emoticons_sleepy:"Sleepy",imgly_sticker_emoticons_smile:"Smile",imgly_sticker_emoticons_smoking:"Smoking",imgly_sticker_emoticons_sobbing:"Sobbing",imgly_sticker_emoticons_star:"Star",imgly_sticker_emoticons_steaming_furious:"Steaming Furious",imgly_sticker_emoticons_sunbathing:"Sunbathing",imgly_sticker_emoticons_tired:"Tired",imgly_sticker_emoticons_tongue_out_wink:"Tongue out wink",imgly_sticker_emoticons_wave:"Wave",imgly_sticker_emoticons_wide_grin:"Wide Grin",imgly_sticker_emoticons_wink:"Wink",imgly_sticker_emoticons_wrestler:"Wrestler",imgly_sticker_shapes_arrow_02:"Arrow 1",imgly_sticker_shapes_arrow_03:"Arrow 2",imgly_sticker_shapes_badge_01:"Badge 1",imgly_sticker_shapes_badge_11:"Badge 5",imgly_sticker_shapes_badge_12:"Badge 6",imgly_sticker_shapes_badge_13:"Badge 7",imgly_sticker_shapes_badge_15:"Badge 8",imgly_sticker_shapes_badge_18:"Badge 9",imgly_sticker_shapes_badge_19:"Badge 10",imgly_sticker_shapes_badge_20:"Badge 11",imgly_sticker_shapes_badge_28:"Badge 12",imgly_sticker_shapes_badge_32:"Badge 13",imgly_sticker_shapes_badge_35:"Badge 14",imgly_sticker_shapes_badge_36:"Badge 15",imgly_sticker_shapes_badge_04:"Badge 2",imgly_sticker_shapes_badge_06:"Badge 3",imgly_sticker_shapes_badge_08:"Badge 4",imgly_sticker_shapes_spray_01:"Spray 1",imgly_sticker_shapes_spray_03:"Spray 2",imgly_sticker_shapes_spray_04:"Spray 3"},canvasActions:{buttonDelete:"Delete",buttonBringToFront:"Move to front",buttonDuplicate:"Duplicate",buttonFlipHorizontal:"Flip",buttonFlipVertical:"Flip"},history:{add:"Sticker",resize:"Sticker resize",position:"Sticker position",color:"Sticker color","delete":"Sticker delete",order:"Sticker order",opacity:"Sticker opacity",flip:"Sticker flip"}},text:{title:"Text",controls:{buttonNew:"New Text",dropdownFontFamily:"Font Family",textFontSize:"Font Size",selectAlignment:"Alignment",selectFontColor:"Font Color",selectBackgroundColor:"Background Color",sliderLineSpacing:"Line Spacing",tabColor:"Color",tabBgColor:"Bg Color",tabAlignment:"Alignment",tabLineHeight:"Line Height",tabFontSize:"Font Size"},canvasControls:{placeholderText:"Write Something",buttonSave:"Done",buttonClose:"Cancel",inputText:"Text Input"},canvasActions:{buttonEdit:"Edit",buttonDelete:"Delete",buttonBringToFront:"Move to front",buttonDuplicate:"Duplicate"},history:{add:"Text",edit:"Text edit",resize:"Text resize",position:"Text position",alignment:"Text alignment",textColor:"Text color",backgroundColor:"Text background color",fontFamily:"Font family",fontStyle:"Font style",lineSpacing:"Line spacing",width:"Text width","delete":"Text delete",order:"Text order"}},textdesign:{title:"Text Design",controls:{buttonNew:"New Text Design",buttonShuffle:"Shuffle Layout",selectColor:"Text Color",tabColor:"Color",tabShuffle:"Shuffle",itemAriaLabel:"Add ${label} text design"},canvasControls:{placeholderText:"Write Something With Style",buttonSave:"Done",buttonClose:"Schlie\xDFen",inputText:"Text Input"},canvasActions:{buttonEdit:"Edit",buttonInvert:"Invert",buttonDelete:"Delete",buttonBringToFront:"Move to front",buttonDuplicate:"Duplicate"},history:{add:"Text design",edit:"Text design edit",resize:"Text design resize",position:"Text design position",color:"Text design color",shuffle:"Text design shuffle",invert:"Text design invert",padding:"Text design padding",order:"Text design order","delete":"Text design delete"}},frame:{title:"Frames",controls:{buttonReset:"Remove Frame",sliderOpacity:"Frame Opacity",sliderSize:"Frame Size",selectColor:"Frame Color",tabColor:"Color",tabOpacity:"Opacity",tabSize:"Size",itemAriaLabel:"Add ${label} frame"},items:{imgly_frame_dia:"Dia",imgly_frame_art_decor:"Art Decor",imgly_frame_black_passepartout:"Black",imgly_frame_lowpoly_shadow:"Low Poly",imgly_frame_wood_passepartout:"Wood"}},brush:{title:"Brush",controls:{buttonReset:"Remove Brush",sliderSize:"Brush Size",sliderHardness:"Brush Hardness",selectColor:"Brush Color",tabSize:"Size",tabHardness:"Hardness",tabColor:"Color"},history:{brushStroke:"Brush Stroke"}},transform:{title:"Transform",controls:{buttonReset:"Reset to default",checkboxKeepResolution:"Keep Resolution",inputCropSize:"Crop Size",inputHeight:"h",inputWidth:"w",tabFlipAndRotate:"Flip & Rotate",tabResolution:"Resolution",tabCropSize:"Crop Size",itemAriaLabel:"Apply ${label} crop",inputHeightAriaLabel:"crop height",inputWidthAriaLabel:"crop width"},categories:{imgly_transforms_common:"Common",imgly_transforms_facebook:"Facebook",imgly_transforms_twitter:"Twitter",imgly_transforms_instagram:"Instagram"},items:{imgly_transform_common_custom:"Custom",imgly_transform_common_square:"Square",imgly_transform_common_4:"4:3",imgly_transform_common_16:"16:9",imgly_transform_common_3:"3:4",imgly_transform_common_9:"9:16",imgly_transform_facebook_profile:"Profile",imgly_transform_facebook_title:"Title",imgly_transform_facebook_post:"Post",imgly_transform_instagram_story:"Story",imgly_transform_instagram_landscape:"Landscape",imgly_transform_instagram_portrait:"Portrait",imgly_transform_instagram_square:"Square",imgly_transform_twitter_profile:"Profile",imgly_transform_twitter_title:"Title",imgly_transform_twitter_post:"Post"},transformActions:{buttonFlipHorizontal:"Flip Horizontal",buttonFlipVertical:"Flip Vertical",buttonRotateClockwise:"Rotate Clockwise",buttonRotateAntiClockwise:"Rotate Counterclockwise"}}},"customTool",{title:"Custom"});});var Yh=d(function(){OH();RH();});var AH,BH;var PH=d(function(){vl();Yh();AH=function AH(i){if(i==="de"){return Pk;}return uu;};BH=function BH(i,t){if(t&&t[i]){return Fi([AH(i),t[i]]);}return AH(i)||uu;};});var Glt,Vlt,Mk,lv;var Jh=d(function(){vl();Glt={headline1:{size:16,letterSpacing:1.5,"case":"uppercase"},headline2:{size:14,letterSpacing:.8,"case":"uppercase"},body:{size:13,letterSpacing:0,"case":"none"},label:{size:13,letterSpacing:0,"case":"capitalize"},basicUICardLabel:{size:12,letterSpacing:0,"case":"capitalize"},button1:{size:14,letterSpacing:0,"case":"uppercase"},button2:{size:14,letterSpacing:0,"case":"capitalize"},basicUITabLabel:{size:14,letterSpacing:.8,"case":"uppercase"}};Vlt={toast:2,controlsBar:5,buttonGroup:5,toolControlBar:6,toolbar:7,label:10,disable:11,canvas:{knob:4,bar:5,controls:5,snappingGuide:1,crop:{grid:2,dragImage:3,backdrop:4},webcam:{backdrop:7}},input:{list:6},button:{"float":5},dialog:{base:100,backdrop:1,container:2},colorItem:{overlay:2,background:1,tiledBackground:0}};Mk=function Mk(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;var e=i;var r=3*t;var o=e-2*r;var n=(o-2*t)/3;var s=(o-t)/2;return{advancedUIToolControlBar:{width:e,paddingTop:2*t,paddingBottom:2*t,paddingLeft:r,paddingRight:r,marginBottom:0,controls:{gutter:2*t}},advancedUICard:{small:{height:n,width:n},medium:{height:s,width:s},large:{height:86,width:o}},advancedUISpacer:t,inputs:{cropSize:{maxWidth:e},checkbox:{maxWidth:e}}};};lv=function lv(){var i=Mk(230);var t={advancedUIToolbar:{width:55,itemHeight:48,separatorHeight:20,marginBottom:0},basicCanvasOffset:40+76-88,basicUIToolbar:{openHeight:88,closeHeight:40},basicUIToolControlBar:{itemsBarHeight:72,controlsBarHeight:80,maxHeight:72+40+4,maxWidth:300},basicCard:{medium:{height:56,width:90},large:{height:60,width:110}},basicSpacer:8,mainCanvasActionBar:{height:50},crop:{minSize:50},canvas:{marginTop:0,transform:{minSliderWidth:435,minValueWidth:235,minFlipWidth:160}},canvasControls:{sprite:{controlOffset:16,rotateHandle:{height:16},minSize:30,controlPadding:16},knob:{size:16,touchable:{desktop:24}},corner:{size:14,touchable:{desktop:24,mobile:48},borderWidth:4},width:{size:14}},buttons:{"float":{size:56}},colorItem:{size:20},color:{colorPicker:{width:214,height:370,saturationSlider:{height:150},thumb:{size:14},arrow:{width:36}}},fontSystem:Glt,zIndex:Vlt};return Fi([i,t]);};});var jlt,cv;var MH=d(function(){jlt=function jlt(){var _ref153=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{primary:"#365afc",background:"#0B0B0B",foreground:"#FFFFFF"},_ref153$primary=_ref153.primary,i=_ref153$primary===void 0?"#365afc":_ref153$primary,_ref153$background=_ref153.background,t=_ref153$background===void 0?"#0B0B0B":_ref153$background,_ref153$foreground=_ref153.foreground,e=_ref153$foreground===void 0?"#FFFFFF":_ref153$foreground;var r="rgba(255, 255, 255, 0.90)";var o="rgba(255, 255, 255, 0.60)";var n="rgba(255, 255, 255, 0.38)";var s="#424242";var a="#333333";var l="#242424";var c="#171717";var u="#0B0B0B";var m="rgba(255, 255, 255, 0.08)";var p="rgba(0, 0, 0, 0.3)";var h="rgba(89, 121, 252, 0.20)";var g="0.3";return{shape:{radiusSmall:2,radiusMedium:4,radiusLarge:4},typography:{fontFamily:"Fira Sans",format:"woff",fontURI:"./fonts/imgly_font_fira_sans_regular.woff",provider:"file"},background:t,foreground:e,primary:i,warning:"#ffba5c",error:"#c2393a",success:"#39c26c",focusOutlineColor:"rgba(255, 255, 255, 0.12)",scrollbar:{handleColor:"rgba(255, 255, 255, 0.2)"},button:{outlinedBorderColor:a,activeForeground:i,containedPrimaryBackground:i,containedPrimaryForeground:r,outlinedPrimaryBackground:l,outlinedPrimaryForeground:r,outlinedSecondaryBackground:"transparent",outlinedSecondaryForeground:o,textPrimaryForeground:i,textSecondaryForeground:o,outlinedInactiveOverlayColor:p,textInactiveOpacity:"0.5",hoverOverlayColor:m},checkbox:{background:a,foreground:e,activeForeground:e,activeBackground:i,inactiveOpacity:g,hoverOpacity:"0.8"},modal:{background:l,bodyForeground:r,headerForeground:o,backdrop:"rgba(0, 0, 0, 0.6)"},card:{background:a,foreground:r,activeBorderColor:i,activeOverlayColor:h,labelBackground:"linear-gradient(transparent, rgba(0, 0, 0, 0.6))",labelForeground:r,inactiveOverlayColor:p,hoverOverlayColor:m},tabTitle:{foreground:o,background:"transparent",activeBackground:"transparent",activeBorderColor:i,activeForeground:r},dropdown:{background:"transparent",foreground:r,hoverBorderColor:o,borderColor:a,caretColor:n,listBackground:a,listBorderColor:a,listItemHoverBackground:s,listForeground:o,listShadow:"0 12px 17px 2px rgba(0,0,0,0.14),\n 0 5px 22px 4px rgba(0,0,0,0.12),\n 0 7px 8px -4px rgba(0,0,0,0.20)",inactiveOpacity:g},textInput:{foreground:r,hoverBorderColor:"rgba(255, 255, 255, 0.40)",background:"transparent",borderColor:a,inactiveOpacity:g},slider:{trackColor:"rgba(255, 255, 255, 0.4)",activeTrackColor:i,thumbBackground:c,thumbBorderColor:i,inactiveOpacity:g,hoverOpacity:"0.7"},selectColor:{activeBorderColor:i,inactiveOpacity:g},toolbar:{foreground:r,background:l,activeBackground:"transparent",activeForeground:i,borderColor:"transparent"},tooltip:{background:s,foreground:r},toolControlBar:{background:"rgba(23, 23, 23, 0.9)",borderColor:"transparent",shadow:"none",separatorColor:a,titleForeground:o,inputLabelForeground:o,inputLabelInactiveOpacity:g},mainCanvasActionBar:{background:"linear-gradient(0deg, transparent 0%, rgba(0, 0, 0, 0.6) 98%)",foreground:r,borderColor:"none"},canvasActionBar:{background:s,foreground:r,separatorColor:n},canvas:{background:u,controlsOutline:"rgba(255, 255, 255, 0.5)",controlsColor:"#ffffff",cropBackdrop:"rgba(0, 0, 0, 0.5)"},colorPicker:{listBackground:a,listShadow:"0 12px 17px 2px rgba(0,0,0,0.14),\n 0 5px 22px 4px rgba(0,0,0,0.12),\n 0 7px 8px -4px rgba(0,0,0,0.20)",controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#424242",highlight:"#565656",shadow:"#333333"}}};};cv=jlt;});var $lt,Lk;var LH=d(function(){$lt=function $lt(){var _ref154=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{primary:"#1e47fb",background:"#FBFBFB",foreground:"#000000"},_ref154$primary=_ref154.primary,i=_ref154$primary===void 0?"#1e47fb":_ref154$primary,_ref154$background=_ref154.background,t=_ref154$background===void 0?"#FBFBFB":_ref154$background,_ref154$foreground=_ref154.foreground,e=_ref154$foreground===void 0?"#000000":_ref154$foreground;var r="rgba(0, 0, 0, 0.90)";var o="rgba(0, 0, 0, 0.60)";var n="rgba(0, 0, 0, 0.38)";var s="#CCCCCC";var a="#D4D4D4";var l="#E6E6E6";var c="#EEEEEE";var u="#FBFBFB";var m="rgba(125, 125, 125, 0.12)";var p="rgba(30, 71, 251, 0.2)";var h="rgba(0, 0, 0, 0.1)";var g="0.3";return{shape:{radiusSmall:2,radiusMedium:4,radiusLarge:4},typography:{fontFamily:"Fira Sans",format:"woff",fontURI:"./fonts/imgly_font_fira_sans_regular.woff",provider:"file"},background:t,foreground:e,primary:i,warning:"#ffb045",error:"#c01a1b",success:"#17c658",focusOutlineColor:"rgba(125, 125, 125, 0.12)",scrollbar:{handleColor:"rgba(0, 0, 0, 0.2)"},button:{outlinedBorderColor:a,activeForeground:i,containedPrimaryBackground:i,containedPrimaryForeground:"rgba(255, 255, 255, 0.9)",outlinedPrimaryBackground:l,outlinedPrimaryForeground:r,outlinedSecondaryBackground:"transparent",outlinedSecondaryForeground:o,textPrimaryForeground:i,textSecondaryForeground:o,outlinedInactiveOverlayColor:h,textInactiveOpacity:"0.5",hoverOverlayColor:m},checkbox:{background:a,foreground:e,activeForeground:e,activeBackground:i,inactiveOpacity:g,hoverOpacity:"0.8"},modal:{background:l,bodyForeground:r,headerForeground:o,backdrop:"rgba(0, 0, 0, 0.6)"},card:{background:a,foreground:r,activeBorderColor:i,activeOverlayColor:p,labelBackground:"linear-gradient(transparent, rgba(0, 0, 0, 0.6))",labelForeground:"rgba(255, 255, 255, 0.87)",inactiveOverlayColor:h,hoverOverlayColor:m},tabTitle:{foreground:o,background:"transparent",activeBackground:"transparent",activeBorderColor:i,activeForeground:r},dropdown:{background:"transparent",foreground:r,hoverBorderColor:o,borderColor:a,listBackground:a,caretColor:n,listForeground:o,listBorderColor:a,listItemHoverBackground:s,listShadow:"0 8px 10px 1px rgba(0,0,0,0.14),\n 0 3px 14px 2px rgba(0,0,0,0.12),\n 0 5px 5px -3px rgba(0,0,0,0.20)",inactiveOpacity:g},textInput:{foreground:r,hoverBorderColor:r,background:"transparent",borderColor:a,inactiveOpacity:g},slider:{trackColor:s,activeTrackColor:i,thumbBackground:c,thumbBorderColor:i,inactiveOpacity:g,hoverOpacity:"0.7"},selectColor:{activeBorderColor:i,inactiveOpacity:g},toolbar:{foreground:r,background:a,activeBackground:"transparent",activeForeground:i,borderColor:"transparent"},tooltip:{background:s,foreground:r},toolControlBar:{background:"rgba(238, 238, 238, 0.9)",borderColor:c,shadow:"none",separatorColor:a,titleForeground:o,inputLabelForeground:o,inputLabelInactiveOpacity:g},mainCanvasActionBar:{background:"transparent",foreground:r,borderColor:"none"},canvasActionBar:{background:s,foreground:r,separatorColor:n},canvas:{background:u,controlsOutline:"rgba(255, 255, 255, 0.6)",controlsColor:"#ffffff",cropBackdrop:"rgba(255, 255, 255, 0.3)"},colorPicker:{listBackground:a,listShadow:"0 8px 10px 1px rgba(0,0,0,0.14),\n 0 3px 14px 2px rgba(0,0,0,0.12),\n 0 5px 5px -3px rgba(0,0,0,0.20)",controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}};};Lk=$lt;});var Zh,uv,Hr;var Qh=d(function(){Jh();MH();LH();Zh=cv();uv=lv();Hr=_objectSpread(_objectSpread({},Zh),{},{measurements:uv});});var Xlt,zH;var UH=d(function(){vl();Qh();Xlt=function Xlt(i){if(i==="light"){return Lk;}return cv;};zH=function zH(i,t){var e=Xlt(i);if(t&&t[i]){var _t$i=t[i],r=_t$i.primary,o=_t$i.background,n=_t$i.foreground;var s={primary:r,background:o,foreground:n};var a=Object.keys(s).reduce(function(l,c){if(s[c]){return _objectSpread(_objectSpread({},l),{},_defineProperty({},c,s[c]));}return l;},{});return Fi([e(a),t[i]]);}return e()||Zh;};});var qlt,NH;var HH=d(function(){vl();Jh();qlt=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];NH=function NH(i){var t=lv();if(i){var e={};Object.keys(i).forEach(function(r){if(qlt.indexOf(r)!==-1){e[r]=i[r];}});return Fi([t,e]);}return t;};});var WH=d(function(){PH();UH();HH();});var Ylt,Qi;var dv=d(function(){Tt();R();zn();U();vl();Ak();FH();sk();Yh();WH();Qh();Ylt={config:_l,locale:uu,theme:Zh,measurements:uv,initialMeasurements:uv};Qi=/*#__PURE__*/function(){function Qi(){var _this332=this;_classCallCheck(this,Qi);this.dispose=function(){_this332.state=null;_this332.events=null;_this332.assetProvider=null;};this.checkDefaultToolAvailability=function(t,e){return e.indexOf(t)!==-1;};this.state=Q(Ylt);this.events=new Rk();this.licenseChecker=null;}_createClass(Qi,[{key:"saveConfig",value:function saveConfig(t){var _this333=this;if(t.mainCanvasActions&&t.mainCanvasActions.length!==4){t.mainCanvasActions.length=4;}var e=t.layout&&t.layout==="basic"?Bk:_l;var r=Fi([e,t],{clone:true});this.licenseChecker=new Zx(r.license);if(!this.licenseChecker.areCustomAssetsAllowed()){r.sticker.enableCustomUpload=false;}var o=BH(r.language,r.custom.languages);var n=zH(r.theme,r.custom.themes);var s=NH(r.custom.measurements);var a=r.library.provider;var l=[];r.adjustment.categories=r.adjustment.categories.reduce(function(m,p){m.push(_objectSpread(_objectSpread({},p),{},{items:p.items.filter(function(h){if(!xC[h.identifier]){l.push(h.identifier);return false;}return true;})}));return m;},[]);if(l.length!==0){console.error("The following identifier are incorrect for the adjustment tool: ".concat(l.join(", ")));}delete r.language;delete r.custom.languages;delete r.custom.themes;delete r.library.provider;var c=r.tools.reduce(function(m,p){if(_typeof(p)==="object"){return[].concat(_toConsumableArray(m),_toConsumableArray(p));}return[].concat(_toConsumableArray(m),[p]);},[]);if(!c.length){console.error("Empty list input for tools");c=Qx.reduce(function(m,p){if(_typeof(p)==="object"){return[].concat(_toConsumableArray(m),_toConsumableArray(p));}return[].concat(_toConsumableArray(m),[p]);},[]);}c=c.filter(function(m){return _this333.licenseChecker.isToolAllowed(m);});if(r.defaultTool){var m=this.checkDefaultToolAvailability(r.defaultTool,c);if(!m){var _c7=c;var _c8=_slicedToArray(_c7,1);r.defaultTool=_c8[0];}}r.tools=c;this.state.config=r;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;var u=this.buildCustomAssetsConfig();this.assetProvider=new _p(u,this.licenseChecker.areCustomAssetsAllowed(),r.assetResolver);this.loadThemeFont();return a;}},{key:"config",get:function get(){return this.state.config;}},{key:"locale",get:function get(){return this.state.locale;}},{key:"theme",get:function get(){return this.state.theme;}},{key:"measurements",get:function get(){return this.state.measurements;}},{key:"initialMeasurements",get:function get(){return this.state.initialMeasurements;}},{key:"tools",get:function get(){return this.config.tools.reduce(function(t,e){if(typeof e==="string"){return[].concat(_toConsumableArray(t),[e]);}return[].concat(_toConsumableArray(t),[""],_toConsumableArray(e));},[]);}},{key:"defaultTool",get:function get(){return this.config.defaultTool;}},{key:"isOrderDefault",get:function get(){return this.config.order==="default";}},{key:"isLayoutAdvanced",get:function get(){return this.config.layout==="advanced";}},{key:"displayCloseButton",get:function get(){return this.config.mainCanvasActions.indexOf("close")!==-1;}},{key:"loadThemeFont",value:function loadThemeFont(){var t=this.theme.typography;if(!t.skipLoading){this.assetProvider.getFontManager().injectFonts([t]);}}},{key:"buildCustomAssetsConfig",value:function buildCustomAssetsConfig(){var t=this.tools;var e=ct(this.state.config);var r=this.state.config.assetBaseUrl;var o=this.state.theme;var n=t.indexOf("filter")!==-1?e["filter"]:void 0;var s=t.indexOf("focus")!==-1?e["focus"]:void 0;var a=t.indexOf("adjustment")!==-1?e["adjustment"]:void 0;var l=t.indexOf("sticker")!==-1?e["sticker"]:void 0;var c=t.indexOf("frame")!==-1?e["frame"]:void 0;var u=t.indexOf("overlay")!==-1?e["overlay"]:void 0;var m=t.indexOf("transform")!==-1?e["transform"]:void 0;var p=t.indexOf("text")!==-1?e["text"]:void 0;var h=t.indexOf("textdesign")!==-1?e["textdesign"]:void 0;return{basePath:r,theme:o,filter:n,focus:s,sticker:l,frame:c,overlay:u,transform:m,text:p,adjustment:a,textdesign:h};}}]);return Qi;}();f([C],Qi.prototype,"saveConfig",1);f([C],Qi.prototype,"dispose",2);f([S],Qi.prototype,"config",1);f([S],Qi.prototype,"locale",1);f([S],Qi.prototype,"theme",1);f([S],Qi.prototype,"measurements",1);f([S],Qi.prototype,"initialMeasurements",1);f([S],Qi.prototype,"tools",1);f([S],Qi.prototype,"defaultTool",1);f([S],Qi.prototype,"isOrderDefault",1);f([S],Qi.prototype,"isLayoutAdvanced",1);f([S],Qi.prototype,"displayCloseButton",1);});var zk;var Uk=d(function(){R();yC();zk=/*#__PURE__*/function(){function zk(t){_classCallCheck(this,zk);this.editor=t;}_createClass(zk,[{key:"setBackgroundImage",value:function setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,originalImage:t,blendMode:"normal",opacity:1});}else{this.container.setData({image:t,originalImage:t});}}},{key:"getchildren",value:function getchildren(){return this.container.getChildren();}},{key:"addImageToContainer",value:function addImageToContainer(){var _this334=this;return new Promise(function(t,e){var r=_this334.editor.activeStore.image;if(jF(r)){_this334.setBackgroundImage(r);t();}else{var o=_this334.editor.libraryStore.getRawUrl(r);_this334.getImageElement(o).then(function(n){_this334.setBackgroundImage(n);t();})["catch"](function(n){e({identifier:"imageLoading",message:n.message});});}});}},{key:"getImageElement",value:function getImageElement(t){var _this335=this;return new Promise(function(e,r){var o=new Image();o.addEventListener("load",function(){e(o);});o.addEventListener("error",function(n){r(n);});o.crossOrigin=_this335.editor.configStore.config.engine.crossOrigin;o.src=t;});}},{key:"getImgageContainerId",value:function getImgageContainerId(){return this.container?this.container.getID():"";}},{key:"engine",get:function get(){return this.editor.engine;}}]);return zk;}();});var Nk;var Hk=d(function(){U();Nk=/*#__PURE__*/function(){function Nk(t){var _this336=this;_classCallCheck(this,Nk);this.applyNewImageTransform=function(){var _this336$editor$engin=_this336.editor.engineMediator.image.container.getBounds(),t=_this336$editor$engin.size,e=_this336$editor$engin.width,r=_this336$editor$engin.height;var o=_this336.container;o.setTransform(_re.IDENTITY);o.setResolution(t);o.setPivot(.5,.5);o.setPosition({x:e/2,y:r/2});};this.editor=t;}_createClass(Nk,[{key:"engine",get:function get(){return this.editor.engine;}},{key:"container",get:function get(){return this.engine.getOutputContainer();}}]);return Nk;}();});function tf(i,t){var e=i.width/i.height;var r=t.width/t.height;if(e>r){return i.height/t.height;}return i.width/t.width;}var GH=d(function(){});var Jlt,ta;var Wk=d(function(){Tt();U();GH();Jlt={transform:_re.IDENTITY};ta=/*#__PURE__*/function(){function ta(t){_classCallCheck(this,ta);this.initialTransform=_re.IDENTITY;this.editor=t;this.state=Q(Jlt);}_createClass(ta,[{key:"createPreview",value:function createPreview(t){this.container=this.editor.engine.createPreview(t);}},{key:"updateTransform",value:function updateTransform(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var r=this.calculateTransform(t);if(r.scale.x){if(e){this.saveInitialTransform(r);}else{this.savePreviewTransform(r);}this.container.setTransform(this.state.transform);return true;}return false;}},{key:"saveInitialTransform",value:function saveInitialTransform(t){this.initialTransform=t;this.savePreviewTransform(t);}},{key:"savePreviewTransform",value:function savePreviewTransform(t){var _this337=this;Ve(function(){_this337.state.transform.position=t.position;_this337.state.transform.scale=t.scale;_this337.state.transform.rotation=t.rotation;var e=Eo();var r=new O(t.scale).divide(e);_this337.previewTransformWithoutDpr={position:new O(t.position).divide(e),scale:r,rotation:t.rotation};});}},{key:"transform",get:function get(){return this.state.transform;}},{key:"position",get:function get(){return this.state.transform.position;}},{key:"scale",get:function get(){return this.state.transform.scale;}},{key:"rotation",get:function get(){return this.state.transform.rotation;}},{key:"calculateTransform",value:function calculateTransform(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=Eo();var r=this.editor.configStore.config.scaleImageToFit;var _this$editor$canvasSt2=this.editor.canvasStore.canvasSize,o=_this$editor$canvasSt2.width,n=_this$editor$canvasSt2.height;var s=this.editor.engine.getOutputDimensions();var a=tf({width:o,height:n},s);var l=r?a:Math.min(1,a);var c=n-s.height*l;var u=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(cn*m){l=tf({width:o,height:n*m},s);}if(s.width*l>o*m){l=tf({width:o*m,height:n},s);}l*=e;var p={x:o*e/2,y:n*e/2};var h={x:l,y:l};return new _re(p,h,t);}}]);return ta;}();f([C],ta.prototype,"updateTransform",1);f([C],ta.prototype,"savePreviewTransform",1);f([S],ta.prototype,"transform",1);f([S],ta.prototype,"position",1);f([S],ta.prototype,"scale",1);f([S],ta.prototype,"rotation",1);});var _Cl,mv;var Gk=d(function(){var _mv$IMAGE_CONTAINER_I;R();_Cl=/*#__PURE__*/function(){function Cl(){_classCallCheck(this,Cl);this.imageContainerOrder=[];this.spriteContainerOrder=[];}_createClass(Cl,[{key:"addIndex",value:function addIndex(t){_Cl.checkTool(t);var _Cl$indexForOrder=_Cl.indexForOrder(_Cl.IMAGE_CONTAINER_INDEX,this.imageContainerOrder,t),e=_Cl$indexForOrder.index,r=_Cl$indexForOrder.order;this.imageContainerOrder=r;return e;}},{key:"removeIndex",value:function removeIndex(t){_Cl.checkTool(t);_Cl.remove(t,this.imageContainerOrder);}},{key:"addSprite",value:function addSprite(t){this.spriteContainerOrder.push(t);return this.imageContainerOrder.length+this.spriteContainerOrder.length-1;}},{key:"removeSprite",value:function removeSprite(t){_Cl.remove(t,this.spriteContainerOrder);}},{key:"renameSprite",value:function renameSprite(t,e){var r=this.spriteContainerOrder.findIndex(function(o){return o===t;});if(r!==-1){this.spriteContainerOrder[r]=e;}}},{key:"bringToFront",value:function bringToFront(t){var e=this.spriteContainerOrder.findIndex(function(r){return r===t;});if(e!==-1){this.spriteContainerOrder.splice(e,1);this.spriteContainerOrder.push(t);}return this.getLastSpriteIndex();}},{key:"getLastSpriteId",value:function getLastSpriteId(){var t=this.spriteContainerOrder.length;return this.spriteContainerOrder[t-1];}},{key:"getSpriteIndex",value:function getSpriteIndex(t){var e=this.spriteContainerOrder.findIndex(function(r){return r===t;});return e+this.imageContainerOrder.length-1;}},{key:"getLastSpriteIndex",value:function getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1;}}],[{key:"checkTool",value:function checkTool(t){if(["sticker","text","textdesign","brush"].indexOf(t)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite");}}},{key:"remove",value:function remove(t,e){var r=e.findIndex(function(o){return o===t;});if(r!==-1){e.splice(r,1);}return void 0;}},{key:"indexForOrder",value:function indexForOrder(t,e,r){var o=t[r];var n=e.findIndex(function(a){return a===r;});if(n!==-1){return{index:n,order:e};}var _e28=e,s=_e28.length;if(s){var a;for(a=0;a0&&t0;}},{key:"canRedo",get:function get(){return this.snapshots.length-1>this.index;}}]);return xm;}();f([S],xm.prototype,"index",1);f([S],xm.prototype,"canUndo",1);f([S],xm.prototype,"canRedo",1);});var du;var pv=d(function(){Tt();R();VH();Zi();du=/*#__PURE__*/function(){function du(t){var _this339=this;_classCallCheck(this,du);this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee34(){var _t41;return regeneratorRuntime.wrap(function _callee34$(_context35){while(1){switch(_context35.prev=_context35.next){case 0:if(_this339.awaitHistoryChange){_context35.next=8;break;}_this339.editor.configStore.events.onUndo();_this339.awaitHistoryChange=true;_t41=_this339.appHistoryManager.undo();_context35.next=6;return _this339.applyState(_t41);case 6:_this339.awaitHistoryChange=false;if(!_this339.canUndo){_this339.isDirtySinceSave=false;}case 8:case"end":return _context35.stop();}}},_callee34);}));this.redo=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee35(){var _t42;return regeneratorRuntime.wrap(function _callee35$(_context36){while(1){switch(_context36.prev=_context36.next){case 0:if(_this339.awaitHistoryChange){_context36.next=7;break;}_this339.editor.configStore.events.onRedo();_this339.awaitHistoryChange=true;_t42=_this339.appHistoryManager.redo();_context36.next=6;return _this339.applyState(_t42);case 6:_this339.awaitHistoryChange=false;case 7:case"end":return _context36.stop();}}},_callee35);}));this.editor=t;this.appHistoryManager=new xm();}_createClass(du,[{key:"canUndo",get:function get(){return this.appHistoryManager.canUndo;}},{key:"canRedo",get:function get(){return this.appHistoryManager.canRedo;}},{key:"getHistoryState",value:function getHistoryState(){var _ref157;var t=ct(this.editor.adjustmentsToolStore.state);var e=ct(this.editor.filterToolStore.state);var r=this.editor.focusToolStore.getFocusStateForHistory();var o=ct(this.editor.overlayToolStore.state);var n=ct(this.editor.frameToolStore.state);var s=this.editor.brushToolStore.strokes;var a=this.editor.spriteStore.getSpriteHistoryState();var l=this.editor.transformToolStore.serializableState;return _ref157={},_defineProperty(_ref157,"adjustment",t),_defineProperty(_ref157,"filter",e),_defineProperty(_ref157,"focus",r),_defineProperty(_ref157,"overlay",o),_defineProperty(_ref157,"frame",n),_defineProperty(_ref157,"brush",s),_defineProperty(_ref157,"sprite",a),_defineProperty(_ref157,"transform",l),_ref157;}},{key:"addInitialSnapshot",value:function addInitialSnapshot(){var t=this.getHistoryState();this.appHistoryManager.addSnapshot({state:t,type:"add",description:"Initial State"});}},{key:"addSnapshot",value:function addSnapshot(t,e,r){var o;if(!t){o=this.getHistoryState();}else if(t.sprite||t.transform){o=_objectSpread(_objectSpread({},this.getHistoryState()),t);}else{o=t;}this.appHistoryManager.addSnapshot({state:o,type:e,description:r});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true;}}},{key:"applyState",value:function(){var _applyState=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee36(_ref158){var _this340=this;var t,e,_i6,_e29,r;return regeneratorRuntime.wrap(function _callee36$(_context37){while(1){switch(_context37.prev=_context37.next){case 0:t=_ref158.state;_context37.prev=1;if(!t){_context37.next=47;break;}e=Object.keys(t);_i6=0,_e29=e;case 5:if(!(_i6<_e29.length)){_context37.next=45;break;}r=_e29[_i6];_context37.t0=r;_context37.next=_context37.t0==="filter"?10:_context37.t0==="adjustment"?13:_context37.t0==="overlay"?16:_context37.t0==="frame"?19:_context37.t0==="focus"?22:_context37.t0==="brush"?25:_context37.t0==="sprite"?28:_context37.t0==="transform"?31:41;break;case 10:_context37.next=12;return this.editor.filterToolStore.updateStateFromHistory(t[r]);case 12:return _context37.abrupt("break",42);case 13:_context37.next=15;return this.editor.adjustmentsToolStore.updateStateFromHistory(t[r]);case 15:return _context37.abrupt("break",42);case 16:_context37.next=18;return this.editor.overlayToolStore.updateStateFromHistory(t[r]);case 18:return _context37.abrupt("break",42);case 19:_context37.next=21;return this.editor.frameToolStore.updateStateFromHistory(t[r]);case 21:return _context37.abrupt("break",42);case 22:_context37.next=24;return this.editor.focusToolStore.updateStateFromHistory(t[r],this.editor.canvasStore.sizeVector);case 24:return _context37.abrupt("break",42);case 25:_context37.next=27;return this.editor.brushToolStore.updateStateFromHistory(t[r]);case 27:return _context37.abrupt("break",42);case 28:_context37.next=30;return this.editor.spriteStore.updateStateFromHistory(t[r]);case 30:return _context37.abrupt("break",42);case 31:this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(t[r]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();_context37.next=40;return this.editor.wait();case 40:return _context37.abrupt("break",42);case 41:return _context37.abrupt("break",42);case 42:_i6++;_context37.next=5;break;case 45:_context37.next=47;return this.editor.renderPromise();case 47:_context37.next=53;break;case 49:_context37.prev=49;_context37.t1=_context37["catch"](1);console.error(_context37.t1);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:_context37.t1,handleConfirm:function handleConfirm(){_this340.applyState({state:t});}});case 53:case"end":return _context37.stop();}}},_callee36,this,[[1,49]]);}));function applyState(_x35){return _applyState.apply(this,arguments);}return applyState;}()},{key:"isDirty",value:function isDirty(){return this.appHistoryManager.snapshots.length>1;}},{key:"reset",value:function reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false;}},{key:"getCurrentSpritesState",value:function getCurrentSpritesState(){var t,e;return(e=(t=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:t.state)==null?void 0:e.sprite;}}]);return du;}();f([C],du.prototype,"undo",2);f([C],du.prototype,"redo",2);f([S],du.prototype,"canUndo",1);f([S],du.prototype,"canRedo",1);});var Zlt,jH,Qlt,$k;var $H=d(function(){Zlt=function Zlt(i,t){return new Promise(function(e,r){var o=new XMLHttpRequest();o.onload=function(){var n=new FileReader();n.onloadend=function(){if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){e(n.result);}else{r(new Error("The image could not be loaded from ".concat(i)));}};n.onerror=function(s){r(s);};n.readAsDataURL(o.response);};o.open("GET",i);o.responseType="blob";o.withCredentials=t==="use-credentials";o.send();});};jH=function jH(i,t){return new Promise(function(e,r){var o=new Image();o.onload=function(){e(o);};o.onerror=function(){r(new Error("Failed to load image with src:".concat(i)));};o.crossOrigin=t;o.src=i;});};Qlt=function Qlt(i,t){return new Promise(function(e,r){Zlt(i,t).then(function(o){var n=new Image();n.addEventListener("load",function(){e(n);});n.src=o;})["catch"](function(){jH(i,t).then(function(o){return e(o);})["catch"](function(o){r(o);});});});};$k=/*#__PURE__*/function(){var _ref160=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee37(_ref159){var i,t,_ref159$crossOrigin,e;return regeneratorRuntime.wrap(function _callee37$(_context38){while(1){switch(_context38.prev=_context38.next){case 0:i=_ref159.url,t=_ref159.image,_ref159$crossOrigin=_ref159.crossOrigin,e=_ref159$crossOrigin===void 0?"anonymous":_ref159$crossOrigin;_context38.prev=1;if(!(t&&t.src&&t.src.substr(0,5)==="data:"||t&&t.src&&t.src.includes(".svg"))){_context38.next=4;break;}return _context38.abrupt("return",t);case 4:if(!(typeof i==="string"&&i.substr(0,5)==="data:"||typeof i==="string"&&i.includes(".svg"))){_context38.next=6;break;}return _context38.abrupt("return",jH(i,e));case 6:return _context38.abrupt("return",Qlt(i||t.src,e));case 9:_context38.prev=9;_context38.t0=_context38["catch"](1);throw new Error(_context38.t0);case 12:case"end":return _context38.stop();}}},_callee37,null,[[1,9]]);}));return function $k(_x36){return _ref160.apply(this,arguments);};}();});var tct,hr;var hv=d(function(){Tt();R();U();$H();tct={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};hr=/*#__PURE__*/function(){function hr(t){var _this341=this;_classCallCheck(this,hr);this.setImage=/*#__PURE__*/function(){var _ref161=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee38(t){var e;return regeneratorRuntime.wrap(function _callee38$(_context39){while(1){switch(_context39.prev=_context39.next){case 0:_context39.prev=0;e=_this341.editor.configStore.config.engine.crossOrigin;if(!(typeof t==="string"&&!t.trim()||t===void 0||t===null)){_context39.next=6;break;}_this341.state.image=null;_context39.next=16;break;case 6:if(!(typeof t==="string")){_context39.next=12;break;}_context39.next=9;return $k({url:cn(t)?t:_this341.editor.assetProvider.getPath(t),crossOrigin:e});case 9:_this341.state.image=_context39.sent;_context39.next=16;break;case 12:if(!(t instanceof HTMLImageElement)){_context39.next=16;break;}_context39.next=15;return $k({image:t,crossOrigin:e});case 15:_this341.state.image=_context39.sent;case 16:if(_this341.isWebcam){_this341.state.isWebcam=false;}_context39.next=22;break;case 19:_context39.prev=19;_context39.t0=_context39["catch"](0);throw new Error(_context39.t0);case 22:case"end":return _context39.stop();}}},_callee38,null,[[0,19]]);}));return function(_x37){return _ref161.apply(this,arguments);};}();this.setImageLoadedToEngine=function(t){_this341.state.imageLoadedToEngine=t;};this.newImage=function(t){_this341.editor.init(t);};this.dispose=function(){_this341.state=null;_this341.editor=null;};this.editor=t;this.state=Q(tct);}_createClass(hr,[{key:"selectTool",value:function selectTool(t){var r,o,n;var e=this.editor.configStore.licenseChecker;if(this.state.tool!==t&&(e==null?void 0:e.isToolAllowed(t))&&(this.image||t==="library"||t==="customTool")){if(this.editor.configStore.isLayoutAdvanced){var s=(n=(o=(r=this.editor.configStore.state.config["customTool"])==null?void 0:r.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(t==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s;}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width;}}}this.editor.onToolChange(this.state.tool,t);this.state.tool=t;this.editor.configStore.events.onToolChanged(t);switch(t){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect();}else{this.editor.spriteStore.textToolStore.loadFonts();}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect();}break;case"brush":{this.editor.brushToolStore.initSize();break;}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break;}}}},{key:"selectWebcam",value:function selectWebcam(t){this.state.isWebcam=t;}},{key:"webcamLabel",get:function get(){return this.editor.libraryStore.locale.controls.buttonWebcamClose;}},{key:"tool",get:function get(){return this.state.tool;}},{key:"isWebcam",get:function get(){return this.state.isWebcam;}},{key:"image",get:function get(){return this.state.image;}},{key:"imageLoadedToEngine",get:function get(){return this.state.imageLoadedToEngine;}}]);return hr;}();f([C],hr.prototype,"selectTool",1);f([C],hr.prototype,"selectWebcam",1);f([C],hr.prototype,"setImage",2);f([C],hr.prototype,"setImageLoadedToEngine",2);f([C],hr.prototype,"newImage",2);f([C],hr.prototype,"dispose",2);f([S],hr.prototype,"webcamLabel",1);f([S],hr.prototype,"tool",1);f([S],hr.prototype,"isWebcam",1);f([S],hr.prototype,"image",1);f([S],hr.prototype,"imageLoadedToEngine",1);});var ect,Kk,_Xk,Oi;var fv=d(function(){Tt();R();U();ect={height:150,width:150};Kk={height:0,width:0};_Xk=/*#__PURE__*/function(){function Xk(t){var _this342=this;_classCallCheck(this,Xk);this.canvasClickDisabled=Q.box(false);this.resizeCanvas=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var e=_this342.editor.activeStore.tool;var r=t==="transform"||!t&&e==="transform";var _this342$editor$confi=_this342.editor.configStore,o=_this342$editor$confi.isLayoutAdvanced,n=_this342$editor$confi.measurements;var s=_this342.editor.canvasStore.storedSize;var a=0;if(!o&&r){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(t==="transform"&&e==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4;}}_this342.setCanvasSize({width:s.width,height:s.height+a});};this.setCanvasSize=function(t){_this342.state.canvasSize=t;};this.dispose=function(){_this342.state=null;_this342.canvas=null;_this342.canvasClickDisabled=null;_this342.editor=null;};this.editor=t;this.state=Q(_Xk.initialState);}_createClass(Xk,[{key:"setCanvasElement",value:function setCanvasElement(t){this.canvas=t;this.editor.engineMediator.preview.createPreview(t);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image);}}},{key:"saveDimensions",value:function saveDimensions(_ref162){var t=_ref162.height,e=_ref162.width,r=_ref162.render;var o=this.editor.activeStore.imageLoadedToEngine;if(t>Kk.height&&e>Kk.width){this.state.storedSize={width:e,height:t};if(this.state.canvasSize.height===0){this.state.canvasSize={width:e,height:t};}if(r&&o){this.editor.resize();}}}},{key:"disableCanvasClick",value:function disableCanvasClick(){this.canvasClickDisabled.set(true);}},{key:"enableCanvasClick",value:function enableCanvasClick(){this.canvasClickDisabled.set(false);}},{key:"isCanvasClickable",get:function get(){return!this.canvasClickDisabled.get();}},{key:"canvasSize",get:function get(){return this.state.canvasSize;}},{key:"storedSize",get:function get(){return this.state.storedSize;}},{key:"sizeVector",get:function get(){return O.fromSize(this.state.canvasSize);}},{key:"sizeVectorMagnitude",get:function get(){return this.sizeVector.magnitude;}},{key:"getContainersAtPreviewPoint",value:function getContainersAtPreviewPoint(t){var _this343=this;var e=this.editor.engine.getContainersAtPreviewPoint(t,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(function(r){return r.getID();}).filter(function(r){return r!==_this343.editor.engineMediator.image.getImgageContainerId();});this.editor.spriteStore.onCanvasClick(e);}}]);return Xk;}();Oi=_Xk;Oi.initialState={canvasSize:Kk,storedSize:ect};f([C],Oi.prototype,"setCanvasElement",1);f([C],Oi.prototype,"saveDimensions",1);f([C],Oi.prototype,"resizeCanvas",2);f([C],Oi.prototype,"disableCanvasClick",1);f([C],Oi.prototype,"enableCanvasClick",1);f([C],Oi.prototype,"setCanvasSize",2);f([C],Oi.prototype,"dispose",2);f([S],Oi.prototype,"isCanvasClickable",1);f([S],Oi.prototype,"canvasSize",1);f([S],Oi.prototype,"storedSize",1);f([S],Oi.prototype,"sizeVector",1);f([S],Oi.prototype,"sizeVectorMagnitude",1);});var ict,Wr;var gv=d(function(){Tt();R();ict={type:null,identifier:null,isVisible:false,error:""};Wr=/*#__PURE__*/function(){function Wr(t){var _this344=this;_classCallCheck(this,Wr);this.showActionModal=function(_ref163){var t=_ref163.type,e=_ref163.identifier,r=_ref163.error,o=_ref163.handleConfirm,n=_ref163.handleDismiss;_this344.resetHandlers();_this344.state.isVisible=true;_this344.state.identifier=e;_this344.state.type=t;_this344.state.error=r||"";_this344.handleConfirm=o;_this344.handleDismiss=n;};this.hideModal=function(){_this344.state.isVisible=false;_this344.state.type=null;_this344.state.error="";_this344.state.identifier=null;_this344.resetHandlers();};this.dispose=function(){_this344.state=null;_this344.configStore=null;};this.resetHandlers=function(){_this344.handleConfirm=null;_this344.handleDismiss=null;};this.configStore=t.configStore;this.state=Q(ict);}_createClass(Wr,[{key:"showInfoModal",value:function showInfoModal(t){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=t;this.state.error="";}},{key:"showTextEditModal",value:function showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error="";}},{key:"modalProps",get:function get(){var t=this.state.isVisible;var e=this.getModalLocale();if(e){var r=e.bodyLabel,o=e.headerLabel,n=e.buttonYes,s=e.buttonNo;return{headerLabel:o,bodyLabel:r,confirmLabel:n,dismissLabel:s,isVisible:t,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss};}return{isVisible:false};}},{key:"isVisible",get:function get(){return this.state.isVisible;}},{key:"type",get:function get(){return this.state.type;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"positionOffset",get:function get(){var _this$configStore=this.configStore,t=_this$configStore.isLayoutAdvanced,_this$configStore$mea=_this$configStore.measurements,e=_this$configStore$mea.basicCanvasOffset,r=_this$configStore$mea.advancedUIToolControlBar,o=_this$configStore$mea.advancedUIToolbar,n=_this$configStore.isOrderDefault;var s=(r.width+o.width)*(!n?-1:1);var a=e;return t?{x:s/2,y:0}:{x:0,y:-a};}},{key:"getModalLocale",value:function getModalLocale(){var _this$state6=this.state,t=_this$state6.identifier,e=_this$state6.error,r=_this$state6.type;var o=this.configStore.locale;if(!r||!t||r==="textEdit")return null;if(r&&t&&o["".concat(r,"Modals")]&&o["".concat(r,"Modals")][t]){var n=o["".concat(r,"Modals")][t];var s=n.body;if(s&&_typeof(e)==="object"){Object.keys(e).forEach(function(l){s=s.replace("${".concat(l,"}"),e[l]);});}else if(s){s=s.replace("${error}",e);}var a=n.heading;if(r==="error"||r==="warning"){var l={error:o.common.error,warning:o.common.warning};var c=r==="error"?l.error:l.warning;a="".concat(c).concat(n.headingDelimiter||""," ").concat(n.header||"");}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo};}return null;}}]);return Wr;}();f([C],Wr.prototype,"showActionModal",2);f([C],Wr.prototype,"showInfoModal",1);f([C],Wr.prototype,"showTextEditModal",1);f([C],Wr.prototype,"hideModal",2);f([C],Wr.prototype,"dispose",2);f([S],Wr.prototype,"modalProps",1);f([S],Wr.prototype,"isVisible",1);f([S],Wr.prototype,"type",1);f([S],Wr.prototype,"identifier",1);f([S],Wr.prototype,"positionOffset",1);});var ti;var bv=d(function(){Tt();U();ti=/*#__PURE__*/function(){function ti(t){var _this345=this;_classCallCheck(this,ti);this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(function(t){return t/100;});this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this["in"]=function(){if(_this345.canZoomIn){_this345.state.scaleIndex+=1;_this345.scaleRender();}};this.out=function(){if(_this345.canZoomOut){_this345.state.scaleIndex-=1;var _this345$checkOffset=_this345.checkOffset({x:0,y:0}),_t43=_this345$checkOffset.maxOffsetX,e=_this345$checkOffset.maxOffsetY;if(_this345.state.scaleIndex===_this345.defaultIndex){_this345.offset.y=e;}if(_this345.state.scaleIndex===_this345.defaultIndex){_this345.offset.x=_t43;}_this345.savePosition();_this345.scaleRender();}};this.setOffset=function(t){var _this345$checkOffset2=_this345.checkOffset(t),e=_this345$checkOffset2.canDragX,r=_this345$checkOffset2.canDragY;if(e){_this345.offset.x=t.x;}if(r){_this345.offset.y=t.y;}_this345.scaleRender();};this.editor=t;}_createClass(ti,[{key:"setInitialTransform",value:function setInitialTransform(){var _this346=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=Eo();var r=this.editor.configStore.config.scaleImageToFit;var o=this.editor.engineMediator.preview.transform;Ve(function(){var n=Math.abs(t||o.scale.x);_this346.setDefaultScale(r?n:Math.min(1*e,n));_this346.setPosition(o.position);});}},{key:"resetScale",value:function resetScale(){this.state.scaleIndex=-1;}},{key:"resetPosition",value:function resetPosition(){var _this$editor$canvasSt3=this.editor.canvasStore.canvas,t=_this$editor$canvasSt3.width,e=_this$editor$canvasSt3.height;this.setPosition({x:t/2,y:e/2});}},{key:"resetOffset",value:function resetOffset(){this.offset={x:0,y:0};}},{key:"setPosition",value:function setPosition(t){this.state.position.x=t.x;this.state.position.y=t.y;}},{key:"savePosition",value:function savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0};}},{key:"setDefaultScale",value:function setDefaultScale(t){var _this347=this;if(this.defaultScale!==1){var r=this.SCALE_LEVELS.findIndex(function(o){return o===_this347.defaultScale;});if(r!==-1){this.SCALE_LEVELS=[].concat(_toConsumableArray(this.SCALE_LEVELS.slice(0,r)),_toConsumableArray(this.SCALE_LEVELS.slice(r+1)));}}var e=this.SCALE_LEVELS.findIndex(function(r){return r===t;});if(e!==-1){this.state.scaleIndex=e;}else{var _r19=this.SCALE_LEVELS.findIndex(function(o,n){if(n===0){return t0;var g=u>0;var x=m-a;var v=p-l;return{canDragX:x<0,canDragY:v<0,maxOffsetX:h?-x:x,maxOffsetY:g?-v:v};}},{key:"calculateScale",value:function calculateScale(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.previewSize;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.defaultScale;var o=e.width,n=e.height;var s=new O({x:o,y:n});var a=new O(Math.abs(s.x*Math.cos(t))+Math.abs(s.y*Math.sin(t)),Math.abs(s.x*Math.sin(t))+Math.abs(s.y*Math.cos(t)));var l=s.subtract(a).divide(2).multiply(r).abs;if(l.y>l.x){return l.y*2/s.y+r;}return l.x*2/s.x+r;}},{key:"defaultIndex",get:function get(){var _this348=this;return this.SCALE_LEVELS.findIndex(function(t){return t===_this348.defaultScale;});}},{key:"getPositionWithOffset",value:function getPositionWithOffset(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.offset;var e=this.position;return{x:e.x-t.x,y:e.y-t.y};}},{key:"scaleRender",value:function scaleRender(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.editor.scale.getPositionWithOffset();var r=t?this.defaultScale:this.scale;var o={x:r,y:r};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(e);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:e,rotation:0});if(!t){this.editor.render();}}},{key:"scale",get:function get(){var t=this.state.scaleIndex;return t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;}},{key:"zoomLevel",get:function get(){var t=Eo();return(this.scale/t*100).toFixed(1);}},{key:"canDrag",get:function get(){return this.defaultScalethis.defaultIndex;}return this.state.scaleIndex!==0;}},{key:"canZoomIn",get:function get(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex;}},{key:"position",get:function get(){return this.state.position;}},{key:"scaledSize",get:function get(){var t=this.state.scaleIndex;var e=t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;var r=this.previewSize;return{width:r.width*e/this.defaultScale,height:r.height*e/this.defaultScale};}},{key:"previewSize",get:function get(){return this.editor.getPreviewSize();}}]);return ti;}();f([Q],ti.prototype,"state",2);f([C],ti.prototype,"in",2);f([C],ti.prototype,"out",2);f([C],ti.prototype,"setInitialTransform",1);f([C],ti.prototype,"resetScale",1);f([C],ti.prototype,"resetPosition",1);f([C],ti.prototype,"setPosition",1);f([C],ti.prototype,"savePosition",1);f([C],ti.prototype,"setDefaultScale",1);f([C],ti.prototype,"setScaleToDefault",1);f([S],ti.prototype,"scale",1);f([S],ti.prototype,"zoomLevel",1);f([S],ti.prototype,"canDrag",1);f([S],ti.prototype,"canZoomOut",1);f([S],ti.prototype,"canZoomIn",1);f([S],ti.prototype,"position",1);f([S],ti.prototype,"scaledSize",1);});var KH,rct,_Gn,ze;var qk=d(function(){Tt();U();KH=[[0,0],[0,1],[1,0],[1,1]];rct=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];_Gn=/*#__PURE__*/function(){function Gn(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"center";var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;_classCallCheck(this,Gn);this.considerRotation=true;this.considerFlip=true;this.store=e;this.m=r==="center"?_Gn.movePivotTo([.5,.5]):KH;this.considerRotation=o;this.considerFlip=n;this.configStore=t.configStore;}_createClass(Gn,[{key:"position",get:function get(){return this.store.position;}},{key:"size",get:function get(){return this.store.size;}},{key:"rotation",get:function get(){return this.considerRotation?this.store.rotationWRTOutputRotation:0;}},{key:"flipHorizontally",get:function get(){return this.considerFlip?this.store.isFlippedHorizontal:false;}},{key:"flipVertically",get:function get(){return this.considerFlip?this.store.isFlippedVertical:false;}},{key:"flipCenter",get:function get(){return this.considerFlip?this.store.flipCenter:null;}},{key:"handleOrigin",value:function handleOrigin(t,e,r){var o=_Gn.getFlippedEdgeIndex(t,e,r);var n=this.m[o][0]*this.size.width;var s=this.m[o][1]*this.size.height;return{width:n,height:s};}},{key:"leftTop",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(0,e,r);return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"leftBottom",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(1,e,r);return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"rightTop",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(2,e,r);return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"rightBottom",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(3,e,r);return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"leftBottomHandle",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(1,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"rightBottomHandle",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(3,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"leftMid",get:function get(){var t=new O(this.leftTop);var e=new O(this.leftBottom);return t.add(e).divide(2);}},{key:"rightMid",get:function get(){var t=new O(this.rightTop);var e=new O(this.rightBottom);return t.add(e).divide(2);}}],[{key:"getFlippedEdgeIndex",value:function getFlippedEdgeIndex(t,e,r){return rct[(e?1:0)+(r?2:0)][t];}},{key:"movePivotTo",value:function movePivotTo(t){return KH.map(function(e){return[e[0]-t[0],e[1]-t[1]];});}}]);return Gn;}();ze=_Gn;ze.coordinatesWithRotation=function(_ref164,r,o,n,s,a){var t=_ref164.width,e=_ref164.height;var l=t*Math.cos(r)-e*Math.sin(r)+a.x;var c=t*Math.sin(r)+e*Math.cos(r)+a.y;if(o){l=s.x*2-l;}if(n){c=s.y*2-c;}return new O({x:l,y:c}).rounded;};f([S],ze.prototype,"position",1);f([S],ze.prototype,"size",1);f([S],ze.prototype,"rotation",1);f([S],ze.prototype,"flipHorizontally",1);f([S],ze.prototype,"flipVertically",1);f([S],ze.prototype,"flipCenter",1);f([S],ze.prototype,"leftTop",1);f([S],ze.prototype,"leftBottom",1);f([S],ze.prototype,"rightTop",1);f([S],ze.prototype,"rightBottom",1);f([S],ze.prototype,"leftBottomHandle",1);f([S],ze.prototype,"rightBottomHandle",1);f([S],ze.prototype,"leftMid",1);f([S],ze.prototype,"rightMid",1);});var Yk=d(function(){dv();Yh();Qh();Jh();jk();Gk();Uk();Hk();Wk();pv();hv();fv();gv();bv();qk();});var Ft;var XH=d(function(){Tt();U();Dk();Ft=/*#__PURE__*/function(){function Ft(t,e){var _this349=this;_classCallCheck(this,Ft);this.minCropSize=0;this.id="";this.dispose=function(){_this349.state=null;_this349.defaults=null;_this349.configStore=null;};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:Q.map({})};this.configStore=t.configStore;this.id=At();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=e;}_createClass(Ft,[{key:"changeIdentifier",value:function changeIdentifier(t){this.state.identifier=t;var e=this.state.cropState.get("".concat(this.id,"-").concat(t));if(!e){this.state.cropState.set("".concat(this.id,"-").concat(t),_objectSpread({},jo));}}},{key:"changeRatio",value:function changeRatio(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),_objectSpread(_objectSpread({},e),{},{ratio:t}));}}},{key:"changeSize",value:function changeSize(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){if(t.width&&t.width>0){e.size.width=Math.round(t.width);}if(t.height&&t.height>0){e.size.height=Math.round(t.height);}this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}},{key:"changeHeight",value:function changeHeight(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){if(t){e.size.height=Math.round(t);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}}},{key:"changeWidth",value:function changeWidth(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){if(t){e.size.width=Math.round(t);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}}},{key:"changePositionX",value:function changePositionX(t,e){var r=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(r&&t<=e-this.minCropSize&&t>=0){r.position.x=Math.round(t);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),r);return true;}return false;}},{key:"changePositionY",value:function changePositionY(t,e){var r=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(r&&t<=e-this.minCropSize&&t>=0){r.position.y=Math.round(t);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),r);return true;}return false;}},{key:"changePosition",value:function changePosition(t,e){var r=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(r){if(t.x<=e.width-this.minCropSize&&t.x>=0&&t.y<=e.height-this.minCropSize&&t.y>=0){r.position.x=Math.round(t.x);r.position.y=Math.round(t.y);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),r);return true;}}return false;}},{key:"changeLockResolution",value:function changeLockResolution(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){e.lockResolution=t!==void 0?t:!e.lockResolution;this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}},{key:"changeForceDimensions",value:function changeForceDimensions(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){e.forceDimensions=t;this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}},{key:"clearState",value:function clearState(){var _this350=this;this.state.cropState.forEach(function(t,e){return e.startsWith(_this350.id)&&_this350.state.cropState["delete"](e);});}},{key:"setRotation",value:function setRotation(t){this.state.rotationInDegrees=t;}},{key:"resetRotation",value:function resetRotation(){this.state.rotationInDegrees=0;}},{key:"resetOutputRotation",value:function resetOutputRotation(){this.state.outputRotation=0;}},{key:"resetFlip",value:function resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false;}},{key:"updateFlip",value:function updateFlip(_ref165){var t=_ref165.flipHorizontally,e=_ref165.flipVertically;this.state.flipHorizontally=t;this.state.flipVertically=e;}},{key:"setOutputRotation",value:function setOutputRotation(t){this.state.outputRotation=t;}},{key:"flipHorizontally",value:function flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally;}},{key:"flipVertically",value:function flipVertically(){this.state.flipVertically=!this.state.flipVertically;}},{key:"flipCenter",get:function get(){var _this$defaults$maxCro=this.defaults.maxCropMaskSize,t=_this$defaults$maxCro.width,e=_this$defaults$maxCro.height;return new O(t/2,e/2);}},{key:"isFlippedHorizontal",get:function get(){return this.state.flipHorizontally;}},{key:"isFlippedVertical",get:function get(){return this.state.flipVertically;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"height",get:function get(){return this.selectedCrop?this.selectedCrop.size.height:jo.size.height;}},{key:"width",get:function get(){return this.selectedCrop?this.selectedCrop.size.width:jo.size.width;}},{key:"position",get:function get(){return this.selectedCrop?this.selectedCrop.position:jo.position;}},{key:"ratio",get:function get(){return this.selectedCrop?this.selectedCrop.ratio:jo.ratio;}},{key:"size",get:function get(){return this.selectedCrop?this.selectedCrop.size:jo.size;}},{key:"x",get:function get(){return this.selectedCrop?this.selectedCrop.position.x:jo.position.x;}},{key:"y",get:function get(){return this.selectedCrop?this.selectedCrop.position.y:jo.position.y;}},{key:"lockResolution",get:function get(){return this.selectedCrop?this.selectedCrop.lockResolution:jo.lockResolution;}},{key:"forceDimensions",get:function get(){return this.selectedCrop?this.selectedCrop.forceDimensions:jo.forceDimensions;}},{key:"selectedCrop",get:function get(){return this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));}},{key:"rotationInDegrees",get:function get(){return this.state.rotationInDegrees;}},{key:"outputRotation",get:function get(){return this.state.outputRotation;}}]);return Ft;}();f([Q],Ft.prototype,"state",2);f([C],Ft.prototype,"changeIdentifier",1);f([C],Ft.prototype,"changeRatio",1);f([C],Ft.prototype,"changeSize",1);f([C],Ft.prototype,"changeHeight",1);f([C],Ft.prototype,"changeWidth",1);f([C],Ft.prototype,"changePositionX",1);f([C],Ft.prototype,"changePositionY",1);f([C],Ft.prototype,"changePosition",1);f([C],Ft.prototype,"changeLockResolution",1);f([C],Ft.prototype,"changeForceDimensions",1);f([C],Ft.prototype,"clearState",1);f([C],Ft.prototype,"setRotation",1);f([C],Ft.prototype,"resetRotation",1);f([C],Ft.prototype,"resetOutputRotation",1);f([C],Ft.prototype,"resetFlip",1);f([C],Ft.prototype,"updateFlip",1);f([C],Ft.prototype,"setOutputRotation",1);f([C],Ft.prototype,"flipHorizontally",1);f([C],Ft.prototype,"flipVertically",1);f([C],Ft.prototype,"dispose",2);f([S],Ft.prototype,"flipCenter",1);f([S],Ft.prototype,"isFlippedHorizontal",1);f([S],Ft.prototype,"isFlippedVertical",1);f([S],Ft.prototype,"identifier",1);f([S],Ft.prototype,"height",1);f([S],Ft.prototype,"width",1);f([S],Ft.prototype,"position",1);f([S],Ft.prototype,"ratio",1);f([S],Ft.prototype,"size",1);f([S],Ft.prototype,"x",1);f([S],Ft.prototype,"y",1);f([S],Ft.prototype,"lockResolution",1);f([S],Ft.prototype,"forceDimensions",1);f([S],Ft.prototype,"selectedCrop",1);f([S],Ft.prototype,"rotationInDegrees",1);f([S],Ft.prototype,"outputRotation",1);});var Jk;var qH=d(function(){Tt();U();hm();Jk=/*#__PURE__*/function(){function Jk(t){var _this351=this;_classCallCheck(this,Jk);this.transforms={output:JSON.stringify(_re.IDENTITY),preview:JSON.stringify(_re.IDENTITY)};this.setFrameOpacity=function(t){_this351.frameOpacity=t;if(_this351.entered&&_this351.editor.frameToolStore.identifier!=="identity"){_this351.editor.frameToolStore.changeOpacity(0);}};this.setOverlayOpacity=function(t){_this351.overlayOpacity=t;if(_this351.entered&&_this351.editor.overlayToolStore.identifier!=="identity"){_this351.editor.overlayToolStore.changeOpacity(0);}};this.editor=t;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false;}_createClass(Jk,[{key:"onLeave",value:function onLeave(){var _this$transformToolSt=this.transformToolStore.rotateFlipState,t=_this$transformToolSt.flipHorizontally,e=_this$transformToolSt.flipVertically,r=_this$transformToolSt.rotation,o=_this$transformToolSt.outputRotation;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity);}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity);}this.editor.engine.setWatermarkOpacity(1);var n=this.editor.previewToWorld(new O(this.transformToolStore.leftTopRespectFlip).add(new O(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new O(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);var s=this.engineMediator.preview.container;var a=this.editor.outputContainer;a.setResolution(ct(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:e,flipHorizontally:t});var l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();var c=1;if(this.transformToolStore.lockResolution){var _this$transformToolSt2=this.transformToolStore,g=_this$transformToolSt2.cropMaskSize,x=_this$transformToolSt2.defaultImageSize;var v=this.transformToolStore.maxCropMaskSize;var b={height:g.height*x.height/v.height,width:g.width*x.width/v.width};c=b.width/this.transformToolStore.localOutputImageSize.width;}var u=Math.abs(l.x);var m=c/(u/this.transformToolStore.defaultScale);var p={x:m,y:m};var h=-(r-o);a.setTransform({scale:p,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls();}},{key:"resetTransforms",value:function resetTransforms(t){this.transforms=t;}},{key:"onEnter",value:function onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0);}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0);}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();var t=this.engineMediator.preview.container;var e=this.editor.outputContainer;var r=JSON.parse(this.transforms.preview);e.setResolution(ct(this.transformToolStore.defaultImageSize));t.setTransform(r);e.setTransform(JSON.parse(this.transforms.output));var o=r.scale;e.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(r);var _this$engineMediator$=this.engineMediator.preview.calculateTransform(),n=_this$engineMediator$.scale;this.editor.scale.setInitialTransform(n.x);}},{key:"rotateOutputContainer",value:function rotateOutputContainer(t){var _this352=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var _this$editor$engineMe=this.editor.engineMediator.image.container.getBounds(),r=_this$editor$engineMe.width,o=_this$editor$engineMe.height;var n=UA(t)?{width:o,height:r}:{width:r,height:o};this.editor.outputContainer.rotate(t,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());var s=this.transformToolStore.rotateFlipState.rotation;this.engineMediator.preview.updateTransform(s);Ve(function(){_this352.editor.scale.setInitialTransform();var a=_this352.getScaleWithFlip(s);_this352.engineMediator.preview.container.setScale(a);_this352.transformToolStore.setCropDefaults(true);_this352.transformToolStore.updateCropMask();});if(e){this.editor.render();}}},{key:"applyPreviewTransform",value:function applyPreviewTransform(){var _this$transformToolSt3=this.transformToolStore.rotateFlipState,t=_this$transformToolSt3.rotation,e=_this$transformToolSt3.flipHorizontally,r=_this$transformToolSt3.flipVertically;var o=this.editor.scale.getPositionWithOffset();var n=this.getScaleWithFlip();var s=t;if(e){s=pm(s);}if(r){s=pm(s);}var a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a);}},{key:"getScaleWithFlip",value:function getScaleWithFlip(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.transformToolStore.rotateFlipState.rotation;var _this$transformToolSt4=this.transformToolStore.rotateFlipState,e=_this$transformToolSt4.flipHorizontally,r=_this$transformToolSt4.flipVertically;var o=e?-1:1;var n=r?-1:1;var s=this.editor.scale.calculateScale(t);return{x:s*o,y:s*n};}},{key:"saveTransforms",value:function saveTransforms(){var t=JSON.stringify(this.engineMediator.preview.container.getTransform());var e=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:t,output:e};}},{key:"saveTransformsBasedOnFlip",value:function saveTransformsBasedOnFlip(){var t=this.engineMediator.preview.container.getTransform();var e=t.scale;var _this$editor$outputCo2=this.editor.outputContainer.getData(),r=_this$editor$outputCo2.flipVertically,o=_this$editor$outputCo2.flipHorizontally;var n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify(_objectSpread(_objectSpread({},t),{},{scale:{x:o?-e.x:e.x,y:r?-e.y:e.y}})),output:n};}},{key:"engineMediator",get:function get(){return this.editor.engineMediator;}},{key:"transformToolStore",get:function get(){return this.editor.transformToolStore;}}]);return Jk;}();});var Zk;var YH=d(function(){U();Zk=/*#__PURE__*/function(){function Zk(t){var _this353=this;_classCallCheck(this,Zk);this.store=t;this.initialState={};this.state={};this.dispose=function(){_this353.initialState=null;_this353.state=null;};}_createClass(Zk,[{key:"init",value:function init(){this.initialState=this.store.serializableState;this.state=_objectSpread({},this.initialState);}},{key:"trackChanges",value:function trackChanges(){this.state=this.store.serializableState;}},{key:"isEqual",value:function isEqual(){return(0,Ye["default"])(this.state,this.initialState);}},{key:"hasChanges",value:function hasChanges(){return!this.isEqual();}}]);return Zk;}();});var JH,_mu,tt;var Qk=d(function(){Tt();R();U();Yk();Zi();Nn();XH();qH();YH();JH="identity";_mu=/*#__PURE__*/function(){function mu(t){var _this354=this;_classCallCheck(this,mu);this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=Q.box(false);this.minCropSize=0;this.transformHistory=new Zk(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=function(t){if(!t.trim())return false;var e=_this354.editor.configStore.config.assetBaseUrl;var _e30=e,r=_e30.length;if(e[r-1]!=="/"){e+="/";}if("".concat(e,"transform")===t){return false;}var o=new Image();try{o.src=t;return true;}catch(n){return false;}};this.reset=function(){_this354.transformStore.resetRotation();_this354.transformStore.resetOutputRotation();_this354.transformStore.resetFlip();_this354.resetCrop();_this354.editor.spriteStore.correctTextFlip();_this354.editor.overlayToolStore.correctOverlayFlip();_this354.setDefaultAngle(0);var t=_this354.editor.outputContainer.getRotation();if(t!==0){_this354.engineMediator.output.applyNewImageTransform();}_this354.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});_this354.engineMediator.preview.updateTransform();_this354.editor.scale.setInitialTransform();_this354.setCropDefaults();_this354.applyInitialCrop();_this354.editor.render();_this354.trackChanges();};this.changeLocalOutputSize=function(t){_this354.localOutputSize.height=Math.round(t.height);_this354.localOutputSize.width=Math.round(t.width);_this354.editor.configStore.events.onCropDimensionsChanged({width:Math.round(t.width),height:Math.round(t.height)});};this.changeDefaultScale=function(t){_this354.defaults.scale=t;};this.changeLocalOutputHeight=function(t){_this354.localOutputSize.height=Math.round(t);};this.changeLocalOutputWidth=function(t){_this354.localOutputSize.width=Math.round(t);};this.changeLockResolution=function(){_this354.transformStore.changeLockResolution();_this354.trackChanges();};this.rotateClockwise=function(){var t=_this354.editor.outputContainer.getRotation();var e=_this354.isFlippedVertical?dS:mS;_this354.rotateOutputContainer(e(t));};this.rotateAntiClockwise=function(){var t=_this354.editor.outputContainer.getRotation();var e=_this354.isFlippedVertical?mS:dS;_this354.rotateOutputContainer(e(t));};this.flipHorizontally=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;_this354.transformStore.flipHorizontally();_this354.editor.spriteStore.reverseTextHorizontally(_this354.transformStore.isFlippedHorizontal);_this354.transformRender(t);if(t){_this354.trackChanges();}};this.flipVertically=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;_this354.transformStore.flipVertically();_this354.editor.spriteStore.reverseTextVertically(_this354.transformStore.isFlippedVertical);_this354.transformRender(t);if(t){_this354.trackChanges();}};this.applyDefaultCrop=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(_this354.identifier==="identity"){var _this354$getMatchingI=_this354.getMatchingItem(),_e31=_this354$getMatchingI.identifier;_this354.changeIdentifier(_e31,t);}};this.updateCropMask=function(){_this354.changeIdentifier(_this354.identifier,true);};this.onLeftTop=function(_ref166){var t=_ref166.x,e=_ref166.y;var r=_this354.getRatio();var o=_this354.rightBottom;var n=_this354.minCropMaskSize,s=_this354.maxCropMaskSize;var a=Math.min(Math.max(0,t),o.x-n.width);var l=Math.min(Math.max(0,e),o.y-n.height);var c=o.x-a;var u=o.y-l;var m={width:Math.max(_this354.minCropSize,Math.min(c,s.width-a)),height:Math.max(_this354.minCropSize,Math.min(u,s.height-l))};if(r==="*"){if(_this354.changePosition({x:a,y:l})){_this354.changeCropAndOutputSize(m);}}else{var p=_this354.proportionalSize(r,m);var h=new O(o).subtract({x:p.width,y:p.height});if(_this354.changePosition(h)){_this354.changeCropAndOutputSize(p,r);}}};this.onLeftBottom=function(_ref167){var t=_ref167.x,e=_ref167.y;var r=_this354.getRatio();var o=_this354.rightTop;var n=_this354.minCropMaskSize,s=_this354.maxCropMaskSize;var a=Math.min(Math.max(0,t),o.x-n.width);var l=Math.max(0,e,o.y+n.height);var c=o.x-a;var u=l-o.y;var m={width:Math.max(1,Math.min(c,s.width-a)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){if(_this354.changePositionX(a)){_this354.changeCropAndOutputSize(m);}}else{var p=_this354.proportionalSize(r,m);if(_this354.changePositionX(o.x-p.width)){_this354.changeCropAndOutputSize(p,r);}}};this.onRightTop=function(_ref168){var t=_ref168.x,e=_ref168.y;var r=_this354.getRatio();var o=_this354.leftBottom;var n=_this354.minCropMaskSize,s=_this354.maxCropMaskSize;var a=Math.max(0,t,o.x+n.width);var l=Math.min(Math.max(0,e),o.y-n.height);var c=a-o.x;var u=o.y-l;var m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-l))};if(r==="*"){if(_this354.changePositionY(l)){_this354.changeCropAndOutputSize(m);}}else{var p=_this354.proportionalSize(r,m);if(_this354.changePositionY(o.y-p.height)){_this354.changeCropAndOutputSize(p,r);}}};this.onRightBottom=function(_ref169){var t=_ref169.x,e=_ref169.y;var r=_this354.getRatio();var o=_this354.leftTop;var n=_this354.minCropMaskSize,s=_this354.maxCropMaskSize;var a=Math.max(0,t,o.x+n.width);var l=Math.max(0,e,o.y+n.height);var c=a-o.x;var u=l-o.y;var m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){_this354.changeCropAndOutputSize(m);}else{var p=_this354.proportionalSize(r,m);_this354.changeCropAndOutputSize(p,r);}};this.onPixelWidth=function(t){var e=JSON.stringify(ct(_this354.localOutputSize));var r=_this354.entityManager.items.find(function(n){return n.identifier===_this354.identifier;});var o=_this354.defaults.imageSize;if(r&&r.ratio){var _n10=t;var s=_this354.localOutputSize.height;var a=r.ratio;if(a==="*"&&_this354.lockResolution){a=_this354.localOutputSize.width/_this354.localOutputSize.height;}if(a==="*"&&!_this354.lockResolution){_n10=Math.max(Math.min(t,o.width),_this354.minCropSize);_this354.changeLocalOutputWidth(_n10);_this354.editor.configStore.events.onCropDimensionsChanged({width:Math.round(_n10),height:Math.round(s)});}else{var l=_mu.placeCropMask(a,o);_n10=Math.max(Math.min(_n10,l.width),_this354.minCropSize);s=_n10/a;_this354.changeLocalOutputSize({height:s,width:_n10});}if(!_this354.lockResolution){_this354.updatePreviewSizeWRTImageSize();}_this354.checkAndAddSnapshot(JSON.parse(e));return Math.round(_n10);}return t;};this.onPixelHeight=function(t){var e=JSON.stringify(ct(_this354.localOutputSize));var r=_this354.entityManager.items.find(function(n){return n.identifier===_this354.identifier;});var o=_this354.defaults.imageSize;if(r&&r.ratio){var _n11=t;var s=_this354.localOutputSize.width;var a=r.ratio;if(a==="*"&&_this354.lockResolution){a=_this354.localOutputSize.width/_this354.localOutputSize.height;}if(a==="*"&&!_this354.lockResolution){_n11=Math.max(Math.min(t,o.height),_this354.minCropSize);_this354.changeLocalOutputHeight(_n11);_this354.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(_n11)});}else{var l=_mu.placeCropMask(a,o);_n11=Math.max(Math.min(_n11,l.height),_this354.minCropSize);s=_n11*a;_this354.changeLocalOutputSize({height:_n11,width:s});}if(!_this354.lockResolution){_this354.updatePreviewSizeWRTImageSize();}_this354.checkAndAddSnapshot(JSON.parse(e));return Math.round(_n11);}return t;};this.dispose=function(){if(_this354.transformStore){_this354.transformStore.dispose();_this354.transformStore=null;}if(_this354.transformHistory){_this354.transformHistory.dispose();_this354.transformHistory=null;}_this354.editor=null;_this354.dragMode=null;_this354.selectedCategory=null;_this354.defaults=null;_this354.localOutputSize=null;_this354.rect=null;_this354.transformations=null;_this354.entityManager=null;};this.setFrameOpacity=function(t){_this354.transformations.setFrameOpacity(t);};this.setOverlayOpacity=function(t){_this354.transformations.setOverlayOpacity(t);};this.closestRatioReducer=function(t){return function(e,r){if(r===null)return-1;return Math.abs(t-e.ratio)r.dimensions.x*r.dimensions.y?-1:1;}return Math.abs(t-o)1&&arguments[1]!==undefined?arguments[1]:false;this.transformStore.changeIdentifier(t);var r=this.getCropMask(t,this.defaults.imageSize);if(r){this.transformStore.changeRatio(r.ratio);this.changeLocalOutputSize(r);this.updatePreviewSizeWRTImageSize();if(r.yChanged!==void 0){this.updateInitialCropMaskPosition(r.yChanged);}if(r.dimensions){this.changeLocalOutputSize({width:r.dimensions.x,height:r.dimensions.y});}if(e){this.trackChanges();}}}},{key:"setDragMode",value:function setDragMode(t){this.dragMode.set(t);}},{key:"getCropMask",value:function getCropMask(t,e){var r=this.getTransform(t);if(r){var o=r.ratio,n=r.forceDimensions,s=r.lockDimensions,_r$dimensions=r.dimensions,a=_r$dimensions===void 0?null:_r$dimensions;if(n){this.transformStore.changeForceDimensions(n);}if(s){this.transformStore.changeLockResolution(s);}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return _objectSpread(_objectSpread({},e),{},{yChanged:void 0,ratio:"*",dimensions:a});default:return _objectSpread(_objectSpread({},_mu.placeCropMask(r.ratio,e)),{},{ratio:r.ratio,dimensions:a});}}else{var _r$dimensions2=r.dimensions,l=_r$dimensions2.x,c=_r$dimensions2.y;return _objectSpread(_objectSpread({},_mu.placeCropMask(l/c,e)),{},{ratio:null,dimensions:a});}}return null;}},{key:"setCropDefaults",value:function setCropDefaults(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.editor.outputContainer.getResolution();this.setDefaultImageSize(e);var r=this.editor.getPreviewSize();var o=this.editor.engineMediator.preview.previewTransformWithoutDpr.position;this.setMaxCropSize(r);this.setDefaultCropPosition({x:o.x-r.width/2,y:o.y-r.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!t){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale;}}},{key:"setDefaultImageSize",value:function setDefaultImageSize(t){this.defaults.imageSize=_objectSpread({},ct(t));if(!this.lockResolution){this.localOutputSize=_objectSpread({},ct(t));}}},{key:"setMaxCropSize",value:function setMaxCropSize(t){this.defaults.maxCropMaskSize.height=t.height;this.defaults.maxCropMaskSize.width=t.width;}},{key:"setDefaultCropPosition",value:function setDefaultCropPosition(t){this.defaults.cropMaskPosition.x=t.x;this.defaults.cropMaskPosition.y=t.y;}},{key:"resetCrop",value:function resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity");}},{key:"toggleCategorySelection",value:function toggleCategorySelection(t){this.selectedCategory=this.selectedCategory===t?JH:t;}},{key:"pureReset",value:function pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();var t=JSON.stringify(this.engineMediator.preview.container.getTransform());var e=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:t,output:e});}},{key:"changePosition",value:function changePosition(t){return this.transformStore.changePosition(t,this.defaults.maxCropMaskSize);}},{key:"changePositionX",value:function changePositionX(t){return this.transformStore.changePositionX(t,this.defaults.maxCropMaskSize.width);}},{key:"changePositionY",value:function changePositionY(t){return this.transformStore.changePositionY(t,this.defaults.maxCropMaskSize.height);}},{key:"changeCropAndOutputSize",value:function changeCropAndOutputSize(_ref170,r){var t=_ref170.width,e=_ref170.height;var o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;this.transformStore.changeWidth(t);this.transformStore.changeHeight(e);if(!this.lockResolution){var _this$defaults$maxCro2=this.defaults.maxCropMaskSize,n=_this$defaults$maxCro2.height,s=_this$defaults$maxCro2.width;var _this$defaults$imageS=this.defaults.imageSize,a=_this$defaults$imageS.height,l=_this$defaults$imageS.width;var c=a/n*e;var u=l/s*t;if(r){c=u/r;}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(u),height:Math.round(c)});}if(e>=this.minCropSize){this.changeLocalOutputHeight(c);}if(t>=this.minCropSize){this.changeLocalOutputWidth(u);}}}},{key:"transformRender",value:function transformRender(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.transformations.applyPreviewTransform();if(t){this.editor.render();}}},{key:"addSnapshot",value:function addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot(_defineProperty({},"transform",this.serializableState),"edit","Transform edit");}},{key:"trackChanges",value:function trackChanges(){this.transformHistory.trackChanges();}},{key:"serializableState",get:function get(){var _this$rotateFlipState=this.rotateFlipState,t=_this$rotateFlipState.flipHorizontally,e=_this$rotateFlipState.flipVertically;var r=this.identifier,o=this.rotationInDegrees;var n=Gl(o);var s=uS(xb(this.editor.engineMediator.output.container.getRotation())+o);var _this$convertUIToOper=this.convertUIToOperationOptions(n,s),a=_this$convertUIToOper.start,l=_this$convertUIToOper.end;return{flipHorizontally:t,flipVertically:e,rotation:n,start:a,end:l,identifier:r,outputRotation:s};}},{key:"getStartEndForOperation",value:function getStartEndForOperation(t){var e=this.leftTop,r=this.rightBottom,o=this.maxCropMaskSize;var n=e.y;var s=e.x;var a=r.x;var l=r.y;switch(t){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}};}}},{key:"getStartEndForUI",value:function getStartEndForUI(t,e,r){var o=this.maxCropMaskSize;var n=e.y;var s=e.x;var a=r.x;var l=r.y;switch(t){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}};}}},{key:"convertOperationOptionsToUI",value:function convertOperationOptionsToUI(_ref171){var t=_ref171.start,e=_ref171.end,r=_ref171.rotation,o=_ref171.outputRotation;var n=o===90||o===270;var s=n?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);var a=Math.cos(r);var l=Math.sin(r);var c=this.calculateScale(r);var u=new O(Math.min(t.x,e.x),Math.min(t.y,e.y));var m=new O(Math.max(t.x,e.x),Math.max(t.y,e.y));var p=m.subtract(u).divide(2);var h=u.add(p).multiply(s);var g=h.subtract(s.multiply(.5));var x=new O(g.x*a-g.y*l,g.x*l+g.y*a).multiply(c);var v=s.multiply(.5).add(x);var b=v.divide(s);var T=b.subtract(p.multiply(c));var k=b.add(p.multiply(c));var E=n?O.fromSize(this.maxCropMaskSize).swapped:O.fromSize(this.maxCropMaskSize);var A=T.multiply(E);var I=k.multiply(E);var _this$getStartEndForU=this.getStartEndForUI(o,A,I),F=_this$getStartEndForU.leftTop,Z=_this$getStartEndForU.rightBottom;return{start:new O(F),end:new O(Z)};}},{key:"convertUIToOperationOptions",value:function convertUIToOperationOptions(t,e){var r=e===90||e===270;var o=r?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);var n=r?O.fromSize(this.maxCropMaskSize).swapped:O.fromSize(this.maxCropMaskSize);var s=Math.cos(-t);var a=Math.sin(-t);var l=this.calculateScale(t,r);var _this$getStartEndForO=this.getStartEndForOperation(e),c=_this$getStartEndForO.leftTop,u=_this$getStartEndForO.rightBottom;var m=new O(c).divide(n);var p=new O(u).divide(n);var h=p.subtract(m).divide(2);var g=m.add(h).multiply(o);var x=g.subtract(o.multiply(.5));var v=new O(x.x*s-x.y*a,x.x*a+x.y*s).divide(l);var b=o.multiply(.5).add(v);var T=b.divide(o);var k=T.subtract(h.divide(l));var E=T.add(h.divide(l));return{start:k,end:E};}},{key:"calculateScale",value:function calculateScale(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=e?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);var o=new O(Math.abs(r.x*Math.cos(t))+Math.abs(r.y*Math.sin(t)),Math.abs(r.x*Math.sin(t))+Math.abs(r.y*Math.cos(t)));var n=r.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/r.y+1:n.x*2/r.x+1;}},{key:"updateStateFromSerialization",value:function updateStateFromSerialization(t){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform();}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();var e=Math.round(xb(t.rotation));this.transformStore.setRotation(e>180?e-360:e);this.transformations.rotateOutputContainer(Gl(uS(t.outputRotation||0)));if(t.identifier){this.transformStore.changeIdentifier(t.identifier);}if(t.start&&t.end){if(t.end.x===0||t.end.y===0){t.end.x=1;t.end.y=1;}var _this$convertOperatio=this.convertOperationOptionsToUI({start:new O(t.start),end:new O(t.end),rotation:t.rotation,outputRotation:t.outputRotation}),r=_this$convertOperatio.start,o=_this$convertOperatio.end;this.changePositionX(r.x);this.changePositionY(r.y);var n=o.x-r.x;var s=o.y-r.y;this.transformStore.changeSize({width:n,height:s});var _this$defaults=this.defaults,a=_this$defaults.maxCropMaskSize,l=_this$defaults.imageSize;var c={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(c);}if(t.flipHorizontally){this.flipHorizontally(false);}if(t.flipVertically){this.flipVertically(false);}this.editor.overlayToolStore.correctOverlayFlip();}},{key:"setDefaultAngle",value:function setDefaultAngle(t){this.defaultAngle=t;}},{key:"updateCanvasControls",value:function updateCanvasControls(t){var e=ct(this.cropMaskPosition);var r=ct(this.cropMaskSize);var o=ct(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*r.height/t.height,width:o.width*r.width/t.width},void 0,false);this.changePosition({y:o.height*e.y/t.height,x:o.width*e.x/t.width});}},{key:"onLeave",value:function onLeave(){this.transformations.onLeave();}},{key:"onEnter",value:function onEnter(){this.transformations.onEnter();this.transformHistory.init();}},{key:"saveTransforms",value:function saveTransforms(){this.transformations.saveTransforms();}},{key:"saveTransformsBasedOnFlip",value:function saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip();}},{key:"setRotation",value:function setRotation(t){this.transformStore.setRotation(t);this.transformRender();}},{key:"rotateOutputContainer",value:function(){var _rotateOutputContainer=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee39(t){var e,_args40=arguments;return regeneratorRuntime.wrap(function _callee39$(_context40){while(1){switch(_context40.prev=_context40.next){case 0:e=_args40.length>1&&_args40[1]!==undefined?_args40[1]:true;this.setDragMode(true);this.transformations.rotateOutputContainer(t,e);_context40.next=5;return this.editor.wait();case 5:this.setDragMode(false);case 6:case"end":return _context40.stop();}}},_callee39,this);}));function rotateOutputContainer(_x38){return _rotateOutputContainer.apply(this,arguments);}return rotateOutputContainer;}()},{key:"applyInitialCrop",value:function applyInitialCrop(){var _this$getMatchingItem=this.getMatchingItem(),t=_this$getMatchingItem.identifier;this.changeIdentifier(t,false);}},{key:"clickableCanvas",value:function clickableCanvas(t){this.editor.clickableCanvas(t);}},{key:"proportionalSize",value:function proportionalSize(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.defaults.maxCropMaskSize;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this.minCropSize;var n=e.height*t;var s=e.height;if(n>r.width||n0&&arguments[0]!==undefined?arguments[0]:this.rotateFlipState.rotation;return this.transformations.getScaleWithFlip(t);}},{key:"cropState",get:function get(){return this.transformStore.selectedCrop;}},{key:"identifier",get:function get(){return this.transformStore.identifier;}},{key:"ratio",get:function get(){return this.transformStore.ratio;}},{key:"height",get:function get(){return this.transformStore.height;}},{key:"width",get:function get(){return this.transformStore.width;}},{key:"localOutputImageSize",get:function get(){return this.localOutputSize;}},{key:"localOutputHeight",get:function get(){return this.localOutputSize.height;}},{key:"localOutputWidth",get:function get(){return this.localOutputSize.width;}},{key:"lockResolution",get:function get(){return this.transformStore.lockResolution;}},{key:"forceDimensions",get:function get(){return this.transformStore.forceDimensions;}},{key:"rotationInDegrees",get:function get(){return this.transformStore.rotationInDegrees;}},{key:"outputRotation",get:function get(){return this.transformStore.outputRotation;}},{key:"isDragMode",get:function get(){return this.dragMode.get();}},{key:"rotateFlipState",get:function get(){var _this$transformStore$=this.transformStore.state,t=_this$transformStore$.flipHorizontally,e=_this$transformStore$.flipVertically,r=_this$transformStore$.rotationInDegrees,o=_this$transformStore$.outputRotation;return{flipHorizontally:t,flipVertically:e,rotation:_mu.inRadians(r),outputRotation:o};}},{key:"selectedCategoryIdentifier",get:function get(){return this.selectedCategory;}},{key:"categories",get:function get(){return this.entityManager.categories;}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"config",get:function get(){return this.editor.configStore.config["transform"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["transform"];}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}},{key:"leftTop",get:function get(){return this.rect.leftTop;}},{key:"leftBottom",get:function get(){return this.rect.leftBottom;}},{key:"rightTop",get:function get(){return this.rect.rightTop;}},{key:"rightBottom",get:function get(){return this.rect.rightBottom;}},{key:"isFlippedHorizontal",get:function get(){return this.transformStore.isFlippedHorizontal;}},{key:"isFlippedVertical",get:function get(){return this.transformStore.isFlippedVertical;}},{key:"leftTopRespectFlip",get:function get(){return this.rectForUi.leftTop;}},{key:"leftBottomRespectFlip",get:function get(){return this.rectForUi.leftBottom;}},{key:"rightTopRespectFlip",get:function get(){return this.rectForUi.rightTop;}},{key:"rightBottomRespectFlip",get:function get(){return this.rectForUi.rightBottom;}},{key:"cropMaskPosition",get:function get(){return this.transformStore.position;}},{key:"cropMaskSize",get:function get(){return this.transformStore.size;}},{key:"state",get:function get(){return this.transformStore.state;}},{key:"defaultImageSize",get:function get(){return this.defaults.imageSize;}},{key:"maxCropMaskSize",get:function get(){return this.defaults.maxCropMaskSize;}},{key:"minCropMaskSize",get:function get(){var t=this.getRatio();if(t==="*"||t===1){return{width:this.minCropSize,height:this.minCropSize};}if(t>1){return{width:this.minCropSize*t,height:this.minCropSize};}return{width:this.minCropSize,height:this.minCropSize*t};}},{key:"defaultCropMaskPosition",get:function get(){return this.defaults.cropMaskPosition;}},{key:"defaultScale",get:function get(){return this.defaults.scale;}},{key:"engineMediator",get:function get(){return this.editor.engineMediator;}},{key:"getRatio",value:function getRatio(){var t=this.getTransform(this.identifier);if(t){if(Object.prototype.hasOwnProperty.call(t,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight;}return t.ratio;}var _t$dimensions=t.dimensions,e=_t$dimensions.x,r=_t$dimensions.y;return e/r;}return"*";}}],[{key:"inRadians",value:function inRadians(t){return t*Math.PI/180;}},{key:"placeCropMask",value:function placeCropMask(t,e){if(e.height*t>e.width){var o=e.width/t;return{height:o,width:e.width,yChanged:true};}var r=e.height*t;return{height:e.height,width:r,yChanged:false};}}]);return mu;}();tt=_mu;f([Q],tt.prototype,"selectedCategory",2);f([Q],tt.prototype,"defaults",2);f([Q],tt.prototype,"localOutputSize",2);f([C],tt.prototype,"changeIdentifier",1);f([C],tt.prototype,"setDragMode",1);f([C],tt.prototype,"setCropDefaults",1);f([C],tt.prototype,"setDefaultImageSize",1);f([C],tt.prototype,"setMaxCropSize",1);f([C],tt.prototype,"setDefaultCropPosition",1);f([C],tt.prototype,"resetCrop",1);f([C],tt.prototype,"toggleCategorySelection",1);f([C],tt.prototype,"pureReset",1);f([C],tt.prototype,"reset",2);f([C],tt.prototype,"changePosition",1);f([C],tt.prototype,"changePositionX",1);f([C],tt.prototype,"changePositionY",1);f([C],tt.prototype,"changeCropAndOutputSize",1);f([C],tt.prototype,"onLeave",1);f([C],tt.prototype,"onEnter",1);f([C],tt.prototype,"changeLocalOutputSize",2);f([C],tt.prototype,"changeDefaultScale",2);f([C],tt.prototype,"changeLocalOutputHeight",2);f([C],tt.prototype,"changeLocalOutputWidth",2);f([C],tt.prototype,"changeLockResolution",2);f([C],tt.prototype,"setRotation",1);f([C],tt.prototype,"rotateClockwise",2);f([C],tt.prototype,"rotateAntiClockwise",2);f([C],tt.prototype,"rotateOutputContainer",1);f([C],tt.prototype,"flipHorizontally",2);f([C],tt.prototype,"flipVertically",2);f([C],tt.prototype,"applyDefaultCrop",2);f([C],tt.prototype,"applyInitialCrop",1);f([C],tt.prototype,"updateCropMask",2);f([C],tt.prototype,"clickableCanvas",1);f([C],tt.prototype,"onLeftTop",2);f([C],tt.prototype,"onLeftBottom",2);f([C],tt.prototype,"onRightTop",2);f([C],tt.prototype,"onRightBottom",2);f([C],tt.prototype,"proportionalSize",1);f([C],tt.prototype,"onPixelWidth",2);f([C],tt.prototype,"onPixelHeight",2);f([C],tt.prototype,"updateInitialCropMaskPosition",1);f([C],tt.prototype,"updatePreviewSizeWRTImageSize",1);f([C],tt.prototype,"dispose",2);f([S],tt.prototype,"cropState",1);f([S],tt.prototype,"identifier",1);f([S],tt.prototype,"ratio",1);f([S],tt.prototype,"height",1);f([S],tt.prototype,"width",1);f([S],tt.prototype,"localOutputImageSize",1);f([S],tt.prototype,"localOutputHeight",1);f([S],tt.prototype,"localOutputWidth",1);f([S],tt.prototype,"lockResolution",1);f([S],tt.prototype,"forceDimensions",1);f([S],tt.prototype,"rotationInDegrees",1);f([S],tt.prototype,"outputRotation",1);f([S],tt.prototype,"isDragMode",1);f([S],tt.prototype,"rotateFlipState",1);f([S],tt.prototype,"selectedCategoryIdentifier",1);f([S],tt.prototype,"categories",1);f([S],tt.prototype,"items",1);f([S],tt.prototype,"config",1);f([S],tt.prototype,"locale",1);f([S],tt.prototype,"isOptionSelected",1);f([S],tt.prototype,"leftTop",1);f([S],tt.prototype,"leftBottom",1);f([S],tt.prototype,"rightTop",1);f([S],tt.prototype,"rightBottom",1);f([S],tt.prototype,"isFlippedHorizontal",1);f([S],tt.prototype,"isFlippedVertical",1);f([S],tt.prototype,"leftTopRespectFlip",1);f([S],tt.prototype,"leftBottomRespectFlip",1);f([S],tt.prototype,"rightTopRespectFlip",1);f([S],tt.prototype,"rightBottomRespectFlip",1);f([S],tt.prototype,"cropMaskPosition",1);f([S],tt.prototype,"cropMaskSize",1);f([S],tt.prototype,"state",1);f([S],tt.prototype,"defaultImageSize",1);f([S],tt.prototype,"maxCropMaskSize",1);f([S],tt.prototype,"minCropMaskSize",1);f([S],tt.prototype,"defaultCropMaskPosition",1);f([S],tt.prototype,"defaultScale",1);});var ZH=d(function(){Dk();Qk();});var QH,oct,tI,nct,_ef,nt;var eI=d(function(){Tt();QH=y(Ju());R();U();Zi();qk();hm();fk();bk();xk();wk();oct={};tI="none";nct={position:{x:0,y:0},rotation:0};_ef=/*#__PURE__*/function(){function ef(t){var _this355=this;_classCallCheck(this,ef);this.state=Q.map(oct);this.selectedId=Q.box(tI);this.editMode=Q.box(false);this.dragMode=Q.box(false);this.minLength=0;this.counter=0;this.addSticker=/*#__PURE__*/function(){var _ref172=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee40(t){var e,_args41=arguments;return regeneratorRuntime.wrap(function _callee40$(_context41){while(1){switch(_context41.prev=_context41.next){case 0:e=_args41.length>1&&_args41[1]!==undefined?_args41[1]:true;_context41.next=3;return _this355.addStickerAsync(t,e);case 3:case"end":return _context41.stop();}}},_callee40);}));return function(_x39){return _ref172.apply(this,arguments);};}();this.addStickerAsync=/*#__PURE__*/function(){var _ref174=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee42(_ref173){var t,e,r,o,_args43=arguments;return regeneratorRuntime.wrap(function _callee42$(_context43){while(1){switch(_context43.prev=_context43.next){case 0:t=_ref173.spriteId,e=_ref173.state,r=_ref173.transform;o=_args43.length>1&&_args43[1]!==undefined?_args43[1]:true;return _context43.abrupt("return",new Promise(function(n,s){r=_this355.getInitialTransform(r);var a=e.identifier;var l=_this355.editor.orderHelper.addSprite(a);_this355.editor.engine.addStickerFromAssets(a,_this355.editor.engineMediator.image.container,l).then(/*#__PURE__*/function(){var _ref175=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee41(c){var u,m,p,v,b,_this355$editor$outpu,h,g,x;return regeneratorRuntime.wrap(function _callee41$(_context42){while(1){switch(_context42.prev=_context42.next){case 0:if(t){c.setData({id:t});}u=c.getID();_this355.container[u]=c;_this355.editor.orderHelper.renameSprite(a,u);m=_this355.getSize(u);m.width*=c.getScale().x;m.height*=c.getScale().y;c.setPivot(.5,.5);if(r.scale){p=r.scale;}else if(r.size){p={x:r.size.width/m.width,y:r.size.height/m.height};}else{v=_this355.editor.shortestOutputSide*.4;b=_ef.magnitude(v)/_ef.sizeMagnitude(c.getSizeInWorldSpace());p={x:b,y:b};}_this355$editor$outpu=_this355.editor.outputContainer.getData(),h=_this355$editor$outpu.flipHorizontally,g=_this355$editor$outpu.flipVertically;c.setFlipHorizontally(h);c.setFlipVertically(g);c.setTransform({position:r.position,scale:p,rotation:r.rotation});if(e.flipHorizontally!==void 0){c.setFlipHorizontally(e.flipHorizontally!==h);}if(e.flipVertically!==void 0){c.setFlipVertically(e.flipVertically!==g);}_this355.setContainerProperties(u,_objectSpread({},e));x=c.getData();_this355.setInitialSpriteState(u,"sticker");_this355.stickerToolStore.setState(u,_objectSpread(_objectSpread({},x),{},{identifier:a}));_context42.next=21;return _this355.editor.renderPromise();case 21:if(o){_this355.setId(u);_this355.addSnapshot("add",_this355.stickerLocale.add);}n();case 23:case"end":return _context42.stop();}}},_callee41);}));return function(_x41){return _ref175.apply(this,arguments);};}())["catch"](function(c){console.error(c);s();});}));case 3:case"end":return _context43.stop();}}},_callee42);}));return function(_x40){return _ref174.apply(this,arguments);};}();this.addText=/*#__PURE__*/function(){var _ref176=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee43(t){var e,_args44=arguments;return regeneratorRuntime.wrap(function _callee43$(_context44){while(1){switch(_context44.prev=_context44.next){case 0:e=_args44.length>1&&_args44[1]!==undefined?_args44[1]:true;_context44.next=3;return _this355.addTextAsync(t,e);case 3:case"end":return _context44.stop();}}},_callee43);}));return function(_x42){return _ref176.apply(this,arguments);};}();this.addTextAsync=function(_ref177){var t=_ref177.spriteId,e=_ref177.state,r=_ref177.transform;var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;return new Promise(function(n,s){r=_this355.getInitialTransform(r);var a=_this355.editor.orderHelper.addSprite(e.identifier);var l=_this355.editor.shortestOutputSide;var c={fontIdentifier:e.identifier,text:e.text,width:e.width||l*.6,fontSize:e.fontSize||l*.1,lineHeight:e.lineHeight,alignment:e.alignment,textColor:e.textColor,backgroundColor:e.backgroundColor};_this355.editor.engine.addTextWithFontLoading(c,_this355.editor.engineMediator.image.container,a).then(/*#__PURE__*/function(){var _ref178=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee44(u){var m,_this355$editor$outpu2,p,h,g;return regeneratorRuntime.wrap(function _callee44$(_context45){while(1){switch(_context45.prev=_context45.next){case 0:if(t){u.setData({id:t});}m=u.getID();_this355.container[m]=u;_this355.editor.orderHelper.renameSprite(e.identifier,m);_this355$editor$outpu2=_this355.editor.outputContainer.getData(),p=_this355$editor$outpu2.flipHorizontally,h=_this355$editor$outpu2.flipVertically;u.setFlipHorizontally(p);u.setFlipVertically(h);u.setPivot(.5,.5);u.setPosition(r.position);u.setRotation(r.rotation);_this355.setInitialSpriteState(m,"text");g=u.getData();_this355.textToolStore.setState(m,_objectSpread({},g));_context45.next=15;return _this355.editor.renderPromise();case 15:if(o){_this355.setId(m);_this355.addSnapshot("add",_this355.textLocale.add);}n();case 17:case"end":return _context45.stop();}}},_callee44);}));return function(_x43){return _ref178.apply(this,arguments);};}())["catch"](function(u){console.error(u);s();});});};this.addTextDesign=/*#__PURE__*/function(){var _ref179=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee45(t){var e,r,_args46=arguments;return regeneratorRuntime.wrap(function _callee45$(_context46){while(1){switch(_context46.prev=_context46.next){case 0:e=_args46.length>1&&_args46[1]!==undefined?_args46[1]:true;r=_args46.length>2&&_args46[2]!==undefined?_args46[2]:false;_context46.prev=2;_context46.next=5;return _this355.addTextDesignAsync(t,e,r);case 5:_context46.next=10;break;case 7:_context46.prev=7;_context46.t0=_context46["catch"](2);console.warn(_context46.t0);case 10:case"end":return _context46.stop();}}},_callee45,null,[[2,7]]);}));return function(_x44){return _ref179.apply(this,arguments);};}();this.addTextDesignAsync=function(_ref180){var t=_ref180.spriteId,e=_ref180.state,r=_ref180.transform;var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return new Promise(function(s,a){r=_this355.getInitialTransform(r);var l=_this355.editor.orderHelper.addSprite(e.identifier);var c=_this355.editor.shortestOutputSide;var u={width:e.width||c*.6,text:e.text,color:e.color,inverted:e.isInverted,seed:e.seed,padding:e.padding};_this355.editor.engine.addTextDesignAsync(e.identifier,u,_this355.editor.engineMediator.image.container,l).then(/*#__PURE__*/function(){var _ref181=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee46(m){var p,_this355$editor$outpu3,h,g,x;return regeneratorRuntime.wrap(function _callee46$(_context47){while(1){switch(_context47.prev=_context47.next){case 0:if(t){if(n){_this355.pureRemoveSprite(t);_this355.textDesignToolStore.state["delete"](t);}m.setData({id:t});}p=m.getID();_this355.container[p]=m;_this355.editor.orderHelper.renameSprite(e.identifier,p);_this355$editor$outpu3=_this355.editor.outputContainer.getData(),h=_this355$editor$outpu3.flipHorizontally,g=_this355$editor$outpu3.flipVertically;m.setFlipHorizontally(h);m.setFlipVertically(g);m.setPivot(.5,.5);m.setPosition(r.position);m.setRotation(r.rotation);_this355.setInitialSpriteState(p,"textdesign");x=m.getData();_this355.textDesignToolStore.setState(p,_objectSpread(_objectSpread({},x),{},{identifier:e.identifier}));_context47.next=15;return _this355.editor.renderPromise();case 15:if(o){_this355.setId(p);_this355.addSnapshot("add",_this355.textDesignLocale.add);}s();case 17:case"end":return _context47.stop();}}},_callee46);}));return function(_x45){return _ref181.apply(this,arguments);};}())["catch"](function(m){a(m);});});};this.spriteLocalTransform=function(){return{position:_this355.editor.previewToOutput(_this355.position),size:_this355.size,rotation:_this355.rotation};};this.clickableCanvas=function(t){_this355.editor.clickableCanvas(t);};this.setContainerProperties=function(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;_this355.container[t].setData(e);if(r){_this355.updatePositionAndSize();}_this355.editor.render();};this.setContainerPosition=function(t,e){_this355.container[t].setPosition(e);};this.pureRemoveSprite=function(t){_this355.editor.engine.removeContainer(_this355.container[t]);var e=_this355.container[t].getIndexInParent();if(e===-1){delete _this355.container[t];_this355.state["delete"](t);_this355.editor.orderHelper.removeSprite(t);return true;}return false;};this.deleteSprite=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this355.id;var e=_this355.state.get(t);if(e.tool==="sticker"){_this355.stickerToolStore["delete"]();}else if(e.tool==="text"){_this355.textToolStore["delete"]();}else if(e.tool==="textdesign"){_this355.textDesignToolStore["delete"]();}};this.removeSprite=function(t){var e=_this355.pureRemoveSprite(t);if(e){_this355.selectLast();_this355.spriteSnapshot("delete");_this355.editor.render();}};this.addSnapshot=function(t,e){_this355.editor.addSnapshot(void 0,t,e);};this.spriteSnapshot=function(t){_this355.addSnapshot("edit",_this355.historyLocale[t]);};this.addNewText=/*#__PURE__*/function(){var _ref182=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee47(t,e){return regeneratorRuntime.wrap(function _callee47$(_context48){while(1){switch(_context48.prev=_context48.next){case 0:if(!_this355.textToolStore.doesTextAssetExist(e.identifier)){_context48.next=5;break;}_context48.next=3;return _this355.addTextAsync(_objectSpread(_objectSpread({},t),{},{state:e}),false);case 3:_context48.next=6;break;case 5:throw new Do(e.identifier);case 6:case"end":return _context48.stop();}}},_callee47);}));return function(_x46,_x47){return _ref182.apply(this,arguments);};}();this.addNewTextDesign=/*#__PURE__*/function(){var _ref183=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee48(t,e){return regeneratorRuntime.wrap(function _callee48$(_context49){while(1){switch(_context49.prev=_context49.next){case 0:if(!_this355.textDesignToolStore.doesTextDesignAssetExist(e.identifier)){_context49.next=5;break;}_context49.next=3;return _this355.addTextDesignAsync(_objectSpread(_objectSpread({},t),{},{state:e}),false);case 3:_context49.next=6;break;case 5:throw new Do(e.identifier);case 6:case"end":return _context49.stop();}}},_callee48);}));return function(_x48,_x49){return _ref183.apply(this,arguments);};}();this.addNewSticker=/*#__PURE__*/function(){var _ref184=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee49(t,e){return regeneratorRuntime.wrap(function _callee49$(_context50){while(1){switch(_context50.prev=_context50.next){case 0:if(!_this355.stickerToolStore.doesStickerAssetExist(e.identifier)){_context50.next=5;break;}_context50.next=3;return _this355.addStickerAsync(_objectSpread(_objectSpread({},t),{},{state:e}),false);case 3:_context50.next=6;break;case 5:throw new Do(e.identifier);case 6:case"end":return _context50.stop();}}},_callee49);}));return function(_x50,_x51){return _ref184.apply(this,arguments);};}();this.getSpriteHistoryState=function(){var _r20;var t=ct(_this355.textToolStore.state);var e=ct(_this355.textDesignToolStore.state);var r=(_r20={common:ct(_this355.state)},_defineProperty(_r20,"sticker",ct(_this355.stickerToolStore.state)),_defineProperty(_r20,"text",t),_defineProperty(_r20,"textdesign",e),_defineProperty(_r20,"spriteIdList",Object.keys(_this355.container)),_r20);Object.keys(r.common).forEach(function(o){r.common[o].size=_this355.container[o].getSizeInWorldSpace();r.common[o].position=_this355.container[o].getPosition();r.common[o].order=_this355.container[o].getIndexInParent();});return r;};this.updateStateFromSerialization=/*#__PURE__*/function(){var _ref185=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee51(t,e,r){var o;return regeneratorRuntime.wrap(function _callee51$(_context52){while(1){switch(_context52.prev=_context52.next){case 0:if(!(e&&e.length)){_context52.next=13;break;}_context52.prev=1;_context52.next=4;return Promise.all(e.map(/*#__PURE__*/function(){var _ref187=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee50(_ref186){var n,s,a,l,c,u,m;return regeneratorRuntime.wrap(function _callee50$(_context51){while(1){switch(_context51.prev=_context51.next){case 0:n=_ref186.svg,s=_ref186.raster,a=_ref186.name,l=_ref186.identifier;c=(n==null?void 0:n.data)?"image/svg+xml":s.type;u="data:".concat(c,";base64,").concat((n==null?void 0:n.data)||s.data);_context51.next=5;return sv(u,150);case 5:m=_context51.sent;return _context51.abrupt("return",{stickerURI:u,thumbnailURI:m,name:a,type:c,identifier:l});case 7:case"end":return _context51.stop();}}},_callee50);}));return function(_x55){return _ref187.apply(this,arguments);};}()));case 4:o=_context52.sent;_context52.next=7;return _this355.stickerToolStore.addCustomStickerAsset(o);case 7:_context52.next=13;break;case 9:_context52.prev=9;_context52.t0=_context52["catch"](1);_this355.editor.modalStore.hideModal();_this355.editor.modalStore.showInfoModal("stickerLoading");case 13:if(!t.text){_context52.next=16;break;}_context52.next=16;return _this355.textToolStore.loadFonts();case 16:if(!t.textdesign){_context52.next=19;break;}_context52.next=19;return _this355.textDesignToolStore.loadFonts();case 19:_context52.next=21;return _this355.updateStateByHistoryState(t.spriteIdList,t,r);case 21:case"end":return _context52.stop();}}},_callee51,null,[[1,9]]);}));return function(_x52,_x53,_x54){return _ref185.apply(this,arguments);};}();this.updateStateFromHistory=/*#__PURE__*/function(){var _ref188=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee52(t){var e,r;return regeneratorRuntime.wrap(function _callee52$(_context53){while(1){switch(_context53.prev=_context53.next){case 0:e=Object.keys(_this355.container);r=e.filter(function(o){return t.spriteIdList.indexOf(o)===-1;});r.forEach(function(o){_this355.pureRemoveSprite(o);});_context53.next=5;return _this355.updateStateByHistoryState(t.spriteIdList,t,0);case 5:case"end":return _context53.stop();}}},_callee52);}));return function(_x56){return _ref188.apply(this,arguments);};}();this.serializableState=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee54(){var t,e;return regeneratorRuntime.wrap(function _callee54$(_context55){while(1){switch(_context55.prev=_context55.next){case 0:t=_this355.editor.spriteStore.getSpriteHistoryState();Object.keys(t.common).forEach(function(r){var _this355$editor$outpu4=_this355.editor.outputContainer.getData(),o=_this355$editor$outpu4.flipHorizontally,n=_this355$editor$outpu4.flipVertically;var s=_this355.editor.outputContainer.getRotation();var a=n!==o?-t.common[r].rotation:t.common[r].rotation;t.common[r].rotation=n!==o?a+s:a-s;});_context55.next=4;return Promise.all(_this355.editor.spriteStore.stickerToolStore.customStickers.map(/*#__PURE__*/function(){var _ref191=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee53(_ref190){var r,o,n,s,a,_n$split,_n$split2,l,_l$split,_l$split2;return regeneratorRuntime.wrap(function _callee53$(_context54){while(1){switch(_context54.prev=_context54.next){case 0:r=_ref190.identifier,o=_ref190.type,n=_ref190.stickerURI,s=_ref190.name;a={identifier:r,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]};}if(!(o==="image/jpeg"||o==="image/png"||o==="image/gif")){_context54.next=10;break;}_n$split=n.split(",");_n$split2=_slicedToArray(_n$split,2);a.raster.data=_n$split2[1];a.raster.type=o;_context54.next=17;break;case 10:_context54.next=12;return sv(n);case 12:l=_context54.sent;_l$split=l.split(",");_l$split2=_slicedToArray(_l$split,2);a.raster.data=_l$split2[1];a.raster.type="image/png";case 17:return _context54.abrupt("return",a);case 18:case"end":return _context54.stop();}}},_callee53);}));return function(_x57){return _ref191.apply(this,arguments);};}()));case 4:e=_context55.sent;return _context55.abrupt("return",{sprite:t,customStickers:e});case 6:case"end":return _context55.stop();}}},_callee54);}));this.updateCanvasControls=function(){Object.keys(_this355.container).forEach(function(t){_this355.updatePositionAndSize(t,true);var e=_this355.state.get(t);if(e){if(e.tool==="text"){var r=_this355.getContainerProperties(t);_this355.textToolStore.changeSize(t,r);}else if(e.tool==="textdesign"){var _r21=_this355.getContainerProperties(t);_this355.textToolStore.changeWidth(_r21.width);}}});};this.setEditMode=function(t){if(_this355.currentSprite){if(["text","textdesign"].indexOf(_this355.tool)!==-1){if(t){_this355.editor.modalStore.showTextEditModal();}else{_this355.editor.modalStore.hideModal();}_this355.editMode.set(t);}}};this.setDragMode=function(t){_this355.dragMode.set(t);};this.setPosition=function(t){var e=_this355.currentSprite;var r=_this355.container[_this355.id];if(e&&r){r.setPosition(_this355.editor.previewToWorld(t));var _this355$getSizePosit=_this355.getSizePositionFromContainer(),o=_this355$getSizePosit.position;e.position.x=o.x;e.position.y=o.y;_this355.state.set(_this355.id,e);_this355.editor.render();}};this.setSize=function(t){var e=_this355.currentSprite;if(e){e.size.width=t.width;e.size.height=t.height;_this355.state.set(_this355.id,e);}};this.setRotation=function(t){var e=_this355.currentSprite;if(e){var _this355$editor$outpu5=_this355.editor.outputContainer.getData(),r=_this355$editor$outpu5.flipHorizontally,o=_this355$editor$outpu5.flipVertically;var n=_this355.editor.outputContainer.getRotation();var s=$h({rotation:t,outputRotation:n,flipHorizontally:r,flipVertically:o});_this355.container[_this355.id].setRotation(s);e.rotation=_this355.container[_this355.id].getRotation();_this355.state.set(_this355.id,e);_this355.editor.render();}};this.onCanvasClick=function(t){if(!_this355.isEditMode){_this355.selectHighestOrderSprite(t);}};this.select=function(t){var e=_this355.state.get(t);if(e){var r=_this355.editor.activeStore.tool;if(r!==e.tool){_this355.editor.activeStore.selectTool(e.tool);}_this355.setId(t);}};this.selectLast=function(){var t=_this355.editor.orderHelper.getLastSpriteId();if(t){_this355.select(t);}};this.selectNext=function(){if(_this355.currentSprite){var _t44=_this355.container[_this355.id];var e=_t44.getIndexInParent();if(e){var r=Object.keys(_this355.container).find(function(o){return _this355.container[o].getIndexInParent()===e-1;});if(r){_this355.select(r);}}}};this.deselect=function(){_this355.setId(tI);};this.bringToFront=/*#__PURE__*/function(){var _ref192=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee55(t){var e;return regeneratorRuntime.wrap(function _callee55$(_context56){while(1){switch(_context56.prev=_context56.next){case 0:e=_this355.editor.orderHelper.bringToFront(t);_this355.container[t].setIndexInParent(e);_this355.spriteSnapshot("order");_context56.next=5;return _this355.editor.render();case 5:_this355.counter+=1;case 6:case"end":return _context56.stop();}}},_callee55);}));return function(_x58){return _ref192.apply(this,arguments);};}();this.flipHorizontally=function(t){var e=_this355.state.get(t);var r=_this355.container[t];r.setFlipHorizontally(!r.getFlipHorizontally());e.flipHorizontally=r.getFlipHorizontally();_this355.spriteSnapshot("flip");_this355.state.set(t,e);_this355.editor.render();};this.pureReset=function(){_this355.deselect();Array.from(_this355.state.keys()).forEach(function(t){_this355.pureRemoveSprite(t);});_this355.stickerToolStore.pureReset();_this355.textToolStore.pureReset();_this355.textDesignToolStore.pureReset();};this.selectHighestOrderSprite=function(t){var e=_this355.editor.brushToolStore.containerId();t=t.filter(function(n){return n!==e;});if(t.length<1){_this355.deselect();return;}var r="";var o=0;t.forEach(function(n){var s=_this355.container[n];var a=s&&s.getIndexInParent()||0;if(a>=o){o=a;r=n;}});_this355.select(r);};this.onCornerDrag=function(_ref193){var t=_ref193.x,e=_ref193.y;if(_this355.currentSprite){var r=new O(_this355.currentSprite.position);var o=new O(t,e);var n=o.subtract(r).magnitude;var s=_this355.getSize();var a=n*2/_ef.sizeMagnitude(s);if(n>_this355.minLength){if(_this355.isSpriteSticker){if(_this355.stickerToolStore.resizeMode!=="unrestricted"){_this355.setStickerSize({width:s.width*a,height:s.height*a});}else{var l=_this355.rotationWRTOutputRotation;var c=o.subtract(r);var u=Math.cos(l);var m=Math.sin(l);var p=Math.max(Math.abs(c.x*u*2+c.y*m*2),_this355.minLength);var h=Math.max(Math.abs(c.x*-m*2+c.y*u*2),_this355.minLength);_this355.setStickerSize({width:p,height:h});}}else if(_this355.isSpriteText){_this355.setTextSize(s.width*a);}else if(_this355.isSpriteTextDesign){_this355.setTextDesignScale(a);}}_this355.editor.render();}};this.onWidthDrag=function(_ref194){var t=_ref194.x,e=_ref194.y;var r=new O(_this355.currentSprite.position);var o=new O(t,e);var n=o.subtract(r).magnitude;var s=_this355.editor.previewToWorld(2*n);if(s>_this355.minLength){_this355.setContainerProperties(_this355.id,{width:s},true);if(_this355.isSpriteText){var a=_this355.getContainerProperties(_this355.id);_this355.textToolStore.changeWidth(a.width);}}};this.onPaddingDrag=function(_ref195){var t=_ref195.x,e=_ref195.y;if(_this355.isSpriteTextDesign){var r=_this355.getContainerProperties(_this355.id);var o=new O(_this355.currentSprite.position);var n=new O(t,e);var s=n.subtract(o).magnitude;var a=Math.max(_this355.editor.previewToWorld(s)-r.width/2,0);_this355.setContainerProperties(_this355.id,{padding:a},true);if(_this355.isSpriteTextDesign){r=_this355.getContainerProperties(_this355.id);_this355.textDesignToolStore.changePadding(r.padding);}}};this.correctTextFlip=function(){var _this355$editor$outpu6=_this355.editor.outputContainer.getData(),t=_this355$editor$outpu6.flipHorizontally,e=_this355$editor$outpu6.flipVertically;Object.values(_this355.container).forEach(function(r){if(r.type==="text"||r.type==="text-design"){r.setFlipHorizontally(t);r.setFlipVertically(e);}});};this.reverseTextHorizontally=function(t){Object.values(_this355.container).forEach(function(e){if(e.type==="text"||e.type==="text-design"){e.setFlipHorizontally(t);}});};this.reverseTextVertically=function(t){Object.values(_this355.container).forEach(function(e){if(e.type==="text"||e.type==="text-design"){e.setFlipVertically(t);}});};this.dispose=function(){_this355.state=null;if(_this355.stickerToolStore){_this355.stickerToolStore.dispose();_this355.stickerToolStore=null;}if(_this355.textToolStore){_this355.textToolStore.dispose();_this355.textToolStore=null;}if(_this355.textDesignToolStore){_this355.textDesignToolStore.dispose();_this355.textDesignToolStore=null;}_this355.selectedId=null;_this355.editMode=null;_this355.dragMode=null;_this355.editor=null;_this355.rect=null;};this.getOutputProperties=function(){return _this355.editor.outputContainer.getData();};this.getContainerProperties=function(t){return _this355.container[t].getData();};this.getContainerTransform=function(t){return _this355.container[t].getTransform();};this.getDuplicateContainerTransform=function(t){var e=_this355.container[t].getTransform();var r=_this355.editor.shortestOutputSide*.1;var o=new O(e.position).add(new O(r,r));return _objectSpread(_objectSpread({},e),{},{position:o});};this.getDuplicateContainerFlip=function(t){var e=_this355.container[t].getFlipHorizontally();var r=_this355.container[t].getFlipVertically();return{flipHorizontally:e,flipVertically:r};};this.updatePositionAndSize=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this355.id;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var _this355$getSizePosit2=_this355.getSizePositionFromContainer(t),r=_this355$getSizePosit2.position,o=_this355$getSizePosit2.size;var n=_this355.state.get(t);if(n){n.position.x=r.x;n.position.y=r.y;n.size.width=o.width;n.size.height=o.height;if(e){var s=_this355.container[t].getRotation();_this355.container[t].setRotation(s);n.rotation=_this355.container[t].getRotation();}_this355.state.set(t,n);}};this.getInitialTransform=function(t){var e=_this355.editor.outputToWorld(nct.position);if(!t){var r=_this355.editor.outputContainer.getRotation();return{rotation:r,position:e};}return _objectSpread({position:e},t);};this.setInitialSpriteState=function(t,e){var r=_this355.container[t];var _this355$getSizePosit3=_this355.getSizePositionFromContainer(t),o=_this355$getSizePosit3.position,n=_this355$getSizePosit3.size;var s=r.getRotation();var a=e!=="sticker"?false:r.getFlipHorizontally();var l=e!=="sticker"?false:r.getFlipVertically();_this355.state.set(t,{tool:e,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l});};this.setStickerSize=function(t){var e=_this355.container[_this355.id];e.setSizeInWorldSpace(_this355.editor.previewSizeToWorld(t));var r=_this355.currentSprite;if(r){r.size=_this355.editor.worldSizeToPreview(e.getSizeInWorldSpace());_this355.state.set(_this355.id,r);}};this.setTextSize=function(t){var e=_this355.getContainerProperties(_this355.id);var r={width:_this355.editor.previewToWorld(t)};var o=r.width/e.width;var n={fontSize:Math.round(e.fontSize*o)};var s=_this355.isSpriteText?_objectSpread(_objectSpread({},r),n):r;if(r.width>_this355.minLength&&n.fontSize){_this355.setContainerProperties(_this355.id,s,true);e=_this355.getContainerProperties(_this355.id);_this355.textToolStore.changeFontSize(e.fontSize,true);_this355.textToolStore.changeWidth(e.width);}};this.setTextDesignScale=function(t){var e=_this355.getContainerProperties(_this355.id);var r=e.width*t;if(r>_this355.minLength){_this355.setContainerProperties(_this355.id,{width:r},true);var _this355$getContainer=_this355.getContainerProperties(_this355.id),o=_this355$getContainer.width;_this355.textDesignToolStore.changeWidth(o);e=_this355.getContainerProperties(_this355.id);_this355.textDesignToolStore.changePadding(e.padding);}};this.getSizePositionFromContainer=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this355.id;var e=_this355.container[t];if(e){var r=_this355.editor.worldToPreview(e.getPosition());var o=_this355.editor.worldSizeToPreview(e.getSizeInWorldSpace());return{position:r,size:o};}return{position:{x:0,y:0},size:{height:1,width:1}};};this.getSize=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this355.id;var e=_this355.container[t];if(e){return _this355.editor.worldSizeToPreview(e.getSizeInWorldSpace());}return{width:0,height:0};};this.editor=t;this.container={};this.stickerToolStore=new Pt(t);this.textToolStore=new gt(t);this.textDesignToolStore=new Mt(t);this.rect=new ze(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2);}_createClass(ef,[{key:"updateStateByHistoryState",value:function(){var _updateStateByHistoryState=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee57(t,e,r){var _this356=this;return regeneratorRuntime.wrap(function _callee57$(_context58){while(1){switch(_context58.prev=_context58.next){case 0:_context58.next=2;return(0,QH["default"])(t,/*#__PURE__*/function(){var _ref196=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee56(o){var n;return regeneratorRuntime.wrap(function _callee56$(_context57){while(1){switch(_context57.prev=_context57.next){case 0:n=e.common[o];if(n){_context57.next=3;break;}return _context57.abrupt("return");case 3:if(!_this356.state.get(o)){_context57.next=7;break;}_this356.updateExistingItem(o,e);_context57.next=9;break;case 7:_context57.next=9;return _this356.addNewItem(o,e);case 9:case"end":return _context57.stop();}}},_callee56);}));return function(_x62){return _ref196.apply(this,arguments);};}());case 2:t.forEach(function(o){var n=e.common[o];var s=_this356.container[o];if(!n||!s)return;s.setIndexInParent(n.order+r);});this.counter+=1;case 4:case"end":return _context58.stop();}}},_callee57,this);}));function updateStateByHistoryState(_x59,_x60,_x61){return _updateStateByHistoryState.apply(this,arguments);}return updateStateByHistoryState;}()},{key:"addNewItem",value:function(){var _addNewItem=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee58(t,e){var r,o,_this$editor$outputCo3,n,s,a,l,c,u,m,p,_m11;return regeneratorRuntime.wrap(function _callee58$(_context59){while(1){switch(_context59.prev=_context59.next){case 0:r=e.common[t];o=r.size?{width:this.editor.worldToPreview(r.size.width),height:this.editor.worldToPreview(r.size.height)}:void 0;_this$editor$outputCo3=this.editor.outputContainer.getData(),n=_this$editor$outputCo3.flipHorizontally,s=_this$editor$outputCo3.flipVertically;a=this.editor.outputContainer.getRotation();l=s!==n?r.rotation-a:r.rotation+a;c=s!==n?-l:l;u={spriteId:t,transform:{size:o,position:new O(r.position),rotation:c}};if(!e.text[t]){_context59.next=14;break;}m=e.text[t];p=this.textToolStore.validFontWithConfig(m.identifier);m.identifier=p==null?void 0:p.identifier;_context59.next=13;return this.addNewText(u,m);case 13:return _context59.abrupt("return");case 14:if(!e.textdesign[t]){_context59.next=18;break;}_context59.next=17;return this.addNewTextDesign(u,e.textdesign[t]);case 17:return _context59.abrupt("return");case 18:if(!e.sticker[t]){_context59.next=22;break;}_m11=this.stickerToolStore.items.find(function(p){return p.identifier===e.sticker[t].identifier;});_context59.next=22;return this.addNewSticker(u,_objectSpread(_objectSpread({},e.sticker[t]),{},{flipHorizontally:r.flipHorizontally,flipVertically:r.flipVertically,resizeMode:e.sticker[t].resizeMode||(_m11==null?void 0:_m11.resizeMode)||"keepAspect"}));case 22:case"end":return _context59.stop();}}},_callee58,this);}));function addNewItem(_x63,_x64){return _addNewItem.apply(this,arguments);}return addNewItem;}()},{key:"updateExistingItem",value:function updateExistingItem(t,e){var r=e.common[t];var o=this.state.get(t);this.state.set(t,o);var n=this.container[t];n.setPosition(new O(r.position));n.setRotation(r.rotation);o.rotation=n.getRotation();if(r.flipHorizontally!==void 0){n.setFlipHorizontally(r.flipHorizontally);}if(r.flipVertically!==void 0){n.setFlipVertically(r.flipVertically);}if(e.text[t]){var s=e.text[t];this.textToolStore.updateStateFromHistory(t,_objectSpread(_objectSpread({},s),{},{fontIdentifier:s.identifier}));}if(e.textdesign[t]){var _s7=e.textdesign[t];this.textDesignToolStore.updateStateFromHistory(t,_objectSpread(_objectSpread({},_s7),{},{inverted:_s7.isInverted}));}if(e.sticker[t]){n.setSizeInWorldSpace(r.size);this.stickerToolStore.updateStateFromHistory(t,e.sticker[t]);}this.updatePositionAndSize(t);}},{key:"currentSprite",get:function get(){if(this.isSpriteSelected){return this.state.get(this.id);}return void 0;}},{key:"padding",get:function get(){return this.textDesignToolStore.padding;}},{key:"isEditMode",get:function get(){return this.editMode.get();}},{key:"isDragMode",get:function get(){return this.dragMode.get();}},{key:"id",get:function get(){return this.selectedId.get();}},{key:"isSpriteSelected",get:function get(){return this.id!==tI;}},{key:"position",get:function get(){if(this.currentSprite){return this.currentSprite.position;}return void 0;}},{key:"tool",get:function get(){if(this.currentSprite){return this.currentSprite.tool;}return void 0;}},{key:"size",get:function get(){if(this.currentSprite){return this.currentSprite.size;}return void 0;}},{key:"rotation",get:function get(){if(this.currentSprite){return this.currentSprite.rotation;}return void 0;}},{key:"rotationWRTOutputRotation",get:function get(){if(this.currentSprite){var _this$editor$outputCo4=this.editor.outputContainer.getData(),t=_this$editor$outputCo4.flipHorizontally,e=_this$editor$outputCo4.flipVertically;var r=this.editor.outputContainer.getRotation();return $h({rotation:this.currentSprite.rotation-r,flipHorizontally:t,flipVertically:e});}return void 0;}},{key:"flipHorizontal",get:function get(){if(this.currentSprite){return this.currentSprite.flipHorizontally;}return void 0;}},{key:"isSpriteSticker",get:function get(){return this.tool==="sticker";}},{key:"isSpriteText",get:function get(){return this.tool==="text";}},{key:"isSpriteTextDesign",get:function get(){return this.tool==="textdesign";}},{key:"isOnTop",get:function get(){var t=this.counter;return this.editor.engine.isSpriteTop(this.id);}},{key:"spritePosition",get:function get(){if(this.currentSprite){var _this$currentSprite$p=this.currentSprite.position,t=_this$currentSprite$p.x,e=_this$currentSprite$p.y;var _this$currentSprite$s=this.currentSprite.size,r=_this$currentSprite$s.height,o=_this$currentSprite$s.width;return{x:Math.round(t-o/2),y:Math.round(e-r/2)};}return void 0;}},{key:"currentRect",get:function get(){if(this.currentSprite){return this.rect;}return void 0;}},{key:"leftTopPosition",get:function get(){if(this.currentSprite){return this.rect.leftTop;}return void 0;}},{key:"leftBottomPosition",get:function get(){if(this.currentSprite){return this.rect.leftBottom;}return void 0;}},{key:"leftMidPosition",get:function get(){if(this.currentSprite){return this.rect.leftMid;}return void 0;}},{key:"leftMidPadPosition",get:function get(){if(this.currentSprite){var t=this.rect.leftMid;return{x:t.x-this.editor.worldToPreview(this.padding),y:t.y};}return void 0;}},{key:"rightTopPosition",get:function get(){if(this.currentSprite){return this.rect.rightTop;}return void 0;}},{key:"rightBottomPosition",get:function get(){if(this.currentSprite){return this.rect.rightBottom;}return void 0;}},{key:"rightMidPosition",get:function get(){if(this.currentSprite){return this.rect.rightMid;}return void 0;}},{key:"rightMidPadPosition",get:function get(){if(this.currentSprite){var t=this.rect.rightMid;return{x:t.x+this.editor.worldToPreview(this.padding),y:t.y};}return void 0;}},{key:"leftBottomHandlePosition",get:function get(){if(this.currentSprite){return this.rect.leftBottomHandle;}return void 0;}},{key:"rightBottomHandlePosition",get:function get(){if(this.currentSprite){return this.rect.rightBottomHandle;}return void 0;}},{key:"historyLocale",get:function get(){if(this.isSpriteSticker){return this.stickerLocale;}if(this.isSpriteText){return this.textDesignLocale;}return this.textLocale;}},{key:"stickerLocale",get:function get(){return this.editor.configStore.locale["sticker"].history;}},{key:"textLocale",get:function get(){return this.editor.configStore.locale["text"].history;}},{key:"textDesignLocale",get:function get(){return this.editor.configStore.locale["textdesign"].history;}},{key:"setId",value:function setId(t){this.selectedId.set(t);}}],[{key:"magnitude",value:function magnitude(t,e){return new O(t,e||t).magnitude;}},{key:"sizeMagnitude",value:function sizeMagnitude(t){return Math.sqrt(t.width*t.width+t.height*t.height);}}]);return ef;}();nt=_ef;f([Q],nt.prototype,"counter",2);f([C],nt.prototype,"addSticker",2);f([C],nt.prototype,"addStickerAsync",2);f([C],nt.prototype,"addText",2);f([C],nt.prototype,"addTextAsync",2);f([C],nt.prototype,"addTextDesign",2);f([C],nt.prototype,"addTextDesignAsync",2);f([C],nt.prototype,"clickableCanvas",2);f([C],nt.prototype,"setContainerProperties",2);f([C],nt.prototype,"setContainerPosition",2);f([C],nt.prototype,"pureRemoveSprite",2);f([C],nt.prototype,"deleteSprite",2);f([C],nt.prototype,"removeSprite",2);f([C],nt.prototype,"addSnapshot",2);f([C],nt.prototype,"addNewText",2);f([C],nt.prototype,"addNewTextDesign",2);f([C],nt.prototype,"addNewSticker",2);f([C],nt.prototype,"updateStateFromSerialization",2);f([C],nt.prototype,"updateStateFromHistory",2);f([C],nt.prototype,"updateCanvasControls",2);f([C],nt.prototype,"setEditMode",2);f([C],nt.prototype,"setDragMode",2);f([C],nt.prototype,"setPosition",2);f([C],nt.prototype,"setSize",2);f([C],nt.prototype,"setRotation",2);f([C],nt.prototype,"onCanvasClick",2);f([C],nt.prototype,"select",2);f([C],nt.prototype,"selectLast",2);f([C],nt.prototype,"selectNext",2);f([C],nt.prototype,"deselect",2);f([C],nt.prototype,"bringToFront",2);f([C],nt.prototype,"flipHorizontally",2);f([C],nt.prototype,"pureReset",2);f([C],nt.prototype,"onCornerDrag",2);f([C],nt.prototype,"onWidthDrag",2);f([C],nt.prototype,"onPaddingDrag",2);f([C],nt.prototype,"correctTextFlip",2);f([C],nt.prototype,"reverseTextHorizontally",2);f([C],nt.prototype,"reverseTextVertically",2);f([C],nt.prototype,"dispose",2);f([S],nt.prototype,"currentSprite",1);f([S],nt.prototype,"padding",1);f([S],nt.prototype,"isEditMode",1);f([S],nt.prototype,"isDragMode",1);f([S],nt.prototype,"id",1);f([S],nt.prototype,"isSpriteSelected",1);f([S],nt.prototype,"position",1);f([S],nt.prototype,"tool",1);f([S],nt.prototype,"size",1);f([S],nt.prototype,"rotation",1);f([S],nt.prototype,"rotationWRTOutputRotation",1);f([S],nt.prototype,"flipHorizontal",1);f([S],nt.prototype,"isSpriteSticker",1);f([S],nt.prototype,"isSpriteText",1);f([S],nt.prototype,"isSpriteTextDesign",1);f([S],nt.prototype,"isOnTop",1);f([S],nt.prototype,"spritePosition",1);f([S],nt.prototype,"currentRect",1);f([S],nt.prototype,"leftTopPosition",1);f([S],nt.prototype,"leftBottomPosition",1);f([S],nt.prototype,"leftMidPosition",1);f([S],nt.prototype,"leftMidPadPosition",1);f([S],nt.prototype,"rightTopPosition",1);f([S],nt.prototype,"rightBottomPosition",1);f([S],nt.prototype,"rightMidPosition",1);f([S],nt.prototype,"rightMidPadPosition",1);f([S],nt.prototype,"leftBottomHandlePosition",1);f([S],nt.prototype,"rightBottomHandlePosition",1);f([S],nt.prototype,"historyLocale",1);f([S],nt.prototype,"stickerLocale",1);f([S],nt.prototype,"textLocale",1);f([S],nt.prototype,"textDesignLocale",1);});var tW=d(function(){eI();});var sct,fr;var iI=d(function(){Tt();R();sct={categories:[],query:""};fr=/*#__PURE__*/function(){function fr(t){var _this357=this;_classCallCheck(this,fr);this.initProvider=function(t){if(t){_this357.libraryProvider=new t();}};this.fetchImages=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee59(){var t,e,r,o,_args60=arguments;return regeneratorRuntime.wrap(function _callee59$(_context60){while(1){switch(_context60.prev=_context60.next){case 0:t=_args60.length>0&&_args60[0]!==undefined?_args60[0]:"";if(!_this357.libraryProvider){_context60.next=17;break;}e=null;_context60.prev=3;_context60.next=6;return _this357.libraryProvider.getCategories();case 6:r=_context60.sent;_context60.next=9;return _this357.libraryProvider.searchImages(t);case 9:o=_context60.sent;e=r.map(function(n,s){var a=o.filter(function(l){return l.category===n.name;});return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(function(l){return{name:l.title||"image".concat(s),identifier:"".concat(n.name,"-").concat(l.title,"-").concat(s),thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar};})};}).filter(function(n){return n.items.length;});_context60.next=16;break;case 13:_context60.prev=13;_context60.t0=_context60["catch"](3);console.log(_context60.t0);case 16:Ve(function(){_this357.state.query=t;_this357.state.categories=e;});case 17:case"end":return _context60.stop();}}},_callee59,null,[[3,13]]);}));this.toggleCategorySelection=function(t){_this357.selectedCategory=_this357.selectedCategory!==t?t:"";};this.dispose=function(){_this357.state=null;_this357.configStore=null;_this357.libraryProvider=null;_this357.selectedCategory=null;};this.getRawUrl=function(t){var e=_this357.items.findIndex(function(r){return r.identifier===t;});if(e!==-1){return _this357.items[e].rawUrl;}return t;};this.configStore=t.configStore;this.state=Q(sct);this.selectedCategory="";}_createClass(fr,[{key:"selectedCategoryIdentifier",get:function get(){return this.selectedCategory;}},{key:"categories",get:function get(){return this.state.categories;}},{key:"items",get:function get(){return this.state.categories.map(function(t){return t.items;}).reduce(function(t,e){return[].concat(_toConsumableArray(t),_toConsumableArray(e));},[]);}},{key:"query",get:function get(){return this.state.query;}},{key:"config",get:function get(){return this.configStore.config["library"];}},{key:"locale",get:function get(){return this.configStore.locale["library"];}}]);return fr;}();f([Q],fr.prototype,"selectedCategory",2);f([C],fr.prototype,"initProvider",2);f([C],fr.prototype,"fetchImages",2);f([C],fr.prototype,"toggleCategorySelection",2);f([C],fr.prototype,"dispose",2);f([S],fr.prototype,"selectedCategoryIdentifier",1);f([S],fr.prototype,"categories",1);f([S],fr.prototype,"items",1);f([S],fr.prototype,"query",1);f([S],fr.prototype,"config",1);f([S],fr.prototype,"locale",1);});var eW=d(function(){iI();});var iW,_Ri;var rW=d(function(){R();zn();U();iW=function iW(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"image/png";return"data:".concat(i,";base64,");};_Ri=/*#__PURE__*/function(){function Ri(t){var _this358=this;_classCallCheck(this,Ri);this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=function(t){var e=at.relativeToAbsolutePoint(t,_this358.cropSpace,false);return at.pointFromSpaceToSpace(e,_this358.cropSpace,_this358.imageSpace,false);};this.mapRelativeCropSizeToScaledImageSize=function(t){return t*Math.min(_this358.outputSize.height*_this358.outputScale.x,_this358.outputSize.width*_this358.outputScale.y);};this.mapRelativeCropSizeToUnscaledImageSize=function(t){return t*Math.min(_this358.outputSize.height,_this358.outputSize.width);};this.editor=t;}_createClass(Ri,[{key:"validateVersion",value:function validateVersion(t){return this.version===t;}},{key:"checkIsSerialisationValid",value:function checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object");}return false;}},{key:"deserializeImage",value:function deserializeImage(t){var e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(iW(),""):""};e.image.data=e.image.data?iW()+e.image.data:"";}return e;}},{key:"deserializeTransformation",value:function deserializeTransformation(t){var e={};var r=t.operations.find(function(s){return s.type==="orientation";});var o=t.operations.find(function(s){return s.type==="transform";});var _this$editor$engine$g=this.editor.engine.getRootContainers(),_this$editor$engine$g2=_slicedToArray(_this$editor$engine$g,1),n=_this$editor$engine$g2[0];this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=_Ri.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false;}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:"";}return e;}},{key:"deserialize",value:function deserialize(t){var _this359=this;var n,s;var e={};if(t.meta?!_Ri.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform");}var r=this.editor.engineMediator.output.container.getResolution();var _this$editor$engineMe2=this.editor.engineMediator.image.container.getBounds(),o=_this$editor$engineMe2.size;this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(function(a){switch(a.type){case"filter":e.filter=_Ri.deserializeFilter(a.options);break;case"adjustments":e.adjustment=_Ri.deserializeAdjustments(a.options);break;case"focus":e.focus=_this359.deserializeFocus(a.options);break;case"sprite":var l=a.options.sprites;l.forEach(function(c){switch(c.type){case"frame":e.frame=_this359.deserializeFrame(c.options);break;case"overlay":e.overlay=_Ri.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=_this359.deserializeBrush(c.options);}else{var _e$brush$strokes;(_e$brush$strokes=e.brush.strokes).push.apply(_e$brush$strokes,_toConsumableArray(_this359.deserializeBrush(c.options).strokes));}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}};}var u=At();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:_this359.spriteOrder,position:_this359.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};_this359.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:_this359.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:_this359.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=_Ri.deserializeStickers(c.options);}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=_this359.deserializeTexts(c.options);}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=_this359.deserializeTextDesign(c.options);}break;default:break;}});break;default:break;}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[];}return e;}},{key:"deserializeFrame",value:function deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:_Ri.deserialzeColor(t.tintColor)};}},{key:"deserializeFocus",value:function deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:break;}return void 0;}},{key:"deserializeRadialFocus",value:function deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeLinearFocus",value:function deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeGaussianFocus",value:function deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeMirroredFocus",value:function deserializeMirroredFocus(t){var e=new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new O(this.mapRelativeCropPointToImageSpace(t.start)).add(new O(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeTexts",value:function deserializeTexts(t){return{identifier:hn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:_Ri.deserialzeColor(t.color),backgroundColor:_Ri.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text};}},{key:"deserializeTextDesign",value:function deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:_Ri.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted};}},{key:"deserializeBrush",value:function deserializeBrush(t){var _this360=this;return{strokes:t.paths.map(function(e){return{path:{controlPoints:e.points.map(_this360.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:_Ri.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}};})};}}],[{key:"deserializeFilter",value:function deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier};}},{key:"deserializeAdjustments",value:function deserializeAdjustments(t){return _objectSpread({},t);}},{key:"deserializeOverlay",value:function deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,function(e){return e.toUpperCase().replace(" ","").replace("_","");})};}},{key:"initializeEmptyTransform",value:function initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0};}},{key:"deserialzeColor",value:function deserialzeColor(t){if(t){if(t.rgba){return t.rgba;}}return[0,0,0,0];}},{key:"checkIfPlatformHTML",value:function checkIfPlatformHTML(t){return t==="html5";}},{key:"deserializeStickers",value:function deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:_Ri.deserialzeColor(t.tintColor)};}}]);return Ri;}();});var oW,_Ai;var nW=d(function(){R();zn();U();oW=function oW(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"image/png";return"data:".concat(i,";base64,");};_Ai=/*#__PURE__*/function(){function Ai(t){var _this361=this;_classCallCheck(this,Ai);this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=function(t){var e=at.relativeToAbsolutePoint(t,_this361.cropSpace,false);return at.pointFromSpaceToSpace(e,_this361.cropSpace,_this361.imageSpace,false);};this.mapRelativeCropSizeToScaledImageSize=function(t){return t*Math.min(_this361.outputSize.height*_this361.outputScale.x,_this361.outputSize.width*_this361.outputScale.y);};this.mapRelativeCropSizeToUnscaledImageSize=function(t){return t*Math.min(_this361.outputSize.height,_this361.outputSize.width);};this.editor=t;}_createClass(Ai,[{key:"validateVersion",value:function validateVersion(t){return this.version===t;}},{key:"checkIsSerialisationValid",value:function checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object");}return false;}},{key:"deserializeImage",value:function deserializeImage(t){var e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(oW(),""):""};e.image.data=e.image.data?oW()+e.image.data:"";}return e;}},{key:"deserializeTransformation",value:function deserializeTransformation(t){var e={};var r=t.operations.find(function(s){return s.type==="orientation";});var o=t.operations.find(function(s){return s.type==="transform";});var _this$editor$engine$g3=this.editor.engine.getRootContainers(),_this$editor$engine$g4=_slicedToArray(_this$editor$engine$g3,1),n=_this$editor$engine$g4[0];this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=_Ai.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false;}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:"";}return e;}},{key:"deserialize",value:function deserialize(t){var _this362=this;var n,s;var e={};if(t.meta?!_Ai.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform");}var r=this.editor.engineMediator.output.container.getResolution();var _this$editor$engineMe3=this.editor.engineMediator.image.container.getBounds(),o=_this$editor$engineMe3.size;this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(function(a){switch(a.type){case"filter":e.filter=_Ai.deserializeFilter(a.options);break;case"adjustments":e.adjustment=_Ai.deserializeAdjustments(a.options);break;case"focus":e.focus=_this362.deserializeFocus(a.options);break;case"sprite":var l=a.options.sprites;l.forEach(function(c){switch(c.type){case"frame":e.frame=_this362.deserializeFrame(c.options);break;case"overlay":e.overlay=_Ai.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=_this362.deserializeBrush(c.options);}else{var _e$brush$strokes2;(_e$brush$strokes2=e.brush.strokes).push.apply(_e$brush$strokes2,_toConsumableArray(_this362.deserializeBrush(c.options).strokes));}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}};}var u=At();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:_this362.spriteOrder,position:_this362.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};_this362.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:_this362.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:_this362.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=_Ai.deserializeStickers(c.options);}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=_this362.deserializeTexts(c.options);}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=_this362.deserializeTextDesign(c.options);}break;default:break;}});break;default:break;}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[];}return e;}},{key:"deserializeFrame",value:function deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:_Ai.deserialzeColor(t.tintColor)};}},{key:"deserializeFocus",value:function deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:return void 0;}}},{key:"deserializeRadialFocus",value:function deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeLinearFocus",value:function deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeGaussianFocus",value:function deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeMirroredFocus",value:function deserializeMirroredFocus(t){var e=new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new O(this.mapRelativeCropPointToImageSpace(t.start)).add(new O(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeTexts",value:function deserializeTexts(t){return{identifier:hn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:_Ai.deserialzeColor(t.color),backgroundColor:_Ai.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text};}},{key:"deserializeTextDesign",value:function deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:_Ai.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted};}},{key:"deserializeBrush",value:function deserializeBrush(t){var _this363=this;return{strokes:t.paths.map(function(e){return{path:{controlPoints:e.points.map(_this363.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:_Ai.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}};})};}}],[{key:"deserializeFilter",value:function deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier};}},{key:"deserializeAdjustments",value:function deserializeAdjustments(t){return _objectSpread({},t);}},{key:"deserializeOverlay",value:function deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,function(e){return e.toUpperCase().replace(" ","").replace("_","");})};}},{key:"initializeEmptyTransform",value:function initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0};}},{key:"deserialzeColor",value:function deserialzeColor(t){if(t){if(t.rgba){return t.rgba;}}return[0,0,0,0];}},{key:"checkIfPlatformHTML",value:function checkIfPlatformHTML(t){return t==="html5";}},{key:"deserializeStickers",value:function deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:_Ai.deserialzeColor(t.tintColor)};}}]);return Ai;}();});var act,lct,cct,uct,dct,mct,pct,hct,fct,gct,bct,yct,_ct,xct,vct,aW;var sW=d(function(){act="@photoeditorsdk/root";lct="5.19.2";cct="The most comprehensive photo editor SDK for HTML5";uct="http://github.com/imgly/pesdk-html5";dct="PhotoEditorSDK (img.ly GmbH) ";mct="SEE LICENSE IN LICENSE.md";pct=true;hct={};fct={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};gct={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};bct={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};yct={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};_ct={eslint:"7.10.0"};xct=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];vct={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};aW={name:act,version:lct,description:cct,repository:uct,author:dct,license:mct,"private":pct,bin:hct,scripts:fct,devDependencies:gct,dependencies:bct,devEngines:yct,resolutions:_ct,workspaces:xct,husky:vct};});var _pu;var lW=d(function(){R();zn();sW();_pu=/*#__PURE__*/function(){function pu(t,e,r,o,n,s){var _this364=this;_classCallCheck(this,pu);this.version="3.12.0";this.mapImagePointToRelativeCropPoint=function(t){var e=at.pointFromSpaceToSpace(t,_this364.imageSpace,_this364.cropSpace,false);return at.absoluteToRelativePoint(e,_this364.cropSpace,false);};this.mapSizeToRelativeUnscaledCropSize=function(t){return t/Math.min(_this364.outputSize.height,_this364.outputSize.width);};this.mapSizeToRelativeScaledCropSize=function(t){return t/Math.min(_this364.outputSize.height*_this364.outputScale.x,_this364.outputSize.width*_this364.outputScale.y);};this.getPointInDirection=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3;var o=Math.tan(e);var n=Math.sqrt(Math.pow(o,2)+1);return{x:t.x+r/n,y:t.y+r*o/n};};this.previewPosition=t;this.previewSize=e;this.outputSize=r;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale();}_createClass(pu,[{key:"serialise",value:function serialise(t,e,r){var _this365=this;var o=_pu.serializeMetaData();var n={width:this.imageSize.width,height:this.imageSize.height};if(e){n.type=r;n.data=e;}var s=[];var a=[];var l=t.adjustment;if(Object.keys(l).map(function(x){return l[x];}).filter(Boolean).length){s.push(_pu.serializeAdjustments(l));}var c=t.filter;if(c.identifier!=="identity"){s.push(_pu.serializeFilters(c));}var u=t.overlay;if(u.identifier!=="identity"){a.push(_pu.serializeOverlay(u));}if(t.transform){var _this$serializeTransf=this.serializeTransform(t.transform),x=_this$serializeTransf.transform,v=_this$serializeTransf.orientation;var b=[x.options.start.x!==0,x.options.start.y!==0,x.options.end.x!==1,x.options.end.y!==1,x.options.rotation!==0];var T=[v.options.rotation!==0,v.options.flipVertically!==false,v.options.flipHorizontally!==false];if(b.some(function(k){return k;})){s.push(x);}if(T.some(function(k){return k;})){s.push(v);}}var m=t.frame;if(m.identifier!=="identity"){a.push(this.serialzeFrame(m));}var p=t.focus;if(p.identifier!=="identity"){s.push(this.serializeFocus(p));}if(t.sprite){t.sprite.spriteIdList.forEach(function(x){var v=t.sprite.common[x];switch(v.tool){case"sticker":var _b9=t.sprite.sticker[x];a.push(_this365.serializeSticker(_b9,v,t.transform));break;case"text":var _T3=t.sprite.text[x];a.push(_this365.serializeText(_T3,v));break;case"textdesign":var k=t.sprite.textdesign[x];a.push(_this365.serializeTextDesign(k,v));break;default:break;}});}if(t.brush.strokes.length){a.push({type:"brush",options:{paths:t.brush.strokes.map(function(x){return{points:x.path.controlPoints.map(_this365.mapImagePointToRelativeCropPoint),brush:{color:{rgba:x.brush.color},size:x.brush.size,hardness:x.brush.hardness}};})}});}if(a.length){var _x65={type:"sprite",options:{sprites:a}};s.push(_x65);}var h=t.customStickers;var g={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:g};}},{key:"serialzeFrame",value:function serialzeFrame(t){return{type:"frame",options:{identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.color},size:this.mapSizeToRelativeUnscaledCropSize(t.width)}};}},{key:"serializeFocus",value:function serializeFocus(t){var e=Math.sqrt(Math.pow(this.previewSize.width,2)+Math.pow(this.previewSize.height,2));switch(t.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(t.linear.start),end:this.mapImagePointToRelativeCropPoint(t.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(t.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(t.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(t.radial.center,0,t.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(t.radial.blurRadius),gradientRadius:.1}}};case"mirrored":var r=t.mirrored;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,e/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,-e/2)),size:this.mapSizeToRelativeScaledCropSize(t.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(t.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(t.gaussian.blurRadius)}}};}}},{key:"serializeSticker",value:function serializeSticker(t,e,r){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(e.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(e.size.width),y:this.mapSizeToRelativeScaledCropSize(e.size.height)},rotation:e.rotation,flipVertically:(e.flipVertically||false)!==(r.flipVertically||false),flipHorizontally:(e.flipHorizontally||false)!==(r.flipHorizontally||false),identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.tintColor},tintMode:t.tintMode}};}},{key:"serializeText",value:function serializeText(t,e){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:t.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(t.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(t.width),text:t.text,lineHeight:t.lineHeight,color:{rgba:t.textColor},backgroundColor:{rgba:t.backgroundColor},alignment:t.alignment}};}},{key:"serializeTextDesign",value:function serializeTextDesign(t,e){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,identifier:t.identifier,inverted:t.isInverted,text:t.text,seed:t.seed,width:this.mapSizeToRelativeScaledCropSize(t.width),padding:this.mapSizeToRelativeScaledCropSize(t.padding),color:{rgba:t.color}}};}},{key:"serializeTransform",value:function serializeTransform(t){var e=t.start,r=t.end;var o={type:"transform",options:{start:e,end:r,rotation:t.rotation,meta:{identifier:t.identifier}}};var n={type:"orientation",options:{rotation:t.outputRotation,flipHorizontally:t.flipHorizontally,flipVertically:t.flipVertically}};return{transform:o,orientation:n};}}],[{key:"serializeFilters",value:function serializeFilters(t){return{type:"filter",options:{intensity:t.intensity,identifier:t.identifier}};}},{key:"serializeAdjustments",value:function serializeAdjustments(t){return{type:"adjustments",options:t};}},{key:"serializeOverlay",value:function serializeOverlay(t){return{type:"overlay",options:{identifier:t.identifier,intensity:t.opacity,blendMode:t.blendMode.replace(/[A-Z]/g,function(e){return" ".concat(e.toLowerCase());})}};}},{key:"serializeMetaData",value:function serializeMetaData(){return{platform:"html5",version:aW.version,createdAt:new Date().toISOString()};}}]);return pu;}();});var rI={};de(rI,{Deserializers:function Deserializers(){return Cct;},Serializer:function Serializer(){return _pu;}});var Cct;var oI=d(function(){rW();nW();lW();Cct={"3.9.0":_Ai,"3.12.0":_Ri};});var cW,Sct,wct,Tct,_rf;var uW=d(function(){Tt();R();U();cW=/^data:image\/(.+?);base64,/;Sct=function Sct(i){return cW.test(i);};wct=function wct(i){return i.match(/^data:([^;]+)/)[1];};Tct=function Tct(i){return i.replace(cW,"");};_rf=/*#__PURE__*/function(){function rf(t){var _this366=this;_classCallCheck(this,rf);this.applySerialization=/*#__PURE__*/function(){var _ref198=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee60(t,e,r,o){var n,s,a,u,l,c;return regeneratorRuntime.wrap(function _callee60$(_context61){while(1){switch(_context61.prev=_context61.next){case 0:_this366.editor.resetToolStates();n=_this366.editor.activeStore.tool==="transform";if(!n){_this366.editor.transformToolStore.onEnter();}_this366.editor.transformToolStore.reset();if(!n){_this366.editor.transformToolStore.onLeave();}s="Unexpected error occured";a=e.deserializeImage(t);if(!(a.image&&a.image.data)){_context61.next=23;break;}u=a.image.data;_context61.next=11;return _this366.editor.setImage(u);case 11:_this366.editor.scale.defaultScale=1;_this366.editor.scale.resetOffset();_this366.editor.transformToolStore.reset();_this366.editor.activeStore.setImage(u);_context61.next=17;return _this366.editor.engineMediator.image.addImageToContainer();case 17:_this366.editor.engineMediator.output.applyNewImageTransform();_this366.editor.engineMediator.preview.updateTransform();_this366.editor.scale.setInitialTransform();_this366.editor.transformToolStore.setCropDefaults();_this366.editor.historyStore.addInitialSnapshot();_this366.editor.transformToolStore.saveTransforms();case 23:l=e.deserializeTransformation(t);if(l){_context61.next=27;break;}o(s);return _context61.abrupt("return");case 27:_context61.next=29;return _this366.applyStateOnUI(l);case 29:c=e.deserialize(t);if(c){_context61.next=33;break;}o(s);return _context61.abrupt("return");case 33:_context61.next=35;return _this366.applyStateOnUI(c);case 35:_this366.editor.historyStore.addInitialSnapshot();if(n){_this366.editor.transformToolStore.onEnter();}_context61.next=39;return _this366.editor.render();case 39:if(_this366.editor.modalStore.identifier==="loading"){_this366.editor.modalStore.hideModal();}r();case 41:case"end":return _context61.stop();}}},_callee60);}));return function(_x66,_x67,_x68,_x69){return _ref198.apply(this,arguments);};}();this.editor=t;}_createClass(rf,[{key:"serialize",value:function serialize(){var _this367=this;var _ref199=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{image:false},t=_ref199.image;var e=this.editor.activeStore.tool==="transform";var r=this.editor.configStore.config.displaySerializationModal;if(r){this.editor.modalStore.showInfoModal("saving");}return new Promise(function(o,n){Promise.resolve().then(function(){return oI(),rI;}).then(/*#__PURE__*/function(){var _ref201=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee61(_ref200){var s,_m12,_this367$editor$image,a,l,c,u,m,_yield$_this367$edito,p,h,g,x,v;return regeneratorRuntime.wrap(function _callee61$(_context62){while(1){switch(_context62.prev=_context62.next){case 0:s=_ref200.Serializer;_context62.prev=1;if(e){_this367.editor.transformToolStore.onLeave();}_context62.next=5;return _this367.editor.wait();case 5:_this367.editor.transformToolStore.applyDefaultCrop(false);_this367$editor$image=_this367.editor.imageContainer.getData(),a=_this367$editor$image.originalImage;l=_this367.editor.engineMediator.output.container.getResolution();c={width:a.width,height:a.height};u=new s(_this367.editor.transformToolStore.defaultCropMaskPosition,_this367.editor.transformToolStore.maxCropMaskSize,l,c,_this367.editor.engine.getRootContainers()[0],_this367.editor.engine.getOutputContainer());m=(_m12={},_defineProperty(_m12,"adjustment",ct(_this367.editor.adjustmentsToolStore.state)),_defineProperty(_m12,"filter",ct(_this367.editor.filterToolStore.state)),_defineProperty(_m12,"focus",ct(_this367.editor.focusToolStore.serializableState)),_defineProperty(_m12,"overlay",ct(_this367.editor.overlayToolStore.state)),_defineProperty(_m12,"frame",ct(_this367.editor.frameToolStore.state)),_defineProperty(_m12,"brush",_this367.editor.brushToolStore.strokes||{strokes:[]}),_m12);_context62.next=13;return _this367.editor.spriteStore.serializableState();case 13:_yield$_this367$edito=_context62.sent;p=_yield$_this367$edito.sprite;h=_yield$_this367$edito.customStickers;p.spriteIdList=p.spriteIdList.sort(function(v,b){var T=p.common[v].order;var k=p.common[b].order;return T-k;});m.sprite=p;m.customStickers=h;m.transform=_this367.editor.transformToolStore.serializableState;if(t){v=_rf.getDataURL(a);x=wct(v);g=Tct(v);}if(r){_this367.editor.modalStore.hideModal();}o(u.serialise(m,g,x));if(e){_this367.editor.transformToolStore.onEnter();}_context62.next=30;break;case 26:_context62.prev=26;_context62.t0=_context62["catch"](1);if(r){_this367.editor.modalStore.hideModal();}n(_context62.t0);case 30:case"end":return _context62.stop();}}},_callee61,null,[[1,26]]);}));return function(_x70){return _ref201.apply(this,arguments);};}());});}},{key:"deserialize",value:function deserialize(t){var _this368=this;this.editor.modalStore.showInfoModal("loading");return new Promise(function(e,r){try{Promise.resolve().then(function(){return oI(),rI;}).then(function(_ref202){var o=_ref202.Deserializers;var n=t.version.match(/[0-3].[0-8].[0-9]/i);var s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](_this368.editor);}else if(o[t.version]){s=new o[t.version](_this368.editor);}else{s=new o["3.12.0"](_this368.editor);}if(n){_this368.editor.modalStore.hideModal();_this368.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:function handleConfirm(){return _this368.applySerialization(t,s,e,r);}});}else{_this368.applySerialization(t,s,e,r);}});}catch(o){if(_this368.editor.modalStore.identifier==="loading"){_this368.editor.modalStore.hideModal();}r(o);}});}},{key:"applyStateOnUI",value:function(){var _applyStateOnUI=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee62(t){var _this369=this;var e,r;return regeneratorRuntime.wrap(function _callee62$(_context63){while(1){switch(_context63.prev=_context63.next){case 0:e=this.editor.activeStore.tool==="transform";_context63.prev=1;if(!t.transform){_context63.next=13;break;}if(!e){this.editor.transformToolStore.onEnter();}this.editor.transformToolStore.updateStateFromSerialization(t.transform);_context63.next=7;return this.editor.wait();case 7:this.editor.transformToolStore.onLeave();if(e){_context63.next=13;break;}this.editor.transformToolStore.onEnter();_context63.next=12;return this.editor.wait();case 12:this.editor.transformToolStore.onLeave();case 13:if(!t.filter){_context63.next=16;break;}_context63.next=16;return this.editor.filterToolStore.updateStateFromSerialization(t.filter);case 16:if(t.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(t.adjustment);}if(!t.focus){_context63.next=20;break;}_context63.next=20;return this.editor.focusToolStore.updateStateFromSerialization(t.focus);case 20:if(!t.overlay){_context63.next=23;break;}_context63.next=23;return this.editor.overlayToolStore.updateStateFromSerialization(t.overlay);case 23:if(!t.sprite){_context63.next=29;break;}r=Object.keys(t).length-1;if(t.customStickers){r-=1;}t.sprite.spriteIdList=t.sprite.spriteIdList.sort(function(o,n){var s=t.sprite.common[o].order;var a=t.sprite.common[n].order;return s-a;});_context63.next=29;return this.editor.spriteStore.updateStateFromSerialization(t.sprite,t.customStickers,Math.max(0,r));case 29:if(t.brush){this.editor.brushToolStore.updateStateFromHistory(t.brush);}if(!t.frame){_context63.next=33;break;}_context63.next=33;return this.editor.frameToolStore.updateStateFromSerialization(t.frame);case 33:this.editor.outputContainer.updateChildrenContainers();_context63.next=39;break;case 36:_context63.prev=36;_context63.t0=_context63["catch"](1);if(_context63.t0.name==="AssetNotFoundError"){console.error(_context63.t0);}else{console.error(_context63.t0);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:_context63.t0.message,handleConfirm:function handleConfirm(){_this369.applyStateOnUI(t);}});}case 39:case"end":return _context63.stop();}}},_callee62,this,[[1,36]]);}));function applyStateOnUI(_x71){return _applyStateOnUI.apply(this,arguments);}return applyStateOnUI;}()}],[{key:"getDataURL",value:function getDataURL(t){if(t instanceof HTMLImageElement){var n=t.src;if(Sct(n)){return n;}}if(t instanceof HTMLCanvasElement){return t.toDataURL("image/png");}var e=document.createElement("canvas");e.width=t.width;e.height=t.height;var r=e.getContext("2d");r.drawImage(t,0,0);var o=e.toDataURL("image/png");$t(e);return o;}}]);return rf;}();});var kct,nI;var dW=d(function(){kct=function kct(i){var t=atob(i.split(",")[1]);var e=i.split(",")[0].split(":")[1].split(";")[0];var r=new ArrayBuffer(t.length);var o=new Uint8Array(r);for(var n=0;nt){return t-r;}for(var n=0;n=a-m){return a+u+(o?r*2:0);}return _this376.mapRange({value:t,fromMin:s,fromLength:a-s,toMin:l,toLength:c-l});}}if(o){return t+(e.length-1)*r*2+r;}return t;};this.mapFromSnapSystem=function(t,e,r,o){if(e.length===0){return t;}if(e[0]>t){if(t>=e[0]-r){return e[0];}return t+r;}var n=t;for(var a=0;a1&&_args71[1]!==undefined?_args71[1]:false;_context71.prev=1;if(_this377.activeStore.image){_context71.next=6;break;}_this377.initWithImage(t);_context71.next=34;break;case 6:_this377.activeStore.setImageLoadedToEngine(false);_this377.modalStore.showInfoModal(_this377.configStore.config.displayResizeWarning?"resizing":"loading");_this377.scale.defaultScale=1;_this377.scale.resetOffset();_context71.next=12;return _this377.activeStore.setImage(t);case 12:_context71.next=14;return _this377.engineMediator.image.addImageToContainer();case 14:_this377.canvasStore.resizeCanvas();_this377.engineMediator.output.applyNewImageTransform();_this377.engineMediator.preview.updateTransform();_this377.scale.setInitialTransform();_this377.transformToolStore.setCropDefaults();_this377$transformToo=_this377.transformToolStore.rotateFlipState,_r22=_this377$transformToo.flipHorizontally,o=_this377$transformToo.flipVertically,n=_this377$transformToo.outputRotation;_this377.outputContainer.setData({flipVertically:o,flipHorizontally:_r22});_context71.next=23;return _this377.transformToolStore.rotateOutputContainer(xp(n),false);case 23:if(e){_this377.focusToolStore.updateCanvasControls();_this377.spriteStore.updateCanvasControls();_this377.transformToolStore.resetCrop();_this377.transformToolStore.applyDefaultCrop();_this377.transformToolStore.saveTransforms();_this377.transformToolStore.onEnter();_this377.transformToolStore.setRotation(_this377.transformToolStore.rotationInDegrees);_this377.transformToolStore.onLeave();_this377.transformToolStore.onEnter();_this377.transformToolStore.onLeave();}else{_this377.transformToolStore.saveTransforms();}_this377.snappingStore.calculatePreviewTopLeftPosition();_this377.historyStore.addInitialSnapshot();_context71.next=28;return _this377.renderPromise();case 28:if(_this377.configStore.config.filter.enablePreviewThumbnails&&_this377.configStore.config.engine.preferredRenderer==="webgl"){_this377.filterToolStore.setImageAndGetPreviews();}s=_this377.activeStore.tool;if(!s){_this377.onReady();}else{_this377.configStore.events.onImageLoaded();}if(!(_this377.modalStore.identifier==="imageResized")){_this377.modalStore.hideModal();}_this377.activeStore.setImageLoadedToEngine(true);_this377.resize();case 34:_context71.next=42;break;case 36:_context71.prev=36;_context71.t0=_context71["catch"](1);_this377.configStore.events.onErrorImageLoading(_context71.t0);_this377.modalStore.hideModal();_this377.modalStore.showActionModal({type:"error",identifier:_context71.t0.identifier?_context71.t0.identifier:"rendering",error:_context71.t0,handleConfirm:function handleConfirm(){_this377.setImage(t,e);},handleDismiss:function handleDismiss(){_this377.activeStore.setImage(void 0);}});throw new Error(_context71.t0);case 42:case"end":return _context71.stop();}}},_callee70,null,[[1,36]]);}));return function(_x79){return _ref211.apply(this,arguments);};}();this.onToolChange=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var o,n;if(t===e){return;}if((n=(o=_this377.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([t,e].indexOf("transform")!==-1){if(t==="transform"){_this377.transformToolStore.onLeave();_this377.transformToolStore.addSnapshot();_this377.snappingStore.calculatePreviewTopLeftPosition();}else if(e==="transform"){_this377.transformToolStore.onEnter();}_this377.resize(e);}else{_this377.scale.resetOffset();_this377.scale.resetPosition();_this377.scale.setScaleToDefault();_this377.scale.scaleRender(true);}if(r){_this377.render();}}};this.resize=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;if(!_this377.engineMediator)return;try{var _e33=_this377.activeStore.tool;var _r23=t==="transform"||!t&&_e33==="transform";_this377.canvasStore.resizeCanvas(t);_this377.transformToolStore.applyDefaultCrop();var o=ct(_this377.transformToolStore.maxCropMaskSize);if(!_r23){_this377.transformToolStore.onEnter();}var n=_this377.engineMediator.preview.container.getRotation();var s=_this377.engineMediator.preview.updateTransform(n);if(s){_this377.scale.setInitialTransform();_this377.transformToolStore.setCropDefaults();_this377.transformToolStore.updateCanvasControls(o);_this377.focusToolStore.updateCanvasControls();_this377.spriteStore.updateCanvasControls();var a=_this377.transformToolStore.getScaleWithFlip(n);_this377.engineMediator.preview.container.setScale(a);if(!_r23){_this377.transformToolStore.onLeave();_this377.transformToolStore.onEnter();_this377.transformToolStore.onLeave();}_this377.snappingStore.calculatePreviewTopLeftPosition();_this377.render();}}catch(e){_this377.configStore.events.onErrorImageLoading(e);_this377.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:function handleConfirm(){_this377.resize(t);},handleDismiss:function handleDismiss(){_this377.activeStore.setImage(void 0);}});}};this["export"]=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee71(){var _ref213,t,e,r,o,n,s,a,l,c,u,m,_args72=arguments;return regeneratorRuntime.wrap(function _callee71$(_context72){while(1){switch(_context72.prev=_context72.next){case 0:_ref213=_args72.length>0&&_args72[0]!==undefined?_args72[0]:{},t=_ref213.preventExportEvent,e=_objectWithoutProperties(_ref213,_excluded7);r=_this377.activeStore.tool==="transform";_context72.prev=2;_this377.modalStore.showInfoModal("exporting");if(r){_this377.transformToolStore.onLeave();}o=_this377.configStore.config;n=_objectSpread(_objectSpread({},o["export"].image),e);s=n.exportType,a=n.format,l=n.quality,c=n.enableDownload,u=n.transparent;_context72.next=10;return _this377.engineMediator.engine["export"](s,a,l,u);case 10:m=_context72.sent;if(!(r&&_this377.transformToolStore)){_context72.next=15;break;}_this377.transformToolStore.onEnter();_context72.next=15;return _this377.render();case 15:if(_this377.historyStore){_this377.historyStore.isDirtySinceSave=false;}if(_this377.modalStore){_this377.modalStore.hideModal();}if(c){_this377.triggerFileDownload(o["export"].filename,a,s,m);}if(!t){_this377.configStore.events.onExport(m);}return _context72.abrupt("return",m);case 22:_context72.prev=22;_context72.t0=_context72["catch"](2);if(_this377.modalStore){_this377.modalStore.hideModal();}if(!(r&&_this377.transformToolStore)){_context72.next=29;break;}_this377.transformToolStore.onEnter();_context72.next=29;return _this377.render();case 29:throw new Error(_context72.t0);case 30:case"end":return _context72.stop();}}},_callee71,null,[[2,22]]);}));this.serialize=function(){var _ref214=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{image:true},t=_ref214.image;if(_this377.serializationMediator){return _this377.serializationMediator.serialize({image:t});}return Promise.resolve({});};this.deserialize=function(t){if(_this377.serializationMediator){return _this377.serializationMediator.deserialize(t);}return Promise.resolve();};this.close=function(){var t,e,r,o,n,s;if((((t=_this377.historyStore)==null?void 0:t.isDirtySinceSave)||((r=(e=_this377.transformToolStore)==null?void 0:e.transformHistory)==null?void 0:r.hasChanges()))&&((n=(o=_this377.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&_this377.modalStore){_this377.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:function handleConfirm(){var a;if((a=_this377.configStore)==null?void 0:a.events){_this377.configStore.events.onClose();}}});}else if((s=_this377.configStore)==null?void 0:s.events){_this377.configStore.events.onClose();}};this.hasChanges=function(){if(_this377.historyStore){return _this377.historyStore.isDirtySinceSave;}return false;};this.getImageDimensions=function(){if(_this377.engine){var _this377$engine$getOu=_this377.engine.getOutputDimensions(),_t45=_this377$engine$getOu.width,_e34=_this377$engine$getOu.height;return{width:_t45,height:_e34};}return{width:0,height:0};};this.wait=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new Promise(function(e){return setTimeout(e,t);});};this.clickableCanvas=/*#__PURE__*/function(){var _ref215=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee72(t){return regeneratorRuntime.wrap(function _callee72$(_context73){while(1){switch(_context73.prev=_context73.next){case 0:if(!t){_context73.next=6;break;}_context73.next=3;return new Promise(function(e){return setTimeout(e,0);});case 3:_this377.canvasStore.enableCanvasClick();_context73.next=7;break;case 6:_this377.canvasStore.disableCanvasClick();case 7:case"end":return _context73.stop();}}},_callee72);}));return function(_x80){return _ref215.apply(this,arguments);};}();this.onReady=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee73(){var t,_e35,_r24,o;return regeneratorRuntime.wrap(function _callee73$(_context74){while(1){switch(_context74.prev=_context74.next){case 0:t=_this377.configStore.config.forceCrop;_this377.activeStore.selectTool(_this377.configStore.defaultTool);if(t){_e35=_this377.transformToolStore.localOutputImageSize;_r24=_e35.width/_e35.height;o=_this377.transformToolStore.entityManager.items.map(function(n){if(n.ratio){return n.ratio;}return n.dimensions.x/n.dimensions.y;});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios');}else if(o.indexOf(parseFloat(_r24.toFixed(2)))===-1){_this377.activeStore.selectTool("transform");}}_this377.configStore.events.onEditorReady();case 4:case"end":return _context74.stop();}}},_callee73);}));this.addSnapshot=function(t,e,r){_this377.historyStore.addSnapshot(t,e,r);};this.resetToolStates=function(){_this377.transformToolStore.pureReset();_this377.filterToolStore.pureReset();_this377.focusToolStore.pureReset();_this377.adjustmentsToolStore.pureReset();_this377.overlayToolStore.pureReset();_this377.frameToolStore.pureReset();_this377.brushToolStore.pureReset();_this377.spriteStore.pureReset();_this377.historyStore.reset();_this377.render();};this.getAssetPath=function(t){return _this377.assetProvider.getPathForCategory(t);};this.render=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee74(){return regeneratorRuntime.wrap(function _callee74$(_context75){while(1){switch(_context75.prev=_context75.next){case 0:_context75.next=2;return _this377.renderPromise();case 2:case"end":return _context75.stop();}}},_callee74);}));this.applyFlipToPreview=function(t){if(!_this377.engineMediator)return{x:0,y:0};return _this377.engineMediator.previewSpaceToFlippedPreviewSpace(t);};this.getPreviewSize=function(){if(!_this377.engine)return{width:0,height:0};var _this377$engine$getOu2=_this377.engine.getOutputDimensions(),t=_this377$engine$getOu2.width,e=_this377$engine$getOu2.height;if(t&&e){return{width:Math.round(_this377.worldToPreview(_this377.outputToWorld(t))),height:Math.round(_this377.worldToPreview(_this377.outputToWorld(e)))};}return{height:e,width:t};};this.getImageMimeType=function(){return pW(_this377.activeStore.image);};this.cleanUpCanvasMemory=function(){var t,e,r;(r=(e=(t=_this377.engineMediator)==null?void 0:t.image)==null?void 0:e.container)==null?void 0:r.dispose();};this.dispose=function(){if(_this377.engineMediator){_this377.engineMediator.dispose();_this377.engineMediator=null;}_this377.serializationMediator=null;if(_this377.spriteStore){_this377.spriteStore.dispose();_this377.spriteStore=null;}_this377.scale=null;_this377.filterToolStore=null;_this377.adjustmentsToolStore=null;_this377.focusToolStore=null;_this377.overlayToolStore=null;_this377.frameToolStore=null;_this377.brushToolStore=null;if(_this377.transformToolStore){_this377.transformToolStore.dispose();_this377.transformToolStore=null;}if(_this377.libraryStore){_this377.libraryStore.dispose();_this377.libraryStore=null;}if(_this377.modalStore){_this377.modalStore.dispose();_this377.modalStore=null;}if(_this377.snappingStore){_this377.snappingStore.dispose();_this377.snappingStore=null;}if(_this377.activeStore){_this377.activeStore.dispose();_this377.activeStore=null;}if(_this377.canvasStore){_this377.canvasStore.dispose();_this377.canvasStore=null;}_this377.historyStore=null;if(_this377.configStore){_this377.configStore.dispose();_this377.configStore=null;}};this.triggerFileDownload=function(t,e,r,o){var n=e==="image/jpeg"&&r!=="ms-blob"?".jpeg":".png";var s=t+n;var a=_this377.blobFromExportData(o);_this377.triggerBlobDownload(s,a);};this.triggerBlobDownload=function(t,e){if(navigator.msSaveBlob){navigator.msSaveBlob(e,t);}else{var _r25=document.createElement("a");var o=URL.createObjectURL(e);_r25.href=o;_r25.download=t;document.body.appendChild(_r25);_r25.click();document.body.removeChild(_r25);if(!HF()){URL.revokeObjectURL(o);}}};this.blobFromExportData=function(t){if(typeof t==="string"){return nI(t);}if(t instanceof HTMLImageElement){return nI(t.src);}return t;};this.configStore=new Qi();if(e){Object.entries(e).forEach(function(_ref218){var _ref219=_slicedToArray(_ref218,2),o=_ref219[0],n=_ref219[1];_this377.configStore.events.on(o,n);});}var r=this.configStore.saveConfig(t);this.engineMediator=new Vk(this);this.serializationMediator=new _rf(this);this.spriteStore=new nt(this);this.scale=new ti(this);this.filterToolStore=new He(this);this.adjustmentsToolStore=new Zt(this);this.focusToolStore=new Bt(this);this.overlayToolStore=new Ze(this);this.frameToolStore=new Be(this);this.brushToolStore=new Ie(this);this.transformToolStore=new tt(this);this.libraryStore=new fr(this);this.modalStore=new Wr(this);this.snappingStore=new $o(this);this.activeStore=new hr(this);this.canvasStore=new Oi(this);this.historyStore=new du(this);this.libraryStore.initProvider(r);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image);}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool);}}}_createClass(Sl,[{key:"shortestOutputSide",get:function get(){var t=this.outputContainer.getBounds();return Math.min(t.width,t.height);}},{key:"assetProvider",get:function get(){return this.configStore.assetProvider;}},{key:"engine",get:function get(){if(!this.engineMediator)return null;return this.engineMediator.engine;}},{key:"imageContainer",get:function get(){if(!this.engineMediator)return null;return this.engineMediator.image.container;}},{key:"orderHelper",get:function get(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper;}},{key:"renderPromise",value:function renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container);}},{key:"previewToWorld",value:function previewToWorld(t,e){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.previewSpaceToWorldSpace(t,e);}return this.engineMediator.previewSpaceToWorldSpace(t,e);}},{key:"worldToPreview",value:function worldToPreview(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.worldSpaceToPreviewSpace(t);}return this.engineMediator.worldSpaceToPreviewSpace(t);}},{key:"worldSizeToPreview",value:function worldSizeToPreview(t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(t.width),height:this.engineMediator.worldSpaceToPreviewSpace(t.height)};}},{key:"previewSizeToWorld",value:function previewSizeToWorld(t,e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(t.width,e),height:this.engineMediator.previewSpaceToWorldSpace(t.height,e)};}},{key:"outputToWorld",value:function outputToWorld(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.outputSpaceToWorldSpace(t);}return this.engineMediator.outputSpaceToWorldSpace(t);}},{key:"previewToOutput",value:function previewToOutput(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.previewSpaceToOutputSpace(t);}return this.engineMediator.previewSpaceToOutputSpace(t);}},{key:"outputContainer",get:function get(){return this.engineMediator.output.container;}}]);return Sl;}();f([C],Sl.prototype,"resize",2);f([C],Sl.prototype,"export",2);f([C],Sl.prototype,"clickableCanvas",2);});var Xt=d(function(){U();pr();tv();oH();ak();ck();uk();mk();_H();SH();wH();Tk();DH();ZH();tW();eW();bv();pv();gW();Ak();dv();hv();fv();gv();sI();Yh();Qh();Jh();vl();Nn();hm();});var nf,sf,bW,yW,Dct,Ect,_W;var xW=d(function(){nf=y(_("react"));B();sf=y(_("styled-components"));R();Xt();U();$e();bW=mt.Button.TextSecondary;yW=sf["default"].span(_templateObject189||(_templateObject189=_taggedTemplateLiteral(["\n font-size: 14px;\n padding: 3px 1px 2px;\n color: ",";\n letter-spacing: ","px;\n display: flex;\n align-self: center;\n"])),function(i){return i.theme.canvasActionBar.foreground;},function(i){return i.theme.measurements.fontSystem.button2.letterSpacing;});Dct=sf["default"].div(_templateObject190||(_templateObject190=_taggedTemplateLiteral(["\n display: inline-flex;\n ","\n"])),function(i){return i.isDisabled&&sf.css(_templateObject191||(_templateObject191=_taggedTemplateLiteral(["\n opacity: 0.5;\n cursor: default;\n pointer-events: none;\n "])));});Ect=function Ect(_ref220){var i=_ref220.isDisabled,t=_ref220.scale,e=_ref220.active;var r=t.canZoomIn;var o=t.canZoomOut;var n=t.zoomLevel;var s=["transform","brush","focus","sticker","text","textdesign"].indexOf(e.tool)!==-1;return!s?nf["default"].createElement(Dct,{isDisabled:i},nf["default"].createElement(bW,{"data-test":N.MainBarButtonZoom,ariaLabel:"Zoom out",isDisabled:!o,onClick:t.out},"-"),nf["default"].createElement(yW,{"data-test":N.ZoomLevel},n," %"),nf["default"].createElement(bW,{ariaLabel:"Zoom in",isDisabled:!r,onClick:t["in"]},"+")):null;};_W=rt("scale","active")(w(Ect));yW.defaultProps={theme:Hr};});var Gr,CW,vW,vm;var SW=d(function(){Gr=y(_("react"));B();CW=y(_("styled-components"));R();W();we();U();$e();xW();vW=(0,CW["default"])(mt.Bar.ButtonGroup)(_templateObject192||(_templateObject192=_taggedTemplateLiteral(["\n > :last-child {\n margin-left: 10px;\n }\n > :first-child {\n margin-left: 0;\n }\n"])));vm=w(function i(){var _D3=D(),t=_D3.config,e=_D3.editor,r=_D3.history,o=_D3.custom,n=_D3.active;var s=t.locale.mainCanvasActions;var a=r.canUndo;var l=r.canRedo;var c=t.config.mainCanvasActions;var u=function u(){e["export"]();};var m=function m(){if(e.activeStore.tool==="transform"){return null;}var v=o.getButton("mainCanvasActionUndo");return Gr["default"].createElement(v,{key:"mainCanvasActionUndo","data-test":N.MainBarButtonUndo,onClick:r.undo,isDisabled:!a||!n.image,label:s.buttonUndo,ariaLabel:s.buttonUndo,icon:Gr["default"].createElement(Xp.undo,null)});};var p=function p(){if(e.activeStore.tool==="transform"){return null;}var v=o.getButton("mainCanvasActionRedo");return Gr["default"].createElement(v,{key:"mainCanvasActionRedo","data-test":N.MainBarButtonRedo,onClick:r.redo,isDisabled:!l||!n.image,label:s.buttonRedo,ariaLabel:s.buttonRedo,icon:Gr["default"].createElement(Xp.redo,null)});};var h=function h(){var v=o.getButton("mainCanvasActionExport");return Gr["default"].createElement(v,{key:"mainCanvasActionExport","data-test":N.MainBarButtonExport,onClick:u,isDisabled:!n.image,label:s.buttonExport,ariaLabel:s.buttonExport,icon:Gr["default"].createElement(Xp["export"],null)});};var g=function g(){if(!t.displayCloseButton){return null;}var v=o.getButton("mainCanvasActionClose");return Gr["default"].createElement(v,{key:"mainCanvasActionClose","data-test":N.MainBarButtonClose,onClick:e.close,isDisabled:!n.image,label:s.buttonClose,ariaLabel:s.buttonClose,icon:Gr["default"].createElement(Xp.close,null)});};var x=c.map(function(v){switch(v){case"undo":return m;case"redo":return p;case"export":return h;case"close":return g;default:return null;}});return Gr["default"].createElement(mt.Bar.Index,null,Gr["default"].createElement(vW,null,x[0]&&x[0]()||null,x[1]&&x[1]()||null),t.config.enableZoom?Gr["default"].createElement(_W,{isDisabled:!n.image}):null,Gr["default"].createElement(vW,null,x[2]&&x[2]()||null,x[3]&&x[3]()||null));});});function Fct(i){return typeof i==="string"&&i.includes("%");}function Oct(i){return typeof i==="string"&&i.includes(".")&&parseFloat(i)===1;}function li(i,t){if(Oct(i)){i="100%";}var e=Fct(i);i=t===360?i:Math.min(t,Math.max(0,parseFloat(i)));if(e){i=parseInt(String(i*t),10)/100;}if(Math.abs(i-t)<1e-6){return 1;}if(t===360){i=(i<0?i%t+t:i%t)/parseFloat(String(t));}else{i=i%t/parseFloat(String(t));}return i;}function _v(i){i=parseFloat(i);if(Number.isNaN(i)||i<0||i>1){i=1;}return i;}function af(i){if(i<=1){return"".concat(Number(i)*100,"%");}return i;}function wl(i){return i.length===1?"0".concat(i):String(i);}var xv=d(function(){});function aI(i,t,e){return{r:li(i,255)*255,g:li(t,255)*255,b:li(e,255)*255};}function lI(i,t,e){i=li(i,255);t=li(t,255);e=li(e,255);var r=Math.max(i,t,e);var o=Math.min(i,t,e);var n=0;var s=0;var a=(r+o)/2;if(r===o){s=0;n=0;}else{var l=r-o;s=a>.5?l/(2-r-o):l/(r+o);switch(r){case i:n=(t-e)/l+(t1){c-=1;}if(c<1/6){return a+(l-a)*(6*c);}if(c<1/2){return l;}if(c<2/3){return a+(l-a)*(2/3-c)*6;}return a;}if(t===0){o=e;n=e;r=e;}else{var a=e<.5?e*(1+t):e+t-e*t;var l=2*e-a;r=s(l,a,i+1/3);o=s(l,a,i);n=s(l,a,i-1/3);}return{r:r*255,g:o*255,b:n*255};}function cI(i,t,e){i=li(i,255);t=li(t,255);e=li(e,255);var r=Math.max(i,t,e);var o=Math.min(i,t,e);var n=0;var s=r;var a=r-o;var l=r===0?0:a/r;if(r===o){n=0;}else{switch(r){case i:n=(t-e)/a+(t0&&arguments[0]!==undefined?arguments[0]:"";var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Vr);if(t instanceof _Vr){return t;}this.originalInput=t;var r=IW(t);this.originalInput=t;this.r=r.r;this.g=r.g;this.b=r.b;this.a=r.a;this.roundA=Math.round(100*this.a)/100;this.format=e.format||r.format;this.gradientType=e.gradientType;if(this.r<1){this.r=Math.round(this.r);}if(this.g<1){this.g=Math.round(this.g);}if(this.b<1){this.b=Math.round(this.b);}this.isValid=r.ok;}_createClass(Vr,[{key:"getAlpha",value:function getAlpha(){return this.a;}},{key:"setAlpha",value:function setAlpha(t){this.a=_v(t);this.roundA=Math.round(100*this.a)/100;return this;}},{key:"toHsv",value:function toHsv(){var t=cI(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a};}},{key:"toHsvString",value:function toHsvString(){var t=cI(this.r,this.g,this.b);var e=Math.round(t.h*360);var r=Math.round(t.s*100);var o=Math.round(t.v*100);return this.a===1?"hsv(".concat(e,", ").concat(r,"%, ").concat(o,"%)"):"hsva(".concat(e,", ").concat(r,"%, ").concat(o,"%, ").concat(this.roundA,")");}},{key:"toHsl",value:function toHsl(){var t=lI(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a};}},{key:"toHslString",value:function toHslString(){var t=lI(this.r,this.g,this.b);var e=Math.round(t.h*360);var r=Math.round(t.s*100);var o=Math.round(t.l*100);return this.a===1?"hsl(".concat(e,", ").concat(r,"%, ").concat(o,"%)"):"hsla(".concat(e,", ").concat(r,"%, ").concat(o,"%, ").concat(this.roundA,")");}},{key:"toHex",value:function toHex(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return uI(this.r,this.g,this.b,t);}},{key:"toHexString",value:function toHexString(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return"#".concat(this.toHex(t));}},{key:"toHex8",value:function toHex8(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return kW(this.r,this.g,this.b,this.a,t);}},{key:"toHex8String",value:function toHex8String(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return"#".concat(this.toHex8(t));}},{key:"toRgb",value:function toRgb(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a};}},{key:"toRgbArray",value:function toRgbArray(){return[Math.round(this.r),Math.round(this.g),Math.round(this.b),this.a];}},{key:"toRgbString",value:function toRgbString(){var t=Math.round(this.r);var e=Math.round(this.g);var r=Math.round(this.b);return"rgba(".concat(t,", ").concat(e,", ").concat(r,", ").concat(this.roundA,")");}},{key:"toPercentageRgb",value:function toPercentageRgb(){var t=function t(e){return"".concat(Math.round(li(e,255)*100),"%");};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a};}},{key:"toPercentageRgbString",value:function toPercentageRgbString(){var t=function t(e){return Math.round(li(e,255)*100);};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")");}},{key:"toName",value:function toName(){if(this.a===0){return"transparent";}if(this.a<1){return false;}var t="#".concat(uI(this.r,this.g,this.b,false));for(var _i9=0,_Object$keys=Object.keys(Cm);_i9<_Object$keys.length;_i9++){var e=_Object$keys[_i9];if(Cm[e]===t){return e;}}return false;}},{key:"toString",value:function toString(t){var e=Boolean(t);t=t||this.format;var r=this.a<1&&this.a>=0;var o=!e&&r&&t&&(t.startsWith("hex")||t==="name");if(o){if(t==="name"&&this.a===0){return this.toName();}return this.toRgbString();}switch(t){case"rgb":return this.toRgbString();case"prgb":return this.toPercentageRgbString();case"hex":case"hex6":return this.toHexString();case"hex3":return this.toHexString(true);case"hex4":return this.toHex8String(true);case"hex8":return this.toHex8String();case"hsl":return this.toHslString();case"hsv":return this.toHsvString();case"name":return this.toName();default:return this.toHexString();}}},{key:"clone",value:function clone(){return new _Vr(this.toString());}}]);return Vr;}();});var hu,Mct,EW;var FW=d(function(){hu=y(_("styled-components"));Mct=hu["default"].div(_templateObject193||(_templateObject193=_taggedTemplateLiteral(["\n position: absolute;\n width: ","px;\n height: ","px;\n overflow: hidden;\n pointer-events: none;\n ","\n left: ","px;\n :after {\n content: '';\n position: absolute;\n width: ","px;\n height: ","px;\n left: 50%;\n ","\n background-color: ",";\n pointer-events: none;\n }\n"])),function(i){return i.theme.measurements.color.colorPicker.arrow.width;},function(i){return i.theme.measurements.color.colorPicker.arrow.width/2;},function(i){return i.direction==="bottom"?hu.css(_templateObject194||(_templateObject194=_taggedTemplateLiteral(["\n bottom: 100%;\n "]))):hu.css(_templateObject195||(_templateObject195=_taggedTemplateLiteral(["\n top: 100%;\n "])));},function(i){return i.arrowOffset;},function(i){return i.theme.measurements.color.colorPicker.arrow.width/2;},function(i){return i.theme.measurements.color.colorPicker.arrow.width/2;},function(i){return i.direction==="bottom"?hu.css(_templateObject196||(_templateObject196=_taggedTemplateLiteral(["\n transform: translate(-50%, 50%) rotate(45deg);\n "]))):hu.css(_templateObject197||(_templateObject197=_taggedTemplateLiteral(["\n transform: translate(-50%, -50%) rotate(45deg);\n "])));},function(i){return i.theme.colorPicker.listBackground;});EW=Mct;});var vv,bI,Lct,zct,Uct,Cv;var OW=d(function(){vv=y(_("react"));bI=y(_("styled-components"));it();Lct=bI["default"].div(_templateObject198||(_templateObject198=_taggedTemplateLiteral(["\n text-align: center;\n width: 28px;\n padding-left: 4px;\n"])));zct=(0,bI["default"])(P.Input.Text)(_templateObject199||(_templateObject199=_taggedTemplateLiteral(["\n input {\n text-align: center;\n border-bottom: 1px solid\n ",";\n }\n"])),function(i){return i.theme.colorPicker.inputBorderColor;});Uct=function Uct(_ref221){var i=_ref221.value,t=_ref221.label,e=_ref221.onChange;return vv["default"].createElement(Lct,null,vv["default"].createElement(P.Input.Label,{label:t}),vv["default"].createElement(zct,{min:0,max:255,value:i,onChange:e}));};Cv=Uct;});var Sv,yI,Nct,Hct,Wct,RW;var AW=d(function(){Sv=y(_("react"));yI=y(_("styled-components"));it();Nct=yI["default"].div(_templateObject200||(_templateObject200=_taggedTemplateLiteral(["\n text-align: left;\n width: 62px;\n"])));Hct=(0,yI["default"])(P.Input.Text)(_templateObject201||(_templateObject201=_taggedTemplateLiteral(["\n input {\n text-align: left;\n border-bottom: 1px solid\n ",";\n }\n"])),function(i){return i.theme.colorPicker.inputBorderColor;});Wct=function Wct(_ref222){var i=_ref222.value,t=_ref222.label,e=_ref222.onChange;return Sv["default"].createElement(Nct,null,Sv["default"].createElement(P.Input.Label,{label:t}),Sv["default"].createElement(Hct,{value:i.toUpperCase(),onChange:e}));};RW=Wct;});var BW,fu;var wv=d(function(){BW=y(_("styled-components"));Xt();fu=BW["default"].div.attrs(function(i){return{style:{left:i.position[0]||"".concat(0,"px"),top:i.position[1]||"".concat(0,"px")}};})(_templateObject202||(_templateObject202=_taggedTemplateLiteral(["\n &&& {\n position: absolute;\n height: ","px;\n width: ","px;\n border-radius: 50%;\n border: 2px solid ",";\n box-sizing: border-box;\n cursor: pointer;\n box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.11), 0 1px 3px 0 rgba(0, 0, 0, 0.46);\n z-index: 2;\n pointer-events: none;\n }\n"])),function(i){return i.theme.measurements.color.colorPicker.thumb.size;},function(i){return i.theme.measurements.color.colorPicker.thumb.size;},function(i){return i.theme.colorPicker.controlsColor;});fu.defaultProps={theme:Hr};});var jr,PW,MW,Gct,Vct,Sm;var Tv=d(function(){jr=y(_("react"));PW=y(Ku());MW=y(_("styled-components"));it();W();Gct=MW["default"].div(_templateObject203||(_templateObject203=_taggedTemplateLiteral(["\n position: relative;\n height: 14px;\n width: 100%;\n"])));Vct=function Vct(i){return function(t){i.forEach(function(e){if(typeof e==="function"){e(t);}else if(e!=null){e.current=t;}});};};Sm=(0,jr.forwardRef)(function(_ref223,o){var i=_ref223.surface,t=_ref223.onChange,e=_ref223.className,r=_ref223.children;var n=(0,jr.useRef)(null);var s=(0,jr.useRef)(null);var _D4=D(),a=_D4.config;var _ref224=(0,jr.useState)(false),_ref225=_slicedToArray(_ref224,2),l=_ref225[0],c=_ref225[1];var u=function u(g){var x=a.measurements.color.colorPicker.thumb.size/2;var v=a.measurements.color.colorPicker.thumb.size;var b=0;var T=0;b=g.clientX;T=g.clientY;var _n$current$getBoundin=n.current.getBoundingClientRect(),k=_n$current$getBoundin.top,E=_n$current$getBoundin.left,A=_n$current$getBoundin.width,I=_n$current$getBoundin.height;var F=b-E-x;var Z=T-k-x;F=Math.max(0,Math.min(A-v,F));Z=Math.max(0,Math.min(I-v,Z));if(t){t([F,Z]);}};var m=function m(g){c(true);u(g);};var p=(0,jr.useCallback)((0,PW["default"])(function(g){if(l){u(g);}},10),[l]);var h=function h(){if(l){c(false);}};return jr["default"].createElement(Gct,{ref:Vct([n,o]),className:e},jr["default"].createElement(P.DraggableCore,{nodeRef:s,onStart:m,onDrag:p,onStop:h},jr["default"].createElement("div",{ref:s},i)),r);});});var LW,jct,gu;var kv=d(function(){LW=_("styled-components");jct=LW.css(_templateObject204||(_templateObject204=_taggedTemplateLiteral(["\n position: absolute;\n top: 3px;\n left: 0;\n width: 100%;\n height: 8px;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n"])));gu=jct;});var Vn,zW,$ct,UW;var NW=d(function(){Vn=y(_("react"));zW=y(_("styled-components"));W();wv();Tv();kv();$ct=zW["default"].div(_templateObject205||(_templateObject205=_taggedTemplateLiteral(["\n ","\n background: linear-gradient(90deg, #F00 0%, #FF0 16.66%, #0F0 33.33%, #0FF 50%, #00F 66.66%, #F0F 83.33%, #F00 100%);\n height: 8px;\n"])),gu);UW=function UW(_ref226){var i=_ref226.hue,t=_ref226.onChange;var _ref227=(0,Vn.useState)(0),_ref228=_slicedToArray(_ref227,2),e=_ref228[0],r=_ref228[1];var o=(0,Vn.useRef)(null);var _D5=D(),n=_D5.config;var s=function s(a){if(o.current){var _a5=_slicedToArray(a,1),l=_a5[0];var c=o.current.offsetWidth;var u=c-n.measurements.color.colorPicker.thumb.size;var m=l*c/u;var p=Math.max(0,Math.min(360,m/c*360));t(p);r(l);}};(0,Vn.useEffect)(function(){if(o.current){var a=o.current.offsetWidth;var l=0;var c=a-n.measurements.color.colorPicker.thumb.size;l=i*a/360;r(l*c/a);}},[i]);return Vn["default"].createElement(Sm,{surface:Vn["default"].createElement($ct,null),ref:o,onChange:s},Vn["default"].createElement(fu,{position:[e,0]}));};});var Xo,_I,Kct,Xct,HW;var WW=d(function(){Xo=y(_("react"));_I=y(_("styled-components"));W();wv();Tv();kv();Kct=_I["default"].div.attrs(function(i){return{style:{background:"linear-gradient(to left, ".concat(i.transparentColor," 0%, ").concat(i.opaqueColor," 100%)")}};})(_templateObject206||(_templateObject206=_taggedTemplateLiteral(["\n ","\n z-index: 1;\n"])),gu);Xct=_I["default"].div.attrs(function(i){return{style:{backgroundImage:"url(".concat(i.url,")")}};})(_templateObject207||(_templateObject207=_taggedTemplateLiteral(["\n ","\n z-index: 0;\n background-repeat: repeat-x;\n background-size: contain;\n background-position: left;\n"])),gu);HW=function HW(_ref229){var i=_ref229.color,t=_ref229.opaqueColor,e=_ref229.transparentColor,r=_ref229.onChange;var _D6=D(),o=_D6.config;var _ref230=(0,Xo.useState)(0),_ref231=_slicedToArray(_ref230,2),n=_ref231[0],s=_ref231[1];var a=(0,Xo.useRef)(null);var l=o.assetProvider.getPath("controls","/tiled-background.png");var c=function c(u){if(a.current){var m=a.current.offsetWidth;var _u13=_slicedToArray(u,1),p=_u13[0];var h=m-o.measurements.color.colorPicker.thumb.size;var g=p*m/h;var x=(m-g)/m;var v=Math.round((x+Number.EPSILON)*100)/100;var b=Math.min(1,Math.max(0,v));r(b);s(p);}};(0,Xo.useEffect)(function(){if(a.current){var u=a.current.offsetWidth;var m=0;var p=u-o.measurements.color.colorPicker.thumb.size;m=(1-i.toHsv().a)*u;s(m*p/u);}},[i.toString()]);return Xo["default"].createElement(Sm,{ref:a,surface:Xo["default"].createElement(Kct,{opaqueColor:t,transparentColor:e}),onChange:c},Xo["default"].createElement(Xct,{url:l}),Xo["default"].createElement(fu,{position:[n,0]}));};});var jn,xI,qct,Yct,GW;var VW=d(function(){jn=y(_("react"));xI=y(_("styled-components"));W();wv();Tv();kv();qct=xI["default"].div.attrs(function(i){return{style:{backgroundColor:"hsl(".concat(i.hue,", 100%, 50%)")}};})(_templateObject208||(_templateObject208=_taggedTemplateLiteral(["\n ","\n background: linear-gradient(to top, rgb(0, 0, 0), rgba(0, 0, 0, 0)),\n linear-gradient(to right, rgb(255, 255, 255), rgba(255, 255, 255, 0));\n height: ","px;\n top: 0px;\n"])),gu,function(i){return i.theme.measurements.color.colorPicker.saturationSlider.height;});Yct=(0,xI["default"])(Sm)(_templateObject209||(_templateObject209=_taggedTemplateLiteral(["\n height: ","px;\n margin-top: 0px;\n"])),function(i){return i.theme.measurements.color.colorPicker.saturationSlider.height;});GW=function GW(_ref232){var i=_ref232.color,t=_ref232.hue,e=_ref232.onChange;var _ref233=(0,jn.useState)([0,0]),_ref234=_slicedToArray(_ref233,2),r=_ref234[0],o=_ref234[1];var n=(0,jn.useRef)(null);var _D7=D(),s=_D7.config;(0,jn.useEffect)(function(){var _i$toHsv=i.toHsv(),l=_i$toHsv.s,c=_i$toHsv.v;if(n.current){var _n$current=n.current,u=_n$current.offsetWidth,m=_n$current.offsetHeight;var p=u-s.measurements.color.colorPicker.thumb.size;var h=m-s.measurements.color.colorPicker.thumb.size;var g=l*u;var x=(1-c)*m;o([g*p/u,x*h/m]);}},[i.toString()]);var a=function a(l){if(n.current){var _l7=_slicedToArray(l,2),c=_l7[0],u=_l7[1];var _n$current2=n.current,m=_n$current2.offsetHeight,p=_n$current2.offsetWidth;var h=p-s.measurements.color.colorPicker.thumb.size;var g=m-s.measurements.color.colorPicker.thumb.size;var x=c*p/h;var v=u*m/g;var b=Math.min(1,Math.max(0,x/p));var T=Math.min(1,Math.max(0,(m-v)/m));e(b,T);o([c,u]);}};return jn["default"].createElement(Yct,{ref:n,surface:jn["default"].createElement(qct,{hue:t}),onChange:a},jn["default"].createElement(fu,{position:r}));};});var ei,$n,Jct,jW,Zct,Qct,tut,eut,lf;var $W=d(function(){ei=y(_("react"));$n=y(_("styled-components"));it();Xt();gI();FW();OW();AW();NW();WW();VW();Jct=$n["default"].div(_templateObject210||(_templateObject210=_taggedTemplateLiteral(["\n position: absolute;\n left: ","px;\n top: ","px;\n z-index: ",";\n display: none;\n opacity: 0;\n transition: opacity 0.3s ease-out;\n ","\n"])),function(i){return i.leftOffset;},function(i){return i.topOffset;},function(i){return i.theme.measurements.zIndex.input.list;},function(i){return i.show&&$n.css(_templateObject211||(_templateObject211=_taggedTemplateLiteral(["\n display: block;\n opacity: 1;\n transition: opacity 0.3s ease-out;\n "])));});jW=$n["default"].div(_templateObject212||(_templateObject212=_taggedTemplateLiteral(["\n &&& {\n position: absolute;\n ","\n padding: 16px;\n box-sizing: border-box;\n box-shadow: ",";\n background: ",";\n border-radius: ","px;\n width: ","px;\n height: ","px;\n left: 8px;\n z-index: 1;\n }\n"])),function(i){return i.direction==="top"&&$n.css(_templateObject213||(_templateObject213=_taggedTemplateLiteral(["\n transform: translate(0, -100%);\n "])));},function(i){return i.theme.colorPicker.listShadow;},function(i){return i.theme.colorPicker.listBackground;},function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.color.colorPicker.width;},function(i){return i.theme.measurements.color.colorPicker.height;});Zct=(0,$n["default"])(UW)(_templateObject214||(_templateObject214=_taggedTemplateLiteral(["\n margin-top: 8px;\n"])));Qct=(0,$n["default"])(HW)(_templateObject215||(_templateObject215=_taggedTemplateLiteral(["\n margin-top: 8px;\n"])));tut=$n["default"].div(_templateObject216||(_templateObject216=_taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n margin-top: 30px;\n"])));eut=$n["default"].div(_templateObject217||(_templateObject217=_taggedTemplateLiteral(["\n display: flex;\n"])));lf=/*#__PURE__*/function(_ei$default$Component){_inherits(lf,_ei$default$Component);var _super237=_createSuper(lf);function lf(t){var _this378;_classCallCheck(this,lf);_this378=_super237.call(this,t);_this378.node=ei["default"].createRef();_this378.checkId=function(t,e,r){var o=t;var n=0;while(o.parentElement&&nF){I+=E-F;E-=I;}var Z=true;if(s==="bottom"&&a){var et=a.height;var pt=a.top;var yt=g-pt;var bt=et-(yt+x);var ht=o.measurements.color.colorPicker.height+k;if(bta-r||n>s-r||nn&&x.xn&&x.yt.measurements.canvas.transform.minSliderWidth;var l=!t.isLayoutAdvanced||t.isLayoutAdvanced&&e>t.measurements.canvas.transform.minValueWidth;var c=this.transformTool.rotationInDegrees-this.transformTool.defaultAngle;var u=n===s?c*-1:c;var m=n!==s?r.rotationInDegrees*-1:r.rotationInDegrees;return qo["default"].createElement(vut,{"data-test":N.RotateSlider,className:o},qo["default"].createElement(P.Draggable,{nodeRef:this.rotateRef,axis:"x",position:{x:0,y:0},onStart:this.drag,onDrag:this.drag,onStop:this.stop,updateOnPosition:true,disabled:!a},qo["default"].createElement(Sut,{ref:this.rotateRef},qo["default"].createElement(UG,{isVisible:a},qo["default"].createElement(Vt.dots,{width:90,height:15,x:u})),qo["default"].createElement(Cut,{isVisible:l},m,"\xB0"),qo["default"].createElement(UG,{isVisible:a},qo["default"].createElement(Vt.dots,{width:90,height:15,x:u})))));}}]);return NG;}(qo["default"].Component);HG=rt("transformTool","config")(w(NG));});var go,br,GG,wut,VG,Tut,jG,kut,Iut,Dut,Eut,Fut,$G,Out,Rut,ff;var MI=d(function(){go=y(_("react"));B();br=y(_("styled-components"));Sr();we();U();WG();GG=br.css(_templateObject238||(_templateObject238=_taggedTemplateLiteral(["\n grid-column-start: span 2;\n"])));wut=(0,br["default"])(HG)(_templateObject239||(_templateObject239=_taggedTemplateLiteral(["\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&GG;},GG);VG=br.css(_templateObject240||(_templateObject240=_taggedTemplateLiteral(["\n grid-column-start: 1;\n grid-row-start: 2;\n"])));Tut=br["default"].div(_templateObject241||(_templateObject241=_taggedTemplateLiteral(["\n display: flex;\n gap: 5px;\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&VG;},VG);jG=br.css(_templateObject242||(_templateObject242=_taggedTemplateLiteral(["\n justify-content: flex-end;\n grid-column-start: 2;\n grid-row-start: 2;\n"])));kut=br["default"].div(_templateObject243||(_templateObject243=_taggedTemplateLiteral(["\n display: flex;\n gap: 5px;\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&jG;},jG);Iut=(0,br["default"])(Vt.rotate)(_templateObject244||(_templateObject244=_taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n transform: scaleX(-1);\n"])));Dut=(0,br["default"])(Vt.rotate)(_templateObject245||(_templateObject245=_taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n"])));Eut=(0,br["default"])(Vt.flipHorizontal)(_templateObject246||(_templateObject246=_taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n"])));Fut=(0,br["default"])(Vt.flipVertical)(_templateObject247||(_templateObject247=_taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n"])));$G=br.css(_templateObject248||(_templateObject248=_taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-template-rows: 1fr 1fr;\n margin-bottom: 0.5rem;\n"])));Out=br["default"].div(_templateObject249||(_templateObject249=_taggedTemplateLiteral(["\n display: inline-flex;\n gap: 5px;\n\n svg {\n color: ",";\n }\n\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.theme.foreground;},function(i){return i.smallContainer&&$G;},$G);Rut=function Rut(_ref281){var i=_ref281.transformTool,t=_ref281.config,e=_ref281.custom,r=_ref281.canvas;var _ref282=(0,go.useContext)(Oe),o=_ref282.rect;var n=i.locale.transformActions;var s=r.canvasSize.width;var a=!t.isLayoutAdvanced||t.isLayoutAdvanced&&s>t.measurements.canvas.transform.minFlipWidth;var l=function l(_ref283){var x=_ref283.customButtonKey,v=_ref283.onClick,b=_ref283.label,T=_ref283.icon;var k=e.getButton(x);return go["default"].createElement(k,{key:b,onClick:v,label:b,ariaLabel:b,icon:T});};var c=l({label:n.buttonFlipHorizontal,icon:go["default"].createElement(Eut,null),onClick:function onClick(){i.flipHorizontally();},customButtonKey:"transformActionFlipHorizontal"});var u=l({label:n.buttonFlipVertical,icon:go["default"].createElement(Fut,null),onClick:function onClick(){i.flipVertically();},customButtonKey:"transformActionFlipVertical"});var m=l({label:n.buttonRotateClockwise,icon:go["default"].createElement(Iut,null),onClick:i.rotateClockwise,customButtonKey:"transformActionRotateClockwise"});var p=l({label:n.buttonRotateAntiClockwise,icon:go["default"].createElement(Dut,null),onClick:i.rotateAntiClockwise,customButtonKey:"transformActionRotateAntiClockwise"});var h=!!o&&o.width<600;var g=t.isLayoutAdvanced?{transform:"rotate(180deg)"}:{};return go["default"].createElement(Out,{style:g,"data-test":N.FlipRotateControls,smallContainer:h},i.config.enableFlip&&a&&go["default"].createElement(Tut,{smallContainer:h},c,u),i.config.enableRotation&&go["default"].createElement(wut,{canvasWidth:s,smallContainer:h}),i.config.enableRotation&&go["default"].createElement(kut,{smallContainer:h},p,m));};ff=rt("transformTool","config","custom","canvas")(w(Rut));});var oa,Aut,Bv,But,KG;var XG=d(function(){oa=y(_("react"));B();$e();zG();MI();Aut=mt.Bar.Index;Bv=mt.Crop.Backdrop;But=function But(_ref284){var i=_ref284.transformTool,t=_ref284.canvas,e=_ref284.config;var r=i.leftTopRespectFlip,o=i.leftBottomRespectFlip,n=i.rightTopRespectFlip;var s=i.cropMaskSize.height;var _t$canvasSize=t.canvasSize,a=_t$canvasSize.height,l=_t$canvasSize.width;var c=i.defaultCropMaskPosition;var u=i.isDragMode?{transition:"unset"}:{};return oa["default"].createElement(mt.Controls.Container,null,oa["default"].createElement(Bv,{style:_objectSpread({left:0,top:0,width:l,height:r.y+c.y},u)}),oa["default"].createElement(Bv,{style:_objectSpread({left:0,top:r.y+c.y,width:c.x+r.x,height:s},u)}),oa["default"].createElement(Bv,{style:_objectSpread({left:n.x+c.x,top:n.y+c.y,width:l-n.x-c.x,height:s},u)}),oa["default"].createElement(Bv,{style:_objectSpread({left:0,top:o.y+c.y,width:l,height:a-o.y-c.y+e.measurements.basicUIToolControlBar.controlsBarHeight},u)}),oa["default"].createElement(LG,null),e.isLayoutAdvanced?oa["default"].createElement(Aut,{bottom:true},oa["default"].createElement(ff,null)):null);};KG=rt("transformTool","canvas","config")(w(But));});var Pv,Mv,Put,qG,YG;var JG=d(function(){Pv=y(_("react"));B();Mv=y(_("styled-components"));$e();Put=(0,Mv["default"])(mt.Controls.Container)(_templateObject250||(_templateObject250=_taggedTemplateLiteral(["\n ","\n z-index: ",";\n"])),function(i){return i.activeCursor?Mv.css(_templateObject251||(_templateObject251=_taggedTemplateLiteral(["\n cursor: move;\n "]))):"";},function(i){return i.theme.measurements.zIndex.canvas.crop.dragImage;});qG=/*#__PURE__*/function(_Pv$default$Component){_inherits(qG,_Pv$default$Component);var _super245=_createSuper(qG);function qG(t){var _this387;_classCallCheck(this,qG);_this387=_super245.call(this,t);_this387.INITIAL_POSITION={x:void 0,y:void 0};_this387.state=_objectSpread(_objectSpread({},_this387.INITIAL_POSITION),{},{isDragging:false});_this387.containerRef=null;_this387.getCursorCoordinates=function(t){var e=0;var r=0;if(t.type.indexOf("touch")!==-1){var a=t;if(!a.touches.length){return _this387.INITIAL_POSITION;}e=a.touches[0].clientX;r=a.touches[0].clientY;}else{var _a7=t;e=_a7.clientX;r=_a7.clientY;}var o=_this387.containerRef.current.getBoundingClientRect();var n=e-o.left;var s=r-o.top;return{x:n,y:s};};_this387.move=function(t){if(_this387.scale.canDrag){var _this387$getCursorCoo=_this387.getCursorCoordinates(t),e=_this387$getCursorCoo.x,r=_this387$getCursorCoo.y;if(e!==void 0&&r!==void 0){if(_this387.state.isDragging){var o={x:_this387.state.x-e,y:_this387.state.y-r};_this387.scale.setOffset(o);}}}};_this387.touchDrag=function(t){if(_this387.scale.canDrag){var _this387$getCursorCoo2=_this387.getCursorCoordinates(t),e=_this387$getCursorCoo2.x,r=_this387$getCursorCoo2.y;if(e!==void 0&&r!==void 0){_this387.setState({x:e,y:r,isDragging:true});}}};_this387.drag=function(t){t.preventDefault();_this387.touchDrag(t);};_this387.stop=function(){if(_this387.scale.canDrag){_this387.scale.savePosition();_this387.setState(_objectSpread(_objectSpread({},_this387.INITIAL_POSITION),{},{isDragging:false}));}};_this387.touchEnd=function(t){t.preventDefault();t.stopPropagation();var _this387$state=_this387.state,e=_this387$state.x,r=_this387$state.y;if(e&&r){_this387.setState(_objectSpread(_objectSpread({},_this387.INITIAL_POSITION),{},{isDragging:false}));}};_this387.containerRef=Pv["default"].createRef();return _this387;}_createClass(qG,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener("mouseup",this.stop,false);document.addEventListener("touchend",this.stop,{passive:true});}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener("mouseup",this.stop,false);document.removeEventListener("touchend",this.stop,false);}},{key:"scale",get:function get(){return this.props.scale;}},{key:"render",value:function render(){return Pv["default"].createElement(Put,{ref:this.containerRef,onMouseMove:this.move,onTouchMove:this.move,onMouseDown:this.drag,onTouchStart:this.touchDrag,onMouseUp:this.stop,onTouchEnd:this.touchEnd,activeCursor:this.scale.canDrag});}}]);return qG;}(Pv["default"].Component);YG=rt("scale")(w(qG));});var qn,ZG;var QG=d(function(){qn=y(_("react"));B();R();W();tG();$e();cG();MG();XG();JG();ZG=w(function(_ref285){var i=_ref285.children;var t=(0,qn.useRef)(null);var _D12=D(),e=_D12.active,r=_D12.sprite,o=_D12.canvas;var n=function n(){switch(e.tool){case"focus":return qn["default"].createElement(lG,null);case"text":case"textdesign":case"sticker":return qn["default"].createElement(PG,null);case"brush":return qn["default"].createElement(QW,null);case"transform":return qn["default"].createElement(KG,null);default:return qn["default"].createElement(mt.Controls.Container,null,qn["default"].createElement(YG,null));}};var s=function s(c){c.preventDefault();c.stopPropagation();if(o==null?void 0:o.isCanvasClickable){var u=c.clientX;var m=c.clientY;if(c.type.indexOf("touch")!==-1){var x=c;if(!x.touches.length){return;}u=x.touches[0].clientX;m=x.touches[0].clientY;}var p=t.current.getBoundingClientRect();var h=u-p.left;var g=m-p.top;o.getContainersAtPreviewPoint({x:h,y:g});}};var a=function a(c){if(c.code==="Tab"){r.selectLast();}};var l=o.canvasSize;return qn["default"].createElement(mt.Controls.Wrapper,{"aria-hidden":true,ref:t,onClick:s,onKeyDown:a,height:l.height,width:l.width},i,n());});});var tV,eV,Mut,Lut,LI;var iV=d(function(){tV=y(_("react"));eV=y(_("styled-components"));Mut=eV["default"].div(_templateObject252||(_templateObject252=_taggedTemplateLiteral(["\n display: ",";\n position: absolute;\n z-index: ",";\n"])),function(_ref286){var i=_ref286.isVisible;return i?"block":"none";},function(i){return i.theme.measurements.zIndex.canvas.snappingGuide;});Lut=function Lut(_ref287){var i=_ref287.isVisible,t=_ref287.className;return tV["default"].createElement(Mut,{isVisible:i,className:t});};LI=Lut;});var Lv,_u,zut,Uut,Nut,Hut,rV;var oV=d(function(){Lv=y(_("react"));B();_u=y(_("styled-components"));U();iV();zut=(0,_u["default"])(LI)(_templateObject253||(_templateObject253=_taggedTemplateLiteral(["\n background: ",";\n ","\n"])),function(i){return i.theme.snapping.positionGuideColor;},function(i){if(i.direction==="horizontal"){return _u.css(_templateObject254||(_templateObject254=_taggedTemplateLiteral(["\n width: 100%;\n height: 2px;\n top: ","px;\n "])),function(){return i.position;});}return _u.css(_templateObject255||(_templateObject255=_taggedTemplateLiteral(["\n width: 2px;\n height: 100%;\n left: ","px;\n "])),function(){return i.position;});});Uut=(0,_u["default"])(LI)(_templateObject256||(_templateObject256=_taggedTemplateLiteral(["\n border: none;\n border-top: 2px dashed ",";\n background: transparent;\n left: ","px;\n top: ","px;\n transform: rotate(","rad);\n width: 200%;\n"])),function(i){return i.theme.snapping.rotationGuideColor;},function(_ref288){var i=_ref288.position;return i.x;},function(_ref289){var i=_ref289.position;return i.y;},function(_ref290){var i=_ref290.rotation;return i;});Nut=_u["default"].div(_templateObject257||(_templateObject257=_taggedTemplateLiteral(["\n position: absolute;\n width: ","px;\n height: ","px;\n top: ","px;\n left: ","px;\n overflow: hidden;\n"])),function(_ref291){var i=_ref291.width;return i;},function(_ref292){var i=_ref292.height;return i;},function(_ref293){var i=_ref293.top;return i;},function(_ref294){var i=_ref294.left;return i;});Hut=function Hut(_ref295){var i=_ref295.snapping,t=_ref295.editor;var _t$getPreviewSize=t.getPreviewSize(),e=_t$getPreviewSize.width,r=_t$getPreviewSize.height;var _i$previewTopLeftPosi=i.previewTopLeftPosition,o=_i$previewTopLeftPosi.x,n=_i$previewTopLeftPosi.y;var s=i.positionGuides.map(function(_ref296,m){var l=_ref296.direction,c=_ref296.value,u=_ref296.isVisible;return Lv["default"].createElement(zut,{key:"positionGuide-".concat(m),direction:l,position:c,isVisible:u});});var a=i.rotationGuides.find(function(_ref297){var l=_ref297.isVisible;return l;});return Lv["default"].createElement(Nut,{"data-test":N.SnappingLine,width:e,height:r,left:o,top:n},s,Lv["default"].createElement(Uut,{key:"rotationGuide",rotation:a?a.value:0,position:a?a.position:{x:0,y:0},isVisible:!!a}));};rV=rt("snapping","editor")(w(Hut));});var nV,sV,Wut,aV;var lV=d(function(){nV=y(_("react"));sV=y(_("styled-components"));U();Wut=sV["default"].img(_templateObject258||(_templateObject258=_taggedTemplateLiteral(["\n z-index: 5;\n position: absolute;\n width: 100px;\n bottom: 30px;\n right: 30px;\n"])));aV=function aV(){return nV["default"].createElement(Wut,{alt:"watermark","data-test":N.Watermark,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaQAAACMCAYAAAAzxN3aAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABMZSURBVHgB7d1tbFTXmQfw4xTXJsZk4hc8LAYPNWDTxOvZJMITNSkInGaTdOUmRWsTdUsrJYvafsh+yDcUqft9VSkftlLYqMRqpJAVQbJ2SeRiU5NCPKAEm1rBr5BxYpKxwNjGJrZxovb+SaYi1Daee8+59zkz/59k0aoUv83c/32e89xzcl7av//XioiIKEA5OTnqLkVERCQAA4mIiERgIBERkQgMJCIiEoGBREREIjCQiIhIBAYSERGJwEAiIiIRGEhERCQCA4mIiERgIBERkQgMJCIiEoGBREREIjCQiIhIBAYSERGJwEAiIiIRGEhERCQCA4mIiERgIBERkQgMJCIiEoGBREREIjCQiIhIBAYSERGJwEAiIiIRGEhERCQCA4mIiERgIBERkQgMJCIiEoGBREREIjCQiIhIBAYSERGJwEAiIiIRGEhERCTCCkWUhUYuXQoNJxJl45OToSuXL6+dn5/Pu379euiL+fn8mbm50EL/nxUrVszmfutbsytyc2dznY+CgoLJVYWF42vLypIlJSUTVVVVo4qIXGMgUVa4du1a/rsnT9YifJyPisVCZylffPFFPj7U3NzN/351fPzmn729vTf/RGCtLixMVkQifZsrKxMMKKL0WBFI//3b3+6d+fzztC8gi6n+7nfjP3zyydPL/ftnz56NHD9+vEEZdk8olHz+uefeVD5qa2ur7e7u3qEMa9qzp7l83boJ5aNUCDmVULUTHhFlGMIKnwcfXV1dauXKlROlxcWJWCwWz9ZwMvHe0fVa+v+3367rO38+pkzIyVEbv/Od7h8//fQJpZH296vzdZaWlib2/vSnLUoAKwLpuhNGcy7uaBczOzubr9I0o/HzL/o5RkdDuIiuXr16Vvnkk0uXIn58b35CO+7dP/2pbnh4OHqzognIzMxM6OORkejHhw9HC1etSt5fUxOv37nznMoyUl9f33/kkXM9PT07TL1GBgYGYs77+bTO93P/wEBU98/zusabfa841CAM7uiVj5LJZLXKEAiig83NDQdfe+2FCxcuxIIMo9tNTU+HOzs7f/Rfv/nNC23Hj/v6O6aFISgeevDBVmUIXn/H2tvrlCYjIyMhPyr9IDGQhEF7SfnkVGdnlaSLtluoKo8cObL996+/vs9500aVYKiaUsHU398fVhSox+rru1fm5RlrJX9dJWl5jznhtl1lOAaSMNempsK6XsB34rxZrK+OcFE/cODAvg97e3fYFK4Ipv89fHjfG4cOPe7X75sWVhuNal3nuRVek2fef79KeYTqyNTN1pYtW8S0kRlIwuh6AS+H7e26o0ePxnBRt3kNbMhpLR549dV9aDcqCoTxKqmvz3OQ9PX1VSgDMHjjrGt2KyEYSAL1a3gB3wmmn2xu16GyONvd/bjKAKiW0G48deqULzci9Pd27txpbMpszFn3wftNedBlaBJ248aNYsIIGEgC+dG2O9fTY+XCOn4ueAwAlYXKILg5ON7R0dTe3i56DSxTPfDAA4mie+9NKEPi8bjr9R+Mes8a6AKgOqrbtk3U1CcDSSA/2nZjly9HlGUQRr87eHBvJk8avRePNzCUgvFwLGZsLQlVktshFox6KwNQHfn9bOCdMJCEunjxorH1HbQPbFx3cdpajRifVhkOoeS1xUPpM10lfdDVlXZXwtSot8TqCBhIQo2NjUVMte1sbNdhzSjTn8G4VeuxY40cdPCfySoJD2qn+542NeotsToCBpJQaNsNDQ0ZqQZsa9e9deTIjkxbM7oT/P5bWlqMb1dF32SySkr3QVlTo95SqyNgIAnWY6CSsa1dhyrhfG9vxj8QuBBUhNzVwX8mq6R0HpQ1NeottToCBpJgnyaT1brbdja16/C9H3rjjb0qi2EjTT446y/TVdJyB5ZMjHpLro6Ax08Ilmrb4Q2iNLGpXXesrS3mZzWH4yNKSkqGCwoKxgsLCydX5uXNpP63iWvXQjdu3MgfHx8PX716NaJ8gmeUsL9hOrvTk3eoko6+805EGYAHZe+0ye7J996rMjHqLbk6AgaScGjb6QokjJ3a0q7zq1WHEKqoqOiu3rKlf7k/Z1Qsp8+cqT7X3b3dj5/n1/sbMpB8hNdCZzyeMDFIk3pQdqnXm/Pa0r5mKr06ArbshPtU4/Y+bsZOg+JUR8bDqLKyMv6rX/zi5WebmlrTCX3sEo3tZl588cWXY3V1LSa3nYGrGp70p/Q1NDQY271hqQdlTY16S6+OgIEkHNp2ui5Gn46MWLF3Hb5fk7t2407xqSeeaEYQeT2rBsGEA+PCa9b0K4MuJhJGFrhpcbh4l5eXG9laZ6kHZU2MettQHQEDyQJ9AwOed22wqV1ncvACb8ymxsZmnetyuHA9//zzh0w+VDmaTEYU+c654TA2cbdQxwLVkYlNj22ojoCBZAE8UKc8GhgaiigLYO3IVHWUCiNTb8x/+8lP3sSalDIA+xsq8h1eK2jtKgMWelAWo966Nz22pToCBpIFdLTtLly4YMX6EY4eV4aYDCNA+2/z5s1Ghg/wGuDODcH44ZNPnjBxo7HQg7ImRr1LS0oSNlRHwECyhJe2HS5kU5bcYZta59q6dWuHH2/KH9TXG7mbhuvT03weKQAmbzTwoGzqP5sa9d61a5extqNuHPu2xNdtu1blgnPXZcUwg6l1LrQsdj/zjC9vSly8Xtq//z8VZRTcaAwODtbpbqfh38NuHHguycSo94b1661YO0phhWQJL227j4eHrTj4refDD418nbW1tdbcIZJMJqskHMhpatTbpuoIGEgWcdO2Q7vOll2yTUySoTp6bNcuUadikp1QJZlYS8L78/BbbzUqzWyrjoCBFAC3L2o303Z9vb2unl/BhVz5zERwlhYXJxSRBiarJBPnfNlWHQEDKQBrw2FXD1G6adu5PW3S7wu5qZ0IampqrBh3JTuYqpJ0s7E6AgZSAMrXr//I7Ys6nSf23bbrCletShYUFvr6Yr702WdGpgB1PgBLZLJK0snG6ggYSAHBhp7KhUQiseyKx227bk1ZWUL5bGpq6h6lWVFRUUIRaSa9SrK1OgIGUkCwu7RyAccRLLe95bZd5/Zr82J6elr7uHdubq741grZR3qVZGt1BAykgGzatClpsm3ntl2HrymINtf8jRvaH/p0KqSkIjIAVZLpXd7dsLk6Aj4YGxDcZa0uLEy6CY2v23ZL3gW5bdcVBzSVdv3zz7VXSKFQSOsb88CrrzZem5gQt+MFjsFQ5Cu8f2uj0RPx06cblCA2V0fAQArQhoqKfjeBhLYdKqCl7oQufnWoW9o2btzoe7sOvvzyS/Hb4qCKs2XHdDIPR4/4dUjjctheHQFbdgHa/uijrh/YdO7MFt0sFTsIj46OugqkrdXVCRUA3VuyEPkBVZISwvbqCBhIAULZ7/YMnaV2NThz5oyrLXgw7m37HRaRn1AlmTwHa7kyoToCBlLAysLhYeUCWn2LHUfgtl0XxLg3ke0ejsUCr0wyoToCBlLAYnV12tt2Y2NjEeVCEOPeRLbDVGqQVVKmVEfAQAoYXkh5LsdHF2rbnersrHKzHhPUuHdKnoER2omJCQ4gkC+CrJIypToCBpIA5eXlfcoFtO1uPwJ5YGDAVbuuOAM3Ib0+NcVAIl8EVSVlUnUEDCQBvLTK3j158httu2QyadW4d0rB3Xdrf1Nddtm6JHIjFkCVlEnVETCQBMDdlesjKW4ZYMCWQm7Hp4Ma9065u6BAeyDhea3bK0giUx70uUrKtOoIGEhChMNhz227cz09tW7+DQnj3iUlJaPKgD/39EQUkU/8rJIyrToCBpIQtR7O7Um17cYuX44oFySMexcVFY0rA3p7e12FNJEbflVJmVgdAQNJCC+braJth3ad2y1MJIx7V2zYYKRCuuKsI7FtR37yo0rKxOoIGEhCpDZbVS6gbfdBV1edcgFHlUs4xM7L+PtSsKb2h7Y2Vz+b22GdCz+v5XyYOC8H/+ZCn0uRKKiSwmvWGLvJy9TqCLi5qiBuN1sFt9N1pYLGvUtLSxMjIyOuznBayuDgYMypkk4j9JUHP9+7t2W5f/dgc3OD7u/loYcean1s1y7XD1KTfyYmJ8uUIZlaHQErJEG8bLbq1j+Ul7vausiE9evWJZQBqJKOvv32duUTbOlkIlg3lJfzfCcLtLW11c4a2gE8k6sjYCAJ4mWzVbeCHve+1bZt2/pNHQ09dOFCrL29XXtILORYW5v28ENrrqqqykggYY0NIcq1Nj26urt3KEMyuToCtuyEwWarbtt26SoqKkpIutvycmjhcpx5//3Hy50qw9SFHU6dOlVlojrS3VrF13m+tzeKoY9bn13DDQF+B1XV1d31O3e6nvzMVqyOvGEgCYPNVnt7e31pL1VUVLh69skk7Al29J13IsoAXHj/7+jRxoJVq5pNvLFRZXR2dv6zMqDGw2MBt0IQ4WtcbCITPyPcEDh/J9Lt3OlHo9EOBtPysTryhi07YUxNmy1kc2WlmPWjFEz8rTT4/WP3ht+//vq+tuPHtT6fdLarqwL/ronTQ3VNQr5x6NDjxzs6mpb7NeJn5QTTj/4HR7eznXdHrI68Y4UkEDZbveCseSiDTK5JeIVTOOOnTzcoQ1AF4EJ76ZNPIrvq6094eaPjQo2BiSGDv6/a2lrPd8YII7dfY3J0tPp3Bw+G/uOFF15RArS0tGh5bfzql79sVhqxOvKOgSQQHlQ1HUiSxr1vh1M4z3V3b58xdLeZ8rGz1nPwtdeiG8rLu9ESS6cKQUWU+OijSP/gYMzk8eu4cfA6ePLWkSM7vAbm1PR0GKG2p6mpVQXMrzXWdLA60oOBJBAujK3Hjs2avNBVbtok+jC+2MMPt/6xo6NR+QDBhA/8zEucoL63qCiZn58/m//tb/9t4m/2xo18pxoKXZ+eDt0+CGBSJBLxdDHCutZ5TWuSCLWzZ8/2S3iQWhpWR3owkITCZqsmprVS/rGmJqEEe+R73+s7d+5cws+7YYQM2lP4UAKgOorV1XkaKNA9gt4Zj29nIH0TqyN9ONQg1JYtW4xNwGHc2+uuBX5oaGhoMfVckg2wduT1YuR2B4/FLHQoZLZjdaQPA0momvvuGzZ1MZY47r0QXIzvv//+rHpDpqA68rpNkJfzsZZy+6GQ2YzVkV4MJKG8bLZ6JxLHvRfzL089FS8vL8+q/dtwI9LU2Oh5AuzSZ5+FlQFYS1N0U//AgLG2erZVR8BAEgybrSrNJI97L+bHTz/dikMEVZZAVajjznhubi5PGTA/N8eWneMDpwI1tcaZjdURMJAEM7HZquRx78WgWty9e/ebK316YDhIW7du7UBVqEi8eDxubEeVbKyOgIEkmInNVqWPey8Gd4tNe/Y0Z3IoVVZWxnc/84y2C1FeXt6cMiA3Ly9rB01SWB2ZwUASDputKo2kj3svJZNDCetkz2p+6HTd2rVG2pylpaVGTve1CasjMxhIwtXcd5+2iThbxr2XkgqlTFpTQpsuncP/lmvTpk1JE5Oako4sCQKrI3MYSMJhAEHXZqu2jHvfCd6w2FcNLS5luWg02qqzTXcr3Hw4v3Ot65DSjiwJwp97eoyNvWdzdQQMJAtgs1WlgU3j3suBFlesrq7FxhYeph3/dffuV0wPMHz/0UdP66yS6nfuDHwvuyCNjIyETO2gUlxcnPVhz0CyADZbVR7ZOO69HNiIFS08m55Vclp0J/79uede8eP3ofPhYlSkmfgaSsex9nZja0exbduyujoCBpIFsHeY17tcG8e9lwsXXazBPPXEE6IHHtDu+vnPfvay06Lr8HMtT8fDxVize1bATt9BMl0dcY9Abq5qDa+brdo67p0OvKGdj5ePtbVFBwYHa69evRpRArg53kI3BPbhI0cm3ZxGjDDDw8kqy7E6Ms+KQCooKJi46y59xVy6z2c4n38WLS+lSb6L50M2O4EyNjYWUS6lO+6Nn5HO79lPaOPhA0cvYLfrscuXI6bPVrodqqGysrLhH9TXx6VMNqIyc34eE8s9awpVOdp9Xta5dL93gjI5OZmP95+J7+We1auTrI6+kvPS/v2/VkQZDhuN9g0MVI2Pj4dNVE64eK8Nh/uLS0qS/xSN9klfnEYVmRgerr5y5UrFrRuw4vtwAjS5YcOGfuwUYvtjAmSPnJwcBhJlHxyfMDQ0FMbmo1NTU/cgpObn5/NxYZ6ZmVmwcsCFOjc3dxZ/Onf9k7nOnwife0OhiUgkkrR5Ogo/j2tTU/mrCwtnGUAUFAQS15Ao6+Cie3O9SamEoq92lmcQkQCcsiMiIhEYSEREJAIDiYiIRGAgERGRCAwkIiISgYFEREQiMJCIiEgEBhIREYnAQCIiIhEYSEREJAIDiYiIRGAgERGRCAwkIiISgYFEREQiMJCIiEgEBhIREYnAQCIiIhEYSEREJAIDiYiIRGAgERGRCAwkIiISgYFEREQiMJCIiEgEBhIREYnAQCIiIhEYSEREJAIDiYiIRGAgERGRCAwkIiISgYFEREQiMJCIiEiEFYqIKAvl5OQoEuUvfwUYvyPZHkPjVwAAAABJRU5ErkJggg=="});};});var $r,cV,Dm;var uV=d(function(){$r=y(_("react"));$g();cV=y(Ku());B();W();U();$e();QG();oV();lV();Dm=w(function i(){var t=(0,$r.useRef)(null);var _D13=D(),e=_D13.canvas,r=_D13.config;var o=function o(){var a=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(t==null?void 0:t.current){var _t$current=t.current,l=_t$current.clientWidth,c=_t$current.clientHeight;var u=Eo();t.current.width=l*u;t.current.height=c*u;e.saveDimensions({width:l,height:c,render:a});}};var n=new Hl((0,cV["default"])(function(){return o();},100,{trailing:true}));(0,$r.useEffect)(function(){var a=t.current;e.setCanvasElement(a);return function(){n.disconnect();};},[]);(0,$r.useLayoutEffect)(function(){o(false);n.observe(t.current);});var s=r.licenseChecker;return $r["default"].createElement($r["default"].Fragment,null,s&&s.isWhiteLabel()?null:$r["default"].createElement(aV,null),$r["default"].createElement(mt.Element,{ref:t,"aria-label":"Canvas","data-test":N.Canvas}),$r["default"].createElement(ZG,null,$r["default"].createElement(rV,null)));});});var zI,zv;var dV=d(function(){zI=y(_("react"));zv=function zv(_ref298){var i=_ref298.children;return zI["default"].createElement(zI["default"].Fragment,null,i);};});var UI=d(function(){dV();});var Em;var mV=d(function(){it();Xt();$e();UI();Em=function Em(){var _this388=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Em);this.getAdvancedCategoryCard=function(){return _this388.components.advancedUICategoryCard;};this.getAdvancedItemCard=function(){return _this388.components.advancedUIItemCard;};this.getAdvancedToolbarItem=function(){return _this388.components.advancedUIToolbarItem;};this.getAdvancedToolbar=function(){return _this388.components.advancedUIToolbar;};this.getAdvancedToolControlBar=function(){return _this388.components.advancedUIToolControlBar;};this.getBasicToolbar=function(){return _this388.components.basicUIToolbar;};this.getBasicToolControlBar=function(){return _this388.components.basicUIToolControlBar;};this.getBasicToolItemsBar=function(){return _this388.components.basicUIToolItemsBar;};this.getDialog=function(){return _this388.components.dialog;};this.getButton=function(t){return _this388.components.buttons[t];};this.getColorItem=function(){return _this388.components.colorItem;};this.getCheckbox=function(){return _this388.components.checkbox;};this.getWindowContainer=function(){return _this388.components.windowContainer;};this.getSlider=function(){return _this388.components.slider;};var r={dialog:P.Dialog,colorItem:P.ColorItem,checkbox:P.Input.Checkbox,slider:P.Input.Slider,buttons:{mainCanvasActionUndo:mt.Button.TextSecondary,mainCanvasActionRedo:mt.Button.TextSecondary,mainCanvasActionExport:Up,mainCanvasActionClose:Ea,canvasActionEdit:mt.Controls.SpriteActionButton,canvasActionBringToFront:mt.Controls.SpriteActionButton,canvasActionDuplicate:mt.Controls.SpriteActionButton,canvasActionDelete:mt.Controls.SpriteActionButton,canvasActionInvert:mt.Controls.SpriteActionButton,canvasActionFlip:mt.Controls.SpriteActionButton,transformActionFlipHorizontal:hs,transformActionFlipVertical:hs,transformActionRotateClockwise:hs,transformActionRotateAntiClockwise:hs,textAlignment:hs,toolControlBarPrimaryButton:zp,toolControlBarSecondaryButton:Ea},windowContainer:zv};this.components=Fi([r,e,t]);};});var na,Gut,Fm;var pV=d(function(){na=y(_("react"));B();R();it();Xt();Gut=function Gut(_ref299){var i=_ref299.modal,t=_ref299.textTool,e=_ref299.textDesignTool,r=_ref299.custom;var o=i.type,n=i.identifier,s=i.isVisible,a=i.modalProps,l=i.positionOffset;var c=a.headerLabel,u=a.bodyLabel,m=a.confirmLabel,p=a.dismissLabel,h=a.handleClose,g=a.handleConfirm,x=a.handleDismiss;var v=r.getDialog();if(o==="info"){return na["default"].createElement(P.InfoModal,{headerLabel:c,bodyLabel:u},na["default"].createElement(v,{type:o,isVisible:s,identifier:n,position:l,handleClose:h,headerLabel:c,bodyLabel:u}));}if(o==="textEdit"){var _t$locale$canvasContr=t.locale.canvasControls,b=_t$locale$canvasContr.buttonSave,T=_t$locale$canvasContr.buttonClose;var k={type:o,isVisible:i.isVisible,confirmLabel:b,dismissLabel:T,headerLabel:t.locale.canvasControls.inputText};if(t.isTextSelected){return na["default"].createElement(P.TextEditModal,_objectSpread(_objectSpread({},k),{},{defaultText:gt.defaultText(),handleConfirm:t.changeText,handleDismiss:t.setEditMode,text:t.text,maxLength:t.config.maxCharacterLimit,allowEmojis:t.config.allowEmojis}),na["default"].createElement(v,{type:o,isVisible:s,identifier:n,position:l,handleClose:h,confirmLabel:b,dismissLabel:T,headerLabel:t.locale.canvasControls.inputText}));}if(e.isTextDesignSelected){return na["default"].createElement(P.TextEditModal,_objectSpread(_objectSpread({},k),{},{defaultText:Mt.defaultText(),handleConfirm:e.changeText,handleDismiss:e.setEditMode,text:e.text,maxLength:e.config.maxCharacterLimit,allowEmojis:e.config.allowEmojis}),na["default"].createElement(v,{type:o,isVisible:s,identifier:n,position:l,handleClose:h,confirmLabel:b,dismissLabel:T,headerLabel:t.locale.canvasControls.inputText}));}}return na["default"].createElement(P.ActionModal,{type:o,headerLabel:c,bodyLabel:u,confirmLabel:m,dismissLabel:p,handleClose:h,handleConfirm:g,handleDismiss:x},na["default"].createElement(v,{type:o,isVisible:s,identifier:n,position:l,confirmLabel:m,dismissLabel:p,headerLabel:c,bodyLabel:u,handleClose:h}));};Fm=rt("textTool","textDesignTool","modal","custom")(w(Gut));});var Uv,hV,Vut,fV,NI;var gV=d(function(){Uv=y(_("react"));hV=y(_("styled-components"));it();U();Vut=(0,hV["default"])(P.Input.Label)(_templateObject259||(_templateObject259=_taggedTemplateLiteral(["\n padding: 0;\n padding-left: 4px;\n"])));fV=/*#__PURE__*/function(_Uv$default$Component){_inherits(fV,_Uv$default$Component);var _super246=_createSuper(fV);function fV(t){var _this389;_classCallCheck(this,fV);_this389=_super246.call(this,t);_this389.onChange=function(t){_this389.setState({value:t.replace(/[^\d.,-]/g,""),isSubmitted:false});};_this389.onSubmit=function(){var t=_this389.props.getCorrectValue;var _this389$state=_this389.state,e=_this389$state.isSubmitted,r=_this389$state.value;if(!e){_this389.setState({value:t(parseInt(r,10)||0).toString(),isSubmitted:true});}};_this389.state={isSubmitted:false,value:t.value.toString()};return _this389;}_createClass(fV,[{key:"componentDidUpdate",value:function componentDidUpdate(t){var e=this.props.value;if(t.value!==e){this.setState({value:e.toString()});}}},{key:"render",value:function render(){var _this$props18=this.props,t=_this$props18.id,e=_this$props18.isDisabled,r=_this$props18.label,o=_this$props18["aria-label"];var n=this.state.value;return Uv["default"].createElement(P.Input.Text,{id:t,"aria-label":o,value:n,isDisabled:e,onChange:this.onChange,onBlur:this.onSubmit,onKeyUp:sA(this.onSubmit)},Uv["default"].createElement(Vut,{label:r,htmlFor:t}));}}]);return fV;}(Uv["default"].Component);NI=fV;});var xu,HI,jut,$ut,Kut,Xut,qut,gf;var bV=d(function(){xu=y(_("react"));HI=y(_("styled-components"));it();gV();jut=HI["default"].div(_templateObject260||(_templateObject260=_taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: 1fr min-content 1fr;\n gap: 1rem;\n align-items: center;\n max-width: ","px;\n"])),function(i){return i.theme.measurements.inputs.cropSize.maxWidth;});$ut=HI["default"].span(_templateObject261||(_templateObject261=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n"])),function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.textInput.foreground;});Kut="photoeditorsdk-transformScaleWidth";Xut="photoeditorsdk-transformScaleHeight";qut=function qut(_ref300){var _ref300$showLabel=_ref300.showLabel,i=_ref300$showLabel===void 0?true:_ref300$showLabel,t=_ref300.label,e=_ref300.isDisabled,r=_ref300.valueHeight,o=_ref300.valueWidth,n=_ref300.labelWidth,s=_ref300.labelHeight,a=_ref300.ariaLabelWidth,l=_ref300.ariaLabelHeight,c=_ref300.onSubmitWidth,u=_ref300.onSubmitHeight;return xu["default"].createElement("div",null,xu["default"].createElement(P.Input.Label,{id:"photoeditorsdk-crop-size-label",label:t,show:i}),xu["default"].createElement(jut,{"aria-labelledby":"photoeditorsdk-crop-size-label"},xu["default"].createElement(NI,{id:Kut,value:o,getCorrectValue:c,label:n,"aria-label":a,isDisabled:e}),xu["default"].createElement($ut,null,"x"),xu["default"].createElement(NI,{id:Xut,value:r,getCorrectValue:u,label:s,"aria-label":l,isDisabled:e})));};gf=qut;});var Ge=d(function(){yy();SW();JW();f1();uV();mV();pV();MI();bV();});var $V=Gt(function(lne,jV){"use strict";var udt=false;var VV=function VV(){};if(udt){GV=function i(t,e){var r=arguments.length;e=new Array(r>1?r-1:0);for(var o=1;o2?r-2:0);for(var o=2;oi;return Ti["default"].createElement(Hdt,null,p.map(function(g){if(g){var x=g.props.label||"";return Ti["default"].createElement(i0,{activeTab:o,key:x,label:x,onClick:c});}return null;}),h&&Ti["default"].createElement(Wdt,{onClick:u,ariaLabel:"Select Next"},"..."),s&&m(),Ti["default"].Children.map(t,function(g){if(!g||g.props&&g.props.label!==o){return null;}return Ti["default"].createElement(WK,{key:g.props.label},g.props.children);}));};});var r0=d(function(){NK();KK();});var Jo,qK,YK,XK,Vdt,JK;var ZK=d(function(){Jo=y(_("react"));qK=y(Ku());YK=y(_("styled-components"));Sr();r0();XK=100;Vdt=YK["default"].div(_templateObject286||(_templateObject286=_taggedTemplateLiteral(["\n position: relative;\n white-space: nowrap;\n display: flex;\n flex-direction: column;\n transition: all 0.2s linear;\n"])));JK=function JK(_ref331){var i=_ref331.children;var _ref332=(0,Jo.useState)(Jo["default"].Children.count(i)),_ref333=_slicedToArray(_ref332,2),t=_ref333[0],e=_ref333[1];var _ref334=(0,Jo.useContext)(Oe),r=_ref334.rect;(0,Jo.useEffect)(function(){window.addEventListener("resize",o);o();return function(){window.removeEventListener("resize",o);};},[r]);var o=(0,qK["default"])(function(){var n=(r==null?void 0:r.width)||0;var s=Jo["default"].Children.count(i);var a=n-32-64-s*XK;if(a<0){var l=Math.round(Math.abs(a/XK));e(s-l);}else{e(s);}},100);if(!t){return null;}return Jo["default"].createElement(Vdt,null,Jo["default"].createElement(Gf,{length:t},i));};});var o0,jdt,QK;var tX=d(function(){o0=y(_("styled-components"));jdt=o0["default"].div(_templateObject287||(_templateObject287=_taggedTemplateLiteral(["\n &:after {\n content: '';\n position: absolute;\n bottom: 0px;\n ","\n border-bottom: 1px solid ",";\n }\n"])),function(i){return i.full?o0.css(_templateObject288||(_templateObject288=_taggedTemplateLiteral(["\n left: -24px;\n width: calc(100% + 48px);\n "]))):"\n left: 24px;\n width: calc(100% - 48px);\n ";},function(i){return i.theme.toolControlBar.separatorColor;});QK=jdt;});var Vf,n0,eX,$dt,iX;var rX=d(function(){Vf=y(_("react"));n0=y(_("styled-components"));Sr();W();eX=n0.css(_templateObject289||(_templateObject289=_taggedTemplateLiteral(["\n width: 100%;\n"])));$dt=n0["default"].div(_templateObject290||(_templateObject290=_taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n width: 100%;\n\n > div {\n position: relative;\n width: 224px;\n\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n }\n"])),function(i){return i.smallContainer&&eX;},eX);iX=function iX(_ref335){var i=_ref335.children,t=_objectWithoutProperties(_ref335,_excluded12);var _D16=D(),e=_D16.custom;var _ref336=(0,Vf.useContext)(Oe),r=_ref336.rect;var o=e.getSlider();if(!o){return null;}return Vf["default"].createElement($dt,{smallContainer:!!r&&r.width<600},Vf["default"].createElement(o,_objectSpread({centerSlider:true},t),i));};});var s0,Kdt,oX;var nX=d(function(){s0=y(_("styled-components"));U();Kdt=s0["default"].div.attrs(function(){return{"data-test":N.CategoryItemsContainer};})(_templateObject291||(_templateObject291=_taggedTemplateLiteral(["\n visibility: hidden;\n opacity: 0;\n display: none;\n\n ","\n"])),function(_ref337){var i=_ref337.show;return i&&s0.css(_templateObject292||(_templateObject292=_taggedTemplateLiteral(["\n opacity: 1;\n visibility: visible;\n display: flex;\n "])));});oX=Kdt;});var jf,fD;var sX=d(function(){jf=y(_("styled-components"));U();fD=jf["default"].div.attrs(function(){return{"data-test":N.ToolControlBar};})(_templateObject293||(_templateObject293=_taggedTemplateLiteral(["\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n position: relative;\n width: 100%;\n z-index: ",";\n\n ","\n"])),function(i){return i.theme.measurements.zIndex.toolControlBar;},function(i){return i.show?jf.css(_templateObject294||(_templateObject294=_taggedTemplateLiteral(["\n transition-timing-function: ease-in;\n transition-duration: 0.3s;\n transition-property: all;\n padding: 2px 0px;\n background: ",";\n color: ",";\n "])),i.theme.toolControlBar.background,i.theme.toolControlBar.inputLabelForeground):jf.css(_templateObject295||(_templateObject295=_taggedTemplateLiteral(["\n max-height: 0px;\n "])));});fD.defaultProps={show:true};});var aX,Xdt,lX;var cX=d(function(){aX=y(_("styled-components"));Xdt=aX["default"].div(_templateObject296||(_templateObject296=_taggedTemplateLiteral(["\n height: ","px;\n width: 2px;\n margin: 0 10px;\n display: inline-flex;\n position: relative;\n &:after {\n content: ' ';\n right: 0px;\n position: absolute;\n top: 8px;\n height: calc(100% - 16px);\n border-right: 1px solid\n ",";\n }\n"])),function(i){return i.theme.measurements.basicUIToolControlBar.itemsBarHeight;},function(i){return i.theme.toolControlBar.separatorColor;});lX=Xdt;});var da,dX,uX,a0,mX,l0;var gD=d(function(){da=y(_("styled-components"));it();dX=da["default"].span(_templateObject297||(_templateObject297=_taggedTemplateLiteral(["\n display: flex;\n cursor: pointer;\n z-index: ",";\n transition: bottom 0.3s linear;\n\n color: ",";\n letter-spacing: ",";\n font-size: ","px;\n\n ","\n\n &:active {\n color: ",";\n }\n"])),function(i){return i.theme.measurements.zIndex.label;},function(i){return i.theme.toolbar.foreground;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body.size;},function(_ref338){var i=_ref338.isActive;return i&&da.css(_templateObject298||(_templateObject298=_taggedTemplateLiteral(["\n color: ",";\n "])),function(t){return t.theme.toolbar.activeForeground;});},function(i){return i.theme.toolbar.activeForeground;});uX=da.css(_templateObject299||(_templateObject299=_taggedTemplateLiteral(["\n background-color: ",";\n color: ",";\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.toolbar.activeBackground;},function(i){return i.theme.toolbar.activeForeground;},function(i){return i.theme.toolbar.activeForeground;});a0=(0,da["default"])(yi)(_templateObject300||(_templateObject300=_taggedTemplateLiteral(["\n display: block;\n height: 100%;\n width: 100%;\n color: ",";\n background-color: ",";\n border: unset;\n box-shadow: unset;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n font-family: '","', sans-serif;\n\n ","\n ","\n\n &:active {\n ","\n }\n\n svg {\n display: flex;\n transition: visibility 0s, opacity 0.5s linear;\n visibility: visible;\n opacity: 1;\n }\n"])),function(i){return i.theme.toolbar.foreground;},function(i){return i.theme.toolbar.background;},function(i){return i.theme.measurements.fontSystem.label.size;},function(i){return i.theme.measurements.fontSystem.label.letterSpacing;},function(i){return i.theme.measurements.fontSystem.label["case"];},function(i){return i.theme.typography.fontFamily;},function(_ref339){var i=_ref339.isActive;return i&&uX;},function(_ref340){var i=_ref340.isDisabled;return i&&da.css(_templateObject301||(_templateObject301=_taggedTemplateLiteral(["\n &:disabled {\n cursor: default;\n pointer-events: none;\n opacity: ",";\n }\n "])),function(t){return t.theme.button.textInactiveOpacity;});},uX);mX=da["default"].div(_templateObject302||(_templateObject302=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.toolbar.foreground;});l0=da["default"].div.attrs({role:"none"})(_templateObject303||(_templateObject303=_taggedTemplateLiteral(["\n display: flex;\n height: ","px;\n text-align: center;\n min-width: 100px;\n /* Allow the text to grow in this limit */\n max-width: 150px;\n position: relative;\n /* Position inline-block box at the top of the line box */\n vertical-align: top;\n /* Allow text to wrap again, overwriting the Toolbar style */\n white-space: normal;\n margin: 1px;\n"])),function(i){return i.theme.measurements.basicUIToolbar.openHeight-2;});});var bD,$f,qdt,pX;var hX=d(function(){bD=y(_("react"));$f=y(_("styled-components"));it();U();gD();qdt=$f["default"].div(_templateObject304||(_templateObject304=_taggedTemplateLiteral(["\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n position: relative;\n width: 100%;\n transition: height 0.2s ease-out, display 0.1s fade-out;\n background-color: ",";\n color: ",";\n z-index: ",";\n\n ","\n"])),function(i){return i.theme.toolbar.background;},function(i){return i.theme.toolbar.foreground;},function(i){return i.theme.measurements.zIndex.toolbar;},function(i){return i.show?$f.css(_templateObject305||(_templateObject305=_taggedTemplateLiteral(["\n height: ","px;\n "," {\n svg {\n visibility: hidden;\n opacity: 0;\n height: 0;\n }\n }\n "," {\n height: ","px;\n }\n "])),i.theme.measurements.basicUIToolbar.closeHeight,a0,l0,i.theme.measurements.basicUIToolbar.closeHeight):$f.css(_templateObject306||(_templateObject306=_taggedTemplateLiteral(["\n height: ","px;\n "])),i.theme.measurements.basicUIToolbar.openHeight);});pX=function pX(_ref341){var _ref341$show=_ref341.show,i=_ref341$show===void 0?false:_ref341$show,t=_ref341.className,e=_ref341.style,r=_ref341.children;return bD["default"].createElement(qdt,{"data-test":N.Toolbar,show:i,className:t,style:e},bD["default"].createElement(Oo,null,r));};});var Kf,fX;var gX=d(function(){Kf=y(_("react"));U();gD();fX=function fX(_ref342){var i=_ref342.children,t=_ref342.label,e=_ref342.isActive,r=_ref342.isDisabled,o=_ref342.onClick;return Kf["default"].createElement(l0,{"aria-haspopup":true,"aria-expanded":e},Kf["default"].createElement(a0,{"data-test":N.ToolbarItem,ariaLabel:t,onClick:o,isActive:e,isDisabled:r},Kf["default"].createElement(mX,null,i,Kf["default"].createElement(dX,{isActive:e},t))));};});var Xf,Ydt,bX;var yX=d(function(){Xf=y(_("styled-components"));Ydt=Xf["default"].li.attrs({role:"none"})(_templateObject307||(_templateObject307=_taggedTemplateLiteral(["\n ","\n width: 2px;\n display: inline-block;\n position: relative;\n &:after {\n content: ' ';\n right: 0px;\n position: absolute;\n top: 8px;\n height: calc(100% - 16px);\n border-right: 1px solid\n ",";\n }\n"])),function(i){return!i.active?Xf.css(_templateObject308||(_templateObject308=_taggedTemplateLiteral(["\n height: ","px;\n "])),i.theme.measurements.basicUIToolbar.openHeight):Xf.css(_templateObject309||(_templateObject309=_taggedTemplateLiteral(["\n height: ","px;\n "])),i.theme.measurements.basicUIToolbar.closeHeight);},function(i){return i.theme.toolControlBar.separatorColor;});bX=Ydt;});var M;var qt=d(function(){it();wK();IK();FK();AK();LK();ZK();tX();rX();r0();nX();sX();cX();hX();gX();yX();M={CardContainer:_K,ExpandableContainer:oX,CategoryContainer:kK,Card:gK,CardAvatar:Jl,CardLabel:CK,Toolbar:{Index:pX,Item:fX,Separator:bX},BarSeparator:QK,ItemsSeparator:lX,Itemsbar:fD,Controlsbar:EK,ControlsbarContainer:MK,ResponsiveTabWrapper:JK,Slider:iX,TabWrapper:Gf,Tab:ua,Other:{ControlsWrapper:RK}};});var Um,_X;var xX=d(function(){Um=y(_("react"));B();R();W();we();qt();_X=w(function i(){var _D17=D(),t=_D17.config,e=_D17.active,r=_D17.custom;var o=t.tools;var n=e.tool;var s=function s(u){var m=t.state.config[u];if("icon"in m){var h=m.icon;return Um["default"].createElement(h,null);}var p=vy[u];return Um["default"].createElement(p,null)||null;};var a=function a(u){return t.locale[u].title;};var l=function l(u,m){return u&&Um["default"].createElement(M.Toolbar.Item,{onClick:function onClick(){return e.selectTool(u);},key:u,label:a(u),isActive:n===u,isDisabled:!(e.image||u==="library"||u==="customTool")},s(u))||Um["default"].createElement(M.Toolbar.Separator,{key:u+m,active:!!n});};var c=r.getBasicToolbar();if(!c){return null;}return Um["default"].createElement(c,{show:!!n},o.map(l));});});var Yn,vX,Jdt,Zdt,CX;var SX=d(function(){Yn=y(_("react"));B();vX=y(_("styled-components"));R();it();we();qt();Jdt=(0,vX["default"])(M.ControlsbarContainer)(_templateObject310||(_templateObject310=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));Zdt=function Zdt(_ref343){var i=_ref343.adjustmentsTool,t=_ref343.custom;var e=i.selectedAdjustmentType.toLowerCase();var r=i[e];var o=t.getButton("toolControlBarSecondaryButton");return Yn["default"].createElement(Jdt,{show:Boolean(e)},o&&Yn["default"].createElement("div",null,Yn["default"].createElement(o,{tool:"adjustment",ariaLabel:i.locale.controls.buttonReset,onClick:i.reset,icon:Yn["default"].createElement(Re.reset,null),label:i.locale.controls.buttonReset})),Yn["default"].createElement(M.Other.ControlsWrapper,null,Yn["default"].createElement(P.Spacer,{count:2}),Yn["default"].createElement(M.Slider,{identifier:i.selectedAdjustmentType,tool:"adjustment","aria-hidden":!e,adjust:true,label:i.selectedOptionLabel,value:r,onChange:function onChange(n){i.editAdjustments({type:e,value:n});},onMouseUp:function onMouseUp(){return i.toolSnapshot();},onTouchEnd:function onTouchEnd(){return i.toolSnapshot();},snap:0}),Yn["default"].createElement(P.Spacer,{count:2})),Yn["default"].createElement(M.BarSeparator,null));};CX=rt("adjustmentsTool","custom")(w(Zdt));});var qf,wX;var TX=d(function(){qf=y(_("react"));B();R();Ge();it();W();wX=w(function(){var _D18=D(),i=_D18.brushTool;var t=i.colorList,e=i.locale,r=i.localeColor;var o=e.controls;var n=r.colorPicker;return qf["default"].createElement(qf["default"].Fragment,null,qf["default"].createElement(P.Input.Selection,{showLabel:false,label:o.selectColor},qf["default"].createElement(De,{tool:"brush",activeColor:i.color,colors:t,labelsColor:n,colorPickerDirection:"top",onChange:i.changeColor})));});});var kX=d(function(){TX();});var IX,DX;var EX=d(function(){IX=y(_("react"));B();R();W();U();qt();DX=w(function(){var _D19=D(),i=_D19.brushTool;var t=i.locale;var e=t.controls;return IX["default"].createElement(M.Slider,{identifier:"brush-hardness",tool:"brush","data-test":N.BrushHardness,showLabel:false,label:e.sliderHardness,value:i.hardness,min:0,max:1,onChange:i.changeHardness});});});var FX=d(function(){EX();});var OX,RX;var AX=d(function(){OX=y(_("react"));B();R();W();U();qt();RX=w(function(){var _D20=D(),i=_D20.brushTool;var t=i.locale;var e=t.controls;return OX["default"].createElement(M.Slider,{identifier:"brush-size",tool:"brush","data-test":N.BrushSize,showLabel:false,label:e.sliderSize,value:i.relativeSize,min:1,max:100,divider:1,onChange:i.changeRelativeSize});});});var BX=d(function(){AX();});var yr,PX,Qdt,yD,tmt,MX;var LX=d(function(){yr=y(_("react"));B();PX=y(_("styled-components"));R();it();W();we();qt();kX();FX();BX();Qdt=M.ResponsiveTabWrapper;var _M2=M;yD=_M2.Tab;tmt=(0,PX["default"])(M.ControlsbarContainer)(_templateObject311||(_templateObject311=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));MX=w(function(){var _D21=D(),i=_D21.brushTool,t=_D21.custom;var e=i.locale,r=i.config;var o=r.basicUIToolControlBarTabsOrder;var n=e.controls;var s=t.getButton("toolControlBarSecondaryButton");var a=function a(l){switch(l){case"brushColor":return yr["default"].createElement(yD,{key:l,label:n.tabColor},yr["default"].createElement(wX,null));case"brushSize":return yr["default"].createElement(yD,{key:l,label:n.tabSize},yr["default"].createElement(RX,null));case"brushHardness":return yr["default"].createElement(yD,{key:l,label:n.tabHardness},yr["default"].createElement(DX,null));default:return null;}};return yr["default"].createElement(tmt,{style:{justifyContent:"center"},show:true},s&&yr["default"].createElement("div",null,yr["default"].createElement(s,{tool:"brush",ariaLabel:n.buttonReset,onClick:i.reset,icon:yr["default"].createElement(Re.reset,null),isDisabled:!i.isDirty,label:n.buttonReset})),yr["default"].createElement(M.Other.ControlsWrapper,null,yr["default"].createElement(P.Input.Form,null,yr["default"].createElement(Qdt,null,o.map(function(l){return a(l);})))));});});var Yf,zX;var UX=d(function(){Yf=y(_("react"));B();R();it();W();qt();zX=w(function(){var _D22=D(),i=_D22.filterTool;var t=i.state;var e=i.locale.controls;var r=function r(){i.toolSnapshot();};return Yf["default"].createElement(M.Other.ControlsWrapper,null,Yf["default"].createElement(P.Spacer,{count:2}),Yf["default"].createElement(M.Slider,{identifier:"filter-intensity",tool:"filter","aria-hidden":!i.isOptionSelected,label:e.sliderIntensity,value:t.intensity,min:0,max:1,onMouseUp:r,onTouchEnd:r,onChange:i.changeIntensity,snap:t.isDuotone?.5:null}),Yf["default"].createElement(P.Spacer,{count:2}));});});var NX=d(function(){UX();});var Au,HX,emt,WX;var GX=d(function(){Au=y(_("react"));B();HX=y(_("styled-components"));R();W();we();qt();NX();emt=(0,HX["default"])(M.ControlsbarContainer)(_templateObject312||(_templateObject312=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));WX=w(function(){var _D23=D(),i=_D23.filterTool,t=_D23.custom;var e=i.config;var r=e.basicUIToolControlBarTabsOrder;var o=t.getButton("toolControlBarSecondaryButton");var n=function n(s){switch(s){case"filterIntensity":return Au["default"].createElement(zX,{key:s});default:return null;}};return Au["default"].createElement(emt,{show:i.isOptionSelected},o&&Au["default"].createElement("div",null,Au["default"].createElement(o,{tool:"filter",ariaLabel:i.locale.controls.buttonReset,onClick:i.reset,icon:Au["default"].createElement(Re.reset,null),label:i.locale.controls.buttonReset})),r.map(function(s){return n(s);}),Au["default"].createElement(M.BarSeparator,null));});});var Jn,VX,imt,jX;var $X=d(function(){Jn=y(_("react"));B();VX=y(_("styled-components"));R();it();W();we();qt();imt=(0,VX["default"])(M.ControlsbarContainer)(_templateObject313||(_templateObject313=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));jX=w(function(){var _D24=D(),i=_D24.focusTool,t=_D24.custom;var e=i.locale.controls;var r=t.getButton("toolControlBarSecondaryButton");var o=function o(){i.toolSnapshot(e.sliderIntensity);};return Jn["default"].createElement(imt,{show:i.isOptionSelected},r&&Jn["default"].createElement("div",null,Jn["default"].createElement(r,{tool:"focus",ariaLabel:e.buttonReset,onClick:i.reset,icon:Jn["default"].createElement(Re.reset,null),label:e.buttonReset})),Jn["default"].createElement(M.Other.ControlsWrapper,null,Jn["default"].createElement(P.Spacer,{count:2}),Jn["default"].createElement(M.Slider,{identifier:"focus-intensity",tool:"focus","aria-hidden":!i.isOptionSelected,label:e.sliderIntensity,value:i.relativeIntensity,min:0,max:100,divider:1,onChange:i.changeRelativeIntensity,onMouseUp:o,onTouchEnd:o}),Jn["default"].createElement(P.Spacer,{count:2})),Jn["default"].createElement(M.BarSeparator,null));});});var _D,KX;var XX=d(function(){_D=y(_("react"));B();R();Ge();it();W();KX=w(function(){var _D25=D(),i=_D25.frameTool;var t=i.locale.controls;var e=i.localeColor.colorPicker;var r=i.colorList;return _D["default"].createElement(P.Input.Selection,{label:t.selectColor,showLabel:false},_D["default"].createElement(De,{tool:"frame",activeColor:i.color,colors:r,labelsColor:e,colorPickerDirection:"top",onChange:i.changeColor,onAddSnapshot:i.colorSnapshot}));});});var qX=d(function(){XX();});var YX,JX;var ZX=d(function(){YX=y(_("react"));B();R();W();qt();JX=w(function(){var _D26=D(),i=_D26.frameTool;var t=i.locale.controls;var e=function e(){i.toolSnapshot(t.sliderOpacity);};return YX["default"].createElement(M.Slider,{identifier:"frame-opacity",tool:"frame","aria-hidden":!i.isOptionSelected,showLabel:false,label:t.sliderOpacity,value:i.opacity,min:0,max:1,onChange:i.changeOpacity,onMouseUp:e,onTouchEnd:e});});});var QX=d(function(){ZX();});var tq,eq;var iq=d(function(){tq=y(_("react"));B();R();W();qt();eq=w(function(){var _D27=D(),i=_D27.frameTool;var t=i.locale.controls;var e=function e(){i.toolSnapshot(t.sliderSize);};return tq["default"].createElement(M.Slider,{identifier:"frame-size",tool:"frame","aria-hidden":!i.isOptionSelected,showLabel:false,label:t.sliderSize,value:i.size,min:i.minSize,max:i.maxSize,divider:1,onChange:i.changeWidth,onMouseUp:e,onTouchEnd:e});});});var rq=d(function(){iq();});var _r,oq,rmt,xD,omt,nq;var sq=d(function(){_r=y(_("react"));B();oq=y(_("styled-components"));R();W();we();qt();qX();QX();rq();rmt=M.TabWrapper;var _M3=M;xD=_M3.Tab;omt=(0,oq["default"])(M.ControlsbarContainer)(_templateObject314||(_templateObject314=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));nq=w(function(){var _D28=D(),i=_D28.frameTool,t=_D28.custom;var e=i.locale.controls;var r=i.tintable,o=i.config;var n=o.basicUIToolControlBarTabsOrder;var s=t.getButton("toolControlBarSecondaryButton");var a=function a(l){switch(l){case"frameOpacity":return _r["default"].createElement(xD,{key:l,label:e.tabOpacity},_r["default"].createElement(JX,null));case"frameSize":return _r["default"].createElement(xD,{key:l,label:e.tabSize},_r["default"].createElement(eq,null));case"frameColor":return r&&_r["default"].createElement(xD,{key:l,label:e.tabColor},_r["default"].createElement(KX,null));default:return null;}};return _r["default"].createElement(omt,{show:i.isOptionSelected},s&&_r["default"].createElement("div",null,_r["default"].createElement(s,{tool:"frame",ariaLabel:e.buttonReset,onClick:i.reset,icon:_r["default"].createElement(Re.reset,null),label:e.buttonReset})),_r["default"].createElement(M.Other.ControlsWrapper,null,_r["default"].createElement(rmt,null,n.map(function(l){return a(l);}))),_r["default"].createElement(M.BarSeparator,null));});});var bo,Jf,nmt,smt,amt,aq;var lq=d(function(){bo=y(_("react"));B();Jf=y(_("styled-components"));R();it();we();U();nD();qt();nmt=(0,Jf["default"])(M.ControlsbarContainer)(_templateObject315||(_templateObject315=_taggedTemplateLiteral(["\n ","\n"])),function(i){return i.firstChildMargin&&Jf.css(_templateObject316||(_templateObject316=_taggedTemplateLiteral(["\n > :first-child {\n margin-right: 16px;\n }\n "])));});smt=(0,Jf["default"])(M.Other.ControlsWrapper)(_templateObject317||(_templateObject317=_taggedTemplateLiteral(["\n grid-column-start: 2;\n align-self: center;\n"])));amt=function amt(_ref344){var i=_ref344.library,t=_ref344.active,e=_ref344.custom;var r=i.locale.controls.placeholderSearch;var o=i.config;var n=e.getButton("toolControlBarPrimaryButton");var s=function s(u){i.fetchImages(u);};var a=function a(u){var m=u.target.files;if(m.length){var p=new FileReader();p.onload=function(h){t.newImage(h.target.result);};p.readAsDataURL(m[0]);}};var l=function l(){t.selectWebcam(true);};var c=function c(){var u=document.getElementById("fileUpload");if(u){u.click();}};return bo["default"].createElement(nmt,{firstChildMargin:o.enableWebcam&&!i.libraryProvider,show:true},o.enableUpload&&n&&bo["default"].createElement("div",null,bo["default"].createElement(n,{tool:"library","data-test":N.LibraryUploadButton,ariaLabel:i.locale.controls.buttonUpload,onClick:c,icon:bo["default"].createElement(Re.uploadImage,null),label:i.locale.controls.buttonUpload},bo["default"].createElement(P.Input.File,{onChange:a}))),i.libraryProvider&&bo["default"].createElement(smt,null,bo["default"].createElement(P.Input.Search,{onChange:s,placeholder:r})),o.enableWebcam&&bo["default"].createElement("div",null,bo["default"].createElement(Xv,{tool:"library",onClick:l,icon:bo["default"].createElement(Re.openWebcam,null),label:i.locale.controls.buttonWebcamOpen})),bo["default"].createElement(M.BarSeparator,null));};aq=rt("library","active","custom")(w(amt));});var cq,uq;var dq=d(function(){cq=y(_("react"));B();it();W();uq=w(function(){var _D29=D(),i=_D29.overlayTool;var t=i.locale.controls;var e=i.blendMode,r=i.allBlendModes;var o=function o(n){i.changeBlendMode(n);};return cq["default"].createElement(P.Input.CarouselSlider,{showLabel:false,label:t.carouselBlendMode,defaultIdentifier:e,onSelect:o,list:r});});});var mq=d(function(){dq();});var pq,hq;var fq=d(function(){pq=y(_("react"));B();R();W();qt();hq=w(function(){var _D30=D(),i=_D30.overlayTool;var t=i.locale.controls;var e=i.state;var r=function r(){i.toolSnapshot();};return pq["default"].createElement(M.Slider,{identifier:"overlay-opacity",tool:"overlay","aria-hidden":!i.isOptionSelected,showLabel:false,label:t.sliderOpacity,value:e.opacity,min:0,max:1,onChange:i.changeOpacity,onMouseUp:r,onTouchEnd:r});});});var gq=d(function(){fq();});var yo,lmt,bq,yq;var _q=d(function(){yo=y(_("react"));B();R();W();we();qt();mq();gq();lmt=M.TabWrapper;var _M4=M;bq=_M4.Tab;yq=w(function(){var _D31=D(),i=_D31.overlayTool,t=_D31.custom;var e=i.config;var r=e.basicUIToolControlBarTabsOrder;var o=i.locale.controls;var n=t.getButton("toolControlBarSecondaryButton");var s=function s(a){switch(a){case"overlayBlendMode":return yo["default"].createElement(bq,{key:a,label:o.tabBlendMode},yo["default"].createElement(uq,null));case"overlayOpacity":return yo["default"].createElement(bq,{key:a,label:o.tabOpacity},yo["default"].createElement(hq,null));default:return null;}};return yo["default"].createElement(M.ControlsbarContainer,{show:i.isOptionSelected},n&&yo["default"].createElement("div",null,yo["default"].createElement(n,{tool:"overlay",ariaLabel:o.buttonReset,onClick:i.reset,icon:yo["default"].createElement(Re.reset,null),label:o.buttonReset})),yo["default"].createElement(M.Other.ControlsWrapper,null,yo["default"].createElement(lmt,null,r.map(function(a){return s(a);}))),yo["default"].createElement(M.BarSeparator,null));});});var Zf,xq;var vq=d(function(){Zf=y(_("react"));B();R();Ge();it();W();xq=w(function(){var _D32=D(),i=_D32.stickerTool;var t=i.locale.controls;var e=i.localeColor.colorPicker;var r=i.colorList;return Zf["default"].createElement(Zf["default"].Fragment,null,Zf["default"].createElement(P.Input.Selection,{isDisabled:!i.isStickerSelected,showLabel:false,label:t.selectColor},Zf["default"].createElement(De,{tool:"sticker",activeSprite:i.id,activeColor:i.tintColor,colors:r,labelsColor:e,isDisabled:!i.isStickerSelected,colorPickerDirection:"top",onChange:i.changeTintColor,onAddSnapshot:i.tintColorSnapshot})));});});var Cq=d(function(){vq();});var Sq,wq;var Tq=d(function(){Sq=y(_("react"));B();R();W();qt();wq=w(function(){var _D33=D(),i=_D33.stickerTool;var t=i.locale.controls;var e=function e(){i.toolSnapshot();};return Sq["default"].createElement(M.Slider,{identifier:"sticker-opacity",tool:"sticker",isDisabled:!i.isStickerSelected,showLabel:false,label:t.sliderOpacity,value:i.opacity,min:0,max:1,onMouseUp:e,onTouchEnd:e,onChange:i.changeOpacity});});});var kq=d(function(){Tq();});var Kr,vD,cmt,Iq,umt,dmt,Dq;var Eq=d(function(){Kr=y(_("react"));B();vD=y(_("styled-components"));R();it();W();we();qt();Cq();kq();cmt=M.TabWrapper;var _M5=M;Iq=_M5.Tab;umt=vD["default"].input.attrs({type:"file",id:"fileUpload",accept:"image/*",multiple:true})(_templateObject318||(_templateObject318=_taggedTemplateLiteral(["\n ","\n"])),gy.VisuallyHidden);dmt=(0,vD["default"])(M.ControlsbarContainer)(_templateObject319||(_templateObject319=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));Dq=w(function(){var _D34=D(),i=_D34.stickerTool,t=_D34.custom;var e=i.config;var r=e.basicUIToolControlBarTabsOrder;var o=i.locale.controls;var n=t.getButton("toolControlBarPrimaryButton");var s=function s(){var u=document.getElementById("fileUpload");if(u){u.value=null;u.click();}};var a=function a(u){var m=u.target.files;i.addFiles(m);};var l=function l(u){switch(u){case"stickerColor":if(!i.tintable)return null;return Kr["default"].createElement(Iq,{key:u,label:o.tabColor},Kr["default"].createElement(xq,null));case"stickerOpacity":return Kr["default"].createElement(Iq,{key:u,label:o.tabOpacity},Kr["default"].createElement(wq,null));default:return null;}};var c=function c(){if(i.isCustomStickerEnabled&&n){return Kr["default"].createElement("div",null,Kr["default"].createElement(n,{tool:"sticker",ariaLabel:o.buttonUpload,onClick:s,icon:Kr["default"].createElement(Re.uploadImage,null),label:o.buttonUpload},Kr["default"].createElement(umt,{onChange:a})));}return null;};return Kr["default"].createElement(dmt,{show:true},c(),Kr["default"].createElement(M.Other.ControlsWrapper,null,Kr["default"].createElement(cmt,null,r.map(function(u){return l(u);}))),Kr["default"].createElement(M.BarSeparator,null));});});var CD,Fq;var Oq=d(function(){CD=y(_("react"));B();R();Ge();it();W();Fq=w(function(){var _D35=D(),i=_D35.textTool;var t=i.backgroundColorList;var e=i.locale.controls;var r=i.localeColor.colorPicker;return CD["default"].createElement(P.Input.Selection,{isDisabled:!i.isTextSelected,showLabel:false,label:e.selectBackgroundColor},CD["default"].createElement(De,{tool:"text",activeSprite:i.id,activeColor:i.backgroundColor,colors:t,labelsColor:r,colorPickerDirection:"top",isDisabled:!i.isTextSelected,onChange:i.changeBackgroundColor,onAddSnapshot:i.backgroundColorSnapshot}));});});var Rq=d(function(){Oq();});var Aq,Bq,mmt,Pq;var Mq=d(function(){Aq=y(_("react"));B();Bq=y(_("styled-components"));it();W();mmt=(0,Bq["default"])(P.Input.NumericInput)(_templateObject320||(_templateObject320=_taggedTemplateLiteral(["\n max-width: 55px;\n > div > input {\n text-align: center;\n }\n"])));Pq=w(function(){var r;var _D36=D(),i=_D36.textTool;var t=i.locale;var e=function e(o){var n=o?parseFloat(o):0;i.setFontSize(Math.max(10,Math.min(690,n)));};return Aq["default"].createElement(mmt,{id:"photoeditorsdk-text-font-size-input",value:i.fontSize.toFixed(0),onSubmit:e,isDisabled:!i.isTextSelected,label:(r=t.controls)==null?void 0:r.textFontSize,showLabel:false});});});var Lq=d(function(){Mq();});var zq,Uq;var Nq=d(function(){zq=y(_("react"));B();R();W();qt();Uq=w(function(){var _D37=D(),i=_D37.textTool;var t=i.locale.controls;var e=function e(){i.toolSnapshot();};return zq["default"].createElement(M.Slider,{identifier:"text-line-spacing",tool:"text",isDisabled:!i.isTextSelected,showLabel:false,label:t.sliderLineSpacing,value:i.lineHeight,min:.5,max:3,onChange:i.changeLineHeight,onMouseUp:e,onTouchEnd:e,snap:1,divider:1,decimal:1});});});var Hq=d(function(){Nq();});var c0,Wq;var Gq=d(function(){c0=y(_("react"));B();it();W();we();U();Wq=w(function(){var _D38=D(),i=_D38.textTool,t=_D38.custom;var e=i.locale.controls;var r=["left","center","right"];var o=t.getButton("textAlignment");return c0["default"].createElement(P.Input.Selection,{isDisabled:!i.isTextSelected,showLabel:false,label:e.selectAlignment,"data-test":N.TextAlignment},r.map(function(n){var s=Cy[n];return c0["default"].createElement(o,{tool:n,isDisabled:!i.isTextSelected,ariaLabel:"Align ".concat(n),isActive:n===i.alignment,key:n,icon:c0["default"].createElement(s,null),onClick:function onClick(){return i.changeAlignment(n);}});}));});});var Vq=d(function(){Gq();});var SD,jq;var $q=d(function(){SD=y(_("react"));B();R();Ge();it();W();jq=w(function(){var _D39=D(),i=_D39.textTool;var t=i.colorList;var e=i.locale.controls;var r=i.localeColor.colorPicker;return SD["default"].createElement(P.Input.Selection,{isDisabled:!i.isTextSelected,showLabel:false,label:e.selectFontColor},SD["default"].createElement(De,{tool:"text",activeSprite:i.id,activeColor:i.textColor,colors:t,labelsColor:r,colorPickerDirection:"top",isDisabled:!i.isTextSelected,onChange:i.changeColor,onAddSnapshot:i.colorSnapshot}));});});var Kq=d(function(){$q();});var fi,Xq,pmt,hmt,qq;var Yq=d(function(){fi=y(_("react"));B();Xq=y(_("styled-components"));R();W();we();qt();r0();Rq();Lq();Hq();Vq();Kq();pmt=M.ResponsiveTabWrapper;hmt=(0,Xq["default"])(M.ControlsbarContainer)(_templateObject321||(_templateObject321=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));qq=w(function(){var _D40=D(),i=_D40.textTool,t=_D40.custom;var e=i.config;var r=e.basicUIToolControlBarTabsOrder;var o=i.locale.controls;var n=t.getButton("toolControlBarPrimaryButton");var s=function s(a){switch(a){case"fontSize":return fi["default"].createElement(ua,{key:a,label:o.tabFontSize},fi["default"].createElement(Pq,null));case"textAlignment":return fi["default"].createElement(ua,{key:a,label:o.tabAlignment},fi["default"].createElement(Wq,null));case"textColor":return fi["default"].createElement(ua,{key:a,label:o.tabColor},fi["default"].createElement(jq,null));case"backgroundColor":return fi["default"].createElement(ua,{key:a,label:o.tabBgColor},fi["default"].createElement(Fq,null));case"lineSpacing":return fi["default"].createElement(ua,{key:a,label:o.tabLineHeight},fi["default"].createElement(Uq,null));default:return null;}};return fi["default"].createElement(hmt,{show:true},fi["default"].createElement("div",null,fi["default"].createElement(n,{tool:"text",ariaLabel:o.buttonNew,onClick:i.add,icon:fi["default"].createElement(Re.addText,null),label:o.buttonNew})),fi["default"].createElement(M.Other.ControlsWrapper,null,fi["default"].createElement(pmt,null,r.map(function(a){return s(a);}))),fi["default"].createElement(M.BarSeparator,null));});});var _o,Jq,fmt,gmt,Zq;var Qq=d(function(){_o=y(_("react"));B();Jq=y(_("styled-components"));R();Ge();it();we();qt();fmt=(0,Jq["default"])(De)(_templateObject322||(_templateObject322=_taggedTemplateLiteral(["\n height: 40px;\n"])));gmt=function gmt(_ref345){var i=_ref345.textDesignTool,t=_ref345.custom;var e=i.locale.controls;var r=i.localeColor.colorPicker;var o=i.colorList;var n=t.getButton("toolControlBarSecondaryButton");var s=t.getButton("toolControlBarPrimaryButton");return _o["default"].createElement(M.ControlsbarContainer,{show:true},s&&_o["default"].createElement("div",null,_o["default"].createElement(s,{tool:"textdesign",ariaLabel:e.buttonNew,onClick:i.add,icon:_o["default"].createElement(Re.addText,null),label:e.buttonNew})),_o["default"].createElement(M.Other.ControlsWrapper,null,_o["default"].createElement(P.Input.Selection,{isDisabled:!i.isTextDesignSelected,label:e.selectColor},_o["default"].createElement(fmt,{tool:"textdesign",activeSprite:i.id,activeColor:i.color,colors:o,labelsColor:r,colorPickerDirection:"top",isDisabled:!i.isTextDesignSelected,onChange:i.changeColor,onAddSnapshot:i.colorSnapshot}))),n&&_o["default"].createElement("div",null,_o["default"].createElement(n,{tool:"textdesign",ariaLabel:e.buttonShuffle,onClick:i.changeSeed,icon:_o["default"].createElement(Re.shuffle,null),label:e.buttonShuffle})),_o["default"].createElement(M.BarSeparator,null));};Zq=rt("textDesignTool","custom")(w(gmt));});var tY,eY;var iY=d(function(){tY=y(_("react"));B();Ge();W();eY=w(function(){var _D41=D(),i=_D41.transformTool;var t=i.locale.controls;var e=i.forceDimensions;return tY["default"].createElement(gf,{isDisabled:e,showLabel:false,valueHeight:i.localOutputHeight,valueWidth:i.localOutputWidth,onSubmitWidth:i.onPixelWidth,onSubmitHeight:i.onPixelHeight,label:t.inputCropSize,labelHeight:t.inputHeight,labelWidth:t.inputWidth,ariaLabelHeight:t.inputHeightAriaLabel,ariaLabelWidth:t.inputWidthAriaLabel});});});var rY=d(function(){iY();});var oY,nY;var sY=d(function(){oY=y(_("react"));Ge();nY=function nY(){return oY["default"].createElement(ff,null);};});var aY=d(function(){sY();});var lY,cY;var uY=d(function(){lY=y(_("react"));B();R();W();cY=w(function(){var _D42=D(),i=_D42.transformTool,t=_D42.custom;var e=i.locale.controls;var r=i.forceDimensions;var o=t.getCheckbox();if(!o){return null;}return lY["default"].createElement(o,{tool:"transform",isDisabled:r,style:{paddingTop:"5px",justifyContent:"center"},value:i.lockResolution,checkMarkPosition:"left",label:e.checkboxKeepResolution,onClick:i.changeLockResolution});});});var dY=d(function(){uY();});var Mi,u0,bmt,wD,mY,ymt,pY;var hY=d(function(){Mi=y(_("react"));B();u0=y(_("styled-components"));R();Sr();W();we();qt();rY();aY();dY();bmt=M.ResponsiveTabWrapper;var _M6=M;wD=_M6.Tab;mY=u0.css(_templateObject323||(_templateObject323=_taggedTemplateLiteral(["\n min-width: unset;\n"])));ymt=(0,u0["default"])(M.Other.ControlsWrapper)(_templateObject324||(_templateObject324=_taggedTemplateLiteral(["\n min-width: 365px;\n\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&mY;},mY);pY=w(function(){var _D43=D(),i=_D43.transformTool,t=_D43.custom;var _ref346=(0,Mi.useContext)(Oe),e=_ref346.rect;var r=i.config;var o=r.basicUIToolControlBarTabsOrder;var n=i.locale.controls;var s=t.getButton("toolControlBarSecondaryButton");var a=function a(l){switch(l){case"flipRotate":return Mi["default"].createElement(wD,{key:l,label:n.tabFlipAndRotate},Mi["default"].createElement(nY,null));case"resolution":return Mi["default"].createElement(wD,{key:l,label:n.tabResolution},Mi["default"].createElement(cY,null));case"cropSize":return Mi["default"].createElement(wD,{key:l,label:n.tabCropSize},Mi["default"].createElement(eY,null));default:return null;}};return Mi["default"].createElement(M.ControlsbarContainer,{show:true},s&&Mi["default"].createElement("div",null,Mi["default"].createElement(s,{tool:"transform",ariaLabel:i.locale.controls.buttonReset,onClick:i.reset,icon:Mi["default"].createElement(Re.reset,null),label:i.locale.controls.buttonReset})),Mi["default"].createElement(ymt,{smallContainer:!!e&&e.width<600},Mi["default"].createElement(bmt,null,o.map(function(l){return a(l);}))),Mi["default"].createElement(M.BarSeparator,null));});});var Ee,fY;var gY=d(function(){Ee=y(_("react"));B();R();it();W();SX();LX();GX();$X();sq();lq();_q();Eq();Yq();Qq();hY();fY=w(function i(){var _D44=D(),t=_D44.active,e=_D44.custom;var r=t.tool;var o=e.getBasicToolControlBar();if(!o){return null;}return Ee["default"].createElement(o,{show:!!r,tool:r},Ee["default"].createElement(P.Switch.Index,{type:r},Ee["default"].createElement(P.Switch.Case,{value:"filter"},Ee["default"].createElement(WX,null)),Ee["default"].createElement(P.Switch.Case,{value:"focus"},Ee["default"].createElement(jX,null)),Ee["default"].createElement(P.Switch.Case,{value:"adjustment"},Ee["default"].createElement(CX,null)),Ee["default"].createElement(P.Switch.Case,{value:"overlay"},Ee["default"].createElement(yq,null)),Ee["default"].createElement(P.Switch.Case,{value:"sticker"},Ee["default"].createElement(Dq,null)),Ee["default"].createElement(P.Switch.Case,{value:"text"},Ee["default"].createElement(qq,null)),Ee["default"].createElement(P.Switch.Case,{value:"textdesign"},Ee["default"].createElement(Zq,null)),Ee["default"].createElement(P.Switch.Case,{value:"library"},Ee["default"].createElement(aq,null)),Ee["default"].createElement(P.Switch.Case,{value:"frame"},Ee["default"].createElement(nq,null)),Ee["default"].createElement(P.Switch.Case,{value:"brush"},Ee["default"].createElement(MX,null)),Ee["default"].createElement(P.Switch.Case,{value:"transform"},Ee["default"].createElement(pY,null))));});});var Nm,bY,_mt,xmt,yY;var _Y=d(function(){Nm=y(_("react"));B();bY=y(_("styled-components"));R();we();U();qt();_mt=bY["default"].div(_templateObject325||(_templateObject325=_taggedTemplateLiteral(["\n position: relative;\n top: -8px;\n color: ",";\n"])),function(i){return i.theme.card.foreground;});xmt=function xmt(_ref347){var i=_ref347.adjustmentsTool;var t=function t(e,r){var o=wL[e.identifier];return Nm["default"].createElement(M.Card,{"data-test":e.identifier,tool:"adjustment",type:"medium",onClick:function onClick(){return i.toggleOptionSelection(e.identifier);},isActive:e.identifier===i.selectedAdjustmentType,key:"".concat(e.identifier,"-").concat(r),label:e.name,style:{animationDelay:"".concat(kt(r),"s")}},Nm["default"].createElement(_mt,null,Nm["default"].createElement(o,null)),Nm["default"].createElement(M.CardLabel,null,i.locale.items[e.identifier]||e.name));};return Nm["default"].createElement(M.CardContainer,null,i.items.map(t));};yY=rt("adjustmentsTool")(w(xmt));});var xY,vY;var CY=d(function(){xY=y(_("react"));R();W();vY=function vY(){var _D45=D(),i=_D45.config;var t=i.state.config["customTool"].toolControlBar;return xY["default"].createElement(t,{language:i.state.locale["customTool"]});};});var SY=d(function(){CY();});var Zn,Qf;var wY=d(function(){Zn=y(_("react"));B();R();U();qt();Qf=/*#__PURE__*/function(_Zn$default$Component){_inherits(Qf,_Zn$default$Component);var _super248=_createSuper(Qf);function Qf(){var _this391;_classCallCheck(this,Qf);_this391=_super248.apply(this,arguments);_this391.onCategoryClick=function(t){var e=_this391.props.filterTool;e.toggleCategorySelection(t);};_this391.renderItem=function(t,e){var n,s;var r=_this391.props.filterTool;var o=(s=(n=r.locale)==null?void 0:n.controls)==null?void 0:s.itemAriaLabel;return Zn["default"].createElement(M.Card,{tool:"filter",type:"medium",onClick:function onClick(){return r.selectFilter(t.identifier,t.defaultIntensity);},isActive:r.identifier===t.identifier,key:"".concat(t.identifier,"-").concat(e),image:t.thumbnailURI,label:t.name,"aria-label":o==null?void 0:o.replace("${label}",t.name),style:{animationDelay:"".concat(kt(e),"s")}},Zn["default"].createElement(M.CardLabel,{withBackground:true},r.locale.categories[t.identifier]||r.locale.items[t.identifier]||t.name));};_this391.renderCategory=function(t,e){var l;var r=_this391.props.filterTool;var o=r.selectedCategoryIdentifier,n=r.locale;var s=(l=n.controls)==null?void 0:l.categoryAriaLabel;var a=o===t.identifier;if(!t.items)return null;return Zn["default"].createElement(M.CategoryContainer,{key:t.identifier},Zn["default"].createElement(M.Card,{role:"button","aria-expanded":a,"aria-label":s==null?void 0:s.replace("${label}",t.name),tool:"filter",type:"large",onClick:function onClick(){return _this391.onCategoryClick(t.identifier);},image:t.thumbnailURI,label:t.name,style:{animationDelay:"".concat(kt(e),"s")}},Zn["default"].createElement(M.CardLabel,{withBackground:true},t.name)),Zn["default"].createElement(M.ExpandableContainer,{show:a},t.items.map(_this391.renderItem)));};return _this391;}_createClass(Qf,[{key:"render",value:function render(){var t=this.props.filterTool;var e=t.categories,r=t.config,o=t.items;if(r.flattenCategories)return Zn["default"].createElement(M.CardContainer,null,o.map(this.renderItem));return Zn["default"].createElement(M.CardContainer,null,e.map(this.renderCategory));}}]);return Qf;}(Zn["default"].Component);Qf=f([rt("filterTool","active"),w],Qf);});var d0,vmt,TY;var kY=d(function(){d0=y(_("react"));B();R();U();qt();vmt=function vmt(_ref348){var i=_ref348.focusTool;var o,n;var t=(n=(o=i.locale)==null?void 0:o.controls)==null?void 0:n.itemAriaLabel;var e=function e(s){i.selectFocus(s);};var r=function r(s,a){return d0["default"].createElement(M.Card,{isActive:s.identifier===i.identifier,tool:"focus",type:"medium",onClick:function onClick(){return e(s.identifier);},key:"".concat(s.identifier,"-").concat(a),image:s.thumbnailURI,label:s.name,"aria-label":t==null?void 0:t.replace("${label}",s.name),style:{animationDelay:"".concat(kt(a),"s")}},d0["default"].createElement(M.CardLabel,{withBackground:true},i.locale.items[s.identifier]||s.name));};return d0["default"].createElement(M.CardContainer,null,i.items.map(r));};TY=rt("focusTool")(w(vmt));});var m0,Cmt,IY;var DY=d(function(){m0=y(_("react"));B();R();U();qt();Cmt=function Cmt(_ref349){var i=_ref349.frameTool;var o,n;var t=i.identifier;var e=(n=(o=i.locale)==null?void 0:o.controls)==null?void 0:n.itemAriaLabel;var r=function r(s,a){return m0["default"].createElement(M.Card,{tool:"frame",type:"medium",onClick:function onClick(){return i.selectFrame(s.identifier);},isActive:s.identifier===t,key:"".concat(s.identifier,"-").concat(a),image:s.thumbnailURI,label:s.name,"aria-label":e==null?void 0:e.replace("${label}",s.name),style:{animationDelay:"".concat(kt(a),"s"),backgroundSize:"60%"}}," ",m0["default"].createElement(M.CardLabel,{hidden:true},i.locale.items[s.identifier]||s.name));};return m0["default"].createElement(M.CardContainer,null,i.items.map(r));};IY=rt("frameTool")(w(Cmt));});var EY,FY;var OY=d(function(){EY=y(_("styled-components"));FY=EY["default"].p(_templateObject326||(_templateObject326=_taggedTemplateLiteral(["\n height: ","px;\n"])),function(i){return i.theme.measurements.basicUIToolControlBar.itemsBarHeight;});});var RY=d(function(){OY();});var Zo,tg;var AY=d(function(){Zo=y(_("react"));B();R();U();qt();RY();tg=/*#__PURE__*/function(_Zo$default$Component){_inherits(tg,_Zo$default$Component);var _super249=_createSuper(tg);function tg(){var _this392;_classCallCheck(this,tg);_this392=_super249.apply(this,arguments);_this392.onCategoryClick=function(t){var e=_this392.props.library;e.toggleCategorySelection(t);};_this392.renderItem=function(t,e){var s,a;var _this392$props=_this392.props,r=_this392$props.active,o=_this392$props.library;var n=(a=(s=o.locale)==null?void 0:s.controls)==null?void 0:a.itemAriaLabel;return Zo["default"].createElement(M.Card,{tool:"library",type:"medium",onClick:function onClick(){return r.newImage(t.rawUrl);},key:"".concat(t.identifier,"-").concat(e),image:t.thumbnailURI,label:t.name,"aria-label":n==null?void 0:n.replace("${label}",t.name),style:{animationDelay:"".concat(kt(e),"s")}});};_this392.renderCategory=function(t,e){var l;var r=_this392.props.library;var o=r.selectedCategoryIdentifier,n=r.locale;var s=(l=n.controls)==null?void 0:l.categoryAriaLabel;var a=o===t.identifier;if(!t.items)return null;return Zo["default"].createElement(M.CategoryContainer,{key:t.identifier},Zo["default"].createElement(M.Card,{role:"button","aria-expanded":a,"aria-label":s==null?void 0:s.replace("${label}",t.name),tool:"library",type:"large",onClick:function onClick(){return _this392.onCategoryClick(t.identifier);},image:t.thumbnailURI,label:t.name,style:{animationDelay:"".concat(kt(e),"s")}},Zo["default"].createElement(M.CardLabel,{withBackground:true},t.name)),Zo["default"].createElement(M.ExpandableContainer,{show:a},t.items.map(_this392.renderItem)));};return _this392;}_createClass(tg,[{key:"render",value:function render(){var t=this.props.library;var e=t.query,r=t.categories,o=t.items,n=t.locale,s=t.config;if(e){return o.length?Zo["default"].createElement(M.CardContainer,null,o.map(this.renderItem)):Zo["default"].createElement(FY,{"data-test":N.NoResult},n.controls.noResults);}if(s.flattenCategories)return Zo["default"].createElement(M.CardContainer,null,o.map(this.renderItem));return Zo["default"].createElement(M.CardContainer,null,r.map(this.renderCategory));}}]);return tg;}(Zo["default"].Component);tg=f([rt("library","active"),w],tg);});var p0,Smt,BY;var PY=d(function(){p0=y(_("react"));B();R();U();qt();Smt=function Smt(_ref350){var i=_ref350.overlayTool;var a;var t=i.identifier,e=i.items,r=i.selectOverlay,o=i.locale;var n=(a=o.controls)==null?void 0:a.itemAriaLabel;var s=function s(l,c){return p0["default"].createElement(M.Card,{tool:"overlay",type:"medium",onClick:function onClick(){return r(l.identifier);},isActive:l.identifier===t,key:"".concat(l.identifier,"-").concat(c),image:l.thumbnailURI,label:l.name,"aria-label":n==null?void 0:n.replace("${label}",l.name),style:{animationDelay:"".concat(kt(c),"s")}},p0["default"].createElement(M.CardLabel,{withBackground:true},o.items[l.identifier]||l.name));};return p0["default"].createElement(M.CardContainer,null,e.map(s));};BY=rt("overlayTool")(w(Smt));});var Qn,eg;var MY=d(function(){Qn=y(_("react"));B();R();U();qt();eg=/*#__PURE__*/function(_Qn$default$Component){_inherits(eg,_Qn$default$Component);var _super250=_createSuper(eg);function eg(){var _this393;_classCallCheck(this,eg);_this393=_super250.apply(this,arguments);_this393.onCategoryClick=function(t){var e=_this393.props.stickerTool;e.toggleCategorySelection(t);};_this393.renderItem=function(t,e){var n,s;var r=_this393.props.stickerTool;var o=(s=(n=r.locale)==null?void 0:n.controls)==null?void 0:s.itemAriaLabel;return Qn["default"].createElement(M.Card,{tool:"sticker",type:"medium",onClick:function onClick(){return r.add(t.identifier);},key:"".concat(t.identifier,"-").concat(e),image:t.thumbnailURI,label:t.name,"aria-label":o==null?void 0:o.replace("${label}",t.name),style:{backgroundSize:"55%",animationDelay:"".concat(yb(e),"s")}},Qn["default"].createElement(M.CardLabel,{hidden:true},r.locale.items[t.identifier]||t.name));};_this393.renderCategory=function(t,e){var l;var r=_this393.props.stickerTool;var o=r.selectedCategoryIdentifier,n=r.locale;var s=(l=n.controls)==null?void 0:l.categoryAriaLabel;var a=o===t.identifier;if(!t.items)return null;return Qn["default"].createElement(M.CategoryContainer,{key:t.identifier},Qn["default"].createElement(M.Card,{role:"button","aria-expanded":a,"aria-label":s==null?void 0:s.replace("${label}",t.name),tool:"sticker",type:"large",onClick:function onClick(){return _this393.onCategoryClick(t.identifier);},image:t.thumbnailURI,label:t.name,style:{animationDelay:"".concat(kt(e),"s")}},Qn["default"].createElement(M.CardLabel,{withBackground:true},n.categories[t.identifier]||t.name)),Qn["default"].createElement(M.ExpandableContainer,{show:a},t.items.map(_this393.renderItem)));};return _this393;}_createClass(eg,[{key:"render",value:function render(){var t=this.props.stickerTool;var e=t.categories,r=t.items,o=t.config;if(o.flattenCategories)return Qn["default"].createElement(M.CardContainer,null,r.map(this.renderItem));return Qn["default"].createElement(M.CardContainer,null,e.map(this.renderCategory));}}]);return eg;}(Qn["default"].Component);eg=f([rt("stickerTool","active"),w],eg);});var ig,LY,wmt,zY,UY;var NY=d(function(){ig=y(_("react"));B();LY=y(_("styled-components"));R();Xt();U();qt();wmt=LY["default"].div(_templateObject327||(_templateObject327=_taggedTemplateLiteral(["\n font-size: 20px;\n position: absolute;\n left: 50%;\n top: 50%;\n transform-origin: left top;\n"])));zY=/*#__PURE__*/function(_ig$default$Component){_inherits(zY,_ig$default$Component);var _super251=_createSuper(zY);function zY(){var _this394;_classCallCheck(this,zY);_this394=_super251.apply(this,arguments);_this394.getWidth=function(_ref351,o){var t=_ref351.fontFamily,e=_ref351.fontStyle,r=_ref351.fontWeight;var n=document.createElement("canvas");var s=n.getContext("2d");s.font="".concat(e," ").concat(r," 20px ").concat(t);s.fillText(o,0,0);return s.measureText(o).width;};_this394.renderItem=function(t,e){var _this394$props=_this394.props,r=_this394$props.config,o=_this394$props.textTool;var n=t.fontFamily,s=t.fontWeight,a=t.fontStyle,l=t.identifier;var c="".concat(t.fontFamily," ").concat(gt.getDisplayFontStyle(t));var u=_this394.getWidth(t,c);var m=(r.measurements.basicCard.medium.width-20)/u;return ig["default"].createElement(M.Card,{tool:"text",type:"medium",onClick:function onClick(){return o.changeFont(l);},isDisabled:!_this394.textTool.isTextSelected,isActive:o.identifier===l,key:"".concat(t.identifier,"-").concat(e),label:c,style:{animationDelay:"".concat(kt(e),"s")}},ig["default"].createElement(wmt,{style:{transform:"scale(".concat(m,") translate(-50%, -50%)"),fontFamily:n,fontStyle:a,fontWeight:s}},c));};return _this394;}_createClass(zY,[{key:"textTool",get:function get(){return this.props.textTool;}},{key:"render",value:function render(){var t=this.props.textTool;var e=t.fontsLoaded,r=t.fontFamilies;if(!e)return null;return ig["default"].createElement(M.CardContainer,null,r.map(this.renderItem));}}]);return zY;}(ig["default"].Component);UY=rt("textTool","config")(w(zY));});var h0,Tmt,HY;var WY=d(function(){h0=y(_("react"));B();R();U();qt();Tmt=function Tmt(_ref352){var i=_ref352.textDesignTool;var l;var t=i.items,e=i.changeIdentifier,r=i.isTextDesignSelected,o=i.identifier,n=i.locale;var s=(l=n.controls)==null?void 0:l.itemAriaLabel;var a=function a(c,u){return h0["default"].createElement(M.Card,{tool:"textdesign",type:"medium",onClick:function onClick(){return e(c.identifier);},isDisabled:!r,isActive:o===c.identifier,key:"".concat(c.identifier,"-").concat(u),image:c.thumbnailURI,label:c.name,"aria-label":s==null?void 0:s.replace("${label}",c.name),style:{animationDelay:"".concat(kt(u),"s"),backgroundSize:"60%"}},h0["default"].createElement(M.CardLabel,{hidden:true},c.name));};return h0["default"].createElement(M.CardContainer,null,t.map(a));};HY=rt("textDesignTool")(w(Tmt));});var xr,TD,kmt,Imt,rg;var GY=d(function(){xr=y(_("react"));B();TD=y(_("styled-components"));R();we();U();qt();kmt=TD["default"].div(_templateObject328||(_templateObject328=_taggedTemplateLiteral(["\n svg {\n margin-bottom: 12px;\n }\n"])));Imt=TD["default"].div(_templateObject329||(_templateObject329=_taggedTemplateLiteral(["\n svg {\n width: ","px;\n height: ","px;\n }\n\n "," {\n width: ","px;\n height: ","px;\n padding: 6px 0px 24px;\n }\n"])),function(i){return i.theme.measurements.basicCard.medium.height;},function(i){return i.theme.measurements.basicCard.medium.height;},Ni,function(i){return i.theme.measurements.basicCard.medium.width-32;},function(i){return i.theme.measurements.basicCard.medium.height-32;});rg=/*#__PURE__*/function(_xr$default$Component){_inherits(rg,_xr$default$Component);var _super252=_createSuper(rg);function rg(){var _this395;_classCallCheck(this,rg);_this395=_super252.apply(this,arguments);_this395.onCategoryClick=function(t){var e=_this395.props.transformTool;e.toggleCategorySelection(t);};_this395.renderItem=function(t,e){var p;var _this395$props=_this395.props,r=_this395$props.transformTool,o=_this395$props.config;var n=r.locale,s=r.identifier;var a=(p=n.controls)==null?void 0:p.itemAriaLabel;var l=r.checkIfTransformThumbnailExits(t.thumbnailURI);var c=Vt.crops[t.identifier]||Vt.crops.imgly_transform_common_custom;var u=xr["default"].createElement(M.CardLabel,null,n.items[t.identifier]||t.name);var m=l?u:xr["default"].createElement(Imt,null,xr["default"].createElement(c,{main:o.theme.transform.crops.main,highlight:o.theme.transform.crops.highlight,shadow:o.theme.transform.crops.shadow}),u);return xr["default"].createElement(M.Card,{tool:"transform",type:"medium",onClick:function onClick(){return r.changeIdentifier(t.identifier,true);},key:"".concat(t.identifier,"-").concat(e),image:t.thumbnailURI,label:t.name,"aria-label":a==null?void 0:a.replace("${label}",t.name),isActive:t.identifier===s,style:{backgroundSize:"55%",animationDelay:"".concat(kt(e),"s")}},m);};_this395.renderCategory=function(t,e){var m;var r=_this395.props.transformTool;var o=r.selectedCategoryIdentifier,n=r.locale;var s=(m=n.controls)==null?void 0:m.categoryAriaLabel;var a=o===t.identifier;if(!t.items)return null;var l=r.checkIfTransformThumbnailExits(t.thumbnailURI);var c=xr["default"].createElement(M.CardLabel,null,n.categories[t.identifier]||t.name);var u=l?c:xr["default"].createElement(kmt,null,Vt.categories[t.identifier]&&xr["default"].createElement(Vt.categories[t.identifier]),c);return xr["default"].createElement(M.CategoryContainer,{key:t.identifier},xr["default"].createElement(M.Card,{role:"button","aria-expanded":a,"aria-label":s==null?void 0:s.replace("${label}",t.name),tool:"transform",type:"large",onClick:function onClick(){return _this395.onCategoryClick(t.identifier);},image:l?t.thumbnailURI:"",label:t.name,style:{animationDelay:"".concat(kt(e),"s")}},u),xr["default"].createElement(M.ExpandableContainer,{show:a},t.items.map(_this395.renderItem)));};return _this395;}_createClass(rg,[{key:"render",value:function render(){var t=this.props.transformTool;var e=t.categories,r=t.config,o=t.items;if(r.flattenCategories)return xr["default"].createElement(M.CardContainer,null,o.map(this.renderItem));return xr["default"].createElement(M.CardContainer,null,e.map(this.renderCategory));}}]);return rg;}(xr["default"].Component);rg=f([rt("transformTool","config"),w],rg);});var er,VY;var jY=d(function(){er=y(_("react"));B();R();W();_Y();SY();wY();kY();DY();AY();PY();MY();NY();WY();GY();VY=w(function i(){var _D46=D(),t=_D46.active,e=_D46.library,r=_D46.custom;var o=t.tool;var n=(0,er.useMemo)(function(){switch(o){case"library":return er["default"].createElement(tg,null);case"filter":return er["default"].createElement(Qf,null);case"focus":return er["default"].createElement(TY,null);case"adjustment":return er["default"].createElement(yY,null);case"overlay":return er["default"].createElement(BY,null);case"sticker":return er["default"].createElement(eg,null);case"text":return er["default"].createElement(UY,null);case"textdesign":return er["default"].createElement(HY,null);case"frame":return er["default"].createElement(IY,null);case"transform":return er["default"].createElement(rg,null);case"customTool":return er["default"].createElement(vY,null);default:return null;}},[o]);var s=r.getBasicToolItemsBar();if(!s||o==="brush"||o==="library"&&!e.libraryProvider){return null;}return er["default"].createElement(s,{show:!!o},n);});});var vr,$Y,Dmt,og;var KY=d(function(){vr=y(_("react"));B();$Y=y(_("styled-components"));Ge();QI();tD();it();U();xX();gY();jY();Dmt=$Y["default"].div(_templateObject330||(_templateObject330=_taggedTemplateLiteral(["\n position: absolute;\n width: 100%;\n height: ","px;\n bottom: 0;\n left: 0;\n background: ",";\n z-index: ",";\n"])),function(i){return i.theme.measurements.basicUIToolControlBar.maxHeight;},function(i){return i.theme.webcam.backdrop;},function(i){return i.theme.measurements.zIndex.disable;});og=/*#__PURE__*/function(_vr$default$Component){_inherits(og,_vr$default$Component);var _super253=_createSuper(og);function og(){_classCallCheck(this,og);return _super253.apply(this,arguments);}_createClass(og,[{key:"render",value:function render(){var _this$props20=this.props,t=_this$props20.active,e=_this$props20.custom;var r=e.getWindowContainer();return vr["default"].createElement(P.Container,{"data-test":N.EditorContainer},t.isWebcam?vr["default"].createElement(Dmt,null):null,vr["default"].createElement(Fm,null),vr["default"].createElement(ja,null,vr["default"].createElement(vm,null),r&&vr["default"].createElement(r,{tool:t.tool},vr["default"].createElement(wf,null,t.isWebcam?vr["default"].createElement(Sf,null):null,t.image&&vr["default"].createElement(Dm,null))),vr["default"].createElement(fY,null),vr["default"].createElement(VY,null),vr["default"].createElement(_X,null)));}}],[{key:"getDerivedStateFromError",value:function getDerivedStateFromError(t){console.error(t);return{hasError:true};}}]);return og;}(vr["default"].Component);og=f([rt("active","custom"),w],og);});var ng,XY,kD;var qY=d(function(){ng=y(_("react"));B();XY=_("styled-components");Ge();qt();KY();kD=/*#__PURE__*/function(_ng$default$Component){_inherits(kD,_ng$default$Component);var _super254=_createSuper(kD);function kD(){var _this396;_classCallCheck(this,kD);_this396=_super254.apply(this,arguments);_this396.componentWillUnmount=function(){_this396.editor.cleanUpCanvasMemory();};return _this396;}_createClass(kD,[{key:"componentDidMount",value:function componentDidMount(){var _this$props21=this.props,t=_this$props21.editor,e=_this$props21.storeProps;this.editor=t;this.storeProps=e;var r=new Em(this.editor.configStore.config.custom.components,{basicUIToolbar:M.Toolbar.Index,basicUIToolControlBar:M.Controlsbar,basicUIToolItemsBar:M.Itemsbar});var o={getDialog:r.getDialog,getButton:r.getButton,getColorItem:r.getColorItem,getCheckbox:r.getCheckbox,getSlider:r.getSlider,getBasicToolbar:r.getBasicToolbar,getBasicToolControlBar:r.getBasicToolControlBar,getBasicToolItemsBar:r.getBasicToolItemsBar,getWindowContainer:r.getWindowContainer};this.storeProps.custom=o;this.forceUpdate();}},{key:"render",value:function render(){return this.storeProps?ng["default"].createElement(ep,_objectSpread({},this.storeProps),ng["default"].createElement(XY.ThemeProvider,{theme:_objectSpread(_objectSpread({},this.editor.configStore.theme),{},{measurements:this.editor.configStore.measurements})},ng["default"].createElement(og,null))):null;}}]);return kD;}(ng["default"].Component);});var YY={};de(YY,{"default":function _default(){return kD;}});var JY=d(function(){qY();});var ypt={};de(ypt,{AdjustmentConfiguration:function AdjustmentConfiguration(){return qg;},AdjustmentIdentifier:function AdjustmentIdentifier(){return qu;},AdjustmentIdentifierKeys:function AdjustmentIdentifierKeys(){return xC;},AdvancedAdjustmentControlBarItem:function AdvancedAdjustmentControlBarItem(){return vC;},AdvancedBrushControlBarItem:function AdvancedBrushControlBarItem(){return HC;},AdvancedFilterControlBarItem:function AdvancedFilterControlBarItem(){return CC;},AdvancedFocusControlBarItem:function AdvancedFocusControlBarItem(){return TC;},AdvancedFrameControlBarItem:function AdvancedFrameControlBarItem(){return kC;},AdvancedLibraryControlBarItem:function AdvancedLibraryControlBarItem(){return RC;},AdvancedOverlayControlBarItem:function AdvancedOverlayControlBarItem(){return AC;},AdvancedStickerControlBarItem:function AdvancedStickerControlBarItem(){return PC;},AdvancedTextControlBarItem:function AdvancedTextControlBarItem(){return LC;},AdvancedTextDesignControlBarItem:function AdvancedTextDesignControlBarItem(){return GC;},AdvancedTransformControlBarItem:function AdvancedTransformControlBarItem(){return VC;},AdvancedUICardLabel:function AdvancedUICardLabel(){return Se;},AdvancedUICategoryCard:function AdvancedUICategoryCard(){return cpt;},AdvancedUIControlsBarSection:function AdvancedUIControlsBarSection(){return hpt;},AdvancedUIItemCard:function AdvancedUIItemCard(){return upt;},AdvancedUIToolControlBar:function AdvancedUIToolControlBar(){return ppt;},AdvancedUIToolbar:function AdvancedUIToolbar(){return mpt;},AdvancedUIToolbarItem:function AdvancedUIToolbarItem(){return Uf;},AlignmentMode:function AlignmentMode(){return OO;},BasicBrushControlBarTabs:function BasicBrushControlBarTabs(){return WC;},BasicFilterControlBarTabs:function BasicFilterControlBarTabs(){return SC;},BasicFocusControlBarTabs:function BasicFocusControlBarTabs(){return iR;},BasicFrameControlBarTabs:function BasicFrameControlBarTabs(){return IC;},BasicOverlayControlBarTabs:function BasicOverlayControlBarTabs(){return BC;},BasicStickerControlBarTabs:function BasicStickerControlBarTabs(){return MC;},BasicTextControlBarTabs:function BasicTextControlBarTabs(){return zC;},BasicTransformControlBarTabs:function BasicTransformControlBarTabs(){return jC;},BasicUIToolControlBar:function BasicUIToolControlBar(){return gpt;},BasicUIToolItemsBar:function BasicUIToolItemsBar(){return bpt;},BasicUIToolbar:function BasicUIToolbar(){return fpt;},BlendMode:function BlendMode(){return pn;},BrushConfiguration:function BrushConfiguration(){return ab;},CanvasAction:function CanvasAction(){return ko;},CanvasBarTextSecondaryButton:function CanvasBarTextSecondaryButton(){return by;},CardAvatar:function CardAvatar(){return Jl;},CardType:function CardType(){return Ue;},CategoryHeaderType:function CategoryHeaderType(){return un;},Checkbox:function Checkbox(){return Zmt;},CheckboxBase:function CheckboxBase(){return Qmt;},CheckboxCheckMark:function CheckboxCheckMark(){return ept;},CheckboxInput:function CheckboxInput(){return tpt;},ColorItem:function ColorItem(){return Lmt;},ColorItemActiveOverlay:function ColorItemActiveOverlay(){return Hmt;},ColorItemBackground:function ColorItemBackground(){return Umt;},ColorItemBase:function ColorItemBase(){return zmt;},ColorItemTiledBackground:function ColorItemTiledBackground(){return Nmt;},Configuration:function Configuration(){return GO;},ContainedPrimaryButton:function ContainedPrimaryButton(){return Up;},Container:function Container(){return Pmt;},CustomToolConfiguration:function CustomToolConfiguration(){return YO;},Dialog:function Dialog(){return Wmt;},DialogBackdrop:function DialogBackdrop(){return jmt;},DialogBase:function DialogBase(){return Gmt;},DialogBody:function DialogBody(){return Kmt;},DialogContainer:function DialogContainer(){return Vmt;},DialogFooter:function DialogFooter(){return Xmt;},DialogHeader:function DialogHeader(){return $mt;},DialogSpinner:function DialogSpinner(){return qmt;},Dropdown:function Dropdown(){return ipt;},DropdownCaret:function DropdownCaret(){return Jb;},EventEmitter:function EventEmitter(){return Tr;},ExportConfiguration:function ExportConfiguration(){return BO;},ExportFormat:function ExportFormat(){return Wl;},FilterCategoryIdentifier:function FilterCategoryIdentifier(){return cp;},FilterConfiguration:function FilterConfiguration(){return Yg;},FilterIdentifier:function FilterIdentifier(){return lp;},FocusConfiguration:function FocusConfiguration(){return Jg;},FocusIdentifier:function FocusIdentifier(){return cs;},FrameConfiguration:function FrameConfiguration(){return Zg;},IconButton:function IconButton(){return hs;},ImageFormat:function ImageFormat(){return mn;},ImageMimeType:function ImageMimeType(){return ap;},Label:function Label(){return Jmt;},LibraryCategory:function LibraryCategory(){return Qg;},LibraryConfiguration:function LibraryConfiguration(){return rb;},LibraryImage:function LibraryImage(){return tb;},LibraryProvider:function LibraryProvider(){return ib;},ModalType:function ModalType(){return dn;},OutlinedPrimaryButton:function OutlinedPrimaryButton(){return zp;},OutlinedSecondaryButton:function OutlinedSecondaryButton(){return Ea;},OverlayConfiguration:function OverlayConfiguration(){return ob;},OverlayIdentifier:function OverlayIdentifier(){return up;},PhotoEditorSDKUI:function PhotoEditorSDKUI(){return tJ;},PhotoEditorSDKUIComponent:function PhotoEditorSDKUIComponent(){return iJ;},SearchField:function SearchField(){return dpt;},SerializationExportType:function SerializationExportType(){return AO;},Slider:function Slider(){return rpt;},SliderBase:function SliderBase(){return opt;},SliderContainer:function SliderContainer(){return npt;},SliderIdentifier:function SliderIdentifier(){return qe;},SliderInput:function SliderInput(){return spt;},SliderLabel:function SliderLabel(){return lpt;},SliderTrack:function SliderTrack(){return apt;},SnappingConfiguration:function SnappingConfiguration(){return Kg;},SpriteActionButton:function SpriteActionButton(){return _n;},StickerConfiguration:function StickerConfiguration(){return nb;},TextConfiguration:function TextConfiguration(){return sb;},TextDesignConfiguration:function TextDesignConfiguration(){return lb;},TextPrimaryButton:function TextPrimaryButton(){return Xl;},TextSecondaryButton:function TextSecondaryButton(){return Ro;},Tool:function Tool(){return H;},TransformConfiguration:function TransformConfiguration(){return cb;},TransformIdentifier:function TransformIdentifier(){return $C;},UIEvent:function UIEvent(){return dp;},WatermarkConfiguration:function WatermarkConfiguration(){return Xg;},WindowContainer:function WindowContainer(){return zv;},calculateAdvancedUIToolControlBarMeasurements:function calculateAdvancedUIToolControlBarMeasurements(){return Mk;},deepmergeAll:function deepmergeAll(){return Fi;},defaultConfig:function defaultConfig(){return _l;},isDuoToneFilterAsset:function isDuoToneFilterAsset(){return Yu;},isExistingCategory:function isExistingCategory(){return vQ;},isExistingItem:function isExistingItem(){return xQ;},isGoogleFontAsset:function isGoogleFontAsset(){return NC;},isLUTFilterAsset:function isLUTFilterAsset(){return wC;},isWebFontAsset:function isWebFontAsset(){return UC;},useGetImage:function useGetImage(){return Amt;},useIsLayoutAdvanced:function useIsLayoutAdvanced(){return Bmt;},useSetImage:function useSetImage(){return Rmt;}});var OD={react:"React","react-dom":"ReactDOM","react-dom/server":"ReactDOMServer","styled-components":"styled"};window.require=function(i){if(Object.hasOwnProperty.call(OD,i)){var t=OD[i];if(Object.hasOwnProperty.call(window,t)){return window[t];}console.log("Cannot find umd script for ".concat(i));}return void 0;};Tt();var Nf=y(_("react"));B();var lK=_("styled-components");Ge();var TV=y(_("react"));R();var yV=y(_("react"));var _V=y(_("styled-components"));it();var Yut=(0,_V["default"])(Dr)(_templateObject331||(_templateObject331=_taggedTemplateLiteral(["\n width: ","px;\n height: ","px;\n margin-bottom: ","px;\n color: ",";\n"])),function(i){return i.theme.measurements.advancedUICard.large.width;},function(i){return i.theme.measurements.advancedUICard.large.height;},function(i){return i.theme.measurements.advancedUISpacer;},function(i){return i.theme.card.foreground;});var Jut=function Jut(_ref353){var i=_ref353.isActive,t=_objectWithoutProperties(_ref353,_excluded13);return yV["default"].createElement(Yut,_objectSpread({},t));};var xV=Jut;var vV=y(_("styled-components"));it();var CV=(0,vV["default"])(Dr)(_templateObject332||(_templateObject332=_taggedTemplateLiteral(["\n width: ","px;\n height: ","px;\n margin-bottom: ","px;\n color: ",";\n &:nth-child(2n + 1) {\n margin-right: ","px;\n }\n"])),function(i){return i.theme.measurements.advancedUICard.medium.width;},function(i){return i.theme.measurements.advancedUICard.medium.height;},function(i){return i.theme.measurements.advancedUISpacer;},function(i){return i.theme.card.foreground;},function(i){return i.theme.measurements.advancedUISpacer;});var SV=y(_("styled-components"));it();var wV=(0,SV["default"])(Dr)(_templateObject333||(_templateObject333=_taggedTemplateLiteral(["\n width: ","px;\n height: ","px;\n margin-bottom: ","px;\n color: ",";\n &:nth-child(3n + 1),\n &:nth-child(3n + 2) {\n margin-right: ","px;\n }\n"])),function(i){return i.theme.measurements.advancedUICard.small.width;},function(i){return i.theme.measurements.advancedUICard.small.height;},function(i){return i.theme.measurements.advancedUISpacer;},function(i){return i.theme.card.foreground;},function(i){return i.theme.measurements.advancedUISpacer;});var bf=function bf(_ref354){var i=_ref354.type,t=_objectWithoutProperties(_ref354,_excluded14);var e=i==="large";var r=i==="small";var o=CV;if(e){o=xV;}else if(r){o=wV;}return TV["default"].createElement(o,_objectSpread({type:i},t));};var kV=y(_("styled-components"));U();var Nv=kV["default"].div.attrs(function(i){return{"data-test":i["data-test"]||N.CardContainer};})(_templateObject334||(_templateObject334=_taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n /* width - padding on both sides */\n width: ","px;\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.width-48;});var IV=y(_("react"));var yf=y(_("styled-components"));U();var Zut=yf["default"].div(_templateObject335||(_templateObject335=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n\n position: relative;\n width: ","px;\n /* for Firefox */\n min-height: 0;\n margin-bottom: ","px;\n\n z-index: ",";\n\n background: ",";\n transition: width 0.4s ease-in;\n ","\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.width;},function(i){return i.theme.measurements.advancedUIToolControlBar.marginBottom;},function(i){return i.theme.measurements.zIndex.toolControlBar;},function(i){return i.theme.toolControlBar.background;},function(i){return!i.reverse?yf.css(_templateObject336||(_templateObject336=_taggedTemplateLiteral(["\n border-right: 1px solid ",";\n "])),i.theme.toolControlBar.borderColor):yf.css(_templateObject337||(_templateObject337=_taggedTemplateLiteral(["\n border-left: 1px solid ",";\n "])),i.theme.toolControlBar.borderColor);});var DV=function DV(_ref355){var _ref355$reverse=_ref355.reverse,i=_ref355$reverse===void 0?false:_ref355$reverse,t=_ref355.style,e=_ref355.className,r=_ref355.children;return IV["default"].createElement(Zut,{"data-test":N.ToolControlBar,reverse:i,className:e,style:t},r);};var Om=y(_("styled-components"));U();var EV=Om["default"].div.attrs(function(){return{"data-test":N.CategoryItemsContainer};})(_templateObject338||(_templateObject338=_taggedTemplateLiteral(["\n transition: max-height 0.8s ease-out, transform 0.8s ease-out;\n background: ",";\n visibility: hidden;\n opacity: 0;\n transform-origin: 0 0;\n display: none;\n flex-wrap: wrap;\n\n ","\n"])),function(i){return i.theme.toolControlBar.background;},function(_ref356){var i=_ref356.show;return i&&Om.css(_templateObject339||(_templateObject339=_taggedTemplateLiteral(["\n opacity: 1;\n visibility: visible;\n ","\n "])),ve()?Om.css(_templateObject340||(_templateObject340=_taggedTemplateLiteral(["\n display: block;\n "]))):Om.css(_templateObject341||(_templateObject341=_taggedTemplateLiteral(["\n display: flex;\n "]))));});var WI=y(_("react"));var GI=y(_("styled-components"));it();U();var Qut=(0,GI["default"])(c1)(_templateObject342||(_templateObject342=_taggedTemplateLiteral(["\n color: ",";\n\n /* the padding and margin should only be applied to the children */\n margin: 0 !important;\n padding: 0 !important;\n"])),function(i){return i.theme.toolControlBar.inputLabelForeground;});var tdt=GI["default"].div(_templateObject343||(_templateObject343=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n > * {\n margin-left: ","px;\n margin-right: ","px;\n margin-bottom: ","px;\n }\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.paddingLeft;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingRight;},function(i){return i.theme.measurements.advancedUIToolControlBar.controls.gutter;});var FV=function FV(_ref357){var i=_ref357.show,t=_ref357.children;return WI["default"].createElement(Qut,{duration:300,height:i?"auto":0,easing:"ease-in-out",animateOpacity:true},WI["default"].createElement(tdt,{"data-test":N.ToolControlBarExpandableControls},t));};var Hv=y(_("styled-components"));it();U();var _f=(0,Hv["default"])(Oo)(_templateObject344||(_templateObject344=_taggedTemplateLiteral(["\n position: relative;\n\n box-sizing: border-box;\n\n /* for Firefox */\n min-height: 0;\n\n transition: height 0.4s cubic-bezier(0.17, 0.04, 0.03, 0.94);\n color: ",";\n\n /* compensate the padding in IE and Edge */\n ","\n"])),function(i){return i.theme.toolControlBar.inputLabelForeground;},function(){if(ve()||wr()){return Hv.css(_templateObject345||(_templateObject345=_taggedTemplateLiteral(["\n > ul {\n padding-right: 34px;\n margin-right: -34px;\n }\n "])));}return"";});_f.defaultProps={direction:"vertical"};var Wv=y(_("styled-components"));var edt=Wv["default"].div(_templateObject346||(_templateObject346=_taggedTemplateLiteral(["\n position: relative;\n &:after {\n content: '';\n position: absolute;\n bottom: 0px;\n ","\n border-bottom: 2px solid ",";\n }\n"])),function(i){return i.full?Wv.css(_templateObject347||(_templateObject347=_taggedTemplateLiteral(["\n left: -","px;\n width: calc(\n 100% + ","px\n );\n "])),3*i.theme.measurements.advancedUISpacer/2,3*i.theme.measurements.advancedUISpacer):"\n left: ".concat(3*i.theme.measurements.advancedUISpacer/2,"px;\n width: calc(100% - ").concat(3*i.theme.measurements.advancedUISpacer,"px);\n ");},function(i){return i.theme.toolControlBar.separatorColor;});var Gv=edt;var OV=y(_("styled-components"));var idt=OV["default"].h2(_templateObject348||(_templateObject348=_taggedTemplateLiteral(["\n color: ",";\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n font-weight: 500;\n min-height: ","px;\n margin-top: 0;\n"])),function(i){return i.theme.toolControlBar.titleForeground;},function(i){return i.theme.measurements.fontSystem.headline2.size;},function(i){return i.theme.measurements.fontSystem.headline2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.headline2["case"];},function(i){return 2*i.theme.measurements.advancedUISpacer;});var Vv=idt;var sa=y(_("react"));var RV=y(_("styled-components"));it();U();var rdt=RV["default"].div(_templateObject349||(_templateObject349=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n flex: 1 0 auto;\n"])));var AV=function AV(_ref358){var i=_ref358.name,t=_ref358.isFirstCategory,e=_ref358.isLastCategory,r=_ref358.children;return sa["default"].createElement(rdt,null,!t&&sa["default"].createElement(P.Spacer,{count:2}),sa["default"].createElement(Vv,{"data-test":i},i),sa["default"].createElement(Nv,{"data-test":N.CategoryItemsContainer},r),!e&&sa["default"].createElement(sa["default"].Fragment,null,sa["default"].createElement(P.Spacer,{count:2}),sa["default"].createElement(Gv,{full:true})));};var BV=y(_("styled-components"));var odt=BV["default"].h1(_templateObject350||(_templateObject350=_taggedTemplateLiteral(["\n /* Center text horizontally and vertically */\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 0;\n padding: 0 4px;\n margin: 0;\n min-height: ","px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n background: ",";\n color: ",";\n border-bottom: 1px solid ",";\n font-weight: 500;\n text-align: center;\n /* prevent the padding from leaving the width of the parent */\n box-sizing: border-box;\n"])),function(i){return i.theme.measurements.mainCanvasActionBar.height-2;},function(i){return i.theme.measurements.fontSystem.headline1.size;},function(i){return i.theme.measurements.fontSystem.headline1.letterSpacing;},function(i){return i.theme.measurements.fontSystem.headline1["case"];},function(i){return i.theme.toolControlBar.background;},function(i){return i.theme.toolControlBar.titleForeground;},function(i){return i.theme.toolControlBar.separatorColor;});var PV=odt;var MV=y(_("react"));var LV=y(_("styled-components"));W();var ndt=LV["default"].div(_templateObject351||(_templateObject351=_taggedTemplateLiteral(["\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n\n overflow-y: auto;\n overflow-x: hidden;\n\n /* calculate the max-height based on the padding and if the heading is used */\n max-height: calc(\n 100% -\n ","px -\n ","px\n );\n\n padding-top: ","px;\n padding-bottom: ","px;\n\n > * {\n margin-left: ","px;\n margin-right: ","px;\n }\n\n /* The scrollable content needs a padding for the scrollbar position */\n > "," {\n margin-left: 0px;\n margin-right: 0px;\n padding-left: ","px;\n padding-right: ","px;\n }\n\n > :not(:last-child) {\n margin-bottom: ","px;\n }\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.paddingBottom+i.theme.measurements.advancedUIToolControlBar.paddingTop;},function(i){return i.displayTitle?i.theme.measurements.mainCanvasActionBar.height-2:"0";},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingTop;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingBottom;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingLeft;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingRight;},_f,function(i){return i.theme.measurements.advancedUIToolControlBar.paddingLeft;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingRight;},function(i){return i.theme.measurements.advancedUIToolControlBar.controls.gutter;});var zV=function zV(_ref359){var i=_ref359.children;var _D47=D(),t=_D47.config;var e=t.config.displayToolControlBarTitle;return MV["default"].createElement(ndt,{displayTitle:e},i);};var VI=y(_("react"));var Rm=y(_("styled-components"));it();U();var sdt=Rm["default"].div(_templateObject352||(_templateObject352=_taggedTemplateLiteral(["\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n align-items: center;\n height: 100%;\n width: ","px;\n\n z-index: ",";\n\n background-color: ",";\n color: ",";\n ","\n margin-bottom: ","px;\n"])),function(i){return i.theme.measurements.advancedUIToolbar.width;},function(i){return i.theme.measurements.zIndex.toolbar;},function(i){return i.theme.toolbar.background;},function(i){return i.theme.toolbar.foreground;},function(i){var t=i.theme.toolbar.border?i.theme.toolbar.border:Rm.css(_templateObject353||(_templateObject353=_taggedTemplateLiteral(["\n 1px solid ",";\n "])),i.theme.toolbar.borderColor);return!i.reverse?Rm.css(_templateObject354||(_templateObject354=_taggedTemplateLiteral(["\n border-right: ",";\n "])),t):Rm.css(_templateObject355||(_templateObject355=_taggedTemplateLiteral(["\n border-left: ",";\n "])),t);},function(i){return i.theme.measurements.advancedUIToolbar.marginBottom;});var UV=function UV(_ref360){var i=_ref360.reverse,t=_ref360.style,e=_ref360.className,r=_ref360.children;return VI["default"].createElement(sdt,{reverse:i,"data-test":N.Toolbar,className:e,style:t},VI["default"].createElement(Oo,{direction:"vertical"},r));};var jI=y(_("react"));var vu=y(_("styled-components"));it();U();var adt=(0,vu["default"])(Ro)(_templateObject356||(_templateObject356=_taggedTemplateLiteral(["\n width: inherit;\n height: inherit;\n padding: 0;\n margin: 0;\n ","\n\n ","\n"])),ve()?vu.css(_templateObject357||(_templateObject357=_taggedTemplateLiteral(["\n background-color: transparent;\n "]))):vu.css(_templateObject358||(_templateObject358=_taggedTemplateLiteral(["\n background-color: inherit;\n "]))),function(i){return i.isActive&&vu.css(_templateObject359||(_templateObject359=_taggedTemplateLiteral(["\n background-color: ",";\n color: ",";\n\n svg {\n color: ",";\n }\n "])),i.theme.toolbar.activeBackground,i.theme.toolbar.activeForeground,i.theme.toolbar.activeForeground);});var ldt=vu["default"].li.attrs({"aria-haspopup":true,"aria-hidden":true,role:"menuitem"})(_templateObject360||(_templateObject360=_taggedTemplateLiteral(["\n height: ","px;\n cursor: pointer;\n position: relative;\n"])),function(i){return i.theme.measurements.advancedUIToolbar.itemHeight;});var NV=function NV(i){return jI["default"].createElement(ldt,null,jI["default"].createElement(adt,_objectSpread(_objectSpread({},i),{},{"data-test":N.ToolbarItem})));};var HV=y(_("styled-components"));var cdt=HV["default"].li.attrs({role:"none"})(_templateObject361||(_templateObject361=_taggedTemplateLiteral(["\n height: ","px;\n cursor: pointer;\n position: relative;\n"])),function(i){return i.theme.measurements.advancedUIToolbar.separatorHeight;});var WV=cdt;var wu=y(_("react"));var xf=_("react");var cne=y(_("react"));var tr=_("react");var ddt=y($V());var KV=mdt()?tr.useLayoutEffect:tr.useEffect;if(false){une=typeof process!=="undefined"?process:{env:{NODE_ENV:"development"}},dne=une.env;checkStyles=function i(t){if(checkedPkgs[t])return;checkedPkgs[t]=true;if(dne.NODE_ENV!=="test"&&parseInt(window.getComputedStyle(document.body).getPropertyValue("--reach-"+t),10)!==1){console.warn("@reach/"+t+' styles not found. If you are using a bundler like webpack or parcel include this in the entry file of your app before any of your own styles:\n\n import "@reach/'+t+"/styles.css\";\n\n Otherwise you'll need to include them some other way:\n\n \n\n For more information visit https://ui.reach.tech/styling.\n ');}};}var une;var dne;var mne=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();function mdt(){return!!(typeof window!=="undefined"&&window.document&&window.document.createElement);}if(false){useControlledSwitchWarning=function i(t,e,r){var o=(0,tr.useRef)(t!=null);var n=(0,tr.useRef)({componentName:r,controlledPropName:e});(0,tr.useEffect)(function(){n.current={componentName:r,controlledPropName:e};},[r,e]);(0,tr.useEffect)(function(){var s=o.current;var a=n.current,l=a.componentName,c=a.controlledPropName;var u=t!=null;if(s!==u){console.error("A component is changing an "+(s?"":"un")+"controlled `"+c+"` state of "+l+" to be "+(s?"un":"")+"controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled "+l+" element for the lifetime of the component.\nMore info: https://fb.me/react-controlled-components");}},[t]);};}if(false){useCheckStyles=function i(t){var e=(0,tr.useRef)(t);(0,tr.useEffect)(function(){return void(e.current=t);},[t]);(0,tr.useEffect)(function(){return checkStyles(e.current);},[]);};}function XV(){var i=(0,tr.useState)(Object.create(null)),t=i[1];return(0,tr.useCallback)(function(){t(Object.create(null));},[]);}if(false){useStateLogger=function i(t,e){if(e===void 0){e=false;}var r=(0,tr.useRef)(e);(0,tr.useEffect)(function(){r.current=e;},[e]);(0,tr.useEffect)(function(){if(r.current){console.group("State Updated");console.log("%c"+t,"font-weight: normal; font-size: 120%; font-style: italic;");console.groupEnd();}},[t]);};}var qV=_("react-dom");var pdt=function i(t){var e=t.children,r=t.type,o=r===void 0?"reach-portal":r;var n=(0,xf.useRef)(null);var s=(0,xf.useRef)(null);var a=XV();KV(function(){if(!n.current)return;var l=n.current.ownerDocument;s.current=l===null||l===void 0?void 0:l.createElement(o);l.body.appendChild(s.current);a();return function(){if(s.current&&s.current.ownerDocument){s.current.ownerDocument.body.removeChild(s.current);}};},[o,a]);return s.current?(0,qV.createPortal)(e,s.current):(0,xf.createElement)("span",{ref:n});};if(false){pdt.displayName="Portal";}var YV=pdt;function $I(i,t){if(i==null)return{};var e={};var r=Object.keys(i);var o,n;for(n=0;n=0)continue;e[o]=i[o];}return e;}function KI(i,t){i.prototype=Object.create(t.prototype);i.prototype.constructor=i;i.__proto__=t;}var gdt=y(oj());var vf=y(_("react"));var jv=y(_("react-dom"));var XI={disabled:false};var nj=y(_("react"));var qI=nj["default"].createContext(null);var Cf="unmounted";var Cu="exited";var Su="entering";var Bm="entered";var YI="exiting";var aa=function(i){KI(t,i);function t(r,o){var n;n=i.call(this,r,o)||this;var s=o;var a=s&&!s.isMounting?r.enter:r.appear;var l;n.appearStatus=null;if(r["in"]){if(a){l=Cu;n.appearStatus=Su;}else{l=Bm;}}else{if(r.unmountOnExit||r.mountOnEnter){l=Cf;}else{l=Cu;}}n.state={status:l};n.nextCallback=null;return n;}t.getDerivedStateFromProps=function r(o,n){var s=o["in"];if(s&&n.status===Cf){return{status:Cu};}return null;};var e=t.prototype;e.componentDidMount=function r(){this.updateStatus(true,this.appearStatus);};e.componentDidUpdate=function r(o){var n=null;if(o!==this.props){var s=this.state.status;if(this.props["in"]){if(s!==Su&&s!==Bm){n=Su;}}else{if(s===Su||s===Bm){n=YI;}}}this.updateStatus(false,n);};e.componentWillUnmount=function r(){this.cancelNextCallback();};e.getTimeouts=function r(){var o=this.props.timeout;var n,s,a;n=s=a=o;if(o!=null&&typeof o!=="number"){n=o.exit;s=o.enter;a=o.appear!==void 0?o.appear:s;}return{exit:n,enter:s,appear:a};};e.updateStatus=function r(o,n){if(o===void 0){o=false;}if(n!==null){this.cancelNextCallback();if(n===Su){this.performEnter(o);}else{this.performExit();}}else if(this.props.unmountOnExit&&this.state.status===Cu){this.setState({status:Cf});}};e.performEnter=function r(o){var n=this;var s=this.props.enter;var a=this.context?this.context.isMounting:o;var l=this.props.nodeRef?[a]:[jv["default"].findDOMNode(this),a],c=l[0],u=l[1];var m=this.getTimeouts();var p=a?m.appear:m.enter;if(!o&&!s||XI.disabled){this.safeSetState({status:Bm},function(){n.props.onEntered(c);});return;}this.props.onEnter(c,u);this.safeSetState({status:Su},function(){n.props.onEntering(c,u);n.onTransitionEnd(p,function(){n.safeSetState({status:Bm},function(){n.props.onEntered(c,u);});});});};e.performExit=function r(){var o=this;var n=this.props.exit;var s=this.getTimeouts();var a=this.props.nodeRef?void 0:jv["default"].findDOMNode(this);if(!n||XI.disabled){this.safeSetState({status:Cu},function(){o.props.onExited(a);});return;}this.props.onExit(a);this.safeSetState({status:YI},function(){o.props.onExiting(a);o.onTransitionEnd(s.exit,function(){o.safeSetState({status:Cu},function(){o.props.onExited(a);});});});};e.cancelNextCallback=function r(){if(this.nextCallback!==null){this.nextCallback.cancel();this.nextCallback=null;}};e.safeSetState=function r(o,n){n=this.setNextCallback(n);this.setState(o,n);};e.setNextCallback=function r(o){var n=this;var s=true;this.nextCallback=function(a){if(s){s=false;n.nextCallback=null;o(a);}};this.nextCallback.cancel=function(){s=false;};return this.nextCallback;};e.onTransitionEnd=function r(o,n){this.setNextCallback(n);var s=this.props.nodeRef?this.props.nodeRef.current:jv["default"].findDOMNode(this);var a=o==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return;}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],c=l[0],u=l[1];this.props.addEndListener(c,u);}if(o!=null){setTimeout(this.nextCallback,o);}};e.render=function r(){var o=this.state.status;if(o===Cf){return null;}var n=this.props,s=n.children,a=n["in"],l=n.mountOnEnter,c=n.unmountOnExit,u=n.appear,m=n.enter,p=n.exit,h=n.timeout,g=n.addEndListener,x=n.onEnter,v=n.onEntering,b=n.onEntered,T=n.onExit,k=n.onExiting,E=n.onExited,A=n.nodeRef,I=$I(n,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return vf["default"].createElement(qI.Provider,{value:null},typeof s==="function"?s(o,I):vf["default"].cloneElement(vf["default"].Children.only(s),I));};return t;}(vf["default"].Component);aa.contextType=qI;aa.propTypes=false?{nodeRef:gdt["default"].shape({current:typeof Element==="undefined"?gdt["default"].any:gdt["default"].instanceOf(Element)}),children:gdt["default"].oneOfType([gdt["default"].func.isRequired,gdt["default"].element.isRequired]).isRequired,"in":gdt["default"].bool,mountOnEnter:gdt["default"].bool,unmountOnExit:gdt["default"].bool,appear:gdt["default"].bool,enter:gdt["default"].bool,exit:gdt["default"].bool,timeout:function i(t){var e=timeoutsShape;if(!t.addEndListener)e=e.isRequired;for(var r=arguments.length,o=new Array(r>1?r-1:0),n=1;n=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i=0)continue;target[key]=source[key];}return target;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _wrapNativeSuper(Class){var _cache=typeof Map==="function"?new Map():undefined;_wrapNativeSuper=function _wrapNativeSuper(Class){if(Class===null||!_isNativeFunction(Class))return Class;if(typeof Class!=="function"){throw new TypeError("Super expression must either be null or a function");}if(typeof _cache!=="undefined"){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper);}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor);}Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:false,writable:true,configurable:true}});return _setPrototypeOf(Wrapper,Class);};return _wrapNativeSuper(Class);}function _construct(Parent,args,Class){if(_isNativeReflectConstruct()){_construct=Reflect.construct;}else{_construct=function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var Constructor=Function.bind.apply(Parent,a);var instance=new Constructor();if(Class)_setPrototypeOf(instance,Class.prototype);return instance;};}return _construct.apply(null,arguments);}function _isNativeFunction(fn){return Function.toString.call(fn).indexOf("[native code]")!==-1;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e37){throw _e37;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e38){didErr=true;err=_e38;},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]();}finally{if(didErr)throw err;}}};}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i1?void 0:r?DD(t,e):t;for(var n=i.length-1,s;n>=0;n--){if(s=i[n])o=(r?s(t,e,o):s(o))||o;}if(r&&o)Pu(t,e,o);return o;};var q=function q(i,t,e){aJ(i,_typeof(t)!=="symbol"?t+"":t,e);return e;};function Wm(){if(typeof window!=="undefined"){return window;}if(typeof global!=="undefined"){return global;}if(typeof self!=="undefined"){return self;}return cJ;}function Cr(){return++lt.mobxGuid;}function me(i){pa(false,i);throw"X";}function pa(i,t){if(!i)throw new Error("[mobx] "+(t||lJ));}function is(i,t){if(true)return false;if(t){return is("'"+i+"', use '"+t+"' instead.");}if(RD.indexOf(i)!==-1)return false;RD.push(i);console.error("[mobx] Deprecated: "+i);return true;}function k0(i){var t=false;return function(){if(t)return;t=true;return i.apply(this,arguments);};}function uJ(i){var t=[];i.forEach(function(e){if(t.indexOf(e)===-1)t.push(e);});return t;}function I0(i){return i!==null&&_typeof(i)==="object";}function Uu(i){if(i===null||_typeof(i)!=="object")return false;var t=Object.getPrototypeOf(i);return t===Object.prototype||t===null;}function dJ(i){if(Nu(i)||sn(i)){return i;}else if(Array.isArray(i)){return new Map(i);}else if(Uu(i)){var t=new Map();for(var e in i){t.set(e,i[e]);}return t;}else{return me("Cannot convert to map from '"+i+"'");}}function mJ(i,t){for(var e=0;e0)&&!(o=r.next()).done){n.push(o.value);}}catch(a){s={error:a};}finally{try{if(o&&!o.done&&(e=r["return"]))e.call(r);}finally{if(s)throw s.error;}}return n;}function x0(){for(var i=[],t=0;t0;if(lt.computationDepth>0&&t)me(false);if(!lt.allowStateChanges&&(t||lt.enforceActions==="strict"))me(false);}function FJ(i){if(false){console.warn("[mobx] Observable "+i.name+" being read outside a reactive context");}}function QD(i,t,e){var r=Ll(true);tE(i);i.newObserving=new Array(i.observing.length+100);i.unboundDepsCount=0;i.runId=++lt.runId;var o=lt.trackingDerivation;lt.trackingDerivation=i;var n;if(lt.disableErrorBoundaries===true){n=t.call(e);}else{try{n=t.call(e);}catch(s){n=new fg(s);}}lt.trackingDerivation=o;RJ(i);if(i.observing.length===0){OJ(i);}os(r);return n;}function OJ(i){if(true)return;if(lt.reactionRequiresObservable||i.requiresObservable){console.warn("[mobx] Derivation "+i.name+" is created/updated without reading any observable value");}}function RJ(i){var t=i.observing;var e=i.observing=i.newObserving;var r=Yt.UP_TO_DATE;var o=0,n=i.unboundDepsCount;for(var s=0;sr){r=a.dependenciesState;}}e.length=o;i.newObserving=null;n=t.length;while(n--){var a=t[n];if(a.diffValue===0){oE(a,i);}a.diffValue=0;}while(o--){var a=e[o];if(a.diffValue===1){a.diffValue=0;zJ(a,i);}}if(r!==Yt.UP_TO_DATE){i.dependenciesState=r;i.onBecomeStale();}}function C0(i){var t=i.observing;i.observing=[];var e=t.length;while(e--){oE(t[e],i);}i.dependenciesState=Yt.NOT_TRACKING;}function R0(i){var t=Hu();var e=i();ha(t);return e;}function Hu(){var i=lt.trackingDerivation;lt.trackingDerivation=null;return i;}function ha(i){lt.trackingDerivation=i;}function Ll(i){var t=lt.allowStateReads;lt.allowStateReads=i;return t;}function os(i){lt.allowStateReads=i;}function tE(i){if(i.dependenciesState===Yt.UP_TO_DATE)return;i.dependenciesState=Yt.UP_TO_DATE;var t=i.observing;var e=t.length;while(e--){t[e].lowestObserverState=Yt.UP_TO_DATE;}}function Al(i,t){if(false){pa(typeof t==="function","`action` can only be invoked on functions");if(typeof i!=="string"||!i)me("actions should have valid names, got: '"+i+"'");}var e=function e(){return eE(i,t,this,arguments);};if(false){if(xpt){Object.defineProperty(e,"name",{value:i});}}e.isMobxAction=true;return e;}function eE(i,t,e,r){var o=BJ(i,e,r);try{return t.apply(e,r);}catch(n){o.error=n;throw n;}finally{PJ(o);}}function BJ(i,t,e){var r=bi()&&!!i;var o=0;if(r){o=Date.now();var n=e&&e.length||0;var s=new Array(n);if(n>0)for(var a=0;at.dependenciesState)i.lowestObserverState=t.dependenciesState;}function oE(i,t){if(i.observers.length===1){i.observers.length=0;nE(i);}else{var e=i.observers;var r=i.observersIndexes;var o=e.pop();if(o!==t){var n=r[t.__mapid]||0;if(n){r[o.__mapid]=n;}else{delete r[o.__mapid];}e[n]=o;}delete r[t.__mapid];}}function nE(i){if(i.isPendingUnobservation===false){i.isPendingUnobservation=true;lt.pendingUnobservations.push(i);}}function ns(){lt.inBatch++;}function ss(){if(--lt.inBatch===0){cE();var i=lt.pendingUnobservations;for(var t=0;t0){nE(i);}return false;}function UJ(i){if(i.lowestObserverState===Yt.STALE)return;i.lowestObserverState=Yt.STALE;var t=i.observers;var e=t.length;while(e--){var r=t[e];if(r.dependenciesState===Yt.UP_TO_DATE){if(r.isTracing!==xo.NONE){aE(r,i);}r.onBecomeStale();}r.dependenciesState=Yt.STALE;}}function NJ(i){if(i.lowestObserverState===Yt.STALE)return;i.lowestObserverState=Yt.STALE;var t=i.observers;var e=t.length;while(e--){var r=t[e];if(r.dependenciesState===Yt.POSSIBLY_STALE)r.dependenciesState=Yt.STALE;else if(r.dependenciesState===Yt.UP_TO_DATE)i.lowestObserverState=Yt.UP_TO_DATE;}}function HJ(i){if(i.lowestObserverState!==Yt.UP_TO_DATE)return;i.lowestObserverState=Yt.POSSIBLY_STALE;var t=i.observers;var e=t.length;while(e--){var r=t[e];if(r.dependenciesState===Yt.UP_TO_DATE){r.dependenciesState=Yt.POSSIBLY_STALE;if(r.isTracing!==xo.NONE){aE(r,i);}r.onBecomeStale();}}}function aE(i,t){console.log("[mobx.trace] '"+i.name+"' is invalidated due to a change in: '"+t.name+"'");if(i.isTracing===xo.BREAK){var e=[];lE(B0(i),e,1);new Function("debugger;\n/*\nTracing '"+i.name+"'\n\nYou are entering this break point because derivation '"+i.name+"' is being traced and '"+t.name+"' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n"+(i instanceof ga?i.derivation.toString().replace(/[*]\//g,"/"):"")+"\n\nThe dependencies for this derivation are:\n\n"+e.join("\n")+"\n*/\n ")();}}function lE(i,t,e){if(t.length>=1e3){t.push("(and many more)");return;}t.push(""+new Array(e).join(" ")+i.name);if(i.dependencies)i.dependencies.forEach(function(r){return lE(r,t,e+1);});}function cE(){if(lt.inBatch>0||lt.isRunningReactions)return;S0(WJ);}function WJ(){lt.isRunningReactions=true;var i=lt.pendingReactions;var t=0;while(i.length>0){if(++t===LD){console.error("Reaction doesn't converge to a stable state after "+LD+" iterations."+(" Probably there is a cycle in the reactive function: "+i[0]));i.splice(0);}var e=i.splice(0);for(var r=0,o=e.length;r";var r=typeof i==="function"?i:t;if(false){pa(typeof r==="function"&&r.length===0,"`runInAction` expects a function without arguments");if(typeof e!=="string"||!e)me("actions should have valid names, got: '"+e+"'");}return eE(e,r,this,void 0);}function b0(i,t,e){as(i,t,Al(t,e.bind(i)));}function XJ(i,t){if(t===void 0){t=VD;}if(false){pa(typeof i==="function","Autorun expects a function as first argument");pa(isAction(i)===false,"Autorun does not accept actions since actions are untrackable");}var e=t&&t.name||i.name||"Autorun@"+Cr();var r=!t.scheduler&&!t.delay;var o;if(r){o=new ba(e,function(){this.track(a);},t.onError,t.requiresObservable);}else{var n=YJ(t);var s=false;o=new ba(e,function(){if(!s){s=true;n(function(){s=false;if(!o.isDisposed)o.track(a);});}},t.onError,t.requiresObservable);}function a(){i(o);}o.schedule();return o.getDisposer();}function YJ(i){return i.scheduler?i.scheduler:i.delay?function(t){return setTimeout(t,i.delay);}:qJ;}function JJ(i,t,e){return dE("onBecomeObserved",i,t,e);}function uE(i,t,e){return dE("onBecomeUnobserved",i,t,e);}function dE(i,t,e,r){var o=typeof r==="function"?ya(t,e):ya(t);var n=typeof r==="function"?r:e;var s=o[i];if(typeof s!=="function")return me(false);o[i]=function(){s.call(this);n.call(this);};return function(){o[i]=s;};}function wg(i){var t=i.enforceActions,e=i.computedRequiresReaction,r=i.computedConfigurable,o=i.disableErrorBoundaries,n=i.arrayBuffer,s=i.reactionScheduler,a=i.reactionRequiresObservable,l=i.observableRequiresReaction;if(i.isolateGlobalState===true){LJ();}if(t!==void 0){if(typeof t==="boolean"||t==="strict")is("Deprecated value for 'enforceActions', use 'false' => '\"never\"', 'true' => '\"observed\"', '\"strict\"' => \"'always'\" instead");var c=void 0;switch(t){case true:case"observed":c=true;break;case false:case"never":c=false;break;case"strict":case"always":c="strict";break;default:me("Invalid value for 'enforceActions': '"+t+"', expected 'never', 'always' or 'observed'");}lt.enforceActions=c;lt.allowStateChanges=c===true||c==="strict"?false:true;}if(e!==void 0){lt.computedRequiresReaction=!!e;}if(a!==void 0){lt.reactionRequiresObservable=!!a;}if(l!==void 0){lt.observableRequiresReaction=!!l;lt.allowStateReads=!lt.observableRequiresReaction;}if(r!==void 0){lt.computedConfigurable=!!r;}if(o!==void 0){if(o===true)console.warn("WARNING: Debug feature only. MobX will NOT recover from errors if this is on.");lt.disableErrorBoundaries=!!o;}if(typeof n==="number"){M0(n);}if(s){GJ(s);}}function ZJ(i,t,e,r){if(false){pa(arguments.length>=2&&arguments.length<=4,"'extendObservable' expected 2-4 arguments");pa(_typeof(i)==="object","'extendObservable' expects an object as first argument");pa(!sn(i),"'extendObservable' should not be used on maps, use map.merge instead");pa(!yg(t),"Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540");if(e){for(var o in e){if(!(o in t))me("Trying to declare a decorator for unspecified property '"+o+"'");}}}r=Lu(r);var n=r.defaultDecorator||(r.deep===false?ZD:O0);Bl(i);L0(i,r.name,n.enhancer);ns();try{var s=Object.getOwnPropertyNames(t);for(var a=0,l=s.length;a0)t.dependencies=uJ(i.observing).map(mE);return t;}function QJ(){this.message="FLOW_CANCELLED";}function tZ(i,t){if(i===null||i===void 0)return false;if(t!==void 0){if(false)return me("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");if(Ml(i)){var e=i.$mobx;return e.values&&!!e.values[t];}return false;}return Ml(i)||!!i.$mobx||F0(i)||bg(i)||Sg(i);}function yg(i){if(arguments.length!==1)me(false);return tZ(i);}function eZ(i){if(Ml(i)){return i.$mobx.getKeys();}if(sn(i)){return rs(i.keys());}if(xa(i)){return rs(i.keys());}if(zl(i)){return i.map(function(t,e){return e;});}return me(false);}function Mu(i,t,e,r){if(r.detectCycles)i.set(t,e);return e;}function ma(i,t,e){if(!t.recurseEverything&&!yg(i))return i;if(_typeof(i)!=="object")return i;if(i===null)return null;if(i instanceof Date)return i;if(MJ(i))return ma(i.get(),t,e);if(yg(i))eZ(i);var r=t.detectCycles===true;if(r&&i!==null&&e.has(i)){return e.get(i);}if(zl(i)||Array.isArray(i)){var o=Mu(e,i,[],t);var n=i.map(function(g){return ma(g,t,e);});o.length=n.length;for(var s=0,a=n.length;s0;}function qm(i,t){var e=i.interceptors||(i.interceptors=[]);e.push(t);return k0(function(){var r=e.indexOf(t);if(r!==-1)e.splice(r,1);});}function on(i,t){var e=Hu();try{var r=i.interceptors;if(r)for(var o=0,n=r.length;o0;}function Ym(i,t){var e=i.changeListeners||(i.changeListeners=[]);e.push(t);return k0(function(){var r=e.indexOf(t);if(r!==-1)e.splice(r,1);});}function wo(i,t){var e=Hu();var r=i.changeListeners;if(!r)return;r=r.slice();for(var o=0,n=r.length;o2)es("box");var e=Lu(t);return new fa(i,lg(e),e.name,true,e.equals);},shallowBox:function shallowBox(i,t){if(arguments.length>2)es("shallowBox");is("observable.shallowBox","observable.box(value, { deep: false })");return Q.box(i,{name:t,deep:false});},array:function array(i,t){if(arguments.length>2)es("array");var e=Lu(t);return new nn(i,lg(e),e.name);},shallowArray:function shallowArray(i,t){if(arguments.length>2)es("shallowArray");is("observable.shallowArray","observable.array(values, { deep: false })");return Q.array(i,{name:t,deep:false});},map:function map(i,t){if(arguments.length>2)es("map");var e=Lu(t);return new Tg(i,lg(e),e.name);},shallowMap:function shallowMap(i,t){if(arguments.length>2)es("shallowMap");is("observable.shallowMap","observable.map(values, { deep: false })");return Q.map(i,{name:t,deep:false});},set:function set(i,t){if(arguments.length>2)es("set");var e=Lu(t);return new kg(i,lg(e),e.name);},object:function object(i,t,e){if(typeof arguments[1]==="string")es("object");var r=Lu(e);return ZJ({},i,t,r);},shallowObject:function shallowObject(i,t){if(typeof arguments[1]==="string")es("shallowObject");is("observable.shallowObject","observable.object(values, {}, { deep: false })");return Q.object(i,{},{name:t,deep:false});},ref:ZD,shallow:kJ,deep:O0,struct:IJ};Q=DJ;Object.keys(PD).forEach(function(i){return Q[i]=PD[i];});hg=YD(false,function(i,t,e,r,o){if(false){pa(e&&e.get,"Trying to declare a computed value for unspecified getter '"+t+"'");}var n=e.get,s=e.set;var a=o[0]||{};hZ(i,t,_Fe({get:n,set:s},a));});EJ=hg({equals:pg.structural});S=function i(t,e,r){if(typeof e==="string"){return hg.apply(null,arguments);}if(t!==null&&_typeof(t)==="object"&&arguments.length===1){return hg.apply(null,arguments);}if(false){pa(typeof t==="function","First argument to `computed` should be an expression.");pa(arguments.length<3,"Computed takes one or two arguments if used as function");}var o=_typeof(e)==="object"?e:{};o.get=t;o.set=typeof e==="function"?e:o.set;o.name=o.name||t.name||"";return new ga(o);};S.struct=EJ;(function(i){i[i["NOT_TRACKING"]=-1]="NOT_TRACKING";i[i["UP_TO_DATE"]=0]="UP_TO_DATE";i[i["POSSIBLY_STALE"]=1]="POSSIBLY_STALE";i[i["STALE"]=2]="STALE";})(Yt||(Yt={}));(function(i){i[i["NONE"]=0]="NONE";i[i["LOG"]=1]="LOG";i[i["BREAK"]=2]="BREAK";})(xo||(xo={}));fg=function(){function i(t){this.cause=t;}return i;}();gg=0;AJ=1;MD=Object.getOwnPropertyDescriptor(function(){},"name");xpt=MD&&MD.configurable;fa=function(i){qD(t,i);function t(e,r,o,n,s){if(o===void 0){o="ObservableValue@"+Cr();}if(n===void 0){n=true;}if(s===void 0){s=pg["default"];}var a=i.call(this,o)||this;a.enhancer=r;a.name=o;a.equals=s;a.hasUnreportedChange=false;a.value=r(e,void 0,o);if(n&&bi()){Pl({type:"create",name:a.name,newValue:""+a.value});}return a;}t.prototype.dehanceValue=function(e){if(this.dehancer!==void 0)return this.dehancer(e);return e;};t.prototype.set=function(e){var r=this.value;e=this.prepareNewValue(e);if(e!==lt.UNCHANGED){var o=bi();if(o){vo({type:"update",name:this.name,newValue:e,oldValue:r});}this.setNewValue(e);if(o)Co();}};t.prototype.prepareNewValue=function(e){zu(this);if(rn(this)){var r=on(this,{object:this,type:"update",newValue:e});if(!r)return lt.UNCHANGED;e=r.newValue;}e=this.enhancer(e,this.value,this.name);return this.equals(this.value,e)?lt.UNCHANGED:e;};t.prototype.setNewValue=function(e){var r=this.value;this.value=e;this.reportChanged();if(So(this)){wo(this,{type:"update",object:this,newValue:e,oldValue:r});}};t.prototype.get=function(){this.reportObserved();return this.dehanceValue(this.value);};t.prototype.intercept=function(e){return qm(this,e);};t.prototype.observe=function(e,r){if(r)e({object:this,type:"update",newValue:this.value,oldValue:void 0});return Ym(this,e);};t.prototype.toJSON=function(){return this.get();};t.prototype.toString=function(){return this.name+"["+this.value+"]";};t.prototype.valueOf=function(){return $D(this.get());};return t;}(_g);fa.prototype[jD()]=fa.prototype.valueOf;MJ=_a("ObservableValue",fa);ga=function(){function i(t){this.dependenciesState=Yt.NOT_TRACKING;this.observing=[];this.newObserving=null;this.isBeingObserved=false;this.isPendingUnobservation=false;this.observers=[];this.observersIndexes={};this.diffValue=0;this.runId=0;this.lastAccessedBy=0;this.lowestObserverState=Yt.UP_TO_DATE;this.unboundDepsCount=0;this.__mapid="#"+Cr();this.value=new fg(null);this.isComputing=false;this.isRunningSetter=false;this.isTracing=xo.NONE;pa(t.get,"missing option for computed: get");this.derivation=t.get;this.name=t.name||"ComputedValue@"+Cr();if(t.set)this.setter=Al(this.name+"-setter",t.set);this.equals=t.equals||(t.compareStructural||t.struct?pg.structural:pg["default"]);this.scope=t.context;this.requiresReaction=!!t.requiresReaction;this.keepAlive=!!t.keepAlive;}i.prototype.onBecomeStale=function(){HJ(this);};i.prototype.onBecomeUnobserved=function(){};i.prototype.onBecomeObserved=function(){};i.prototype.get=function(){if(this.isComputing)me("Cycle detected in computation "+this.name+": "+this.derivation);if(lt.inBatch===0&&this.observers.length===0&&!this.keepAlive){if(v0(this)){this.warnAboutUntrackedRead();ns();this.value=this.computeValue(false);ss();}}else{sE(this);if(v0(this)){if(this.trackAndCompute())NJ(this);}}var t=this.value;if(Hm(t))throw t.cause;return t;};i.prototype.peek=function(){var t=this.computeValue(false);if(Hm(t))throw t.cause;return t;};i.prototype.set=function(t){if(this.setter){pa(!this.isRunningSetter,"The setter of computed value '"+this.name+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?");this.isRunningSetter=true;try{this.setter.call(this.scope,t);}finally{this.isRunningSetter=false;}}else pa(false,false);};i.prototype.trackAndCompute=function(){if(bi()){Pl({object:this.scope,type:"compute",name:this.name});}var t=this.value;var e=this.dependenciesState===Yt.NOT_TRACKING;var r=this.computeValue(true);var o=e||Hm(t)||Hm(r)||!this.equals(t,r);if(o){this.value=r;}return o;};i.prototype.computeValue=function(t){this.isComputing=true;lt.computationDepth++;var e;if(t){e=QD(this,this.derivation,this.scope);}else{if(lt.disableErrorBoundaries===true){e=this.derivation.call(this.scope);}else{try{e=this.derivation.call(this.scope);}catch(r){e=new fg(r);}}}lt.computationDepth--;this.isComputing=false;return e;};i.prototype.suspend=function(){if(!this.keepAlive){C0(this);this.value=void 0;}};i.prototype.observe=function(t,e){var r=this;var o=true;var n=void 0;return XJ(function(){var s=r.get();if(!o||e){var a=Hu();t({type:"update",object:r,newValue:s,oldValue:n});ha(a);}o=false;n=s;});};i.prototype.warnAboutUntrackedRead=function(){if(true)return;if(this.requiresReaction===true){me("[mobx] Computed value "+this.name+" is read outside a reactive context");}if(this.isTracing!==xo.NONE){console.log("[mobx.trace] '"+this.name+"' is being read outside a reactive context. Doing a full recompute");}if(lt.computedRequiresReaction){console.warn("[mobx] Computed value "+this.name+" is being read outside a reactive context. Doing a full recompute");}};i.prototype.toJSON=function(){return this.get();};i.prototype.toString=function(){return this.name+"["+this.derivation.toString()+"]";};i.prototype.valueOf=function(){return $D(this.get());};return i;}();ga.prototype[jD()]=ga.prototype.valueOf;Sg=_a("ComputedValue",ga);ug=function(){function i(){this.version=5;this.UNCHANGED={};this.trackingDerivation=null;this.computationDepth=0;this.runId=0;this.mobxGuid=0;this.inBatch=0;this.pendingUnobservations=[];this.pendingReactions=[];this.isRunningReactions=false;this.allowStateChanges=true;this.allowStateReads=true;this.enforceActions=false;this.spyListeners=[];this.globalReactionErrorHandlers=[];this.computedRequiresReaction=false;this.reactionRequiresObservable=false;this.observableRequiresReaction=false;this.computedConfigurable=false;this.disableErrorBoundaries=false;this.suppressReactionErrors=false;}return i;}();dg=true;rE=false;lt=function(){var i=Wm();if(i.__mobxInstanceCount>0&&!i.__mobxGlobals)dg=false;if(i.__mobxGlobals&&i.__mobxGlobals.version!==new ug().version)dg=false;if(!dg){setTimeout(function(){if(!rE){me("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`");}},1);return new ug();}else if(i.__mobxGlobals){i.__mobxInstanceCount+=1;if(!i.__mobxGlobals.UNCHANGED)i.__mobxGlobals.UNCHANGED={};return i.__mobxGlobals;}else{i.__mobxInstanceCount=1;return i.__mobxGlobals=new ug();}}();ba=function(){function i(t,e,r,o){if(t===void 0){t="Reaction@"+Cr();}if(o===void 0){o=false;}this.name=t;this.onInvalidate=e;this.errorHandler=r;this.requiresObservable=o;this.observing=[];this.newObserving=[];this.dependenciesState=Yt.NOT_TRACKING;this.diffValue=0;this.runId=0;this.unboundDepsCount=0;this.__mapid="#"+Cr();this.isDisposed=false;this._isScheduled=false;this._isTrackPending=false;this._isRunning=false;this.isTracing=xo.NONE;}i.prototype.onBecomeStale=function(){this.schedule();};i.prototype.schedule=function(){if(!this._isScheduled){this._isScheduled=true;lt.pendingReactions.push(this);cE();}};i.prototype.isScheduled=function(){return this._isScheduled;};i.prototype.runReaction=function(){if(!this.isDisposed){ns();this._isScheduled=false;if(v0(this)){this._isTrackPending=true;try{this.onInvalidate();if(this._isTrackPending&&bi()){Pl({name:this.name,type:"scheduled-reaction"});}}catch(t){this.reportExceptionInDerivation(t);}}ss();}};i.prototype.track=function(t){ns();var e=bi();var r;if(e){r=Date.now();vo({name:this.name,type:"reaction"});}this._isRunning=true;var o=QD(this,t,void 0);this._isRunning=false;this._isTrackPending=false;if(this.isDisposed){C0(this);}if(Hm(o))this.reportExceptionInDerivation(o.cause);if(e){Co({time:Date.now()-r});}ss();};i.prototype.reportExceptionInDerivation=function(t){var e=this;if(this.errorHandler){this.errorHandler(t,this);return;}if(lt.disableErrorBoundaries)throw t;var r="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";if(lt.suppressReactionErrors){console.warn("[mobx] (error in reaction '"+this.name+"' suppressed, fix error of causing action below)");}else{console.error(r,t);}if(bi()){Pl({type:"error",name:this.name,message:r,error:""+t});}lt.globalReactionErrorHandlers.forEach(function(o){return o(t,e);});};i.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=true;if(!this._isRunning){ns();C0(this);ss();}}};i.prototype.getDisposer=function(){var t=this.dispose.bind(this);t.$mobx=this;return t;};i.prototype.toString=function(){return"Reaction["+this.name+"]";};i.prototype.trace=function(t){if(t===void 0){t=false;}rZ(this,t);};return i;}();LD=100;S0=function S0(i){return i();};bg=_a("Reaction",ba);VJ={spyReportEnd:true};C=function i(t,e,r,o){if(arguments.length===1&&typeof t==="function")return Al(t.name||"",t);if(arguments.length===2&&typeof e==="function")return Al(t,e);if(arguments.length===1&&typeof t==="string")return zD(t);if(o===true){t[e]=Al(t.name||e,r.value);}else{return zD(e).apply(null,arguments);}};C.bound=KJ;qJ=function qJ(i){return i();};QJ.prototype=Object.create(Error.prototype);iZ={detectCycles:true,exportMapsAsObjects:true,recurseEverything:false};nZ=1e4;sZ=function(){var i=false;var t={};Object.defineProperty(t,"0",{set:function set(){i=true;}});Object.create(t)["0"]=1;return i===false;}();w0=0;P0=function(){function i(){}return i;}();aZ(P0,Array.prototype);if(Object.isFrozen(Array)){["constructor","push","shift","concat","pop","unshift","replace","find","findIndex","splice","reverse","sort"].forEach(function(i){Object.defineProperty(P0.prototype,i,{configurable:true,writable:true,value:Array.prototype[i]});});}pE=function(){function i(t,e,r,o){this.array=r;this.owned=o;this.values=[];this.lastKnownLength=0;this.atom=new _g(t||"ObservableArray@"+Cr());this.enhancer=function(n,s){return e(n,s,t+"[..]");};}i.prototype.dehanceValue=function(t){if(this.dehancer!==void 0)return this.dehancer(t);return t;};i.prototype.dehanceValues=function(t){if(this.dehancer!==void 0&&t.length>0)return t.map(this.dehancer);return t;};i.prototype.intercept=function(t){return qm(this,t);};i.prototype.observe=function(t,e){if(e===void 0){e=false;}if(e){t({object:this.array,type:"splice",index:0,added:this.values.slice(),addedCount:this.values.length,removed:[],removedCount:0});}return Ym(this,t);};i.prototype.getArrayLength=function(){this.atom.reportObserved();return this.values.length;};i.prototype.setArrayLength=function(t){if(typeof t!=="number"||t<0)throw new Error("[mobx.array] Out of range: "+t);var e=this.values.length;if(t===e)return;else if(t>e){var r=new Array(t-e);for(var o=0;o0&&t+e+1>w0)M0(t+e+1);};i.prototype.spliceWithArray=function(t,e,r){var o=this;zu(this.atom);var n=this.values.length;if(t===void 0)t=0;else if(t>n)t=n;else if(t<0)t=Math.max(0,n+t);if(arguments.length===1)e=n-t;else if(e===void 0||e===null)e=0;else e=Math.max(0,Math.min(e,n-t));if(r===void 0)r=mg;if(rn(this)){var s=on(this,{object:this.array,type:"splice",index:t,removedCount:e,added:r});if(!s)return mg;e=s.removedCount;r=s.added;}r=r.length===0?r:r.map(function(c){return o.enhancer(c,void 0);});var a=r.length-e;this.updateArrayLength(n,a);var l=this.spliceItemsIntoValues(t,e,r);if(e!==0||r.length!==0)this.notifyArraySplice(t,r,l);return this.dehanceValues(l);};i.prototype.spliceItemsIntoValues=function(t,e,r){var o;if(r.length-1){this.splice(r,1);return true;}return false;};t.prototype.move=function(e,r){is("observableArray.move is deprecated, use .slice() & .replace() instead");function o(a){if(a<0){throw new Error("[mobx.array] Index out of bounds: "+a+" is negative");}var l=this.$mobx.values.length;if(a>=l){throw new Error("[mobx.array] Index out of bounds: "+a+" is not smaller than "+l);}}o.call(this,e);o.call(this,r);if(e===r){return;}var n=this.$mobx.values;var s;if(e0)&&!(o=r.next()).done){n.push(o.value);}}catch(a){s={error:a};}finally{try{if(o&&!o.done&&(e=r["return"]))e.call(r);}finally{if(s)throw s.error;}}return n;};CZ={};});function wZ(i){i();}function Ig(i){if(!i){i=wZ;if(false){console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native");}}wg({reactionScheduler:i});vE()[SZ]=true;}var SZ;var W0=d(function(){Tt();Wu();SZ=xE("observerBatching");});function an(){return TZ;}var TZ;var Dg=d(function(){TZ=false;});function CE(i){return B0(i);}var SE=d(function(){Tt();});function wE(i){var t={cleanAt:Date.now()+kZ,reaction:i};return t;}function TE(){if(G0===void 0){G0=setTimeout(DZ,IZ);}}function kE(i){Zm.add(i);TE();}function IE(i){Zm["delete"](i);}function DZ(){G0=void 0;var i=Date.now();Zm.forEach(function(t){var e=t.current;if(e){if(i>=e.cleanAt){e.reaction.dispose();t.current=null;Zm["delete"](t);}}});if(Zm.size>0){TE();}}var kZ,IZ,Zm,G0;var DE=d(function(){kZ=1e4;IZ=1e4;Zm=new Set();});function V0(i){return function(){if(Eg){Fg.push(i);}else{i();}};}function j0(i){Eg=true;Fg=[];try{var t=i();Eg=false;var e=Fg.length>0?Fg:void 0;EE["default"].useLayoutEffect(function(){if(e){e.forEach(function(r){return r();});}},[e]);return t;}finally{Eg=false;}}var EE,Eg,Fg;var $0=d(function(){EE=y(_("react"));Eg=false;Fg=[];});function FE(i){return"observer"+i;}function Gu(i,t,e){if(t===void 0){t="observed";}if(e===void 0){e=EZ;}if(an()){return i();}var r=e.useForceUpdate||H0;var o=r();var n=V0(o);var s=Og["default"].useRef(null);if(!s.current){var a=new ba(FE(t),function(){if(l.mounted){n();}else{a.dispose();s.current=null;}});var l=wE(a);s.current=l;kE(s);}var c=s.current.reaction;Og["default"].useDebugValue(c,CE);Og["default"].useEffect(function(){IE(s);if(s.current){s.current.mounted=true;}else{s.current={reaction:new ba(FE(t),function(){n();}),cleanAt:Infinity};n();}return function(){s.current.reaction.dispose();s.current=null;};},[]);return j0(function(){var u;var m;c.track(function(){try{u=i();}catch(p){m=p;}});if(m){throw m;}return u;});}var Og,EZ;var Rg=d(function(){Tt();Og=y(_("react"));SE();DE();Dg();Wu();$0();EZ={};});function X0(i,t){if(an()){return i;}var e=_K2({forwardRef:false},t);var r=i.displayName||i.name;var o=function o(s,a){return Gu(function(){return i(s,a);},r);};o.displayName=r;var n;if(e.forwardRef){n=(0,Qm.memo)((0,Qm.forwardRef)(o));}else{n=(0,Qm.memo)(o);}OZ(i,n);n.displayName=r;return n;}function OZ(i,t){Object.keys(i).forEach(function(e){if(!FZ[e]){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e));}});}var Qm,_K2,FZ;var OE=d(function(){Qm=_("react");Dg();Rg();_K2=function K0(){_K2=Object.assign||function(i){for(var t,e=1,r=arguments.length;e2?r-2:0),n=2;n";}function VZ(i){var t=this;if(an()===true)return i.call(this);ls(this,Bg,false);ls(this,Ag,false);var e=Q0(this);var r=i.bind(this);var o=false;var n=new ba(e+".render()",function(){if(!o){o=true;if(t[qE]!==true){var a=true;try{ls(t,Ag,true);if(!t[Bg])Me.Component.prototype.forceUpdate.call(t);a=false;}finally{ls(t,Ag,false);if(a)n.dispose();}}}});n["reactComponent"]=this;s[Z0]=n;this.render=s;function s(){o=false;var a=void 0;var l=void 0;n.track(function(){try{l=iE(false,r);}catch(c){a=c;}});if(a){throw a;}return l;}return s.call(this);}function HE(i,t){if(an()){console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side.");}if(this.state!==t){return true;}return!$E(this.props,i);}function WE(i,t){var e=va("reactProp_"+t+"_valueHolder");var r=va("reactProp_"+t+"_atomHolder");function o(){if(!this[r]){ls(this,r,xg("reactive "+t));}return this[r];}Object.defineProperty(i,t,{configurable:true,enumerable:true,get:function n(){var s=false;if(Ll&&os){s=Ll(true);}o.call(this).reportObserved();if(Ll&&os){os(s);}return this[e];},set:function n(s){if(!this[Ag]&&!$E(this[e],s)){ls(this,e,s);ls(this,Bg,true);o.call(this).reportChanged();ls(this,Bg,false);}else{ls(this,e,s);}}});}function w(i){if(i["isMobxInjector"]===true){console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'");}if(VE&&i["$$typeof"]===VE){throw new Error("Mobx observer: You are trying to use 'observer' on a function component wrapped in either another observer or 'React.memo'. The observer already applies 'React.memo' for you.");}if(GE&&i["$$typeof"]===GE){var t=i["render"];if(typeof t!=="function")throw new Error("render property of ForwardRef was not a function");return(0,Me.forwardRef)(function e(){var r=arguments;return(0,Me.createElement)(Vu,null,function(){return t.apply(void 0,r);});});}if(typeof i==="function"&&(!i.prototype||!i.prototype.render)&&!i["isReactClass"]&&!Object.prototype.isPrototypeOf.call(Me.Component,i)){return X0(i);}return GZ(i);}function Pg(){Pg=Object.assign||function(i){for(var t=1;t=0)continue;e[o]=i[o];}return e;}function ep(i){var t=i.children,e=jZ(i,["children"]);var r=Me["default"].useContext(tp);var o=Me["default"].useRef(Pg({},r,e));var n=o.current;if(false){var s=Pg({},n,e);if(!$E(n,s)){throw new Error("MobX Provider: The set of provided stores has changed. See: https://github.com/mobxjs/mobx-react#the-set-of-provided-stores-has-changed-error.");}}return Me["default"].createElement(tp.Provider,{value:n},t);}function jE(i,t,e,r){var o=Me["default"].forwardRef(function(n,s){var a=Pg({},n);var l=Me["default"].useContext(tp);Object.assign(a,i(l||{},a)||{});if(s){a.ref=s;}return Me["default"].createElement(t,a);});if(r)o=w(o);o["isMobxInjector"]=true;NZ(t,o);o["wrappedComponent"]=t;o.displayName=$Z(t,e);return o;}function $Z(i,t){var e;var r=i.displayName||i.name||i.constructor&&i.constructor.name||"Component";if(t)e="inject-with-"+t+"("+r+")";else e="inject("+r+")";return e;}function KZ(i){return function(t,e){i.forEach(function(r){if(r in e)return;if(!(r in t))throw new Error("MobX injector: Store '"+r+"' is not available! Make sure it is provided by some Provider");e[r]=t[r];});return e;};}function rt(){for(var i=arguments.length,t=new Array(i),e=0;e0;});};});var nF;var sF=d(function(){ju();nF=function nF(){return qr.some(function(i){return i.skippedTargets.length>0;});};});var aF,lF;var cF=d(function(){aF="ResizeObserver loop completed with undelivered notifications.";lF=function lF(){var i;if(typeof ErrorEvent==="function"){i=new ErrorEvent("error",{message:aF});}else{i=document.createEvent("Event");i.initEvent("error",false,false);i.message=aF;}window.dispatchEvent(i);};});var Ul;var iC=d(function(){(function(i){i["BORDER_BOX"]="border-box";i["CONTENT_BOX"]="content-box";i["DEVICE_PIXEL_CONTENT_BOX"]="device-pixel-content-box";})(Ul||(Ul={}));});var rC;var uF=d(function(){rC=function(){function i(t,e,r,o){this.x=t;this.y=e;this.width=r;this.height=o;this.top=this.y;this.left=this.x;this.bottom=this.top+this.height;this.right=this.left+this.width;return Object.freeze(this);}i.prototype.toJSON=function(){var t=this,e=t.x,r=t.y,o=t.top,n=t.right,s=t.bottom,a=t.left,l=t.width,c=t.height;return{x:e,y:r,top:o,right:n,bottom:s,left:a,width:l,height:c};};i.fromRect=function(t){return new i(t.x,t.y,t.width,t.height);};return i;}();});var ip,zg,oC,dF;var rp=d(function(){ip=function ip(i){return i instanceof SVGElement&&"getBBox"in i;};zg=function zg(i){if(ip(i)){var t=i.getBBox(),e=t.width,r=t.height;return!e&&!r;}var o=i,n=o.offsetWidth,s=o.offsetHeight;return!(n||s||i.getClientRects().length);};oC=function oC(i){var t,e;var r=(e=(t=i)===null||t===void 0?void 0:t.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(r&&i instanceof r.Element);};dF=function dF(i){switch(i.tagName){case"INPUT":if(i.type!=="image"){break;}case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return true;}return false;};});var Nl;var nC=d(function(){Nl=typeof window!=="undefined"?window:{};});var Ug,mF,XZ,qZ,ln,$u,pF,sC,Ng;var Hg=d(function(){iC();uF();rp();nC();Ug=new WeakMap();mF=/auto|scroll/;XZ=/^tb|vertical/;qZ=/msie|trident/i.test(Nl.navigator&&Nl.navigator.userAgent);ln=function ln(i){return parseFloat(i||"0");};$u=function $u(i,t,e){if(i===void 0){i=0;}if(t===void 0){t=0;}if(e===void 0){e=false;}return Object.freeze({inlineSize:(e?t:i)||0,blockSize:(e?i:t)||0});};pF=Object.freeze({devicePixelContentBoxSize:$u(),borderBoxSize:$u(),contentBoxSize:$u(),contentRect:new rC(0,0,0,0)});sC=function sC(i,t){if(t===void 0){t=false;}if(Ug.has(i)&&!t){return Ug.get(i);}if(zg(i)){Ug.set(i,pF);return pF;}var e=getComputedStyle(i);var r=ip(i)&&i.ownerSVGElement&&i.getBBox();var o=!qZ&&e.boxSizing==="border-box";var n=XZ.test(e.writingMode||"");var s=!r&&mF.test(e.overflowY||"");var a=!r&&mF.test(e.overflowX||"");var l=r?0:ln(e.paddingTop);var c=r?0:ln(e.paddingRight);var u=r?0:ln(e.paddingBottom);var m=r?0:ln(e.paddingLeft);var p=r?0:ln(e.borderTopWidth);var h=r?0:ln(e.borderRightWidth);var g=r?0:ln(e.borderBottomWidth);var x=r?0:ln(e.borderLeftWidth);var v=m+c;var b=l+u;var T=x+h;var k=p+g;var E=!a?0:i.offsetHeight-k-i.clientHeight;var A=!s?0:i.offsetWidth-T-i.clientWidth;var I=o?v+T:0;var F=o?b+k:0;var Z=r?r.width:ln(e.width)-I-A;var et=r?r.height:ln(e.height)-F-E;var pt=Z+v+A+T;var yt=et+b+E+k;var bt=Object.freeze({devicePixelContentBoxSize:$u(Math.round(Z*devicePixelRatio),Math.round(et*devicePixelRatio),n),borderBoxSize:$u(pt,yt,n),contentBoxSize:$u(Z,et,n),contentRect:new rC(m,l,Z,et)});Ug.set(i,bt);return bt;};Ng=function Ng(i,t,e){var r=sC(i,e),o=r.borderBoxSize,n=r.contentBoxSize,s=r.devicePixelContentBoxSize;switch(t){case Ul.DEVICE_PIXEL_CONTENT_BOX:return s;case Ul.BORDER_BOX:return o;default:return n;}};});var aC;var lC=d(function(){Hg();aC=function(){function i(t){var e=sC(t);this.target=t;this.contentRect=e.contentRect;this.borderBoxSize=[e.borderBoxSize];this.contentBoxSize=[e.contentBoxSize];this.devicePixelContentBoxSize=[e.devicePixelContentBoxSize];}return i;}();});var Wg;var cC=d(function(){rp();Wg=function Wg(i){if(zg(i)){return Infinity;}var t=0;var e=i.parentNode;while(e){t+=1;e=e.parentNode;}return t;};});var hF;var fF=d(function(){ju();lC();cC();Hg();hF=function hF(){var i=Infinity;var t=[];qr.forEach(function n(s){if(s.activeTargets.length===0){return;}var a=[];s.activeTargets.forEach(function l(c){var u=new aC(c.target);var m=Wg(c.target);a.push(u);c.lastReportedSize=Ng(c.target,c.observedBox);if(mi){e.activeTargets.push(o);}else{e.skippedTargets.push(o);}}});});};});var bF;var yF=d(function(){oF();sF();cF();fF();gF();bF=function bF(){var i=0;uC(i);while(rF()){i=hF();uC(i);}if(nF()){lF();}return i>0;};});var dC,_F,YZ,xF;var vF=d(function(){_F=[];YZ=function YZ(){return _F.splice(0).forEach(function(i){return i();});};xF=function xF(i){if(!dC){var t=0;var e=document.createTextNode("");var r={characterData:true};new MutationObserver(function(){return YZ();}).observe(e,r);dC=function dC(){e.textContent=""+(t?t--:t++);};}_F.push(i);dC();};});var CF;var SF=d(function(){vF();CF=function CF(i){xF(function t(){requestAnimationFrame(i);});};});var Gg,JZ,ZZ,QZ,wF,TF,mC,tQ,Vg,pC;var kF=d(function(){yF();nC();SF();Gg=0;JZ=function JZ(){return!!Gg;};ZZ=250;QZ={attributes:true,characterData:true,childList:true,subtree:true};wF=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"];TF=function TF(i){if(i===void 0){i=0;}return Date.now()+i;};mC=false;tQ=function(){function i(){var t=this;this.stopped=true;this.listener=function(){return t.schedule();};}i.prototype.run=function(t){var e=this;if(t===void 0){t=ZZ;}if(mC){return;}mC=true;var r=TF(t);CF(function(){var o=false;try{o=bF();}finally{mC=false;t=r-TF();if(!JZ()){return;}if(o){e.run(1e3);}else if(t>0){e.run(t);}else{e.start();}}});};i.prototype.schedule=function(){this.stop();this.run();};i.prototype.observe=function(){var t=this;var e=function e(){return t.observer&&t.observer.observe(document.body,QZ);};document.body?e():Nl.addEventListener("DOMContentLoaded",e);};i.prototype.start=function(){var t=this;if(this.stopped){this.stopped=false;this.observer=new MutationObserver(this.listener);this.observe();wF.forEach(function(e){return Nl.addEventListener(e,t.listener,true);});}};i.prototype.stop=function(){var t=this;if(!this.stopped){this.observer&&this.observer.disconnect();wF.forEach(function(e){return Nl.removeEventListener(e,t.listener,true);});this.stopped=true;}};return i;}();Vg=new tQ();pC=function pC(i){!Gg&&i>0&&Vg.start();Gg+=i;!Gg&&Vg.stop();};});var eQ,IF;var DF=d(function(){iC();Hg();rp();eQ=function eQ(i){return!ip(i)&&!dF(i)&&getComputedStyle(i).display==="inline";};IF=function(){function i(t,e){this.target=t;this.observedBox=e||Ul.CONTENT_BOX;this.lastReportedSize={inlineSize:0,blockSize:0};}i.prototype.isActive=function(){var t=Ng(this.target,this.observedBox,true);if(eQ(this.target)){this.lastReportedSize=t;}if(this.lastReportedSize.inlineSize!==t.inlineSize||this.lastReportedSize.blockSize!==t.blockSize){return true;}return false;};return i;}();});var EF;var FF=d(function(){EF=function(){function i(t,e){this.activeTargets=[];this.skippedTargets=[];this.observationTargets=[];this.observer=t;this.callback=e;}return i;}();});var jg,OF,op;var RF=d(function(){kF();DF();FF();ju();jg=new WeakMap();OF=function OF(i,t){for(var e=0;e=0){n&&qr.splice(qr.indexOf(r),1);r.observationTargets.splice(o,1);pC(-1);}};i.disconnect=function(t){var e=this;var r=jg.get(t);r.observationTargets.slice().forEach(function(o){return e.unobserve(t,o.target);});r.activeTargets.splice(0,r.activeTargets.length);};return i;}();});var Hl;var AF=d(function(){RF();rp();Hl=function(){function i(t){if(arguments.length===0){throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");}if(typeof t!=="function"){throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");}op.connect(this,t);}i.prototype.observe=function(t,e){if(arguments.length===0){throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");}if(!oC(t)){throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");}op.observe(this,t,e);};i.prototype.unobserve=function(t){if(arguments.length===0){throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");}if(!oC(t)){throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");}op.unobserve(this,t);};i.prototype.disconnect=function(){op.disconnect(this);};i.toString=function(){return"function ResizeObserver () { [polyfill code] }";};return i;}();});var $g=d(function(){AF();lC();});var Ku=Gt(function(Ift,MF){var iQ="Expected a function";var BF=0/0;var rQ="[object Symbol]";var oQ=/^\s+|\s+$/g;var nQ=/^[-+]0x[0-9a-f]+$/i;var sQ=/^0b[01]+$/i;var aQ=/^0o[0-7]+$/i;var lQ=parseInt;var cQ=(typeof global==="undefined"?"undefined":_typeof(global))=="object"&&global&&global.Object===Object&&global;var uQ=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self;var dQ=cQ||uQ||Function("return this")();var mQ=Object.prototype;var pQ=mQ.toString;var hQ=Math.max;var fQ=Math.min;var hC=function hC(){return dQ.Date.now();};function gQ(i,t,e){var r,o,n,s,a,l,c=0,u=false,m=false,p=true;if(typeof i!="function"){throw new TypeError(iQ);}t=PF(t)||0;if(fC(e)){u=!!e.leading;m="maxWait"in e;n=m?hQ(PF(e.maxWait)||0,t):n;p="trailing"in e?!!e.trailing:p;}function h(I){var F=r,Z=o;r=o=void 0;c=I;s=i.apply(Z,F);return s;}function g(I){c=I;a=setTimeout(b,t);return u?h(I):s;}function x(I){var F=I-l,Z=I-c,et=t-F;return m?fQ(et,n-Z):et;}function v(I){var F=I-l,Z=I-c;return l===void 0||F>=t||F<0||m&&Z>=n;}function b(){var I=hC();if(v(I)){return T(I);}a=setTimeout(b,x(I));}function T(I){a=void 0;if(p&&r){return h(I);}r=o=void 0;return s;}function k(){if(a!==void 0){clearTimeout(a);}c=0;r=l=o=a=void 0;}function E(){return a===void 0?s:T(hC());}function A(){var I=hC(),F=v(I);r=arguments;o=this;l=I;if(F){if(a===void 0){return g(l);}if(m){a=setTimeout(b,t);return h(l);}}if(a===void 0){a=setTimeout(b,t);}return s;}A.cancel=k;A.flush=E;return A;}function fC(i){var t=_typeof(i);return!!i&&(t=="object"||t=="function");}function bQ(i){return!!i&&_typeof(i)=="object";}function yQ(i){return _typeof(i)=="symbol"||bQ(i)&&pQ.call(i)==rQ;}function PF(i){if(typeof i=="number"){return i;}if(yQ(i)){return BF;}if(fC(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=fC(t)?t+"":t;}if(typeof i!="string"){return i===0?i:+i;}i=i.replace(oQ,"");var e=sQ.test(i);return e||aQ.test(i)?lQ(i.slice(2),e?2:8):nQ.test(i)?BF:+i;}MF.exports=gQ;});var LF,Oe;var Sr=d(function(){LF=y(_("react"));Oe=LF["default"].createContext({});});var zF=d(function(){});var $t;var To=d(function(){$t=function $t(i){if(i){i.width=1;i.height=1;var t=i.getContext("2d");if(t){t.clearRect(0,0,1,1);}}};});var np,wr,ve,UF,NF,HF,WF;var gC=d(function(){To();np=function np(){return typeof window!=="undefined"&&window.navigator&&window.navigator.userAgent||"";};wr=function wr(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return i.indexOf("Edge")!==-1;};ve=function ve(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return!!i.match(/msie|trident/i);};UF=function UF(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return!!i.match(/windows/i);};NF=function NF(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return i.indexOf("Safari")!==-1&&i.indexOf("Chrome")===-1;};HF=function HF(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:np();return!!i.match(/iP(hone|od|ad)|AppleWebKit/);};WF=function WF(){if(typeof document==="undefined"){return false;}var i=document.createElement("canvas");var t=i.getContext("webgl")||i.getContext("experimental-webgl");var e=t&&t instanceof WebGLRenderingContext;$t(i);return e;};});var _Q,GF;var VF=d(function(){_Q=new RegExp(/\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D\uD83D\uDC68|\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC68\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83D\uDC68\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83D\uDC68\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83D\uDC68\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83D\uDC68\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC69(?:\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFE])|\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFC-\uDFFF]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68\u200D(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68\u200D\u2764\uFE0F\u200D\uD83D\uDC68|\uD83D\uDC69\u200D\u2764\uFE0F\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDDD1\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC68(?:\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|(?:\uD83D[\uDC67-\uDC69])\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]\uFE0F)|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83C\uDFF3\uFE0F\u200D\u26A7|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF]))\u200D[\u2695\u2696\u2708]\uFE0F|\uD83D\uDC69\u200D(?:\uD83D[\uDC67\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83D\uDC3B\u200D\u2744|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDF])\u200D[\u2640\u2642])\uFE0F|\uD83E\uDDD1\u200D[\u2695\u2696\u2708]\uFE0F|(?:\uD83D[\uDC68\uDC69])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D[\u2695\u2696\u2708]\uFE0F)|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC08\u200D\u2B1B|\uD83E\uDDD1\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDC66\uDC67\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC3\uDFC7]|\uD83D[\uDC43\uDC4A-\uDC4C\uDC4F\uDC50\uDC66-\uDC69\uDC6B-\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD7A\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270C\u270D]|\uD83C[\uDFC2\uDFC4\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC46-\uDC49\uDC4D\uDC4E\uDD74\uDD75\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9\u23EA\u23ED-\u23EF\u23F1-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7\u26F8\u26FA\u26FD\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2753\u2757\u2763\u2764\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE1A\uDE2F\uDE37\uDF0D-\uDF0F\uDF15\uDF1C\uDF21\uDF24-\uDF2C\uDF36\uDF78\uDF7D\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFA7\uDFAC-\uDFAE\uDFC6\uDFCD\uDFCE\uDFD4-\uDFE0\uDFED\uDFF3\uDFF5\uDFF7]|\uD83D[\uDC08\uDC15\uDC1F\uDC26\uDC3F\uDC41\uDC53\uDC6A\uDC7D\uDCA3\uDCB0\uDCB3\uDCBB\uDCBF\uDCCB\uDCDA\uDCDF\uDCE4-\uDCE6\uDCEA-\uDCED\uDCF7\uDCF9-\uDCFB\uDCFD\uDD08\uDD0D\uDD12\uDD13\uDD49\uDD4A\uDD50-\uDD67\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDE10\uDE87\uDE8D\uDE91\uDE94\uDE98\uDEAD\uDEB2\uDEB9\uDEBA\uDEBC\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|[\u23E9-\u23F3\u23F8-\u23FA\u25FB-\u25FE\u2614\u2615\u267F\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26C8\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]/g);GF=function GF(i){return i.replace(_Q,"");};});var cn;var bC=d(function(){cn=function cn(i){try{new URL(i);return true;}catch(t){return false;}};});var jF;var yC=d(function(){jF=function jF(i){return i instanceof HTMLImageElement;};});function xQ(i){return!Object.prototype.hasOwnProperty.call(i,"name");}function vQ(i){return!Object.prototype.hasOwnProperty.call(i,"name");}var $F=d(function(){});var ko;var sp=d(function(){ko=function(m){m["UNDO"]="undo";m["REDO"]="redo";m["DELETE"]="delete";m["BRING_TO_FRONT"]="bringtofront";m["EDIT"]="edit";m["DUPLICATE"]="duplicate";m["ADD"]="add";m["FLIP"]="flip";m["INVERT"]="invert";m["CLOSE"]="close";m["EXPORT"]="export";return m;}(ko||{});});var H;var _C=d(function(){H=function(p){p["LIBRARY"]="library";p["TRANSFORM"]="transform";p["FILTER"]="filter";p["ADJUSTMENT"]="adjustment";p["FOCUS"]="focus";p["STICKER"]="sticker";p["TEXT"]="text";p["TEXT_DESIGN"]="textdesign";p["OVERLAY"]="overlay";p["FRAME"]="frame";p["BRUSH"]="brush";p["CUSTOM"]="customTool";return p;}(H||{});});var KF=d(function(){});var XF=d(function(){});var qF=d(function(){});var YF=d(function(){});var un;var Xu=d(function(){un=function(e){e["TEXT"]="text";e["CARD"]="card";return e;}(un||{});});var JF=d(function(){});var ZF=d(function(){});var Ue;var QF=d(function(){Ue=function(r){r["LARGE"]="large";r["MEDIUM"]="medium";r["SMALL"]="small";return r;}(Ue||{});});var tO=d(function(){});var eO=d(function(){});var iO=d(function(){});var rO=d(function(){});var oO=d(function(){});var nO=d(function(){});var sO=d(function(){});var aO=d(function(){});var lO=d(function(){});var cO=d(function(){});var uO=d(function(){});var dO=d(function(){});var mO=d(function(){});var pO=d(function(){});var dn;var hO=d(function(){dn=function(o){o["ERROR"]="error";o["WARNING"]="warning";o["INFO"]="info";o["TEXT_EDIT"]="textEdit";return o;}(dn||{});});var fO=d(function(){});var gO=d(function(){});var bO=d(function(){});var yO=d(function(){});var _O=d(function(){});var qe;var xO=d(function(){qe=function(c){c["BrushSize"]="brush-size";c["BrushHardness"]="brush-hardness";c["FilterIntensity"]="filter-intensity";c["TextLineSpacing"]="text-line-spacing";c["StickerOpacity"]="sticker-opacity";c["OverlayOpacity"]="overlay-opacity";c["FrameSize"]="frame-size";c["FrameOpacity"]="frame-opacity";c["FocusIntensity"]="focus-intensity";return c;}(qe||{});});var vO=d(function(){});var CO=d(function(){});var SO=d(function(){});var wO=d(function(){});var TO=d(function(){});var kO=d(function(){});var IO=d(function(){});var DO,EO,Kg;var FO=d(function(){DO=function DO(){_classCallCheck(this,DO);this.enabled=true;this.threshold=20;this.snapToHorizontalCenter=true;this.snapToVerticalCenter=true;this.snapToLeft=.1;this.snapToRight=.1;this.snapToTop=.1;this.snapToBottom=.1;};EO=function EO(){_classCallCheck(this,EO);this.enabled=true;this.threshold=20;this.angles=[0,45,90,135,180,225,270,315];};Kg=function Kg(){_classCallCheck(this,Kg);this.position=new DO();this.rotation=new EO();};});var OO,Xg;var RO=d(function(){OO=function(n){n["CENTER"]="center";n["TOP_LEFT"]="top-left";n["TOP_RIGHT"]="top-right";n["BOTTOM_LEFT"]="bottom-left";n["BOTTOM_RIGHT"]="bottom-right";return n;}(OO||{});Xg=function Xg(){_classCallCheck(this,Xg);this.watermarkURI="";this.alignment="top-right";this.inset=.05;this.size=.2;};});var AO,BO;var PO=d(function(){AO=function(t){t["OBJECT"]="object";return t;}(AO||{});BO=function BO(){_classCallCheck(this,BO);};});var Wl;var MO=d(function(){Wl=function(o){o["IMAGE"]="image";o["DATA_URL"]="data-url";o["BLOB"]="blob";o["MSBLOB"]="ms-blob";return o;}(Wl||{});});var mn;var LO=d(function(){mn=function(e){e["PNG"]="image/png";e["JPEG"]="image/jpeg";return e;}(mn||{});});var ap;var zO=d(function(){ap=function(l){l["BMP"]="image/bmp";l["GIF"]="image/gif";l["ICO"]="image/x-icon";l["JPEG"]="image/jpeg";l["PNG"]="image/png";l["SVG"]="image/svg+xml";l["TIFF"]="image/tiff";l["WEBP"]="image/webp";return l;}(ap||{});});var UO=d(function(){});var NO=d(function(){});var HO=d(function(){});var WO=d(function(){});var GO;var VO=d(function(){_C();GO=function GO(){_classCallCheck(this,GO);this.order="default";this.language="en";this.theme="dark";this.assetBaseUrl="assets/";this.assetResolver={};this.displayResizeWarning=false;this.displayCloseWarning=true;this.displayDiscardChangesWarning=true;this.displayCanvasRendererWarning=true;this.displayToolControlBarTitle=true;this.displaySerializationModal=true;this.forceCrop=false;this.enableZoom=true;this.scaleImageToFit=true;this.restrictZoomOutToDefault=true;this.defaultTool="filter";};"filter","focus","adjustment","library","overlay","sticker","text","textdesign","frame","brush","transform","customTool";});var jO=d(function(){});var qu,xC;var $O=d(function(){qu=function(p){p["BRIGHTNESS"]="brightness";p["CONTRAST"]="contrast";p["SATURATION"]="saturation";p["CLARITY"]="clarity";p["SHADOWS"]="shadows";p["HIGHLIGHTS"]="highlights";p["EXPOSURE"]="exposure";p["GAMMA"]="gamma";p["BLACKS"]="blacks";p["WHITES"]="whites";p["TEMPERATURE"]="temperature";p["SHARPNESS"]="sharpness";return p;}(qu||{});xC=Object.values(qu).reduce(function(i,t){i[t]=true;return i;},{});});var vC,qg;var KO=d(function(){vC=function(o){o["RemoveAdjustmentButton"]="removeAdjustmentButton";o["Expandable"]="expandable";o["Separator"]="separator";o["Items"]="items";return o;}(vC||{});qg=function qg(){_classCallCheck(this,qg);this.categories=[];this.flattenCategories=false;this.advancedUIToolControlBarOrder=[{type:"expandable",children:["removeAdjustmentButton","separator"]},"items"];};});var XO=d(function(){});var qO=d(function(){$O();KO();XO();});var YO;var JO=d(function(){YO=function YO(){_classCallCheck(this,YO);};});var CC,SC,Yg;var ZO=d(function(){Xu();CC=function(n){n["RemoveFilterButton"]="removeFilterButton";n["FilterIntensitySlider"]="filterIntensitySlider";n["Expandable"]="expandable";n["Separator"]="separator";n["Items"]="items";return n;}(CC||{});SC=function(t){t["FilterIntensity"]="filterIntensity";return t;}(SC||{});Yg=function Yg(){_classCallCheck(this,Yg);this.categories=[];this.flattenCategories=false;this.categoryHeaderType="card";this.enablePreviewThumbnails=false;this.advancedUIToolControlBarOrder=[{type:"expandable",children:["removeFilterButton","filterIntensitySlider","separator"]},"items"];this.basicUIToolControlBarTabsOrder=["filterIntensity"];};});function Yu(i){return i.lightColor!==void 0;}function wC(i){return i.lutURI!==void 0;}var QO=d(function(){});var lp,cp;var tR=d(function(){lp=function(ut){ut["Desert"]="imgly_duotone_desert";ut["Peach"]="imgly_duotone_peach";ut["Clash"]="imgly_duotone_clash";ut["Plum"]="imgly_duotone_plum";ut["Breezy"]="imgly_duotone_breezy";ut["DeepBlue"]="imgly_duotone_deepblue";ut["Frog"]="imgly_duotone_frog";ut["Sunset"]="imgly_duotone_sunset";ut["AD1920"]="imgly_lut_ad1920";ut["Greyed"]="imgly_lut_bw";ut["Dusty"]="imgly_lut_x400";ut["Litho"]="imgly_lut_litho";ut["Sepia"]="imgly_lut_sepiahigh";ut["Weathered"]="imgly_lut_plate";ut["HardStuff"]="imgly_lut_sin";ut["Polaroid"]="imgly_lut_blues";ut["Sunny70s"]="imgly_lut_front";ut["Oldtimer"]="imgly_lut_texas";ut["Inferno"]="imgly_lut_celsius";ut["Snappy"]="imgly_lut_cool";ut["Chestnut"]="imgly_lut_chest";ut["Softy"]="imgly_lut_winter";ut["Pebble"]="imgly_lut_kdynamic";ut["Moss"]="imgly_lut_fall";ut["Lemon"]="imgly_lut_lenin";ut["GreenGap"]="imgly_lut_pola669";ut["Colla"]="imgly_lut_elder";ut["Solanus"]="imgly_lut_orchid";ut["Kalmen"]="imgly_lut_bleached";ut["Joran"]="imgly_lut_bleachedblue";ut["Levante"]="imgly_lut_breeze";ut["Zephyr"]="imgly_lut_blueshadows";ut["Golden"]="imgly_lut_sunset";ut["LowFire"]="imgly_lut_eighties";ut["Sunrise"]="imgly_lut_evening";ut["FlatBlack"]="imgly_lut_k2";ut["Pumpkin"]="imgly_lut_nogreen";ut["Ancient"]="imgly_lut_ancient";ut["Candy"]="imgly_lut_cottoncandy";ut["Classic"]="imgly_lut_classic";ut["Colorful"]="imgly_lut_colorful";ut["Creamy"]="imgly_lut_creamy";ut["Fixie"]="imgly_lut_fixie";ut["Food"]="imgly_lut_food";ut["Fridge"]="imgly_lut_fridge";ut["Glam"]="imgly_lut_glam";ut["Gobblin"]="imgly_lut_gobblin";ut["Hicon"]="imgly_lut_highcontrast";ut["HighCarb"]="imgly_lut_highcarb";ut["K1"]="imgly_lut_k1";ut["K6"]="imgly_lut_k6";ut["Keen"]="imgly_lut_keen";ut["Lomo"]="imgly_lut_lomo";ut["Lomo100"]="imgly_lut_lomo100";ut["Lucid"]="imgly_lut_lucid";ut["Mellow"]="imgly_lut_mellow";ut["Neat"]="imgly_lut_neat";ut["Pale"]="imgly_lut_pale";ut["Pitched"]="imgly_lut_pitched";ut["PolaSX"]="imgly_lut_polasx";ut["Pro400"]="imgly_lut_pro400";ut["Quozi"]="imgly_lut_quozi";ut["Settled"]="imgly_lut_settled";ut["Seventies"]="imgly_lut_seventies";ut["Soft"]="imgly_lut_soft";ut["Steel"]="imgly_lut_steel";ut["Summer"]="imgly_lut_summer";ut["Tender"]="imgly_lut_tender";ut["Twilight"]="imgly_lut_twilight";return ut;}(lp||{});cp=function(a){a["DuoTone"]="imgly_filter_category_duotone";a["BW"]="imgly_filter_category_bw";a["Vintage"]="imgly_filter_category_vintage";a["Smooth"]="imgly_filter_category_smooth";a["Cold"]="imgly_filter_category_cold";a["Warm"]="imgly_filter_category_warm";a["Legacy"]="imgly_filter_category_legacy";return a;}(cp||{});});var eR=d(function(){ZO();QO();tR();});var TC,iR,Jg;var rR=d(function(){TC=function(n){n["RemoveFocusButton"]="removeFocusButton";n["FocusIntensitySlider"]="focusIntensitySlider";n["Expandable"]="expandable";n["Separator"]="separator";n["Items"]="items";return n;}(TC||{});iR=function(t){t["FocusIntensity"]="focusIntensity";return t;}(iR||{});Jg=function Jg(){_classCallCheck(this,Jg);this.items=[];this.advancedUIToolControlBarOrder=[{type:"expandable",children:["removeFocusButton","focusIntensitySlider","separator"]},"items"];this.basicUIToolControlBarTabsOrder=["focusIntensity"];};});var oR=d(function(){});var cs;var nR=d(function(){cs=function(o){o["RADIAL"]="radial";o["LINEAR"]="linear";o["MIRRORED"]="mirrored";o["GAUSSIAN"]="gaussian";return o;}(cs||{});});var sR=d(function(){rR();oR();nR();});var kC,IC,Zg;var aR=d(function(){kC=function(a){a["RemoveFrameButton"]="removeFrameButton";a["FrameOpacitySlider"]="frameOpacitySlider";a["FrameSizeSlider"]="frameSizeSlider";a["FrameColorList"]="frameColorList";a["Separator"]="separator";a["Items"]="items";a["Expandable"]="expandable";return a;}(kC||{});IC=function(r){r["FrameSize"]="frameSize";r["FrameOpacity"]="frameOpacity";r["FrameColor"]="frameColor";return r;}(IC||{});Zg=function Zg(){_classCallCheck(this,Zg);this.items=[];this.advancedUIToolControlBarOrder=[{type:"expandable",children:["removeFrameButton","frameOpacitySlider","frameSizeSlider","frameColorList","separator"]},"items"];this.basicUIToolControlBarTabsOrder=["frameOpacity","frameSize","frameColor"];};});var lR=d(function(){});var cR=d(function(){aR();lR();});var Qg;var DC=d(function(){Qg=/*#__PURE__*/function(){function Qg(t){_classCallCheck(this,Qg);this.name=t.name;this.coverImageUrl=t.coverImageUrl;}_createClass(Qg,[{key:"loadCoverImage",value:function loadCoverImage(){var _this=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"anonymous";return new Promise(function(e,r){var o=new Image();o.addEventListener("load",function(){e(o);});o.addEventListener("error",function(){r(new Error("Failed to load image at ".concat(_this.coverImage)));});o.crossOrigin=t;o.src=_this.coverImageUrl;_this.coverImage=o;});}}]);return Qg;}();});var tb;var EC=d(function(){tb=/*#__PURE__*/function(){function tb(t){_classCallCheck(this,tb);this.title=t.title;this.category=t.category||t.title;this.thumbUrl=t.thumbUrl;this.rawUrl=t.rawUrl;this.authorName=t.authorName;this.authorAvatar=t.authorAvatar;}_createClass(tb,[{key:"loadThumbImage",value:function loadThumbImage(){var _this2=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"anonymous";return new Promise(function(e,r){var o=new Image();o.addEventListener("load",function(){e(o);});o.addEventListener("error",function(){r(new Error("Failed to load image at ".concat(_this2.thumbUrl)));});o.crossOrigin=t;o.src=_this2.thumbUrl;_this2.thumbImage=o;});}},{key:"getThumbImage",value:function getThumbImage(){return this.thumbUrl;}}]);return tb;}();});var eb;var uR=d(function(){eb=/*#__PURE__*/function(){function eb(){_classCallCheck(this,eb);}_createClass(eb,[{key:"getData",value:function getData(t){return new Promise(function(e,r){var o=new XMLHttpRequest();o.open("GET",t,true);o.responseType="json";o.onload=function(){var n=o.status;if(n===200){e(o.response);}else{r(new Error("HTTP Status ".concat(n)));}};o.send();});}}]);return eb;}();});var ib;var FC=d(function(){uR();ib=/*#__PURE__*/function(){function ib(){_classCallCheck(this,ib);}_createClass(ib,[{key:"loadJSON",value:function loadJSON(t){var e=new eb();return e.getData(t);}},{key:"getCategories",value:function getCategories(){return Promise.resolve([]);}},{key:"searchImages",value:function searchImages(t){return Promise.resolve([]);}}]);return ib;}();});var OC;var dR=d(function(){DC();EC();FC();OC=/*#__PURE__*/function(_ib){_inherits(OC,_ib);var _super=_createSuper(OC);function OC(){_classCallCheck(this,OC);return _super.apply(this,arguments);}_createClass(OC,[{key:"loadData",value:function loadData(){var _this3=this;if(this.data){return Promise.resolve(this.data);}return this.loadJSON("https://img.ly/static/libraries/unsplash/metadata.json").then(function(t){if(typeof t==="string"){t=JSON.parse(t);}_this3.data=t;return t;});}},{key:"getCategories",value:function getCategories(){return this.loadData().then(function(t){return t.categories.map(function(e){return new Qg({name:e.name,coverImageUrl:e.coverImage});});});}},{key:"searchImages",value:function searchImages(t){return this.loadData().then(function(e){return e.images.filter(function(r){var o=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").split(/\s+/);for(var n=0;n1?_len-1:0),_key=1;_key<_len;_key++){e[_key-1]=arguments[_key];}var r=this.events[t];if(!r||!r.length){return false;}r.slice(0).forEach(function(o){return o.apply(null,e);});return true;}}]);return Tr;}();});var LR=d(function(){});var zR=d(function(){});var R=d(function(){$F();sp();_C();KF();XF();qF();YF();Xu();JF();ZF();QF();tO();eO();iO();rO();oO();nO();sO();aO();lO();cO();uO();dO();mO();pO();hO();fO();gO();bO();yO();_O();xO();vO();CO();SO();wO();TO();kO();IO();FO();RO();PO();MO();LO();zO();UO();NO();HO();WO();VO();jO();qO();JO();eR();sR();cR();pR();yR();vR();TR();IR();FR();BR();PR();MR();LR();zR();});var CQ,ub;var UR=d(function(){R();CQ=[{identifier:"basics",name:"Basics",items:[{identifier:"brightness"},{identifier:"contrast"},{identifier:"saturation"},{identifier:"gamma"}]},{identifier:"refinements",name:"Refinements",items:[{identifier:"clarity"},{identifier:"shadows"},{identifier:"highlights"},{identifier:"exposure"},{identifier:"blacks"},{identifier:"whites"},{identifier:"temperature"},{identifier:"sharpness"}]}];ub=CQ;});var SQ,db;var NR=d(function(){R();SQ=[{identifier:"imgly_filter_category_duotone",name:"DuoTone",thumbnailURI:"./categories/duotone.jpg",items:[{identifier:"imgly_duotone_desert",name:"Desert",thumbnailURI:"./items/imgly_duotone_desert.jpg",lightColor:"#e1de9a",darkColor:"#cb2129",defaultIntensity:.5},{identifier:"imgly_duotone_peach",name:"Peach",thumbnailURI:"./items/imgly_duotone_peach.jpg",lightColor:"#e9abb8",darkColor:"#0040ff",defaultIntensity:.5},{identifier:"imgly_duotone_clash",name:"Clash",thumbnailURI:"./items/imgly_duotone_clash.jpg",lightColor:"#f41a0f",darkColor:"#23007c",defaultIntensity:.5},{identifier:"imgly_duotone_plum",name:"Plum",thumbnailURI:"./items/imgly_duotone_plum.jpg",lightColor:"#74d7ff",darkColor:"#23007c",defaultIntensity:.5},{identifier:"imgly_duotone_breezy",name:"Breezy",thumbnailURI:"./items/imgly_duotone_breezy.jpg",lightColor:"#68fdff",darkColor:"#c20000",defaultIntensity:.5},{identifier:"imgly_duotone_deepblue",name:"Deep Blue",thumbnailURI:"./items/imgly_duotone_deepblue.jpg",lightColor:"#2de9eb",darkColor:"#58007c",defaultIntensity:.5},{identifier:"imgly_duotone_frog",name:"Frog",thumbnailURI:"./items/imgly_duotone_frog.jpg",lightColor:"#5bff60",darkColor:"#7f23a9",defaultIntensity:.5},{identifier:"imgly_duotone_sunset",name:"Sunset",thumbnailURI:"./items/imgly_duotone_sunset.jpg",lightColor:"#f8ea46",darkColor:"#c400be",defaultIntensity:.5}]},{identifier:"imgly_filter_category_bw",name:"B & W",thumbnailURI:"./categories/b&w.jpg",items:[{identifier:"imgly_lut_ad1920",name:"1920 A.D.",thumbnailURI:"./items/imgly_lut_ad1920.jpg",lutURI:"./items/imgly_lut_ad1920_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_bw",name:"Greyed",thumbnailURI:"./items/imgly_lut_bw.jpg",lutURI:"./items/imgly_lut_bw_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_x400",name:"Dusty",thumbnailURI:"./items/imgly_lut_x400.jpg",lutURI:"./items/imgly_lut_dusty_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_litho",name:"Litho",thumbnailURI:"./items/imgly_lut_litho.jpg",lutURI:"./items/imgly_lut_litho_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_sepiahigh",name:"Sepia",thumbnailURI:"./items/imgly_lut_sepiahigh.jpg",lutURI:"./items/imgly_lut_sepia_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_plate",name:"Weathered",thumbnailURI:"./items/imgly_lut_plate.jpg",lutURI:"./items/imgly_lut_weathered_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_sin",name:"Hard Stuff",thumbnailURI:"./items/imgly_lut_sin.jpg",lutURI:"./items/imgly_lut_hard_stuff_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8}]},{identifier:"imgly_filter_category_vintage",name:"Vintage",thumbnailURI:"./categories/vintage.jpg",items:[{identifier:"imgly_lut_blues",name:"Polaroid",thumbnailURI:"./items/imgly_lut_blues.jpg",lutURI:"./items/imgly_lut_polaroid_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_front",name:"Sunny 70s",thumbnailURI:"./items/imgly_lut_front.jpg",lutURI:"./items/imgly_lut_sunny_70s_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_texas",name:"Oldtimer",thumbnailURI:"./items/imgly_lut_texas.jpg",lutURI:"./items/imgly_lut_oldtimer_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_celsius",name:"Inferno",thumbnailURI:"./items/imgly_lut_celsius.jpg",lutURI:"./items/imgly_lut_inferno_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_cool",name:"Snappy",thumbnailURI:"./items/imgly_lut_cool.jpg",lutURI:"./items/imgly_lut_snappy_5_5_128.png",defaultIntensity:1}]},{identifier:"imgly_filter_category_smooth",name:"Smooth",thumbnailURI:"./categories/smooth.jpg",items:[{identifier:"imgly_lut_chest",name:"Chestnut",thumbnailURI:"./items/imgly_lut_chest.jpg",lutURI:"./items/imgly_lut_chestnut_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_winter",name:"Softy",thumbnailURI:"./items/imgly_lut_winter.jpg",lutURI:"./items/imgly_lut_softly_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_kdynamic",name:"Pebble",thumbnailURI:"./items/imgly_lut_kdynamic.jpg",lutURI:"./items/imgly_lut_pebble_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_fall",name:"Moss",thumbnailURI:"./items/imgly_lut_fall.jpg",lutURI:"./items/imgly_lut_moss_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_lenin",name:"Lemon",thumbnailURI:"./items/imgly_lut_lenin.jpg",lutURI:"./items/imgly_lut_lemon_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_pola669",name:"Green Gap",thumbnailURI:"./items/imgly_lut_pola669.jpg",lutURI:"./items/imgly_lut_green_gap_5_5_128.png",defaultIntensity:1}]},{identifier:"imgly_filter_category_cold",name:"Cold",thumbnailURI:"./categories/cold.jpg",items:[{identifier:"imgly_lut_elder",name:"Colla",thumbnailURI:"./items/imgly_lut_elder.jpg",lutURI:"./items/imgly_lut_colla_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_orchid",name:"Solanus",thumbnailURI:"./items/imgly_lut_orchid.jpg",lutURI:"./items/imgly_lut_solanus_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_bleached",name:"Kalmen",thumbnailURI:"./items/imgly_lut_bleached.jpg",lutURI:"./items/imgly_lut_kalmen_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_bleachedblue",name:"Joran",thumbnailURI:"./items/imgly_lut_bleachedblue.jpg",lutURI:"./items/imgly_lut_joran_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_breeze",name:"Levante",thumbnailURI:"./items/imgly_lut_breeze.jpg",lutURI:"./items/imgly_lut_levante_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_blueshadows",name:"Zephyr",thumbnailURI:"./items/imgly_lut_blueshadows.jpg",lutURI:"./items/imgly_lut_zephyr_5_5_128.png",defaultIntensity:1}]},{identifier:"imgly_filter_category_warm",name:"Warm",thumbnailURI:"./categories/warm.jpg",items:[{identifier:"imgly_lut_sunset",name:"Golden",thumbnailURI:"./items/imgly_lut_sunset.jpg",lutURI:"./items/imgly_lut_golden_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_eighties",name:"Low Fire",thumbnailURI:"./items/imgly_lut_eighties.jpg",lutURI:"./items/imgly_lut_low_fire_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_evening",name:"Sunrise",thumbnailURI:"./items/imgly_lut_evening.jpg",lutURI:"./items/imgly_lut_sunrise_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_k2",name:"Flat Black",thumbnailURI:"./items/imgly_lut_k2.jpg",lutURI:"./items/imgly_lut_flat_black_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_nogreen",name:"Pumpkin",thumbnailURI:"./items/imgly_lut_nogreen.jpg",lutURI:"./items/imgly_lut_pumpkin_5_5_128.png",defaultIntensity:1}]},{identifier:"imgly_filter_category_legacy",name:"Legacy",thumbnailURI:"./categories/legacy.jpg",items:[{identifier:"imgly_lut_ancient",name:"Ancient",thumbnailURI:"./items/imgly_lut_ancient.jpg",lutURI:"./items/imgly_lut_ancient_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_cottoncandy",name:"Candy",thumbnailURI:"./items/imgly_lut_cottoncandy.jpg",lutURI:"./items/imgly_lut_cottoncandy_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_classic",name:"Classic",thumbnailURI:"./items/imgly_lut_classic.jpg",lutURI:"./items/imgly_lut_classic_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_colorful",name:"Colorful",thumbnailURI:"./items/imgly_lut_colorful.jpg",lutURI:"./items/imgly_lut_colorful_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_creamy",name:"Creamy",thumbnailURI:"./items/imgly_lut_creamy.jpg",lutURI:"./items/imgly_lut_creamy_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_fixie",name:"Fixie",thumbnailURI:"./items/imgly_lut_fixie.jpg",lutURI:"./items/imgly_lut_fixie_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_food",name:"Food",thumbnailURI:"./items/imgly_lut_food.jpg",lutURI:"./items/imgly_lut_food_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_fridge",name:"Fridge",thumbnailURI:"./items/imgly_lut_fridge.jpg",lutURI:"./items/imgly_lut_fridge_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_glam",name:"Glam",thumbnailURI:"./items/imgly_lut_glam.jpg",lutURI:"./items/imgly_lut_glam_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_gobblin",name:"Gobblin",thumbnailURI:"./items/imgly_lut_gobblin.jpg",lutURI:"./items/imgly_lut_gobblin_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_highcontrast",name:"Hicon",thumbnailURI:"./items/imgly_lut_highcontrast.jpg",lutURI:"./items/imgly_lut_highcontrast_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_highcarb",name:"High Carb",thumbnailURI:"./items/imgly_lut_highcarb.jpg",lutURI:"./items/imgly_lut_highcarb_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_k1",name:"K1",thumbnailURI:"./items/imgly_lut_k1.jpg",lutURI:"./items/imgly_lut_k1_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_k6",name:"K6",thumbnailURI:"./items/imgly_lut_k6.jpg",lutURI:"./items/imgly_lut_k6_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_keen",name:"Keen",thumbnailURI:"./items/imgly_lut_keen.jpg",lutURI:"./items/imgly_lut_keen_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_lomo",name:"Lomo",thumbnailURI:"./items/imgly_lut_lomo.jpg",lutURI:"./items/imgly_lut_lomo_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_lomo100",name:"Lomo 100",thumbnailURI:"./items/imgly_lut_lomo100.jpg",lutURI:"./items/imgly_lut_lomo100_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_lucid",name:"Lucid",thumbnailURI:"./items/imgly_lut_lucid.jpg",lutURI:"./items/imgly_lut_lucid_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_mellow",name:"Mellow",thumbnailURI:"./items/imgly_lut_mellow.jpg",lutURI:"./items/imgly_lut_mellow_8_8_512.png",defaultIntensity:1,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_neat",name:"Neat",thumbnailURI:"./items/imgly_lut_neat.jpg",lutURI:"./items/imgly_lut_neat_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_pale",name:"Pale",thumbnailURI:"./items/imgly_lut_pale.jpg",lutURI:"./items/imgly_lut_pale_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_pitched",name:"Pitched",thumbnailURI:"./items/imgly_lut_pitched.jpg",lutURI:"./items/imgly_lut_pitched_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_polasx",name:"Pola SX",thumbnailURI:"./items/imgly_lut_polasx.jpg",lutURI:"./items/imgly_lut_polasx_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_pro400",name:"Pro 400",thumbnailURI:"./items/imgly_lut_pro400.jpg",lutURI:"./items/imgly_lut_pro400_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_quozi",name:"Quozi",thumbnailURI:"./items/imgly_lut_quozi.jpg",lutURI:"./items/imgly_lut_quozi_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_settled",name:"Settled",thumbnailURI:"./items/imgly_lut_settled.jpg",lutURI:"./items/imgly_lut_settled_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_seventies",name:"Seventies",thumbnailURI:"./items/imgly_lut_seventies.jpg",lutURI:"./items/imgly_lut_seventies_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_soft",name:"Soft",thumbnailURI:"./items/imgly_lut_soft.jpg",lutURI:"./items/imgly_lut_soft_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_steel",name:"Steel",thumbnailURI:"./items/imgly_lut_steel.jpg",lutURI:"./items/imgly_lut_steel_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_summer",name:"Summer",thumbnailURI:"./items/imgly_lut_summer.jpg",lutURI:"./items/imgly_lut_summer_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_tender",name:"Tender",thumbnailURI:"./items/imgly_lut_tender.jpg",lutURI:"./items/imgly_lut_tender_5_5_128.png",defaultIntensity:1},{identifier:"imgly_lut_twilight",name:"Twilight",thumbnailURI:"./items/imgly_lut_twilight.jpg",lutURI:"./items/imgly_lut_twilight_5_5_128.png",defaultIntensity:1}]}];db=SQ;});var wQ,KC;var HR=d(function(){R();wQ=[{identifier:"radial",thumbnailURI:"./items/radial.png"},{identifier:"mirrored",thumbnailURI:"./items/mirrored.png"},{identifier:"linear",thumbnailURI:"./items/linear.png"},{identifier:"gaussian",thumbnailURI:"./items/gaussian.png"}];KC=wQ;});var TQ,mb;var WR=d(function(){TQ=[{identifier:"imgly_font_open_sans_bold",fontFamily:"Open Sans",fontWeight:"bold",fontURI:"./fonts/imgly_font_open_sans_bold.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2189,descender:-600}},{identifier:"imgly_font_aleo_bold",fontFamily:"Aleo",fontWeight:"bold",fontURI:"./fonts/imgly_font_aleo_bold.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:805,descender:-195}},{identifier:"imgly_font_amaticsc",fontFamily:"Amatic SC",fontWeight:"normal",fontURI:"./fonts/imgly_font_amaticsc.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1016,descender:-245}},{identifier:"imgly_font_archivo_black",fontFamily:"Archivo",fontWeight:"normal",fontURI:"./fonts/imgly_font_archivo_black.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:878,descender:-210}},{identifier:"imgly_font_bungee_inline",fontFamily:"Bungee Inline",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_bungee_inline.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:860,descender:-140}},{identifier:"imgly_font_fira_sans_regular",fontFamily:"Fira Sans",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_fira_sans_regular.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:935,descender:-265}},{identifier:"imgly_font_carter_one",fontFamily:"Carter One",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_carter_one.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2264,descender:-890}},{identifier:"imgly_font_codystar",fontFamily:"Codystar",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_codystar.woff",format:"woff",textMetrics:{unitsPerEm:1024,ascender:953,descender:-255}},{identifier:"imgly_font_krona_one",fontFamily:"Krona One",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_krona_one.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2030,descender:-530}},{identifier:"imgly_font_kumar_one_outline",fontFamily:"Kumar One Outline",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_kumar_one_outline.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1137,descender:-642}},{identifier:"imgly_font_lobster",fontFamily:"Lobster",fontWeight:"normal",fontURI:"./fonts/imgly_font_lobster.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1e3,descender:-250}},{identifier:"imgly_font_molle",fontFamily:"Molle",fontWeight:"normal",fontStyle:"italic",fontURI:"./fonts/imgly_font_molle.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1852,descender:-701}},{identifier:"imgly_font_monoton",fontFamily:"Monoton",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_monoton.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2366,descender:-822}},{identifier:"imgly_font_nixie_one",fontFamily:"Nixie One",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_nixie_one.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:926,descender:-210}},{identifier:"imgly_font_notable",fontFamily:"Notable",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_notable.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1143,descender:-157}},{identifier:"imgly_font_ostrich_sans_black",fontFamily:"Ostrich",fontWeight:800,fontStyle:"normal",fontURI:"./fonts/imgly_font_ostrich_sans_black.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:950,descender:-250}},{identifier:"imgly_font_ostrich_sans_bold",fontFamily:"Ostrich",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_ostrich_sans_bold.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:950,descender:-250}},{identifier:"imgly_font_oswald_semi_bold",fontFamily:"Oswald SemiBold",googleFamily:"Oswald",fontWeight:600,fontStyle:"normal",fontURI:"./fonts/imgly_font_oswald_semi_bold.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1193,descender:-289}},{identifier:"imgly_font_palanquin_dark_semi_bold",fontFamily:"Palanquin Dark SemiBold",googleFamily:"Palanquin Dark",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_palanquin_dark_semi_bold.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1320,descender:-491}},{identifier:"imgly_font_poppins",fontFamily:"Poppins",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_poppins.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1050,descender:-350}},{identifier:"imgly_font_permanent_marker",fontFamily:"Permanent Marker",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_permanent_marker.woff",format:"woff",textMetrics:{unitsPerEm:1024,ascender:1136,descender:-325}},{identifier:"imgly_font_roboto_black_italic",fontFamily:"Roboto Black",fontWeight:"bold",fontStyle:"italic",googleFamily:"Roboto",fontURI:"./fonts/imgly_font_roboto_black_italic.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1900,descender:-500}},{identifier:"imgly_font_roboto_light_italic",fontFamily:"Roboto Light",googleFamily:"Roboto",fontWeight:300,fontStyle:"italic",fontURI:"./fonts/imgly_font_roboto_light_italic.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1900,descender:-500}},{identifier:"imgly_font_sancreek",fontFamily:"Sancreek",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_sancreek.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2104,descender:-738}},{identifier:"imgly_font_stint_ultra_expanded",fontFamily:"Stint Ultra Expanded",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_stint_ultra_expanded.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1853,descender:-483}},{identifier:"imgly_font_trash_hand",fontFamily:"Trash Hand",fontWeight:"normal",fontURI:"./fonts/imgly_font_trash_hand.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:759,descender:-304}},{identifier:"imgly_font_vt323",fontFamily:"VT323",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_vt323.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:800,descender:-200}},{identifier:"imgly_font_yeseva_one",fontFamily:"Yeseva One",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_yeseva_one.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:915,descender:-240}},{identifier:"imgly_font_abril_fatface_regular",fontFamily:"Abril Fatface",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_abril_fatface_regular.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:1058,descender:-291}},{identifier:"imgly_font_montserrat_light",fontFamily:"Montserrat Light",googleFamily:"Montserrat",fontWeight:300,fontStyle:"normal",fontURI:"./fonts/imgly_font_montserrat_light.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:968,descender:-251}},{identifier:"imgly_font_handycheera_regular",fontFamily:"Handycheera",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_handycheera_regular.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2199,descender:-808}},{identifier:"imgly_font_ostrich_sans_heavy",fontFamily:"Ostrich",fontWeight:900,fontStyle:"normal",fontURI:"./fonts/imgly_font_ostrich_sans_heavy.woff",format:"woff",textMetrics:{unitsPerEm:1e3,ascender:674,descender:0}},{identifier:"imgly_font_petit_formal_script",fontFamily:"Petit Formal Script",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_petit_formal_script.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2033,descender:-527}},{identifier:"imgly_font_rasa_500",fontFamily:"Rasa",fontWeight:500,fontStyle:"normal",fontURI:"./fonts/imgly_font_rasa_500.woff",format:"woff",textMetrics:{unitsPerEm:2750,ascender:2300,descender:-1050}},{identifier:"imgly_font_rasa_regular",fontFamily:"Rasa",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_rasa_regular.woff",format:"woff",textMetrics:{unitsPerEm:2750,ascender:2300,descender:-1050}},{identifier:"imgly_font_roboto_black",fontFamily:"Roboto Black",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_roboto_black.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1900,descender:-500}},{identifier:"imgly_font_roboto_light",fontFamily:"Roboto Light",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_roboto_light.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:1900,descender:-500}},{identifier:"imgly_font_sue_ellen_francisco",fontFamily:"Sue Ellen Francisco",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_sue_ellen_francisco.woff",format:"woff",textMetrics:{unitsPerEm:1024,ascender:1362,descender:-634}},{identifier:"imgly_font_ultra",fontFamily:"Ultra",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_ultra.woff",format:"woff",textMetrics:{unitsPerEm:2048,ascender:2066,descender:-561}},{identifier:"imgly_font_allison_regular",fontFamily:"Allison",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_allison_regular.ttf",format:"truetype",textMetrics:{unitsPerEm:1e3,ascender:890,descender:-380}},{identifier:"imgly_font_cookie_regular",fontFamily:"Cookie",fontWeight:"normal",fontStyle:"normal",fontURI:"./fonts/imgly_font_cookie_regular.ttf",format:"truetype",textMetrics:{unitsPerEm:1e3,ascender:789,descender:-320}},{identifier:"imgly_font_lexend_bold",fontFamily:"Lexend",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_lexend_bold.ttf",format:"truetype",textMetrics:{unitsPerEm:1e3,ascender:1e3,descender:-250}},{identifier:"imgly_font_outfit_bold",fontFamily:"Outfit",fontWeight:"bold",fontStyle:"normal",fontURI:"./fonts/imgly_font_outfit_bold.ttf",format:"truetype",textMetrics:{unitsPerEm:1e3,ascender:1e3,descender:-260}}];mb=TQ;});var GR,VR;var jR=d(function(){GR=["imgly_font_open_sans_bold","imgly_font_aleo_bold","imgly_font_amaticsc","imgly_font_archivo_black","imgly_font_bungee_inline","imgly_font_carter_one","imgly_font_codystar","imgly_font_fira_sans_regular","imgly_font_krona_one","imgly_font_kumar_one_outline","imgly_font_lexend_bold","imgly_font_lobster","imgly_font_molle","imgly_font_monoton","imgly_font_nixie_one","imgly_font_notable","imgly_font_ostrich_sans_black","imgly_font_ostrich_sans_bold","imgly_font_oswald_semi_bold","imgly_font_outfit_bold","imgly_font_palanquin_dark_semi_bold","imgly_font_poppins","imgly_font_permanent_marker","imgly_font_roboto_black_italic","imgly_font_roboto_light_italic","imgly_font_sancreek","imgly_font_stint_ultra_expanded","imgly_font_trash_hand","imgly_font_vt323","imgly_font_yeseva_one"];VR=["imgly_font_abril_fatface_regular","imgly_font_allison_regular","imgly_font_bungee_inline","imgly_font_cookie_regular","imgly_font_handycheera_regular","imgly_font_lexend_bold","imgly_font_montserrat_light","imgly_font_ostrich_sans_black","imgly_font_ostrich_sans_bold","imgly_font_ostrich_sans_heavy","imgly_font_outfit_bold","imgly_font_permanent_marker","imgly_font_petit_formal_script","imgly_font_rasa_500","imgly_font_rasa_regular","imgly_font_roboto_black","imgly_font_roboto_light","imgly_font_roboto_black_italic","imgly_font_roboto_light_italic","imgly_font_sue_ellen_francisco","imgly_font_ultra"];});var kQ,pb;var $R=d(function(){kQ=[{identifier:"imgly_frame_dia",name:"Dia",layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_dia/imgly_frame_dia_thumb.png",imageGroups:{top:{mid:{image:"./items/imgly_frame_dia/imgly_frame_dia_top.png",mode:"repeat"}},left:{start:"./items/imgly_frame_dia/imgly_frame_dia_top_corner_left.png",mid:"./items/imgly_frame_dia/imgly_frame_dia_left.png",end:"./items/imgly_frame_dia/imgly_frame_dia_bottom_corner_left.png"},right:{start:"./items/imgly_frame_dia/imgly_frame_dia_top_corner_right.png",mid:"./items/imgly_frame_dia/imgly_frame_dia_right.png",end:"./items/imgly_frame_dia/imgly_frame_dia_bottom_corner_right.png"},bottom:{mid:{image:"./items/imgly_frame_dia/imgly_frame_dia_bottom.png",mode:"repeat"}}}},{identifier:"imgly_frame_art_decor",name:"Art Decor",tintable:true,layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_art_decor/imgly_frame_art_decor_thumb.png",imageGroups:{top:{start:"./items/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_left.png",mid:{image:"./items/imgly_frame_art_decor/imgly_frame_art_decor_top.png",mode:"stretch"},end:"./items/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_right.png"},left:{mid:{image:"./items/imgly_frame_art_decor/imgly_frame_art_decor_left.png",mode:"stretch"}},right:{mid:{image:"./items/imgly_frame_art_decor/imgly_frame_art_decor_right.png",mode:"stretch"}},bottom:{start:"./items/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_left.png",mid:{image:"./items/imgly_frame_art_decor/imgly_frame_art_decor_bottom.png",mode:"stretch"},end:"./items/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_right.png"}}},{identifier:"imgly_frame_black_passepartout",name:"Black Passepartout",layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_thumb.png",imageGroups:{top:{start:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_left.png",mid:{image:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top.png",mode:"stretch"},end:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_right.png"},left:{mid:{image:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_right.png",mode:"stretch"}},bottom:{start:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_left.png",mid:{image:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom.png",mode:"stretch"},end:"./items/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_right.png"}}},{identifier:"imgly_frame_wood_passepartout",name:"Wood Passepartout",layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_thumb.png",imageGroups:{top:{start:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_left.png",mid:{image:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top.png",mode:"stretch"},end:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_right.png"},left:{mid:{image:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_right.png",mode:"stretch"}},bottom:{start:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_left.png",mid:{image:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom.png",mode:"stretch"},end:"./items/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_right.png"}}},{identifier:"imgly_frame_lowpoly_shadow",name:"Low Poly",layoutMode:"horizontal-inside",thumbnailURI:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_thumb.png",imageGroups:{top:{start:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_left.png",mid:{image:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top.png",mode:"stretch"},end:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_right.png"},left:{mid:{image:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_left.png",mode:"stretch"}},right:{mid:{image:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_right.png",mode:"stretch"}},bottom:{start:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_left.png",mid:{image:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom.png",mode:"stretch"},end:"./items/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_right.png"}}}];pb=kQ;});var IQ,hb;var KR=d(function(){R();IQ=[{identifier:"imgly_overlay_golden",name:"Golden",defaultBlendMode:"lighten",overlayURI:"./items/imgly_overlay_golden.jpg",thumbnailURI:"./items/imgly_overlay_golden_thumb.jpg"},{identifier:"imgly_overlay_lightleak1",name:"Lightleak",defaultBlendMode:"screen",overlayURI:"./items/imgly_overlay_lightleak1.jpg",thumbnailURI:"./items/imgly_overlay_lightleak1_thumb.jpg"},{identifier:"imgly_overlay_rain",name:"Rain",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_rain.jpg",thumbnailURI:"./items/imgly_overlay_rain_thumb.jpg"},{identifier:"imgly_overlay_mosaic",name:"Mosaic",defaultBlendMode:"multiply",overlayURI:"./items/imgly_overlay_mosaic.jpg",thumbnailURI:"./items/imgly_overlay_mosaic_thumb.jpg"},{identifier:"imgly_overlay_vintage",name:"Vintage",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_vintage.jpg",thumbnailURI:"./items/imgly_overlay_vintage_thumb.jpg"},{identifier:"imgly_overlay_paper",name:"Paper",defaultBlendMode:"multiply",overlayURI:"./items/imgly_overlay_paper.jpg",thumbnailURI:"./items/imgly_overlay_paper_thumb.jpg"},{identifier:"imgly_overlay_bokeh",name:"Bokeh",defaultBlendMode:"lighten",overlayURI:"./items/imgly_overlay_bokeh.jpg",thumbnailURI:"./items/imgly_overlay_bokeh_thumb.jpg"},{identifier:"imgly_overlay_hearts",name:"Hearts",defaultBlendMode:"screen",overlayURI:"./items/imgly_overlay_hearts.jpg",thumbnailURI:"./items/imgly_overlay_hearts_thumb.jpg"},{identifier:"imgly_overlay_lightleak2",name:"Lightleak 2",defaultBlendMode:"lighten",overlayURI:"./items/imgly_overlay_lightleak2.jpg",thumbnailURI:"./items/imgly_overlay_lightleak2_thumb.jpg"},{identifier:"imgly_overlay_wood",name:"Wood",defaultBlendMode:"multiply",overlayURI:"./items/imgly_overlay_wood.jpg",thumbnailURI:"./items/imgly_overlay_wood_thumb.jpg"},{identifier:"imgly_overlay_chop",name:"Chop",defaultBlendMode:"multiply",overlayURI:"./items/imgly_overlay_chop.jpg",thumbnailURI:"./items/imgly_overlay_chop_thumb.jpg"},{identifier:"imgly_overlay_metal",name:"Metal",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_metal.jpg",thumbnailURI:"./items/imgly_overlay_metal_thumb.jpg"},{identifier:"imgly_overlay_painting",name:"Painting",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_painting.jpg",thumbnailURI:"./items/imgly_overlay_painting_thumb.jpg"},{identifier:"imgly_overlay_grain",name:"Grain",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_grain.jpg",thumbnailURI:"./items/imgly_overlay_grain_thumb.jpg"},{identifier:"imgly_overlay_clouds",name:"Clouds",defaultBlendMode:"softLight",overlayURI:"./items/imgly_overlay_clouds.jpg",thumbnailURI:"./items/imgly_overlay_clouds_thumb.jpg"},{identifier:"imgly_overlay_wall1",name:"Wall",defaultBlendMode:"lighten",overlayURI:"./items/imgly_overlay_wall1.jpg",thumbnailURI:"./items/imgly_overlay_wall1_thumb.jpg"},{identifier:"imgly_overlay_wall2",name:"Wall 2",defaultBlendMode:"overlay",overlayURI:"./items/imgly_overlay_wall2.jpg",thumbnailURI:"./items/imgly_overlay_wall2_thumb.jpg"}];hb=IQ;});var DQ,fb;var XR=d(function(){DQ=[{identifier:"imgly_sticker_emoticons",name:"Emoticons",thumbnailURI:"./categories/emoticons.png",items:[{identifier:"imgly_sticker_emoticons_grin",stickerURI:"./emoticons/imgly_sticker_emoticons_grin.svg",tintMode:"none",name:"Grin",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_laugh",stickerURI:"./emoticons/imgly_sticker_emoticons_laugh.svg",tintMode:"none",name:"Laugh",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_smile",stickerURI:"./emoticons/imgly_sticker_emoticons_smile.svg",tintMode:"none",name:"Smile",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_wink",stickerURI:"./emoticons/imgly_sticker_emoticons_wink.svg",tintMode:"none",name:"Wink",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_tongue_out_wink",stickerURI:"./emoticons/imgly_sticker_emoticons_tongue_out_wink.svg",tintMode:"none",name:"Tongue out wink",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_angel",stickerURI:"./emoticons/imgly_sticker_emoticons_angel.svg",tintMode:"none",name:"Angel",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_kisses",stickerURI:"./emoticons/imgly_sticker_emoticons_kisses.svg",tintMode:"none",name:"Kisses",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_loving",stickerURI:"./emoticons/imgly_sticker_emoticons_loving.svg",tintMode:"none",name:"Loving",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_kiss",stickerURI:"./emoticons/imgly_sticker_emoticons_kiss.svg",tintMode:"none",name:"Kiss",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_wave",stickerURI:"./emoticons/imgly_sticker_emoticons_wave.svg",tintMode:"none",name:"Wave",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_nerd",stickerURI:"./emoticons/imgly_sticker_emoticons_nerd.svg",tintMode:"none",name:"Nerd",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_cool",stickerURI:"./emoticons/imgly_sticker_emoticons_cool.svg",tintMode:"none",name:"Cool",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_blush",stickerURI:"./emoticons/imgly_sticker_emoticons_blush.svg",tintMode:"none",name:"Blush",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_duckface",stickerURI:"./emoticons/imgly_sticker_emoticons_duckface.svg",tintMode:"none",name:"Duckface",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_furious",stickerURI:"./emoticons/imgly_sticker_emoticons_furious.svg",tintMode:"none",name:"Furious",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_angry",stickerURI:"./emoticons/imgly_sticker_emoticons_angry.svg",tintMode:"none",name:"Angry",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_steaming_furious",stickerURI:"./emoticons/imgly_sticker_emoticons_steaming_furious.svg",tintMode:"none",name:"Steaming Furious",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sad",stickerURI:"./emoticons/imgly_sticker_emoticons_sad.svg",tintMode:"none",name:"Sad",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_anxious",stickerURI:"./emoticons/imgly_sticker_emoticons_anxious.svg",tintMode:"none",name:"Anxious",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_cry",stickerURI:"./emoticons/imgly_sticker_emoticons_cry.svg",tintMode:"none",name:"Cry",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sobbing",stickerURI:"./emoticons/imgly_sticker_emoticons_sobbing.svg",tintMode:"none",name:"Sobbing",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_loud_cry",stickerURI:"./emoticons/imgly_sticker_emoticons_loud_cry.svg",tintMode:"none",name:"Loud Cry",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_wide_grin",stickerURI:"./emoticons/imgly_sticker_emoticons_wide_grin.svg",tintMode:"none",name:"Wide grin",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_impatient",stickerURI:"./emoticons/imgly_sticker_emoticons_impatient.svg",tintMode:"none",name:"Impatient",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_tired",stickerURI:"./emoticons/imgly_sticker_emoticons_tired.svg",tintMode:"none",name:"Tired",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_asleep",stickerURI:"./emoticons/imgly_sticker_emoticons_asleep.svg",tintMode:"none",name:"Asleep",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sleepy",stickerURI:"./emoticons/imgly_sticker_emoticons_sleepy.svg",tintMode:"none",name:"Sleepy",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_deceased",stickerURI:"./emoticons/imgly_sticker_emoticons_deceased.svg",tintMode:"none",name:"Deceased",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_attention",stickerURI:"./emoticons/imgly_sticker_emoticons_attention.svg",tintMode:"none",name:"Attention",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_question",stickerURI:"./emoticons/imgly_sticker_emoticons_question.svg",tintMode:"none",name:"Question",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_not_speaking_to_you",stickerURI:"./emoticons/imgly_sticker_emoticons_not_speaking_to_you.svg",tintMode:"none",name:"Not speaking to you",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sick",stickerURI:"./emoticons/imgly_sticker_emoticons_sick.svg",tintMode:"none",name:"Sick",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_pumpkin",stickerURI:"./emoticons/imgly_sticker_emoticons_pumpkin.svg",tintMode:"none",name:"Pumpkin",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_boxer",stickerURI:"./emoticons/imgly_sticker_emoticons_boxer.svg",tintMode:"none",name:"Boxer",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_idea",stickerURI:"./emoticons/imgly_sticker_emoticons_idea.svg",tintMode:"none",name:"Idea",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_smoking",stickerURI:"./emoticons/imgly_sticker_emoticons_smoking.svg",tintMode:"none",name:"Smoking",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_beer",stickerURI:"./emoticons/imgly_sticker_emoticons_beer.svg",tintMode:"none",name:"Beer",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_skateboard",stickerURI:"./emoticons/imgly_sticker_emoticons_skateboard.svg",tintMode:"none",name:"Skateboard",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_guitar",stickerURI:"./emoticons/imgly_sticker_emoticons_guitar.svg",tintMode:"none",name:"Guitar",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_music",stickerURI:"./emoticons/imgly_sticker_emoticons_music.svg",tintMode:"none",name:"Music",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_sunbathing",stickerURI:"./emoticons/imgly_sticker_emoticons_sunbathing.svg",tintMode:"none",name:"Sunbathing",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_hippie",stickerURI:"./emoticons/imgly_sticker_emoticons_hippie.svg",tintMode:"none",name:"Hippie",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_humourous",stickerURI:"./emoticons/imgly_sticker_emoticons_humourous.svg",tintMode:"none",name:"Humourous",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_hitman",stickerURI:"./emoticons/imgly_sticker_emoticons_hitman.svg",tintMode:"none",name:"Hitman",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_harry_potter",stickerURI:"./emoticons/imgly_sticker_emoticons_harry_potter.svg",tintMode:"none",name:"Harry Potter",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_business",stickerURI:"./emoticons/imgly_sticker_emoticons_business.svg",tintMode:"none",name:"Business",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_batman",stickerURI:"./emoticons/imgly_sticker_emoticons_batman.svg",tintMode:"none",name:"Batman",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_skull",stickerURI:"./emoticons/imgly_sticker_emoticons_skull.svg",tintMode:"none",name:"Skull",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_ninja",stickerURI:"./emoticons/imgly_sticker_emoticons_ninja.svg",tintMode:"none",name:"Ninja",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_masked",stickerURI:"./emoticons/imgly_sticker_emoticons_masked.svg",tintMode:"none",name:"Masked",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_alien",stickerURI:"./emoticons/imgly_sticker_emoticons_alien.svg",tintMode:"none",name:"Alien",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_wrestler",stickerURI:"./emoticons/imgly_sticker_emoticons_wrestler.svg",tintMode:"none",name:"Wrestler",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_devil",stickerURI:"./emoticons/imgly_sticker_emoticons_devil.svg",tintMode:"none",name:"Devil",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_star",stickerURI:"./emoticons/imgly_sticker_emoticons_star.svg",tintMode:"none",name:"Star",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_baby_chicken",stickerURI:"./emoticons/imgly_sticker_emoticons_baby_chicken.svg",tintMode:"none",name:"Baby Chicken",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_rabbit",stickerURI:"./emoticons/imgly_sticker_emoticons_rabbit.svg",tintMode:"none",name:"Rabbit",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_pig",stickerURI:"./emoticons/imgly_sticker_emoticons_pig.svg",tintMode:"none",name:"Pig",resizeMode:"keepAspect"},{identifier:"imgly_sticker_emoticons_chicken",stickerURI:"./emoticons/imgly_sticker_emoticons_chicken.svg",tintMode:"none",name:"Chicken",resizeMode:"keepAspect"}]},{identifier:"imgly_sticker_shapes",name:"Shapes",thumbnailURI:"./categories/shapes.png",items:[{identifier:"imgly_sticker_shapes_badge_01",stickerURI:"./shapes/imgly_sticker_shapes_badge_01.svg",tintMode:"solid",name:"Shape Badge 01",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_04",stickerURI:"./shapes/imgly_sticker_shapes_badge_04.svg",tintMode:"solid",name:"Shape Badge 04",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_12",stickerURI:"./shapes/imgly_sticker_shapes_badge_12.svg",tintMode:"solid",name:"Shape Badge 12",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_06",stickerURI:"./shapes/imgly_sticker_shapes_badge_06.svg",tintMode:"solid",name:"Shape Badge 06",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_13",stickerURI:"./shapes/imgly_sticker_shapes_badge_13.svg",tintMode:"solid",name:"Shape Badge 13",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_36",stickerURI:"./shapes/imgly_sticker_shapes_badge_36.svg",tintMode:"solid",name:"Shape Badge 36",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_08",stickerURI:"./shapes/imgly_sticker_shapes_badge_08.svg",tintMode:"solid",name:"Shape Badge 08",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_11",stickerURI:"./shapes/imgly_sticker_shapes_badge_11.svg",tintMode:"solid",name:"Shape Badge 11",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_35",stickerURI:"./shapes/imgly_sticker_shapes_badge_35.svg",tintMode:"solid",name:"Shape Badge 35",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_28",stickerURI:"./shapes/imgly_sticker_shapes_badge_28.svg",tintMode:"solid",name:"Shape Badge 28",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_32",stickerURI:"./shapes/imgly_sticker_shapes_badge_32.svg",tintMode:"solid",name:"Shape Badge 32",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_15",stickerURI:"./shapes/imgly_sticker_shapes_badge_15.svg",tintMode:"solid",name:"Shape Badge 15",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_20",stickerURI:"./shapes/imgly_sticker_shapes_badge_20.svg",tintMode:"solid",name:"Shape Badge 20",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_18",stickerURI:"./shapes/imgly_sticker_shapes_badge_18.svg",tintMode:"solid",name:"Shape Badge 18",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_badge_19",stickerURI:"./shapes/imgly_sticker_shapes_badge_19.svg",tintMode:"solid",name:"Shape Badge 19",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_arrow_02",stickerURI:"./shapes/imgly_sticker_shapes_arrow_02.svg",tintMode:"solid",name:"Shape Arrow 02",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_arrow_03",stickerURI:"./shapes/imgly_sticker_shapes_arrow_03.svg",tintMode:"solid",name:"Shape Arrow 03",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_spray_01",stickerURI:"./shapes/imgly_sticker_shapes_spray_01.svg",tintMode:"solid",name:"Shape Spray 01",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_spray_04",stickerURI:"./shapes/imgly_sticker_shapes_spray_04.svg",tintMode:"solid",name:"Shape Spray 04",resizeMode:"keepAspect"},{identifier:"imgly_sticker_shapes_spray_03",stickerURI:"./shapes/imgly_sticker_shapes_spray_03.svg",tintMode:"solid",name:"Shape Spray 03",resizeMode:"keepAspect"}]}];fb=DQ;});var EQ,qR;var YR=d(function(){EQ=[{thumbnailURI:"./items/dark/imgly_text_design_icon_thislayoutisgreat.png",identifier:"imgly_text_design_blocks",name:"Blocks"},{thumbnailURI:"./items/dark/imgly_text_design_icon_fatandfast.png",identifier:"imgly_text_design_rotated",name:"Rotated"},{thumbnailURI:"./items/dark/imgly_text_design_icon_summerfeeling.png",identifier:"imgly_text_design_blocks_light",name:"Blocks Light"},{thumbnailURI:"./items/dark/imgly_text_design_icon_typewithstyle.png",identifier:"imgly_text_design_equal_width",name:"Equal Width"},{thumbnailURI:"./items/dark/imgly_text_design_icon_inthebox.png",identifier:"imgly_text_design_masked",name:"Masked"},{thumbnailURI:"./items/dark/imgly_text_design_icon_bluefriday.png",identifier:"imgly_text_design_celebrate",name:"Celebrate"},{thumbnailURI:"./items/dark/imgly_text_design_icon_decorative.png",identifier:"imgly_text_design_sunshine",name:"Sunshine"},{thumbnailURI:"./items/dark/imgly_text_design_icon_specialdeals.png",identifier:"imgly_text_design_masked_badge",name:"Masked Badge"},{thumbnailURI:"./items/dark/imgly_text_design_icon_doublelines.png",identifier:"imgly_text_design_blocks_condensed",name:"Blocks Condensed"},{thumbnailURI:"./items/dark/imgly_text_design_icon_celebrate.png",identifier:"imgly_text_design_celebrate_simple",name:"Celebrate Simple"},{thumbnailURI:"./items/dark/imgly_text_design_icon_beerandburger.png",identifier:"imgly_text_design_equal_width_fat",name:"Equal Width Fat"},{thumbnailURI:"./items/dark/imgly_text_design_icon_watercolor.png",identifier:"imgly_text_design_watercolor",name:"Watercolor"},{thumbnailURI:"./items/dark/imgly_text_design_icon_particle.png",identifier:"imgly_text_design_particles",name:"Particles"},{thumbnailURI:"./items/dark/imgly_text_design_icon_yeah.png",identifier:"imgly_text_design_masked_speech_bubble",name:"Masked Speech Bubble"},{thumbnailURI:"./items/dark/imgly_text_design_icon_thisisadream.png",identifier:"imgly_text_design_masked_speech_bubble_comic",name:"Masked Speech Bubble Comic"},{thumbnailURI:"./items/dark/imgly_text_design_icon_fatface.png",identifier:"imgly_text_design_multiline",name:"Multiline"}];qR=EQ;});var FQ,JR;var ZR=d(function(){FQ=[{thumbnailURI:"./items/light/imgly_text_design_icon_thislayoutisgreat.png",identifier:"imgly_text_design_blocks",name:"Blocks"},{thumbnailURI:"./items/light/imgly_text_design_icon_fatandfast.png",identifier:"imgly_text_design_rotated",name:"Rotated"},{thumbnailURI:"./items/light/imgly_text_design_icon_summerfeeling.png",identifier:"imgly_text_design_blocks_light",name:"Blocks Light"},{thumbnailURI:"./items/light/imgly_text_design_icon_typewithstyle.png",identifier:"imgly_text_design_equal_width",name:"Equal Width"},{thumbnailURI:"./items/light/imgly_text_design_icon_inthebox.png",identifier:"imgly_text_design_masked",name:"Masked"},{thumbnailURI:"./items/light/imgly_text_design_icon_bluefriday.png",identifier:"imgly_text_design_celebrate",name:"Celebrate"},{thumbnailURI:"./items/light/imgly_text_design_icon_decorative.png",identifier:"imgly_text_design_sunshine",name:"Sunshine"},{thumbnailURI:"./items/light/imgly_text_design_icon_specialdeals.png",identifier:"imgly_text_design_masked_badge",name:"Masked Badge"},{thumbnailURI:"./items/light/imgly_text_design_icon_doublelines.png",identifier:"imgly_text_design_blocks_condensed",name:"Blocks Condensed"},{thumbnailURI:"./items/light/imgly_text_design_icon_celebrate.png",identifier:"imgly_text_design_celebrate_simple",name:"Celebrate Simple"},{thumbnailURI:"./items/light/imgly_text_design_icon_beerandburger.png",identifier:"imgly_text_design_equal_width_fat",name:"Equal Width Fat"},{thumbnailURI:"./items/light/imgly_text_design_icon_watercolor.png",identifier:"imgly_text_design_watercolor",name:"Watercolor"},{thumbnailURI:"./items/light/imgly_text_design_icon_particle.png",identifier:"imgly_text_design_particles",name:"Particles"},{thumbnailURI:"./items/light/imgly_text_design_icon_yeah.png",identifier:"imgly_text_design_masked_speech_bubble",name:"Masked Speech Bubble"},{thumbnailURI:"./items/light/imgly_text_design_icon_thisisadream.png",identifier:"imgly_text_design_masked_speech_bubble_comic",name:"Masked Speech Bubble Comic"},{thumbnailURI:"./items/light/imgly_text_design_icon_fatface.png",identifier:"imgly_text_design_multiline",name:"Multiline"}];JR=FQ;});var OQ,gb;var QR=d(function(){OQ=[{identifier:"imgly_transforms_common",name:"Common",items:[{identifier:"imgly_transform_common_custom",name:"Custom",thumbnailURI:"",ratio:"*"},{identifier:"imgly_transform_common_square",name:"Square",thumbnailURI:"",ratio:1},{identifier:"imgly_transform_common_4",name:"4:3",thumbnailURI:"",ratio:4/3},{identifier:"imgly_transform_common_16",name:"16:9",thumbnailURI:"",ratio:16/9},{identifier:"imgly_transform_common_3",name:"3:4",thumbnailURI:"",ratio:3/4},{identifier:"imgly_transform_common_9",name:"9:16",thumbnailURI:"",ratio:9/16}]},{identifier:"imgly_transforms_facebook",name:"Facebook",items:[{identifier:"imgly_transform_facebook_profile",name:"Profile",thumbnailURI:"",dimensions:{x:300,y:300},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_facebook_title",name:"Title",thumbnailURI:"",dimensions:{x:1200,y:627},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_facebook_post",name:"Post",thumbnailURI:"",dimensions:{x:940,y:788},forceDimensions:true,lockDimensions:true}]},{identifier:"imgly_transforms_instagram",name:"Instagram",items:[{identifier:"imgly_transform_instagram_landscape",name:"Landscape",thumbnailURI:"",dimensions:{x:1080,y:566},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_instagram_portrait",name:"Portrait",thumbnailURI:"",dimensions:{x:1080,y:1350},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_instagram_square",name:"Square",thumbnailURI:"",dimensions:{x:1080,y:1080},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_instagram_story",name:"Story",thumbnailURI:"",dimensions:{x:1080,y:1920},forceDimensions:true,lockDimensions:true}]},{identifier:"imgly_transforms_twitter",name:"Twitter",items:[{identifier:"imgly_transform_twitter_post",name:"Post",thumbnailURI:"",dimensions:{x:1024,y:512},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_twitter_profile",name:"Profile",thumbnailURI:"",dimensions:{x:400,y:400},forceDimensions:true,lockDimensions:true},{identifier:"imgly_transform_twitter_title",name:"Title",thumbnailURI:"",dimensions:{x:1500,y:500},forceDimensions:true,lockDimensions:true}]}];gb=OQ;});var us,hn;var XC=d(function(){us={imgly_font_bernier_regular:"imgly_font_sancreek",imgly_font_cheque_regular:"imgly_font_kumar_one_outline",imgly_font_gagalin_regular:"imgly_font_permanent_marker",imgly_font_hagin_caps_thin:"imgly_font_nixie_one",imgly_font_intro_inline:"imgly_font_bungee_inline",imgly_font_nexa_script:"imgly_font_molle",imgly_font_panton_blackitalic_caps:"imgly_font_roboto_black_italic",imgly_font_panton_lightitalic_caps:"imgly_font_roboto_light_italic",imgly_font_perfograma:"imgly_font_codystar",imgly_font_panton_black_caps:"imgly_font_roboto_black",imgly_font_panton_light_caps:"imgly_font_roboto_light",imgly_font_summer_font_light:"imgly_font_sue_ellen_francisco",imgly_font_wolesbro:"imgly_font_cookie_regular",imgly_font_campton_bold:"imgly_font_outfit_bold",imgly_font_galano_grotesque_bold:"imgly_font_lexend_bold",imgly_font_amberlight:"imgly_font_allison_regular)"};hn=function hn(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(us[i]){if(t){console.warn("Font ".concat(i," was deprecated. Please use ").concat(us[i]," instead."));}return us[i];}return i;};});var mp={};de(mp,{isMobile:function isMobile(){return qC;}});function qC(){if(typeof navigator==="undefined"){return false;}var i=navigator.userAgent||navigator.vendor||window.opera;return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4));}var YC=d(function(){});function At(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){var t=Math.random()*16|0;var e=i==="x"?t:t&3|8;return e.toString(16);});}var tA=d(function(){});var eA,iA;var JC=d(function(){eA=function eA(i){i.preventDefault();i.stopPropagation();};iA=function iA(){};});var ZC=d(function(){});var o_t;var rA=d(function(){JC();ZC();o_t=typeof window!=="undefined"?window.performance.now.bind(window.performance):iA();});var pp;var QC=d(function(){pp=/*#__PURE__*/function(){function pp(t){_classCallCheck(this,pp);this.text=t;this.lastOffsetWidth=-1;var e="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.element=document.createElement("div");this.element.setAttribute("aria-hidden","true");this.element.appendChild(document.createTextNode(t));this.collapsible=document.createElement("span");this.expandable=document.createElement("span");this.collapsibleInner=document.createElement("span");this.expandableInner=document.createElement("span");this.collapsible.style.cssText=e;this.expandable.style.cssText=e;this.expandableInner.style.cssText=e;this.collapsibleInner.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;";this.collapsible.appendChild(this.collapsibleInner);this.expandable.appendChild(this.expandableInner);this.element.appendChild(this.collapsible);this.element.appendChild(this.expandable);}_createClass(pp,[{key:"getElement",value:function getElement(){return this.element;}},{key:"setFont",value:function setFont(t){this.element.style.cssText="max-width:none;\n min-width:20px;\n min-height:20px;\n display:inline-block;\n overflow:hidden;\n position:absolute;\n width:auto;\n margin:0;\n padding:0;\n top:-999px;\n white-space:nowrap;\n font-synthesis:none;\n font:".concat(t,";");}},{key:"getWidth",value:function getWidth(){return this.element.offsetWidth;}},{key:"setWidth",value:function setWidth(t){this.element.style.width="".concat(t,"px");}},{key:"onResize",value:function onResize(t){var _this4=this;var e=function e(){_this4.onScroll(t);};this.collapsible.addEventListener("scroll",e);this.expandable.addEventListener("scroll",e);this.reset();}},{key:"reset",value:function reset(){var t=this.getWidth();var e=t+100;this.expandableInner.style.width="".concat(e,"px");this.expandable.scrollLeft=e;this.collapsible.scrollLeft=this.collapsible.scrollWidth+100;if(this.lastOffsetWidth!==t){this.lastOffsetWidth=t;return true;}return false;}},{key:"onScroll",value:function onScroll(t){if(this.reset()&&this.element.parentNode!==null){t(this.lastOffsetWidth);}}}]);return pp;}();});var _Ce,Ca;var oA=d(function(){QC();_Ce=/*#__PURE__*/function(){function Ce(t){_classCallCheck(this,Ce);this.font=_objectSpread({fontFamily:"normal",fontStyle:"normal",fontWeight:"normal",fontStretch:"normal"},t);}_createClass(Ce,[{key:"load",value:function load(t,e){var _this5=this;var r="BESbswy";var o=null;var n=e||_Ce.DEFAULT_TIMEOUT;var s=this.getTime();return new Promise(function(a,l){if(_Ce.supportsNativeFontLoading()&&!_Ce.hasSafari10Bug()){var c=new Promise(function(m,p){var h=function h(){var g=_this5.getTime();if(g-s>=n){p(new Error(""+n+"ms timeout exceeded"));}else{document["fonts"].load(_this5.getStyle("\"".concat(_this5.font.fontFamily,"\"")),r).then(function(x){if(x.length>=1){m();}else{setTimeout(h,25);}},l);}};h();});var u=new Promise(function(m,p){o=setTimeout(function(){p(new Error("".concat(n," ms timeout exceeded")));},n);});Promise.race([u,c]).then(function(){clearTimeout(o);a(_this5);},l);}else{var _c2=new pp(r);var _u2=new pp(r);var m=new pp(r);var p=-1;var h=-1;var g=-1;var x=-1;var v=-1;var b=-1;var T=document.createElement("div");var k=function k(){if(T.parentNode!==null){T.parentNode.removeChild(T);}};var E=function E(){if(p!==-1&&h!==-1||p!==-1&&g!==-1||h!==-1&&g!==-1){if(p===h||p===g||h===g){if(_Ce.hasWebKitFallbackBug()){if(p===x&&h===x&&g===x||p===v&&h===v&&g===v||p===b&&h===b&&g===b){return;}}k();clearTimeout(o);a(_this5);}}};T.dir="ltr";_c2.setFont(_this5.getStyle("sans-serif"));_u2.setFont(_this5.getStyle("serif"));m.setFont(_this5.getStyle("monospace"));T.appendChild(_c2.getElement());T.appendChild(_u2.getElement());T.appendChild(m.getElement());document.body.appendChild(T);x=_c2.getWidth();v=_u2.getWidth();b=m.getWidth();var A=function A(){var I=_this5.getTime();if(I-s>=n){k();l(new Error("".concat(n," ms timeout exceeded")));}else{var F=document.hidden;if(F===true||F===void 0){p=_c2.getWidth();h=_u2.getWidth();g=m.getWidth();E();}o=setTimeout(A,50);}};A();_c2.onResize(function(I){p=I;E();});_c2.setFont(_this5.getStyle("\"".concat(_this5.font.fontFamily,"\",sans-serif")));_u2.onResize(function(I){h=I;E();});_u2.setFont(_this5.getStyle("\"".concat(_this5.font.fontFamily,"\",serif")));m.onResize(function(I){g=I;E();});m.setFont(_this5.getStyle("\"".concat(_this5.font.fontFamily,"\",monospace")));}});}},{key:"getStyle",value:function getStyle(t){return[this.font.fontStyle,this.font.fontWeight,_Ce.supportsStretch()?this.font.fontStretch:"","100px",t].join(" ");}},{key:"getTime",value:function getTime(){return new Date().getTime();}}],[{key:"getUserAgent",value:function getUserAgent(){return window.navigator.userAgent;}},{key:"getNavigatorVendor",value:function getNavigatorVendor(){return window.navigator.vendor;}},{key:"hasWebKitFallbackBug",value:function hasWebKitFallbackBug(){if(_Ce.HAS_WEBKIT_FALLBACK_BUG===null){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(_Ce.getUserAgent());_Ce.HAS_WEBKIT_FALLBACK_BUG=!!t&&(parseInt(t[1],10)<536||parseInt(t[1],10)===536&&parseInt(t[2],10)<=11);}return _Ce.HAS_WEBKIT_FALLBACK_BUG;}},{key:"hasSafari10Bug",value:function hasSafari10Bug(){if(_Ce.HAS_SAFARI_10_BUG===null){if(_Ce.supportsNativeFontLoading()&&/Apple/.test(_Ce.getNavigatorVendor())){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(_Ce.getUserAgent());_Ce.HAS_SAFARI_10_BUG=!!t&&parseInt(t[1],10)<603;}else{_Ce.HAS_SAFARI_10_BUG=false;}}return _Ce.HAS_SAFARI_10_BUG;}},{key:"supportsNativeFontLoading",value:function supportsNativeFontLoading(){if(_Ce.SUPPORTS_NATIVE_FONT_LOADING===null){_Ce.SUPPORTS_NATIVE_FONT_LOADING=!!document["fonts"];}return _Ce.SUPPORTS_NATIVE_FONT_LOADING;}},{key:"supportsStretch",value:function supportsStretch(){if(_Ce.SUPPORTS_STRETCH===null){var t=document.createElement("div");try{t.style.font="condensend 100px sans-serif";}catch(e){_Ce.SUPPORTS_STRETCH=false;}_Ce.SUPPORTS_STRETCH=t.style.font!=="";}return _Ce.SUPPORTS_STRETCH;}}]);return Ce;}();Ca=_Ce;Ca.HAS_WEBKIT_FALLBACK_BUG=null;Ca.HAS_SAFARI_10_BUG=null;Ca.SUPPORTS_STRETCH=null;Ca.SUPPORTS_NATIVE_FONT_LOADING=null;Ca.DEFAULT_TIMEOUT=6e4;});var _ge,O;var tS=d(function(){_ge=/*#__PURE__*/function(){function ge(t,e){_classCallCheck(this,ge);if(typeof t==="number"){this.x=t;this.y=e;}else{this.x=t.x;this.y=t.y;}}_createClass(ge,[{key:"magnitude",get:function get(){return Math.sqrt(this.x*this.x+this.y*this.y);}},{key:"normalized",get:function get(){var t=this.magnitude;return new _ge(this.x/t,this.y/t);}},{key:"floored",get:function get(){return new _ge(Math.floor(this.x),Math.floor(this.y));}},{key:"rounded",get:function get(){return new _ge(Math.round(this.x),Math.round(this.y));}},{key:"min",get:function get(){return Math.min(this.x,this.y);}},{key:"max",get:function get(){return Math.max(this.x,this.y);}},{key:"abs",get:function get(){return new _ge(Math.abs(this.x),Math.abs(this.y));}},{key:"swapped",get:function get(){return new _ge(this.y,this.x);}},{key:"clone",value:function clone(){return new _ge(this.x,this.y);}},{key:"add",value:function add(t,e){if(typeof t==="number"){return new _ge(this.x+t,this.y+e);}else{return new _ge(this.x+t.x,this.y+t.y);}}},{key:"subtract",value:function subtract(t,e){if(typeof t==="number"){return new _ge(this.x-t,this.y-e);}else{return new _ge(this.x-t.x,this.y-t.y);}}},{key:"multiply",value:function multiply(t,e){if(typeof t==="number"){return new _ge(this.x*t,this.y*(e===void 0?t:e));}else{return new _ge(this.x*t.x,this.y*t.y);}}},{key:"divide",value:function divide(t,e){if(typeof t==="number"){return new _ge(this.x/t,this.y/(e===void 0?t:e));}else{return new _ge(this.x/t.x,this.y/t.y);}}},{key:"equals",value:function equals(t){return this.x===t.x&&this.y===t.y;}},{key:"clamp",value:function clamp(t,e){var r=Math.max(t.x,Math.min(e.x,this.x));var o=Math.max(t.y,Math.min(e.y,this.y));return new _ge(r,o);}}],[{key:"fromSize",value:function fromSize(t){return new _ge(t.width,t.height);}},{key:"distance",value:function distance(t,e){var r=e.x-t.x;var o=e.y-t.y;return Math.sqrt(r*r+o*o);}},{key:"dot",value:function dot(t,e){return t.x*e.x+t.y*e.y;}},{key:"lerp",value:function lerp(t,e,r){var o=Math.min(Math.max(r,0),1);return new _ge(t.x*o+e.x*(1-o),t.y*o+e.y*(1-o));}},{key:"lerpUnclamped",value:function lerpUnclamped(t,e,r){return new _ge(t.x*r+e.x*(1-r),t.y*r+e.y*(1-r));}},{key:"proportionalFit",value:function proportionalFit(t,e){var r=t.x/t.y;var o=e.x/e.y;if(r>o){return e.multiply(t.y/e.y);}else{return e.multiply(t.x/e.x);}}}]);return ge;}();O=_ge;O.ZERO=new _ge(0,0);O.ONE=new _ge(1,1);O.UP=new _ge(0,1);O.DOWN=new _ge(0,-1);O.RIGHT=new _ge(1,0);O.LEFT=new _ge(-1,0);});var eS=d(function(){R();});var hp;var nA=d(function(){tS();eS();YC();hp=/*#__PURE__*/function(_Tr){_inherits(hp,_Tr);var _super2=_createSuper(hp);function hp(t,e){var _this6;_classCallCheck(this,hp);_this6=_super2.call(this);_this6.image=t;_this6.options=e;return _this6;}_createClass(hp,[{key:"needsResize",value:function needsResize(){var t=this.resizedDimensions();return t.x=0;r--){var o=i[r];if(o==="."){i.splice(r,1);}else if(o===".."){i.splice(r,1);e++;}else if(e){i.splice(r,1);e--;}}if(t){for(;e--;e){i.unshift("..");}}return i;}function PQ(i){return i.charAt(0)==="/";}function MQ(i){var t=PQ(i);var e=i.substr(-1)==="/";i=BQ(i.split("/").filter(Boolean),!t).join("/");if(!i&&!t){i=".";}if(i&&e){i+="/";}return(t?"/":"")+i;}var fp;var mA=d(function(){fp=function fp(){for(var _len2=arguments.length,i=new Array(_len2),_key2=0;_key2<_len2;_key2++){i[_key2]=arguments[_key2];}return MQ(i.join("/"));};});var hA=Gt(function(__t,pA){var LQ=typeof Element!=="undefined";var zQ=typeof Map==="function";var UQ=typeof Set==="function";var NQ=typeof ArrayBuffer==="function"&&!!ArrayBuffer.isView;function bb(i,t){if(i===t)return true;if(i&&t&&_typeof(i)=="object"&&_typeof(t)=="object"){if(i.constructor!==t.constructor)return false;var e,r,o;if(Array.isArray(i)){e=i.length;if(e!=t.length)return false;for(r=e;r--!==0;){if(!bb(i[r],t[r]))return false;}return true;}var n;if(zQ&&i instanceof Map&&t instanceof Map){if(i.size!==t.size)return false;n=i.entries();while(!(r=n.next()).done){if(!t.has(r.value[0]))return false;}n=i.entries();while(!(r=n.next()).done){if(!bb(r.value[1],t.get(r.value[0])))return false;}return true;}if(UQ&&i instanceof Set&&t instanceof Set){if(i.size!==t.size)return false;n=i.entries();while(!(r=n.next()).done){if(!t.has(r.value[0]))return false;}return true;}if(NQ&&ArrayBuffer.isView(i)&&ArrayBuffer.isView(t)){e=i.length;if(e!=t.length)return false;for(r=e;r--!==0;){if(i[r]!==t[r])return false;}return true;}if(i.constructor===RegExp)return i.source===t.source&&i.flags===t.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===t.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===t.toString();o=Object.keys(i);e=o.length;if(e!==Object.keys(t).length)return false;for(r=e;r--!==0;){if(!Object.prototype.hasOwnProperty.call(t,o[r]))return false;}if(LQ&&i instanceof Element)return false;for(r=e;r--!==0;){if((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&i.$$typeof){continue;}if(!bb(i[o[r]],t[o[r]]))return false;}return true;}return i!==i&&t!==t;}pA.exports=function i(t,e){try{return bb(t,e);}catch(r){if((r.message||"").match(/stack|recursion/i)){console.warn("react-fast-compare cannot handle circular refs");return false;}throw r;}};});var Ye,rS,Io;var fA=d(function(){Ye=y(hA());rS=function rS(i,t,_ref){var _ref2=_slicedToArray(_ref,2),e=_ref2[0],r=_ref2[1];var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var n=i[t];if(n){if(nr){console.error("".concat(t," must be less than or equal to ").concat(r));return r;}}return n||o;};Io=function Io(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:[1,1,1,1];var r=i[t];var o=true;if(r){r.forEach(function(n){if(n<0){console.error("".concat(n," in ").concat(t," must be greater than or equal to 0"));o=false;}if(n>1){console.error("".concat(n," in ").concat(t," must be less than or equal to 1"));o=false;}});}if(!o)return e;return r||e;};});var kt,yb;var gA=d(function(){kt=function kt(i){return i*.08;};yb=function yb(i){return i*.03;};});var bA,yA;var _A=d(function(){bA=function bA(i,t){var e=i.indexOf(t);if(e===-1||!i.length)return void 0;if(e===i.length-1)return i[0];return i[e+1];};yA=function yA(i,t){var e=i.indexOf(t);if(e===-1||!i.length)return void 0;if(e===0)return i[i.length-1];return i[e-1];};});var gp,oS;var xA=d(function(){gp={};oS=function oS(_ref3){var i=_ref3.src,t=_ref3.crossOrigin,e=_ref3.key,r=_ref3.resolve,o=_ref3.reject;gp[e]=i;var n=new Image();n.onload=function(){if(gp[e]===i){r(n);delete gp[e];}};n.onerror=function(s){if(gp[e]===i){o(s);delete gp[e];}};n.crossOrigin=t;n.src=i;};});var Do;var vA=d(function(){Do=/*#__PURE__*/function(_Error){_inherits(Do,_Error);var _super3=_createSuper(Do);function Do(t){var _this7;_classCallCheck(this,Do);_this7=_super3.call(this,t);_this7.name="AssetNotFoundError";return _this7;}return Do;}(/*#__PURE__*/_wrapNativeSuper(Error));});var Eo;var CA=d(function(){Eo=function Eo(){return Math.max(window.devicePixelRatio||1,1);};});var bp=d(function(){XC();YC();tA();rA();ZC();oA();QC();nA();eS();lA();dA();JC();mA();fA();gA();_A();xA();vA();CA();});var wA=Gt(function(j_t,SA){"use strict";SA.exports=function(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var e=arguments.length>2?arguments[2]:undefined;e=_objectSpread({indent:" ",includeEmptyLines:false},e);if(typeof i!=="string"){throw new TypeError("Expected `input` to be a `string`, got `".concat(_typeof(i),"`"));}if(typeof t!=="number"){throw new TypeError("Expected `count` to be a `number`, got `".concat(_typeof(t),"`"));}if(typeof e.indent!=="string"){throw new TypeError("Expected `options.indent` to be a `string`, got `".concat(_typeof(e.indent),"`"));}if(t===0){return i;}var r=e.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return i.replace(r,e.indent.repeat(t));};});var TA=Gt(function(){});var EA=Gt(function(X_t,DA){"use strict";var kA=TA();var IA=/\s+at.*(?:\(|\s)(.*)\)?/;var HQ=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;var WQ=typeof kA.homedir==="undefined"?"":kA.homedir();DA.exports=function(i,t){t=Object.assign({pretty:false},t);return i.replace(/\\/g,"/").split("\n").filter(function(e){var r=e.match(IA);if(r===null||!r[1]){return true;}var o=r[1];if(o.includes(".app/Contents/Resources/electron.asar")||o.includes(".app/Contents/Resources/default_app.asar")){return false;}return!HQ.test(o);}).filter(function(e){return e.trim()!=="";}).map(function(e){if(t.pretty){return e.replace(IA,function(r,o){return r.replace(o,o.replace(WQ,"~"));});}return e;}).join("\n");};});var RA=Gt(function(q_t,OA){"use strict";var GQ=wA();var VQ=EA();var jQ=function jQ(i){return i.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");};var FA=/*#__PURE__*/function(_Error2,_Symbol$iterator){_inherits(FA,_Error2);var _super4=_createSuper(FA);function FA(t){var _this8;_classCallCheck(this,FA);if(!Array.isArray(t)){throw new TypeError("Expected input to be an Array, got ".concat(_typeof(t)));}t=_toConsumableArray(t).map(function(r){if(r instanceof Error){return r;}if(r!==null&&_typeof(r)==="object"){return Object.assign(new Error(r.message),r);}return new Error(r);});var e=t.map(function(r){return typeof r.stack==="string"?jQ(VQ(r.stack)):String(r);}).join("\n");e="\n"+GQ(e,4);_this8=_super4.call(this,e);_this8.name="AggregateError";Object.defineProperty(_assertThisInitialized(_this8),"_errors",{value:t});return _this8;}_createClass(FA,[{key:_Symbol$iterator,value:/*#__PURE__*/regeneratorRuntime.mark(function value(){var _iterator2,_step2,t;return regeneratorRuntime.wrap(function value$(_context){while(1){switch(_context.prev=_context.next){case 0:_iterator2=_createForOfIteratorHelper(this._errors);_context.prev=1;_iterator2.s();case 3:if((_step2=_iterator2.n()).done){_context.next=9;break;}t=_step2.value;_context.next=7;return t;case 7:_context.next=3;break;case 9:_context.next=14;break;case 11:_context.prev=11;_context.t0=_context["catch"](1);_iterator2.e(_context.t0);case 14:_context.prev=14;_iterator2.f();return _context.finish(14);case 17:case"end":return _context.stop();}}},value,this,[[1,11,14,17]]);})}]);return FA;}(/*#__PURE__*/_wrapNativeSuper(Error),Symbol.iterator);OA.exports=FA;});var Ju=Gt(function(Y_t,AA){"use strict";var $Q=RA();AA.exports=/*#__PURE__*/function(){var _ref4=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(i,t){var _ref5,_ref5$concurrency,e,_ref5$stopOnError,r,_args3=arguments;return regeneratorRuntime.wrap(function _callee2$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_ref5=_args3.length>2&&_args3[2]!==undefined?_args3[2]:{},_ref5$concurrency=_ref5.concurrency,e=_ref5$concurrency===void 0?Infinity:_ref5$concurrency,_ref5$stopOnError=_ref5.stopOnError,r=_ref5$stopOnError===void 0?true:_ref5$stopOnError;return _context3.abrupt("return",new Promise(function(o,n){if(typeof t!=="function"){throw new TypeError("Mapper function is required");}if(!((Number.isSafeInteger(e)||e===Infinity)&&e>=1)){throw new TypeError("Expected `concurrency` to be an integer from 1 and up or `Infinity`, got `".concat(e,"` (").concat(_typeof(e),")"));}var s=[];var a=[];var l=i[Symbol.iterator]();var c=false;var u=false;var m=0;var p=0;var h=function h(){if(c){return;}var g=l.next();var x=p;p++;if(g.done){u=true;if(m===0){if(!r&&a.length!==0){n(new $Q(a));}else{o(s);}}return;}m++;_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var v;return regeneratorRuntime.wrap(function _callee$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return g.value;case 3:v=_context2.sent;_context2.next=6;return t(v,x);case 6:s[x]=_context2.sent;m--;h();_context2.next=14;break;case 11:_context2.prev=11;_context2.t0=_context2["catch"](0);if(r){c=true;n(_context2.t0);}else{a.push(_context2.t0);m--;h();}case 14:case"end":return _context2.stop();}}},_callee,null,[[0,11]]);}))();};for(var g=0;g1&&_args7[1]!==undefined?_args7[1]:true;return _context7.abrupt("return",new Promise(function(r,o){if(_this12.isFontLoaded(t.identifier)){r();}if(e){_this12.injectFonts([t]);}var n=new Ca(t);n.load().then(function(){_this12.loadedFonts[t.identifier]=t;r();})["catch"](function(s){o(t.identifier);});}));case 2:case"end":return _context7.stop();}}},_callee6);}));function loadFont(_x6){return _loadFont.apply(this,arguments);}return loadFont;}()},{key:"loadFontWithIdentifier",value:function(){var _loadFontWithIdentifier=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee7(t){var e,r,_args8=arguments;return regeneratorRuntime.wrap(function _callee7$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:e=_args8.length>1&&_args8[1]!==undefined?_args8[1]:true;r=this.assetManager.getFontAsset(t);if(r){_context8.next=4;break;}throw new Error("The requested font asset with identifier ".concat(t," does not exist!"));case 4:return _context8.abrupt("return",this.loadFont(r,e));case 5:case"end":return _context8.stop();}}},_callee7,this);}));function loadFontWithIdentifier(_x7){return _loadFontWithIdentifier.apply(this,arguments);}return loadFontWithIdentifier;}()},{key:"injectFonts",value:function injectFonts(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.assetManager.getPathForCategory("font");var r=t.filter(NC);var o=t.filter(UC);if(r.length>0){this.addGoogleFontLinks(r);}if(o.length>0){this.addWebFontCSS(o,e);}}},{key:"addGoogleFontLinks",value:function addGoogleFontLinks(t){var _this13=this;var e=t.filter(function(s){return!_this13.injectedFonts[s.identifier];});if(e.length===0){return;}var r=this.getGoogleFamiliesString(e);var o=document.createElement("link");o.rel="stylesheet";o.href="https://fonts.googleapis.com/css?family=".concat(r);var n=document.getElementsByTagName("head")[0];n.appendChild(o);t.forEach(function(s){_this13.injectedFonts[s.identifier]=s;});}},{key:"addWebFontCSS",value:function addWebFontCSS(t,e){var _this14=this;var r=t.filter(function(a){return!_this14.injectedFonts[a.identifier];});if(r.length===0){return;}var o=_yp.createFontFacesCSS(r,e);var n="\n /* Injected by PhotoEditorSDK */\n ".concat(o.join("\n"),"\n ");var s=document.createElement("style");s.innerHTML=n;document.head.appendChild(s);t.forEach(function(a){_this14.injectedFonts[a.identifier]=a;});}}],[{key:"createFontFacesCSS",value:function createFontFacesCSS(t,e){return t.map(function(r){var o=e(r.fontURI);return"@font-face {\n font-family: \"".concat(r.fontFamily,"\";\n src: url('").concat(o,"') format('").concat(r.format||"woff","');\n font-weight: ").concat(r.fontWeight||"normal",";\n font-style: ").concat(r.fontStyle||"normal",";\n }");});}}]);return yp;}();});var _p;var PA=d(function(){R();UR();NR();HR();WR();jR();$R();KR();XR();YR();ZR();QR();gC();bC();bp();nS();_p=/*#__PURE__*/function(){function _p(t){var _this15=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,_p);this.assetResolver=r;this.basePath="assets/";this.areCustomAssetsAllowed=false;this.getAssets=function(t){switch(t){case"overlay":return _this15.overlayAssets;case"filter":return _this15.filterCategories;case"font":return _this15.fontAssets;case"focus":return _this15.focusAssets;case"adjustment":return _this15.adjustmentCategories;case"sticker":return _this15.stickerCategories;case"textdesign":return _this15.textDesignAssets;case"frame":return _this15.frameAssets;case"transform":return _this15.transformCategories;default:return[];}return[];};this.getPath=function(t,e){var _this15$assetResolver=_this15.assetResolver,r=_this15$assetResolver===void 0?{}:_this15$assetResolver;var o=e&&r.item?r.item(e,t):e;if(o==null?void 0:o.match(/data:image/g)){return o;}if((o==null?void 0:o.match(/(ftp|http|https):\/\//))&&cn(o)){return o;}if(!o&&cn(t)){return t;}var n=o?fp(t,o):fp(t);var s;if(_this15.basePath.match(/(ftp|http|https):\/\//)){var _a2=_this15.basePath.length;if(_this15.basePath[_a2-1]!=="/"){_this15.basePath="".concat(_this15.basePath,"/");}s=_this15.basePath+n;}else{s=fp(_this15.basePath,n);}return r.path?r.path(s,t,o):s;};this.getPathForCategory=function(t){return function(){for(var _len3=arguments.length,e=new Array(_len3),_key3=0;_key3<_len3;_key3++){e[_key3]=arguments[_key3];}return _this15.getPath.apply(_this15,[t].concat(e));};};this.addCustomStickerAsset=function(t,e,r){t.forEach(function(o){var n=o.thumbnailURI,s=o.name,a=o.stickerURI,l=o.identifier,c=o.tintMode,u=o.resizeMode;var m=_this15.stickerCategories.find(function(h){return h.identifier===e;});var p={identifier:l,name:s,thumbnailURI:n,stickerURI:a,tintMode:c,resizeMode:u};if(m){m.items.push(p);m.thumbnailURI=n;}else{var h={identifier:e,name:r,thumbnailURI:n,items:[p]};_this15.stickerCategories=[h].concat(_toConsumableArray(_this15.stickerCategories));}});_this15.stickerAssets=_this15.stickerCategories.reduce(_this15.allOptions,[]);};this.getItemPath=function(t,e,r){var o=t.find(function(n){return n.identifier===e;});return o?o[r]||o.path||"":"";};this.isNonExistingFont=function(t){return!mb.find(function(e){return e.identifier===t.identifier;})&&!us[t.identifier];};this.replaceDeprecatedFont=function(t){if(us[t.identifier]){return mb.find(function(e){return e.identifier===hn(t.identifier,true);});}return t;};var m,p;if(t==null?void 0:t.basePath)this.basePath=t.basePath;this.areCustomAssetsAllowed=e;var o=db.reduce(this.allOptions,[]);if(t&&t.filter){this.filterCategories=this.configuredCategory(db,t.filter,o);}else{this.filterCategories=db;}this.lutFilterAssets=this.filterCategories.reduce(this.allOptions,[]).filter(function(h){return wC(h);});this.duoToneFilterAssets=this.filterCategories.reduce(this.allOptions,[]).filter(function(h){return Yu(h);});var n=ub.reduce(this.allOptions,[]);if(t&&t.adjustment){this.adjustmentCategories=this.configuredCategory(ub,t.adjustment,n);}else{this.adjustmentCategories=ub;}this.fontAssets=mb.reduce(this.allOptions,[]);var s=GR.map(function(h){return _this15.getFontAsset(h);});if(((p=(m=t==null?void 0:t.text)==null?void 0:m.fonts)==null?void 0:p.length)>0){s=t.text.fonts.map(function(g){if(_this15.isNonExistingFont(g))return g;var x=_this15.replaceDeprecatedFont(g);return _this15.getFontAsset(x.identifier);});var h=t.text.fonts.filter(this.isNonExistingFont);this.fontAssets=t.text.fonts?[].concat(_toConsumableArray(this.fontAssets),_toConsumableArray(h)):this.fontAssets;}this.textToolFontAssets=s;var a=t&&t.focus&&t.focus.items&&t.focus.items.length?t.focus.items.map(function(h){return KC.find(function(g){return g.identifier===h.identifier;});}):KC;this.focusAssets=a;if(t&&t.overlay&&t.overlay.items){this.overlayAssets=this.configuredItem(t.overlay.items,hb,hb);}else{this.overlayAssets=hb;}if(t&&t.frame&&t.frame.items){this.frameAssets=this.configuredItem(t.frame.items,pb,pb);}else{this.frameAssets=pb;}var l=fb.reduce(this.allOptions,[]);if(t&&t.sticker){this.stickerCategories=this.configuredCategory(fb,t.sticker,l);}else{this.stickerCategories=fb;}this.stickerAssets=this.stickerCategories.reduce(this.allOptions,[]);var c=qR;if(t&&t.theme==="light"){c=JR;}this.textDesignAssets=t&&t.textdesign&&t.textdesign.items&&t.textdesign.items.length?t.textdesign.items.map(function(h){return c.find(function(g){return g.identifier===h.identifier;});}):c;this.textDesignToolFontAssets=VR.map(function(h){return _this15.getFontAsset(h);});var u=gb.reduce(this.allOptions,[]);if(t&&t.transform){this.transformCategories=this.configuredCategory(gb,t.transform,u,"transform");}else{this.transformCategories=gb;}this.transformAssets=this.transformCategories.reduce(this.allOptions,[]);this.fontManager=new _yp(this);}_createClass(_p,[{key:"getFontManager",value:function getFontManager(){return this.fontManager;}},{key:"getAssetSource",value:function getAssetSource(t,e){switch(t){case"filter":var r=this.getLUTFilterAsset(e);if(r){return this.getPath(t,this.getItemPath(this.lutFilterAssets,e,"lutURI"));}break;case"overlay":return this.getPath(t,this.getItemPath(this.overlayAssets,e,"overlayURI"));case"font":return this.getPath(t,this.getItemPath(this.fontAssets,e,"fontURI"));case"sticker":var o=this.stickerAssets.find(function(n){return n.identifier===e;});if(o){if(o.stickerURI.substr(0,10)==="data:image"){return o.stickerURI;}if(e.includes("imgly_sticker")&&o.stickerURI.includes(".svg")&&ve()){var n=this.getPath(t,this.getItemPath(this.stickerAssets,e,"stickerURI"));var s=n.split("/");s.splice(s.length-1,0,"base");s[s.length-1]=s[s.length-1].replace(".svg",".png");return s.join("/");}return this.getPath(t,this.getItemPath(this.stickerAssets,e,"stickerURI"));}throw new Error("Cannot resolve this type of sticker asset yet");case"textdesign":return this.getPath(fp(t,"engine"),e);case"frame":return this.getPath(t,e);default:break;}throw new Error("Cannot resolve this type of asset yet");}},{key:"getDuotoneFilterAsset",value:function getDuotoneFilterAsset(t){return this.duoToneFilterAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getLUTFilterAsset",value:function getLUTFilterAsset(t){return this.lutFilterAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getOverlayAsset",value:function getOverlayAsset(t){return this.overlayAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getStickerAsset",value:function getStickerAsset(t){return this.stickerAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getFontAsset",value:function getFontAsset(t){var e=this.fontAssets.filter(function(r){return r.identifier===t;})[0];if(e){return e;}console.warn("The font asset for ".concat(t," was not found."));return void 0;}},{key:"getTextDesignAssets",value:function getTextDesignAssets(t){return this.textDesignAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getFrameAsset",value:function getFrameAsset(t){return this.frameAssets.filter(function(e){return e.identifier===t;})[0];}},{key:"getFontAssets",value:function getFontAssets(){return this.fontAssets;}},{key:"getFontAssetsForText",value:function getFontAssetsForText(){return this.textToolFontAssets;}},{key:"getFontAssetsForTextDesign",value:function getFontAssetsForTextDesign(){return this.textDesignToolFontAssets;}},{key:"getFrameAssets",value:function getFrameAssets(){return this.frameAssets;}},{key:"allOptions",value:function allOptions(t,e){if(Object.prototype.hasOwnProperty.call(e,"items")){return[].concat(_toConsumableArray(t),_toConsumableArray(e.items));}return[].concat(_toConsumableArray(t),[e]);}},{key:"configuredCategory",value:function configuredCategory(t,e,r,o){var _this16=this;if(e.categories&&e.categories.length){return e.categories.reduce(function(n,s){var a=t.find(function(l){return l.identifier===s.identifier;});if(a){n.push(_objectSpread(_objectSpread(_objectSpread({},a),s),{},{items:_this16.configuredItem(s.items,r,a.items,o).filter(Boolean)}));}else if(_this16.areCustomAssetsAllowed||o==="transform"){n.push(_objectSpread(_objectSpread({},s),{},{items:_this16.configuredItem(s.items,r,s.items,o).filter(Boolean)}));}return n;},[]);}return t;}},{key:"configuredItem",value:function configuredItem(t,e,r,o){var _this17=this;if(t&&t.length){return t.reduce(function(n,s){var a=e.find(function(l){return l.identifier===s.identifier;});if(a){n.push(_objectSpread(_objectSpread({},a),s));}else if(_this17.areCustomAssetsAllowed||o==="transform"){n.push(s);}return n;},[]).filter(Boolean);}return r;}}]);return _p;}();});var sS,je;var MA=d(function(){sS=/*#__PURE__*/function(){function sS(t,e,r,o){_classCallCheck(this,sS);if(typeof t==="number"){if(typeof e==="number"&&r!==void 0&&o!==void 0){this.origin={x:t,y:e};this.size={width:r||0,height:o||0};}else{throw new Error("Invalid arguments passed to Rect. Expected (number, number, number, number)");}}else{this.origin=t;if(typeof e==="number"){throw new Error("Invalid arguments passed to Rect. Expected (Float2, Size)");}this.size=e;}}_createClass(sS,[{key:"minX",get:function get(){return this.origin.x;}},{key:"minY",get:function get(){return this.origin.y;}},{key:"midX",get:function get(){return this.origin.x+.5*this.size.width;}},{key:"midY",get:function get(){return this.origin.y+.5*this.size.height;}},{key:"maxX",get:function get(){return this.origin.x+this.size.width;}},{key:"maxY",get:function get(){return this.origin.y+this.size.height;}},{key:"width",get:function get(){return this.size.width;}},{key:"height",get:function get(){return this.size.height;}}],[{key:"contains",value:function contains(t,e){return e.x>=t.minX&&e.x<=t.maxX&&e.y>=t.minY&&e.y<=t.maxY;}}]);return sS;}();je=sS;je.ZERO=new sS({x:0,y:0},{width:0,height:0});});var _ds,wt;var LA=d(function(){_ds=/*#__PURE__*/function(){function ds(t,e,r,o,n,s){_classCallCheck(this,ds);this.a=t;this.b=e;this.c=r;this.d=o;this.tx=n;this.ty=s;}_createClass(ds,null,[{key:"fromScale",value:function fromScale(t,e){return new _ds(t,0,0,e,0,0);}},{key:"fromRotation",value:function fromRotation(t){var e=Math.cos(t);var r=Math.sin(t);return new _ds(e,-r,r,e,0,0);}},{key:"fromRotationDeg",value:function fromRotationDeg(t){var e=Math.PI*t/180;return this.fromRotation(e);}},{key:"fromTranslation",value:function fromTranslation(t,e){return new _ds(1,0,0,1,t,e);}},{key:"fromTRS",value:function fromTRS(t,e,r,o,n){var s=Math.cos(r);var a=Math.sin(r);return new _ds(o*s,-n*a,o*a,n*s,t,e);}},{key:"multiply",value:function multiply(t,e){var r=t.a*e.a+t.b*e.c;var o=t.a*e.b+t.b*e.d;var n=t.c*e.a+t.d*e.c;var s=t.c*e.b+t.d*e.d;var a=t.a*e.tx+t.b*e.ty+t.tx;var l=t.c*e.tx+t.d*e.ty+t.ty;return new _ds(r,o,n,s,a,l);}},{key:"transformPoint",value:function transformPoint(t,e){return{x:t.a*e.x+t.b*e.y+t.tx,y:t.c*e.x+t.d*e.y+t.ty};}},{key:"getInverted",value:function getInverted(t){var e=t.a*t.d-t.b*t.c;if(e===0){return t;}var r=1/e;var o=r*t.d;var n=-r*t.b;var s=-r*t.c;var a=r*t.a;var l=r*(t.b*t.ty-t.d*t.tx);var c=r*(t.c*t.tx-t.a*t.ty);return new _ds(o,n,s,a,l,c);}}]);return ds;}();wt=_ds;wt.IDENTITY=_ds.fromScale(1,1);});function Yr(i){return typeof i==="number";}var aS,lS;var cS=d(function(){aS=function aS(i){return i<0;};lS=function lS(i){return aS(i)?-i:i;};});var Gl,xb,_b,zA,xp,uS,dS,mS,UA;var NA=d(function(){var _b2;cS();bp();Gl=function Gl(i){return i*(Math.PI/180);};xb=function xb(i){return i*(180/Math.PI);};_b=(_b2={},_defineProperty(_b2,0,Gl(0)),_defineProperty(_b2,90,Gl(90)),_defineProperty(_b2,180,Gl(180)),_defineProperty(_b2,270,Gl(270)),_b2);zA=Object.values(_b);xp=function xp(i){var t=Math.round(xb(lS(i)));if(aS(i)){if(t===270){t=90;}else if(t===90){t=270;}}return _b[t%360];};uS=function uS(i){return i===0?i:360-lS(i);};dS=function dS(i){return bA(zA,xp(i));};mS=function mS(i){return yA(zA,xp(i));};UA=function UA(i){var t=xp(i);return t===_b[270]||t===_b[90];};});var HA=d(function(){tS();MA();LA();cS();NA();});var _re;var WA=d(function(){_re=/*#__PURE__*/function(){function re(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{x:1,y:1};var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,re);this.position=t;this.scale=e;this.rotation=r;}_createClass(re,null,[{key:"IDENTITY",get:function get(){return new _re({x:0,y:0});}}]);return re;}();});var U=d(function(){zF();gC();VF();bC();yC();PA();nS();HA();WA();bp();To();});var Sa,GA,VA,XQ,pS;var jA=d(function(){Sa=y(_("react"));$g();GA=y(Ku());VA=y(_("styled-components"));Sr();U();XQ=VA["default"].div(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n background: ",";\n color: ",";\n display: flex;\n flex-direction: row;\n overflow: hidden;\n -webkit-touch-callout: none;\n user-select: none;\n * {\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n font-family: '","', sans-serif;\n /* css reset for a global box-sizing: border-box */\n box-sizing: content-box;\n\n scrollbar-width: thin;\n scrollbar-color: "," transparent;\n\n &::-webkit-scrollbar-track {\n border-radius: 10px;\n background-color: transparent;\n margin: 1px;\n }\n\n &::-webkit-scrollbar {\n width: 6px;\n height: 6px;\n background-color: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n border-radius: 10px;\n box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.4);\n background-color: ",";\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background-color: ",";\n }\n }\n\n /* This will be applied first in some cases and should be treated as such */\n h1,\n h2,\n h3,\n input,\n textarea,\n label,\n span,\n div,\n p {\n line-height: normal;\n }\n"])),function(i){return i.theme.background;},function(i){return i.theme.foreground;},function(i){return i.theme.typography.fontFamily;},function(i){return i.theme.scrollbar.handleColor;},function(i){return i.theme.scrollbar.handleColor;},function(i){return i.theme.scrollbar.handleColor;});pS=/*#__PURE__*/function(_Sa$default$Component){_inherits(pS,_Sa$default$Component);var _super5=_createSuper(pS);function pS(t){var _this18;_classCallCheck(this,pS);_this18=_super5.call(this,t);_this18.node=Sa["default"].createRef();_this18.mounted=false;_this18.saveEditorDimensions=function(t){if(_this18.mounted){_this18.setState({contextValue:{element:t,rect:t.getBoundingClientRect()}});}};var e;if((e=Sa["default"])==null?void 0:e.version){var r=Number.parseInt(Sa["default"].version.split(".")[0],10);var o=Number.parseInt(Sa["default"].version.split(".")[1],10);if(r<16||r===16&&o<8)console.error("Please be aware that the PhotoEditorSDK will require React 16.8.6 or above.");}_this18.saveEditorDimensions=(0,GA["default"])(_this18.saveEditorDimensions,100);_this18.resizeObserver=new Hl(function(_ref7){var _ref8=_slicedToArray(_ref7,1),r=_ref8[0];_this18.saveEditorDimensions(r.target);});_this18.state={contextValue:{element:null,rect:null}};return _this18;}_createClass(pS,[{key:"componentDidMount",value:function componentDidMount(){var t;this.mounted=true;if((t=this.node)==null?void 0:t.current){this.resizeObserver.observe(this.node.current);}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.mounted=false;this.resizeObserver.disconnect();}},{key:"render",value:function render(){var t=this.props.children;var e=this.state.contextValue;return Sa["default"].createElement(XQ,{ref:this.node,"data-test":N.EditorContainer},Sa["default"].createElement(Oe.Provider,{value:e},t));}}]);return pS;}(Sa["default"].Component);});var vb,vp,qQ,Cb;var Cp=d(function(){vb=y(_("styled-components"));vp=vb.css(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n height: ","px;\n width: ","px;\n border-radius: ",";\n pointer-events: none;\n"])),function(i){return i.theme.measurements.colorItem.size;},function(i){return i.theme.measurements.colorItem.size;},function(i){return i.theme.colorItem.borderRadius||"".concat(i.theme.shape.radiusSmall,"px");});qQ=vb["default"].div.attrs(function(i){return{style:{background:i.color}};})(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n ","\n z-index: ",";\n"])),vp,function(i){return i.theme.measurements.zIndex.colorItem.background;});Cb=qQ;});var Vl,Sp,YQ,hS,JQ,Sb;var fS=d(function(){Vl=y(_("react"));Sp=y(_("styled-components"));Cp();YQ=Sp["default"].div(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n ","\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: ",";\n\n box-sizing: border-box;\n border: 2px solid transparent;\n border-radius: ",";\n transition: border-color 300ms ease-in-out;\n ","\n"])),vp,function(i){return i.theme.measurements.zIndex.colorItem.overlay;},function(i){return i.theme.colorItem.borderRadius||"".concat(i.theme.shape.radiusSmall,"px");},function(i){return i.isActive&&Sp.css(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n border-color: ",";\n "])),i.theme.selectColor.activeBorderColor);});hS=Sp["default"].span(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n display: inline-block;\n height: 2px;\n width: 2px;\n border-radius: 50%;\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.6);\n background: rgba(255, 255, 255, 0.87);\n margin: 1px;\n pointer-events: none;\n"])));JQ=function JQ(_ref9){var i=_ref9.isActive,t=_ref9.className,e=_ref9.style;return Vl["default"].createElement(YQ,{isActive:i,className:t,style:e},i&&Vl["default"].createElement(Vl["default"].Fragment,null,Vl["default"].createElement(hS,null),Vl["default"].createElement(hS,null),Vl["default"].createElement(hS,null)));};Sb=JQ;});var $A,di;var KA=d(function(){$A=_("styled-components");di=$A.css(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["\n &:focus {\n outline: none;\n box-shadow: 0 0 2px ",";\n }\n &:-moz-focusring {\n outline: none;\n box-shadow: 0 0 2px ",";\n }\n"])),function(i){return i.theme.focusOutlineColor;},function(i){return i.theme.focusOutlineColor;});});var XA,Zu;var qA=d(function(){XA=_("styled-components");Zu=XA.css(_templateObject11||(_templateObject11=_taggedTemplateLiteral(["\n position: absolute !important;\n height: 1px;\n width: 1px;\n overflow: hidden;\n clip: rect(1px 1px 1px 1px); /* IE6, IE7 */\n clip: rect(1px, 1px, 1px, 1px);\n"])));});var Jr=d(function(){KA();qA();});var YA,ZQ,wb;var gS=d(function(){YA=y(_("styled-components"));Jr();ZQ=YA["default"].button.attrs({type:"button"})(_templateObject12||(_templateObject12=_taggedTemplateLiteral(["\n &&& {\n box-sizing: border-box;\n }\n position: relative;\n background: transparent;\n border: none;\n height: ","px;\n width: ","px;\n margin: ",";\n padding: 0;\n cursor: pointer;\n border-radius: ",";\n\n &:hover {\n opacity: 0.7;\n }\n\n ","\n\n &:disabled {\n opacity: ",";\n cursor: default;\n }\n"])),function(i){return i.theme.measurements.colorItem.size;},function(i){return i.theme.measurements.colorItem.size;},function(i){return i.theme.colorItem.margin;},function(i){return i.theme.colorItem.borderRadius||"".concat(i.theme.shape.radiusSmall,"px");},di,function(i){return i.theme.selectColor.inactiveOpacity;});wb=ZQ;});var JA,QQ,Tb;var bS=d(function(){JA=y(_("styled-components"));Cp();QQ=JA["default"].div.attrs(function(i){var t=i.url?{backgroundImage:"url(".concat(i.url,")")}:{};return _objectSpread({style:t},i.style);})(_templateObject13||(_templateObject13=_taggedTemplateLiteral(["\n ","\n z-index: ",";\n"])),vp,function(i){return i.theme.measurements.zIndex.colorItem.tiledBackground;});Tb=QQ;});var wp,ttt,ZA;var QA=d(function(){wp=y(_("react"));B();fS();Cp();gS();bS();ttt=function ttt(_ref10){var i=_ref10.isActive,t=_ref10.onClick,e=_ref10.color,r=_ref10.label,o=_ref10.isDisabled,n=_ref10.tiledBackgroundUrl,s=_ref10.className,a=_ref10.style,l=_ref10.children;return wp["default"].createElement(wb,{disabled:o,onClick:t,"aria-label":r,className:s,style:a},wp["default"].createElement(Tb,{url:n}),wp["default"].createElement(Cb,{color:e}),wp["default"].createElement(Sb,{isActive:i}),l);};ZA=rt("config")(w(ttt));});var tB,ett,kb;var yS=d(function(){tB=y(_("styled-components"));ett=tB["default"].div(_templateObject14||(_templateObject14=_taggedTemplateLiteral(["\n display: block;\n opacity: 1;\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: ",";\n text-align: left;\n background: ",";\n height: 100%;\n width: 100%;\n"])),function(i){return i.theme.measurements.zIndex.dialog.backdrop;},function(i){return i.theme.modal.backdrop;});kb=ett;});var eB,Ib,itt,Db;var _S=d(function(){eB=y(_("react"));Ib=y(_("styled-components"));itt=Ib["default"].div(_templateObject15||(_templateObject15=_taggedTemplateLiteral(["\n display: none;\n visibility: hidden;\n opacity: 0;\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: ",";\n transition: opacity 100s ease-in-out;\n\n ",";\n"])),function(i){return i.theme.measurements.zIndex.dialog.base;},function(i){return i.isVisible&&Ib.css(_templateObject16||(_templateObject16=_taggedTemplateLiteral(["\n opacity: 1;\n display: block;\n visibility: visible;\n "])));});Db=function Db(_ref11){var i=_ref11.isVisible,t=_ref11.className,e=_ref11.children;return eB["default"].createElement(itt,{isVisible:i,className:t},e);};});var iB,rtt,Eb;var xS=d(function(){iB=y(_("styled-components"));rtt=iB["default"].div.attrs(function(_ref12){var i=_ref12.style;return{role:"dialog","aria-hidden":false,style:i};})(_templateObject17||(_templateObject17=_taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n flex-direction: column;\n transition: top 0.25s ease;\n position: absolute;\n top: calc(50% + ","px);\n left: calc(50% + ","px);\n width: ",";\n height: ",";\n transform: translate(-50%, -50%);\n border-radius: ","px;\n background: ",";\n color: ",";\n z-index: ",";\n\n @media all and (min-width: 0) and (max-width: 640px) {\n text-align: center;\n width: auto;\n min-width: 200px;\n height: auto;\n top: 50%;\n left: 50%;\n }\n"])),function(i){return i.top;},function(i){return i.left;},function(i){return i.width;},function(i){return i.height;},function(i){return i.theme.shape.radiusLarge;},function(i){return i.theme.modal.background;},function(i){return i.theme.modal.bodyForeground;},function(i){return i.theme.measurements.zIndex.dialog.container;});Eb=rtt;});var Fb,ott,rB;var oB=d(function(){Fb=y(_("react"));U();yS();_S();xS();ott=function ott(_ref13){var _ref13$isVisible=_ref13.isVisible,i=_ref13$isVisible===void 0?false:_ref13$isVisible,_ref13$width=_ref13.width,t=_ref13$width===void 0?"350px":_ref13$width,_ref13$height=_ref13.height,e=_ref13$height===void 0?"fit-content":_ref13$height,r=_ref13.position,o=_ref13.header,n=_ref13.body,s=_ref13.footer,a=_ref13.className,l=_ref13.style,c=_ref13.children;return Fb["default"].createElement(Db,{isVisible:i},Fb["default"].createElement(kb,null),Fb["default"].createElement(Eb,{height:e,width:t,left:r.x,top:r.y,className:a,style:l,"data-test":N.Dialog},o,n,c,s));};rB=ott;});var nB,ntt,ms;var Tp=d(function(){nB=y(_("styled-components"));ntt=nB["default"].div(_templateObject18||(_templateObject18=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n overflow: hidden;\n box-sizing: border-box;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n\n padding: 0px 20px 11px;\n &:first-child {\n padding-top: 11px;\n }\n\n @media all and (min-width: 0) and (max-width: 640px) {\n align-items: center;\n }\n"])),function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.modal.bodyForeground;});ms=ntt;});var sB,stt,Qu;var Ob=d(function(){sB=y(_("styled-components"));stt=sB["default"].div(_templateObject19||(_templateObject19=_taggedTemplateLiteral(["\n display: flex;\n border-top: 2px solid\n ",";\n\n min-height: 40px;\n justify-content: flex-end;\n @media all and (min-width: 0) and (max-width: 640px) {\n height: auto;\n flex-direction: column;\n justify-content: space-around;\n }\n"])),function(i){return i.type==="error"?i.theme.error:i.theme.warning;});Qu=stt;});var aB,att,td;var Rb=d(function(){aB=y(_("styled-components"));att=aB["default"].h3(_templateObject20||(_templateObject20=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n\n padding: 11px 20px 0px;\n"])),function(i){return i.theme.measurements.fontSystem.headline2.size;},function(i){return i.theme.measurements.fontSystem.headline2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.headline2["case"];},function(i){return i.theme.modal.headerForeground;});td=att;});var ed,kp,ltt,ctt,Ab,utt,Bb;var vS=d(function(){ed=y(_("react"));kp=y(_("styled-components"));ltt=kp.keyframes(_templateObject21||(_templateObject21=_taggedTemplateLiteral(["\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n"])));ctt=kp["default"].div(_templateObject22||(_templateObject22=_taggedTemplateLiteral(["\n display: inline-block;\n position: relative;\n width: 45px;\n height: 45px;\n"])));Ab=kp["default"].div(_templateObject23||(_templateObject23=_taggedTemplateLiteral(["\n box-sizing: border-box;\n display: block;\n position: absolute;\n width: 40px;\n height: 40px;\n margin: 2.5px;\n border: 2.5px solid ",";\n border-radius: 50%;\n animation: "," 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;\n border-color: "," transparent transparent\n transparent;\n\n :nth-child(1) {\n animation-delay: -0.45s;\n }\n :nth-child(2) {\n animation-delay: -0.3s;\n }\n :nth-child(3) {\n animation-delay: -0.15s;\n }\n"])),function(i){return i.theme.primary;},ltt,function(i){return i.theme.primary;});utt=function utt(_ref14){var i=_ref14.className,t=_ref14.style;return ed["default"].createElement(ctt,{className:i,style:t},ed["default"].createElement(Ab,null),ed["default"].createElement(Ab,null),ed["default"].createElement(Ab,null),ed["default"].createElement(Ab,null));};Bb=utt;});function dtt(i){var t="";var e=true;var r;for(r=0;r0&&arguments[0]!==undefined?arguments[0]:"transform";if(typeof window==="undefined"||typeof window.document==="undefined"){return"";}var t=window.document.documentElement.style;if(i in t){return"";}var e;for(e=0;e not mounted on DragStart!");}var r=e.ownerDocument;if(_this19.props.disabled||!(t.target instanceof Node)||_this19.props.handle&&!kS(t.target,_this19.props.handle,e)||_this19.props.cancel&&kS(t.target,_this19.props.cancel,e)){return false;}var o=Hb(t,_assertThisInitialized(_this19));if(o==null){return false;}var n=o.x,s=o.y;var a=Ub(_assertThisInitialized(_this19),n,s);var l=_this19.props.onStart(t,a);if(l===false){return false;}_this19.setState({dragging:true,lastX:n,lastY:s});if(kr.move==="touchmove"){Lb(r,kr.move,_this19.onTouchDrag);}else{Lb(r,kr.move,_this19.onMouseDrag);}Lb(r,kr.stop,_this19.handleDragStop);};_this19.handleDrag=function(t){var e=Hb(t,_assertThisInitialized(_this19));if(e==null){return;}var r=e.x,o=e.y;var n=Ub(_assertThisInitialized(_this19),r,o);var s=_this19.props.onDrag(t,n);if(s===false){try{_this19.handleDragStop(new MouseEvent("mouseup"));}catch(a){var l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",true,true,window,0,0,0,0,0,false,false,false,false,0,null);_this19.handleDragStop(l);}return;}_this19.setState({lastX:r,lastY:o});};_this19.handleDragStop=function(t){if(!_this19.state.dragging){return;}var e=Hb(t,_assertThisInitialized(_this19));if(e==null){return;}var r=e.x,o=e.y;var n=Ub(_assertThisInitialized(_this19),r,o);var s=_this19.findDOMNode();_this19.setState({dragging:false,lastX:NaN,lastY:NaN});_this19.props.onStop(t,n);if(s){if(kr.move==="touchmove"){wa(s.ownerDocument,kr.move,_this19.onTouchDrag);}else{wa(s.ownerDocument,kr.move,_this19.onMouseDrag);}wa(s.ownerDocument,kr.stop,_this19.handleDragStop);}};_this19.onMouseDown=function(t){_this19.preventDefault(t);kr=fn.mouse;_this19.props.onMouseDown(t);if(t.button&&typeof t.button==="number"&&t.button!==0){return false;}return _this19.handleDragStart(t);};_this19.onMouseDrag=function(t){_this19.preventDefault(t);return _this19.handleDrag(t);};_this19.onMouseUp=function(t){_this19.preventDefault(t);kr=fn.mouse;return _this19.handleDragStop(t);};_this19.onTouchStart=function(t){_this19.preventDefault(t);kr=fn.touch;var e=_this19.getTouchFromEvent(t);return _this19.handleDragStart(e);};_this19.onTouchDrag=function(t){_this19.preventDefault(t);kr=fn.touch;var e=_this19.getTouchFromEvent(t);return _this19.handleDrag(e);};_this19.onTouchEnd=function(t){_this19.preventDefault(t);kr=fn.touch;var e=_this19.getTouchFromEvent(t);return _this19.handleDragStop(e);};return _this19;}_createClass(jl,[{key:"componentWillUnmount",value:function componentWillUnmount(){var t=this.findDOMNode();if(t){var e=t.ownerDocument;wa(e,fn.mouse.move,this.onMouseDrag);wa(e,fn.touch.move,this.onTouchDrag);wa(e,fn.mouse.stop,this.handleDragStop);wa(e,fn.touch.stop,this.handleDragStop);}}},{key:"render",value:function render(){return Wb["default"].cloneElement(Wb["default"].Children.only(this.props.children),{style:_objectSpread({touchAction:"none"},this.props.children.props.style),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd});}}]);return jl;}(Wb["default"].Component);jl.defaultProps=ES;jl.displayName="DraggableCore";});var Ip,ftt,Gb,vB;var CB=d(function(){Ip=y(_("react"));FS();zb();DS();ftt=_objectSpread(_objectSpread({},ES),{},{axis:"both",bounds:false,defaultClassName:"draggable",defaultClassNameDragging:"draggable-dragging",defaultClassNameDragged:"draggable-dragged",defaultPosition:{x:0,y:0},position:null,rotation:0,updateOnPosition:false});Gb=/*#__PURE__*/function(_Ip$default$Component){_inherits(Gb,_Ip$default$Component);var _super7=_createSuper(Gb);function Gb(t){var _this20;_classCallCheck(this,Gb);_this20=_super7.call(this,t);_this20.onDragStart=function(t,e){var r=_this20.props.onStart(t,Nb(_assertThisInitialized(_this20),e));if(r===false){return false;}_this20.setState({dragging:true,dragged:true});};_this20.onDrag=function(t,e){var _this20$props=_this20.props,r=_this20$props.position,o=_this20$props.defaultPosition,n=_this20$props.onDrag,s=_this20$props.bounds;if(!_this20.state.dragging){return false;}var a=Nb(_assertThisInitialized(_this20),e);var l=Boolean(r);var c={x:l?a.x:o.x,y:l?a.y:o.y,slackX:0,slackY:0};if(s){var m=c.x,p=c.y;c.x+=_this20.state.slackX;c.y+=_this20.state.slackY;var _yB=yB(_assertThisInitialized(_this20),c.x,c.y),_yB2=_slicedToArray(_yB,2),h=_yB2[0],g=_yB2[1];c.x=h;c.y=g;c.slackX=_this20.state.slackX+(m-c.x);c.slackY=_this20.state.slackY+(p-c.y);a.x=c.x;a.y=c.y;a.deltaX=c.x-_this20.state.x;a.deltaY=c.y-_this20.state.y;}var u=n(t,a);if(u===false){return false;}_this20.setState(c);};_this20.onDragStop=function(t,e){if(!_this20.state.dragging){return false;}var r=_this20.props.onStop(t,Nb(_assertThisInitialized(_this20),e));if(r===false){return false;}var o={dragging:false,slackX:0,slackY:0,x:0,y:0};var n=Boolean(_this20.props.position);if(n){var _this20$props$positio=_this20.props.position,s=_this20$props$positio.x,a=_this20$props$positio.y;o.x=s;o.y=a;}_this20.setState(o);};_this20.findDOMNode=function(){var t=_this20.props.nodeRef;return(t==null?void 0:t.current)||null;};_this20.state={dragging:false,dragged:false,x:t.position?t.position.x:t.defaultPosition.x,y:t.position?t.position.y:t.defaultPosition.y,slackX:0,slackY:0};return _this20;}_createClass(Gb,[{key:"componentDidUpdate",value:function componentDidUpdate(t){var e=Boolean(this.props.position);if(e){if(this.props.updateOnPosition){if(t.position&&t.position.x!==this.props.position.x||t.position.y!==this.props.position.y){this.setState({x:this.props.position.x,y:this.props.position.y});}}else{if(t.position&&this.props.position.x!==this.state.x||this.props.position.y!==this.state.y){this.setState({x:this.props.position.x,y:this.props.position.y});}}}}},{key:"componentWillUnmount",value:function componentWillUnmount(){this.setState({dragging:false});}},{key:"render",value:function render(){var _this$props=this.props,t=_this$props.position,e=_this$props.defaultPosition,r=_this$props.rotation,o=_this$props.defaultClassName,n=_this$props.defaultClassNameDragging,s=_this$props.defaultClassNameDragged,a=_objectWithoutProperties(_this$props,_excluded);var _this$state=this.state,l=_this$state.x,c=_this$state.y,u=_this$state.dragging,m=_this$state.dragged;var p={};var h=Boolean(t);var g=!h||u;var x=t||e;var v={x:_B(this)&&g?l:x.x,y:xB(this)&&g?c:x.y,rotation:r};p=fB(v);var b=Ip["default"].Children.only(this.props.children);var T=[b.props.className||"",o,u?n:"",m?s:""].join(" ").trim();var k=Ip["default"].cloneElement(b,{className:T,style:_objectSpread(_objectSpread({},b.props.style),p)});return Ip["default"].createElement(jl,_objectSpread(_objectSpread({},a),{},{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),k);}}]);return Gb;}(Ip["default"].Component);Gb.defaultProps=ftt;Gb.displayName="Draggable";vB=Gb;});var rd=Gt(function(Lvt,kB){var TB="Expected a function";var SB=0/0;var gtt="[object Symbol]";var btt=/^\s+|\s+$/g;var ytt=/^[-+]0x[0-9a-f]+$/i;var _tt=/^0b[01]+$/i;var xtt=/^0o[0-7]+$/i;var vtt=parseInt;var Ctt=(typeof global==="undefined"?"undefined":_typeof(global))=="object"&&global&&global.Object===Object&&global;var Stt=(typeof self==="undefined"?"undefined":_typeof(self))=="object"&&self&&self.Object===Object&&self;var wtt=Ctt||Stt||Function("return this")();var Ttt=Object.prototype;var ktt=Ttt.toString;var Itt=Math.max;var Dtt=Math.min;var OS=function OS(){return wtt.Date.now();};function Ett(i,t,e){var r,o,n,s,a,l,c=0,u=false,m=false,p=true;if(typeof i!="function"){throw new TypeError(TB);}t=wB(t)||0;if(Vb(e)){u=!!e.leading;m="maxWait"in e;n=m?Itt(wB(e.maxWait)||0,t):n;p="trailing"in e?!!e.trailing:p;}function h(I){var F=r,Z=o;r=o=void 0;c=I;s=i.apply(Z,F);return s;}function g(I){c=I;a=setTimeout(b,t);return u?h(I):s;}function x(I){var F=I-l,Z=I-c,et=t-F;return m?Dtt(et,n-Z):et;}function v(I){var F=I-l,Z=I-c;return l===void 0||F>=t||F<0||m&&Z>=n;}function b(){var I=OS();if(v(I)){return T(I);}a=setTimeout(b,x(I));}function T(I){a=void 0;if(p&&r){return h(I);}r=o=void 0;return s;}function k(){if(a!==void 0){clearTimeout(a);}c=0;r=l=o=a=void 0;}function E(){return a===void 0?s:T(OS());}function A(){var I=OS(),F=v(I);r=arguments;o=this;l=I;if(F){if(a===void 0){return g(l);}if(m){a=setTimeout(b,t);return h(l);}}if(a===void 0){a=setTimeout(b,t);}return s;}A.cancel=k;A.flush=E;return A;}function Ftt(i,t,e){var r=true,o=true;if(typeof i!="function"){throw new TypeError(TB);}if(Vb(e)){r="leading"in e?!!e.leading:r;o="trailing"in e?!!e.trailing:o;}return Ett(i,t,{"leading":r,"maxWait":t,"trailing":o});}function Vb(i){var t=_typeof(i);return!!i&&(t=="object"||t=="function");}function Ott(i){return!!i&&_typeof(i)=="object";}function Rtt(i){return _typeof(i)=="symbol"||Ott(i)&&ktt.call(i)==gtt;}function wB(i){if(typeof i=="number"){return i;}if(Rtt(i)){return SB;}if(Vb(i)){var t=typeof i.valueOf=="function"?i.valueOf():i;i=Vb(t)?t+"":t;}if(typeof i!="string"){return i===0?i:+i;}i=i.replace(btt,"");var e=_tt.test(i);return e||xtt.test(i)?vtt(i.slice(2),e?2:8):ytt.test(i)?SB:+i;}kB.exports=Ftt;});var od,jb,RS,zi,nd,$b,Kb;var $l=d(function(){od=y(_("styled-components"));tC();jb=od["default"].span(_templateObject24||(_templateObject24=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));RS=(0,od["default"])(jb)(_templateObject25||(_templateObject25=_taggedTemplateLiteral([""])));zi=(0,od["default"])(jb)(_templateObject26||(_templateObject26=_taggedTemplateLiteral([""])));nd=(0,od["default"])(jb)(_templateObject27||(_templateObject27=_taggedTemplateLiteral([""])));$b={display:"none",left:0,top:0};Kb=(0,od["default"])(jb)(_templateObject28||(_templateObject28=_taggedTemplateLiteral(["\n display: ",";\n left: ","px;\n top: ","px;\n pointer-events: none;\n border-radius: 50%;\n background-color: rgba(255, 255, 255, 0.12);\n animation: "," 1.2s;\n width: 100px;\n height: 100px;\n margin-top: -50px;\n margin-left: -50px;\n opacity: 0;\n"])),function(_ref17){var i=_ref17.display;return i;},function(_ref18){var i=_ref18.left;return i;},function(_ref19){var i=_ref19.top;return i;},Mg);});var sd,Xb,Fo,Att,yi;var Ta=d(function(){sd=y(_("react"));Xb=y(_("styled-components"));Jr();$l();Fo=Xb.css(_templateObject29||(_templateObject29=_taggedTemplateLiteral(["\n color: ",";\n border-color: ",";\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.button.activeForeground;},function(i){return i.theme.button.activeForeground;},function(i){return i.theme.button.activeForeground;});Att=Xb["default"].button(_templateObject30||(_templateObject30=_taggedTemplateLiteral(["\n &&& {\n box-sizing: border-box;\n }\n text-align: center;\n position: relative;\n padding: 4px 8px;\n min-height: 32px;\n border-radius: ","px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n font-family: ",", sans-serif;\n cursor: pointer;\n border: none;\n background-color: transparent;\n overflow: hidden;\n ","\n\n /* Active */\n\n &:active {\n ","\n }\n\n ","\n\n /* Disabled */\n\n &:disabled {\n cursor: default;\n pointer-events: none;\n\n "," {\n background-color: ",";\n }\n }\n\n /* Hover */\n\n &:hover {\n "," {\n background-color: ",";\n }\n }\n\n div {\n font-size: ","px;\n letter-spacing: ","px;\n }\n"])),function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.fontSystem.button1.size;},function(i){return i.theme.measurements.fontSystem.button1.letterSpacing;},function(i){return i.theme.measurements.fontSystem.button1["case"];},function(i){return i.theme.typography.fontFamily;},di,Fo,function(_ref20){var i=_ref20.isActive;return i&&Fo;},zi,function(i){return i.theme.button.outlinedInactiveOverlayColor;},nd,function(i){return i.theme.button.hoverOverlayColor;},function(i){return i.theme.measurements.fontSystem.button1.size;},function(i){return i.theme.measurements.fontSystem.button1.letterSpacing;});yi=/*#__PURE__*/function(_sd$default$Component){_inherits(yi,_sd$default$Component);var _super8=_createSuper(yi);function yi(){var _this21;_classCallCheck(this,yi);_this21=_super8.apply(this,arguments);_this21.state=$b;_this21.timeout=null;_this21.onClick=function(t){var e=t.currentTarget.getBoundingClientRect();var r=t.pageX-e.left;var o=t.pageY-e.top;if(_this21.state.display==="block"){_this21.setState({display:"none"},function(){_this21.setRippleState(r,o);});}else{_this21.setRippleState(r,o);}_this21.props.onClick(t);};_this21.setRippleState=function(t,e){_this21.setState({left:t,top:e,display:"block"});_this21.timeout=setTimeout(function(){_this21.setState({display:"none"});},1200);};return _this21;}_createClass(yi,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout);}},{key:"render",value:function render(){var _this$props2=this.props,t=_this$props2.isActive,e=_this$props2.isDisabled,r=_this$props2.label,o=_this$props2.ariaLabel,n=_this$props2.children,s=_this$props2.className,a=_objectWithoutProperties(_this$props2,_excluded2);var _this$state2=this.state,l=_this$state2.left,c=_this$state2.top,u=_this$state2.display;return sd["default"].createElement(Att,_objectSpread(_objectSpread({"data-test":o,className:s,isActive:t,disabled:e,"aria-label":o},a),{},{onClick:this.onClick}),r,n,sd["default"].createElement(Kb,{display:u,left:l,top:c}),sd["default"].createElement(zi,null),sd["default"].createElement(nd,null));}}]);return yi;}(sd["default"].Component);yi.defaultProps={type:"button",isDisabled:false,isActive:false};});var IB,Dp,Btt,Ptt,Ui;var ka=d(function(){IB=y(_("react"));Dp=y(_("styled-components"));Jr();Btt=Dp["default"].label(_templateObject31||(_templateObject31=_taggedTemplateLiteral(["\n ","\n"])),Zu);Ptt=Dp["default"].label(_templateObject32||(_templateObject32=_taggedTemplateLiteral(["\n display: block;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n margin: 0;\n padding-bottom: 8px;\n\n ","\n"])),function(i){return i.theme.measurements.fontSystem.label.size;},function(i){return i.theme.measurements.fontSystem.label.letterSpacing;},function(i){return i.theme.measurements.fontSystem.label["case"];},function(i){return i.theme.toolControlBar.inputLabelForeground;},function(_ref21){var i=_ref21.isDisabled;return i&&Dp.css(_templateObject33||(_templateObject33=_taggedTemplateLiteral(["\n opacity: ",";\n cursor: default;\n pointer-events: none;\n "])),function(t){return t.theme.toolControlBar.inputLabelInactiveOpacity;});});Ui=function Ui(_ref22){var i=_ref22.id,t=_ref22["data-test"],e=_ref22.label,r=_ref22.htmlFor,o=_ref22.show,n=_ref22.style,s=_ref22.isDisabled,a=_ref22.className;var l=o?Ptt:Btt;var c=r||(e?e.replace(" ","-"):void 0);return IB["default"].createElement(l,{id:i,"data-test":t,style:n,isDisabled:s,htmlFor:c,className:a},e);};Ui.defaultProps={show:true};});var Zr,FB,Qr,Mtt,Ltt,DB,ztt,Utt,Ntt,Htt,EB,AS,OB;var RB=d(function(){Zr=y(_("react"));FB=y(rd());Qr=y(_("styled-components"));U();Ta();ka();Mtt=Qr["default"].div(_templateObject34||(_templateObject34=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n"])));Ltt=(0,Qr["default"])(Ui)(_templateObject35||(_templateObject35=_taggedTemplateLiteral(["\n align-self: flex-start;\n"])));DB=(0,Qr["default"])(yi)(_templateObject36||(_templateObject36=_taggedTemplateLiteral(["\n color: ",";\n padding: 1px 7px 2px;\n"])),function(i){return i.theme.button.textSecondaryForeground;});ztt=Qr["default"].div(_templateObject37||(_templateObject37=_taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n width: ","px;\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.width-48;});Utt=Qr["default"].article(_templateObject38||(_templateObject38=_taggedTemplateLiteral(["\n /* 0.6 of width here refers to the width of the container without padding */\n width: ","px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n text-align: center;\n margin-top: 7px;\n display: inline-block;\n color: ",";\n"])),function(i){return .6*i.theme.measurements.advancedUIToolControlBar.width;},function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.toolControlBar.inputLabelForeground;});Ntt=Qr["default"].div(_templateObject39||(_templateObject39=_taggedTemplateLiteral(["\n width: ","px;\n transform: translateZ(0);\n overflow: hidden;\n transition: all 500ms ease-out;\n"])),function(i){return .6*i.theme.measurements.advancedUIToolControlBar.width;});Htt=Qr["default"].span(_templateObject40||(_templateObject40=_taggedTemplateLiteral(["\n width: ","px;\n margin-left: -","px;\n position: relative;\n display: inline-block;\n transform: translateZ(0);\n transition: all 600ms cubic-bezier(0.77, 0, 0.175, 1);\n font-family: '","', sans-serif;\n"])),function(i){return Math.round(i.length*.6*i.theme.measurements.advancedUIToolControlBar.width);},function(i){return i.activeIndex*.6*i.theme.measurements.advancedUIToolControlBar.width;},function(i){return i.theme.typography.fontFamily;});EB=Qr["default"].div(_templateObject41||(_templateObject41=_taggedTemplateLiteral(["\n border: solid ",";\n border-width: 0 2px 2px 0;\n padding: 3px;\n height: 0;\n width: 0;\n\n ","\n"])),function(i){return i.theme.card.foreground;},function(_ref23){var i=_ref23.direction;return i==="left"?Qr.css(_templateObject42||(_templateObject42=_taggedTemplateLiteral(["\n margin-left: 2px;\n transform: rotate(135deg);\n "]))):Qr.css(_templateObject43||(_templateObject43=_taggedTemplateLiteral(["\n margin-right: 2px;\n transform: rotate(-45deg);\n "])));});AS=/*#__PURE__*/function(_Zr$default$PureCompo){_inherits(AS,_Zr$default$PureCompo);var _super9=_createSuper(AS);function AS(t){var _this22;_classCallCheck(this,AS);_this22=_super9.call(this,t);_this22.updateIndex=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=t+(e?-1:1);var o=_this22.props.list.length-1;if(r>o){r=0;}if(r<0){r=o;}_this22.props.onSelect(_this22.props.list[r].identifier);};_this22.getActiveIndex=function(t){var e=_this22.props.list;var r=e.findIndex(function(o){return o.identifier===t;});return r!==-1?r:0;};_this22.throttledUpdateIndex=(0,FB["default"])(_this22.updateIndex,600);return _this22;}_createClass(AS,[{key:"render",value:function render(){var _this23=this;var _this$props3=this.props,t=_this$props3.list,e=_this$props3.label,_this$props3$showLabe=_this$props3.showLabel,r=_this$props3$showLabe===void 0?true:_this$props3$showLabe;var o=this.getActiveIndex(this.props.defaultIdentifier);var n=t.length<=1;return Zr["default"].createElement(Mtt,{"data-test":N.CarouselSlider},Zr["default"].createElement(Ltt,{show:r,label:e}),Zr["default"].createElement(ztt,{id:"photoeditorsdk-".concat(e.replace(" ","-"))},Zr["default"].createElement(DB,{ariaLabel:"Select Previous",isDisabled:n,onClick:function onClick(){return _this23.throttledUpdateIndex(o,true);}},Zr["default"].createElement(EB,{direction:"left"})),Zr["default"].createElement(Ntt,null,Zr["default"].createElement(Htt,{activeIndex:o,length:t.length},t.map(function(s){return Zr["default"].createElement(Utt,{key:s.identifier},s.value);}))),Zr["default"].createElement(DB,{ariaLabel:"Select Next",isDisabled:n,onClick:function onClick(){return _this23.throttledUpdateIndex(o);}},Zr["default"].createElement(EB,{direction:"right"}))));}}]);return AS;}(Zr["default"].PureComponent);AS.defaultProps={showLabel:true};OB=AS;});var AB,Wtt,qb;var BS=d(function(){AB=y(_("styled-components"));Wtt=AB["default"].div(_templateObject44||(_templateObject44=_taggedTemplateLiteral(["\n display: flex;\n position: relative;\n margin-bottom: 12px;\n max-width: ","px;\n"])),function(i){return i.theme.measurements.inputs.checkbox.maxWidth;});qb=Wtt;});var Ep,Gtt,Fp;var PS=d(function(){Ep=y(_("styled-components"));Jr();Gtt=Ep["default"].div(_templateObject45||(_templateObject45=_taggedTemplateLiteral(["\n position: relative;\n height: 16px;\n width: 16px;\n cursor: pointer;\n background-color: ",";\n border-radius: ","px;\n transition-timing-function: ease-in;\n transition-duration: 0.3s;\n &::after {\n content: '';\n position: absolute;\n display: inline-block;\n left: 5px;\n width: 5px;\n height: 10px;\n border-style: solid;\n border-width: 0 2px 2px 0;\n border-color: transparent;\n transform: rotate(45deg) scale(0.8);\n }\n\n &:first-child {\n margin-right: 8px;\n }\n\n &:last-child {\n margin-left: 8px;\n }\n\n ","\n\n &:hover {\n opacity: ",";\n }\n ","\n ","\n"])),function(i){return i.theme.checkbox.background;},function(i){return i.theme.shape.radiusSmall;},di,function(i){return i.theme.checkbox.hoverOpacity;},function(i){return i.isChecked&&Ep.css(_templateObject46||(_templateObject46=_taggedTemplateLiteral(["\n background-color: ",";\n &::after {\n color: ",";\n border-color: ",";\n }\n &:hover {\n background-color: ",";\n opacity: 0.8;\n }\n "])),i.theme.checkbox.activeBackground,i.theme.checkbox.activeForeground,i.theme.checkbox.foreground,i.theme.checkbox.activeBackground);},function(i){return i.isDisabled&&Ep.css(_templateObject47||(_templateObject47=_taggedTemplateLiteral(["\n opacity: 0.5;\n cursor: default;\n pointer-events: none;\n "])));});Fp=Gtt;});var BB,Vtt,Yb;var MS=d(function(){BB=y(_("styled-components"));Jr();Vtt=BB["default"].input.attrs({type:"checkbox",tabIndex:0})(_templateObject48||(_templateObject48=_taggedTemplateLiteral(["\n position: absolute;\n opacity: 0;\n cursor: pointer;\n height: 0;\n width: 0;\n margin: 0;\n padding: 0;\n ","\n"])),di);Yb=Vtt;});var ad,PB,MB;var LB=d(function(){ad=y(_("react"));U();ka();BS();PS();MS();PB=function PB(_ref24){var i=_ref24.label,t=_ref24.value,e=_ref24.checkMarkPosition,r=_ref24.onClick,o=_ref24.isDisabled,n=_ref24.className,s=_ref24.style;var a="photoeditorsdk-".concat(i.replace(" ","-"));return ad["default"].createElement(qb,{"data-test":N.Checkbox,className:n,style:s},e==="left"&&ad["default"].createElement(Fp,{onClick:r,isDisabled:o,isChecked:t}),ad["default"].createElement(Ui,{isDisabled:o,label:i,htmlFor:a}),ad["default"].createElement(Yb,{id:a,disabled:o,checked:t,"aria-checked":t,onChange:r}),e==="right"&&ad["default"].createElement(Fp,{onClick:r,isDisabled:o,isChecked:t}));};MB=PB;PB.defaultProps={value:false,checkMarkPosition:"left"};});var zB,Jb;var LS=d(function(){zB=y(_("styled-components"));Jb=zB["default"].div(_templateObject49||(_templateObject49=_taggedTemplateLiteral(["\n position: absolute;\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid ",";\n transform: rotate(","deg);\n display: inline-block;\n transition-duration: 0.3s;\n transition-timing-function: ease-in;\n right: 0;\n top: 13px;\n"])),function(i){return i.theme.dropdown.caretColor;},function(i){return i.rotation||0;});});var Zb,UB,NB;var HB=d(function(){Zb=y(_("styled-components"));UB=Zb.css(_templateObject50||(_templateObject50=_taggedTemplateLiteral(["\n opacity: ",";\n pointer-events: none;\n"])),function(i){return i.theme.dropdown.inactiveOpacity;});NB=Zb["default"].div(_templateObject51||(_templateObject51=_taggedTemplateLiteral(["\n display: block;\n position: relative;\n width: 100%;\n white-space: nowrap;\n transition-duration: 0.5s;\n\n &:disabled {\n ","\n }\n\n ","\n"])),UB,function(_ref25){var i=_ref25.isDisabled;return i&&UB;});});var Qb,WB;var GB=d(function(){Qb=y(_("styled-components"));Jr();WB=Qb["default"].li(_templateObject52||(_templateObject52=_taggedTemplateLiteral(["\n padding: 10px 16px;\n text-overflow: ellipsis;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n white-space: nowrap;\n color: ",";\n\n &:hover {\n cursor: pointer;\n background: ",";\n }\n\n ","\n\n ","\n"])),function(i){return i.theme.measurements.fontSystem.button2.size;},function(i){return i.theme.measurements.fontSystem.button2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.button2["case"];},function(i){return i.theme.dropdown.foreground;},function(i){return i.theme.dropdown.listItemHoverBackground;},function(_ref26){var i=_ref26.isActive;return i&&Qb.css(_templateObject53||(_templateObject53=_taggedTemplateLiteral(["\n border-left: 2px solid ",";\n "])),function(t){return t.theme.primary;});},di);});var zS,gn,jtt,$tt,Oo;var VB=d(function(){zS=y(_("react"));gn=y(_("styled-components"));U();jtt=gn["default"].div(_templateObject54||(_templateObject54=_taggedTemplateLiteral(["\n display: flex;\n ",";\n"])),function(i){if(ve()||wr()){return gn.css(_templateObject55||(_templateObject55=_taggedTemplateLiteral(["\n overflow: hidden;\n "])));}if(i.direction==="vertical"){return gn.css(_templateObject56||(_templateObject56=_taggedTemplateLiteral(["\n flex-direction: column;\n flex: 1 1 auto;\n overflow-y: auto;\n overflow-x: hidden;\n "])));}return gn.css(_templateObject57||(_templateObject57=_taggedTemplateLiteral(["\n overflow-y: hidden;\n overflow-x: auto;\n "])));});$tt=gn["default"].ul.attrs(function(){return{role:"menubar","aria-label":"Tool Navigation"};})(_templateObject58||(_templateObject58=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: ",";\n\n list-style: none;\n padding: 0;\n margin: 0;\n\n ","\n"])),function(i){return i.direction==="vertical"?"column":"row";},function(i){if(ve()||wr()){return gn.css(_templateObject59||(_templateObject59=_taggedTemplateLiteral(["\n ","\n\n scrollbar-face-color: ",";\n scrollbar-track-color: ",";\n scrollbar-base-color: ",";\n scrollbar-3dlight-color: ",";\n scrollbar-highlight-color: ",";\n scrollbar-arrow-color: ",";\n scrollbar-shadow-color: ",";\n scrollbar-dark-shadow-color: ",";\n "])),function(){if(i.direction==="vertical"){return gn.css(_templateObject60||(_templateObject60=_taggedTemplateLiteral(["\n width: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n\n /* hidde the arrows */\n margin-top: -10px;\n margin-bottom: -10px;\n padding-top: 10px;\n padding-bottom: 10px;\n\n /* hide the scrollbar */\n padding-right: 10px;\n margin-right: -10px;\n "])));}return gn.css(_templateObject61||(_templateObject61=_taggedTemplateLiteral(["\n height: 100%;\n overflow-y: hidden;\n overflow-x: auto;\n\n margin-right: -10px;\n margin-left: -10px;\n padding-right: 10px;\n padding-left: 10px;\n\n padding-bottom: 10px;\n margin-bottom: -10px;\n "])));},i.theme.scrollbar.handleColor,i.theme.toolbar.background,i.theme.toolbar.background,i.theme.scrollbar.handleColor,i.theme.scrollbar.handleColor,i.theme.toolbar.background,i.theme.scrollbar.handleColor,i.theme.scrollbar.handleColor);}return"";});Oo=function Oo(_ref27){var _ref27$direction=_ref27.direction,i=_ref27$direction===void 0?"horizontal":_ref27$direction,t=_ref27["data-test"],e=_ref27.className,r=_ref27.children,o=_objectWithoutProperties(_ref27,_excluded3);return zS["default"].createElement(jtt,_objectSpread(_objectSpread({},o),{},{direction:i,className:e}),zS["default"].createElement($tt,{direction:i,"data-test":t},r));};});var US=d(function(){VB();});var Op,NS;var jB=d(function(){Op=y(_("styled-components"));U();US();NS=(0,Op["default"])(Oo)(_templateObject62||(_templateObject62=_taggedTemplateLiteral(["\n position: absolute;\n\n background: ",";\n color: ",";\n border: 1px solid ",";\n box-shadow: ",";\n\n visibility: hidden;\n opacity: 0;\n ","\n\n transition: all 0.5s ease;\n\n width: 100%;\n max-height: 160px;\n margin: 5px 0;\n\n /* had to add these changes to get the dropdown working in IE11 */\n ","\n\n border-radius: 0 0 ","px\n ","px;\n z-index: ",";\n"])),function(i){return i.theme.dropdown.listBackground;},function(i){return i.theme.dropdown.listForeground;},function(i){return i.theme.dropdown.listBorderColor;},function(i){return i.theme.dropdown.listShadow;},function(i){if(i.isOpen){return Op.css(_templateObject63||(_templateObject63=_taggedTemplateLiteral(["\n visibility: visible;\n opacity: 1;\n display: flex;\n "])));}return"";},function(){if(ve()){return Op.css(_templateObject64||(_templateObject64=_taggedTemplateLiteral(["\n > ul {\n height: 160px;\n margin-bottom: 0px;\n margin-top: 0px;\n padding-bottom: 0px;\n padding-top: 0px;\n }\n "])));}return"";},function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.zIndex.input.list;});NS.defaultProps={direction:"vertical"};});var $B,KB;var XB=d(function(){$B=y(_("styled-components"));Jr();KB=$B["default"].div(_templateObject65||(_templateObject65=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n background-color: ",";\n border: none;\n border-bottom: 1px solid ",";\n padding: 5px 0;\n cursor: ",";\n transition: border-color 0.4s ease-in-out;\n\n &:hover {\n border-color: ",";\n }\n\n ","\n"])),function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.dropdown.foreground;},function(i){return i.theme.dropdown.background;},function(i){return i.theme.dropdown.borderColor;},function(i){return i.showList?"pointer":"default";},function(i){return i.theme.dropdown.hoverBorderColor;},di);});var bn,qB,Ktt,HS;var YB=d(function(){bn=y(_("react"));qB=y(_("styled-components"));U();LS();HB();GB();jB();XB();ka();Ktt=qB["default"].div(_templateObject66||(_templateObject66=_taggedTemplateLiteral([""])));HS=/*#__PURE__*/function(_bn$default$PureCompo){_inherits(HS,_bn$default$PureCompo);var _super10=_createSuper(HS);function HS(t){var _this24;_classCallCheck(this,HS);_this24=_super10.call(this,t);_this24.state={isOpen:false};_this24.dropdownId="";_this24.dropdownLabelId="";_this24.handleOutsideClick=function(t){if(_this24.node&&_this24.node.contains(t.target)){return;}_this24.setState({isOpen:false});};_this24.onSelect=function(t){var e=_this24.props.onSelect;e(t);_this24.setState({isOpen:false});};_this24.handleKeyDownItem=function(t){return function(e){if(e.nativeEvent.code==="Space"||e.nativeEvent.code==="Enter"){_this24.onSelect(t);}};};_this24.onClick=function(){_this24.setState(function(t){return{isOpen:!t.isOpen};});};_this24.listItem=function(t){var _this24$props=_this24.props,e=_this24$props.itemStyle,r=_this24$props.selectedItem;var o=_this24.state.isOpen;var n=t.value,s=t.label;var a={};if(typeof e==="function"){a=e(t);}else if(e!==null&&_typeof(e)==="object"){a=e;}return bn["default"].createElement(WB,{role:"option","aria-hidden":!o,tabIndex:0,style:a,onClick:function onClick(){return _this24.onSelect(n);},key:n,isActive:r===n,onKeyDown:_this24.handleKeyDownItem(n)},s);};_this24.onKeyDown=function(t){if(t.nativeEvent.code==="Space"||t.nativeEvent.code==="Enter"){_this24.onClick();}};_this24.nodeRef=function(e){_this24.node=e;};_this24.dropdownId=At().slice(0,8);_this24.dropdownLabelId="".concat(_this24.dropdownId,"-label");return _this24;}_createClass(HS,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener("mousedown",this.handleOutsideClick,false);}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener("mousedown",this.handleOutsideClick,false);}},{key:"render",value:function render(){var _this$props4=this.props,t=_this$props4.selectedItem,e=_this$props4.list,r=_this$props4.label,o=_this$props4.style,n=_this$props4.isDisabled;var s=this.state.isOpen;var a=e.length>1;return bn["default"].createElement(Ktt,null,bn["default"].createElement(Ui,{id:this.dropdownLabelId,isDisabled:n,style:{paddingLeft:"0px"},label:r}),bn["default"].createElement("div",{ref:this.nodeRef},bn["default"].createElement(NB,{isOpen:s,isDisabled:n},bn["default"].createElement(KB,{role:"combobox","aria-controls":this.dropdownId,"aria-expanded":s,"aria-labelledby":this.dropdownLabelId,"data-test":N.Dropdown,"aria-hidden":n,showList:a,style:o,onClick:a?this.onClick:void 0,onKeyDown:this.onKeyDown,tabIndex:n?-1:0},t,a&&bn["default"].createElement(Jb,{rotation:s?180:0})),bn["default"].createElement(NS,{id:this.dropdownId,role:"listbox",tabIndex:-1,"aria-labelledby":this.dropdownLabelId,"data-test":N.DropdownList,isOpen:s},a&&e.map(this.listItem)))));}}]);return HS;}(bn["default"].PureComponent);});var JB,ZB;var QB=d(function(){JB=y(_("styled-components"));ZB=JB["default"].input.attrs({type:"file",id:"fileUpload",accept:"image/*"})(_templateObject67||(_templateObject67=_taggedTemplateLiteral(["\n display: none;\n"])));});var t5,Xtt,e5;var i5=d(function(){t5=y(_("react"));Xtt=function Xtt(_ref28){var i=_ref28.children;var t=function t(e){e.preventDefault();};return t5["default"].createElement("form",{onSubmit:t},i);};e5=Xtt;});var r5,Kl;var ty=d(function(){r5=_("styled-components");Kl=r5.css(_templateObject68||(_templateObject68=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n height: 100%;\n width: 100%;\n min-height: 26px;\n color: ",";\n padding: 0;\n border: none;\n appearance: none;\n border-bottom: 1px solid ",";\n background: ",";\n font-family: '","', sans-serif;\n transition: border-color 0.4s ease-in-out;\n\n &::-webkit-inner-spin-button,\n &::-webkit-outer-spin-button {\n margin: 0;\n }\n\n &:-moz-focusring {\n outline: none;\n border-color: ",";\n }\n\n &::-ms-clear,\n &::-ms-reveal {\n display: none;\n }\n\n &:focus {\n outline: none;\n border-color: ",";\n }\n\n &:disabled {\n opacity: ",";\n pointer-events: none;\n }\n\n &:hover {\n border-color: ",";\n }\n"])),function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.textInput.foreground;},function(i){return i.theme.textInput.borderColor;},function(i){return i.theme.textInput.background;},function(i){return i.theme.typography.fontFamily;},function(i){return i.theme.textInput.hoverBorderColor;},function(i){return i.theme.textInput.hoverBorderColor;},function(i){return i.theme.textInput.inactiveOpacity;},function(i){return i.theme.textInput.hoverBorderColor;});});var ey,GS,qtt,Ytt,WS,iy;var VS=d(function(){ey=y(_("react"));GS=y(_("styled-components"));ty();qtt=GS["default"].div(_templateObject69||(_templateObject69=_taggedTemplateLiteral(["\n ","\n position: relative;\n display: flex;\n align-items: center;\n height: unset;\n\n &:focus-within {\n border-color: ",";\n }\n"])),Kl,function(i){return i.theme.textInput.hoverBorderColor;});Ytt=GS["default"].input(_templateObject70||(_templateObject70=_taggedTemplateLiteral(["\n ","\n border-bottom: none;\n &:disabled {\n opacity: ",";\n cursor: default;\n pointer-events: none;\n }\n"])),Kl,function(i){return i.theme.textInput.inactiveOpacity;});WS=/*#__PURE__*/function(_ey$default$Component){_inherits(WS,_ey$default$Component);var _super11=_createSuper(WS);function WS(){var _this25;_classCallCheck(this,WS);_this25=_super11.apply(this,arguments);_this25.onChange=function(t){var e=_this25.props.onChange;if(e){e(t.target.value);}};return _this25;}_createClass(WS,[{key:"render",value:function render(){var _this$props5=this.props,t=_this$props5["aria-label"],e=_this$props5["aria-labeledby"],r=_this$props5.id,o=_this$props5.testId,n=_this$props5.value,s=_this$props5.type,a=_this$props5.min,l=_this$props5.max,c=_this$props5.onBlur,u=_this$props5.onFocus,m=_this$props5.onKeyUp,p=_this$props5.onKeyDown,h=_this$props5.onMouseUp,g=_this$props5.onTouchEnd,x=_this$props5.isDisabled,v=_this$props5.className,b=_this$props5.children;return ey["default"].createElement(qtt,{className:v},ey["default"].createElement(Ytt,{"aria-label":t,"aria-labelledby":e,id:r,"data-test":o,"aria-hidden":x,disabled:x,value:n,type:s,min:a,max:l,onChange:this.onChange,onBlur:c,onFocus:u,onKeyUp:m,onKeyDown:p,onMouseUp:h,onTouchEnd:g}),b);}}]);return WS;}(ey["default"].Component);WS.defaultProps={type:"text"};iy=WS;});var ld,Ap,Jtt,_Rp,jS,ry;var $S=d(function(){ld=y(_("react"));Ap=y(_("styled-components"));U();ka();VS();Jtt=Ap["default"].div(_templateObject71||(_templateObject71=_taggedTemplateLiteral(["\n ","\n"])),ve()?Ap.css(_templateObject72||(_templateObject72=_taggedTemplateLiteral([""]))):Ap.css(_templateObject73||(_templateObject73=_taggedTemplateLiteral(["\n display: flex;\n flex: 0 1 auto;\n flex-direction: column;\n "]))));_Rp=/*#__PURE__*/function(_ld$default$Component){_inherits(Rp,_ld$default$Component);var _super12=_createSuper(Rp);function Rp(t){var _this26;_classCallCheck(this,Rp);_this26=_super12.call(this,t);_this26.node=null;_this26.handleOutsideClick=function(t){if(_this26.node&&_this26.node.current&&_this26.node.current.contains(t.target)){return;}_this26.onSubmit();};_this26.onSubmit=function(){var t=_this26.props.onSubmit;var _this26$state=_this26.state,e=_this26$state.value,r=_this26$state.isActive;if(t){var o=parseFloat(_Rp.cleanValue(e));if(!Number.isNaN(o)&&r){t("".concat(o));}}_this26.setState({isActive:false});};_this26.onBlur=function(){_this26.onSubmit();};_this26.onFocus=function(){_this26.setState({isActive:true});};_this26.onKeyDown=function(t){var e=_this26.state.value;if(t.key==="Enter"){_this26.onSubmit();}else if(t.key==="ArrowUp"){var r=parseFloat(_Rp.cleanValue(e));if(typeof r==="number"){_this26.setState({value:(r+1).toString(),isActive:true});}}else if(t.key==="ArrowDown"){var _r2=parseFloat(_Rp.cleanValue(e));if(typeof _r2==="number"){_this26.setState({value:(_r2-1).toString(),isActive:true});}}};_this26.onChange=function(t){_this26.setState({value:t.replace(/[^\d.,-]/g,""),isActive:true});};_this26.state={value:_this26.props.value||"",isActive:false};_this26.node=ld["default"].createRef();return _this26;}_createClass(Rp,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener("mousedown",this.handleOutsideClick,false);document.addEventListener("touchstart",this.handleOutsideClick,false);}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener("mousedown",this.handleOutsideClick,false);document.removeEventListener("touchstart",this.handleOutsideClick,false);}},{key:"render",value:function render(){var _this$props6=this.props,t=_this$props6.id,e=_this$props6.label,r=_this$props6["aria-label"],o=_this$props6.isDisabled,n=_this$props6.showLabel,s=_this$props6.ariaHidden,a=_this$props6.onMouseUp,l=_this$props6.onTouchEnd,c=_this$props6.className,u=_this$props6.style;var m=this.state.value;return ld["default"].createElement(Jtt,{ref:this.node,"data-test":N.NummericInput,className:c,style:u},e&&n&&ld["default"].createElement(Ui,{htmlFor:t,label:e,show:!!e,isDisabled:o}),ld["default"].createElement(iy,{id:t,value:m,isDisabled:o,"aria-hidden":s,"aria-label":!e?r:void 0,"aria-labelledby":e?t:void 0,onChange:this.onChange,onKeyDown:this.onKeyDown,onBlur:this.onBlur,onFocus:this.onFocus,onMouseUp:a,onTouchEnd:l}));}}],[{key:"getDerivedStateFromProps",value:function getDerivedStateFromProps(_ref29,_ref30){var t=_ref29.value;var e=_ref30.value,r=_ref30.isActive;if(t!==e&&!r){return{value:t};}return null;}},{key:"cleanValue",value:function cleanValue(t){return t?t.replace(",",".").replace(/[a-zA-Z]/g,"").trim():"";}}]);return Rp;}(ld["default"].Component);jS=_Rp;jS.defaultProps={showLabel:true};ry=jS;});var Bp,o5,Ztt,n5;var s5=d(function(){Bp=y(_("react"));o5=y(_("styled-components"));ty();Ztt=o5["default"].input.attrs({type:"search"})(_templateObject74||(_templateObject74=_taggedTemplateLiteral(["\n ","\n"])),Kl);n5=(0,Bp.forwardRef)(function(_ref31,s){var i=_ref31.value,t=_ref31.onChange,e=_ref31.onKeyDown,r=_ref31.placeholder,o=_ref31.className,n=_ref31.style;var a=function a(l){if(t)t(l.target.value);};return Bp["default"].createElement("div",{className:o,style:n},Bp["default"].createElement(Ztt,{ref:s,value:i,onChange:a,onKeyDown:e,placeholder:r,autoComplete:"off"}));});});var oy,Pp,Qtt,a5,tet,l5;var c5=d(function(){oy=y(_("react"));Pp=y(_("styled-components"));ka();Qtt=Pp["default"].div(_templateObject75||(_templateObject75=_taggedTemplateLiteral([""])));a5=function a5(_ref32){var i=_ref32.label,t=_ref32.children,e=_ref32.inline,r=_ref32.showLabel,o=_ref32.isDisabled,n=_ref32["data-test"];var s="photoeditorsdk-".concat(i.replace(" ","-"),"-label");return oy["default"].createElement(Qtt,{"data-test":n},oy["default"].createElement(Ui,{id:s,isDisabled:o,label:i,show:r}),oy["default"].createElement(tet,{"aria-labelledby":s,inline:!!e},t));};tet=Pp["default"].div(_templateObject76||(_templateObject76=_taggedTemplateLiteral(["\n display: inline-flex;\n ","\n"])),function(i){return!i.inline&&Pp.css(_templateObject77||(_templateObject77=_taggedTemplateLiteral(["\n flex-wrap: wrap;\n "])))||"";});a5.defaultProps={showLabel:true};l5=a5;});var u5,ny;var d5=d(function(){u5=y(_("styled-components"));ny=u5["default"].div(_templateObject78||(_templateObject78=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n /* needed for IE11 to properly calculate the width */\n min-width: 1px;\n"])));});var KS=d(function(){d5();});var m5,sy;var p5=d(function(){m5=y(_("styled-components"));sy=m5["default"].div(_templateObject79||(_templateObject79=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n height: 26px;\n margin-right: ","px;\n width: ",";\n"])),function(i){return i.centerSlider?-56:0;},function(i){return i.centerSlider?"calc(100% + 56px)":"100%";});});var XS=d(function(){p5();});var ay,h5,eet,ly;var f5=d(function(){ay=y(_("react"));h5=y(_("styled-components"));$S();eet=(0,h5["default"])(ry)(_templateObject80||(_templateObject80=_taggedTemplateLiteral(["\n max-width: 50px;\n padding-left: 16px;\n > div > input {\n text-align: center;\n }\n"])));ly=function ly(_ref33){var i=_ref33.id,t=_ref33["aria-label"],e=_ref33.value,r=_ref33.min,o=_ref33.max,n=_ref33.divider,s=_ref33.suffix,a=_ref33.decimal,l=_ref33.isDisabled,c=_ref33["aria-hidden"],u=_ref33.onChange,m=_ref33.onMouseUp,p=_ref33.onTouchEnd,h=_ref33.className,g=_ref33.style;var x="".concat(i,"-input");var v="".concat((e*n).toFixed(a)).concat(s);var b=(0,ay.useCallback)(function(T){var k=T.replace(s,"");if(k){var E=parseFloat(k)/n;var A=Math.max(r,Math.min(o,E));if(!Number.isNaN(A)){u(A);if(m){m(A);}else if(p){p(A);}}}},[r,o,s,u,m,p]);return ay["default"].createElement(eet,{className:h,style:g,"aria-label":t,id:x,value:v,isDisabled:l,"aria-hidden":c,onSubmit:b});};});var qS=d(function(){f5();});var g5,cy;var b5=d(function(){g5=y(_("styled-components"));ka();cy=(0,g5["default"])(Ui)(_templateObject81||(_templateObject81=_taggedTemplateLiteral(["\n padding-bottom: 2px;\n"])));});var YS=d(function(){b5();});var Ia,ps,JS,iet,ret,uy;var y5=d(function(){Ia=y(_("react"));ps=y(_("styled-components"));Sr();U();Jr();JS=ps.css(_templateObject82||(_templateObject82=_taggedTemplateLiteral(["\n ","\n background: ",";\n border: 2px solid ",";\n border-radius: 50%;\n cursor: pointer;\n"])),wr()||ve()?ps.css(_templateObject83||(_templateObject83=_taggedTemplateLiteral(["\n width: 16px;\n height: 16px;\n "]))):ps.css(_templateObject84||(_templateObject84=_taggedTemplateLiteral(["\n width: 20px;\n height: 20px;\n "]))),function(i){return i.theme.slider.thumbBackground;},function(i){return i.theme.slider.thumbBorderColor;});iet=function iet(i){var t=(i.value-i.min)*100/(i.max-i.min);if(i.adjust){if(i.value>0){t=i.value*(i.max/2)*100;return"".concat(i.theme.slider.trackColor," 0%,\n ").concat(i.theme.slider.trackColor," 50%,\n ").concat(i.theme.slider.activeTrackColor," 50%,\n ").concat(i.theme.slider.activeTrackColor," ").concat(50+t,"%,\n ").concat(i.theme.slider.trackColor," ").concat(50+t,"%,\n ").concat(i.theme.slider.trackColor," 100%\n ");}if(i.value<0){t=i.value*(i.min/2)*100;return"".concat(i.theme.slider.trackColor," 0%,\n ").concat(i.theme.slider.trackColor," ").concat(50-t,"%,\n ").concat(i.theme.slider.activeTrackColor," ").concat(50-t,"%,\n ").concat(i.theme.slider.activeTrackColor," 50%,\n ").concat(i.theme.slider.trackColor," 50%,\n ").concat(i.theme.slider.trackColor," 100%\n ");}return"".concat(i.theme.slider.trackColor," 0%,\n ").concat(i.theme.slider.trackColor," 100%");}return"".concat(i.theme.slider.activeTrackColor," 0%,\n ").concat(i.theme.slider.activeTrackColor," ").concat(t,"%,\n ").concat(i.theme.slider.trackColor," ").concat(t,"%,\n ").concat(i.theme.slider.trackColor," 100%");};ret=ps["default"].input.attrs(function(i){return{style:!wr()&&!ve()?{background:"linear-gradient(to right, ".concat(iet(i),")")}:{}};})(_templateObject85||(_templateObject85=_taggedTemplateLiteral(["\n display: flex;\n flex: 1 0 auto;\n appearance: none;\n width: 100%;\n max-width: ",";\n outline: none;\n border-radius: 0; /* iOS */\n\n padding: 0;\n margin: 0;\n border: none;\n\n ","\n\n ","\n\n &::-moz-focus-outer {\n /** This is to remove the dotted focus lines in firefox */\n border: 0;\n }\n &:disabled {\n opacity: ",";\n pointer-events: none;\n }\n &:hover {\n opacity: ",";\n }\n &::-webkit-slider-runnable-track {\n cursor: pointer;\n appearance: none;\n }\n &::-moz-range-track {\n appearance: none;\n cursor: pointer;\n }\n &::-ms-track {\n cursor: pointer;\n height: 2px;\n appearance: none;\n background: transparent;\n color: transparent;\n border-color: transparent;\n border-width: 6px 0;\n }\n &::-webkit-slider-thumb {\n appearance: none;\n ","\n }\n &::-moz-range-thumb {\n appearance: none;\n ","\n }\n &::-ms-thumb {\n appearance: none;\n ","\n }\n &::-ms-fill-lower {\n background: ",";\n }\n &::-ms-fill-upper {\n background: ",";\n }\n &::-ms-tooltip {\n display: none;\n }\n"])),function(i){return i.showInput?"calc(100% - 50px)":"100%";},di,function(i){if(wr()||ve()){return ps.css(_templateObject86||(_templateObject86=_taggedTemplateLiteral(["\n margin-top: 10px;\n height: 20px;\n /* remove once we have a better concept for focus in all browser */\n &:focus {\n box-shadow: none;\n }\n "])));}if(i.smallContainer){return ps.css(_templateObject87||(_templateObject87=_taggedTemplateLiteral(["\n height: 4px;\n "])));}return ps.css(_templateObject88||(_templateObject88=_taggedTemplateLiteral(["\n height: 2px;\n "])));},function(i){return i.theme.slider.inactiveOpacity;},function(i){return i.theme.slider.hoverOpacity;},JS,JS,JS,function(i){return"".concat(i.theme.slider.activeTrackColor);},function(i){return"".concat(i.theme.slider.trackColor);});uy=function uy(_ref34){var i=_ref34.id,t=_ref34.label,e=_ref34.value,r=_ref34.min,o=_ref34.max,n=_ref34.step,s=_ref34.adjust,a=_ref34.showInput,l=_ref34["aria-hidden"],c=_ref34.isDisabled,u=_ref34.onChange,m=_ref34.onMouseUp,p=_ref34.onTouchEnd,h=_ref34["data-test"],g=_ref34.className,x=_ref34.style;var _ref35=(0,Ia.useContext)(Oe),v=_ref35.rect;var b=(0,Ia.useCallback)(function(E){var A=parseFloat(E.target.value);u(A);},[u]);var T=(0,Ia.useCallback)(function(E){var A=E.target.value;var I=parseFloat(A);if(p){p(I);}},[p]);var k=(0,Ia.useCallback)(function(E){var A=E.target.value;var I=parseFloat(A);if(m){m(I);}},[p]);return Ia["default"].createElement(ret,{type:"range",role:"slider","aria-valuenow":e,"aria-valuemin":r,"aria-valuemax":o,"aria-label":t,"data-test":h,id:i,name:t,tabIndex:0,value:e,min:r,max:o,step:n,style:x,className:g,adjust:s,showInput:a,disabled:c,smallContainer:!!v&&v.width<600,"aria-hidden":l,onChange:b,onKeyUp:b,onKeyDown:b,onMouseUp:k,onTouchEnd:T});};});var ZS=d(function(){y5();});var Da,_5;var x5=d(function(){Da=y(_("react"));U();KS();XS();qS();YS();ZS();_5=function _5(_ref36){var i=_ref36["data-test"],t=_ref36.label,e=_ref36.identifier,_ref36$showLabel=_ref36.showLabel,r=_ref36$showLabel===void 0?true:_ref36$showLabel,_ref36$showInput=_ref36.showInput,o=_ref36$showInput===void 0?true:_ref36$showInput,_ref36$centerSlider=_ref36.centerSlider,n=_ref36$centerSlider===void 0?false:_ref36$centerSlider,_ref36$min=_ref36.min,s=_ref36$min===void 0?-1:_ref36$min,_ref36$max=_ref36.max,a=_ref36$max===void 0?1:_ref36$max,_ref36$value=_ref36.value,l=_ref36$value===void 0?0:_ref36$value,_ref36$step=_ref36.step,c=_ref36$step===void 0?.01:_ref36$step,_ref36$decimal=_ref36.decimal,u=_ref36$decimal===void 0?0:_ref36$decimal,_ref36$divider=_ref36.divider,m=_ref36$divider===void 0?100:_ref36$divider,_ref36$suffix=_ref36.suffix,p=_ref36$suffix===void 0?"":_ref36$suffix,_ref36$adjust=_ref36.adjust,h=_ref36$adjust===void 0?false:_ref36$adjust,g=_ref36["aria-hidden"],x=_ref36.isDisabled,v=_ref36.onChange,b=_ref36.onMouseUp,T=_ref36.onTouchEnd,k=_ref36.style,E=_ref36.className;var _ref37=(0,Da.useState)("photoeditorsdk-slider-".concat(At())),_ref38=_slicedToArray(_ref37,1),A=_ref38[0];return Da["default"].createElement(ny,{className:E,"data-test":i||e||A,style:k},Da["default"].createElement(cy,{isDisabled:x,label:t,show:r}),Da["default"].createElement(sy,{centerSlider:o&&n},Da["default"].createElement(uy,{id:A,label:t,value:l,min:s,max:a,step:c,adjust:h,showInput:o,isDisabled:x,"aria-hidden":g,onChange:v,onMouseUp:b,onTouchEnd:T}),o&&Da["default"].createElement(ly,{id:A,"aria-label":t,value:l,min:s,max:a,divider:m,suffix:p,decimal:u,isDisabled:x,"aria-hidden":g,onChange:v,onMouseUp:b,onTouchEnd:T})));};});var v5=d(function(){x5();KS();XS();qS();ZS();YS();});var C5,Xl;var dy=d(function(){C5=y(_("styled-components"));Ta();$l();Xl=(0,C5["default"])(yi)(_templateObject89||(_templateObject89=_taggedTemplateLiteral(["\n color: ",";\n\n svg {\n color: ",";\n }\n\n /* Repeat active styles so they are not overwritten */\n ","\n\n "," {\n display: none;\n }\n\n &:disabled {\n opacity: ",";\n }\n"])),function(i){return i.theme.button.textPrimaryForeground;},function(i){return i.theme.button.textPrimaryForeground;},function(_ref39){var i=_ref39.isActive;return i&&Fo;},zi,function(i){return i.theme.button.textInactiveOpacity;});});var S5,Ro;var my=d(function(){S5=y(_("styled-components"));Ta();$l();Ro=(0,S5["default"])(yi)(_templateObject90||(_templateObject90=_taggedTemplateLiteral(["\n color: ",";\n\n /* Repeat active styles so they are not overwritten */\n ","\n\n "," {\n display: none;\n }\n\n &:disabled {\n opacity: ",";\n }\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.button.textSecondaryForeground;},function(_ref40){var i=_ref40.isActive;return i&&Fo;},zi,function(i){return i.theme.button.textInactiveOpacity;},function(i){return i.theme.button.textSecondaryForeground;});});var yn,QS;var w5=d(function(){yn=y(_("react"));U();dy();my();Tp();Ob();Rb();QS=/*#__PURE__*/function(_yn$default$Component){_inherits(QS,_yn$default$Component);var _super13=_createSuper(QS);function QS(){var _this27;_classCallCheck(this,QS);_this27=_super13.apply(this,arguments);_this27.onDismiss=function(){var _this27$props=_this27.props,t=_this27$props.handleClose,e=_this27$props.handleDismiss;if(t)t();if(e)e();};_this27.onConfirm=function(){var _this27$props2=_this27.props,t=_this27$props2.handleClose,e=_this27$props2.handleConfirm;if(t)t();if(e)e();};return _this27;}_createClass(QS,[{key:"render",value:function render(){var _this$props7=this.props,t=_this$props7.headerLabel,e=_this$props7.bodyLabel,r=_this$props7.confirmLabel,o=_this$props7.dismissLabel,n=_this$props7.type,s=_this$props7.children;var a=yn["default"].Children.toArray(s)[0];if(!yn["default"].isValidElement(a))throw new Error("Child is not a valid react element");return yn["default"].cloneElement(a,{handleConfirm:this.onConfirm,handleDismiss:this.onDismiss,header:yn["default"].createElement(td,null,t),body:yn["default"].createElement(ms,{"data-test":N.DialogBody},e),footer:yn["default"].createElement(Qu,{type:n},o&&yn["default"].createElement(Ro,{label:o,ariaLabel:o,onClick:this.onDismiss}),r&&yn["default"].createElement(Xl,{label:r,ariaLabel:r,onClick:this.onConfirm}))});return null;}}]);return QS;}(yn["default"].Component);});var Ao,Mp,oet,net,set,aet,t1;var T5=d(function(){Ao=y(_("react"));Mp=y(_("styled-components"));U();Tp();Rb();vS();oet=Mp["default"].div(_templateObject91||(_templateObject91=_taggedTemplateLiteral(["\n display: flex;\n"])));net=(0,Mp["default"])(td)(_templateObject92||(_templateObject92=_taggedTemplateLiteral(["\n padding: 0;\n"])));set=Mp["default"].div(_templateObject93||(_templateObject93=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n margin-left: 8px;\n @media all and (min-width: 640px) {\n margin-left: 30px;\n }\n"])));aet=(0,Mp["default"])(ms)(_templateObject94||(_templateObject94=_taggedTemplateLiteral(["\n padding: 0;\n margin: 0;\n"])));t1=/*#__PURE__*/function(_Ao$default$PureCompo){_inherits(t1,_Ao$default$PureCompo);var _super14=_createSuper(t1);function t1(){_classCallCheck(this,t1);return _super14.apply(this,arguments);}_createClass(t1,[{key:"render",value:function render(){var _this$props8=this.props,t=_this$props8.headerLabel,e=_this$props8.bodyLabel,r=_this$props8.children;var o=Ao["default"].Children.toArray(r)[0];if(!Ao["default"].isValidElement(o))throw new Error("Child is not a valid react element");return Ao["default"].cloneElement(o,{height:"90px",body:Ao["default"].createElement(ms,{"data-test":N.DialogBody},Ao["default"].createElement(oet,null,Ao["default"].createElement(Bb,null),Ao["default"].createElement(set,null,Ao["default"].createElement(net,null,t),Ao["default"].createElement(aet,null,e))))});return null;}}]);return t1;}(Ao["default"].PureComponent);});var Ir,cd,cet,uet,det,met,pet,e1,k5;var I5=d(function(){Ir=y(_("react"));cd=y(_("styled-components"));U();dy();my();Tp();Ob();ty();cet=cd["default"].form(_templateObject95||(_templateObject95=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n"])));uet=cd["default"].textarea(_templateObject96||(_templateObject96=_taggedTemplateLiteral(["\n display: flex;\n caret-color: ",";\n ","\n min-height: 100%;\n padding: 0px;\n outline-offset: -8px;\n color: ",";\n resize: none;\n font-family: '","', sans-serif;\n\n &:selection,\n &:-moz-selection {\n background-color: ",";\n color: ",";\n }\n"])),function(i){return i.theme.primary;},Kl,function(i){return i.theme.modal.bodyForeground;},function(i){return i.theme.typography.fontFamily;},function(i){return i.theme.primary;},function(i){return i.theme.foreground;});det=cd["default"].label(_templateObject97||(_templateObject97=_taggedTemplateLiteral(["\n padding: 11px 20px 8px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n"])),function(i){return i.theme.measurements.fontSystem.label.size;},function(i){return i.theme.measurements.fontSystem.label.letterSpacing;},function(i){return i.theme.measurements.fontSystem.label["case"];},function(i){return i.theme.modal.headerForeground;});met=(0,cd["default"])(ms)(_templateObject98||(_templateObject98=_taggedTemplateLiteral(["\n height: 100%;\n"])));pet=(0,cd["default"])(Qu)(_templateObject99||(_templateObject99=_taggedTemplateLiteral(["\n border-top: none;\n"])));e1=/*#__PURE__*/function(_Ir$default$Component){_inherits(e1,_Ir$default$Component);var _super15=_createSuper(e1);function e1(){var _this28;_classCallCheck(this,e1);_this28=_super15.apply(this,arguments);_this28.state={value:""};_this28.input=Ir["default"].createRef();_this28.handleKeydown=function(t){aA(_this28.handleDismiss)(t);};_this28.handleDismiss=function(){var t=_this28.props.handleDismiss;if(t)t(false);};_this28.handleConfirm=function(){var t=_this28.props.handleConfirm;var e=_this28.input.current.value;if(e){if(t)t(e);_this28.handleDismiss();}};_this28.onChange=function(t){var e=_this28.props.allowEmojis;var r=e?t.target.value:GF(t.target.value);_this28.input.current.value=r;_this28.setState({value:r});};_this28.onSubmit=function(t){t.preventDefault();};return _this28;}_createClass(e1,[{key:"componentDidMount",value:function componentDidMount(){var _this$props9=this.props,t=_this$props9.text,e=_this$props9.defaultText;this.input.current.focus();this.input.current.value=t||e||"";this.setState({value:this.input.current.value});document.addEventListener("keydown",this.handleKeydown,false);if(t===e){this.input.current.select();}}},{key:"componentDidUpdate",value:function componentDidUpdate(t){var e=this.props.isVisible;if(t.isVisible!==e){if(e){this.input.current.focus();}}}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener("keydown",this.handleKeydown,false);}},{key:"render",value:function render(){var _this$props10=this.props,t=_this$props10.headerLabel,e=_this$props10.dismissLabel,r=_this$props10.confirmLabel,o=_this$props10.maxLength,n=_this$props10.type,s=_this$props10.children;var a=this.state.value;var l=Ir["default"].Children.toArray(s)[0];if(!Ir["default"].isValidElement(l))throw new Error("Child is not a valid react element");return Ir["default"].cloneElement(l,{handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss,isConfirmDisabled:!a,height:"150px",header:Ir["default"].createElement(det,{htmlFor:"photoeditorsdk-TextInput"},t),body:Ir["default"].createElement(met,null,Ir["default"].createElement(cet,{onSubmit:this.onSubmit},Ir["default"].createElement(uet,{ref:this.input,id:"photoeditorsdk-TextInput",placeholder:"Write Something",autoFocus:true,onChange:this.onChange,maxLength:o}))),footer:Ir["default"].createElement(pet,{type:n},Ir["default"].createElement(Ro,{label:e,ariaLabel:e,onClick:this.handleDismiss}),Ir["default"].createElement(Xl,{label:r,ariaLabel:r,isDisabled:!a,onClick:this.handleConfirm}))});return null;}}]);return e1;}(Ir["default"].Component);e1.defaultProps={defaultText:"Write Something",allowEmojis:false};k5=e1;});var D5,i1;var E5=d(function(){D5=y(_("styled-components"));i1=D5["default"].div(_templateObject100||(_templateObject100=_taggedTemplateLiteral(["\n padding-bottom: ","px;\n"])),function(i){return(i.count||1)*8;});i1.defaultProps={count:1};});var ql,r1,py,hy;var F5=d(function(){ql=y(_("react"));r1=/*#__PURE__*/function(_ql$default$Component){_inherits(r1,_ql$default$Component);var _super16=_createSuper(r1);function r1(){_classCallCheck(this,r1);return _super16.apply(this,arguments);}_createClass(r1,[{key:"getChildren",value:function getChildren(){var _this29=this;var t=[];var e=[];ql["default"].Children.forEach(this.props.children,function(r){switch(r.type.componentName){case"case":if(_this29.props.type===r.props.value){t.push(r);}break;case"default":e.push(r);break;}});if(t.length>0){return t;}return e;}},{key:"render",value:function render(){var t=this.getChildren();return t.length===0?null:ql["default"].createElement(ql["default"].Fragment,null,t);}}]);return r1;}(ql["default"].Component);py=/*#__PURE__*/function(_ql$default$Component2){_inherits(py,_ql$default$Component2);var _super17=_createSuper(py);function py(){_classCallCheck(this,py);return _super17.apply(this,arguments);}_createClass(py,[{key:"render",value:function render(){return this.props.children;}}]);return py;}(ql["default"].Component);py.componentName="case";hy=/*#__PURE__*/function(_ql$default$Component3){_inherits(hy,_ql$default$Component3);var _super18=_createSuper(hy);function hy(){_classCallCheck(this,hy);return _super18.apply(this,arguments);}_createClass(hy,[{key:"render",value:function render(){return this.props.children;}}]);return hy;}(ql["default"].Component);hy.componentName="default";});var ud,het,fet,O5;var R5=d(function(){ud=y(_("styled-components"));het=ud.keyframes(_templateObject101||(_templateObject101=_taggedTemplateLiteral(["\n from { transform: translate(-50%, 0%); }\n to { transform: translate(-50%, 50%); }\n"])));fet=ud["default"].div(_templateObject102||(_templateObject102=_taggedTemplateLiteral(["\n position: absolute;\n top: ","px;\n left: ","px;\n transform: translate(-50%, 50%);\n background: black;\n color: white;\n border-radius: ","px;\n padding: 10px 16px;\n text-align: center;\n z-index: ",";\n visibility: hidden;\n\n ","\n"])),function(i){return i.position.y;},function(i){return i.position.x;},function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.zIndex.toast;},function(_ref41){var i=_ref41.show;return i&&ud.css(_templateObject103||(_templateObject103=_taggedTemplateLiteral(["\n visibility: visible;\n animation: "," 0.5s, fadeout 0.5s 2.5s;\n "])),het);});O5=fet;});var dd,to,A5,get,B5,bet,P5,yet,Bo;var Lp=d(function(){dd=y(_("react"));to=y(_("styled-components"));Sr();Ta();A5=to.css(_templateObject104||(_templateObject104=_taggedTemplateLiteral(["\n display: flex;\n flex: 0 0 auto;\n justify-content: center;\n align-items: center;\n padding: 4px;\n"])));get=(0,to["default"])(yi)(_templateObject105||(_templateObject105=_taggedTemplateLiteral(["\n ","\n\n ","\n ","\n"])),function(_ref42){var i=_ref42.fullWidth;return i&&to.css(_templateObject106||(_templateObject106=_taggedTemplateLiteral(["\n width: 100%;\n "])));},function(_ref43){var i=_ref43.hasIcon,t=_ref43.smallContainer;return i&&t&&A5;},function(_ref44){var i=_ref44.hasIcon;return i&&to.css(_templateObject107||(_templateObject107=_taggedTemplateLiteral(["\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n "])),A5);});B5=to.css(_templateObject108||(_templateObject108=_taggedTemplateLiteral(["\n display: flex;\n"])));bet=to["default"].div(_templateObject109||(_templateObject109=_taggedTemplateLiteral(["\n &:focus {\n outline: none;\n }\n\n > img {\n height: 18px;\n width: 18px;\n }\n\n > svg {\n height: 18px;\n width: 18px;\n }\n display: none;\n\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&B5;},B5);P5=to.css(_templateObject110||(_templateObject110=_taggedTemplateLiteral(["\n display: none;\n"])));yet=to["default"].div(_templateObject111||(_templateObject111=_taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n &:focus {\n outline: none;\n }\n font-size: inherit;\n text-spacing: inherit;\n color: inherit;\n\n ","\n\n ","\n ","\n"])),function(_ref45){var i=_ref45.isDisabled;return i&&to.css(_templateObject112||(_templateObject112=_taggedTemplateLiteral(["\n opacity: ",";\n "])),function(t){return t.theme.button.textInactiveOpacity;});},function(_ref46){var i=_ref46.hasIcon,t=_ref46.smallContainer;return i&&t&&P5;},function(_ref47){var i=_ref47.hasIcon;return i&&to.css(_templateObject113||(_templateObject113=_taggedTemplateLiteral(["\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n "])),P5);});Bo=function Bo(_ref48){var i=_ref48.label,t=_ref48.children,e=_ref48.icon,r=_ref48.fullWidth,o=_ref48.isDisabled,n=_objectWithoutProperties(_ref48,_excluded4);var _ref49=(0,dd.useContext)(Oe),s=_ref49.rect;var a=!!s&&s.width<600;var l=dd["default"].createElement(yet,{hasIcon:!!e,isDisabled:o,smallContainer:a},i,t);return dd["default"].createElement(get,_objectSpread({fullWidth:r,isDisabled:o,hasIcon:!!e,smallContainer:a},n),e&&dd["default"].createElement(bet,{smallContainer:a},e),(t||i)&&l);};});var M5,zp;var L5=d(function(){M5=y(_("styled-components"));Lp();zp=(0,M5["default"])(Bo)(_templateObject114||(_templateObject114=_taggedTemplateLiteral(["\n background: ",";\n color: ",";\n border: 1px solid ",";\n min-width: 32px;\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.button.outlinedPrimaryBackground;},function(i){return i.theme.button.outlinedPrimaryForeground;},function(i){return i.theme.button.outlinedBorderColor;},function(i){return i.theme.button.outlinedPrimaryForeground;});});var z5,Ea;var U5=d(function(){z5=y(_("styled-components"));Ta();Lp();Ea=(0,z5["default"])(Bo)(_templateObject115||(_templateObject115=_taggedTemplateLiteral(["\n background: ",";\n color: ",";\n border: 1px solid ",";\n\n svg {\n color: ",";\n }\n\n ","\n"])),function(i){return i.theme.button.outlinedSecondaryBackground;},function(i){return i.theme.button.outlinedSecondaryForeground;},function(i){return i.theme.button.outlinedBorderColor;},function(i){return i.theme.button.outlinedSecondaryForeground;},function(_ref50){var i=_ref50.isActive;return i&&Fo;});});var o1,n1,_et,xet,hs;var N5=d(function(){o1=y(_("react"));n1=y(_("styled-components"));Ta();$l();_et=(0,n1["default"])(yi)(_templateObject116||(_templateObject116=_taggedTemplateLiteral(["\n color: ",";\n\n svg {\n color: ",";\n }\n\n /* Repeat active styles so they are not overwritten */\n ","\n\n "," {\n display: none;\n }\n\n &:disabled {\n opacity: ",";\n }\n"])),function(i){return i.theme.foreground;},function(i){return i.theme.foreground;},function(_ref51){var i=_ref51.isActive;return i&&Fo;},zi,function(i){return i.theme.button.textInactiveOpacity;});xet=n1["default"].div(_templateObject117||(_templateObject117=_taggedTemplateLiteral(["\n display: flex;\n &:focus {\n outline: none;\n }\n"])));hs=function hs(_ref52){var i=_ref52.label,t=_ref52.icon,e=_ref52.children,r=_objectWithoutProperties(_ref52,_excluded5);return o1["default"].createElement(_et,_objectSpread({},r),o1["default"].createElement(xet,null,t));};});var H5,Up;var W5=d(function(){H5=y(_("styled-components"));Lp();Up=(0,H5["default"])(Bo)(_templateObject118||(_templateObject118=_taggedTemplateLiteral(["\n background: ",";\n color: ",";\n border: 1px solid ",";\n\n &:active {\n color: ",";\n }\n\n svg {\n color: ",";\n\n &:active {\n color: ",";\n }\n }\n"])),function(i){return i.theme.button.containedPrimaryBackground;},function(i){return i.theme.button.containedPrimaryForeground;},function(i){return i.theme.button.containedPrimaryBackground;},function(i){return i.theme.button.containedPrimaryForeground;},function(i){return i.theme.button.containedPrimaryForeground;},function(i){return i.theme.button.containedPrimaryForeground;});});var Yl,Np,vet,Cet,wet,Dr;var G5=d(function(){Yl=y(_("react"));Np=y(_("styled-components"));eC();$l();Jr();vet=function vet(){return Np.css(_templateObject119||(_templateObject119=_taggedTemplateLiteral(["\n animation: "," 0.2s linear;\n "])),Lg);};Cet=Np.css(_templateObject120||(_templateObject120=_taggedTemplateLiteral(["\n border: 1px solid ",";\n "," {\n background-color: ",";\n }\n"])),function(i){return i.theme.card.activeBorderColor;},RS,function(i){return i.theme.card.activeOverlayColor;});wet=Np["default"].button.attrs(function(i){var t={};if(i.image){t.backgroundImage="url(".concat(i.image,")");}return _objectSpread({style:t},i.style);})(_templateObject121||(_templateObject121=_taggedTemplateLiteral(["\n &&& {\n box-sizing: border-box;\n }\n\n /* basic ui text items use position absolute */\n position: relative;\n\n padding: 0;\n cursor: pointer;\n /* Safari will change the height of the toolbar and position the category cards at the bottom for some reason */\n vertical-align: top;\n border: none;\n box-sizing: border-box;\n background-size: cover;\n background-position: center center;\n background-repeat: no-repeat;\n background-color: ",";\n color: ",";\n\n border-radius: ","px;\n ",";\n animation-fill-mode: both;\n overflow: hidden;\n\n ","\n\n /* Active */\n\n /* No :active styles on purpose. */\n\n ","\n\n /* Disabled */\n\n &:disabled {\n cursor: default;\n pointer-events: none;\n\n "," {\n background-color: ",";\n }\n }\n\n /* Hover */\n\n &:hover {\n "," {\n background-color: ",";\n }\n }\n"])),function(i){return i.theme.card.background;},function(i){return i.theme.card.foreground;},function(i){return i.theme.shape.radiusMedium;},vet,di,function(_ref53){var i=_ref53.isActive;return i&&Cet;},zi,function(i){return i.theme.card.inactiveOverlayColor;},nd,function(i){return i.theme.card.hoverOverlayColor;});Dr=/*#__PURE__*/function(_Yl$default$Component){_inherits(Dr,_Yl$default$Component);var _super19=_createSuper(Dr);function Dr(){var _this30;_classCallCheck(this,Dr);_this30=_super19.apply(this,arguments);_this30.state=$b;_this30.timeout=null;_this30.onKeyDown=function(t){if(t.key==="Space"||t.key==="Enter"){if(_this30.props.onClick){_this30.props.onClick();}}};_this30.onClick=function(t){var e=t.currentTarget.getBoundingClientRect();var r=t.pageX-e.left;var o=t.pageY-e.top;if(_this30.state.display==="block"){_this30.setState({display:"none"},function(){_this30.setRippleState(r,o);});}else{_this30.setRippleState(r,o);}_this30.props.onClick(t);};_this30.setRippleState=function(t,e){_this30.setState({left:t,top:e,display:"block"});_this30.timeout=setTimeout(function(){_this30.setState({display:"none"});},1200);};return _this30;}_createClass(Dr,[{key:"componentWillUnmount",value:function componentWillUnmount(){clearTimeout(this.timeout);}},{key:"render",value:function render(){var _this$props11=this.props,t=_this$props11.children,e=_this$props11.label,r=_this$props11.role,o=_this$props11["aria-label"],n=_this$props11["aria-expanded"],s=_this$props11.isActive,a=_this$props11.isDisabled,l=_this$props11.image,c=_this$props11.style,u=_this$props11.className;var _this$state3=this.state,m=_this$state3.left,p=_this$state3.top,h=_this$state3.display;return Yl["default"].createElement(wet,{role:r,"aria-expanded":n,isActive:s,"aria-label":o,"data-test":e,disabled:a,image:l,onClick:this.onClick,onKeyDown:this.onKeyDown,style:c,className:u},t,Yl["default"].createElement(Kb,{display:h,left:m,top:p}),Yl["default"].createElement(RS,null),Yl["default"].createElement(zi,null),Yl["default"].createElement(nd,null));}}]);return Dr;}(Yl["default"].Component);Dr.defaultProps={isActive:false};});var md,Er,Tet,ket,Iet,Det,Eet,Se;var V5=d(function(){md=y(_("react"));Er=y(_("styled-components"));U();Jr();Tet=Er["default"].div(_templateObject122||(_templateObject122=_taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 0 4px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n ","\n"])),function(i){return i.theme.measurements.fontSystem.label.size;},function(i){return i.theme.measurements.fontSystem.label.letterSpacing;},function(i){return i.theme.measurements.fontSystem.label["case"];},function(i){return i.withBackground?Er.css(_templateObject123||(_templateObject123=_taggedTemplateLiteral(["\n color: ",";\n "])),i.theme.card.labelForeground):Er.css(_templateObject124||(_templateObject124=_taggedTemplateLiteral(["\n color: ",";\n "])),i.theme.card.foreground);});ket=Er["default"].div(_templateObject125||(_templateObject125=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n position: absolute;\n bottom: 0px;\n border-radius: ","px;\n left: 0;\n ","\n width: 100%;\n cursor: pointer;\n"])),function(i){return i.theme.shape.radiusMedium;},function(i){return i.withBackground?Er.css(_templateObject126||(_templateObject126=_taggedTemplateLiteral(["\n color: ",";\n height: 40px;\n background: ",";\n "])),i.theme.card.labelForeground,i.theme.card.labelBackground):Er.css(_templateObject127||(_templateObject127=_taggedTemplateLiteral(["\n color: ",";\n height: 32px;\n "])),i.theme.card.foreground);});Iet=Er["default"].div(_templateObject128||(_templateObject128=_taggedTemplateLiteral(["\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid ",";\n ","\n transform: rotate(","deg);\n display: inline-block;\n transition-duration: 0.3s;\n transition-timing-function: ease-in;\n"])),function(i){return i.theme.card.labelForeground;},function(i){return i.withBackground?Er.css(_templateObject129||(_templateObject129=_taggedTemplateLiteral(["\n border-top-color: ",";\n "])),i.theme.card.labelForeground):Er.css(_templateObject130||(_templateObject130=_taggedTemplateLiteral(["\n border-top-color: ",";\n "])),i.theme.card.foreground);},function(i){return i.rotation||0;});Det=Er["default"].span(_templateObject131||(_templateObject131=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding-left: 10px;\n"])));Eet=Er["default"].div(_templateObject132||(_templateObject132=_taggedTemplateLiteral(["\n ","\n"])),Zu);Se=function Se(_ref54){var i=_ref54.children,t=_ref54.className,e=_ref54.caret,r=_ref54.isActive,o=_ref54.style,n=_ref54.withBackground,s=_ref54.hidden;if(s){return md["default"].createElement(Eet,null,i);}var a=function a(){return md["default"].createElement(Det,null,md["default"].createElement(Iet,{"aria-hidden":true,rotation:r?180:0,withBackground:n}));};return md["default"].createElement(ket,{className:t,withBackground:n,style:o},md["default"].createElement(Tet,{"data-test":N.CardLabel,withBackground:n},i,e&&a()));};});var j5,Jl;var $5=d(function(){j5=y(_("styled-components"));U();Jl=j5["default"].div.attrs(function(i){return{"data-test":N.CardAvatar,style:{backgroundImage:"url(".concat(i.url,")")}};})(_templateObject133||(_templateObject133=_taggedTemplateLiteral(["\n position: absolute;\n top: 4px;\n left: 4px;\n height: 28px;\n width: 28px;\n border-radius: 50%;\n"])));});var K5,s1,fy,a1;var X5=d(function(){K5=function K5(i){var t=[];t[0]=requestAnimationFrame(function(){t[1]=requestAnimationFrame(function(){i();});});return t;};s1=function s1(i){i.forEach(function(t){return cancelAnimationFrame(t);});};fy=function fy(i){return!Number.isNaN(parseFloat(i))&&Number.isFinite(i);};a1=function a1(i){return typeof i==="string"&&i.search("%")===i.length-1&&fy(i.substr(0,i.length-1));};});var Hp,l1,c1;var q5=d(function(){Hp=y(_("react"));X5();c1=(l1=/*#__PURE__*/function(_Hp$default$Component){_inherits(l1,_Hp$default$Component);var _super20=_createSuper(l1);function l1(i){var _this31;_classCallCheck(this,l1);_this31=_super20.call(this,i);_this31.contentRef=null;_this31.contentRef=Hp["default"].createRef();_this31.animationFrameIDs=[];var t="auto";var e="visible";if(fy(i.height)){t=i.height<0||i.height==="0"?0:i.height;e="hidden";}else if(a1(i.height)){t=i.height==="0%"?0:i.height;e="hidden";}var r=typeof window!=="undefined";if(r&&window.matchMedia){_this31.prefersReducedMotion=window.matchMedia("(prefers-reduced-motion)").matches;}_this31.state={height:t,overflow:e,shouldUseTransitions:false};return _this31;}_createClass(l1,[{key:"componentDidMount",value:function componentDidMount(){var i=this.state.height;if(this.contentRef.current&&this.contentRef.current.style){this.hideContent(i);}}},{key:"componentDidUpdate",value:function componentDidUpdate(i,t){var _this32=this;var e=this.props.height;var _this$getTimings=this.getTimings(),r=_this$getTimings.duration,o=_this$getTimings.delay;if(this.contentRef.current&&e!==i.height){this.showContent(t.height);this.contentRef.current.style.overflow="hidden";var n=this.contentRef.current.offsetHeight;this.contentRef.current.style.overflow="";var s=r+o;var a=null;var l={height:null,overflow:"hidden"};var c=t.height==="auto";if(fy(e)){a=e<0||e==="0"?0:e;l.height=a;}else if(a1(e)){a=e==="0%"?0:e;l.height=a;}else{a=n;l.height="auto";l.overflow=null;}if(c){l.height=a;a=n;}this.setState({height:a,overflow:"hidden",shouldUseTransitions:!c});clearTimeout(this.timeoutID);clearTimeout(this.animationClassesTimeoutID);if(c){s1(this.animationFrameIDs);this.animationFrameIDs=K5(function(){_this32.setState({height:l.height,overflow:l.overflow,shouldUseTransitions:true});});this.animationClassesTimeoutID=setTimeout(function(){_this32.setState({shouldUseTransitions:false});_this32.hideContent(l.height);},s);}else{this.timeoutID=setTimeout(function(){_this32.setState({height:l.height,overflow:"visible",shouldUseTransitions:false});if(e!=="auto"){_this32.hideContent(a);}},s);}}}},{key:"componentWillUnmount",value:function componentWillUnmount(){s1(this.animationFrameIDs);clearTimeout(this.timeoutID);clearTimeout(this.animationClassesTimeoutID);this.timeoutID=null;}},{key:"getTimings",value:function getTimings(){if(this.prefersReducedMotion){return{delay:0,duration:0};}var _this$props12=this.props,i=_this$props12.delay,t=_this$props12.duration;return{delay:i,duration:t};}},{key:"showContent",value:function showContent(i){if(i===0){this.contentRef.current.style.display="";}}},{key:"hideContent",value:function hideContent(i){if(i===0){this.contentRef.current.style.display="none";}}},{key:"render",value:function render(){var _this$props13=this.props,i=_this$props13.animateOpacity,t=_this$props13.children,e=_this$props13.className,r=_this$props13.easing;var _this$state4=this.state,o=_this$state4.height,n=_this$state4.overflow,s=_this$state4.shouldUseTransitions;var _this$getTimings2=this.getTimings(),a=_this$getTimings2.duration,l=_this$getTimings2.delay;var c={height:o,overflow:n};if(s){c.transition="height ".concat(a,"ms ").concat(r," ").concat(l,"ms");c.WebkitTransition=c.transition;}var u={};if(i){u.transition="opacity ".concat(a,"ms ").concat(r," ").concat(l,"ms");u.WebkitTransition=u.transition;if(o===0){u.opacity=0;}}return Hp["default"].createElement("div",{"aria-hidden":o===0,className:e,style:c},Hp["default"].createElement("div",{style:u,ref:this.contentRef},t));}}]);return l1;}(Hp["default"].Component),l1.defaultProps={animateOpacity:false,duration:250,delay:0,easing:"ease"},l1);});var Y5=d(function(){q5();});var gy,J5,P;var it=d(function(){eC();jA();QA();fS();Cp();gS();bS();oB();yS();_S();Tp();xS();Ob();Rb();vS();CB();FS();RB();LB();BS();PS();MS();YB();QB();i5();ka();$S();s5();c5();v5();VS();w5();T5();I5();E5();Jr();F5();R5();$l();Ta();Lp();L5();my();dy();U5();N5();W5();G5();V5();$5();US();Y5();gy={Focused:di,VisuallyHidden:Zu};J5={ripple:Mg,scale:QE,slide:Lg};P={Container:pS,ColorItem:ZA,ColorItemBase:wb,ColorItemBackground:Cb,ColorItemTiledBackground:Tb,ColorItemActiveOverlay:Sb,Dialog:rB,DialogBase:Db,DialogContainer:Eb,DialogBackdrop:kb,DialogHeader:td,DialogBody:ms,DialogFooter:Qu,DialogSpinner:Bb,TextEditModal:k5,ActionModal:QS,InfoModal:t1,Spacer:i1,Draggable:vB,DraggableCore:jl,Toast:O5,Input:{Label:Ui,File:ZB,Search:n5,Slider:_5,SliderBase:ny,SliderContainer:sy,SliderInput:ly,SliderTrack:uy,SliderLabel:cy,CarouselSlider:OB,Selection:l5,Checkbox:MB,CheckboxBase:qb,CheckboxInput:Yb,CheckboxCheckMark:Fp,Dropdown:HS,Text:iy,NumericInput:ry,Form:e5},Switch:{Index:r1,Case:py,Default:hy}};});var Z5,by;var Q5=d(function(){Z5=y(_("styled-components"));it();by=(0,Z5["default"])(Bo)(_templateObject134||(_templateObject134=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n\n "," {\n display: none;\n }\n\n &:disabled {\n opacity: ",";\n }\n"])),function(i){return i.theme.measurements.fontSystem.button2.size;},function(i){return i.theme.measurements.fontSystem.button2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.button2["case"];},function(i){return i.theme.button.textSecondaryForeground;},zi,function(i){return i.theme.button.textInactiveOpacity;});});var u1,d1,Fet,Oet,tP;var eP=d(function(){u1=y(_("react"));d1=y(_("styled-components"));it();Fet=(0,d1["default"])(yi)(_templateObject135||(_templateObject135=_taggedTemplateLiteral(["\n width: 60px;\n height: 60px;\n background-color: gray;\n border-radius: 50%;\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n z-index: ",";\n padding: 2px;\n"])),function(i){return i.theme.measurements.zIndex.button["float"];});Oet=d1["default"].div(_templateObject136||(_templateObject136=_taggedTemplateLiteral(["\n height: 56px;\n width: 56px;\n border-radius: 50%;\n background-color: ",";\n"])),function(i){return i.theme.webcam.floatButton;});tP=function tP(i){return u1["default"].createElement(Fet,_objectSpread({},i),u1["default"].createElement(Oet,null));};});var Zl,iP,_n,Wp;var rP=d(function(){Zl=y(_("styled-components"));it();iP=Zl["default"].div(_templateObject137||(_templateObject137=_taggedTemplateLiteral(["\n display: inline-flex;\n"])));_n=(0,Zl["default"])(Bo)(_templateObject138||(_templateObject138=_taggedTemplateLiteral(["\n background: ",";\n color: ",";\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n padding: 4px 10px;\n position: relative;\n /* for safari */\n margin: 0;\n &:last-child:after {\n opacity: 0;\n }\n"])),function(i){return i.theme.canvasActionBar.background;},function(i){return i.theme.canvasActionBar.foreground;},function(i){return i.theme.measurements.fontSystem.button2.size;},function(i){return i.theme.measurements.fontSystem.button2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.button2["case"];});Wp=Zl["default"].div(_templateObject139||(_templateObject139=_taggedTemplateLiteral(["\n ",";\n position: absolute;\n transform: translate(-50%, -100%);\n background: ",";\n color: ",";\n border-radius: ","px;\n white-space: nowrap;\n transition: opacity 0.3s ease-in-out;\n z-index: ",";\n\n "," {\n &:after {\n content: '';\n position: absolute;\n right: 0px;\n top: 6px;\n height: calc(100% - 12px);\n border-right: 1px solid\n ",";\n &:last-child {\n border-right: unset;\n }\n }\n }\n"])),function(_ref55){var i=_ref55.show;return i?Zl.css(_templateObject140||(_templateObject140=_taggedTemplateLiteral(["\n opacity: 1;\n "]))):Zl.css(_templateObject141||(_templateObject141=_taggedTemplateLiteral(["\n opacity: 0;\n "])));},function(i){return i.theme.canvasActionBar.background;},function(i){return i.theme.canvasActionBar.foreground;},function(i){return i.theme.canvasActionBar.borderRadius?i.theme.canvasActionBar.borderRadius:i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.zIndex.buttonGroup;},_n,function(i){return i.theme.canvasActionBar.separatorColor;});});var yy=d(function(){Q5();eP();rP();});function D(){return(0,oP.useContext)(tp);}var oP;var W=d(function(){oP=_("react");B();});var fs,Ret,nP;var sP=d(function(){fs=y(_("react"));Ret=function Ret(){return fs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},fs["default"].createElement("defs",null,fs["default"].createElement("path",{id:"photoeditorsdk-blacks-icon",d:"M24 12c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12m0 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10m4 12c0 2.788-2.326 3.879-7 3V18.5c4.148-.459 6.516.226 6.516 2.623 0 1.207-.492 1.998-1.512 2.474C27.504 23.999 28 24.619 28 26zm-5-6v3c2.244.068 2.775-.719 2.775-1.536 0-1.22-.531-1.812-2.775-1.464zm0 7.5c2.19.193 3.038-.04 3.038-1.484 0-1.37-1.096-1.695-3.038-1.516v3z"})),fs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},fs["default"].createElement("path",{d:"M0 0H48V48H0z"}),fs["default"].createElement("mask",{fill:"currentColor"},fs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-blacks-icon"})),fs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-blacks-icon"})));};nP=Ret;});var Fa,Aet,aP;var lP=d(function(){Fa=y(_("react"));Aet=function Aet(){return Fa["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},Fa["default"].createElement("defs",null,Fa["default"].createElement("path",{id:"photoeditorsdk-brightness-icon",d:"M22.185 33.836c.594.109 1.2.164 1.815.164v2c-.735 0-1.462-.066-2.175-.197zm5.58-.568l.753 1.852c-.675.275-1.375.487-2.093.635l-.402-1.96c.597-.122 1.18-.299 1.741-.527zm-9.446-1.037c.5.346 1.03.646 1.586.895l-.82 1.824c-.666-.3-1.303-.66-1.903-1.074zm12.884-1.295l1.44 1.388a12.06 12.06 0 01-1.65 1.429l-1.167-1.625a10.06 10.06 0 001.377-1.192zm-15.758-1.754c.316.52.679 1.01 1.083 1.464l-1.493 1.33a12.038 12.038 0 01-1.3-1.756zm17.97-1.802l1.882.676a11.948 11.948 0 01-.925 1.982l-1.727-1.008a9.948 9.948 0 00.77-1.65zM24 18c.091 0 .182.002.273.006L24 18a6.071 6.071 0 01.668.037l.192.024a5.974 5.974 0 011.847.585l.01.005a5.992 5.992 0 011.154.768A5.99 5.99 0 0130 24c0 3.309-2.691 6-6 6a5.985 5.985 0 01-4.404-1.929l.163.17a6.052 6.052 0 01-1.353-2.07A5.951 5.951 0 0118 24c0-3.309 2.691-6 6-6zm2.827 3.173l-5.654 5.654A3.988 3.988 0 0024 28c2.206 0 4-1.794 4-4a3.988 3.988 0 00-1.173-2.827zM14.08 25.268c.076.606.208 1.2.392 1.777l-1.905.608a11.936 11.936 0 01-.472-2.134zm21.885-2.192a12.16 12.16 0 01-.032 2.198l-1.989-.21a10.193 10.193 0 00.027-1.836zM12.522 20.49l1.912.584a9.943 9.943 0 00-.37 1.783l-1.987-.226c.083-.73.232-1.445.445-2.14zm22.059-2.155c.345.643.63 1.316.853 2.013l-1.905.608a9.934 9.934 0 00-.71-1.676zm-19.587-2.266l1.5 1.323c-.402.456-.762.948-1.075 1.47l-1.715-1.03c.376-.625.808-1.215 1.29-1.763zm16.272-1.62c.58.442 1.12.936 1.61 1.476l-1.479 1.346c-.41-.45-.859-.862-1.343-1.23zm-12.241-1.372l.83 1.82a9.986 9.986 0 00-1.58.903l-1.147-1.638a11.986 11.986 0 011.897-1.085zm7.7-.766c.714.166 1.408.396 2.076.688L28 14.832a9.916 9.916 0 00-1.727-.573zm-2.857-.31l.021 2c-.613.006-1.22.068-1.812.184l-.383-1.964a12.046 12.046 0 012.174-.22z"})),Fa["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Fa["default"].createElement("mask",null,Fa["default"].createElement("use",{xlinkHref:"#photoeditorsdk-brightness-icon"})),Fa["default"].createElement("use",{fillOpacity:"0.9",transform:"rotate(-45 24.039 24)",xlinkHref:"#photoeditorsdk-brightness-icon"})));};aP=Aet;});var gs,Bet,cP;var uP=d(function(){gs=y(_("react"));Bet=function Bet(){return gs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},gs["default"].createElement("defs",null,gs["default"].createElement("path",{id:"photoeditorsdk-clarity-icon",d:"M24 12L13 24.001 24 36l11-11.999L24 12zm-8.29 12.001H21l3-9.041 8.29 9.041-8.28 9.029L28 24.001h-7l2.99 9.029-8.28-9.029z"})),gs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},gs["default"].createElement("path",{d:"M0 0H48V48H0z"}),gs["default"].createElement("mask",{fill:"currentColor"},gs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-clarity-icon"})),gs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-clarity-icon"})));};cP=Bet;});var bs,Pet,dP;var mP=d(function(){bs=y(_("react"));Pet=function Pet(){return bs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},bs["default"].createElement("defs",null,bs["default"].createElement("path",{id:"photoeditorsdk-contrast-icon",d:"M24 34V14c5.51 0 10 4.49 10 10s-4.49 10-10 10m0-22c-6.62 0-12 5.38-12 12s5.38 12 12 12 12-5.38 12-12-5.38-12-12-12"})),bs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},bs["default"].createElement("path",{d:"M0 0H48V48H0z"}),bs["default"].createElement("mask",{fill:"currentColor"},bs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-contrast-icon"})),bs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-contrast-icon"})));};dP=Pet;});var ys,Met,pP;var hP=d(function(){ys=y(_("react"));Met=function Met(){return ys["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},ys["default"].createElement("defs",null,ys["default"].createElement("path",{id:"photoeditorsdk-exposure-icon",d:"M24 34V14c5.51 0 10 4.49 10 10s-4.49 10-10 10m0-22c6.62 0 12 5.38 12 12s-5.38 12-12 12-12-5.38-12-12 5.38-12 12-12zm-3.536 8.464l-2.121 2.122-2.121-2.122-1.414 1.415L16.929 24l-2.121 2.121 1.414 1.415 2.121-2.122 2.121 2.122 1.415-1.415L19.757 24l2.122-2.121-1.415-1.415zm5.304 4.597l4.242-4.243 1.415 1.414-4.243 4.243-1.414-1.414z"})),ys["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},ys["default"].createElement("path",{d:"M0 0H48V48H0z"}),ys["default"].createElement("mask",{fill:"currentColor"},ys["default"].createElement("use",{xlinkHref:"#photoeditorsdk-exposure-icon"})),ys["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",transform:"rotate(45 24 24)",xlinkHref:"#photoeditorsdk-exposure-icon"})));};pP=Met;});var _s,Let,fP;var gP=d(function(){_s=y(_("react"));Let=function Let(){return _s["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},_s["default"].createElement("defs",null,_s["default"].createElement("path",{id:"photoeditorsdk-gamma-icon",d:"M22.185 33.836c.594.109 1.2.164 1.815.164v2c-.735 0-1.462-.066-2.175-.197zm5.58-.568l.753 1.852c-.675.275-1.375.487-2.093.635l-.402-1.96c.597-.122 1.18-.299 1.741-.527zm-9.446-1.037c.5.346 1.03.646 1.586.895l-.82 1.824c-.666-.3-1.303-.66-1.903-1.074zm12.884-1.295l1.44 1.388a12.06 12.06 0 01-1.65 1.429l-1.167-1.625a10.06 10.06 0 001.377-1.192zm-15.758-1.754c.316.52.679 1.01 1.083 1.464l-1.493 1.33a12.038 12.038 0 01-1.3-1.756zm17.97-1.802l1.882.676a11.948 11.948 0 01-.925 1.982l-1.727-1.008a9.948 9.948 0 00.77-1.65zM24 18c.091 0 .182.002.273.006L24 18a6.071 6.071 0 01.668.037l.192.024a5.974 5.974 0 011.847.585l.01.005a5.992 5.992 0 011.154.768A5.99 5.99 0 0130 24c0 3.309-2.691 6-6 6a5.985 5.985 0 01-4.404-1.929l.163.17a6.052 6.052 0 01-1.353-2.07A5.951 5.951 0 0118 24c0-3.309 2.691-6 6-6zm2.827 3.173l-5.654 5.654A3.988 3.988 0 0024 28c2.206 0 4-1.794 4-4a3.988 3.988 0 00-1.173-2.827zM14.08 25.268c.076.606.208 1.2.392 1.777l-1.905.608a11.936 11.936 0 01-.472-2.134zm21.885-2.192a12.16 12.16 0 01-.032 2.198l-1.989-.21a10.193 10.193 0 00.027-1.836zM12.522 20.49l1.912.584a9.943 9.943 0 00-.37 1.783l-1.987-.226c.083-.73.232-1.445.445-2.14zm22.059-2.155c.345.643.63 1.316.853 2.013l-1.905.608a9.934 9.934 0 00-.71-1.676zm-19.587-2.266l1.5 1.323c-.402.456-.762.948-1.075 1.47l-1.715-1.03c.376-.625.808-1.215 1.29-1.763zm16.272-1.62c.58.442 1.12.936 1.61 1.476l-1.479 1.346c-.41-.45-.859-.862-1.343-1.23zm-12.241-1.372l.83 1.82a9.986 9.986 0 00-1.58.903l-1.147-1.638a11.986 11.986 0 011.897-1.085zm7.7-.766c.714.166 1.408.396 2.076.688L28 14.832a9.916 9.916 0 00-1.727-.573zm-2.857-.31l.021 2c-.613.006-1.22.068-1.812.184l-.383-1.964a12.046 12.046 0 012.174-.22z"})),_s["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},_s["default"].createElement("path",{d:"M0 0H48V48H0z"}),_s["default"].createElement("mask",{fill:"#fff"},_s["default"].createElement("use",{xlinkHref:"#photoeditorsdk-gamma-icon"})),_s["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-gamma-icon"})));};fP=Let;});var xs,zet,bP;var yP=d(function(){xs=y(_("react"));zet=function zet(){return xs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},xs["default"].createElement("defs",null,xs["default"].createElement("path",{id:"photoeditorsdk-highlights-icon",d:"M31.07 31.07A9.932 9.932 0 0124 34c-2.67 0-5.18-1.04-7.07-2.93l14.14-14.14c3.9 3.9 3.9 10.24 0 14.14m1.42-15.56A11.995 11.995 0 0024 12c-3.07 0-6.14 1.17-8.49 3.51-4.68 4.69-4.68 12.29 0 16.98C17.86 34.83 20.93 36 24 36c3.07 0 6.14-1.17 8.49-3.51 4.68-4.69 4.68-12.29 0-16.98"})),xs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},xs["default"].createElement("path",{d:"M0 0H48V48H0z"}),xs["default"].createElement("mask",{fill:"currentColor"},xs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-highlights-icon"})),xs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-highlights-icon"})));};bP=zet;});var vs,Uet,_P;var xP=d(function(){vs=y(_("react"));Uet=function Uet(){return vs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},vs["default"].createElement("defs",null,vs["default"].createElement("path",{id:"photoeditorsdk-saturation-icon",d:"M17 31c1.334 1.099 2 2.177 2 3.234 0 .797-.454 1.39-1.211 1.655-.165.057-.428.094-.789.111l-.172-.01a2.54 2.54 0 01-.617-.101C15.454 35.624 15 35.03 15 34.234c0-1.057.666-2.135 2-3.234zm8.7-6l-4.24 4H17v-3.81l.2-.19h8.5zm-.7-7.59l4.24 4.25L26.76 24h-8.54L25 17.41zm7.778-3.532a3 3 0 01.135 4.1l-.135.143-1.414 1.414 1.414 1.415-1.414 1.414-7.07-7.071 1.413-1.414 1.414 1.413 1.414-1.414a3.001 3.001 0 014.243 0z"})),vs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},vs["default"].createElement("path",{d:"M0 0H48V48H0z"}),vs["default"].createElement("mask",{fill:"currentColor"},vs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-saturation-icon"})),vs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-saturation-icon"})));};_P=Uet;});var Cs,Net,vP;var CP=d(function(){Cs=y(_("react"));Net=function Net(){return Cs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},Cs["default"].createElement("defs",null,Cs["default"].createElement("path",{id:"photoeditorsdk-shadows-icon",d:"M30.365 17.637l3.076 3.076c.382 1.09.566 2.234.56 3.387l-5.05-5.049-1.414 1.414 6.123 6.124a9.674 9.674 0 01-.792 2.036l-6.746-6.745-1.414 1.414 7.036 7.036c-.212.254-.43.502-.672.742-.24.24-.488.46-.742.672l-7.036-7.036-1.414 1.414 6.745 6.746a9.674 9.674 0 01-2.036.792l-6.124-6.123-1.414 1.414L24.101 34a10.012 10.012 0 01-3.388-.558l-3.076-3.076-.707.707c-3.896-3.896-3.896-10.246 0-14.142 3.896-3.896 10.246-3.896 14.142 0l-.707.707zm-14.849-2.12c-4.688 4.687-4.688 12.281 0 16.97a12.036 12.036 0 004.108 2.693c.064.022.127.057.191.078 4.264 1.577 9.242.658 12.671-2.772 3.43-3.429 4.35-8.407 2.772-12.67-.02-.065-.056-.128-.078-.192a12.036 12.036 0 00-2.694-4.108c-4.688-4.688-12.282-4.688-16.97 0z"})),Cs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Cs["default"].createElement("path",{d:"M0 0H48V48H0z"}),Cs["default"].createElement("mask",{fill:"currentColor"},Cs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-shadows-icon"})),Cs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-shadows-icon"})));};vP=Net;});var Ss,Het,SP;var wP=d(function(){Ss=y(_("react"));Het=function Het(){return Ss["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},Ss["default"].createElement("defs",null,Ss["default"].createElement("path",{id:"photoeditorsdk-sharpness-icon",d:"M24 12l11 24H13l11-24zm0 4.8V34h7.883L24 16.8z"})),Ss["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ss["default"].createElement("path",{d:"M0 0H48V48H0z"}),Ss["default"].createElement("mask",{fill:"currentColor"},Ss["default"].createElement("use",{xlinkHref:"#photoeditorsdk-sharpness-icon"})),Ss["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-sharpness-icon"})));};SP=Het;});var ws,Wet,TP;var kP=d(function(){ws=y(_("react"));Wet=function Wet(){return ws["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},ws["default"].createElement("defs",null,ws["default"].createElement("path",{id:"photoeditorsdk-temperature-icon",d:"M24 12a4 4 0 014 4v7.255a7 7 0 11-8 0V16a4 4 0 014-4zm0 2a2 2 0 00-2 2v8.298l-.856.597a5 5 0 105.712 0L26 24.298V16a2 2 0 00-2-2zm1 6v5.126A4.002 4.002 0 0124 33a4 4 0 01-1-7.874V20h2z"})),ws["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},ws["default"].createElement("path",{d:"M0 0H48V48H0z"}),ws["default"].createElement("mask",{fill:"currentColor"},ws["default"].createElement("use",{xlinkHref:"#photoeditorsdk-temperature-icon"})),ws["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-temperature-icon"})));};TP=Wet;});var Ts,Get,IP;var DP=d(function(){Ts=y(_("react"));Get=function Get(){return Ts["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"48",height:"48",viewBox:"0 0 48 48"},Ts["default"].createElement("defs",null,Ts["default"].createElement("path",{id:"photoeditorsdk-whites-icon",d:"M24 12c6.627 0 12 5.373 12 12s-5.373 12-12 12-12-5.373-12-12 5.373-12 12-12zm-2 6.46h-2c.221 4.539.762 9.051 1 11.04h1.5l1.5-5.52 1.5 5.52H27c.238-1.989.779-6.501 1-11.04h-2c-.051 1.071-.432 7.446-.5 7.973-.459-1.717-.541-3.111-1-4.811h-1c-.442 1.7-.541 2.975-1 4.811-.051-.527-.466-6.902-.5-7.973z"})),Ts["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ts["default"].createElement("path",{d:"M0 0H48V48H0z"}),Ts["default"].createElement("mask",{fill:"currentColor"},Ts["default"].createElement("use",{xlinkHref:"#photoeditorsdk-whites-icon"})),Ts["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-whites-icon"})));};IP=Get;});var Oa,Vet,EP;var FP=d(function(){Oa=y(_("react"));Vet=function Vet(){return Oa["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Oa["default"].createElement("defs",null,Oa["default"].createElement("path",{id:"photoeditorsdk-close-icon",d:"M21.583 0L24 2.416 14.416 12 24 21.584 21.583 24 12 14.416 2.417 24 0 21.584 9.584 12 0 2.416 2.417 0 12 9.584 21.583 0z"})),Oa["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Oa["default"].createElement("mask",{fill:"currentColor"},Oa["default"].createElement("use",{xlinkHref:"#photoeditorsdk-close-icon"})),Oa["default"].createElement("use",{fill:"currentColor",fillRule:"nonzero",xlinkHref:"#photoeditorsdk-close-icon"})));};EP=Vet;});function jet(){return Ra["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Ra["default"].createElement("defs",null,Ra["default"].createElement("path",{id:"photoeditorsdk-export-icon",d:"M22 1.5a1.5 1.5 0 011.493 1.356L23.5 3H22h1.5v17a1.5 1.5 0 01-1.5 1.5H12a1.5 1.5 0 01-1.493-1.356L10.5 20v-6h2v5.499h9v-16h-9V9h-2V3A1.5 1.5 0 0112 1.5h10zM6.15 5.817L7.634 7.3l-3.171 3.171h13.978v2H4.47l3.171 3.17-1.483 1.483L.5 11.467l5.65-5.65z"})),Ra["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ra["default"].createElement("mask",{fill:"#fff"},Ra["default"].createElement("use",{xlinkHref:"#photoeditorsdk-export-icon"})),Ra["default"].createElement("use",{fill:"currentcolor",fillOpacity:"0.9",transform:"rotate(90 12 11.5)",xlinkHref:"#photoeditorsdk-export-icon"})));}var Ra,OP;var RP=d(function(){Ra=y(_("react"));OP=jet;});var Aa,$et,AP;var BP=d(function(){Aa=y(_("react"));$et=function $et(){return Aa["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"25",height:"25",viewBox:"0 0 25 25"},Aa["default"].createElement("defs",null,Aa["default"].createElement("path",{id:"photoeditorsdk-redo-icon",d:"M4 10.065C4 4.506 8.365 0 13.75 0s9.75 4.506 9.75 10.065v9.29h-3v-9.29c0-3.849-3.022-6.968-6.75-6.968S7 6.217 7 10.065v7.741h3L5.5 24 1 17.806h3v-7.741z"})),Aa["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Aa["default"].createElement("mask",{fill:"currentColor"},Aa["default"].createElement("use",{xlinkHref:"#photoeditorsdk-redo-icon"})),Aa["default"].createElement("use",{fill:"currentColor",transform:"matrix(0 1 1 0 .25 -.25)",xlinkHref:"#photoeditorsdk-redo-icon"})));};AP=$et;});var Ba,Ket,PP;var MP=d(function(){Ba=y(_("react"));Ket=function Ket(){return Ba["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"25",height:"25",viewBox:"0 0 25 25"},Ba["default"].createElement("defs",null,Ba["default"].createElement("path",{id:"photoeditorsdk-undo-icon",d:"M4 10.065C4 4.506 8.365 0 13.75 0s9.75 4.506 9.75 10.065v9.29h-3v-9.29c0-3.849-3.022-6.968-6.75-6.968S7 6.217 7 10.065v7.741h3L5.5 24 1 17.806h3v-7.741z"})),Ba["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ba["default"].createElement("mask",{fill:"currentColor"},Ba["default"].createElement("use",{xlinkHref:"#photoeditorsdk-undo-icon"})),Ba["default"].createElement("use",{fill:"currentColor",transform:"rotate(90 12.25 12)",xlinkHref:"#photoeditorsdk-undo-icon"})));};PP=Ket;});function Xet(){return Pa["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",focusable:"false","aria-hidden":"true","aria-label":"Center Align",width:"26",height:"26"},Pa["default"].createElement("defs",null,Pa["default"].createElement("path",{id:"photoeditorsdk-align-center-icon",d:"M31.5 30v3h-15v-3h15zm4.5-7.5v3H12v-3h24zm0-7.5v3H12v-3h24z"})),Pa["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Pa["default"].createElement("mask",{fill:"#fff"},Pa["default"].createElement("use",{xlinkHref:"#photoeditorsdk-align-center-icon"})),Pa["default"].createElement("use",{fill:"currentColor",xlinkHref:"#photoeditorsdk-align-center-icon"})));}var Pa,LP;var zP=d(function(){Pa=y(_("react"));LP=Xet;});var Ma,qet,UP;var NP=d(function(){Ma=y(_("react"));qet=function qet(){return Ma["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",focusable:"false","aria-hidden":"true","aria-label":"Left Align",width:"26",height:"26"},Ma["default"].createElement("defs",null,Ma["default"].createElement("path",{id:"photoeditorsdk-align-left-icon",d:"M27 30v3H12v-3h15zm9-7.5v3H12v-3h24zm0-7.5v3H12v-3h24z"})),Ma["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ma["default"].createElement("mask",{fill:"#fff"},Ma["default"].createElement("use",{xlinkHref:"#photoeditorsdk-align-left-icon"})),Ma["default"].createElement("use",{fill:"currentColor",xlinkHref:"#photoeditorsdk-align-left-icon"})));};UP=qet;});function Yet(){return ks["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",width:"26",height:"26",focusable:"false","aria-hidden":"true","aria-label":"Right Align"},ks["default"].createElement("defs",null,ks["default"].createElement("path",{id:"photoeditorsdk-align-right-icon",d:"M27 30v3H12v-3h15zm9-7.5v3H12v-3h24zm0-7.5v3H12v-3h24z"})),ks["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},ks["default"].createElement("path",{d:"M0 0H48V48H0z"}),ks["default"].createElement("mask",{fill:"#fff"},ks["default"].createElement("use",{xlinkHref:"#photoeditorsdk-align-right-icon"})),ks["default"].createElement("use",{fill:"currentColor",transform:"matrix(-1 0 0 1 48 0)",xlinkHref:"#photoeditorsdk-align-right-icon"})));}var ks,HP;var WP=d(function(){ks=y(_("react"));HP=Yet;});var _i,Jet,GP;var VP=d(function(){_i=y(_("react"));Jet=function Jet(){return _i["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Adjustments",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},_i["default"].createElement("g",{fill:"none",fillRule:"evenodd"},_i["default"].createElement("g",null,_i["default"].createElement("g",{fill:"#D8D8D8",opacity:"0"},_i["default"].createElement("rect",{width:"48",height:"48"})),_i["default"].createElement("g",{transform:"translate(12 12)"},_i["default"].createElement("rect",{fill:"#D8D8D8",opacity:"0",width:"24",height:"24"}),_i["default"].createElement("g",{transform:"translate(2 13)",fill:"currentColor"},_i["default"].createElement("path",{d:"M3.02746439,4 C3.00931666,4.16416693 3,4.33099545 3,4.5 C3,4.66900455 3.00931666,4.83583307 3.02746439,5 L0,5 L0,4 L3.02746439,4 Z M13,4 L20,4 L20,5 L13,5 L13,4 Z",fillOpacity:"0.2"}),_i["default"].createElement("path",{d:"M5.09842503,6.29819429 C5.0340931,6.05140089 5,5.7851211 5,5.5 C5,3.56700338 6.56700338,2 8.5,2 C8.7851211,2 9.05140089,2.0340931 9.29819429,2.09842503 C10.0278893,2.64566496 10.5,3.5176988 10.5,4.5 C10.5,6.15685425 9.15685425,7.5 7.5,7.5 C6.5176988,7.5 5.64566496,7.02788926 5.09842503,6.29819429 Z M11.1637159,7.11349161 C10.874061,7.51881791 10.5188179,7.87406095 10.1134916,8.16371592 C10.5772175,7.93004328 10.9300433,7.5772175 11.1637159,7.11349161 Z",fillOpacity:"0.2"}),_i["default"].createElement("path",{d:"M7.5,7.5 C9.15685425,7.5 10.5,6.15685425 10.5,4.5 C10.5,2.84314575 9.15685425,1.5 7.5,1.5 C5.84314575,1.5 4.5,2.84314575 4.5,4.5 C4.5,6.15685425 5.84314575,7.5 7.5,7.5 Z M7.5,9 C5.01471863,9 3,6.98528137 3,4.5 C3,2.01471863 5.01471863,0 7.5,0 C9.98528137,0 12,2.01471863 12,4.5 C12,6.98528137 9.98528137,9 7.5,9 Z",fillOpacity:"0.87"})),_i["default"].createElement("g",{transform:"rotate(-180 11 5.5)",fill:"currentColor"},_i["default"].createElement("path",{d:"M11.9725356,4 L20,4 L20,5 L11.9725356,5 C11.9906833,4.83583307 12,4.66900455 12,4.5 C12,4.33099545 11.9906833,4.16416693 11.9725356,4 Z M0,4 L2,4 L2,5 L0,5 L0,4 Z",fillOpacity:"0.2"}),_i["default"].createElement("g",{transform:"rotate(-180 5 3.5)",fillOpacity:"0.2"},_i["default"].createElement("path",{d:"M0.0984250251,4.29819429 C0.0340930963,4.05140089 0,3.7851211 0,3.5 C0,1.56700338 1.56700338,0 3.5,0 C3.7851211,0 4.05140089,0.0340930963 4.29819429,0.0984250251 C5.02788926,0.645664963 5.5,1.5176988 5.5,2.5 C5.5,4.15685425 4.15685425,5.5 2.5,5.5 C1.5176988,5.5 0.645664963,5.02788926 0.0984250251,4.29819429 Z M6.16371592,5.11349161 C5.87406095,5.51881791 5.51881791,5.87406095 5.11349161,6.16371592 C5.5772175,5.93004328 5.93004328,5.5772175 6.16371592,5.11349161 Z"})),_i["default"].createElement("path",{d:"M7.5,7.5 C9.15685425,7.5 10.5,6.15685425 10.5,4.5 C10.5,2.84314575 9.15685425,1.5 7.5,1.5 C5.84314575,1.5 4.5,2.84314575 4.5,4.5 C4.5,6.15685425 5.84314575,7.5 7.5,7.5 Z M7.5,9 C5.01471863,9 3,6.98528137 3,4.5 C3,2.01471863 5.01471863,-3.6739404e-16 7.5,-3.6739404e-16 C9.98528137,-3.6739404e-16 12,2.01471863 12,4.5 C12,6.98528137 9.98528137,9 7.5,9 Z",fillOpacity:"0.87"}))))));};GP=Jet;});function Zet(){return La["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Brush",width:"48",height:"48",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},La["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},La["default"].createElement("path",{fillOpacity:"0.87",d:"M14.73 18.86C13.293 19.503 11.624 20 10 20 2 20 0 13 0 10c.486.972 2.37 5.848 7.537 4.165C7.873 17.125 10.427 19 13 19c.6 0 1.177-.05 1.73-.14zM8.422 8.63a7.352 7.352 0 00-1.127 1.616L2.401 3.705c-.215-.287-.178-.807.072-1.056l.088-.088L8.5 8.5l-.078.13z",opacity:"0.5",transform:"translate(12 12) translate(2 2)"}),La["default"].createElement("path",{fillOpacity:"0.87",d:"M7.295 10.246c-.27.526-.48 1.09-.615 1.68L1.2 4.603c-.663-.885-.564-2.24.212-3.015l.176-.176c.78-.78 2.121-.881 3.015-.212l7.245 5.421a6.088 6.088 0 00-1.67.624L3.706 2.401c-.294-.22-.801-.184-1.056.072l-.176.176c-.25.25-.287.769-.072 1.056l4.894 6.54z",transform:"translate(12 12) translate(2 2)"}),La["default"].createElement("path",{fillOpacity:"0.87",d:"M9.702 6.554c-.185-.869-.151-.71-.207-.955C8.88 2.902 8.145 2 6 2 3.98 2 2 4.08 2 6.5c0 2.294 1.835 4 4 4 1.545 0 2.915-.342 4.544-1.088-.332-.7-.578-1.619-.842-2.858z",opacity:"0.5",transform:"translate(12 12) translate(2 2) translate(7 7)"}),La["default"].createElement("path",{fillOpacity:"0.25",d:"M10.379 9.027c.053.135.108.263.165.385C8.914 10.158 7.545 10.5 6 10.5c-2.165 0-4-1.706-4-4 0-1.528.79-2.921 1.88-3.74-.882 2.084-1.025 6.482 6.499 6.267z",transform:"translate(12 12) translate(2 2) translate(7 7)"}),La["default"].createElement("path",{fillOpacity:"0.87",d:"M9.702 6.554c-.185-.869-.151-.71-.207-.955C8.88 2.902 8.145 2 6 2 3.98 2 2 4.08 2 6.5c0 2.294 1.835 4 4 4 1.545 0 2.915-.342 4.544-1.088-.332-.7-.578-1.619-.842-2.858zM6 12C3.239 12 .5 9.842.5 6.5S3.239.5 6 .5c6.5 0 4 8 7 9.342C11 10.947 8.761 12 6 12z",transform:"translate(12 12) translate(2 2) translate(7 7)"})));}var La,jP;var $P=d(function(){La=y(_("react"));jP=Zet;});var Po,Qet,KP;var XP=d(function(){Po=y(_("react"));Qet=function Qet(){return Po["default"].createElement("svg",{"aria-hidden":"true",focusable:"false","aria-label":"Filter",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},Po["default"].createElement("g",{fill:"none",fillRule:"evenodd"},Po["default"].createElement("g",null,Po["default"].createElement("g",{fill:"#D8D8D8",opacity:"0"},Po["default"].createElement("rect",{width:"48",height:"48"})),Po["default"].createElement("g",{transform:"translate(16 14)",fill:"currentColor"},Po["default"].createElement("g",null,Po["default"].createElement("path",{d:"M1.53468397,11.3244256 C2.30584171,10.1516526 4.0927284,8.69757613 8,10 C11.5643313,11.1881104 13.1877038,10.2588113 13.9183327,9.30853287 C14.2918933,10.1286474 14.5,11.0400207 14.5,12 C14.5,15.5898509 11.5898509,18.5 8,18.5 C4.41014913,18.5 1.5,15.5898509 1.5,12 C1.5,11.7718729 1.51175212,11.5464906 1.53468397,11.3244256 Z",fillOpacity:"0.2"}),Po["default"].createElement("path",{d:"M1.53471819,12.6759057 C2.39408133,13.5811739 4.12541941,14.1109247 5.5,13.5 C9.81068889,11.5841383 9.99203585,9.66827654 14.3948028,10.8290113 C14.4639074,11.2088572 14.5,11.6002137 14.5,12 C14.5,15.5898509 11.5898509,18.5 8,18.5 C4.63838968,18.5 1.87279864,15.9481381 1.53471819,12.6759057 Z",fillOpacity:"0.25"}),Po["default"].createElement("path",{d:"M11,1.44328993e-15 L11,4.58151705 C13.9318303,5.7682918 16,8.64262245 16,12 C16,16.418278 12.418278,20 8,20 C3.581722,20 0,16.418278 0,12 C0,8.64262245 2.06816966,5.7682918 5,4.58151705 L5,1.60982339e-15 L6.5,1.44328993e-15 L6.5,5.67393184 C3.6333,6.35109564 1.5,8.92641836 1.5,12 C1.5,15.5898509 4.41014913,18.5 8,18.5 C11.5898509,18.5 14.5,15.5898509 14.5,12 C14.5,8.92641836 12.3667,6.35109564 9.5,5.67393184 L9.5,1.77635684e-15 L11,1.44328993e-15 Z",fillOpacity:"0.87"}))))));};KP=Qet;});var eo,tit,qP;var YP=d(function(){eo=y(_("react"));tit=function tit(){return eo["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Focus",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},eo["default"].createElement("g",{fill:"none",fillRule:"evenodd"},eo["default"].createElement("g",null,eo["default"].createElement("g",{fill:"#D8D8D8",opacity:"0"},eo["default"].createElement("rect",{width:"48",height:"48"})),eo["default"].createElement("g",{transform:"translate(12 12)"},eo["default"].createElement("rect",{fill:"#D8D8D8",opacity:"0",width:"24",height:"24"}),eo["default"].createElement("g",{transform:"translate(4 2)",fill:"currentColor"},eo["default"].createElement("path",{d:"M8.51312274,19.9836057 C8.77273397,19.9669655 9.02898229,19.9377873 9.2812837,19.8966625 C9.14309542,19.9643562 9.04607398,20 9,20 C8.83633495,20 8.67398178,19.9944755 8.51312274,19.9836057 Z M2.27242753,15.0235117 C2.09503729,14.4174909 2,13.7771617 2,13.115 C2,8.89625769 7.39855682,4.1952443 9.03524007,2.8669743 C9.66704719,3.45933018 10.2896864,4.09178959 10.8802638,4.75434357 C12.9939648,7.12565193 14.310818,9.45010207 14.481291,11.4644804 C14.4937541,11.6117488 14.5,11.7569175 14.5,11.9 C14.5,15.5490785 11.5855665,18.5 8,18.5 C5.525182,18.5 3.37015673,17.0943182 2.27242753,15.0235117 Z M15.999821,11.9547651 C15.9999402,11.9698392 16,11.9849176 16,12 C16,12.0581275 15.9984809,12.1163475 15.9954873,12.1746435 C15.9978914,12.1015915 15.9993401,12.0282946 15.999821,11.9547651 Z",fillOpacity:"0.2"}),eo["default"].createElement("path",{d:"M3.47269084,16.6357644 C3.47244857,13.6389249 9.59189484,15.3529683 12,11.5 C13.2066771,9.56931667 12.316614,7.05620551 11.0727604,4.97270186 C13.0737756,7.26814668 14.316054,9.51197209 14.481291,11.4644804 C14.4937541,11.6117488 14.5,11.7569175 14.5,11.9 C14.5,15.5490785 11.5855665,18.5 8,18.5 C6.2411126,18.5 4.64375705,17.7899702 3.47269084,16.6357644 Z",fillOpacity:"0.25"}),eo["default"].createElement("path",{d:"M7.73975027,2.16383649 C6.84545319,2.94914111 5.95084629,3.82194197 5.11973623,4.75434357 C3.00603518,7.12565193 1.68918197,9.45010207 1.51870896,11.4644804 C1.50624591,11.6117488 1.5,11.7569175 1.5,11.9 C1.5,15.5492218 4.41434886,18.5 8,18.5 C11.5855665,18.5 14.5,15.5490785 14.5,11.9 C14.5,11.7569175 14.4937541,11.6117488 14.481291,11.4644804 C14.310818,9.45010207 12.9939648,7.12565193 10.8802638,4.75434357 C10.0491537,3.82194197 9.15454681,2.94914111 8.26024973,2.16383649 C8.17157048,2.08596503 8.08476013,2.01060875 8,1.93784184 C7.91523987,2.01060875 7.82842952,2.08596503 7.73975027,2.16383649 Z M8,20 C3.581722,20 0,16.3735065 0,11.9 C0,6.05 8,0 8,0 C8,0 16,6.05 16,11.9 C16,16.3732777 12.418278,20 8,20 Z",fillOpacity:"0.87"}))))));};qP=tit;});var Ql,eit,JP;var ZP=d(function(){Ql=y(_("react"));eit=function eit(){return Ql["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",focusable:"false","aria-hidden":"true","aria-label":"Frames",width:"48",height:"48",viewBox:"0 0 48 48"},Ql["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(12 12)"},Ql["default"].createElement("path",{fillOpacity:"0.2",d:"M8 8L17 7 17 17 7 17z"}),Ql["default"].createElement("path",{fillOpacity:"0.87",d:"M4.5 19.5h15v-15h-15v15zM3 3h18v18H3V3z"}),Ql["default"].createElement("path",{fillOpacity:"0.87",d:"M7 17h10V7H7v10zM6 6h12v12H6V6z"}),Ql["default"].createElement("path",{fillOpacity:"0.25",d:"M9 15L11 12 13 14 14 13.5 15 15z"})));};JP=eit;});var Fr,iit,QP;var tM=d(function(){Fr=y(_("react"));iit=function iit(){return Fr["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Library",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},Fr["default"].createElement("g",{fill:"none",fillRule:"evenodd"},Fr["default"].createElement("g",{transform:"translate(15 15)",fill:"currentColor"},Fr["default"].createElement("g",null,Fr["default"].createElement("polygon",{fillOpacity:"0.2",points:"3 3 12.5 1.5 12.5 15.5 1.5 15.5"}),Fr["default"].createElement("path",{d:"M1.5,1.5 L1.5,15.5 L12.5,15.5 L12.5,1.5 L1.5,1.5 Z M0,0 L14,0 L14,17 L0,17 L0,0 Z",fillOpacity:"0.87"}),Fr["default"].createElement("polygon",{fillOpacity:"0.25",points:"3 11 6 7 8 9 9 8.5 11 11"}),Fr["default"].createElement("circle",{fillOpacity:"0.25",cx:"9",cy:"5",r:"1"}),Fr["default"].createElement("rect",{fillOpacity:"0.25",x:"3",y:"13",width:"8",height:"1"}),Fr["default"].createElement("g",{transform:"rotate(14 -2.352 56.952)",fillOpacity:"0.2"},Fr["default"].createElement("path",{d:"M1.32904158,1.07500967e-13 L5,1.07500967e-13 L5,14.7234101 L4,10.7126291 L4,1 L1.57836958,1 L1.32904158,1.07500967e-13 Z M5,14.9745817 L5,16 L0.887271787,16 L5,14.9745817 Z"}),Fr["default"].createElement("path",{d:"M1.82769758,2 L3,2 L3,6.70184819 L1.82769758,2 Z"}))))));};QP=iit;});var pd,rit,eM;var iM=d(function(){pd=y(_("react"));rit=function rit(){return pd["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Overlays",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},pd["default"].createElement("g",{fill:"none",fillRule:"evenodd"},pd["default"].createElement("g",{transform:"translate(15 15)",fill:"currentColor"},pd["default"].createElement("path",{d:"M13.5,4 L13.5,13.5 L4,13.5 L4,5 C4,4.44771525 4.44771525,4 5,4 L13.5,4 Z M15,4 L17,4 C17.5522847,4 18,4.44771525 18,5 L18,17 C18,17.5522847 17.5522847,18 17,18 L5,18 C4.44771525,18 4,17.5522847 4,17 L4,15 L14,15 C14.5522847,15 15,14.5522847 15,14 L15,4 Z",fillOpacity:"0.2"}),pd["default"].createElement("path",{d:"M1.5,1.5 L1.5,13.5 L13.5,13.5 L13.5,1.5 L1.5,1.5 Z M1,0 L14,0 C14.5522847,-1.01453063e-16 15,0.44771525 15,1 L15,14 C15,14.5522847 14.5522847,15 14,15 L1,15 C0.44771525,15 6.76353751e-17,14.5522847 0,14 L0,1 C-6.76353751e-17,0.44771525 0.44771525,1.01453063e-16 1,0 Z",fillOpacity:"0.87"}))));};eM=rit;});var xn,oit,rM;var oM=d(function(){xn=y(_("react"));oit=function oit(){return xn["default"].createElement("svg",{focusable:"false","aria-hidden":"true",width:"48px",height:"48px",version:"1.1",xmlns:"http://www.w3.org/2000/svg","aria-label":"Stickers",viewBox:"0 0 48 48"},xn["default"].createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},xn["default"].createElement("g",null,xn["default"].createElement("g",{transform:"translate(14.000000, 14.000000)",fill:"currentColor"},xn["default"].createElement("g",{transform:"translate(2.000000, 2.000000)",fillOpacity:"0.2"},xn["default"].createElement("path",{d:"M11.5840291,0.290311095 C14.1040281,1.4637822 15.9529364,3.83641178 16.3972985,6.6747443 C11.4538042,7.5567274 7.55733385,11.4556991 6.68374109,16.3973312 C3.83946575,15.9530468 1.46423317,14.1041207 0.290132399,11.5832649 C0.0988489957,10.7650202 3.01980663e-14,9.89786431 3.01980663e-14,9 C3.01980663e-14,6.64646143 0.903391324,4.50392121 2.38232909,2.90022422 C4.02683831,1.11698861 6.38297582,-3.55271368e-15 9,-3.55271368e-15 C9.89814387,-3.55271368e-15 10.7655602,0.0989105588 11.5840291,0.290311095 Z"}),xn["default"].createElement("path",{d:"M17.9877222,8 L8,17.9877222 C8.2591955,12.5923102 12.5906864,8.26470667 17.9877222,8 Z"})),xn["default"].createElement("path",{d:"M9.87290303,14.9211604 C9.09408801,14.4293124 5,11.7146562 5,9 C5,7.34 6.34,6 8,6 C8.77,6 9.47,6.52 10,7 C10.53,6.52 11.23,6 12,6 C13.66,6 15,7.34 15,9 C15,9.30171667 14.9494261,9.60343334 14.8584511,9.90209822 C12.7354304,11.0373368 10.9933363,12.7905402 9.87290303,14.9211604 Z",fillOpacity:"0.25"}),xn["default"].createElement("path",{d:"M10,1.5 C5.30557963,1.5 1.5,5.30557963 1.5,10 C1.5,14.2449983 4.61102233,17.7611603 8.68374109,18.3973312 C9.55733385,13.4556991 13.4538042,9.5567274 18.3972985,8.6747443 C17.7608961,4.60976745 14.2436106,1.5 10,1.5 Z M0,10 C0,4.4771525 4.4771525,0 10,0 C15.5228475,0 20,4.4771525 20,10 C14.5988732,10.2649073 10.2649073,14.5988732 10.0116954,19.9999933 C4.4771525,20 0,15.5228475 0,10 Z",fillOpacity:"0.87"})))));};rM=oit;});var hd,nit,nM;var sM=d(function(){hd=y(_("react"));nit=function nit(){return hd["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",focusable:"false","aria-hidden":"true","aria-label":"Texts",width:"48",height:"48"},hd["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},hd["default"].createElement("path",{fillOpacity:"0.2",d:"M17.883 19.5H16.07L11.702 6.833l1.235-1.411L17.883 19.5z",transform:"translate(12 12)"}),hd["default"].createElement("path",{fillOpacity:"0.87",d:"M10.8 8.818L8.483 14.5h4.275l-1.96-5.682zM10 6.5l3.5-4 5.973 17H21V21h-8v-1.5h1.483L13.276 16H7.873l-1.426 3.5H8V21H3v-1.5h1.704L10 6.5zm1.702.333L16.069 19.5h1.814L12.937 5.422l-1.235 1.411z",transform:"translate(12 12)"}),hd["default"].createElement("path",{fillOpacity:"0.2",d:"M19.55 15l-.35-1H21v1h-1.45zm1.05 3l-.35-1H21v1h-.4zM7.639 8L7.25 9H3V8h4.639zm1.167-3l-.39 1H7V5h1.806zm-2.334 6l-.389 1H6v-1h.472zm-1.166 3l-.39 1H3v-1h2.306zm-1.167 3l-.389 1H3v-1h1.139zM15.35 3L15 2h1v1h-.65zm3.15 9l-.35-1H21v1h-2.5zm-1.05-3l-.35-1H21v1h-3.55zM16.4 6l-.35-1H18v1h-1.6zm-5.9-3H9V2h2.5l-1 1zM3 5h3v1H3V5zm16 0h2v1h-2V5zM3 11h2v1H3v-1zm18-8h-4V2h4v1zM8 3H3V2h5v1z",transform:"translate(12 12)"})));};nM=nit;});var fd,sit,aM;var lM=d(function(){fd=y(_("react"));sit=function sit(){return fd["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Text Design",width:"48",height:"48",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg"},fd["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},fd["default"].createElement("path",{fillOpacity:"0.87",d:"M1 0h14a1 1 0 011 1v19l-8-6-8 6V1a1 1 0 011-1zm.5 1.5V17L8 12.125 14.5 17V1.5h-13z",transform:"translate(14 14) translate(2)"}),fd["default"].createElement("path",{fillOpacity:"0.2",d:"M1.5 1.5h13V17L8 12.125 1.5 17V1.5z",transform:"translate(14 14) translate(2)"}),fd["default"].createElement("path",{fillOpacity:"0.25",d:"M9 4l2.52 7H10.2l-.7-1.85H6.45L5.77 11H4.49L6.9 4H9zm-1.04.78h-.05L6.73 8.14H9.2L7.96 4.78z",transform:"translate(14 14) translate(2)"})));};aM=sit;});function ait(){return za["default"].createElement("svg",{focusable:"false","aria-hidden":"true","aria-label":"Transform",width:"48",height:"48",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48"},za["default"].createElement("g",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(12 12)"},za["default"].createElement("path",{fillOpacity:"0.2",d:"M10 10L15 9 15 15 9 15z"}),za["default"].createElement("path",{fillOpacity:"0.87",d:"M9 15h6V9H9v6zm-1.5 0V7.5H15V3h1.5v13.5H3V15h4.5zm0 2.5H9V21H7.5v-3.5zM21 7.5V9h-3.5V7.5H21z"}),za["default"].createElement("g",{fillOpacity:"0.2"},za["default"].createElement("path",{d:"M0 10h1a9.003 9.003 0 015.5-8.294L7 3 10.942.044C10.632.014 10.318 0 10 0 4.477 0 0 4.477 0 10z",transform:"translate(2 2)"}),za["default"].createElement("path",{d:"M9 20h1a9.003 9.003 0 015.5-8.294L16 13l3.942-2.956c-.31-.03-.624-.044-.942-.044-5.523 0-10 4.477-10 10z",transform:"translate(2 2) rotate(-180 14.47 15)"}))));}var za,cM;var uM=d(function(){za=y(_("react"));cM=ait;});var Ua,lit,dM;var mM=d(function(){Ua=y(_("react"));lit=function lit(){return Ua["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Ua["default"].createElement("defs",null,Ua["default"].createElement("path",{id:"photoeditorsdk-icon-add-text",d:"M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0zm1 6h-2v5H6v2h5v5h2v-5h5v-2h-5V6z"})),Ua["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ua["default"].createElement("mask",{fill:"currentColor"},Ua["default"].createElement("use",{xlinkHref:"#photoeditorsdk-icon-add-text"})),Ua["default"].createElement("use",{fill:"currentColor",fillRule:"nonzero",xlinkHref:"#photoeditorsdk-icon-add-text"})));};dM=lit;});var m1,cit,pM;var hM=d(function(){m1=y(_("react"));cit=function cit(){return m1["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},m1["default"].createElement("path",{fill:"currentColor",fillOpacity:"0.9",fillRule:"evenodd",stroke:"none",strokeWidth:"1",d:"M12 1c5.523 0 10 4.477 10 10a9.98 9.98 0 01-3.678 7.749c1.877.92 3.445 2.251 4.502 3.88l.176.283-1.743 1.02c-1.04-1.735-2.824-3.102-4.995-3.884A9.94 9.94 0 0112 21a9.962 9.962 0 01-4.255-.948c-2.076.748-3.797 2.033-4.852 3.661l-.147.237L1 22.935c1.053-1.766 2.694-3.204 4.684-4.183A9.975 9.975 0 012 11C2 5.477 6.477 1 12 1zm0 2a8 8 0 100 16 8 8 0 000-16zm0 5a5 5 0 110 10 5 5 0 010-10zm0 2a3 3 0 100 6 3 3 0 000-6zm1-4v1h-2V6h2z"}));};pM=cit;});var p1,uit,fM;var gM=d(function(){p1=y(_("react"));uit=function uit(){return p1["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},p1["default"].createElement("path",{fill:"currentColor",fillOpacity:"0.9",fillRule:"evenodd",stroke:"none",strokeWidth:"1",d:"M16.23 10.885a2.292 2.292 0 00-2.285-2.286 2.292 2.292 0 00-2.286 2.286 2.292 2.292 0 002.286 2.286 2.292 2.292 0 002.286-2.286zM13.946.599C8.265.6 3.66 5.205 3.66 10.885H.231l4.571 4.571 4.572-4.571H5.945c0-4.423 3.577-8 8-8s8 3.577 8 8a7.994 7.994 0 01-12.64 6.514l-1.623 1.646a10.3 10.3 0 006.263 2.126c5.68 0 10.286-4.606 10.286-10.286S19.625.599 13.945.599z",transform:"rotate(56 11.298 10.261)"}));};fM=uit;});function dit(){return Na["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Na["default"].createElement("defs",null,Na["default"].createElement("path",{id:"photoeditorsdk-shuffle-icon",d:"M24 10v8a3 3 0 01-3 3H6v3l-6-4 6-4v3h15a1 1 0 001-1v-8h2zM18 0l6 4-6 4V5H3a1 1 0 00-1 1v8H0V6a3 3 0 013-3h15V0z"})),Na["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Na["default"].createElement("mask",{fill:"currentColor"},Na["default"].createElement("use",{xlinkHref:"#photoeditorsdk-shuffle-icon"})),Na["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-shuffle-icon"})));}var Na,bM;var yM=d(function(){Na=y(_("react"));bM=dit;});var Ha,mit,_M;var xM=d(function(){Ha=y(_("react"));mit=function mit(){return Ha["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Ha["default"].createElement("defs",null,Ha["default"].createElement("path",{id:"photoeditorsdk-upload-icon",d:"M4.143 17.286l-.001 3.142h15.715v-3.142H23v6.285H1v-6.285h3.143zM12 0l9.429 9.429-2.2 2.2L13.57 5.97v9.743H10.43V5.971L4.77 11.63l-2.2-2.2L12 0z"})),Ha["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ha["default"].createElement("mask",{fill:"currentColor"},Ha["default"].createElement("use",{xlinkHref:"#photoeditorsdk-upload-icon"})),Ha["default"].createElement("use",{fill:"currentColor",xlinkHref:"#photoeditorsdk-upload-icon"})));};_M=mit;});var Is,pit,vM;var CM=d(function(){Is=y(_("react"));pit=function pit(){return Is["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Is["default"].createElement("defs",null,Is["default"].createElement("path",{id:"photoeditorsdk-bring-to-front-icon",d:"M21 16a2 2 0 012 2v4a2 2 0 01-2 2H3a2 2 0 01-2-2v-4a2 2 0 012-2h18zM12.006 1l5.996 5.996-1.414 1.414-3.578-3.577V12h-2.008V4.833L7.418 8.417 6.004 7.003 12.006 1z"})),Is["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Is["default"].createElement("path",{d:"M0 0H24V24H0z"}),Is["default"].createElement("mask",{fill:"currentColor"},Is["default"].createElement("use",{xlinkHref:"#photoeditorsdk-bring-to-front-icon"})),Is["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-bring-to-front-icon"})));};vM=pit;});var Je,hit,SM;var wM=d(function(){Je=y(_("react"));hit=function hit(_ref56){var _ref56$highlight=_ref56.highlight,i=_ref56$highlight===void 0?"currentColor":_ref56$highlight,_ref56$width=_ref56.width,t=_ref56$width===void 0?48:_ref56$width,_ref56$height=_ref56.height,e=_ref56$height===void 0?48:_ref56$height;return Je["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 48 48"},Je["default"].createElement("g",{fill:"none",fillOpacity:"0.9",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Je["default"].createElement("g",{fill:i,transform:"translate(13 13)"},Je["default"].createElement("path",{d:"M22 3.701h-1.642V1.644l-2.06-.001V0h2.538c.421 0 .682.174.827.32.322.322.337.748.337.83v2.551z"}),Je["default"].createElement("path",{d:"M1.643 3.701H0V1.165C0 .743.174.482.32.336.64.016 1.06 0 1.147 0H3.701v1.643H1.644l-.001 2.058z"}),Je["default"].createElement("path",{d:"M13.7232174 1.5486087L17.4249565 1.5486087 17.4249565 0 13.7232174 0z"}),Je["default"].createElement("path",{d:"M9.15008696 1.5486087L12.8508696 1.5486087 12.8508696 0 9.15008696 0z"}),Je["default"].createElement("path",{d:"M4.57504348 1.5486087L8.27678261 1.5486087 8.27678261 0 4.57504348 0z"}),Je["default"].createElement("path",{d:"M0 8.27582609L1.5486087 8.27582609 1.5486087 4.57504348 0 4.57504348z"}),Je["default"].createElement("path",{d:"M20.4513913 8.27582609L22 8.27582609 22 4.57504348 20.4513913 4.57504348z"}),Je["default"].createElement("path",{d:"M0 12.8508696L1.5486087 12.8508696 1.5486087 9.14913043 0 9.14913043z"}),Je["default"].createElement("path",{d:"M0 17.4249565L1.5486087 17.4249565 1.5486087 13.7232174 0 13.7232174z"}),Je["default"].createElement("path",{d:"M20.4513913 12.8508696L22 12.8508696 22 9.14913043 20.4513913 9.14913043z"}),Je["default"].createElement("path",{d:"M20.4513913 17.4249565L22 17.4249565 22 13.7232174 20.4513913 13.7232174z"}),Je["default"].createElement("path",{d:"M3.702 22H1.165c-.421 0-.682-.174-.828-.32-.322-.322-.337-.748-.337-.83v-2.552h1.643v2.059h2.059V22z"}),Je["default"].createElement("path",{d:"M20.853 22h-2.554v-1.642h2.057l.001-2.06H22v2.538c0 .42-.174.682-.319.827-.32.32-.742.337-.828.337"}),Je["default"].createElement("path",{d:"M4.57504348 22L8.27678261 22 8.27678261 20.4513913 4.57504348 20.4513913z"}),Je["default"].createElement("path",{d:"M9.15008696 22L12.8508696 22 12.8508696 20.4513913 9.15008696 20.4513913z"}),Je["default"].createElement("path",{d:"M13.7232174 22L17.4249565 22 17.4249565 20.4513913 13.7232174 20.4513913z"}))));};SM=hit;});var _y,fit,TM;var kM=d(function(){_y=y(_("react"));fit=function fit(_ref57){var _ref57$highlight=_ref57.highlight,i=_ref57$highlight===void 0?"currentColor":_ref57$highlight,_ref57$width=_ref57.width,t=_ref57$width===void 0?48:_ref57$width,_ref57$height=_ref57.height,e=_ref57$height===void 0?48:_ref57$height;return _y["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 48 48"},_y["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},_y["default"].createElement("path",{fill:i,d:"M29.967 13.005L26.984 13c-3.35 0-5.516 2.222-5.516 5.66v2.61h-2.999c-.26 0-.469.21-.469.47v3.78c0 .26.21.47.469.47h2.999v9.541c0 .26.21.469.469.469h3.912c.26 0 .47-.21.47-.469V25.99h3.506c.259 0 .469-.21.469-.47l.001-3.78a.47.47 0 00-.469-.47h-3.508v-2.212c0-1.064.254-1.603 1.639-1.603l2.01-.001c.258 0 .468-.21.468-.47v-3.51a.47.47 0 00-.468-.47z"})));};TM=fit;});var tc,git,IM;var DM=d(function(){tc=y(_("react"));git=function git(_ref58){var _ref58$highlight=_ref58.highlight,i=_ref58$highlight===void 0?"currentColor":_ref58$highlight,_ref58$width=_ref58.width,t=_ref58$width===void 0?48:_ref58$width,_ref58$height=_ref58.height,e=_ref58$height===void 0?48:_ref58$height;return tc["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 48 48"},tc["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},tc["default"].createElement("g",{fill:i,transform:"translate(13 13)"},tc["default"].createElement("path",{d:"M15.125 0h-8.25A6.876 6.876 0 000 6.875v8.25A6.876 6.876 0 006.875 22h8.25A6.876 6.876 0 0022 15.125v-8.25A6.876 6.876 0 0015.125 0zm4.813 15.125a4.818 4.818 0 01-4.813 4.813h-8.25a4.818 4.818 0 01-4.813-4.813v-8.25a4.818 4.818 0 014.813-4.813h8.25a4.818 4.818 0 014.813 4.813v8.25z"}),tc["default"].createElement("path",{d:"M11 5.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zm0 8.938A3.442 3.442 0 017.562 11 3.441 3.441 0 0111 7.562 3.441 3.441 0 0114.438 11 3.442 3.442 0 0111 14.438z"}),tc["default"].createElement("circle",{cx:"16.913",cy:"5.088",r:"1"}))));};IM=git;});var xy,bit,EM;var FM=d(function(){xy=y(_("react"));bit=function bit(_ref59){var _ref59$highlight=_ref59.highlight,i=_ref59$highlight===void 0?"currentColor":_ref59$highlight,_ref59$width=_ref59.width,t=_ref59$width===void 0?48:_ref59$width,_ref59$height=_ref59.height,e=_ref59$height===void 0?48:_ref59$height;return xy["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:e,viewBox:"0 0 48 48"},xy["default"].createElement("g",{fill:"none",fillOpacity:"0.9",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},xy["default"].createElement("path",{fill:i,d:"M36 17.305c-.892.402-1.843.668-2.835.797a4.997 4.997 0 002.165-2.79 9.685 9.685 0 01-3.12 1.222 4.874 4.874 0 00-3.595-1.596c-2.723 0-4.916 2.267-4.916 5.047 0 .4.032.785.113 1.151-4.09-.205-7.71-2.215-10.141-5.278a5.18 5.18 0 00-.673 2.55c0 1.748.877 3.297 2.185 4.194a4.766 4.766 0 01-2.223-.621v.055c0 2.452 1.705 4.49 3.942 4.958-.4.113-.837.167-1.29.167-.315 0-.633-.019-.931-.087.637 1.999 2.446 3.468 4.597 3.516a9.73 9.73 0 01-6.1 2.152c-.404 0-.791-.018-1.178-.07a13.601 13.601 0 007.548 2.266c9.054 0 14.004-7.693 14.004-14.36 0-.224-.008-.439-.018-.653A9.958 9.958 0 0036 17.305z"})));};EM=bit;});var OM,yit,Ni;var Wa=d(function(){OM=y(_("styled-components"));yit=OM["default"].svg.attrs({xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"})(_templateObject142||(_templateObject142=_taggedTemplateLiteral([""])));Ni=yit;});var oe,_it,RM;var AM=d(function(){oe=y(_("react"));Wa();_it=function _it(_ref60){var _ref60$highlight=_ref60.highlight,i=_ref60$highlight===void 0?"#565656":_ref60$highlight,_ref60$width=_ref60.width,t=_ref60$width===void 0?32:_ref60$width,_ref60$height=_ref60.height,e=_ref60$height===void 0?32:_ref60$height;return oe["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 32 32"},oe["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},oe["default"].createElement("g",{fill:i,transform:"translate(-8 -8)"},oe["default"].createElement("g",{transform:"translate(8 8)"},oe["default"].createElement("g",null,oe["default"].createElement("path",{d:"M.941 31.992h2.824v-.94L.941 31.05v-2.822h-.94v2.846s-.004.918.94.918"}),oe["default"].createElement("path",{d:"M31.974 31.051v-2.823h-.942v2.823h-2.823v.941h2.846s.919.003.919-.94"}),oe["default"].createElement("path",{d:"M4.62305882 31.9926588L8.38776471 31.9926588 8.38776471 31.0514824 4.62305882 31.0514824z"}),oe["default"].createElement("path",{d:"M9.32894118 31.9926588L13.0936471 31.9926588 13.0936471 31.0514824 9.32894118 31.0514824z"}),oe["default"].createElement("path",{d:"M14.0348235 31.9926588L17.7995294 31.9926588 17.7995294 31.0514824 14.0348235 31.0514824z"}),oe["default"].createElement("path",{d:"M18.7407059 31.9926588L22.5054118 31.9926588 22.5054118 31.0514824 18.7407059 31.0514824z"}),oe["default"].createElement("path",{d:"M23.4465882 31.9926588L27.2112941 31.9926588 27.2112941 31.0514824 23.4465882 31.0514824z"}),oe["default"].createElement("path",{d:"M0 .94v2.824h.941L.942.941h2.823V0H.919S0-.002 0 .94"}),oe["default"].createElement("path",{d:"M31.032 0H28.21v.94l2.823.002v2.822h.942V.92s.002-.92-.942-.92"}),oe["default"].createElement("path",{d:"M4.62305882 0.940423529L8.38776471 0.940423529 8.38776471 -0.000752941176 4.62305882 -0.000752941176z"}),oe["default"].createElement("path",{d:"M9.32894118 0.940423529L13.0936471 0.940423529 13.0936471 -0.000752941176 9.32894118 -0.000752941176z"}),oe["default"].createElement("path",{d:"M14.0348235 0.940423529L17.7995294 0.940423529 17.7995294 -0.000752941176 14.0348235 -0.000752941176z"}),oe["default"].createElement("path",{d:"M18.7407059 0.940423529L22.5054118 0.940423529 22.5054118 -0.000752941176 18.7407059 -0.000752941176z"}),oe["default"].createElement("path",{d:"M23.4465882 0.940423529L27.2112941 0.940423529 27.2112941 -0.000752941176 23.4465882 -0.000752941176z"}),oe["default"].createElement("path",{d:"M0 8.46324706L0.941176471 8.46324706 0.941176471 4.69854118 0 4.69854118z"}),oe["default"].createElement("path",{d:"M0 13.1691294L0.941176471 13.1691294 0.941176471 9.40442353 0 9.40442353z"}),oe["default"].createElement("path",{d:"M0 17.8750118L0.941176471 17.8750118 0.941176471 14.1103059 0 14.1103059z"}),oe["default"].createElement("path",{d:"M0 22.5808941L0.941176471 22.5808941 0.941176471 18.8161882 0 18.8161882z"}),oe["default"].createElement("path",{d:"M0 27.2867765L0.941176471 27.2867765 0.941176471 23.5220706 0 23.5220706z"}),oe["default"].createElement("path",{d:"M30.976 8.46324706L31.9171765 8.46324706 31.9171765 4.69854118 30.976 4.69854118z"}),oe["default"].createElement("path",{d:"M30.976 13.1691294L31.9171765 13.1691294 31.9171765 9.40442353 30.976 9.40442353z"}),oe["default"].createElement("path",{d:"M30.976 17.8750118L31.9171765 17.8750118 31.9171765 14.1103059 30.976 14.1103059z"}),oe["default"].createElement("path",{d:"M30.976 22.5808941L31.9171765 22.5808941 31.9171765 18.8161882 30.976 18.8161882z"}),oe["default"].createElement("path",{d:"M30.976 27.2867765L31.9171765 27.2867765 31.9171765 23.5220706 30.976 23.5220706z"}))))));};RM=_it;});var Gp,xit,BM;var PM=d(function(){Gp=y(_("react"));Wa();xit=function xit(_ref61){var _ref61$highlight=_ref61.highlight,i=_ref61$highlight===void 0?"#565656":_ref61$highlight,_ref61$width=_ref61.width,t=_ref61$width===void 0?32:_ref61$width,_ref61$height=_ref61.height,e=_ref61$height===void 0?48:_ref61$height;return Gp["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 42 32"},Gp["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Gp["default"].createElement("g",{fill:i,transform:"translate(-3 -8)"},Gp["default"].createElement("rect",{width:"42",height:"32",x:"3",y:"8",rx:"0.5"}))));};BM=xit;});var Vp,vit,MM;var LM=d(function(){Vp=y(_("react"));Wa();vit=function vit(_ref62){var _ref62$highlight=_ref62.highlight,i=_ref62$highlight===void 0?"#565656":_ref62$highlight,_ref62$width=_ref62.width,t=_ref62$width===void 0?26:_ref62$width,_ref62$height=_ref62.height,e=_ref62$height===void 0?46:_ref62$height;return Vp["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 26 46"},Vp["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Vp["default"].createElement("g",{fill:i,transform:"translate(-11 -1)"},Vp["default"].createElement("path",{d:"M1 11.496A.5.5 0 011.5 11h45a.5.5 0 01.5.496v25.008a.5.5 0 01-.5.496h-45a.5.5 0 01-.5-.496V11.496z",transform:"rotate(90 24 24)"}))));};MM=vit;});var jp,Cit,zM;var UM=d(function(){jp=y(_("react"));Wa();Cit=function Cit(_ref63){var _ref63$highlight=_ref63.highlight,i=_ref63$highlight===void 0?"#565656":_ref63$highlight,_ref63$width=_ref63.width,t=_ref63$width===void 0?26:_ref63$width,_ref63$height=_ref63.height,e=_ref63$height===void 0?46:_ref63$height;return jp["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 26 46"},jp["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},jp["default"].createElement("g",{fill:i,transform:"translate(-11 -1)"},jp["default"].createElement("path",{d:"M1 11.496A.5.5 0 011.5 11h45a.5.5 0 01.5.496v25.008a.5.5 0 01-.5.496h-45a.5.5 0 01-.5-.496V11.496z"}))));};zM=Cit;});var vn,Sit,NM;var HM=d(function(){vn=y(_("react"));Wa();Sit=function Sit(_ref64){var _ref64$highlight=_ref64.highlight,i=_ref64$highlight===void 0?"#565656":_ref64$highlight,_ref64$mask=_ref64.mask,t=_ref64$mask===void 0?"#fff":_ref64$mask,_ref64$width=_ref64.width,e=_ref64$width===void 0?32:_ref64$width,_ref64$height=_ref64.height,r=_ref64$height===void 0?32:_ref64$height;return vn["default"].createElement(Ni,{width:e,height:r,viewBox:"0 0 32 32"},vn["default"].createElement("defs",null,vn["default"].createElement("rect",{id:"photoeditorsdk-square-icon",width:"32",height:"32",x:"0.92",y:"0.707",rx:"1"})),vn["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},vn["default"].createElement("g",{transform:"translate(-8 -8)"},vn["default"].createElement("g",{transform:"translate(7.08 7.293)"},vn["default"].createElement("mask",{fill:t},vn["default"].createElement("use",{xlinkHref:"#photoeditorsdk-square-icon"})),vn["default"].createElement("use",{fill:i,xlinkHref:"#photoeditorsdk-square-icon"})))));};NM=Sit;});var $p,wit,WM;var GM=d(function(){$p=y(_("react"));Wa();wit=function wit(_ref65){var _ref65$highlight=_ref65.highlight,i=_ref65$highlight===void 0?"#565656":_ref65$highlight,_ref65$width=_ref65.width,t=_ref65$width===void 0?32:_ref65$width,_ref65$height=_ref65.height,e=_ref65$height===void 0?42:_ref65$height;return $p["default"].createElement(Ni,{width:t,height:e,viewBox:"0 0 32 42"},$p["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},$p["default"].createElement("g",{fill:i,transform:"translate(-8 -3)"},$p["default"].createElement("rect",{width:"42",height:"32",x:"3",y:"8",rx:"0.5",transform:"rotate(90 24 24)"}))));};WM=wit;});var Cn,Tit,VM;var jM=d(function(){Cn=y(_("react"));Tit=function Tit(_ref66){var _ref66$main=_ref66.main,i=_ref66$main===void 0?"#424242":_ref66$main,_ref66$highlight=_ref66.highlight,t=_ref66$highlight===void 0?"#565656":_ref66$highlight,_ref66$width=_ref66.width,e=_ref66$width===void 0?"48px":_ref66$width,_ref66$height=_ref66.height,r=_ref66$height===void 0?"48px":_ref66$height;return Cn["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Cn["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Cn["default"].createElement("rect",{width:"28",height:"3",x:"12",y:"41",fill:i,rx:"0.5",transform:"matrix(-1 0 0 1 52 0)"}),Cn["default"].createElement("rect",{width:"34",height:"28",x:"7",y:"8",fill:t,rx:"0.5",transform:"matrix(1 0 0 -1 0 44)"}),Cn["default"].createElement("rect",{width:"3",height:"3",x:"8",y:"41",fill:i,rx:"0.5",transform:"matrix(-1 0 0 1 19 0)"}),Cn["default"].createElement("rect",{width:"28",height:"3",x:"12",y:"37",fill:i,rx:"0.5",transform:"matrix(-1 0 0 1 52 0)"}),Cn["default"].createElement("rect",{width:"28",height:"3",x:"12",y:"4",fill:i,rx:"0.5",transform:"matrix(1 0 0 -1 0 11)"}),Cn["default"].createElement("rect",{width:"3",height:"3",x:"8",y:"37",fill:i,rx:"0.5",transform:"matrix(-1 0 0 1 19 0)"}),Cn["default"].createElement("rect",{width:"3",height:"3",x:"8",y:"4",fill:i,rx:"0.5",transform:"matrix(1 0 0 -1 0 11)"})));};VM=Tit;});var Sn,kit,$M;var KM=d(function(){Sn=y(_("react"));kit=function kit(_ref67){var _ref67$main=_ref67.main,i=_ref67$main===void 0?"#424242":_ref67$main,_ref67$highlight=_ref67.highlight,t=_ref67$highlight===void 0?"#565656":_ref67$highlight,_ref67$width=_ref67.width,e=_ref67$width===void 0?"48px":_ref67$width,_ref67$height=_ref67.height,r=_ref67$height===void 0?"48px":_ref67$height;return Sn["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Sn["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Sn["default"].createElement("g",null,Sn["default"].createElement("path",{fill:i,d:"M42 5a1 1 0 011 1v13a1 1 0 01-1 1H6a1 1 0 01-1-1V6a1 1 0 011-1h36zM21.505 18h-2.01a.494.494 0 00-.495.5c0 .268.222.5.495.5h2.01c.28 0 .495-.224.495-.5l-.008-.088a.503.503 0 00-.487-.412zm8.004 0h-5.018a.5.5 0 000 1h5.018a.5.5 0 00.491-.5l-.008-.088A.5.5 0 0029.51 18z"}),Sn["default"].createElement("rect",{width:"22",height:"11",x:"20",y:"29",fill:i,rx:"1"}),Sn["default"].createElement("rect",{width:"13",height:"10",x:"6",y:"23",fill:i,rx:"1"}),Sn["default"].createElement("rect",{width:"22",height:"5",x:"20",y:"23",fill:i,rx:"1"}),Sn["default"].createElement("rect",{width:"7",height:"7",x:"9",y:"14",fill:t,rx:"1"}),Sn["default"].createElement("rect",{width:"13",height:"9",x:"6",y:"34",fill:i,rx:"1"}))));};$M=kit;});var wn,Iit,XM;var qM=d(function(){wn=y(_("react"));Iit=function Iit(_ref68){var _ref68$main=_ref68.main,i=_ref68$main===void 0?"#424242":_ref68$main,_ref68$highlight=_ref68.highlight,t=_ref68$highlight===void 0?"#565656":_ref68$highlight,_ref68$width=_ref68.width,e=_ref68$width===void 0?"48px":_ref68$width,_ref68$height=_ref68.height,r=_ref68$height===void 0?"48px":_ref68$height;return wn["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},wn["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},wn["default"].createElement("g",{transform:"translate(5 5)"},wn["default"].createElement("path",{fill:t,d:"M37 0a1 1 0 011 1v13a1 1 0 01-1 1H1a1 1 0 01-1-1V1a1 1 0 011-1h36zM16.505 13h-2.01a.494.494 0 00-.495.5c0 .268.222.5.495.5h2.01c.28 0 .495-.224.495-.5l-.008-.088a.503.503 0 00-.487-.412zm8.004 0h-5.018a.5.5 0 000 1h5.018a.5.5 0 00.491-.5l-.008-.088A.5.5 0 0024.51 13z"}),wn["default"].createElement("rect",{width:"22",height:"11",x:"15",y:"24",fill:i,rx:"1"}),wn["default"].createElement("rect",{width:"13",height:"10",x:"1",y:"18",fill:i,rx:"1"}),wn["default"].createElement("rect",{width:"22",height:"5",x:"15",y:"18",fill:i,rx:"1"}),wn["default"].createElement("rect",{width:"7",height:"7",x:"4",y:"9",fill:i,rx:"1"}),wn["default"].createElement("rect",{width:"13",height:"9",x:"1",y:"29",fill:i,rx:"1"}))));};XM=Iit;});var Ds,Dit,YM;var JM=d(function(){Ds=y(_("react"));Dit=function Dit(_ref69){var _ref69$main=_ref69.main,i=_ref69$main===void 0?"#424242":_ref69$main,_ref69$highlight=_ref69.highlight,t=_ref69$highlight===void 0?"#565656":_ref69$highlight,_ref69$width=_ref69.width,e=_ref69$width===void 0?"48px":_ref69$width,_ref69$height=_ref69.height,r=_ref69$height===void 0?"48px":_ref69$height;return Ds["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Ds["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ds["default"].createElement("rect",{width:"26",height:"7",x:"7",y:"18",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"9",height:"7",x:"34",y:"11",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"9",height:"8",x:"34",y:"19",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"3",height:"3",x:"40",y:"6",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"26",height:"21",x:"7",y:"27",fill:i,rx:"1"}),Ds["default"].createElement("rect",{width:"26",height:"16",x:"7",y:"5",fill:t,rx:"1"})));};YM=Dit;});var Es,Eit,ZM;var QM=d(function(){Es=y(_("react"));Eit=function Eit(_ref70){var _ref70$main=_ref70.main,i=_ref70$main===void 0?"#424242":_ref70$main,_ref70$highlight=_ref70.highlight,t=_ref70$highlight===void 0?"#565656":_ref70$highlight,_ref70$width=_ref70.width,e=_ref70$width===void 0?"48px":_ref70$width,_ref70$height=_ref70.height,r=_ref70$height===void 0?"48px":_ref70$height;return Es["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Es["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Es["default"].createElement("rect",{width:"26",height:"7",x:"7",y:"34",fill:i,rx:"1"}),Es["default"].createElement("rect",{width:"26",height:"32",x:"7",y:"5",fill:t,rx:"1"}),Es["default"].createElement("rect",{width:"9",height:"7",x:"34",y:"11",fill:i,rx:"1"}),Es["default"].createElement("rect",{width:"9",height:"8",x:"34",y:"19",fill:i,rx:"1"}),Es["default"].createElement("rect",{width:"3",height:"3",x:"40",y:"6",fill:i,rx:"1"}),Es["default"].createElement("rect",{width:"26",height:"5",x:"7",y:"43",fill:i,rx:"1"})));};ZM=Eit;});var Fs,Fit,tL;var eL=d(function(){Fs=y(_("react"));Fit=function Fit(_ref71){var _ref71$main=_ref71.main,i=_ref71$main===void 0?"#424242":_ref71$main,_ref71$highlight=_ref71.highlight,t=_ref71$highlight===void 0?"#565656":_ref71$highlight,_ref71$width=_ref71.width,e=_ref71$width===void 0?"48px":_ref71$width,_ref71$height=_ref71.height,r=_ref71$height===void 0?"48px":_ref71$height;return Fs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Fs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Fs["default"].createElement("rect",{width:"26",height:"7",x:"7",y:"28",fill:i,rx:"1"}),Fs["default"].createElement("rect",{width:"26",height:"26",x:"7",y:"5",fill:t,rx:"1"}),Fs["default"].createElement("rect",{width:"9",height:"7",x:"34",y:"11",fill:i,rx:"1"}),Fs["default"].createElement("rect",{width:"9",height:"8",x:"34",y:"19",fill:i,rx:"1"}),Fs["default"].createElement("rect",{width:"3",height:"3",x:"40",y:"6",fill:i,rx:"1"}),Fs["default"].createElement("rect",{width:"26",height:"11",x:"7",y:"37",fill:i,rx:"1"})));};tL=Fit;});var Kp,Oit,iL;var rL=d(function(){Kp=y(_("react"));Oit=function Oit(_ref72){var _ref72$main=_ref72.main,i=_ref72$main===void 0?"#424242":_ref72$main,_ref72$highlight=_ref72.highlight,t=_ref72$highlight===void 0?"#565656":_ref72$highlight,_ref72$width=_ref72.width,e=_ref72$width===void 0?"48px":_ref72$width,_ref72$height=_ref72.height,r=_ref72$height===void 0?"48px":_ref72$height;return Kp["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Kp["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Kp["default"].createElement("rect",{width:"20",height:"34",x:"14",y:"10",fill:t,rx:"1.5"}),Kp["default"].createElement("rect",{width:"3",height:"3",x:"14",y:"5",fill:i,rx:"1"})));};iL=Oit;});var Hi,Rit,oL;var nL=d(function(){Hi=y(_("react"));Rit=function Rit(_ref73){var _ref73$main=_ref73.main,i=_ref73$main===void 0?"#424242":_ref73$main,_ref73$highlight=_ref73.highlight,t=_ref73$highlight===void 0?"#565656":_ref73$highlight,_ref73$shadow=_ref73.shadow,e=_ref73$shadow===void 0?"#333333":_ref73$shadow,_ref73$width=_ref73.width,r=_ref73$width===void 0?"48px":_ref73$width,_ref73$height=_ref73.height,o=_ref73$height===void 0?"48px":_ref73$height;return Hi["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:o,viewBox:"0 0 48 48"},Hi["default"].createElement("defs",null,Hi["default"].createElement("filter",{id:"photoeditorsdk-twitter-post-icon",width:"166.7%",height:"166.7%",x:"-33.3%",y:"-33.3%",filterUnits:"objectBoundingBox"},Hi["default"].createElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:"1"}))),Hi["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Hi["default"].createElement("rect",{width:"38",height:"15",x:"5",y:"5",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"24",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"26",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"28",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"26",height:"13",x:"17",y:"24",fill:t,rx:"0.5"}),Hi["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"38",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"42",fill:i,rx:"0.5"}),Hi["default"].createElement("rect",{width:"9",height:"9",x:"8",y:"13",fill:e,filter:"url(#photoeditorsdk-twitter-post-icon)",rx:"1"}),Hi["default"].createElement("rect",{width:"7",height:"7",x:"9",y:"14",fill:i,rx:"1"})));};oL=Rit;});var Mo,Ait,sL;var aL=d(function(){Mo=y(_("react"));Ait=function Ait(_ref74){var _ref74$main=_ref74.main,i=_ref74$main===void 0?"#424242":_ref74$main,_ref74$highlight=_ref74.highlight,t=_ref74$highlight===void 0?"#565656":_ref74$highlight,_ref74$width=_ref74.width,e=_ref74$width===void 0?"48px":_ref74$width,_ref74$height=_ref74.height,r=_ref74$height===void 0?"48px":_ref74$height;return Mo["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Mo["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Mo["default"].createElement("rect",{width:"38",height:"15",x:"5",y:"5",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"24",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"26",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"28",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"26",height:"13",x:"17",y:"24",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"38",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"42",fill:i,rx:"0.5"}),Mo["default"].createElement("rect",{width:"7",height:"7",x:"9",y:"14",fill:t,rx:"1"})));};sL=Ait;});var Lo,Bit,lL;var cL=d(function(){Lo=y(_("react"));Bit=function Bit(_ref75){var _ref75$main=_ref75.main,i=_ref75$main===void 0?"#424242":_ref75$main,_ref75$highlight=_ref75.highlight,t=_ref75$highlight===void 0?"#565656":_ref75$highlight,_ref75$width=_ref75.width,e=_ref75$width===void 0?"48px":_ref75$width,_ref75$height=_ref75.height,r=_ref75$height===void 0?"48px":_ref75$height;return Lo["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:r,viewBox:"0 0 48 48"},Lo["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Lo["default"].createElement("rect",{width:"38",height:"15",x:"5",y:"5",fill:t,rx:"0.5"}),Lo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"24",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"26",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"11",height:"1",x:"5",y:"28",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"26",height:"13",x:"17",y:"24",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"38",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"26",height:"3",x:"17",y:"42",fill:i,rx:"0.5"}),Lo["default"].createElement("rect",{width:"7",height:"7",x:"9",y:"14",fill:i,rx:"1"})));};lL=Bit;});var Ga,Pit,uL;var dL=d(function(){Ga=y(_("react"));Pit=function Pit(){return Ga["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Ga["default"].createElement("defs",null,Ga["default"].createElement("path",{id:"photoeditorsdk-delete-icon",d:"M20 6l-2.312 15.718A1.5 1.5 0 0116.204 23H5.796a1.5 1.5 0 01-1.484-1.282L2 6h18zM7 1a1 1 0 011-1h6a1 1 0 011 1v1h7v2H0V2h7V1z"})),Ga["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Ga["default"].createElement("mask",{fill:"currentColor"},Ga["default"].createElement("use",{xlinkHref:"#photoeditorsdk-delete-icon"})),Ga["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-delete-icon"})));};uL=Pit;});var Or,Mit,mL;var pL=d(function(){Or=y(_("react"));Mit=function Mit(_ref76){var _ref76$height=_ref76.height,i=_ref76$height===void 0?3:_ref76$height,_ref76$width=_ref76.width,t=_ref76$width===void 0?102:_ref76$width,_ref76$x=_ref76.x,e=_ref76$x===void 0?-102:_ref76$x,r=_ref76.className,o=_ref76.style;return Or["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:i,viewBox:"0 0 102 3",className:r,style:o},Or["default"].createElement("pattern",{id:"photoeditorsdk-slider-dots",fill:"currentColor",patternUnits:"userSpaceOnUse",width:"102",height:"3"},Or["default"].createElement("rect",{width:"3",height:"3",x:"99",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"88",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"77",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"66",y:"0",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"55",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"44",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"33",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"22",y:"0",opacity:"0.5",rx:"1.5"}),Or["default"].createElement("rect",{width:"3",height:"3",x:"11",y:"0",rx:"1.5"})),Or["default"].createElement("rect",{fill:"url(#photoeditorsdk-slider-dots)",x:-t*1.5,y:"0",width:t*4,height:"3",transform:"translate(".concat(e,", 0)")}));};mL=Mit;});var Va,Lit,hL;var fL=d(function(){Va=y(_("react"));Lit=function Lit(){return Va["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 24 24"},Va["default"].createElement("defs",null,Va["default"].createElement("path",{id:"photoeditorsdk-duplicate-icon",d:"M3.429 8.571v12h12v-12h-12zM1.714 5.143h15.429c.947 0 1.714.767 1.714 1.714v15.429c0 .946-.767 1.714-1.714 1.714H1.714A1.714 1.714 0 010 22.286V6.857c0-.947.768-1.714 1.714-1.714zM22.286 0C23.232 0 24 .768 24 1.714v15.429c0 .947-.768 1.714-1.714 1.714H20.57V3.429L5.142 3.428V1.714C5.143.768 5.91 0 6.858 0h15.429z"})),Va["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1"},Va["default"].createElement("mask",{fill:"currentColor"},Va["default"].createElement("use",{xlinkHref:"#photoeditorsdk-duplicate-icon"})),Va["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-duplicate-icon"})));};hL=Lit;});var h1,zit,gL;var bL=d(function(){h1=y(_("react"));zit=function zit(){return h1["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},h1["default"].createElement("path",{fill:"currentColor",fillRule:"evenodd",stroke:"none",strokeWidth:"1",d:"M2.087 7.115h7.66v15.32h5.027l.223-15.32h7.438V2.087H2.087v5.028zM14.075 24h-4.15a2.42 2.42 0 01-1.718-.711 2.423 2.423 0 01-.711-1.717V9.01H2.429c-.67 0-1.278-.273-1.718-.713A2.426 2.426 0 010 6.579V2.43C0 1.76.272 1.153.711.713A2.424 2.424 0 012.43 0h19.142c.671 0 1.278.272 1.718.713.439.44.711 1.047.711 1.718v4.148c0 .671-.272 1.278-.711 1.718-.44.44-1.047.713-1.718.713h-5.067v12.562c0 .67-.272 1.278-.711 1.717a2.42 2.42 0 01-1.718.711z"}));};gL=zit;});var Os,Uit,yL;var _L=d(function(){Os=y(_("react"));Uit=function Uit(_ref77){var i=_ref77.className;return Os["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 15 14",transform:"scale(-1, 1)",className:i},Os["default"].createElement("title",null,"Flip Horizontal"),Os["default"].createElement("defs",null,Os["default"].createElement("path",{id:"photoeditorsdk-flip-horizontal-icon",d:"M42 1v14h-1.167v-1.167H37a2 2 0 01-2-2V4.167a2 2 0 012-2l3.833-.001V1H42zm5.833 11.958a.875.875 0 01-.875.875h-3.791v-1.166l3.499-.001V3.333h-3.5V2.167h3.792c.446 0 .815.333.869.765l.006.11v9.916z"})),Os["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(-34 -1)"},Os["default"].createElement("mask",{fill:"none"},Os["default"].createElement("use",{xlinkHref:"#photoeditorsdk-flip-horizontal-icon"})),Os["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-flip-horizontal-icon"})));};yL=Uit;});var Rs,Nit,xL;var vL=d(function(){Rs=y(_("react"));Nit=function Nit(_ref78){var i=_ref78.className;return Rs["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 15 14",className:i},Rs["default"].createElement("title",null,"Flip Vertical"),Rs["default"].createElement("defs",null,Rs["default"].createElement("path",{id:"photoeditorsdk-flip-vertical-icon",d:"M42 1v14h-1.167v-1.167H37a2 2 0 01-2-2V4.167a2 2 0 012-2l3.833-.001V1H42zm5.833 11.958a.875.875 0 01-.875.875h-3.791v-1.166l3.499-.001V3.333h-3.5V2.167h3.792c.446 0 .815.333.869.765l.006.11v9.916z"})),Rs["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(-34 -1)"},Rs["default"].createElement("mask",{fill:"none"},Rs["default"].createElement("use",{xlinkHref:"#photoeditorsdk-flip-vertical-icon"})),Rs["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",transform:"rotate(-90 41.417 8)",xlinkHref:"#photoeditorsdk-flip-vertical-icon"})));};xL=Nit;});var As,Hit,CL;var SL=d(function(){As=y(_("react"));Hit=function Hit(_ref79){var _ref79$alt=_ref79.alt,i=_ref79$alt===void 0?"Rotate":_ref79$alt,t=_ref79.className;return As["default"].createElement("svg",{xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",width:"24",height:"24",viewBox:"0 0 16 16",className:t},As["default"].createElement("title",null,i),As["default"].createElement("defs",null,As["default"].createElement("path",{id:"photoeditorsdk-rotate-icon",d:"M132 0l1.25 1.57a8.01 8.01 0 0110.41.77 8.015 8.015 0 010 11.32c-.33.33-.67.62-1.04.859-1.38.991-3 1.481-4.62 1.481v-2c1.22 0 2.44-.37 3.47-1.111a6 6 0 00.77-9.129 5.992 5.992 0 00-7.73-.63L136 5h-5l1-5zm2.43 12.82c.5.38 1.06.67 1.66.87l-.64 1.89a7.56 7.56 0 01-1.48-.67l-.03-.01v-.01h-.02v-.01h-.01c0-.01-.01-.01-.01-.01h-.01v-.01h-.02v-.01h-.01l-.01-.01s-.01 0-.01-.01h-.01c-.2-.12-.4-.26-.6-.4zm-2.15-3.02c.18.6.47 1.17.83 1.68l-1.63 1.16v-.01s-.01 0-.01-.01c0 0 0-.01-.01-.01v-.01h-.01v-.01c-.01 0-.01-.01-.01-.01v-.01h-.01v-.01h-.01v-.01c0-.01-.01-.01-.01-.01v-.01c-.01 0-.01 0-.01-.01-.27-.39-.49-.79-.68-1.21-.01 0-.01-.01-.01-.01v-.01h-.01v-.02l-.01-.01c0-.02-.01-.02-.01-.02v-.02h-.01v-.02h-.01v-.03h-.01v-.02h-.01v-.02c-.01 0-.01 0-.01-.01v-.01c-.1-.23-.19-.47-.26-.7z"})),As["default"].createElement("g",{fill:"none",fillRule:"evenodd",stroke:"none",strokeWidth:"1",transform:"translate(-130)"},As["default"].createElement("mask",{fill:"none"},As["default"].createElement("use",{xlinkHref:"#photoeditorsdk-rotate-icon"})),As["default"].createElement("use",{fill:"currentColor",fillOpacity:"0.9",xlinkHref:"#photoeditorsdk-rotate-icon"})));};CL=Hit;});var vy,Cy,Re,Xp,Vt,wL;var we=d(function(){var _vy,_categories,_crops,_wL;R();sP();lP();uP();mP();hP();gP();yP();xP();CP();wP();kP();DP();FP();RP();BP();MP();zP();NP();WP();VP();$P();XP();YP();ZP();tM();iM();oM();sM();lM();uM();mM();hM();gM();yM();xM();CM();wM();kM();DM();FM();Wa();AM();PM();LM();UM();HM();GM();jM();KM();qM();JM();QM();eL();rL();nL();aL();cL();dL();pL();fL();bL();_L();vL();SL();vy=(_vy={},_defineProperty(_vy,"adjustment",GP),_defineProperty(_vy,"filter",KP),_defineProperty(_vy,"library",QP),_defineProperty(_vy,"overlay",eM),_defineProperty(_vy,"focus",qP),_defineProperty(_vy,"sticker",rM),_defineProperty(_vy,"text",nM),_defineProperty(_vy,"textdesign",aM),_defineProperty(_vy,"frame",JP),_defineProperty(_vy,"transform",cM),_defineProperty(_vy,"brush",jP),_vy);Cy={left:UP,right:HP,center:LP};Re={addText:dM,openWebcam:pM,reset:fM,shuffle:bM,uploadImage:_M};Xp={undo:PP,redo:AP,close:EP,"export":OP};Vt={categories:(_categories={},_defineProperty(_categories,"imgly_transforms_common",SM),_defineProperty(_categories,"imgly_transforms_facebook",TM),_defineProperty(_categories,"imgly_transforms_twitter",EM),_defineProperty(_categories,"imgly_transforms_instagram",IM),_categories),crops:(_crops={},_defineProperty(_crops,"imgly_transform_common_custom",RM),_defineProperty(_crops,"imgly_transform_common_square",NM),_defineProperty(_crops,"imgly_transform_common_3",WM),_defineProperty(_crops,"imgly_transform_common_4",BM),_defineProperty(_crops,"imgly_transform_common_9",MM),_defineProperty(_crops,"imgly_transform_common_16",zM),_defineProperty(_crops,"imgly_transform_facebook_post",VM),_defineProperty(_crops,"imgly_transform_facebook_profile",$M),_defineProperty(_crops,"imgly_transform_facebook_title",XM),_defineProperty(_crops,"imgly_transform_instagram_landscape",YM),_defineProperty(_crops,"imgly_transform_instagram_portrait",ZM),_defineProperty(_crops,"imgly_transform_instagram_square",tL),_defineProperty(_crops,"imgly_transform_instagram_story",iL),_defineProperty(_crops,"imgly_transform_twitter_post",oL),_defineProperty(_crops,"imgly_transform_twitter_profile",sL),_defineProperty(_crops,"imgly_transform_twitter_title",lL),_crops),dots:mL,duplicate:hL,edit:gL,bringToFront:vM,"delete":uL,flipHorizontal:yL,flipVertical:xL,rotate:CL};wL=(_wL={},_defineProperty(_wL,"brightness",aP),_defineProperty(_wL,"contrast",dP),_defineProperty(_wL,"saturation",_P),_defineProperty(_wL,"clarity",cP),_defineProperty(_wL,"shadows",vP),_defineProperty(_wL,"highlights",bP),_defineProperty(_wL,"exposure",pP),_defineProperty(_wL,"gamma",fP),_defineProperty(_wL,"blacks",nP),_defineProperty(_wL,"whites",IP),_defineProperty(_wL,"temperature",TP),_defineProperty(_wL,"sharpness",SP),_wL);});var TL,kL,Wit,ja;var f1=d(function(){TL=y(_("react"));kL=y(_("styled-components"));W();Wit=kL["default"].div(_templateObject143||(_templateObject143=_taggedTemplateLiteral(["\n display: flex;\n position: relative;\n flex-direction: column;\n width: 100%;\n height: 100%;\n max-width: calc(100% - ","px);\n"])),function(i){return i.maxWidth;});ja=function ja(_ref80){var i=_ref80.children;var _D2=D(),t=_D2.config;var e=0;if(t.isLayoutAdvanced){e=t.measurements.advancedUIToolbar.width+t.measurements.advancedUIToolControlBar.width;}return TL["default"].createElement(Wit,{maxWidth:e},i);};});var qp,IL;var DL=d(function(){qp=y(_("styled-components"));U();IL=qp["default"].div.attrs(function(){return{"data-test":N.MainCanvasActionBar};})(_templateObject144||(_templateObject144=_taggedTemplateLiteral(["\n &&& {\n display: ",";\n flex-direction: row;\n align-items: center;\n height: ","px;\n color: ",";\n border-bottom: 1px solid\n ",";\n padding: 8px 24px;\n box-sizing: border-box;\n position: absolute;\n width: 100%;\n z-index: ",";\n background: ",";\n ","\n }\n"])),function(i){return i.hide?"none":"flex";},function(i){return i.theme.measurements.mainCanvasActionBar.height;},function(i){return i.theme.mainCanvasActionBar.foreground;},function(i){return i.theme.mainCanvasActionBar.borderColor;},function(i){return i.theme.measurements.zIndex.canvas.bar;},function(i){return i.transparentBackgound?"transparent":i.theme.mainCanvasActionBar.background;},function(i){return i.bottom?qp.css(_templateObject145||(_templateObject145=_taggedTemplateLiteral(["\n justify-content: space-around;\n bottom: 0;\n transform: rotate(180deg);\n "]))):qp.css(_templateObject146||(_templateObject146=_taggedTemplateLiteral(["\n justify-content: space-between;\n "])));});});var EL,FL;var OL=d(function(){EL=y(_("styled-components"));FL=EL["default"].canvas(_templateObject147||(_templateObject147=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));});var RL,AL;var BL=d(function(){RL=y(_("styled-components"));AL=RL["default"].div.attrs({role:"main"})(_templateObject148||(_templateObject148=_taggedTemplateLiteral(["\n background-color: ",";\n flex-grow: 1;\n flex-shrink: 1;\n flex-basis: auto;\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n /* added this for safari, else the webcam overlay did not know the height */\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n margin-top: ","px;\n"])),function(i){return i.theme.canvas.background;},function(i){return i.theme.measurements.canvas.marginTop;});});var PL,ML;var LL=d(function(){PL=y(_("styled-components"));ML=PL["default"].div.attrs(function(_ref81){var i=_ref81.height,t=_ref81.width;return{style:{height:"".concat(i,"px"),width:"".concat(t,"px")}};})(_templateObject149||(_templateObject149=_taggedTemplateLiteral(["\n border-style: solid;\n border-width: 2px 0 2px 0;\n border-color: ",";\n box-shadow: 0 -6px 6px -6px rgba(0, 0, 0, 0.2),\n inset 0 6px 6px -6px rgba(0, 0, 0, 0.2);\n cursor: move;\n position: absolute;\n"])),function(i){return i.theme.canvas.controlsOutline;});});var zL,UL;var NL=d(function(){zL=y(_("styled-components"));UL=zL["default"].div.attrs(function(_ref82){var i=_ref82.radius;return{style:{height:"".concat(i*2,"px"),width:"".concat(i*2,"px")}};})(_templateObject150||(_templateObject150=_taggedTemplateLiteral(["\n border-radius: 50%;\n border: 2px solid ",";\n box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),\n inset 0 2px 6px 0 rgba(0, 0, 0, 0.2);\n cursor: move;\n"])),function(i){return i.theme.canvas.controlsOutline;});});var HL,WL;var GL=d(function(){HL=y(_("styled-components"));WL=HL["default"].div(_templateObject151||(_templateObject151=_taggedTemplateLiteral(["\n position: relative;\n height: inherit;\n width: inherit;\n"])));});var be,Git,Sy;var g1=d(function(){be=y(_("styled-components"));Git=be["default"].div(function(i){var _i$theme$measurements=i.theme.measurements.canvasControls.corner.touchable,t=_i$theme$measurements.desktop,e=_i$theme$measurements.mobile;var r=t/4;var o=e/2;return be.css(_templateObject152||(_templateObject152=_taggedTemplateLiteral(["\n position: absolute;\n width: ","px;\n height: ","px;\n ","\n ","\n ","\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n width: ","px;\n height: ","px;\n ","\n ","\n }\n "])),t,t,function(n){return n.vertical==="top"?be.css(_templateObject153||(_templateObject153=_taggedTemplateLiteral(["\n top: 0px;\n "]))):be.css(_templateObject154||(_templateObject154=_taggedTemplateLiteral(["\n bottom: 0px;\n "])));},function(n){return n.horizontal==="left"?be.css(_templateObject155||(_templateObject155=_taggedTemplateLiteral(["\n left: 0px;\n "]))):be.css(_templateObject156||(_templateObject156=_taggedTemplateLiteral(["\n right: 0px;\n "])));},function(n){return n.vertical==="top"?be.css(_templateObject157||(_templateObject157=_taggedTemplateLiteral(["\n margin-top: -","px;\n "])),r):be.css(_templateObject158||(_templateObject158=_taggedTemplateLiteral(["\n margin-bottom: -","px;\n "])),r);},function(n){return n.horizontal==="left"?be.css(_templateObject159||(_templateObject159=_taggedTemplateLiteral(["\n margin-left: -","px;\n "])),r):be.css(_templateObject160||(_templateObject160=_taggedTemplateLiteral(["\n margin-right: -","px;\n "])),r);},e,e,function(n){return n.vertical==="top"?be.css(_templateObject161||(_templateObject161=_taggedTemplateLiteral(["\n margin-top: -","px;\n "])),o):be.css(_templateObject162||(_templateObject162=_taggedTemplateLiteral(["\n margin-bottom: -","px;\n "])),o);},function(n){return n.horizontal==="left"?be.css(_templateObject163||(_templateObject163=_taggedTemplateLiteral(["\n margin-left: -","px;\n "])),o):be.css(_templateObject164||(_templateObject164=_taggedTemplateLiteral(["\n margin-right: -","px;\n "])),o);});});Sy=(0,be["default"])(Git)(function(i){var t=i.horizontal==="right"?i.borderWidth:0;var e=i.vertical==="bottom"?i.borderWidth:0;var r=i.horizontal==="left"?i.borderWidth:0;var o=i.vertical==="top"?i.borderWidth:0;var n="".concat(o,"px ").concat(t,"px ").concat(e,"px ").concat(r,"px");var s=i.horizontal==="left"&&i.vertical==="bottom"||i.horizontal==="right"&&i.vertical==="top"?"nesw-resize":"nwse-resize";var a=i.theme.measurements.canvasControls.corner.touchable.desktop/4-i.borderWidth;var l=i.theme.measurements.canvasControls.corner.touchable.mobile/4+i.borderWidth;return be.css(_templateObject165||(_templateObject165=_taggedTemplateLiteral(["\n &:before {\n display: block;\n position: absolute;\n content: '';\n width: ","px;\n height: ","px;\n z-index: ",";\n border-color: ",";\n border-style: solid;\n border-width: ",";\n pointer-events: auto;\n ","\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n ","\n }\n }\n cursor: ",";\n pointer-events: none;\n "])),function(c){return c.theme.measurements.canvasControls.corner.size;},function(c){return c.theme.measurements.canvasControls.corner.size;},function(c){return c.theme.measurements.zIndex.canvas.controls;},function(c){return c.theme.canvas.controlsColor;},n,i.vertical==="top"?be.css(_templateObject166||(_templateObject166=_taggedTemplateLiteral(["\n top: ","px;\n "])),a):be.css(_templateObject167||(_templateObject167=_taggedTemplateLiteral(["\n bottom: ","px;\n "])),a),i.horizontal==="left"?be.css(_templateObject168||(_templateObject168=_taggedTemplateLiteral(["\n left: ","px;\n "])),a):be.css(_templateObject169||(_templateObject169=_taggedTemplateLiteral(["\n right: ","px;\n "])),a),i.vertical==="top"?be.css(_templateObject170||(_templateObject170=_taggedTemplateLiteral(["\n margin-top: ","px;\n "])),l):be.css(_templateObject171||(_templateObject171=_taggedTemplateLiteral(["\n margin-bottom: ","px;\n "])),l),i.horizontal==="left"?be.css(_templateObject172||(_templateObject172=_taggedTemplateLiteral(["\n margin-left: ","px;\n "])),l):be.css(_templateObject173||(_templateObject173=_taggedTemplateLiteral(["\n margin-right: ","px;\n "])),l),s);});});var VL,jL;var $L=d(function(){VL=y(_("styled-components"));U();jL=VL["default"].div.attrs(function(){return{"data-test":N.Knob};})(_templateObject174||(_templateObject174=_taggedTemplateLiteral(["\n position: absolute;\n height: ","px;\n width: ","px;\n margin-left: -10px;\n margin-top: -10px;\n z-index: ",";\n will-change: transform;\n cursor: ew-resize;\n &:before {\n display: block;\n position: absolute;\n content: '';\n background: ",";\n border-radius: 50%;\n width: ","px;\n height: ","px;\n top: ","px;\n left: ","px;\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.24);\n }\n"])),function(i){return i.theme.measurements.canvasControls.knob.touchable.desktop;},function(i){return i.theme.measurements.canvasControls.knob.touchable.desktop;},function(i){return i.theme.measurements.zIndex.canvas.knob;},function(i){return i.theme.canvas.controlsColor;},function(i){return i.theme.measurements.canvasControls.knob.size;},function(i){return i.theme.measurements.canvasControls.knob.size;},function(i){return i.theme.measurements.canvasControls.knob.size/4;},function(i){return i.theme.measurements.canvasControls.knob.size/4;});});var KL,XL;var qL=d(function(){KL=y(_("styled-components"));XL=KL["default"].div(_templateObject175||(_templateObject175=_taggedTemplateLiteral(["\n position: absolute;\n color: ",";\n"])),function(i){return i.theme.canvas.controlsOutline;});});var YL,JL;var ZL=d(function(){YL=y(_("styled-components"));JL=YL["default"].div.attrs(function(i){return{style:{left:"".concat(i.x,"px")}};})(_templateObject176||(_templateObject176=_taggedTemplateLiteral(["\n position: absolute;\n bottom: -","px;\n height: ","px;\n width: 2px;\n background-color: ",";\n"])),function(i){return i.theme.measurements.canvasControls.sprite.rotateHandle.height;},function(i){return i.theme.measurements.canvasControls.sprite.rotateHandle.height;},function(i){return i.theme.canvas.controlsOutline;});});var QL,t4;var e4=d(function(){QL=y(_("styled-components"));t4=QL["default"].div.attrs(function(_ref83){var i=_ref83.height,t=_ref83.width,e=_ref83.theme;return{style:{height:"".concat(i+e.measurements.canvasControls.sprite.controlPadding,"px"),width:"".concat(t+e.measurements.canvasControls.sprite.controlPadding,"px")}};})(_templateObject177||(_templateObject177=_taggedTemplateLiteral(["\n left: -","px;\n top: -","px;\n transform-origin: center center;\n border-style: solid;\n border-width: 2px;\n border-color: ",";\n box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),\n inset 0 2px 6px 0 rgba(0, 0, 0, 0.2);\n cursor: move;\n will-change: transform;\n position: absolute;\n"])),function(i){return i.theme.measurements.canvasControls.sprite.controlPadding/2;},function(i){return i.theme.measurements.canvasControls.sprite.controlPadding/2;},function(i){return i.theme.canvas.controlsColor;});});var i4,r4;var o4=d(function(){i4=y(_("styled-components"));U();r4=i4["default"].div.attrs(function(){return{"data-test":N.TextWidth};})(_templateObject178||(_templateObject178=_taggedTemplateLiteral(["\n position: absolute;\n height: ","px;\n width: 4px;\n z-index: ",";\n background: ",";\n cursor: pointer;\n"])),function(i){return i.theme.measurements.canvasControls.width.size;},function(i){return i.theme.measurements.zIndex.canvas.controls;},function(i){return i.theme.canvas.controlsColor;});});var n4,s4;var a4=d(function(){n4=y(_("styled-components"));s4=n4["default"].div.attrs({tabIndex:0})(_templateObject179||(_templateObject179=_taggedTemplateLiteral(["\n position: absolute;\n height: ","px;\n width: ","px;\n top: 0;\n left: 0;\n &:focus {\n outline: 0;\n }\n"])),function(i){return i.height;},function(i){return i.width;});});var $a,wy,l4,c4,u4,ec;var b1=d(function(){$a=y(_("styled-components"));U();g1();wy=NF()?$a.css(_templateObject180||(_templateObject180=_taggedTemplateLiteral(["\n transition: unset;\n "]))):$a.css(_templateObject181||(_templateObject181=_taggedTemplateLiteral(["\n transition: all 0.4s ease-in-out;\n "])));l4=$a["default"].div(_templateObject182||(_templateObject182=_taggedTemplateLiteral(["\n position: absolute;\n background: ",";\n z-index: ",";\n ","\n"])),function(i){return i.theme.canvas.cropBackdrop;},function(i){return i.theme.measurements.zIndex.canvas.crop.backdrop;},wy);c4=$a["default"].div.attrs({"data-test":N.CropMask})(_templateObject183||(_templateObject183=_taggedTemplateLiteral(["\n position: absolute;\n box-shadow: inset 0 0 0 2px ",";\n cursor: move;\n ","\n"])),function(i){return i.theme.canvas.controlsOutline;},wy);u4=$a["default"].div(_templateObject184||(_templateObject184=_taggedTemplateLiteral(["\n position: absolute;\n background: ",";\n z-index: ",";\n ","\n"])),function(i){return i.theme.canvas.controlsOutline;},function(i){return i.theme.measurements.zIndex.canvas.crop.grid;},wy);ec=(0,$a["default"])(Sy)(_templateObject185||(_templateObject185=_taggedTemplateLiteral(["\n z-index: ",";\n ",";\n"])),function(i){return i.theme.measurements.zIndex.canvas.controls;},wy);});var d4,m4;var p4=d(function(){d4=y(_("styled-components"));m4=d4["default"].canvas(_templateObject186||(_templateObject186=_taggedTemplateLiteral(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));});var h4,f4;var g4=d(function(){h4=y(_("styled-components"));f4=h4["default"].video(_templateObject187||(_templateObject187=_taggedTemplateLiteral(["\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n"])));});var b4,y4;var _4=d(function(){b4=y(_("styled-components"));y4=b4["default"].div(_templateObject188||(_templateObject188=_taggedTemplateLiteral(["\n position: relative;\n transition: all 0.4s cubic-bezier(0.17, 0.04, 0.03, 0.94);\n height: 100%;\n width: 100%;\n z-index: ",";\n background-color: ",";\n"])),function(i){return i.theme.measurements.zIndex.canvas.webcam.backdrop;},function(i){return i.theme.webcam.background;});});var mt;var $e=d(function(){yy();f1();DL();OL();BL();LL();NL();GL();g1();$L();qL();ZL();e4();o4();a4();b1();p4();g4();_4();mt={Index:FL,Area:ja,Bar:{Index:IL,ButtonGroup:iP},Button:{TextSecondary:by,Float:tP},Container:AL,Element:m4,Wrapper:y4,Webcam:f4,Controls:{Knob:jL,Circle:UL,Corner:Sy,Line:XL,Area:ML,Sprite:t4,RotateHandle:JL,Container:WL,Wrapper:s4,SpriteActionsWrapper:Wp,SpriteActionButton:_n,Width:r4},Crop:{Mask:c4,GridLine:u4,Backdrop:l4,Control:ec}};});var ir={};de(ir,{FragmentPrecision:function FragmentPrecision(){return Ty;},ImageFormat:function ImageFormat(){return ic;},OptionType:function OptionType(){return K;},RenderType:function RenderType(){return Rr;},RendererType:function RendererType(){return Ke;},UniformType:function UniformType(){return le;}});var Rr,ic,K,le,Ke,Ty;var Ar=d(function(){Rr={IMAGE:"image",DATAURL:"data-url",BUFFER:"buffer",BLOB:"blob",MSBLOB:"ms-blob"};ic={PNG:"image/png",JPEG:"image/jpeg",RAW:"raw"};K=function(h){h["NUMBER"]="number";h["VECTOR2"]="vector2";h["COLOR_MATRIX"]="color-matrix";h["COLOR"]="color";h["ARRAY"]="array";h["OBJECT"]="object";h["STRING"]="string";h["BOOLEAN"]="boolean";h["CONFIGURABLE"]="configurable";h["IMAGE"]="image";h["FUNCTION"]="function";h["TEXTURE"]="texture";h["ALL"]="*";return h;}(K||{});le=function(x){x["SAMPLER2D"]="sampler2d";x["INT"]="i";x["INT1"]="1i";x["INT2"]="2i";x["INT3"]="3i";x["INT4"]="4i";x["FLOAT"]="f";x["FLOAT1"]="1f";x["FLOAT2"]="2f";x["FLOAT_VECTOR2"]="2fv";x["FLOAT3"]="3f";x["FLOAT4"]="4f";x["MAT3"]="mat3";x["MAT3FV"]="mat3fv";x["MAT4"]="mat4";return x;}(le||{});Ke=function(e){e["WEBGL"]="webgl";e["CANVAS"]="canvas";return e;}(Ke||{});Ty=function(r){r["High"]="highp";r["Medium"]="mediump";r["Low"]="lowp";return r;}(Ty||{});});var Yp,x4;var v4=d(function(){Yp=function Yp(){return document.createElement("canvas");};x4=function x4(i,t){var e=t||Yp();e.width=i.width;e.height=i.height;var r=e.getContext("2d");if(!r){throw new Error("Cannot render context");}r.clearRect(0,0,e.width,e.height);r.drawImage(i,0,0,i.width,i.height);return e;};});var gd;var y1=d(function(){gd=function gd(t,e,r){_classCallCheck(this,gd);this.width=t;this.height=e;this.data=r;};});var C4={};de(C4,{glGet:function glGet(){return ky;},webUtils:function webUtils(){return Kit;}});var ky,Vit,jit,$it,Kit;var S4=d(function(){v4();To();y1();ky=function ky(i){var t={preserveDrawingBuffer:true};return i.getContext("webgl",t)||i.getContext("experimental-webgl",t);};Vit=function Vit(){var i=Yp();var t=ky(i);var e=t.getParameter(t.MAX_TEXTURE_SIZE);var r=t.getExtension("WEBGL_lose_context");if(r){r.loseContext();}$t(i);return e;};jit=function jit(i,t){if(t instanceof gd){i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t.width,t.height,0,i.RGBA,i.UNSIGNED_BYTE,t.data);}else{var e=x4(t);i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e);$t(e);}};$it=function $it(i){return Boolean(i.tagName&&i.tagName.toUpperCase()==="IMG");};Kit={isSupported:function isSupported(){return Boolean(ky(Yp()));},isCanvas:function isCanvas(i){return i.constructor.name==="Canvas"||Boolean(i.tagName&&i.tagName.toUpperCase()==="CANVAS");},isImage:$it,Image:typeof window!=="undefined"?window.Image:void 0,glMaxTexture:Vit,glGet:ky,createCanvas:Yp,glResize:function glResize(i,t){return i;},glTexImage:jit};});var w4,pi,bd,_1,T4;var Tn=d(function(){Ar();if(true){w4=(S4(),Li(C4)).webUtils;}if(false){w4=null.serverUtils;}pi=w4;bd=function bd(i){return i._type==="webgl";};_1=function _1(i){return Boolean(i&&"tagName"in i&&i.tagName&&i.tagName.toUpperCase()==="CANVAS");};T4=function T4(i){return Boolean("tagName"in i&&i.tagName.toUpperCase()==="IMG");};});var _Iy,k4;var I4=d(function(){_Iy=/*#__PURE__*/function(){function Iy(){_classCallCheck(this,Iy);}_createClass(Iy,null,[{key:"head",value:function head(t){return t[0];}},{key:"tail",value:function tail(t){return t.slice(1);}},{key:"last",value:function last(t){return t[t.length-1];}},{key:"init",value:function init(t){return t.slice(0,t.length-1);}},{key:"remove",value:function remove(t,e){return t.filter(function(r,o,n){return!e(r,o,n);});}},{key:"findIndex",value:function findIndex(t,e){for(var r=0;rt){for(var o=t;o>2;s=(e&3)<<4|r>>4;a=(r&15)<<2|o>>6;l=o&63;if(isNaN(r)){a=l=64;}else if(isNaN(o)){l=64;}t=t+Ka.charAt(n)+Ka.charAt(s)+Ka.charAt(a)+Ka.charAt(l);e=r=o="";n=s=a=l="";}while(c256||/^[a-z0-9]$/i.test(T)?T:"%"+k.toString(16).toUpperCase();}).join("");}catch(T){return b;}});}(a.pathname):a.pathname),u.protocol==="about:"&&u.pathname==="blank"&&(u.protocol="",u.pathname=""),m&&i[0]!=="/"&&(u.pathname=u.pathname.substr(1)),s&&!C1.test(s)&&i.slice(-1)!=="/"&&u.pathname==="/"&&(u.pathname=""),u.path=u.pathname+u.search,u.auth=[a.username,a.password].map(decodeURIComponent).filter(Boolean).join(":"),u.port=a.port,c&&!u.host.endsWith(c)&&(u.host+=c,u.port=c.slice(1)),u.href=p?""+u.pathname+u.search+u.hash:Qp(u);var g=/^(file)/.test(u.href)?["host","hostname"]:[];return Object.keys(u).forEach(function(x){~g.indexOf(x)||(u[x]=u[x]||null);}),u;}var k1,Qit,S1,w1,T1,trt,ert,C1,irt,rrt,ort,nrt;var M4=d(function(){k1=y(B4(),1);Qit=/https?|ftp|gopher|file/;S1="http://";w1="w.w";T1=S1+w1;trt=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i;ert=/https?|ftp|gopher|file/;xd.prototype.parse=vd,xd.prototype.format=Qp,xd.prototype.resolve=P4,xd.prototype.resolveObject=P4;C1=/^https?|ftp|gopher|file/;irt=/^(.*?)([#?].*)/;rrt=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i;ort=/^([a-z0-9.+-]*:)?\/\/\/*/i;nrt=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i;});var srt,th,ro;var Cd=d(function(){M4();srt=5e3;th=typeof window!=="undefined"?window:global;ro=/*#__PURE__*/function(){function ro(t){_classCallCheck(this,ro);this._url=t;this._parsedUrl=vd(this._url,true);}_createClass(ro,[{key:"_isJSONPRequest",value:function _isJSONPRequest(){var t=this._parsedUrl.query;for(var e in t){var r=t[e];if(r==="?"){return true;}}return false;}},{key:"load",value:function load(){if(this._isJSONPRequest()){return this._loadJSONP();}return this._loadJSON();}},{key:"_loadJSON",value:function _loadJSON(){var _this36=this;return new Promise(function(t,e){var r;if(th.XDomainRequest){r=new th.XDomainRequest();r.onload=function(){var o=JSON.parse(r.responseText);t(o);};r.onerror=function(o){e(o);};r.open("GET",_this36._url,true);r.send();}else if(th.XMLHttpRequest){r=new XMLHttpRequest();r.onreadystatechange=function(o){if(r.readyState===4){if(r.status===200){var n=JSON.parse(r.responseText);t(n);}else{e(new Error("HTTP Status ".concat(r.status)));}}};r.open("GET",_this36._url,true);r.send();}});}},{key:"_loadJSONP",value:function _loadJSONP(){var _this37=this;var t=false;var e=false;var r="pesdk".concat(Math.round(Math.random()*99999999999999));return new Promise(function(o,n){var s=_this37._createJSONPNode(r);th[r]=function(a){_this37._removeJSONPNode(s);if(!t){e=true;o(a);}};th.setTimeout(function(){if(!e){_this37._removeJSONPNode(s);t=true;n(new Error("Timeout of 5 seconds exceeded."));}},srt);});}},{key:"_createJSONPNode",value:function _createJSONPNode(t){var e=this._buildJSONPUrl(t);var r=document.querySelector("head");var o=document.createElement("script");o.src=e;r.appendChild(o);return o;}},{key:"_removeJSONPNode",value:function _removeJSONPNode(t){t.parentNode.removeChild(t);}},{key:"_buildJSONPUrl",value:function _buildJSONPUrl(t){var e=this._parsedUrl.query;var r=null;for(var o in e){if(e[o]==="?"){r=o;break;}}delete this._parsedUrl.search;e[r]=t;return Qp(this._parsedUrl);}}]);return ro;}();});var I1={};de(I1,{ImageLoader:function ImageLoader(){return Wi;},JSONLoader:function JSONLoader(){return ro;}});var L4=d(function(){_d();Cd();});var _Gi,G;var oc=d(function(){_Gi=/*#__PURE__*/function(){function Gi(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;_classCallCheck(this,Gi);this.r=t;this.g=e;this.b=r;this.a=o;}_createClass(Gi,[{key:"toRGBA",value:function toRGBA(){var t=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255),this.a.toFixed(2)];return"rgba(".concat(t.join(","),")");}},{key:"set",value:function set(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this.a;this.r=t;this.g=e;this.b=r;this.a=o;return this;}},{key:"toRGB",value:function toRGB(){return[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)];}},{key:"toHex",value:function toHex(){var t=[this._componentToHex(Math.round(this.r*255)),this._componentToHex(Math.round(this.g*255)),this._componentToHex(Math.round(this.b*255))];return"#".concat(t.join(""));}},{key:"toGLColor",value:function toGLColor(){return[this.r,this.g,this.b,this.a];}},{key:"toArray",value:function toArray(){return this.toGLColor();}},{key:"toRGBGLColor",value:function toRGBGLColor(){return[this.r,this.g,this.b];}},{key:"toHSV",value:function toHSV(){var t=Math.max(this.r,this.g,this.b);var e=Math.min(this.r,this.g,this.b);var r;var o;var n=t;var s=t-e;o=t===0?0:s/t;if(t===e){r=0;}else{switch(t){case this.r:r=(this.g-this.b)/s;if(this.g3&&arguments[3]!==undefined?arguments[3]:1;var _ref87=[],n=_ref87[0],s=_ref87[1],a=_ref87[2];var l=Math.floor(t*6);var c=t*6-l;var u=r*(1-e);var m=r*(1-c*e);var p=r*(1-(1-c)*e);switch(l%6){case 0:n=r;s=p;a=u;break;case 1:n=m;s=r;a=u;break;case 2:n=u;s=r;a=p;break;case 3:n=u;s=m;a=r;break;case 4:n=p;s=u;a=r;break;case 5:n=r;s=u;a=m;break;}return new _Gi(n,s,a,o);}},{key:"fromArray",value:function fromArray(t){return new _Gi(t[0],t[1],t[2],t[3]);}},{key:"fromHex",value:function fromHex(t){var _t$match=t.match(/[0-9A-fa-f]{1,2}/g),_t$match2=_slicedToArray(_t$match,3),e=_t$match2[0],r=_t$match2[1],o=_t$match2[2];return new _Gi(parseInt(e,16)/255,parseInt(r,16)/255,parseInt(o,16)/255,1);}},{key:"TRANSPARENT",get:function get(){return new _Gi(0,0,0,0);}},{key:"WHITE",get:function get(){return new _Gi(1,1,1,1);}},{key:"BLACK",get:function get(){return new _Gi(0,0,0,1);}},{key:"RED",get:function get(){return new _Gi(1,0,0,1);}},{key:"BLUE",get:function get(){return new _Gi(0,0,1,1);}},{key:"GREEN",get:function get(){return new _Gi(0,1,0,1);}}]);return Gi;}();G=_Gi;});var art,z4,Vi;var Sd=d(function(){zo();art=12;z4=/*#__PURE__*/function(){function z4(){_classCallCheck(this,z4);this._maxListeners=art;this._events={};this._pipeDestinations=[];}_createClass(z4,[{key:"pipeEvents",value:function pipeEvents(t){this._pipeDestinations.push(t);}},{key:"unpipeEvents",value:function unpipeEvents(t){var e=this._pipeDestinations.indexOf(t);if(e===-1){return;}this._pipeDestinations.splice(e,1);}},{key:"on",value:function on(t,e){if(typeof t==="undefined"){throw new Error("Invalid event type: `".concat(t,"`"));}if(typeof e!=="function"){throw new TypeError();}var r=this._events[t]||(this._events[t]=[]);if(r.indexOf(e)!==-1){return this;}r.push(e);if(this._maxListeners&&r.length>this._maxListeners){Y.warn("EventEmitter","Possible memory leak detected, added ".concat(r.length," `").concat(t,"` listeners (current limit is ").concat(this._maxListeners,")"));if(typeof console!=="undefined"){console.trace();}}return this;}},{key:"once",value:function once(t,e){if(typeof t==="undefined"){throw new Error("Invalid event type: `".concat(t,"`"));}var r=this;function o(){r.off(t,o);e.apply(null,arguments);}return this.on(t,o);}},{key:"off",value:function off(t){if(typeof t==="undefined"){throw new Error("Invalid event type: `".concat(t,"`"));}if((arguments.length<=1?0:arguments.length-1)===0){this._events[t]=null;return this;}var r=arguments.length<=1?undefined:arguments[1];if(typeof r!=="function"){throw new TypeError();}var o=this._events[t];if(!o||!o.length){return this;}var n=o.indexOf(r);if(n===-1){return this;}o.splice(n,1);return this;}},{key:"emit",value:function emit(t){for(var _len8=arguments.length,e=new Array(_len8>1?_len8-1:0),_key8=1;_key8<_len8;_key8++){e[_key8-1]=arguments[_key8];}if(typeof t==="undefined"){throw new Error("Invalid event type: `".concat(t,"`"));}this._pipeDestinations.forEach(function(o){o.emit.apply(o,[t].concat(e));});var r=this._events[t];if(!r||!r.length){return false;}r.slice(0).forEach(function(o){return o.apply(null,e);});return true;}},{key:"setMaxListeners",value:function setMaxListeners(t){if(parseInt(t,10)!==t){throw new TypeError();}this._maxListeners=t;}}]);return z4;}();Vi=z4;});var nc;var D1=d(function(){zo();To();nc={checkFramebufferStatus:function checkFramebufferStatus(i,t){var _r5;var e=t.checkFramebufferStatus(t.FRAMEBUFFER);var r=(_r5={},_defineProperty(_r5,t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,"Incomplete attachment"),_defineProperty(_r5,t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,"Missing attachment"),_defineProperty(_r5,t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,"Incomplete dimensions"),_defineProperty(_r5,t.FRAMEBUFFER_UNSUPPORTED,"Framebuffer unsupported"),_r5);if(e!==t.FRAMEBUFFER_COMPLETE){Y.warn(i,"Framebuffer incomplete: ".concat(r[e]));}},determineGPUName:function determineGPUName(i){var t=null;var e=null;if(!i){e=document.createElement("canvas");i=e.getContext("experimental-webgl")||e.getContext("webgl");}var r=i&&i.getExtension("WEBGL_debug_renderer_info");if(r){t=i.getParameter(r.UNMASKED_RENDERER_WEBGL);e&&e.remove();}$t(e);return t;},isGPUBlacklisted:function isGPUBlacklisted(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return false;}};});var Dy;var U4=d(function(){Dy=function Dy(i){return typeof i==="number";};});var lrt,sc,Ey,_ot2;var Bs=d(function(){U4();lrt=function lrt(i){return i instanceof _ot2;};sc=function sc(i,t){if(lrt(i)){return{x:i.x,y:i.y};}return{x:i,y:Dy(t)?t:i};};Ey=function Ey(i,t){return function(e,r){var _sc=sc(e,r),o=_sc.x,n=_sc.y;i.x=t(i.x,o);i.y=t(i.y,n);return i;};};_ot2=/*#__PURE__*/function(){function ot(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,ot);this.add=Ey(this,function(t,e){return t+e;});this.subtract=Ey(this,function(t,e){return t-e;});this.divide=Ey(this,function(t,e){return t/e;});this.multiply=Ey(this,function(t,e){return t*e;});this.x=t;this.y=e;}_createClass(ot,[{key:"set",value:function set(t,e){var _sc2=sc(t,e),r=_sc2.x,o=_sc2.y;this.x=r;this.y=o;return this;}},{key:"clone",value:function clone(){return new _ot2(this.x,this.y);}},{key:"copy",value:function copy(t){this.x=t.x;this.y=t.y;return this;}},{key:"clamp",value:function clamp(t,e){if(Dy(t)){t=new _ot2(t,t);}if(Dy(e)){e=new _ot2(e,e);}if(t){this.x=Math.max(t.x,this.x);this.y=Math.max(t.y,this.y);}if(e){this.x=Math.min(e.x,this.x);this.y=Math.min(e.y,this.y);}return this;}},{key:"dot",value:function dot(t,e){var _sc3=sc(t,e),r=_sc3.x,o=_sc3.y;return this.x*r+this.y*o;}},{key:"equals",value:function equals(t,e){var _sc4=sc(t,e),r=_sc4.x,o=_sc4.y;return r===this.x&&o===this.y;}},{key:"flip",value:function flip(){var t=this.x;this.x=this.y;this.y=t;return this;}},{key:"round",value:function round(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this;}},{key:"ceil",value:function ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this;}},{key:"floor",value:function floor(){this.x|=0;this.y|=0;return this;}},{key:"abs",value:function abs(){this.x=Math.abs(this.x);this.y=Math.abs(this.y);return this;}},{key:"len",value:function len(){return Math.sqrt(this.x*this.x+this.y*this.y);}},{key:"min",value:function min(){return Math.min(this.x,this.y);}},{key:"max",value:function max(){return Math.max(this.x,this.y);}},{key:"toObject",value:function toObject(){return{x:this.x,y:this.y};}},{key:"toString",value:function toString(){return"Vector2({ x: ".concat(this.x,", y: ").concat(this.y," })");}},{key:"roundDecimal",value:function roundDecimal(t){this.x=parseFloat(this.x.toFixed(t));this.y=parseFloat(this.y.toFixed(t));return this;}},{key:"asArray",value:function asArray(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(t){return[this.y,this.x];}return[this.x,this.y];}}],[{key:"fromObject",value:function fromObject(t){return new _ot2(t.x,t.y);}},{key:"NULL",get:function get(){return new _ot2(0,0);}}]);return ot;}();});var _rr;var E1=d(function(){Bs();_rr=/*#__PURE__*/function(){function rr(){_classCallCheck(this,rr);this.a=1;this.b=0;this.c=0;this.d=1;this.tx=0;this.ty=0;this.reset();}_createClass(rr,[{key:"multiply",value:function multiply(t){var e;var r;var o;var n;var s;var a;e=this.a*t.a+this.b*t.c;r=this.a*t.b+this.b*t.d;o=this.c*t.a+this.d*t.c;n=this.c*t.b+this.d*t.d;s=this.tx*t.a+this.ty*t.c+t.tx;a=this.tx*t.b+this.ty*t.d+t.ty;this.a=e;this.b=r;this.c=o;this.d=n;this.tx=s;this.ty=a;return this;}},{key:"applyToVector",value:function applyToVector(t){var _t2=t,e=_t2.x,r=_t2.y;t=t.clone();t.x=this.a*e+this.c*r+this.tx;t.y=this.b*e+this.d*r+this.tx;return t;}},{key:"applyInverseToVector",value:function applyInverseToVector(t){var e=1/(this.a*this.d+this.c*-this.b);var _t3=t,r=_t3.x,o=_t3.y;t=t.clone();t.x=this.d*e*r+-this.c*e*o+(this.ty*this.c-this.tx*this.d)*e;t.y=this.a*e*o+-this.b*e*r+(-this.ty*this.a+this.tx*this.b)*e;return t;}},{key:"rectangleToCoordinates",value:function rectangleToCoordinates(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new _ot2(0,0);var r=t.width*(1-e.x);var o=t.width*-e.x;var n=t.height*(1-e.y);var s=t.height*-e.y;var a=[];a.push(new _ot2(this.a*o+this.c*s+this.tx,this.d*s+this.b*o+this.ty));a.push(new _ot2(this.a*r+this.c*s+this.tx,this.d*s+this.b*r+this.ty));a.push(new _ot2(this.a*r+this.c*n+this.tx,this.d*n+this.b*r+this.ty));a.push(new _ot2(this.a*o+this.c*n+this.tx,this.d*n+this.b*o+this.ty));return a;}},{key:"reset",value:function reset(){this.a=1;this.b=0;this.c=0;this.d=1;this.tx=0;this.ty=0;}},{key:"toArray",value:function toArray(){var t=[this.a,this.b,0,this.c,this.d,0,this.tx,this.ty,1];if(typeof Float32Array==="undefined"){return t;}return new Float32Array(t);}},{key:"toString",value:function toString(){return"Matrix({ a: ".concat(this.a,", b: ").concat(this.b,", c: ").concat(this.c,", d: ").concat(this.d,", tx: ").concat(this.tx,", ty: ").concat(this.ty," })");}}],[{key:"IDENTITY",get:function get(){return new _rr();}}]);return rr;}();});var _ce;var F1=d(function(){Bs();_ce=/*#__PURE__*/function(){function ce(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,ce);this.x=0;this.y=0;this.width=0;this.height=0;this.x=t;this.y=e;this.width=r;this.height=o;}_createClass(ce,[{key:"set",value:function set(t,e,r,o){this.x=t;this.y=e;this.width=r;this.height=o;return this;}},{key:"clone",value:function clone(){return new _ce(this.x,this.y,this.width,this.height);}},{key:"copy",value:function copy(t){this.x=t.x;this.y=t.y;this.width=t.width;this.height=t.height;return this;}},{key:"equals",value:function equals(t,e,r,o){if(t instanceof _ce){return t.x===this.x&&t.y===this.y&&t.width===this.width&&t.height===this.height;}return t===this.x&&e===this.y&&r===this.width&&o===this.height;}},{key:"translate",value:function translate(t,e){var _sc5=sc(t,e),r=_sc5.x,o=_sc5.y;this.x+=r;this.y+=o;return this;}},{key:"scale",value:function scale(t,e){var _sc6=sc(t,e),r=_sc6.x,o=_sc6.y;this.width*=r;this.height*=o;return this;}},{key:"round",value:function round(){this.x=Math.round(this.x);this.y=Math.round(this.y);this.width=Math.round(this.width);this.height=Math.round(this.height);return this;}},{key:"getPosition",value:function getPosition(){return new _ot2(this.x,this.y);}},{key:"getSize",value:function getSize(){return new _ot2(this.width,this.height);}},{key:"insetBy",value:function insetBy(t,e){this.x+=t;this.y+=e;this.width-=2*t;this.height-=2*e;return this;}},{key:"intersects",value:function intersects(t){var e=new _ot2(this.x,this.y);var r=new _ot2(this.x+this.width,this.y+this.height);var o=new _ot2(t.x,t.y);var n=new _ot2(t.x+t.width,t.y+t.height);if(o.x>r.x||e.x>n.x||n.y>tn;if(ht!==0){ht=255/ht;s[p]=(g*Qo>>tn)*ht;s[p+1]=(x*Qo>>tn)*ht;s[p+2]=(v*Qo>>tn)*ht;}else{s[p]=s[p+1]=s[p+2]=0;}g-=T;x-=k;v-=E;b-=A;T-=ae.r;k-=ae.g;E-=ae.b;A-=ae.a;u=h+((u=a+n+1)>tn;if(ht>0){ht=255/ht;s[u]=g*Qo>>tn;s[u+1]=x*Qo>>tn;s[u+2]=v*Qo>>tn;}else{s[u]=s[u+1]=s[u+2]=0;}g-=T;x-=k;v-=E;b-=A;T-=ae.r;k-=ae.g;E-=ae.b;A-=ae.a;u=a+((u=l+St)0&&arguments[0]!==undefined?arguments[0]:1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var s=arguments.length>5&&arguments[5]!==undefined?arguments[5]:0;var a=arguments.length>6&&arguments[6]!==undefined?arguments[6]:1;var l=arguments.length>7&&arguments[7]!==undefined?arguments[7]:0;var c=arguments.length>8&&arguments[8]!==undefined?arguments[8]:0;var u=arguments.length>9&&arguments[9]!==undefined?arguments[9]:0;var m=arguments.length>10&&arguments[10]!==undefined?arguments[10]:0;var p=arguments.length>11&&arguments[11]!==undefined?arguments[11]:0;var h=arguments.length>12&&arguments[12]!==undefined?arguments[12]:1;var g=arguments.length>13&&arguments[13]!==undefined?arguments[13]:0;var x=arguments.length>14&&arguments[14]!==undefined?arguments[14]:0;var v=arguments.length>15&&arguments[15]!==undefined?arguments[15]:0;var b=arguments.length>16&&arguments[16]!==undefined?arguments[16]:0;var T=arguments.length>17&&arguments[17]!==undefined?arguments[17]:0;var k=arguments.length>18&&arguments[18]!==undefined?arguments[18]:1;var E=arguments.length>19&&arguments[19]!==undefined?arguments[19]:0;_classCallCheck(this,Dn);this.set(t,e,r,o,n,s,a,l,c,u,m,p,h,g,x,v,b,T,k,E);}_createClass(Dn,[{key:"set",value:function set(t,e,r,o,n,s,a,l,c,u,m,p,h,g,x,v,b,T,k,E){this.a=t;this.b=e;this.c=r;this.d=o;this.e=n;this.f=s;this.g=a;this.h=l;this.i=c;this.j=u;this.k=m;this.l=p;this.m=h;this.n=g;this.o=x;this.p=v;this.q=b;this.r=T;this.s=k;this.t=E;}},{key:"reset",value:function reset(){this.a=1;this.b=0;this.c=0;this.d=0;this.e=0;this.f=0;this.g=1;this.h=0;this.i=0;this.j=0;this.k=0;this.l=0;this.m=1;this.n=0;this.o=0;this.p=0;this.q=0;this.r=0;this.s=1;this.t=0;}},{key:"apply",value:function apply(t){var e=this.a*t.r+this.b*t.g+this.c*t.b+this.d*t.a+this.e;var r=this.f*t.r+this.g*t.g+this.h*t.b+this.i*t.a+this.j;var o=this.k*t.r+this.l*t.g+this.m*t.b+this.n*t.a+this.o;var n=this.p*t.r+this.q*t.g+this.r*t.b+this.s*t.a+this.t;return new G(e,r,o,n);}},{key:"multiply",value:function multiply(t){var e;var r;var o;var n;var s;var a;var l;var c;var u;var m;var p;var h;var g;var x;var v;var b;var T;var k;var E;var A;var I=t;var F=this;e=I.a*F.a+I.b*F.f+I.c*F.k+I.d*F.p;r=I.a*F.b+I.b*F.g+I.c*F.l+I.d*F.q;o=I.a*F.c+I.b*F.h+I.c*F.m+I.d*F.r;n=I.a*F.d+I.b*F.i+I.c*F.n+I.d*F.s;a=I.f*F.a+I.g*F.f+I.h*F.k+I.i*F.p;l=I.f*F.b+I.g*F.g+I.h*F.l+I.i*F.q;c=I.f*F.c+I.g*F.h+I.h*F.m+I.i*F.r;u=I.f*F.d+I.g*F.i+I.h*F.n+I.i*F.s;p=I.k*F.a+I.l*F.f+I.m*F.k+I.n*F.p;h=I.k*F.b+I.l*F.g+I.m*F.l+I.n*F.q;g=I.k*F.c+I.l*F.h+I.m*F.m+I.n*F.r;x=I.k*F.d+I.l*F.i+I.m*F.n+I.n*F.s;b=I.p*F.a+I.q*F.f+I.r*F.k+I.s*F.p;T=I.p*F.b+I.q*F.g+I.r*F.l+I.s*F.q;k=I.p*F.c+I.q*F.h+I.r*F.m+I.s*F.r;E=I.p*F.d+I.q*F.i+I.r*F.n+I.s*F.s;s=I.a*F.e+I.b*F.j+I.c*F.o+I.d*F.t+I.e;m=I.f*F.e+I.g*F.j+I.h*F.o+I.i*F.t+I.j;v=I.k*F.e+I.l*F.j+I.m*F.o+I.n*F.t+I.o;A=I.p*F.e+I.q*F.j+I.r*F.o+I.s*F.t+I.t;this.a=e;this.b=r;this.c=o;this.d=n;this.e=s;this.f=a;this.g=l;this.h=c;this.i=u;this.j=m;this.k=p;this.l=h;this.m=g;this.n=x;this.o=v;this.p=b;this.q=T;this.r=k;this.s=E;this.t=A;return this;}},{key:"clone",value:function clone(){var t=new _Dn();t.set(this.a,this.b,this.c,this.d,this.e,this.f,this.g,this.h,this.i,this.j,this.k,this.l,this.m,this.n,this.o,this.p,this.q,this.r,this.s,this.t);return t;}},{key:"equals",value:function equals(t){return this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d&&this.e===t.e&&this.f===t.f&&this.g===t.g&&this.h===t.h&&this.i===t.i&&this.j===t.j&&this.k===t.k&&this.l===t.l&&this.m===t.m&&this.n===t.n&&this.o===t.o&&this.p===t.p&&this.q===t.q&&this.r===t.r&&this.s===t.s&&this.t===t.t;}},{key:"getOffsets",value:function getOffsets(){return[this.e,this.j,this.o,this.t];}},{key:"toString",value:function toString(){return"ColorMatrix( ".concat(this.a,", ").concat(this.b,", ").concat(this.c,", ").concat(this.d,", ").concat(this.e,",\n ").concat(this.f,", ").concat(this.g,", ").concat(this.h,", ").concat(this.i,", ").concat(this.j,",\n ").concat(this.k,", ").concat(this.l,", ").concat(this.m,", ").concat(this.n,", ").concat(this.o,",\n ").concat(this.p,", ").concat(this.q,", ").concat(this.r,", ").concat(this.s,", ").concat(this.t," )");}},{key:"toArray",value:function toArray(){var _this39=this;return"abcdefghijklmnopqrst".split("").map(function(t){return _this39[t];});}}],[{key:"IDENTITY",get:function get(){return new _Dn();}},{key:"createBrightnessMatrix",value:function createBrightnessMatrix(t){var e=new _Dn();e.e=t;e.j=t;e.o=t;return e;}},{key:"createContrastMatrix",value:function createContrastMatrix(t){var e=new _Dn();var r=(1-t)/2;e.a=e.g=e.m=t;e.e=e.j=e.o=r;return e;}},{key:"createSaturationMatrix",value:function createSaturationMatrix(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;var e=new _Dn();var r=1-t;var o=.213*r;var n=.715*r;var s=.072*r;e.a=o+t;e.b=n;e.c=s;e.f=o;e.g=n+t;e.h=s;e.k=o;e.l=n;e.m=s+t;return e;}},{key:"createExposureMatrix",value:function createExposureMatrix(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=Math.pow(2,t);return new _Dn(e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0);}},{key:"createLinearMatrix",value:function createLinearMatrix(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=new _Dn();r.a=r.g=r.m=t;r.e=r.j=r.o=e;return r;}}]);return Dn;}();eh=_Dn;});var _Td,_t;var kd=d(function(){Ar();Tn();oc();Sd();O1();Bs();kn();_Td=/*#__PURE__*/function(_Vi){_inherits(Td,_Vi);var _super22=_createSuper(Td);function Td(){var _this40;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Td);_this40=_super22.call(this);_this40.availableOptions=_objectSpread(_objectSpread({},Object.getPrototypeOf(_assertThisInitialized(_this40)).availableOptions),e);_this40._onConfigurableUpdate=_this40._onConfigurableUpdate.bind(_assertThisInitialized(_this40));_this40._initOptions(t);return _this40;}_createClass(Td,[{key:"_buildConfigError",value:function _buildConfigError(t){var e="";if(this.constructor.name){e="".concat(this.constructor.name,": ");}e+=t;return new Error(e);}},{key:"_onOptionsChange",value:function _onOptionsChange(){}},{key:"validateSettings",value:function validateSettings(){var _this41=this;return new Promise(function(t,e){for(var r in _this41.availableOptions){var o=_this41.availableOptions[r];if(o.required&&typeof _this41._options[r]==="undefined"){return e(_this41._buildConfigError("Option `".concat(r,"` is required.")));}}t();});}},{key:"_initOptions",value:function _initOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._options={};var e;var r;var o;var n=this;for(e in this.availableOptions){o=e.charAt(0).toUpperCase()+e.slice(1);r=this.availableOptions[e];if(["string","number","boolean","object","vector2","color","configurable","color-matrix","array","image","function","*"].indexOf(r.type)===-1){throw this._buildConfigError("Unknown option type: `".concat(r.type,"`"));}var s=function a(l){n["set".concat(o)]=function(c,u,m){n.setOption(l,c,u,m);};n["get".concat(o)]=function(){return n.getOption(l);};};s(e);if(r.type==="configurable"){this._options[e]=new _Td(void 0,r.structure||{});this._options[e].on("update",this._onConfigurableUpdate);}if(!(e in t)||typeof t[e]==="undefined"){if(typeof r["default"]!=="undefined"){var a=r["default"];if(typeof r["default"]==="function"){a=r["default"]();}this["set".concat(o)](a,false,true);}else if(r.type!=="configurable"){this._options[e]=void 0;}}}for(e in t){if(typeof this.availableOptions[e]==="undefined"){throw new Error("Invalid option: ".concat(e));}if(typeof t[e]!=="undefined"){o=e.charAt(0).toUpperCase()+e.slice(1);this["set".concat(o)](t[e],false,true);}}}},{key:"set",value:function set(t){var _this42=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;Object.keys(t).forEach(function(r){_this42.setOption(r,t[r],false);});this._onOptionsChange();if(e){this.emit("update",this,t);}}},{key:"getOption",value:function getOption(t){return this._options[t];}},{key:"hasOption",value:function hasOption(t){return!!this.availableOptions[t];}},{key:"getOptionDefault",value:function getOptionDefault(t){var e=this.availableOptions[t];if(!e){throw new Error("Invalid option: ".concat(t));}return e["default"];}},{key:"resetOptions",value:function resetOptions(){this.set(this.getDefaultOptions());}},{key:"getDefaultOptions",value:function getDefaultOptions(){var t={};for(var e in this.availableOptions){var r=this.availableOptions[e]["default"];if(typeof r==="undefined")continue;t[e]=r;}return t;}},{key:"getOptions",value:function getOptions(){return _objectSpread({},this._options);}},{key:"equals",value:function equals(t){var e=t.getOptions();return this.optionsEqual(e);}},{key:"optionsEqual",value:function optionsEqual(t){for(var e in t){var r=t[e];if(!this._optionEquals(e,r)){return false;}}return true;}},{key:"_optionEquals",value:function _optionEquals(t,e){var r=this.availableOptions[t];if(typeof r==="undefined"){throw new Error("Invalid option: ".concat(t));}var o=this.availableOptions[t].type;var n=this._options[t];if(n===e)return true;if(typeof e==="undefined"||typeof n==="undefined")return false;switch(o){case"object":if(typeof n.optionsEqual==="function"){return n.optionsEqual(e._options);}return n===e;case"string":case"number":case"boolean":case"function":case"*":return n===e;case"vector2":return n.equals(e);case"color":case"color-matrix":return e.equals(n);case"configurable":return n.optionsEqual(e);case"array":return this._arrayOptionEquals(t,e);case"image":return n.src===e.src;}}},{key:"_arrayOptionEquals",value:function _arrayOptionEquals(t,e){var r=this._options[t];if(e.length!==r.length){return false;}var o=true;for(var n=0;n0&&arguments[0]!==undefined?arguments[0]:Object.keys(this._options);var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r={};t.forEach(function(o){if(typeof _this43.availableOptions[o]==="undefined"){return Log.warn("Trying to serialize a key that does not exist: ".concat(o));}if(_this43.availableOptions[o].serializable===false)return;r[o]=_this43.serializeOption(o,e);});return r;}},{key:"serializeOption",value:function serializeOption(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=this.availableOptions[t];var o=r.type;var n=this._options[t];if(!n)return n;if(r.serializable===false){throw new Error("Option `".concat(t,"` is not serializable."));}switch(o){case"string":case"number":case"boolean":case"object":case"function":case"*":return n;case"vector2":return e?n.toObject():n.clone();case"color":case"color-matrix":return e?n.toArray():n.clone();case"configurable":return n.serializeOptions(void 0,e);case"array":return n.slice(0);case"image":return e?n.src:n;}}},{key:"setOption",value:function setOption(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=this.availableOptions[t];if(!n){throw new Error("Invalid option: ".concat(t));}if(typeof n.setter!=="undefined"){e=n.setter.call(this,e,o);}if(typeof n.validation!=="undefined"){n.validation(e);}if(e===null||typeof e==="undefined"){if(n.required){throw this._buildConfigError("Option `".concat(t,"` is required."));}this._options[t]=e;}else{switch(n.type){case"string":{if(typeof e!=="string"){throw this._buildConfigError("Option `".concat(t,"` has to be a string."));}var s=n.available;if(typeof s!=="undefined"&&s.indexOf(e)===-1){throw this._buildConfigError("Invalid value for `".concat(t,"` (valid values are: ").concat(n.available.join(", "),")"));}this._options[t]=e;break;}case"number":if(typeof e!=="number"){throw this._buildConfigError("Option `".concat(t,"` has to be a number."));}this._options[t]=e;break;case"boolean":if(typeof e!=="boolean"){throw this._buildConfigError("Option `".concat(t,"` has to be a boolean."));}this._options[t]=e;break;case"vector2":if(!(e instanceof _ot2)&&!(_typeof(e)==="object"&&"x"in e&&"y"in e)){throw this._buildConfigError("Option `".concat(t,"` has to be an instance of Vector2 or an Object holding x and y values."));}if(e instanceof _ot2){this._options[t]=e.clone();}else{this._options[t]=_ot2.fromObject(e);}break;case"color":if(!(e instanceof G)){throw this._buildConfigError("Option `".concat(t,"` has to be an instance of Color."));}this._options[t]=e;break;case"color-matrix":if(!(e instanceof eh)){throw this._buildConfigError("Option `".concat(t,"` has to be an instance of ColorMatrix."));}this._options[t]=e.clone();break;case"function":if(typeof e!=="function"){throw this._buildConfigError("Option `".concat(t,"` has to be a function."));}this._options[t]=e;break;case"object":case"*":this._options[t]=e;break;case"image":{var _pi=pi,_s3=_pi.Image;if(typeof e==="string"){var a=new _s3();if(T4(a)){a.crossOrigin=z.getCrossOriginValue(n.crossOrigin);}a.src=e;this._options[t]=a;}else if(e instanceof _s3||typeof HTMLCanvasElement!=="undefined"&&e instanceof HTMLCanvasElement||typeof HTMLImageElement!=="undefined"&&e instanceof HTMLImageElement){this._options[t]=e;}else{throw this._buildConfigError("Option `".concat(t,"` has to be an Image, Canvas or String."));}break;}case"configurable":if(e instanceof _Td){this._options[t]=e;}else{this._options[t].set(e);}break;case"array":if(!(e instanceof Array)){throw this._buildConfigError("Option `".concat(t,"` has to be an Array."));}this._options[t]=e.slice(0);break;default:throw this._buildConfigError("Unknown option type: `".concat(n.type,"`"));}}if(r){this._onOptionsChange();this.emit("update",this,_defineProperty({},t,e));}}},{key:"_onConfigurableUpdate",value:function _onConfigurableUpdate(){for(var _len9=arguments.length,t=new Array(_len9),_key9=0;_key9<_len9;_key9++){t[_key9]=arguments[_key9];}this.emit.apply(this,["update"].concat(t));}},{key:"hasChanges",value:function hasChanges(){var t=this.getDefaultOptions();return!this.optionsEqual(t);}}]);return Td;}(Vi);_t=_Td;});var ih;var R1=d(function(){Ar();Le();Le();ih=/*#__PURE__*/function(){function ih(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:[];_classCallCheck(this,ih);this._program=null;this._renderer=t;this._vertexSource=e;this._fragmentSource=r;this._uniforms=o;this._uniformLocations={};this._attributes=n;this._attributeLocations={};this._onContextChange=this._onContextChange.bind(this);this._renderer.on("context",this._onContextChange);this._init();}_createClass(ih,[{key:"_init",value:function _init(){this._compile();var t=this._renderer.getContext();t.useProgram(this._program);this._cacheUniformLocations();this._cacheAttributeLocations();}},{key:"_onContextChange",value:function _onContextChange(){this._init();}},{key:"setupBuffers",value:function setupBuffers(t,e){var r=this._renderer.getContext();r.bindBuffer(r.ARRAY_BUFFER,t);r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e);r.vertexAttribPointer(this._attributeLocations.a_position,2,r.FLOAT,false,Xa,0);r.vertexAttribPointer(this._attributeLocations.a_texCoord,2,r.FLOAT,false,Xa,2*4);r.vertexAttribPointer(this._attributeLocations.a_color,4,r.UNSIGNED_BYTE,true,Xa,4*4);}},{key:"syncUniforms",value:function syncUniforms(){var _this44=this;Object.keys(this._uniforms).forEach(function(t){_this44.syncUniform(t);});}},{key:"syncUniform",value:function syncUniform(t){var e=this._renderer.getContext();var r=this._uniforms[t];var o=this._uniformLocations[t];switch(r.type){case"sampler2d":e.uniform1i(o,r.value);break;case"i":case"1i":e.uniform1i(o,r.value);break;case"2i":e.uniform2i(o,r.value[0],r.value[1]);break;case"3i":e.uniform3i(o,r.value[0],r.value[1],r.value[2]);break;case"4i":e.uniform4i(o,r.value[0],r.value[1],r.value[2],r.value[3]);break;case"f":case"1f":e.uniform1f(o,r.value);break;case"2f":e.uniform2f(o,r.value[0],r.value[1]);break;case"3f":e.uniform3f(o,r.value[0],r.value[1],r.value[2]);break;case"4f":e.uniform4f(o,r.value[0],r.value[1],r.value[2],r.value[3]);break;case"2fv":e.uniform2fv(o,r.value);break;case"mat3":case"mat3fv":e.uniformMatrix3fv(o,false,r.value);break;case"mat4":e.uniformMatrix4fv(o,false,r.value);break;default:Y.warn(this.constructor.name,"Unknown uniform type: ".concat(r.type));}}},{key:"_cacheAttributeLocations",value:function _cacheAttributeLocations(){var _this45=this;var t=this._renderer.getContext();this._attributes.forEach(function(e){if(_this45._program){_this45._attributeLocations[e]=t.getAttribLocation(_this45._program,e);}});}},{key:"_cacheUniformLocations",value:function _cacheUniformLocations(){var _this46=this;var t=this._renderer.getContext();var e=Object.keys(this._uniforms);e.forEach(function(r){if(_this46._program){var o=t.getUniformLocation(_this46._program,r);if(o){_this46._uniformLocations[r]=o;}}});}},{key:"_addPrecisionToSource",value:function _addPrecisionToSource(t){var e=this._renderer.getMaxFloatPrecision();var r="mediump";if(z.isMobile()&&e==="highp"){r="highp";}return"precision ".concat(r," float;\n").concat(t);}},{key:"_compile",value:function _compile(){var t=this._renderer.getContext();var e=this._compileShader(t.VERTEX_SHADER,this._vertexSource);this._vertexShader=e;var r=this._addPrecisionToSource(this._fragmentSource);var o=this._compileShader(t.FRAGMENT_SHADER,r);this._fragmentShader=o;var n=t.createProgram();if(!n){return;}t.attachShader(n,e);t.attachShader(n,o);t.linkProgram(n);var s=t.getProgramParameter(n,t.LINK_STATUS);if(!s){var a=t.getProgramInfoLog(n);if(t.isContextLost())a="WebGL context lost";t.deleteProgram(n);Y.error(this.constructor.name,"WebGL program linking error: ".concat(a));}else{this._program=n;}}},{key:"_compileShader",value:function _compileShader(t,e){var r=this._renderer.getContext();var o=r.createShader(t);if(!o){throw new Error("Cannot create shared: ".concat(JSON.stringify(t)));}r.shaderSource(o,e);r.compileShader(o);var n=r.getShaderParameter(o,r.COMPILE_STATUS);if(!n){var s=r.getShaderInfoLog(o);if(r.isContextLost())s="WebGL context lost";r.deleteShader(o);Y.error(this.constructor.name,"WebGL shader compilation error: ".concat(s));}return o;}},{key:"setUniform",value:function setUniform(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;this._uniforms[t].value=e;if(r){this.syncUniform(t);}}},{key:"setUniforms",value:function setUniforms(t){var _this47=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;Object.keys(t).forEach(function(r){_this47._uniforms[r].value=t[r];if(e){_this47.syncUniform(r);}});}},{key:"getUniforms",value:function getUniforms(){return this._uniforms;}},{key:"getAttributes",value:function getAttributes(){return this._attributes;}},{key:"getAttributeLocations",value:function getAttributeLocations(){return this._attributeLocations;}},{key:"getProgram",value:function getProgram(){return this._program;}},{key:"dispose",value:function dispose(){var t=this._renderer.getContext();t.deleteProgram(this._program);t.deleteShader(this._vertexShader);t.deleteShader(this._fragmentShader);this._renderer.off("context",this._onContextChange);}}]);return ih;}();});var j4;var V4=d(function(){j4="uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_texCoord) * v_color;\n}\n";});var K4;var $4=d(function(){K4="attribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\nuniform mat3 u_projMatrix;\n\nvoid main() {\n gl_Position = vec4((u_projMatrix * vec3(a_position, 1)).xy, 0, 1);\n v_texCoord = a_texCoord;\n v_color = vec4(a_color.rgb * a_color.a, a_color.a);\n}\n";});var hrt,Ps,A1;var X4=d(function(){Ar();Le();R1();V4();$4();hrt=new _rr();Ps={vertexSource:K4,fragmentSource:j4,uniforms:{u_image:{type:"sampler2d",value:0},u_projMatrix:{type:"mat3",value:hrt.toArray()}},attributes:["a_position","a_texCoord","a_color"]};A1=/*#__PURE__*/function(_ih){_inherits(A1,_ih);var _super23=_createSuper(A1);function A1(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Ps.vertexSource;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:Ps.fragmentSource;_classCallCheck(this,A1);return _super23.call(this,t,e,r,Ps.uniforms,Ps.attributes);}return A1;}(ih);});var B1=d(function(){R1();X4();});var Uo;var Id=d(function(){To();G4();Ar();kd();Le();B1();Tn();Uo=/*#__PURE__*/function(_t4){_inherits(Uo,_t4);var _super24=_createSuper(Uo);function Uo(){var _this48;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Uo);_this48=_super24.call(this,t,e);_this48._initOptions(t);return _this48;}_createClass(Uo,[{key:"_initOptions",value:function _initOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._shaders=[];this._availableUniforms=Ps.uniforms;this._attributes=Ps.attributes;this._vertexSource=Ps.vertexSource;this._fragmentSource=Ps.fragmentSource;this._initUniforms();_get(_getPrototypeOf(Uo.prototype),"_initOptions",this).call(this,t);}},{key:"_initUniforms",value:function _initUniforms(){this._uniforms={};for(var t in this._availableUniforms){var e=this._availableUniforms[t];this._uniforms[t]={type:e.type,value:e["default"]||null};}for(var _t5 in this.availableOptions){var _e2=this.availableOptions[_t5];if(!_e2.uniformType){Y.trace(this.constructor.name,"Option `".concat(_t5,"` is missing a `uniformType`!"));}else{this._uniforms["u_".concat(_t5)]={type:_e2.uniformType,value:_e2["default"]||null};}}}},{key:"setOption",value:function setOption(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;_get(_getPrototypeOf(Uo.prototype),"setOption",this).call(this,t,e,r);var o=e;var n=this.availableOptions[t];if(!n.uniformType){return;}var s="u_".concat(t);switch(n.type){case"color":if(n.uniformType==="4f"){o=e.toGLColor();}else if(n.uniformType==="3f"){o=e.toRGBGLColor();}break;case"vector2":o=[e.x,e.y];break;case"color-matrix":{o=[e.a,e.b,e.c,e.d,e.f,e.g,e.h,e.i,e.k,e.l,e.m,e.n,e.p,e.q,e.r,e.s];var a=[e.e,e.j,e.o,e.t];this._uniforms["".concat(s,"_vec")]={value:a,type:"4f"};}}this.setUniform(s,o);}},{key:"setUniform",value:function setUniform(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;this._uniforms[t].value=e;}},{key:"setUniforms",value:function setUniforms(t){var _this49=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;Object.entries(t).forEach(function(_ref88){var _ref89=_slicedToArray(_ref88,2),r=_ref89[0],o=_ref89[1];_this49._uniforms[r].value=o;if(e){_this49.syncUniform(r);}});}},{key:"syncUniform",value:function syncUniform(t){this._shaders.forEach(function(e){e.syncUniform(t);});}},{key:"syncUniforms",value:function syncUniforms(){this._shaders.forEach(function(t){t.syncUniforms();});}},{key:"getShaderForRenderer",value:function getShaderForRenderer(t){var e=t.id;if(!this._shaders)this._shaders=[];var r=this._shaders[e];if(!r){r=new ih(t,this._vertexSource,this._fragmentSource,this._uniforms,this._attributes);this._shaders[e]=r;}return r;}},{key:"apply",value:function apply(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(bd(t)){this._applyWebGL(t,e,r,o);}else{this._applyCanvas(t,e,r,o);}}},{key:"_applyWebGL",value:function _applyWebGL(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=t.getContext();var s=this.getShaderForRenderer(t);t.setRenderTarget(r);if(o){r.clear();}t.setShader(s);var a=t.getCurrentRenderTarget().getProjectionMatrix().toArray();s.setUniform("u_projMatrix",a);s.syncUniforms();n.activeTexture(n.TEXTURE0);n.bindTexture(n.TEXTURE_2D,e.getTexture());n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);}},{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=r.getContext();Y.warn(this.constructor.name,"`_applyCanvas` is not implemented. Just copying image data from `inputTarget` to `outputTarget`.");s.clearRect(0,0,n.width,n.height);s.drawImage(n,0,0);}},{key:"dispose",value:function dispose(){this._shaders.forEach(function(t){return t.dispose();});this._shaders=[];}},{key:"_blurImage",value:function _blurImage(t,e,r){var o=10;var n=t.getCanvas();var s=Math.min(1,o/(r*Math.min(n.width,n.height)));var a=z.createCanvas();a.width=Math.round(n.width*s);a.height=Math.round(n.height*s);var l=a.getContext("2d");l.drawImage(n,0,0,n.width,n.height,0,0,a.width,a.height);var c=r*Math.min(a.width,a.height);var u=l.getImageData(0,0,a.width,a.height);W4(u,0,0,a.width,a.height,c);l.putImageData(u,0,0);e.getContext().drawImage(a,0,0,a.width,a.height,0,0,n.width,n.height);$t(a);}}]);return Uo;}(_t);});var Y4;var q4=d(function(){Y4="uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\n\nvoid main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4(color.a > 0. ? color.rgb / color.a : vec3(0), color.a);\n}\n";});var Dd;var J4=d(function(){Id();q4();Dd=/*#__PURE__*/function(_Uo){_inherits(Dd,_Uo);var _super25=_createSuper(Dd);function Dd(){var _this50;_classCallCheck(this,Dd);_this50=_super25.call(this);_this50._fragmentSource=Y4;return _this50;}return Dd;}(Uo);});var Q4;var Z4=d(function(){Q4="uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform vec4 u_color;\n\nvoid main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4(mix(color.rgb, u_color.rgb, u_color.a), color.a) * color.a;\n}\n";});var brt,yrt,P1,t3;var e3=d(function(){Le();Id();Z4();brt=ir.OptionType;yrt=ir.UniformType;P1=/*#__PURE__*/function(_Uo2){_inherits(P1,_Uo2);var _super26=_createSuper(P1);function P1(){var _this51;_classCallCheck(this,P1);for(var _len10=arguments.length,t=new Array(_len10),_key10=0;_key10<_len10;_key10++){t[_key10]=arguments[_key10];}_this51=_super26.call.apply(_super26,[this].concat(t));_this51._fragmentSource=Q4;return _this51;}_createClass(P1,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=this._options.color;var c=s.getImageData(0,0,n.width,n.height);var u=a.getImageData(0,0,n.width,n.height);var m=n.width*n.height;var p=new G();var h=new G();for(var g=0;g3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var _this$_options=this._options,c=_this$_options.mode,u=_this$_options.color;var m=u.r,p=u.g,h=u.b,g=u.a;var x=[.2125,.7154,.0721];switch(c){case _qa.MODES.SOLID:for(var v=0;v3&&arguments[3]!==undefined?arguments[3]:false;var n=this._options.overlayTexture.getRenderTarget().getContext();var s=e.getCanvas();var a=e.getContext();var l=r.getContext();var c=a.getImageData(0,0,s.width,s.height);var u=n.getImageData(0,0,s.width,s.height);var _this$_options2=this._options,m=_this$_options2.blendMode,p=_this$_options2.alpha;var h=new G();var g=new G();var x=new G();for(var v=0;v3&&arguments[3]!==undefined?arguments[3]:pi.createCanvas();var n=arguments.length>4?arguments[4]:undefined;_classCallCheck(this,Ms);this._width=t;this._height=e;this._pixelRatio=r;this._baseTexture=new Ae();this._canvas=o;var s=n||this._canvas.getContext("2d");if(!s){throw new Error("Cannot get canvas context");}this._context=s;this._baseTexture.setSource(this._canvas);this._canvas.width=this._width*this._pixelRatio;this._canvas.height=this._height*this._pixelRatio;this._filterStack=[{renderTarget:this,filters:[]}];}_createClass(Ms,[{key:"clear",value:function clear(){var t=this._context;t.setTransform(1,0,0,1,0,0);t.clearRect(0,0,this._width*this._pixelRatio,this._height*this._pixelRatio);}},{key:"resizeTo",value:function resizeTo(t){this._baseTexture.resizeTo(t);if(this._width!==t.x){this._width=t.x;this._canvas.width=this._width*this._pixelRatio;}if(this._height!==t.y){this._height=t.y;this._canvas.height=this._height*this._pixelRatio;}}},{key:"getCanvas",value:function getCanvas(){return this._canvas;}},{key:"getContext",value:function getContext(){return this._context;}},{key:"getFilterStack",value:function getFilterStack(){return this._filterStack;}},{key:"getWidth",value:function getWidth(){return this._width;}},{key:"getHeight",value:function getHeight(){return this._height;}},{key:"getPixelRatio",value:function getPixelRatio(){return this._pixelRatio;}},{key:"setPixelRatio",value:function setPixelRatio(t){this._pixelRatio=t;}},{key:"getDimensions",value:function getDimensions(){return new _ot2(this._width,this._height);}},{key:"getBaseTexture",value:function getBaseTexture(){return this._baseTexture;}},{key:"dispose",value:function dispose(){delete this._canvas;delete this._context;this._baseTexture.dispose();}}]);return Ms;}();});var lc;var Ay=d(function(){Le();rh();lc=/*#__PURE__*/function(){function lc(t){_classCallCheck(this,lc);this._renderer=t;this._filterStack=[{renderTarget:t.getCurrentRenderTarget(),filters:[]}];this._textures=[];this._textureFrame=new _ce(0,0,t.getWidth(),t.getHeight());}_createClass(lc,[{key:"resizeTo",value:function resizeTo(t){this._textureFrame.width=t.x;this._textureFrame.height=t.y;this._textures.forEach(function(e){return e.resizeTo(t);});}},{key:"pushFilters",value:function pushFilters(t,e){this._currentFrame=t.getBounds();var r=this._getOrCreateRenderTarget();this._renderer.setRenderTarget(r);this._filterStack.push({renderTarget:r,filters:e});r.clear();}},{key:"popFilters",value:function popFilters(){var t=this._filterStack.pop();if(!t)return void 0;var e=t.filters,r=t.renderTarget;var o=this._filterStack[this._filterStack.length-1];var n=r;var s=o.renderTarget;if(e.length===1){var a=e[0];a.apply(this._renderer,n,s);this._textures.push(n);}else{this._applyFilters(e,n,s);}return e;}},{key:"_applyFilters",value:function _applyFilters(t,e,r){var _this56=this;var o=e;var n=this._getOrCreateRenderTarget(true);var s=t[t.length-1];t.forEach(function(a){var l=a===s;if(!l){a.apply(_this56._renderer,o,n);var c=o;o=n;n=c;}else{a.apply(_this56._renderer,o,r);}});this._textures.push(o);this._textures.push(n);}},{key:"_getOrCreateRenderTarget",value:function _getOrCreateRenderTarget(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._textures.pop();if(!e){e=new Ms(this._textureFrame.width,this._textureFrame.height,1);}if(t){e.clear();}return e;}},{key:"setFilterStack",value:function setFilterStack(t){this._filterStack=t;}},{key:"dispose",value:function dispose(){}}]);return lc;}();});var nh=Gt(function(p3,oh){(function(){var i,t,e,r,o,n;if(typeof performance!=="undefined"&&performance!==null&&performance.now){oh.exports=function(){return performance.now();};}else if(typeof process!=="undefined"&&process!==null&&process.hrtime){oh.exports=function(){return(i()-o)/1e6;};t=process.hrtime;i=function i(){var s;s=t();return s[0]*1e9+s[1];};r=i();n=process.uptime()*1e9;o=r-n;}else if(Date.now){oh.exports=function(){return Date.now()-e;};e=Date.now();}else{oh.exports=function(){return new Date().getTime()-e;};e=new Date().getTime();}}).call(p3);});var h3,f3,By;var N1=d(function(){Le();h3=typeof window!=="undefined"&&window.performance&&window.performance.now?window.performance.now.bind(window.performance):nh();f3=/*#__PURE__*/function(){function f3(t){var _this57=this;_classCallCheck(this,f3);this._context=t;this._tracking=false;var e=this;var _loop2=function _loop2(r){var o=t[r];if(typeof o==="function"){_this57[r]=function(){var s=t[r];for(var _len13=arguments.length,n=new Array(_len13),_key13=0;_key13<_len13;_key13++){n[_key13]=arguments[_key13];}if(!e._tracking){return s.apply(t,n);}var a=h3();var l=s.apply(t,n);var c=h3()-a;var u={functionName:r,arguments:n,duration:c};e._trackedCalls.push(u);return l;};}else{_this57._makePropertyWrapper(r);}};for(var r in t){_loop2(r);}}_createClass(f3,[{key:"_makePropertyWrapper",value:function _makePropertyWrapper(t){var e=["_context","_trackedCalls","_tracking"];if(e.indexOf(t)!==-1)return;var r=this._context;this.__defineGetter__(t,function(){return r[t];});this.__defineSetter__(t,function(o){r[t]=o;});}},{key:"startFrame",value:function startFrame(){this._tracking=true;this._trackedCalls=[];}},{key:"endFrame",value:function endFrame(){var t="Rendering";Y.log(t,"Frame rendering results:");Y.log(t,"Context calls: ".concat(this._trackedCalls.length));var e={};this._trackedCalls.forEach(function(_ref90){var o=_ref90.functionName,n=_ref90.duration;e[o]=e[o]||{totalDuration:0,calls:0};e[o].totalDuration+=n;e[o].calls++;});var r=[];for(var o in e){var n=e[o];n.averageDuration=n.totalDuration/n.calls;r.push({functionName:o,data:n});}r.sort(function(o,n){return n.data.totalDuration-o.data.totalDuration;});r=r.slice(0,3);r.forEach(function(o){Y.log(t,"".concat(o.functionName,": ").concat(o.data.calls," calls, ").concat(o.data.totalDuration.toFixed(2),"ms"));});}}]);return f3;}();By=f3;});var sh;var H1=d(function(){Le();sh=/*#__PURE__*/function(_Vi3){_inherits(sh,_Vi3);var _super30=_createSuper(sh);function sh(){var _this58;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:800;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:600;var r=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,sh);_this58=_super30.call(this);_this58._maxTextureSize=null;_this58._options=_objectSpread(_objectSpread({debug:false,transparent:false,clearColor:G.TRANSPARENT},r),{},{pixelRatio:1});_this58.setMaxListeners(0);_this58._width=t;_this58._height=e;_this58._dimensions=new _ot2(_this58._width,_this58._height);_this58._maxTextureSize=null;_this58._pixelRatio=_this58._options.pixelRatio;_this58._canvas=_this58._options.canvas;_this58._clearColor=_this58._options.transparent?G.TRANSPARENT:_this58._options.clearColor||G.BLACK;return _this58;}_createClass(sh,[{key:"setCanvas",value:function setCanvas(t){var e=this._canvas;this._canvas=t;if(e!==t){this._createContext();this._onBeforeContext();this._setupContext();}this.resizeTo(new _ot2(this._width,this._height));}},{key:"getCanvas",value:function getCanvas(){return this._canvas;}},{key:"_onBeforeContext",value:function _onBeforeContext(){}},{key:"resizeTo",value:function resizeTo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;this._width=t.x*this._pixelRatio;this._height=t.y*this._pixelRatio;if(e&&this._canvas){this._canvas.width=this._width;this._canvas.height=this._height;if("style"in this._canvas){this._canvas.style.width="".concat(this._width/this._pixelRatio,"px");this._canvas.style.height="".concat(this._height/this._pixelRatio,"px");}}this._dimensions=t.clone();}},{key:"_createContext",value:function _createContext(){Y.warn(this.constructor.name,"`_createContext` is abstract and not implemented in inherited class");}},{key:"_setupContext",value:function _setupContext(){Y.warn(this.constructor.name,"`_setupContext` is abstract and not implemented in inherited class");}},{key:"render",value:function render(t){Y.warn(this.constructor.name,"`render` is abstract and not implemented in inherited class");}},{key:"getMaxDimensions",value:function getMaxDimensions(){return null;}},{key:"getContext",value:function getContext(){return this._context;}},{key:"getWidth",value:function getWidth(){return this._dimensions.x;}},{key:"getHeight",value:function getHeight(){return this._dimensions.y;}},{key:"getDimensions",value:function getDimensions(){return this._dimensions;}},{key:"getPixelRatio",value:function getPixelRatio(){return this._pixelRatio;}},{key:"setPixelRatio",value:function setPixelRatio(t){this._pixelRatio=t;if(this._defaultRenderTarget){this._defaultRenderTarget.setPixelRatio(t);}}},{key:"getMaxTextureSize",value:function getMaxTextureSize(){return this._maxTextureSize;}},{key:"getFilterManager",value:function getFilterManager(){return this._filterManager;}},{key:"setFilterManager",value:function setFilterManager(t){this._filterManager=t;}},{key:"setClearColor",value:function setClearColor(t){this._clearColor=t;}},{key:"getClearColor",value:function getClearColor(){return this._clearColor;}},{key:"isOfType",value:function isOfType(t){return this._type===t;}},{key:"dispose",value:function dispose(){Y.warn(this.constructor.name,"`dispose` is abstract and not implemented in inherited class");}}]);return sh;}(Vi);});var g3,_W2,Od;var b3=d(function(){To();Fy();Le();Ay();rh();N1();Tn();H1();g3=ir.RendererType;_W2=/*#__PURE__*/function(_sh){_inherits(W1,_sh);var _super31=_createSuper(W1);function W1(){var _this59;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:800;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:600;var r=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,W1);_this59=_super31.call(this,t,e,_objectSpread({},r));_this59.id=0;_this59.setCanvas((r==null?void 0:r.canvas)||pi.createCanvas());_this59._type=g3.CANVAS;return _this59;}_createClass(W1,[{key:"_createContext",value:function _createContext(){var t=this._canvas;var e=t.getContext("2d");if(!e)return;if(this._options.debug){e=new By(e);}this.id=_W2.contextId++;this._context=e;this.emit("context",e);return e;}},{key:"_setupContext",value:function _setupContext(){var t=this._context;if(!("imageSmoothingEnabled"in t)){["moz","webkit","ms"].forEach(function(e){if(t[e]){t[e]=true;}});}else{t.imageSmoothingEnabled=true;}this._defaultRenderTarget=new Ms(this._width,this._height,this._pixelRatio,this._canvas,this._context);this.setRenderTarget(this._defaultRenderTarget);this._filterManager=new lc(this);}},{key:"render",value:function render(t){var e=this._renderTarget.getContext();var r=t.getParent();t.setParent(new ac());t.updateTransform();if(r){t.setParent(r);}e.setTransform(1,0,0,1,0,0);e.globalAlpha=1;var _this$_canvas=this._canvas,o=_this$_canvas.width,n=_this$_canvas.height;e.clearRect(0,0,o,n);if(this._clearColor.a!==0){e.save();e.fillStyle=this._clearColor.toRGBA();e.fillRect(0,0,o,n);e.restore();}this.renderDisplayObject(t,this._renderTarget);}},{key:"renderDisplayObject",value:function renderDisplayObject(t,e){var r=this._renderTarget;this._filterManager.setFilterStack(e.getFilterStack());this.setRenderTarget(e);t.renderCanvas(this);this.setRenderTarget(r);}},{key:"getCurrentRenderTarget",value:function getCurrentRenderTarget(){return this._renderTarget;}},{key:"setRenderTarget",value:function setRenderTarget(t){this._renderTarget=t;}},{key:"getContext",value:function getContext(){return this._renderTarget.getContext();}},{key:"dispose",value:function dispose(){$t(this._canvas);this._filterManager.dispose();}}]);return W1;}(sh);Od=_W2;Od.contextId=0;Od.type=g3.CANVAS;});var y3;var _3=d(function(){y3=function y3(i){if(typeof window!=="undefined"){var _window=window,t=_window.WebGLDebugUtils;if(t){var e=function e(r,o){console.error("gl.".concat(r,"(").concat(t.glFunctionArgsToString(r,o),")"));};i=t.makeDebugContext(i,null,e);}}return i;};});var G1;var x3=d(function(){G1=/*#__PURE__*/function(){function G1(t){_classCallCheck(this,G1);this.vertices=new Float32Array([0,0,100,0,100,100,0,100]);this.uvs=new Float32Array([0,0,1,0,1,1,0,1]);this.indices=new Uint16Array([0,1,2,0,3,2]);this.colors=new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]);this.vertexBuffer=null;this.indexBuffer=null;this.gl=t;this.initBuffers();this.uploadBuffers();}_createClass(G1,[{key:"map",value:function map(t,e){var r=e.x,o=e.y;this.uvs[2]=e.width/t.width;this.uvs[4]=this.uvs[2];this.uvs[5]=e.height/t.height;this.uvs[7]=this.uvs[5];this.vertices[0]=r;this.vertices[1]=o;this.vertices[2]=r+e.width;this.vertices[3]=o;this.vertices[4]=this.vertices[2];this.vertices[5]=o+e.height;this.vertices[6]=r;this.vertices[7]=this.vertices[5];this.uploadBuffers();}},{key:"getVertexBuffer",value:function getVertexBuffer(){return this.vertexBuffer;}},{key:"getIndexBuffer",value:function getIndexBuffer(){return this.indexBuffer;}},{key:"dispose",value:function dispose(){this.cleanBuffer();}},{key:"initBuffers",value:function initBuffers(){var t=this.gl;this.cleanBuffer();this.vertexBuffer=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer);t.bufferData(t.ARRAY_BUFFER,(8+8+16)*4,t.DYNAMIC_DRAW);this.indexBuffer=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indices,t.STATIC_DRAW);}},{key:"uploadBuffers",value:function uploadBuffers(){var t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer);t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);t.bufferSubData(t.ARRAY_BUFFER,8*4,this.uvs);t.bufferSubData(t.ARRAY_BUFFER,(8+8)*4,this.colors);}},{key:"cleanBuffer",value:function cleanBuffer(){var t=this.gl;t.deleteBuffer(this.vertexBuffer);t.deleteBuffer(this.indexBuffer);}}]);return G1;}();});var Ls;var ah=d(function(){Le();Fd();Ls=/*#__PURE__*/function(){function Ls(t,e,r,o){var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;_classCallCheck(this,Ls);this._renderer=t;this._gl=t.getContext();this._width=e;this._height=r;this._frame=null;this._pixelRatio=o;this._projectionMatrix=new _rr();this._mipMapping=false;this._baseTexture=new Ae();var s=this._baseTexture.getFrame();s.width=e;s.height=r;this._baseTexture.setPixelRatio(o);this._baseTexture.setLoaded(true);this._framebuffer=null;this._isRoot=n;this._filterStack=[{renderTarget:this,filters:[]}];if(!n){this._initFrameBuffer();}}_createClass(Ls,[{key:"resizeTo",value:function resizeTo(t){this._width=t.x|0;this._height=t.y|0;this._baseTexture.resizeTo(t);if(!this._isRoot){this._resizeTexture();}this._baseTexture.setMinFilter(this._getMinFilter());this._baseTexture.setMagFilter(this._getMagFilter());this._calculateProjectionMatrix();}},{key:"_getMinFilter",value:function _getMinFilter(){var t=Ae.DefaultMinFilter;if(this._mipMapping){t=Ae.TrilinearFilter;}return t;}},{key:"_getMagFilter",value:function _getMagFilter(){return Ae.DefaultMagFilter;}},{key:"_resizeTexture",value:function _resizeTexture(){var t=this._gl;var e=this._width*this._pixelRatio;var r=this._height*this._pixelRatio;if(this._texture){t.deleteTexture(this._texture);this._texture=null;}this._texture=t.createTexture();t.bindTexture(t.TEXTURE_2D,this._texture);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e,r,0,t.RGBA,t.UNSIGNED_BYTE,null);t.bindFramebuffer(t.FRAMEBUFFER,this._framebuffer);t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this._texture,0);if(this._texture){this._baseTexture.setGLTextureForRenderer(this._texture,this._renderer);}if(this._renderer._options.debug){nc.checkFramebufferStatus("WebGLRenderTarget#_initFramebuffer",t);}var o=new _ot2(this._width,this._height);if(z.isPowerOfTwo(o)){Y.info("WebGLRenderTarget","Mip-mapping enabled");this._mipMapping=true;}else{this._mipMapping=false;}this._baseTexture.setMipMappingEnabled(this._mipMapping);}},{key:"activate",value:function activate(){var t=this._gl;t.bindFramebuffer(t.FRAMEBUFFER,this._framebuffer);this._calculateProjectionMatrix();t.viewport(0,0,this._width*this._pixelRatio,this._height*this._pixelRatio);t.disable(t.STENCIL_TEST);}},{key:"clear",value:function clear(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:G.TRANSPARENT;var e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer);if(this._renderer._options.debug){nc.checkFramebufferStatus("WebGLRenderTarget#clear",e);}e.clearColor.apply(e,t.toGLColor());e.clear(e.COLOR_BUFFER_BIT);}},{key:"_calculateProjectionMatrix",value:function _calculateProjectionMatrix(){var t=this._projectionMatrix;t.reset();var e=this._frame||new _ce(0,0,this._width,this._height);var r=e.x,o=e.y;if(!this._isRoot){t.a=1/this._width*2;t.d=1/this._height*2;t.tx=-1-r*t.a;t.ty=-1-o*t.d;}else{t.a=1/this._width*2;t.d=-1/this._height*2;t.tx=-1-r*t.a;t.ty=1-o*t.d;}}},{key:"_initFrameBuffer",value:function _initFrameBuffer(){var t=this._gl;if(this._framebuffer){t.deleteFramebuffer(this._framebuffer);this._framebuffer=null;}if(this._texture){t.deleteTexture(this._texture);this._texture=null;}this._framebuffer=t.createFramebuffer();this._texture=t.createTexture();t.bindTexture(t.TEXTURE_2D,this._texture);t.bindFramebuffer(t.FRAMEBUFFER,this._framebuffer);t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,this._texture,0);if(this._texture){this._baseTexture.setGLTextureForRenderer(this._texture,this._renderer);}this.resizeTo(new _ot2(this._width,this._height));if(this._renderer._options.debug){nc.checkFramebufferStatus("WebGLRenderTarget#_initFramebuffer",t);}}},{key:"getProjectionMatrix",value:function getProjectionMatrix(){return this._projectionMatrix;}},{key:"getTexture",value:function getTexture(){return this._texture;}},{key:"getFrame",value:function getFrame(){return this._frame;}},{key:"setFrame",value:function setFrame(t){this._frame=t;}},{key:"getFilterStack",value:function getFilterStack(){return this._filterStack;}},{key:"getPixelRatio",value:function getPixelRatio(){return this._pixelRatio;}},{key:"setPixelRatio",value:function setPixelRatio(t){this._pixelRatio=t;if(!this._isRoot){this._resizeTexture();}}},{key:"getBaseTexture",value:function getBaseTexture(){return this._baseTexture;}},{key:"dispose",value:function dispose(){var t=this._gl;this._baseTexture.dispose();if(this._framebuffer){t.deleteFramebuffer(this._framebuffer);this._framebuffer=null;}if(this._texture){t.deleteTexture(this._texture);this._texture=null;}}}]);return Ls;}();});var lh;var V1=d(function(){U1();Le();x3();Tn();ah();lh=/*#__PURE__*/function(){function lh(t){_classCallCheck(this,lh);this._renderer=t;this._filterStack=[];this._currentFrame=null;this._renderTargets=[];this._textureFrame=new _ce(0,0,t.getWidth(),t.getHeight());this._onContextChange=this._onContextChange.bind(this);this._renderer.on("context",this._onContextChange);this._onContextChange();}_createClass(lh,[{key:"resizeTo",value:function resizeTo(t){this._textureFrame.width=t.x;this._textureFrame.height=t.y;this._renderTargets.forEach(function(e){return e.resizeTo(t);});}},{key:"getFilterStack",value:function getFilterStack(){return this._filterStack;}},{key:"setFilterStack",value:function setFilterStack(t){this._filterStack=t;}},{key:"_getOrCreateRenderTarget",value:function _getOrCreateRenderTarget(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._renderTargets.pop();if(!e){e=new Ls(this._renderer,this._textureFrame.width,this._textureFrame.height,1);}if(this._currentFrame){e.setFrame(this._currentFrame);}if(t){e.clear();}return e;}},{key:"pushFilters",value:function pushFilters(t,e){var r=t.getBounds();this._currentFrame=r;var o=t.getFilterRectangle();if(o.width>0&&o.height>0){this._currentFrame=o;}var n=this._getOrCreateRenderTarget();this._renderer.setRenderTarget(n);var s=e[0]instanceof Dd;if(s){n.clear(this._renderer.getClearColor());}else{n.clear();}this._filterStack.push({renderTarget:n,filters:e});}},{key:"popFilters",value:function popFilters(){var t=this._filterStack.pop();if(!t)return void 0;var e=t.filters,r=t.renderTarget;var o=this._filterStack[this._filterStack.length-1];var n=r;var s=o.renderTarget;var a=n.getFrame();if(a){this._quad.map(this._textureFrame,a);}var l=e[0].getShaderForRenderer(this._renderer);var c=this._quad.getVertexBuffer();var u=this._quad.getIndexBuffer();var m=this._renderer.getContext();m.bindBuffer(m.ARRAY_BUFFER,c);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,u);var p=l.getAttributeLocations();m.vertexAttribPointer(p.a_position,2,m.FLOAT,false,0,0);m.vertexAttribPointer(p.a_texCoord,2,m.FLOAT,false,0,2*4*4);m.vertexAttribPointer(p.a_color,4,m.FLOAT,false,0,4*4*4);this._renderer.updateTexture(n.getBaseTexture(),false);if(e.length===1){e[0].apply(this._renderer,n,s);this._renderTargets.push(n);}else{this._applyFilters(e,n,s);}return e;}},{key:"_applyFilters",value:function _applyFilters(t,e,r){var _this60=this;var o=e;var n=this._getOrCreateRenderTarget(true);this._renderer.updateTexture(n.getBaseTexture(),false);var s=t[t.length-1];t.forEach(function(a){var l=a===s;if(!l){a.apply(_this60._renderer,o,n,true);var c=o;o=n;n=c;}else{a.apply(_this60._renderer,o,r,true);}});this._renderTargets.push(o);this._renderTargets.push(n);}},{key:"_onContextChange",value:function _onContextChange(){this._renderTargets.length=0;if(bd(this._renderer)){if(this._quad){this._quad.dispose();}this._quad=new G1(this._renderer.getContext());}}},{key:"dispose",value:function dispose(){this._renderer.off("context",this._onContextChange);if(this._quad){this._quad.dispose();}this._renderTargets.forEach(function(t){t.dispose();});}}]);return lh;}();});var v3=Gt(function(VDt,j1){var ch=function ch(){function i(u){r.appendChild(u.dom);return u;}function t(u){for(var m=0;mn+1e3&&(a.update(1e3*s/(u-n),100),n=u,s=0,c)){var m=performance.memory;c.update(m.usedJSHeapSize/1048576,m.jsHeapSizeLimit/1048576);}return u;},update:function update(){o=this.end();},domElement:r,setMode:t};};ch.Panel=function(i,t,e){var r=Infinity,o=0,n=Math.round,s=n(window.devicePixelRatio||1),a=80*s,l=48*s,c=3*s,u=2*s,m=3*s,p=15*s,h=74*s,g=30*s,x=document.createElement("canvas");x.width=a;x.height=l;x.style.cssText="width:80px;height:48px";var v=x.getContext("2d");v.font="bold "+9*s+"px Helvetica,Arial,sans-serif";v.textBaseline="top";v.fillStyle=e;v.fillRect(0,0,a,l);v.fillStyle=t;v.fillText(i,c,u);v.fillRect(m,p,h,g);v.fillStyle=e;v.globalAlpha=.9;v.fillRect(m,p,h,g);return{dom:x,update:function update(b,T){r=Math.min(r,b);o=Math.max(o,b);v.fillStyle=e;v.globalAlpha=1;v.fillRect(0,0,a,p);v.fillStyle=t;v.fillText(n(b)+" "+i+" ("+n(r)+"-"+n(o)+")",c,u);v.drawImage(x,m+s,p,h-s,g,m,p,h-s,g);v.fillRect(m+h-s,p,s,g);v.fillStyle=e;v.globalAlpha=.9;v.fillRect(m+h-s,p,s,n((1-b/T)*g));}};};_typeof(j1)==="object"&&(j1.exports=ch);});var Ya,Py;var C3=d(function(){Ya=y(v3());Py=/*#__PURE__*/function(){function Py(t){_classCallCheck(this,Py);this._context=t;this._domAvailable=typeof document!=="undefined";this._hookIntoContext();this._textures={};this._framebuffers={};this._programs={};this._shaders={};this._buffers={};this._boundTexture=null;this._id=0;this._enums={};this._setupStats();this._createEnumMap();this._updateMemoryStats=this._updateMemoryStats.bind(this);this._updateMemoryStats();}_createClass(Py,[{key:"_createEnumMap",value:function _createEnumMap(){for(var t in this._context){var e=this._context[t];if(typeof e==="number"){this._enums[e]=t;}}}},{key:"_enumValueToString",value:function _enumValueToString(t){var e=this._enums[t];return typeof e==="undefined"?t:e;}},{key:"_setupStats",value:function _setupStats(){if(!this._domAvailable)return;this._stats=new Ya["default"]();this._stats.showPanel(3);this._memPanel=this._stats.addPanel(new Ya["default"].Panel("MB [WebGL]","#43ADEB","#282828"));this._texPanel=this._stats.addPanel(new Ya["default"].Panel("Textures","#43ADEB","#282828"));this._bufPanel=this._stats.addPanel(new Ya["default"].Panel("Buffers","#43ADEB","#282828"));this._fboPanel=this._stats.addPanel(new Ya["default"].Panel("FBOs","#43ADEB","#282828"));this._prgPanel=this._stats.addPanel(new Ya["default"].Panel("Programs","#43ADEB","#282828"));this._shdPanel=this._stats.addPanel(new Ya["default"].Panel("Shaders","#43ADEB","#282828"));}},{key:"_updatePanel",value:function _updatePanel(t){if(!this._domAvailable)return;this._stats.begin();switch(t){case"tex":this._texPanel.update(this.getTexturesCount(),50);break;case"buf":this._bufPanel.update(this.getBuffersCount(),50);break;case"fbo":this._fboPanel.update(this.getFBOCount(),50);break;case"prg":this._prgPanel.update(this.getProgramCount(),50);break;case"shd":this._shdPanel.update(this.getShaderCount(),50);break;}this._stats.end();}},{key:"getTexturesCount",value:function getTexturesCount(){return Object.keys(this._textures).length;}},{key:"getBuffersCount",value:function getBuffersCount(){return Object.keys(this._buffers).length;}},{key:"getFBOCount",value:function getFBOCount(){return Object.keys(this._framebuffers).length;}},{key:"getProgramCount",value:function getProgramCount(){return Object.keys(this._programs).length;}},{key:"getShaderCount",value:function getShaderCount(){return Object.keys(this._shaders).length;}},{key:"_updateMemoryStats",value:function _updateMemoryStats(){if(!this._domAvailable)return;var t=this._getMemoryUsage()/1e3/1e3;this._memPanel.update(t,400);setTimeout(this._updateMemoryStats,1e3);}},{key:"_getMemoryUsage",value:function _getMemoryUsage(){var t=0;for(var e in this._textures){t+=this._textures[e].memory;}for(var _e3 in this._buffers){t+=this._buffers[_e3].memory;}return t;}},{key:"_hookIntoContext",value:function _hookIntoContext(){var _this61=this;var _loop3=function _loop3(t){var e=_this61._context[t];if(typeof e==="function"){_this61[t]=function(){var o=this._context[t];for(var _len14=arguments.length,r=new Array(_len14),_key14=0;_key14<_len14;_key14++){r[_key14]=arguments[_key14];}return this._trackGLCall(o,t,r);};}else{_this61._makePropertyWrapper(t);}};for(var t in this._context){_loop3(t);}}},{key:"_makePropertyWrapper",value:function _makePropertyWrapper(t){var e=["_context"];if(e.indexOf(t)!==-1)return;var r=this._context;this.__defineGetter__(t,function(){return r[t];});this.__defineSetter__(t,function(o){r[t]=o;});}},{key:"_trackGLCall",value:function _trackGLCall(t,e,r){var o=["texImage2D","bindTexture","createTexture","deleteTexture","createBuffer","bindBuffer","bufferData","deleteBuffer","createFramebuffer","deleteFramebuffer","createProgram","deleteProgram","createShader","deleteShader"];var n;if(o.indexOf(e)!==-1){n=this["_".concat(e)](r);}else{n=t.apply(this._context,r);}var s=this._context.getError();if(s!==0){var a=r.join(", ");if(a.length>100){a="".concat(a.substr(0,100),"...");}console.error(new Error("WebGL Error ".concat(this._enumValueToString(s)," in ").concat(e,"(").concat(a,")")));}return n;}},{key:"_createProgram",value:function _createProgram(){var t=this._context.createProgram();t._wmmId=this._id++;this._programs[t._wmmId]=t;this._updatePanel("prg");return t;}},{key:"_deleteProgram",value:function _deleteProgram(_ref91){var _ref92=_slicedToArray(_ref91,1),t=_ref92[0];if(!t||!this._programs[t._wmmId])return;delete this._programs[t._wmmId];this._context.deleteProgram(t);this._updatePanel("prg");}},{key:"_createShader",value:function _createShader(_ref93){var _ref94=_slicedToArray(_ref93,1),t=_ref94[0];var e=this._context.createShader(t);e._wmmId=this._id++;this._shaders[e._wmmId]=e;this._updatePanel("shd");return e;}},{key:"_deleteShader",value:function _deleteShader(_ref95){var _ref96=_slicedToArray(_ref95,1),t=_ref96[0];if(!t||!this._shaders[t._wmmId])return;delete this._shaders[t._wmmId];this._context.deleteShader(t);this._updatePanel("shd");}},{key:"_createFramebuffer",value:function _createFramebuffer(){var t=this._context.createFramebuffer();t._wmmId=this._id++;this._framebuffers[t._wmmId]=t;this._updatePanel("fbo");return t;}},{key:"_deleteFramebuffer",value:function _deleteFramebuffer(_ref97){var _ref98=_slicedToArray(_ref97,1),t=_ref98[0];if(!t||!this._framebuffers[t._wmmId])return;delete this._framebuffers[t._wmmId];this._context.deleteFramebuffer(t);this._updatePanel("fbo");}},{key:"_createBuffer",value:function _createBuffer(){var t=this._context.createBuffer();t._wmmId=this._id++;this._buffers[t._wmmId]={buffer:t,memory:0};this._updatePanel("buf");return t;}},{key:"_bindBuffer",value:function _bindBuffer(_ref99){var _ref100=_slicedToArray(_ref99,2),t=_ref100[0],e=_ref100[1];this._context.bindBuffer(t,e);this._boundBuffer=e._wmmId;}},{key:"_bufferData",value:function _bufferData(_ref101){var _ref102=_slicedToArray(_ref101,3),t=_ref102[0],e=_ref102[1],r=_ref102[2];this._context.bufferData(t,e,r);var o;if(typeof e==="number"){o=e;}else if("byteLength"in e){o=e.byteLength;}else if("length"in e){o=e.length;}this._buffers[this._boundBuffer].memory=o;}},{key:"_deleteBuffer",value:function _deleteBuffer(_ref103){var _ref104=_slicedToArray(_ref103,1),t=_ref104[0];if(!t||!this._buffers[t._wmmId])return;delete this._buffers[t._wmmId];this._context.deleteBuffer(t);this._updatePanel("buf");}},{key:"_createTexture",value:function _createTexture(){var t=this._context.createTexture();t._wmmId=this._id++;this._textures[t._wmmId]={texture:t,memory:0};this._updatePanel("tex");return t;}},{key:"_deleteTexture",value:function _deleteTexture(_ref105){var _ref106=_slicedToArray(_ref105,1),t=_ref106[0];if(!t||!this._textures[t._wmmId])return;delete this._textures[t._wmmId];this._context.deleteTexture(t);this._updatePanel("tex");}},{key:"_bindTexture",value:function _bindTexture(_ref107){var _ref108=_slicedToArray(_ref107,2),t=_ref108[0],e=_ref108[1];this._context.bindTexture(t,e);this._boundTexture=e._wmmId;}},{key:"_texImage2D",value:function _texImage2D(t){var _t6=_slicedToArray(t,9),e=_t6[2],r=_t6[3],o=_t6[4],n=_t6[5],s=_t6[8];if(typeof s==="undefined"){s=n;}this._context.texImage2D.apply(this._context,t);var a=this._calculateByteCountForTexture(e,r,o,s);this._textures[this._boundTexture].memory=a;}},{key:"_calculateByteCountForTexture",value:function _calculateByteCountForTexture(t,e,r,o){if(o!==null){if("width"in o){e=o.width;r=o.height;}else{return o.length;}}var n=1;switch(t){case this._context.ALPHA:n=1;break;case this._context.RGB:n=3;break;case this._context.RGBA:n=4;break;}return e*r*n;}}]);return Py;}();});var uh;var $1=d(function(){uh=/*#__PURE__*/function(){function uh(t){_classCallCheck(this,uh);this._renderer=t;this._onContextChange=this._onContextChange.bind(this);this._renderer.on("context",this._onContextChange);}_createClass(uh,[{key:"_onContextChange",value:function _onContextChange(){}},{key:"start",value:function start(){}},{key:"stop",value:function stop(){this.flush();}},{key:"flush",value:function flush(){}},{key:"dispose",value:function dispose(){this._renderer.off("context",this._onContextChange);delete this._renderer;}}]);return uh;}();});var K1;var S3=d(function(){Le();$1();K1=/*#__PURE__*/function(_uh){_inherits(K1,_uh);var _super32=_createSuper(K1);function K1(t){var _this62;_classCallCheck(this,K1);_this62=_super32.call(this,t);_this62._vertexBuffer=null;_this62._indexBuffer=null;_this62._maxBatchSize=wd;_this62._vertices=new ArrayBuffer(wd*4*Xa);_this62._positions=new Float32Array(_this62._vertices);_this62._colors=new Uint32Array(_this62._vertices);_this62._indices=new Uint16Array(wd*6);for(var e=0,r=0;e=this._maxBatchSize){this.flush();}var n=e.getUVs();if(!n){return;}var s=this._currentBatchSize*Xa;this._addVertexCoordinates(t,s,r);this._addTextureUVs(t,s,n);this._addColors(t,s);this._sprites[this._currentBatchSize]=t;this._currentBatchSize++;}},{key:"_addColors",value:function _addColors(t,e){var r=this._colors;var o=16777215;var n=(o>>16)+(o&65280)+((o&255)<<16)+(t.getWorldAlpha()*255<<24);r[e+4]=r[e+9]=r[e+14]=r[e+19]=n;}},{key:"_addTextureUVs",value:function _addTextureUVs(t,e,r){var o=this._positions;var _r6=_slicedToArray(r,4),n=_r6[0],s=_r6[1],a=_r6[2],l=_r6[3];o[e+2]=n.x;o[e+3]=n.y;o[e+7]=s.x;o[e+8]=s.y;o[e+12]=a.x;o[e+13]=a.y;o[e+17]=l.x;o[e+18]=l.y;}},{key:"_addVertexCoordinates",value:function _addVertexCoordinates(t,e,r){var o=this._positions;var n=t.getWorldTransform();var s=t.getAnchor();var a=n.rectangleToCoordinates(r,s);var l=5;for(var c=0;c<4;c++){o[e+c*l]=a[c].x;o[e+c*l+1]=a[c].y;}}},{key:"_onContextChange",value:function _onContextChange(){var t=this._renderer.getContext();this._shader=this._renderer.shaders["default"];if(this._vertexBuffer){this._vertexBuffer=null;}if(this._indexBuffer){this._indexBuffer=null;}this._vertexBuffer=t.createBuffer();this._indexBuffer=t.createBuffer();t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this._indexBuffer);t.bufferData(t.ELEMENT_ARRAY_BUFFER,this._indices,t.STATIC_DRAW);t.bindBuffer(t.ARRAY_BUFFER,this._vertexBuffer);t.bufferData(t.ARRAY_BUFFER,this._vertices,t.DYNAMIC_DRAW);}},{key:"start",value:function start(){if(this._vertexBuffer&&this._indexBuffer){this._shader.setupBuffers(this._vertexBuffer,this._indexBuffer);}}},{key:"flush",value:function flush(){var p;var t=this._renderer;var e=t.getContext();if(this._currentBatchSize===0){return;}if(this._currentBatchSize>wd*.5){e.bufferSubData(e.ARRAY_BUFFER,0,this._vertices);}else{var h=this._positions.subarray(0,this._currentBatchSize*Xa);e.bufferSubData(e.ARRAY_BUFFER,0,h);}var r=0;var o=null;var n=null;var s=null;var a=null;var l=false;var c=false;var u=null;var m=0;for(var _h3=0,g=this._currentBatchSize;_h30&&arguments[0]!==undefined?arguments[0]:800;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:600;var r=arguments.length>2?arguments[2]:undefined;_classCallCheck(this,X1);_this63=_super33.call(this,t,e,r);_this63.type="webgl";_this63.maxTextureDimensions=null;_this63._type="webgl";_this63._onContextLost=_this63._onContextLost.bind(_assertThisInitialized(_this63));_this63._onContextRestored=_this63._onContextRestored.bind(_assertThisInitialized(_this63));_this63.setCanvas(_this63._options.canvas||pi.createCanvas());_this63.shaders={"default":new A1(_assertThisInitialized(_this63),void 0,void 0)};_this63.renderers={sprite:new K1(_assertThisInitialized(_this63))};return _this63;}_createClass(X1,[{key:"_onContextLost",value:function _onContextLost(t){t.preventDefault();Y.warn(this.constructor.name,"WebGL context has been lost - trying to restore.");this.emit("context-lost");}},{key:"_onContextCreationError",value:function _onContextCreationError(t){t.preventDefault();Y.warn(this.constructor.name,"Failed to create WebGL context: ".concat(t.statusMessage||"Unknown error"));}},{key:"_onContextRestored",value:function _onContextRestored(){Y.warn(this.constructor.name,"WebGL context has been restored. Clearing all textures.");this._createContext();this._setupContext();this.emit("context-restored");}},{key:"_onBeforeContext",value:function _onBeforeContext(){if(this._filterManager){this._filterManager.dispose();}this._filterManager=new lh(this);this._currentObjectRenderer=new uh(this);}},{key:"setShader",value:function setShader(t){this._currentShader=t;this._context.useProgram(t.getProgram());this._setAttributesForShader(t);}},{key:"setCanvas",value:function setCanvas(t){if(this._canvas){this._removeContextEventListeners();}_get(_getPrototypeOf(X1.prototype),"setCanvas",this).call(this,t);this._addContextEventListeners();}},{key:"_addContextEventListeners",value:function _addContextEventListeners(){if(_1(this._canvas)){this._canvas.addEventListener("webglcontextlost",this._onContextLost);this._canvas.addEventListener("webglcontextrestored",this._onContextRestored);this._canvas.addEventListener("webglcontextcreationerror",this._onContextCreationError);}}},{key:"_removeContextEventListeners",value:function _removeContextEventListeners(){if(_1(this._canvas)){this._canvas.removeEventListener("webglcontextlost",this._onContextLost);this._canvas.removeEventListener("webglcontextrestored",this._onContextRestored);this._canvas.removeEventListener("webglcontextcreationerror",this._onContextCreationError);}}},{key:"_setAttributesForShader",value:function _setAttributesForShader(t){if(!this._canvas)return;var e=this._context;var r=t.getAttributes();var o=t.getAttributeLocations();r.forEach(function(n){var s=o[n];e.enableVertexAttribArray(s);});}},{key:"_createContext",value:function _createContext(){if(!this._canvas)return;var t=pi.glGet(this._canvas);if(this._options.debug){y3(t);}if(this._options.debug){t=new By(t);t=new Py(t);}this.id=_X2.contextId++;this._context=t;this._maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE);this.emit("context",t);return t;}},{key:"_setupContext",value:function _setupContext(){var t=this._context;t.disable(t.DEPTH_TEST);t.disable(t.CULL_FACE);t.enable(t.BLEND);t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA);this._defaultRenderTarget=new Ls(this,this._width,this._height,this._pixelRatio,true);this.setRenderTarget(this._defaultRenderTarget);this._getMaxPrecision();}},{key:"getContext",value:function getContext(){return this._context;}},{key:"_getMaxPrecision",value:function _getMaxPrecision(){var t=this._context;var e=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);this._maxFloatPrecision=(e==null?void 0:e.precision)!==0?"highp":"mediump";var r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_INT);this._maxIntPrecision=(r==null?void 0:r.rangeMax)!==0?"highp":"lowp";}},{key:"resizeTo",value:function resizeTo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;_get(_getPrototypeOf(X1.prototype),"resizeTo",this).call(this,t,e);if(this._currentRenderTarget){this._currentRenderTarget.resizeTo(t);}this._context=pi.glResize(this._context,t);}},{key:"setRenderTarget",value:function setRenderTarget(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._defaultRenderTarget;this._currentRenderTarget=t;this._currentRenderTarget.activate();}},{key:"setObjectRenderer",value:function setObjectRenderer(t){this._currentObjectRenderer.stop();this._currentObjectRenderer=t;this._currentObjectRenderer.start();}},{key:"render",value:function render(t){this.setRenderTarget(this._defaultRenderTarget);this._defaultRenderTarget.clear(this._clearColor);var e=t.getParent();t.setParent(new ac());t.updateTransform();if(e){t.setParent(e);}this.renderDisplayObject(t,this._defaultRenderTarget);}},{key:"renderDisplayObject",value:function renderDisplayObject(t,e){this.setRenderTarget(e);this._filterManager.setFilterStack(e.getFilterStack());t.renderWebGL(this);this._currentObjectRenderer.flush();}},{key:"clear",value:function clear(){var t=this._context;t.clearColor.apply(t,this._clearColor.toGLColor);t.clear(t.COLOR_BUFFER_BIT);}},{key:"save",value:function save(){return{renderTarget:this._currentRenderTarget,objectRenderer:this._currentObjectRenderer,filterStack:this._filterManager.getFilterStack()};}},{key:"restore",value:function restore(t){this.setRenderTarget(t.renderTarget);this._filterManager.setFilterStack(t.filterStack);this._currentObjectRenderer=t.objectRenderer;}},{key:"getOrCreateGLTexture",value:function getOrCreateGLTexture(t){var e=this._context;var r=t.getGLTextureForRenderer(this);if(!r){r=e.createTexture();t.setGLTextureForRenderer(r,this);}return r;}},{key:"updateTexture",value:function updateTexture(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var r=t.getSource();var o=this._context;var n=t.getGLUnit();var s=this.getOrCreateGLTexture(t);o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_2D,s);o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,true);if(e&&r){pi.glTexImage(o,r);}if(t.isMipMappingEnabled()){o.generateMipmap(o.TEXTURE_2D);}else{o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,t.getGLRepeat(o,"x"));o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,t.getGLRepeat(o,"y"));}o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,t.getGLFilter(o,"min"));o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t.getGLFilter(o,"mag"));o.activeTexture(o.TEXTURE0);}},{key:"getMaxDimensions",value:function getMaxDimensions(){if(!this.maxTextureDimensions){this.maxTextureDimensions=pi.glMaxTexture(this._context);}return this.maxTextureDimensions;}},{key:"getCurrentRenderTarget",value:function getCurrentRenderTarget(){return this._currentRenderTarget;}},{key:"getCurrentObjectRenderer",value:function getCurrentObjectRenderer(){return this._currentObjectRenderer;}},{key:"getMaxFloatPrecision",value:function getMaxFloatPrecision(){return this._maxFloatPrecision;}},{key:"getMaxIntPrecision",value:function getMaxIntPrecision(){return this._maxIntPrecision;}},{key:"dispose",value:function dispose(){if(this._canvas){$t(this._canvas);}this._filterManager.dispose();this._currentObjectRenderer.dispose();this._defaultRenderTarget.dispose();for(var r in this.shaders){this.shaders[r].dispose();delete this.shaders[r];}this._removeContextEventListeners();var t=this._context;var e=t.getExtension("WEBGL_lose_context");if(e){e.loseContext();}}}]);return X1;}(sh);My=_X2;My.contextId=0;});var vrt,Crt,q1;var T3=d(function(){Bs();vrt=function vrt(){return[new _ot2(0,0),new _ot2(1,0),new _ot2(1,1),new _ot2(0,1)];};Crt=function Crt(i,t,e){var _i2=_slicedToArray(i,4),r=_i2[0],o=_i2[1],n=_i2[2],s=_i2[3];r.x=t.x/e.width;r.y=t.y/e.height;o.x=(t.x+t.width)/e.width;o.y=t.y/e.height;n.x=(t.x+t.width)/e.width;n.y=(t.y+t.height)/e.height;s.x=t.x/e.width;s.y=(t.y+t.height)/e.height;return i;};q1={create:vrt,updateViaFrames:Crt};});var _Ja;var Y1=d(function(){T3();Le();Fd();_Ja=/*#__PURE__*/function(_Vi4){_inherits(Ja,_Vi4);var _super34=_createSuper(Ja);function Ja(t,e){var _this64;_classCallCheck(this,Ja);_this64=_super34.call(this);if(!(t instanceof Ae)){throw new Error("`baseTexture` should be an instance of BaseTexture");}_this64._uvs=q1.create();_this64._frame=e?e.clone():new _ce(0,0,1,1);_this64._frameLocked=Boolean(e);_this64._onBaseTextureLoaded=_this64._onBaseTextureLoaded.bind(_assertThisInitialized(_this64));_this64._onBaseTextureUpdated=_this64._onBaseTextureUpdated.bind(_assertThisInitialized(_this64));_this64.setBaseTexture(t);return _this64;}_createClass(Ja,[{key:"_onBaseTextureLoaded",value:function _onBaseTextureLoaded(){if(!this._frameLocked){var t=this._baseTexture.getFrame().clone();this.setFrame(t);}this._baseTexture.on("update",this._onBaseTextureUpdated);}},{key:"_onBaseTextureUpdated",value:function _onBaseTextureUpdated(){var _this$_baseTexture$ge=this._baseTexture.getFrame(),t=_this$_baseTexture$ge.width,e=_this$_baseTexture$ge.height;this._frame.width=t;this._frame.height=e;this.emit("update");}},{key:"_updateUVs",value:function _updateUVs(){this._uvs=q1.updateViaFrames(this._uvs,this._frame,this._baseTexture.getFrame());}},{key:"getBaseTexture",value:function getBaseTexture(){return this._baseTexture;}},{key:"setBaseTexture",value:function setBaseTexture(t){this._baseTexture=t;if(!this._baseTexture.isLoaded()){this._baseTexture.once("loaded",this._onBaseTextureLoaded);}else{var _t$getFrame=t.getFrame(),e=_t$getFrame.width,r=_t$getFrame.height;if(!this._frameLocked){this._frame=new _ce(0,0,e,r);}this._onBaseTextureLoaded();}}},{key:"getFrame",value:function getFrame(){return this._frame;}},{key:"setFrame",value:function setFrame(t){this._frame=t;this._updateUVs();}},{key:"getWidth",value:function getWidth(){return this._frame.width;}},{key:"getHeight",value:function getHeight(){return this._frame.height;}},{key:"getUVs",value:function getUVs(){return this._uvs;}},{key:"getDimensions",value:function getDimensions(){return new _ot2(this._frame.width,this._frame.height);}},{key:"dispose",value:function dispose(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;t&&this._baseTexture.dispose();}}],[{key:"fromImage",value:function fromImage(t){var e=new Ae(t);return new _Ja(e);}},{key:"fromCanvas",value:function fromCanvas(t){var e=new Ae(t);return new _Ja(e);}}]);return Ja;}(Vi);});var dh,mh;var J1=d(function(){Ar();Le();Ay();V1();rh();ah();Fd();Y1();dh=function dh(i){return i._type==="webgl";};mh=/*#__PURE__*/function(_Ja2){_inherits(mh,_Ja2);var _super35=_createSuper(mh);function mh(t){var _this65;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:100;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;_classCallCheck(this,mh);_this65=_super35.call(this,new Ae(),new _ce(0,0,e,r));_this65._loaded=true;_this65._width=e;_this65._height=r;_this65._pixelRatio=o;_this65._renderer=t;_this65._setupFilterManager();_this65._setupBuffer();_this65.setBaseTexture(_this65._renderTarget.getBaseTexture());_this65._updateUVs();return _this65;}_createClass(mh,[{key:"_setupFilterManager",value:function _setupFilterManager(){if(this._filterManager){this._filterManager.dispose();}if(dh(this._renderer)){this._filterManager=new lh(this._renderer);}else{this._filterManager=new lc(this._renderer);}this._filterManager.resizeTo(new _ot2(this._width,this._height));}},{key:"_setupBuffer",value:function _setupBuffer(){if(this._renderTarget){this._renderTarget.dispose();}if(dh(this._renderer)){this._renderTarget=new Ls(this._renderer,this._width,this._height,this._pixelRatio);}else{this._renderTarget=new Ms(this._width,this._height,this._pixelRatio);}}},{key:"clear",value:function clear(t){this._renderTarget.clear(t);}},{key:"resizeTo",value:function resizeTo(t){if(this._width===t.x&&this._height===t.y){return;}this._width=t.x;this._height=t.y;this._frame.width=t.x;this._frame.height=t.y;this._renderTarget.resizeTo(t);this._filterManager.resizeTo(t);}},{key:"render",value:function render(t){if(dh(this._renderer)){this._renderWebGL(t);}else{this._renderCanvas(t);}}},{key:"_renderWebGL",value:function _renderWebGL(t){if(!dh(this._renderer))return;this._renderTarget.activate();t.getWorldTransform().reset();t.getChildren().forEach(function(r){r.updateTransform();});var e=this._renderer.getFilterManager();this._renderer.setFilterManager(this._filterManager);this._renderer.renderDisplayObject(t,this._renderTarget);this._renderer.setFilterManager(e);}},{key:"_renderCanvas",value:function _renderCanvas(t){if(dh(this._renderer))return;t.getWorldTransform().reset();t.getChildren().forEach(function(r){r.updateTransform();});var e=this._renderer.getFilterManager();this._renderer.setFilterManager(this._filterManager);this._renderer.renderDisplayObject(t,this._renderTarget);this._renderer.setFilterManager(e);}},{key:"getRenderTarget",value:function getRenderTarget(){return this._renderTarget;}},{key:"dispose",value:function dispose(){this._renderTarget.dispose();this._filterManager.dispose();_get(_getPrototypeOf(mh.prototype),"dispose",this).call(this);}}]);return mh;}(_Ja);});var Rd,zs;var ph=d(function(){Rd={EXPORT:"export",CLOSE:"close",OPERATION_CREATED:"operation:created",OPERATION_UPDATED:"operation:updated",OPERATION_REMOVED:"operation:removed",EDITOR_READY:"editor:ready",WINDOW_RESIZE:"window:resize",ZOOM_DONE:"editor:zoom_done",HISTORY_UNDO:"history:undo",HISTORY_UPDATED:"history:update",FEATURES_DISABLED:"editor:features:disabled",FEATURES_ENABLED:"editor:features:enabled",FEATURES_UPDATED:"editor:features:updated",TRANSFORM_REAPPLY_RATIO:"transform:reapply_ratio"};zs={DEFAULTS:{FILTERS:[{identifier:"imgly_filters_duotone",defaultName:"DuoTone",assetFileName:"duotone",filters:[{identifier:"imgly_duotone_desert",defaultName:"Desert",lightColor:"#e1de9a",darkColor:"#cb2129"},{identifier:"imgly_duotone_peach",defaultName:"Peach",lightColor:"#e9abb8",darkColor:"#0040ff"},{identifier:"imgly_duotone_clash",defaultName:"Clash",lightColor:"#f41a0f",darkColor:"#23007c"},{identifier:"imgly_duotone_plum",defaultName:"Plum",lightColor:"#74d7ff",darkColor:"#23007c"},{identifier:"imgly_duotone_breezy",defaultName:"Breezy",lightColor:"#68fdff",darkColor:"#c20000"},{identifier:"imgly_duotone_deepblue",defaultName:"Deep Blue",lightColor:"#2de9eb",darkColor:"#58007c"},{identifier:"imgly_duotone_frog",defaultName:"Frog",lightColor:"#5bff60",darkColor:"#7f23a9"},{identifier:"imgly_duotone_sunset",defaultName:"Sunset",lightColor:"#f8ea46",darkColor:"#c400be"}]},{identifier:"imgly_filters_bw",assetFileName:"b&w",defaultName:"Black & White",filters:[{identifier:"imgly_lut_ad1920",defaultName:"1920 A.D.",lutImage:"filters/imgly_lut_ad1920_5_5_128.png"},{identifier:"imgly_lut_bw",defaultName:"Greyed",lutImage:"filters/imgly_lut_bw_5_5_128.png"},{identifier:"imgly_lut_x400",defaultName:"Dusty",lutImage:"filters/imgly_lut_dusty_5_5_128.png"},{identifier:"imgly_lut_litho",defaultName:"Litho",lutImage:"filters/imgly_lut_litho_5_5_128.png"},{identifier:"imgly_lut_sepiahigh",defaultName:"Sepia",lutImage:"filters/imgly_lut_sepia_5_5_128.png"},{identifier:"imgly_lut_plate",defaultName:"Weathered",lutImage:"filters/imgly_lut_weathered_5_5_128.png"},{identifier:"imgly_lut_sin",defaultName:"Hard Stuff",lutImage:"filters/imgly_lut_hard_stuff_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8}]},{identifier:"imgly_filters_retro",assetFileName:"vintage",defaultName:"Vintage",filters:[{identifier:"imgly_lut_blues",defaultName:"Polaroid",lutImage:"filters/imgly_lut_polaroid_5_5_128.png"},{identifier:"imgly_lut_front",defaultName:"Sunny 70s",lutImage:"filters/imgly_lut_sunny_70s_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_texas",defaultName:"Oldtimer",lutImage:"filters/imgly_lut_oldtimer_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_celsius",defaultName:"Inferno",lutImage:"filters/imgly_lut_inferno_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_cool",defaultName:"Snappy",lutImage:"filters/imgly_lut_snappy_5_5_128.png"}]},{identifier:"imgly_filters_analog",assetFileName:"smooth",defaultName:"Smooth",filters:[{identifier:"imgly_lut_chest",defaultName:"Chestnut",lutImage:"filters/imgly_lut_chestnut_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_winter",defaultName:"Softly",lutImage:"filters/imgly_lut_softly_5_5_128.png"},{identifier:"imgly_lut_kdynamic",defaultName:"Pebble",lutImage:"filters/imgly_lut_pebble_5_5_128.png"},{identifier:"imgly_lut_fall",defaultName:"Moss",lutImage:"filters/imgly_lut_moss_5_5_128.png"},{identifier:"imgly_lut_lenin",defaultName:"Lemon",lutImage:"filters/imgly_lut_lemon_5_5_128.png"},{identifier:"imgly_lut_pola669",defaultName:"Green Gap",lutImage:"filters/imgly_lut_green_gap_5_5_128.png"}]},{identifier:"imgly_filters_winter",assetFileName:"cold",defaultName:"Cold",filters:[{identifier:"imgly_lut_elder",defaultName:"Colla",lutImage:"filters/imgly_lut_colla_5_5_128.png"},{identifier:"imgly_lut_orchid",defaultName:"Solanus",lutImage:"filters/imgly_lut_solanus_5_5_128.png"},{identifier:"imgly_lut_bleached",defaultName:"Kalmen",lutImage:"filters/imgly_lut_kalmen_5_5_128.png"},{identifier:"imgly_lut_bleachedblue",defaultName:"Joran",lutImage:"filters/imgly_lut_joran_5_5_128.png"},{identifier:"imgly_lut_breeze",defaultName:"Levante",lutImage:"filters/imgly_lut_levante_5_5_128.png"},{identifier:"imgly_lut_blueshadows",defaultName:"Zephyr",lutImage:"filters/imgly_lut_zephyr_5_5_128.png"}]},{identifier:"imgly_filters_summer",assetFileName:"warm",defaultName:"Warm",filters:[{identifier:"imgly_lut_sunset",defaultName:"Golden",lutImage:"filters/imgly_lut_golden_5_5_128.png"},{identifier:"imgly_lut_eighties",defaultName:"Low Fire",lutImage:"filters/imgly_lut_low_fire_5_5_128.png"},{identifier:"imgly_lut_evening",defaultName:"Sunrise",lutImage:"filters/imgly_lut_sunrise_5_5_128.png"},{identifier:"imgly_lut_k2",defaultName:"Flat Black",lutImage:"filters/imgly_lut_flat_black_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_nogreen",defaultName:"Pumpkin",lutImage:"filters/imgly_lut_pumpkin_5_5_128.png"}]},{identifier:"imgly_filters_legacy",defaultName:"Legacy",assetFileName:"legacy",filters:[{identifier:"imgly_lut_ancient",defaultName:"Ancient",lutImage:"filters/imgly_lut_ancient_5_5_128.png"},{identifier:"imgly_lut_cottoncandy",defaultName:"Candy",lutImage:"filters/imgly_lut_cottoncandy_5_5_128.png"},{identifier:"imgly_lut_classic",defaultName:"Classic",lutImage:"filters/imgly_lut_classic_5_5_128.png"},{identifier:"imgly_lut_colorful",defaultName:"Colorful",lutImage:"filters/imgly_lut_colorful_5_5_128.png"},{identifier:"imgly_lut_creamy",defaultName:"Creamy",lutImage:"filters/imgly_lut_creamy_5_5_128.png"},{identifier:"imgly_lut_fixie",defaultName:"Fixie",lutImage:"filters/imgly_lut_fixie_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_food",defaultName:"Food",lutImage:"filters/imgly_lut_food_5_5_128.png"},{identifier:"imgly_lut_fridge",defaultName:"Fridge",lutImage:"filters/imgly_lut_fridge_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_glam",defaultName:"Glam",lutImage:"filters/imgly_lut_glam_5_5_128.png"},{identifier:"imgly_lut_gobblin",defaultName:"Gobblin",lutImage:"filters/imgly_lut_gobblin_5_5_128.png"},{identifier:"imgly_lut_highcontrast",defaultName:"Hicon",lutImage:"filters/imgly_lut_highcontrast_5_5_128.png"},{identifier:"imgly_lut_highcarb",defaultName:"High Carb",lutImage:"filters/imgly_lut_highcarb_5_5_128.png"},{identifier:"imgly_lut_k1",defaultName:"K1",lutImage:"filters/imgly_lut_k1_5_5_128.png"},{identifier:"imgly_lut_k6",defaultName:"K6",lutImage:"filters/imgly_lut_k6_5_5_128.png"},{identifier:"imgly_lut_keen",defaultName:"Keen",lutImage:"filters/imgly_lut_keen_5_5_128.png"},{identifier:"imgly_lut_lomo",defaultName:"Lomo",lutImage:"filters/imgly_lut_lomo_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_lomo100",defaultName:"Lomo 100",lutImage:"filters/imgly_lut_lomo100_5_5_128.png"},{identifier:"imgly_lut_lucid",defaultName:"Lucid",lutImage:"filters/imgly_lut_lucid_5_5_128.png"},{identifier:"imgly_lut_mellow",defaultName:"Mellow",lutImage:"filters/imgly_lut_mellow_8_8_512.png",resolution:512,horizontalTileCount:8,verticalTileCount:8},{identifier:"imgly_lut_neat",defaultName:"Neat",lutImage:"filters/imgly_lut_neat_5_5_128.png"},{identifier:"imgly_lut_pale",defaultName:"Pale",lutImage:"filters/imgly_lut_pale_5_5_128.png"},{identifier:"imgly_lut_pitched",defaultName:"Pitched",lutImage:"filters/imgly_lut_pitched_5_5_128.png"},{identifier:"imgly_lut_polasx",defaultName:"Pola SX",lutImage:"filters/imgly_lut_polasx_5_5_128.png"},{identifier:"imgly_lut_pro400",defaultName:"Pro 400",lutImage:"filters/imgly_lut_pro400_5_5_128.png"},{identifier:"imgly_lut_quozi",defaultName:"Quozi",lutImage:"filters/imgly_lut_quozi_5_5_128.png"},{identifier:"imgly_lut_settled",defaultName:"Settled",lutImage:"filters/imgly_lut_settled_5_5_128.png"},{identifier:"imgly_lut_seventies",defaultName:"Seventies",lutImage:"filters/imgly_lut_seventies_5_5_128.png"},{identifier:"imgly_lut_soft",defaultName:"Soft",lutImage:"filters/imgly_lut_soft_5_5_128.png"},{identifier:"imgly_lut_steel",defaultName:"Steel",lutImage:"filters/imgly_lut_steel_5_5_128.png"},{identifier:"imgly_lut_summer",defaultName:"Summer",lutImage:"filters/imgly_lut_summer_5_5_128.png"},{identifier:"imgly_lut_tender",defaultName:"Tender",lutImage:"filters/imgly_lut_tender_5_5_128.png"},{identifier:"imgly_lut_twilight",defaultName:"Twilight",lutImage:"filters/imgly_lut_twilight_5_5_128.png"}]}],OVERLAYS:[{identifier:"imgly_overlay_golden",defaultName:"Golden",image:"overlays/imgly_overlay_golden.jpg",thumbnail:"overlays/imgly_overlay_golden_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_bokeh",defaultName:"Bokeh",image:"overlays/imgly_overlay_bokeh.jpg",thumbnail:"overlays/imgly_overlay_bokeh_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_hearts",defaultName:"Hearts",image:"overlays/imgly_overlay_hearts.jpg",thumbnail:"overlays/imgly_overlay_hearts_thumb.jpg",blendMode:"screen"},{identifier:"imgly_overlay_lightleak1",defaultName:"Light Leak",image:"overlays/imgly_overlay_lightleak1.jpg",thumbnail:"overlays/imgly_overlay_lightleak1_thumb.jpg",blendMode:"screen"},{identifier:"imgly_overlay_lightleak2",defaultName:"Light Leak 2",image:"overlays/imgly_overlay_lightleak2.jpg",thumbnail:"overlays/imgly_overlay_lightleak2_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_rain",defaultName:"Rain",image:"overlays/imgly_overlay_rain.jpg",thumbnail:"overlays/imgly_overlay_rain_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_wood",defaultName:"Wood",image:"overlays/imgly_overlay_wood.jpg",thumbnail:"overlays/imgly_overlay_wood_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_mosaic",defaultName:"Mosaic",image:"overlays/imgly_overlay_mosaic.jpg",thumbnail:"overlays/imgly_overlay_mosaic_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_chop",defaultName:"Chop",image:"overlays/imgly_overlay_chop.jpg",thumbnail:"overlays/imgly_overlay_chop_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_vintage",defaultName:"Vintage",image:"overlays/imgly_overlay_vintage.jpg",thumbnail:"overlays/imgly_overlay_vintage_thumb.jpg",blendMode:"darken"},{identifier:"imgly_overlay_metal",defaultName:"Metal",image:"overlays/imgly_overlay_metal.jpg",thumbnail:"overlays/imgly_overlay_metal_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_paper",defaultName:"Paper",image:"overlays/imgly_overlay_paper.jpg",thumbnail:"overlays/imgly_overlay_paper_thumb.jpg",blendMode:"multiply"},{identifier:"imgly_overlay_painting",defaultName:"Painting",image:"overlays/imgly_overlay_painting.jpg",thumbnail:"overlays/imgly_overlay_painting_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_grain",defaultName:"Grain",image:"overlays/imgly_overlay_grain.jpg",thumbnail:"overlays/imgly_overlay_grain_thumb.jpg",blendMode:"overlay"},{identifier:"imgly_overlay_clouds",defaultName:"Clouds",image:"overlays/imgly_overlay_clouds.jpg",thumbnail:"overlays/imgly_overlay_clouds_thumb.jpg",blendMode:"softLight"},{identifier:"imgly_overlay_wall1",defaultName:"Wall",image:"overlays/imgly_overlay_wall1.jpg",thumbnail:"overlays/imgly_overlay_wall1_thumb.jpg",blendMode:"lighten"},{identifier:"imgly_overlay_wall2",defaultName:"Wall 2",image:"overlays/imgly_overlay_wall2.jpg",thumbnail:"overlays/imgly_overlay_wall2_thumb.jpg",blendMode:"overlay"}],FRAME_CATEGORIES:[{identifier:"imgly_frame_generic",defaultName:"Generic",metaData:{backgroundImage:"frames/generic.png"},frames:[{identifier:"imgly_frame_dia",defaultName:"Dia",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_dia/imgly_frame_dia_thumb.png",imageGroups:{top:{mid:{image:"frames/imgly_frame_dia/imgly_frame_dia_top.png",mode:"repeat"}},left:{start:"frames/imgly_frame_dia/imgly_frame_dia_top_corner_left.png",mid:"frames/imgly_frame_dia/imgly_frame_dia_left.png",end:"frames/imgly_frame_dia/imgly_frame_dia_bottom_corner_left.png"},right:{start:"frames/imgly_frame_dia/imgly_frame_dia_top_corner_right.png",mid:"frames/imgly_frame_dia/imgly_frame_dia_right.png",end:"frames/imgly_frame_dia/imgly_frame_dia_bottom_corner_right.png"},bottom:{mid:{image:"frames/imgly_frame_dia/imgly_frame_dia_bottom.png",mode:"repeat"}}}},{identifier:"imgly_frame_art_decor",defaultName:"Art Decor",tintable:true,layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_art_decor/imgly_frame_art_decor_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_left.png",mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top.png",mode:"stretch"},end:"frames/imgly_frame_art_decor/imgly_frame_art_decor_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_left.png",mid:{image:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom.png",mode:"stretch"},end:"frames/imgly_frame_art_decor/imgly_frame_art_decor_bottom_corner_right.png"}}},{identifier:"imgly_frame_black_passepartout",defaultName:"Black Passepartout",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_left.png",mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top.png",mode:"stretch"},end:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_left.png",mid:{image:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom.png",mode:"stretch"},end:"frames/imgly_frame_black_passepartout/imgly_frame_black_passepartout_bottom_corner_right.png"}}},{identifier:"imgly_frame_lowpoly_shadow",defaultName:"Low Poly",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_left.png",mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top.png",mode:"stretch"},end:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_left.png",mid:{image:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom.png",mode:"stretch"},end:"frames/imgly_frame_lowpoly_shadow/imgly_frame_lowpoly_shadow_bottom_corner_right.png"}}},{identifier:"imgly_frame_wood_passepartout",defaultName:"Wood Passepartout",layoutMode:"horizontal-inside",thumbnail:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_thumb.png",imageGroups:{top:{start:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_left.png",mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top.png",mode:"stretch"},end:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_top_corner_right.png"},left:{mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_left.png",mode:"stretch"}},right:{mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_right.png",mode:"stretch"}},bottom:{start:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_left.png",mid:{image:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom.png",mode:"stretch"},end:"frames/imgly_frame_wood_passepartout/imgly_frame_wood_passepartout_bottom_corner_right.png"}}}]}],STICKER_CATEGORIES:[{identifier:"imgly_sticker_emoticons",defaultName:"Emoticons",metaData:{backgroundImage:"stickers/emoticons/background.png"},stickers:[{identifier:"imgly_sticker_emoticons_alien",defaultName:"Alien",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_alien.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_alien.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_alien.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_alien.png"],width:1e3,height:935}}},{identifier:"imgly_sticker_emoticons_angel",defaultName:"Angel",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angel.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_angel.png"],width:62,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angel.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_angel.png"]}}},{identifier:"imgly_sticker_emoticons_angry",defaultName:"Angry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_angry.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_angry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_angry.png"]}}},{identifier:"imgly_sticker_emoticons_anxious",defaultName:"Anxious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_anxious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_anxious.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_anxious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_anxious.png"]}}},{identifier:"imgly_sticker_emoticons_asleep",defaultName:"Asleep",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_asleep.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_asleep.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_asleep.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_asleep.png"]}}},{identifier:"imgly_sticker_emoticons_attention",defaultName:"Attention",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_attention.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_attention.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_attention.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_attention.png"]}}},{identifier:"imgly_sticker_emoticons_baby_chicken",defaultName:"Baby Chicken",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_baby_chicken.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_baby_chicken.png"],width:61,height:42},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_baby_chicken.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_baby_chicken.png"]}}},{identifier:"imgly_sticker_emoticons_batman",defaultName:"Batman",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_batman.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_batman.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_batman.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_batman.png"]}}},{identifier:"imgly_sticker_emoticons_beer",defaultName:"Beer",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_beer.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_beer.png"],width:62,height:59},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_beer.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_beer.png"]}}},{identifier:"imgly_sticker_emoticons_blush",defaultName:"Blush",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_blush.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_blush.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_blush.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_blush.png"]}}},{identifier:"imgly_sticker_emoticons_boxer",defaultName:"Boxer",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_boxer.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_boxer.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_boxer.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_boxer.png"]}}},{identifier:"imgly_sticker_emoticons_business",defaultName:"Business",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_business.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_business.png"],width:60,height:63},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_business.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_business.png"]}}},{identifier:"imgly_sticker_emoticons_chicken",defaultName:"Chicken",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_chicken.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_chicken.png"],width:63,height:55},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_chicken.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_chicken.png"]}}},{identifier:"imgly_sticker_emoticons_cool",defaultName:"Cool",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cool.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_cool.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cool.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_cool.png"]}}},{identifier:"imgly_sticker_emoticons_cry",defaultName:"Cry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_cry.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_cry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_cry.png"]}}},{identifier:"imgly_sticker_emoticons_deceased",defaultName:"Deceased",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_deceased.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_deceased.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_deceased.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_deceased.png"]}}},{identifier:"imgly_sticker_emoticons_devil",defaultName:"Devil",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_devil.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_devil.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_devil.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_devil.png"]}}},{identifier:"imgly_sticker_emoticons_duckface",defaultName:"Duckface",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_duckface.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_duckface.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_duckface.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_duckface.png"]}}},{identifier:"imgly_sticker_emoticons_furious",defaultName:"Furious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_furious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_furious.png"],width:62,height:61},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_furious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_furious.png"]}}},{identifier:"imgly_sticker_emoticons_grin",defaultName:"Grin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_grin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_grin.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_grin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_grin.png"]}}},{identifier:"imgly_sticker_emoticons_guitar",defaultName:"Guitar",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_guitar.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_guitar.png"],width:64,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_guitar.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_guitar.png"]}}},{identifier:"imgly_sticker_emoticons_harry_potter",defaultName:"Harry Potter",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_harry_potter.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_harry_potter.png"],width:64,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_harry_potter.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_harry_potter.png"]}}},{identifier:"imgly_sticker_emoticons_hippie",defaultName:"Hippie",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hippie.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_hippie.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hippie.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_hippie.png"]}}},{identifier:"imgly_sticker_emoticons_hitman",defaultName:"Hitman",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hitman.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_hitman.png"],width:64,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_hitman.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_hitman.png"]}}},{identifier:"imgly_sticker_emoticons_humourous",defaultName:"Humourous",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_humourous.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_humourous.png"],width:64,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_humourous.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_humourous.png"]}}},{identifier:"imgly_sticker_emoticons_idea",defaultName:"Idea",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_idea.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_idea.png"],width:64,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_idea.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_idea.png"]}}},{identifier:"imgly_sticker_emoticons_impatient",defaultName:"Impatient",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_impatient.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_impatient.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_impatient.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_impatient.png"]}}},{identifier:"imgly_sticker_emoticons_kiss",defaultName:"Kiss",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kiss.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_kiss.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kiss.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_kiss.png"]}}},{identifier:"imgly_sticker_emoticons_kisses",defaultName:"Kisses",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kisses.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_kisses.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_kisses.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_kisses.png"]}}},{identifier:"imgly_sticker_emoticons_laugh",defaultName:"Laugh",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_laugh.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_laugh.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_laugh.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_laugh.png"]}}},{identifier:"imgly_sticker_emoticons_loud_cry",defaultName:"Loud Cry",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loud_cry.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_loud_cry.png"],width:64,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loud_cry.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_loud_cry.png"]}}},{identifier:"imgly_sticker_emoticons_loving",defaultName:"Loving",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loving.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_loving.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_loving.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_loving.png"]}}},{identifier:"imgly_sticker_emoticons_masked",defaultName:"Masked",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_masked.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_masked.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_masked.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_masked.png"]}}},{identifier:"imgly_sticker_emoticons_music",defaultName:"Music",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_music.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_music.png"],width:62,height:54},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_music.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_music.png"]}}},{identifier:"imgly_sticker_emoticons_nerd",defaultName:"Nerd",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_nerd.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_nerd.png"]},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_nerd.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_nerd.png"]}}},{identifier:"imgly_sticker_emoticons_ninja",defaultName:"Ninja",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_ninja.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_ninja.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_ninja.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_ninja.png"]}}},{identifier:"imgly_sticker_emoticons_not_speaking_to_you",defaultName:"Not Speaking To You",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_not_speaking_to_you.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_not_speaking_to_you.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_not_speaking_to_you.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_not_speaking_to_you.png"]}}},{identifier:"imgly_sticker_emoticons_pig",defaultName:"Pig",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pig.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_pig.png"],width:63,height:41},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pig.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_pig.png"]}}},{identifier:"imgly_sticker_emoticons_pumpkin",defaultName:"Pumpkin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pumpkin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_pumpkin.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_pumpkin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_pumpkin.png"]}}},{identifier:"imgly_sticker_emoticons_question",defaultName:"Question",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_question.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_question.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_question.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_question.png"]}}},{identifier:"imgly_sticker_emoticons_rabbit",defaultName:"Rabbit",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_rabbit.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_rabbit.png"],width:65,height:47},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_rabbit.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_rabbit.png"]}}},{identifier:"imgly_sticker_emoticons_sad",defaultName:"Sad",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sad.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sad.png"]},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sad.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sad.png"]}}},{identifier:"imgly_sticker_emoticons_sick",defaultName:"Sick",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sick.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sick.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sick.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sick.png"]}}},{identifier:"imgly_sticker_emoticons_skateboard",defaultName:"Skateboard",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skateboard.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_skateboard.png"],width:62,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skateboard.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_skateboard.png"]}}},{identifier:"imgly_sticker_emoticons_skull",defaultName:"Skull",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skull.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_skull.png"],width:62,height:62},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_skull.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_skull.png"]}}},{identifier:"imgly_sticker_emoticons_sleepy",defaultName:"Sleepy",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sleepy.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sleepy.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sleepy.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sleepy.png"]}}},{identifier:"imgly_sticker_emoticons_smile",defaultName:"Smile",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smile.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_smile.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smile.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_smile.png"]}}},{identifier:"imgly_sticker_emoticons_smoking",defaultName:"Smoking",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smoking.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_smoking.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_smoking.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_smoking.png"]}}},{identifier:"imgly_sticker_emoticons_sobbing",defaultName:"Sobbing",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sobbing.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sobbing.png"],width:62,height:59},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sobbing.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sobbing.png"]}}},{identifier:"imgly_sticker_emoticons_star",defaultName:"Star",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_star.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_star.png"],width:64,height:64},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_star.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_star.png"]}}},{identifier:"imgly_sticker_emoticons_steaming_furious",defaultName:"Steaming Furious",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_steaming_furious.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_steaming_furious.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_steaming_furious.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_steaming_furious.png"]}}},{identifier:"imgly_sticker_emoticons_sunbathing",defaultName:"Sunbathing",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sunbathing.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_sunbathing.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_sunbathing.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_sunbathing.png"]}}},{identifier:"imgly_sticker_emoticons_tired",defaultName:"Tired",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tired.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_tired.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tired.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_tired.png"]}}},{identifier:"imgly_sticker_emoticons_tongue_out_wink",defaultName:"Tongue Out Wink",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tongue_out_wink.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_tongue_out_wink.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_tongue_out_wink.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_tongue_out_wink.png"]}}},{identifier:"imgly_sticker_emoticons_wave",defaultName:"Wave",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wave.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wave.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wave.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wave.png"]}}},{identifier:"imgly_sticker_emoticons_wide_grin",defaultName:"Wide Grin",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wide_grin.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wide_grin.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wide_grin.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wide_grin.png"]}}},{identifier:"imgly_sticker_emoticons_wink",defaultName:"Wink",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wink.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wink.png"],width:62,height:58},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wink.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wink.png"]}}},{identifier:"imgly_sticker_emoticons_wrestler",defaultName:"Wrestler",images:{mediaThumb:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wrestler.svg","stickers/emoticons/stickers/thumbs/imgly_sticker_emoticons_wrestler.png"],width:62,height:60},mediaBase:{uris:["stickers/emoticons/stickers/imgly_sticker_emoticons_wrestler.svg","stickers/emoticons/stickers/base/imgly_sticker_emoticons_wrestler.png"]}}}]},{identifier:"imgly_sticker_shapes",defaultName:"Shapes",metaData:{backgroundImage:"stickers/shapes/background.png"},stickers:[{identifier:"imgly_sticker_shapes_arrow_02",defaultName:"Arrow 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_02.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_arrow_02.png"],width:2e3,height:1236},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_02.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_arrow_02.png"],width:2e3,height:1236}}},{identifier:"imgly_sticker_shapes_arrow_03",defaultName:"Arrow 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_03.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_arrow_03.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_arrow_03.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_arrow_03.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_01",defaultName:"Badge 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_01.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_01.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_01.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_01.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_04",defaultName:"Badge 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_04.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_04.png"],width:2e3,height:1589},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_04.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_04.png"],width:2e3,height:1589}}},{identifier:"imgly_sticker_shapes_badge_06",defaultName:"Badge 3",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_06.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_06.png"],width:2e3,height:1733},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_06.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_06.png"],width:2e3,height:1733}}},{identifier:"imgly_sticker_shapes_badge_08",defaultName:"Badge 4",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_08.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_08.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_08.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_08.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_11",defaultName:"Badge 5",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_11.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_11.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_11.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_11.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_12",defaultName:"Badge 6",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_12.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_12.png"],width:2001,height:1903},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_12.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_12.png"],width:2001,height:1903}}},{identifier:"imgly_sticker_shapes_badge_13",defaultName:"Badge 7",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_13.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_13.png"],width:2e3,height:1718},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_13.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_13.png"],width:2e3,height:1718}}},{identifier:"imgly_sticker_shapes_badge_15",defaultName:"Badge 8",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_15.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_15.png"],width:1618,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_15.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_15.png"],width:1618,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_18",defaultName:"Badge 9",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_18.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_18.png"],width:1198,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_18.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_18.png"],width:1198,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_19",defaultName:"Badge 10",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_19.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_19.png"],width:2127,height:481},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_19.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_19.png"],width:2127,height:481}}},{identifier:"imgly_sticker_shapes_badge_20",defaultName:"Badge 11",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_20.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_20.png"],width:2e3,height:1404},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_20.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_20.png"],width:2e3,height:1404}}},{identifier:"imgly_sticker_shapes_badge_28",defaultName:"Badge 12",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_28.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_28.png"],width:2e3,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_28.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_28.png"],width:2e3,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_32",defaultName:"Badge 13",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_32.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_32.png"],width:1960,height:2e3},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_32.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_32.png"],width:1960,height:2e3}}},{identifier:"imgly_sticker_shapes_badge_35",defaultName:"Badge 14",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_35.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_35.png"],width:2e3,height:2002},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_35.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_35.png"],width:2e3,height:2002}}},{identifier:"imgly_sticker_shapes_badge_36",defaultName:"Badge 15",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_36.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_badge_36.png"],width:2e3,height:1668},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_badge_36.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_badge_36.png"],width:2e3,height:1668}}},{identifier:"imgly_sticker_shapes_spray_01",defaultName:"Spray 1",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_01.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_01.png"],width:1912,height:2039},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_01.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_01.png"],width:1912,height:2039}}},{identifier:"imgly_sticker_shapes_spray_03",defaultName:"Spray 2",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_03.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_03.png"],width:1681,height:1779},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_03.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_03.png"],width:1681,height:1779}}},{identifier:"imgly_sticker_shapes_spray_04",defaultName:"Spray 3",tintMode:"solid",images:{mediaThumb:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_04.svg","stickers/shapes/stickers/thumbs/imgly_sticker_shapes_spray_04.png"],width:1407,height:2248},mediaBase:{uris:["stickers/shapes/stickers/imgly_sticker_shapes_spray_04.svg","stickers/shapes/stickers/base/imgly_sticker_shapes_spray_04.png"],width:1407,height:2248}}}]}]}};});function X(i,t,e){if(i!=null)if(typeof i=="number")this.fromNumber(i,t,e);else if(t==null&&typeof i!="string")this.fromString(i,256);else this.fromString(i,t);}function Nt(){return new X(null);}function wrt(i,t,e,r,o,n){while(--n>=0){var s=t*this[i++]+e[r]+o;o=Math.floor(s/67108864);e[r++]=s&67108863;}return o;}function Trt(i,t,e,r,o,n){var s=t&32767,a=t>>15;while(--n>=0){var l=this[i]&32767;var c=this[i++]>>15;var u=a*l+c*s;l=s*l+((u&32767)<<15)+e[r]+(o&1073741823);o=(l>>>30)+(u>>>15)+a*c+(o>>>30);e[r++]=l&1073741823;}return o;}function krt(i,t,e,r,o,n){var s=t&16383,a=t>>14;while(--n>=0){var l=this[i]&16383;var c=this[i++]>>14;var u=a*l+c*s;l=s*l+((u&16383)<<14)+e[r]+o;o=(l>>28)+(u>>14)+a*c;e[r++]=l&268435455;}return o;}function I3(i){return Irt.charAt(i);}function D3(i,t){var e=Ly[i.charCodeAt(t)];return e==null?-1:e;}function Drt(i){for(var t=this.t-1;t>=0;--t){i[t]=this[t];}i.t=this.t;i.s=this.s;}function Ert(i){this.t=1;this.s=i<0?-1:0;if(i>0)this[0]=i;else if(i<-1)this[0]=i+this.DV;else this.t=0;}function Za(i){var t=Nt();t.fromInt(i);return t;}function Frt(i,t){var e;if(t==16)e=4;else if(t==8)e=3;else if(t==256)e=8;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else{this.fromRadix(i,t);return;}this.t=0;this.s=0;var r=i.length,o=false,n=0;while(--r>=0){var s=e==8?i[r]&255:D3(i,r);if(s<0){if(i.charAt(r)=="-")o=true;continue;}o=false;if(n==0)this[this.t++]=s;else if(n+e>this.DB){this[this.t-1]|=(s&(1<>this.DB-n;}else this[this.t-1]|=s<=this.DB)n-=this.DB;}if(e==8&&(i[0]&128)!=0){this.s=-1;if(n>0)this[this.t-1]|=(1<0&&this[this.t-1]==i){--this.t;}}function Rrt(i){if(this.s<0)return"-"+this.negate().toString(i);var t;if(i==16)t=4;else if(i==8)t=3;else if(i==2)t=1;else if(i==32)t=5;else if(i==4)t=2;else return this.toRadix(i);var e=(1<0){if(a>a)>0){o=true;n=I3(r);}while(s>=0){if(a>(a+=this.DB-t);}else{r=this[s]>>(a-=t)&e;if(a<=0){a+=this.DB;--s;}}if(r>0)o=true;if(o)n+=I3(r);}}return o?n:"0";}function Art(){var i=Nt();X.ZERO.subTo(this,i);return i;}function Brt(){return this.s<0?this.negate():this;}function Prt(i){var t=this.s-i.s;if(t!=0)return t;var e=this.t;t=e-i.t;if(t!=0)return this.s<0?-t:t;while(--e>=0){if((t=this[e]-i[e])!=0)return t;}return 0;}function zy(i){var t=1,e;if((e=i>>>16)!=0){i=e;t+=16;}if((e=i>>8)!=0){i=e;t+=8;}if((e=i>>4)!=0){i=e;t+=4;}if((e=i>>2)!=0){i=e;t+=2;}if((e=i>>1)!=0){i=e;t+=1;}return t;}function Mrt(){if(this.t<=0)return 0;return this.DB*(this.t-1)+zy(this[this.t-1]^this.s&this.DM);}function Lrt(i,t){var e;for(e=this.t-1;e>=0;--e){t[e+i]=this[e];}for(e=i-1;e>=0;--e){t[e]=0;}t.t=this.t+i;t.s=this.s;}function zrt(i,t){for(var e=i;e=0;--a){t[a+n+1]=this[a]>>r|s;s=(this[a]&o)<=0;--a){t[a]=0;}t[n]=s;t.t=this.t+n+1;t.s=this.s;t.clamp();}function Nrt(i,t){t.s=this.s;var e=Math.floor(i/this.DB);if(e>=this.t){t.t=0;return;}var r=i%this.DB;var o=this.DB-r;var n=(1<>r;for(var s=e+1;s>r;}if(r>0)t[this.t-e-1]|=(this.s&n)<>=this.DB;}if(i.t>=this.DB;}r+=this.s;}else{r+=this.s;while(e>=this.DB;}r-=i.s;}t.s=r<0?-1:0;if(r<-1)t[e++]=this.DV+r;else if(r>0)t[e++]=r;t.t=e;t.clamp();}function Wrt(i,t){var e=this.abs(),r=i.abs();var o=e.t;t.t=o+r.t;while(--o>=0){t[o]=0;}for(o=0;o=0){i[e]=0;}for(e=0;e=t.DV){i[e+t.t]-=t.DV;i[e+t.t+1]=1;}}if(i.t>0)i[i.t-1]+=t.am(e,t[e],i,2*e,0,1);i.s=0;i.clamp();}function Vrt(i,t,e){var r=i.abs();if(r.t<=0)return;var o=this.abs();if(o.t0){r.lShiftTo(l,n);o.lShiftTo(l,e);}else{r.copyTo(n);o.copyTo(e);}var c=n.t;var u=n[c-1];if(u==0)return;var m=u*(1<1?n[c-2]>>this.F2:0);var p=this.FV/m,h=(1<=0){e[e.t++]=1;e.subTo(b,e);}X.ONE.dlShiftTo(c,b);b.subTo(n,n);while(n.t=0){var T=e[--x]==u?this.DM:Math.floor(e[x]*p+(e[x-1]+g)*h);if((e[x]+=n.am(0,T,e,v,0,c))0)e.rShiftTo(l,e);if(s<0)X.ZERO.subTo(e,e);}function jrt(i){var t=Nt();this.abs().divRemTo(i,null,t);if(this.s<0&&t.compareTo(X.ZERO)>0)i.subTo(t,t);return t;}function cc(i){this.m=i;}function $rt(i){if(i.s<0||i.compareTo(this.m)>=0)return i.mod(this.m);else return i;}function Krt(i){return i;}function Xrt(i){i.divRemTo(this.m,null,i);}function qrt(i,t,e){i.multiplyTo(t,e);this.reduce(e);}function Yrt(i,t){i.squareTo(t);this.reduce(t);}function Jrt(){if(this.t<1)return 0;var i=this[0];if((i&1)==0)return 0;var t=i&3;t=t*(2-(i&15)*t)&15;t=t*(2-(i&255)*t)&255;t=t*(2-((i&65535)*t&65535))&65535;t=t*(2-i*t%this.DV)%this.DV;return t>0?this.DV-t:-t;}function uc(i){this.m=i;this.mp=i.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<0)this.m.subTo(t,t);return t;}function Qrt(i){var t=Nt();i.copyTo(t);this.reduce(t);return t;}function tot(i){while(i.t<=this.mt2){i[i.t++]=0;}for(var t=0;t>15)*this.mpl&this.um)<<15)&i.DM;e=t+this.m.t;i[e]+=this.m.am(0,r,i,t,0,this.m.t);while(i[e]>=i.DV){i[e]-=i.DV;i[++e]++;}}i.clamp();i.drShiftTo(this.m.t,i);if(i.compareTo(this.m)>=0)i.subTo(this.m,i);}function eot(i,t){i.squareTo(t);this.reduce(t);}function iot(i,t,e){i.multiplyTo(t,e);this.reduce(e);}function rot(){return(this.t>0?this[0]&1:this.s)==0;}function oot(i,t){if(i>4294967295||i<1)return X.ONE;var e=Nt(),r=Nt(),o=t.convert(this),n=zy(i)-1;o.copyTo(e);while(--n>=0){t.sqrTo(e,r);if((i&1<0)t.mulTo(r,o,e);else{var s=e;e=r;r=s;}}return t.revert(e);}function not(i,t){var e;if(i<256||t.isEven())e=new cc(t);else e=new uc(t);return this.exp(i,e);}function sot(){var i=Nt();this.copyTo(i);return i;}function aot(){if(this.s<0){if(this.t==1)return this[0]-this.DV;else if(this.t==0)return-1;}else if(this.t==1)return this[0];else if(this.t==0)return 0;return(this[1]&(1<<32-this.DB)-1)<>24;}function cot(){return this.t==0?this.s:this[0]<<16>>16;}function uot(i){return Math.floor(Math.LN2*this.DB/Math.log(i));}function dot(){if(this.s<0)return-1;else if(this.t<=0||this.t==1&&this[0]<=0)return 0;else return 1;}function mot(i){if(i==null)i=10;if(this.signum()==0||i<2||i>36)return"0";var t=this.chunkSize(i);var e=Math.pow(i,t);var r=Za(e),o=Nt(),n=Nt(),s="";this.divRemTo(r,o,n);while(o.signum()>0){s=(e+n.intValue()).toString(i).substr(1)+s;o.divRemTo(r,o,n);}return n.intValue().toString(i)+s;}function pot(i,t){this.fromInt(0);if(t==null)t=10;var e=this.chunkSize(t);var r=Math.pow(t,e),o=false,n=0,s=0;for(var a=0;a=e){this.dMultiply(r);this.dAddOffset(s,0);n=0;s=0;}}if(n>0){this.dMultiply(Math.pow(t,n));this.dAddOffset(s,0);}if(o)X.ZERO.subTo(this,this);}function hot(i,t,e){if(typeof t=="number"){if(i<2)this.fromInt(1);else{this.fromNumber(i,e);if(!this.testBit(i-1))this.bitwiseTo(X.ONE.shiftLeft(i-1),tw,this);if(this.isEven())this.dAddOffset(1,0);while(!this.isProbablePrime(t)){this.dAddOffset(2,0);if(this.bitLength()>i)this.subTo(X.ONE.shiftLeft(i-1),this);}}}else{var r=new Array(),o=i&7;r.length=(i>>3)+1;t.nextBytes(r);if(o>0)r[0]&=(1<0){if(e>e)!=(this.s&this.DM)>>e)t[o++]=r|this.s<=0){if(e<8){r=(this[i]&(1<>(e+=this.DB-8);}else{r=this[i]>>(e-=8)&255;if(e<=0){e+=this.DB;--i;}}if((r&128)!=0)r|=-256;if(o==0&&(this.s&128)!=(r&128))++o;if(o>0||r!=this.s)t[o++]=r;}}return t;}function got(i){return this.compareTo(i)==0;}function bot(i){return this.compareTo(i)<0?this:i;}function yot(i){return this.compareTo(i)>0?this:i;}function _ot(i,t,e){var r,o,n=Math.min(i.t,this.t);for(r=0;r>=16;t+=16;}if((i&255)==0){i>>=8;t+=8;}if((i&15)==0){i>>=4;t+=4;}if((i&3)==0){i>>=2;t+=2;}if((i&1)==0)++t;return t;}function Eot(){for(var i=0;i=this.t)return this.s!=0;return(this[t]&1<>=this.DB;}if(i.t>=this.DB;}r+=this.s;}else{r+=this.s;while(e>=this.DB;}r+=i.s;}t.s=r<0?-1:0;if(r>0)t[e++]=r;else if(r<-1)t[e++]=this.DV+r;t.t=e;t.clamp();}function zot(i){var t=Nt();this.addTo(i,t);return t;}function Uot(i){var t=Nt();this.subTo(i,t);return t;}function Not(i){var t=Nt();this.multiplyTo(i,t);return t;}function Hot(){var i=Nt();this.squareTo(i);return i;}function Wot(i){var t=Nt();this.divRemTo(i,t,null);return t;}function Got(i){var t=Nt();this.divRemTo(i,null,t);return t;}function Vot(i){var t=Nt(),e=Nt();this.divRemTo(i,t,e);return new Array(t,e);}function jot(i){this[this.t]=this.am(0,i-1,this,0,0,this.t);++this.t;this.clamp();}function $ot(i,t){if(i==0)return;while(this.t<=t){this[this.t++]=0;}this[t]+=i;while(this[t]>=this.DV){this[t]-=this.DV;if(++t>=this.t)this[this.t++]=0;++this[t];}}function hh(){}function O3(i){return i;}function Kot(i,t,e){i.multiplyTo(t,e);}function Xot(i,t){i.squareTo(t);}function qot(i){return this.exp(i,new hh());}function Yot(i,t,e){var r=Math.min(this.t+i.t,t);e.s=0;e.t=r;while(r>0){e[--r]=0;}var o;for(o=e.t-this.t;r=0){e[r]=0;}for(r=Math.max(t-this.t,0);r2*this.m.t)return i.mod(this.m);else if(i.compareTo(this.m)<0)return i;else{var t=Nt();i.copyTo(t);this.reduce(t);return t;}}function Qot(i){return i;}function tnt(i){i.drShiftTo(this.m.t-1,this.r2);if(i.t>this.m.t+1){i.t=this.m.t+1;i.clamp();}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(i.compareTo(this.r2)<0){i.dAddOffset(1,this.m.t+1);}i.subTo(this.r2,i);while(i.compareTo(this.m)>=0){i.subTo(this.m,i);}}function ent(i,t){i.squareTo(t);this.reduce(t);}function _int(i,t,e){i.multiplyTo(t,e);this.reduce(e);}function rnt(i,t){var e=i.bitLength(),r,o=Za(1),n;if(e<=0)return o;else if(e<18)r=1;else if(e<48)r=3;else if(e<144)r=4;else if(e<768)r=5;else r=6;if(e<8)n=new cc(t);else if(t.isEven())n=new Bd(t);else n=new uc(t);var s=new Array(),a=3,l=r-1,c=(1<1){var u=Nt();n.sqrTo(s[1],u);while(a<=c){s[a]=Nt();n.mulTo(u,s[a-2],s[a]);a+=2;}}var m=i.t-1,p,h=true,g=Nt(),x;e=zy(i[m])-1;while(m>=0){if(e>=l)p=i[m]>>e-l&c;else{p=(i[m]&(1<0)p|=i[m-1]>>this.DB+e-l;}a=r;while((p&1)==0){p>>=1;--a;}if((e-=a)<0){e+=this.DB;--m;}if(h){s[p].copyTo(o);h=false;}else{while(a>1){n.sqrTo(o,g);n.sqrTo(g,o);a-=2;}if(a>0)n.sqrTo(o,g);else{x=o;o=g;g=x;}n.mulTo(g,s[p],o);}while(m>=0&&(i[m]&1<0){t.rShiftTo(n,t);e.rShiftTo(n,e);}while(t.signum()>0){if((o=t.getLowestSetBit())>0)t.rShiftTo(o,t);if((o=e.getLowestSetBit())>0)e.rShiftTo(o,e);if(t.compareTo(e)>=0){t.subTo(e,t);t.rShiftTo(1,t);}else{e.subTo(t,e);e.rShiftTo(1,e);}}if(n>0)e.lShiftTo(n,e);return e;}function nnt(i){if(i<=0)return 0;var t=this.DV%i,e=this.s<0?i-1:0;if(this.t>0)if(t==0)e=this[0]%i;else for(var r=this.t-1;r>=0;--r){e=(t*e+this[r])%i;}return e;}function snt(i){var t=i.isEven();if(this.isEven()&&t||i.signum()==0)return X.ZERO;var e=i.clone(),r=this.clone();var o=Za(1),n=Za(0),s=Za(0),a=Za(1);while(e.signum()!=0){while(e.isEven()){e.rShiftTo(1,e);if(t){if(!o.isEven()||!n.isEven()){o.addTo(this,o);n.subTo(i,n);}o.rShiftTo(1,o);}else if(!n.isEven())n.subTo(i,n);n.rShiftTo(1,n);}while(r.isEven()){r.rShiftTo(1,r);if(t){if(!s.isEven()||!a.isEven()){s.addTo(this,s);a.subTo(i,a);}s.rShiftTo(1,s);}else if(!a.isEven())a.subTo(i,a);a.rShiftTo(1,a);}if(e.compareTo(r)>=0){e.subTo(r,e);if(t)o.subTo(s,o);n.subTo(a,n);}else{r.subTo(e,r);if(t)s.subTo(o,s);a.subTo(n,a);}}if(r.compareTo(X.ONE)!=0)return X.ZERO;if(a.compareTo(i)>=0)return a.subtract(i);if(a.signum()<0)a.addTo(i,a);else return a;if(a.signum()<0)return a.add(i);else return a;}function lnt(i){var t,e=this.abs();if(e.t==1&&e[0]<=$i[$i.length-1]){for(t=0;t<$i.length;++t){if(e[0]==$i[t])return true;}return false;}if(e.isEven())return false;t=1;while(t<$i.length){var r=$i[t],o=t+1;while(o<$i.length&&r>1;if(i>$i.length)i=$i.length;var o=Nt();for(var n=0;n>16)+(b>>16)+(T>>16);return k<<16|T&65535;}function o(v,b){return v>>>b|v<<32-b;}function n(v,b){return v>>>b;}function s(v,b,T){return v&b^~v&T;}function a(v,b,T){return v&b^v&T^b&T;}function l(v){return o(v,2)^o(v,13)^o(v,22);}function c(v){return o(v,6)^o(v,11)^o(v,25);}function u(v){return o(v,7)^o(v,18)^n(v,3);}function m(v){return o(v,17)^o(v,19)^n(v,10);}function p(v,b){var T=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298);var k=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225);var E=new Array(64);var A,I,F,Z,et,pt,yt,bt,ht,Qt;var gi,ii;v[b>>5]|=128<<24-b%32;v[(b+64>>9<<4)+15]=b;for(var ht=0;ht>5]|=(v.charCodeAt(k/t)&T)<<24-k%32;}return b;}function g(v){v=v.replace(/\r\n/g,"\n");var b="";for(var T=0;T127&&k<2048){b+=String.fromCharCode(k>>6|192);b+=String.fromCharCode(k&63|128);}else{b+=String.fromCharCode(k>>12|224);b+=String.fromCharCode(k>>6&63|128);b+=String.fromCharCode(k&63|128);}}return b;}function x(v){var b=e?"0123456789ABCDEF":"0123456789abcdef";var T="";for(var k=0;k>2]>>(3-k%4)*8+4&15)+b.charAt(v[k>>2]>>(3-k%4)*8&15);}return T;}i=g(i);return x(p(h(i),i.length*t));}var P3=d(function(){});var unt,dnt,dc;var M3=d(function(){unt=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/g;dnt=/^(0|[1-9]\d*)\.(0|[1-9]\d*)(\.(0|[1-9]\d*))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/g;dc=/*#__PURE__*/function(){function dc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;_classCallCheck(this,dc);var r=e?dnt:unt;var o=r.exec(t);r.lastIndex=0;this._major=o[1];this._minor=o[2];this._patch=o[3]||0;}_createClass(dc,[{key:"major",get:function get(){return this._major;}},{key:"minor",get:function get(){return this._minor;}},{key:"patch",get:function get(){return this._patch;}},{key:"equals",value:function equals(t){return this._major===t._major&&this._minor===t._minor&&this._patch===t._patch;}},{key:"isMoreRecentThan",value:function isMoreRecentThan(t){if(this._majort.major)return true;if(this._minort.minor)return true;if(this._patch<=t.patch)return false;if(this._patch>t.patch)return true;}}]);return dc;}();});function mnt(i){return i.map(function(t){return"0".concat((t&255).toString(16)).slice(-2);}).join("");}var xi,pnt,hnt,L3,fnt,z3,ew,gnt,bnt,iw,ynt,U3,rw,Uy;var ow=d(function(){Cd();A3();P3();yd();M3();kn();xi=function xi(i){return z.byteArrayToString(io.decode(i));};pnt="TDNSeVlXTnJQMkZ3YVV0bGVUMD0=";hnt="ZW50ZXJwcmlzZV9saWNlbnNl";L3="YXBwX2lkZW50aWZpZXJz";fnt="cGxhdGZvcm0=";z3="ZmVhdHVyZXM=";ew="ZXhwaXJlc19hdA==";gnt="ZG9tYWlucw==";bnt="YXBpX3Rva2Vu";iw="c2lnbmF0dXJl";ynt="dmVyc2lvbg==";U3=/*#__PURE__*/function(){function U3(t){_classCallCheck(this,U3);this._version="2.4";this._l=typeof t==="string"?t.trim():t;this._e=this._parseBigInt("65537",10);this._n=this._parseBigInt("681984042382424091378806337544846672160292647422517223678775230983366046720611873368204040735766698395282492937192783016867164773742859209434481353888637963692711665138989982680829529436715362566735813634679619274059040232728883894511099669775400556584329435375723951309340934658571478665059403241851229195311069345899870108307225910988692123234379186643268583453907260879685992156955936561142314233983397819356937109343127504441076920088455337597736475086676246750168976219763398350254797168313954762459542746440628077261880980924552698138857743609502132632199713575442848784271304503226045319991689413234228439044522583790713890093165912455428688507463773064216328753265963237930998706891042679105987175588970202082466871461192706070321938250462103821558100761330890228135620208935801286878657384108721268761878694436895194628411397454202904351577771506916746612289964053490210990342857409030179406810634136188751670648983222653319056818302012063874664196648868156305696644664362171542503665321455971335955948698828939948786720193132672749776162913092000667953299803216404664087988046584107737900256954976744353601826341965438148646041640662195744770544094748295945844184507459808803114917301124088082458306086473490516969815873631",10);this._parseLicense();}_createClass(U3,[{key:"v",value:function v(){return this._sigValid()&&!this.isExp();}},{key:"_jsonValid",value:function _jsonValid(){try{this._decLic=JSON.parse(this._l);}catch(t){this._decLic={};return false;}return true;}},{key:"_hostnameValid",value:function _hostnameValid(){if(typeof window==="undefined")return true;if(!this._decLic[xi(L3)].length)return true;var t=window.location.hostname;var e=false;this._decLic[xi(L3)].forEach(function(r){if(z.wildCardMatch(t,r)){e=true;}});return e;}},{key:"_platformValid",value:function _platformValid(){var t=this._decLic[xi(fnt)];var e=true?"HTML5":"Server";return e===t;}},{key:"c",value:function c(){var _this66=this;return new Promise(function(t,e){var r=_this66._validateError();if(r!==null){e(r);}t();});}},{key:"validate",value:function validate(){var t=this._validateError();if(t!==null){return false;}return true;}},{key:"_validateError",value:function _validateError(){var t=_typeof(this._l);if(t!=="string"||!this._jsonValid()){var e=new Error();e.code="ELICINVFMT";return e;}if(!this._sigValid()){var _e4=new Error();_e4.code="ELICINV";return _e4;}if(!this._hostnameValid()){var _e5=new Error();_e5.code="ELICINVHOST";return _e5;}if(!this._platformValid()){var _e6=new Error();_e6.code="ELICINVPLAT";return _e6;}if(this.isExp()){var _e7=new Error();_e7.code="ELICEXP";return _e7;}return null;}},{key:"isToolAllowed",value:function isToolAllowed(t){return this._includesFeature(t);}},{key:"isWhiteLabel",value:function isWhiteLabel(){return this._includesFeature("whitelabel",new dc("2.4",true));}},{key:"areCustomAssetsAllowed",value:function areCustomAssetsAllowed(){return this._includesFeature("customassets",new dc("2.4",true));}},{key:"t",value:function t(){if(this._decLic.enterprise_license)return Promise.resolve();if(this._includesFeature("noexporttracking",new dc("2.4",true)))return Promise.resolve();var t=this._decLic[xi(gnt)][0]+xi(xi(pnt))+this._decLic[xi(bnt)];var e=new ro(t);return e.load()["catch"](function(){});}},{key:"isENT",value:function isENT(){if(!this._decLic)return false;return this._decLic[xi(hnt)];}},{key:"_sigValid",value:function _sigValid(){return this._verify(this._message,this._sig);}},{key:"exp",value:function exp(){return!!this._decLic[xi(ew)];}},{key:"dl",value:function dl(){return Math.ceil((this._expAt()-Date.now())/(60*60*24*1e3));}},{key:"isExp",value:function isExp(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Date.now();if(this._decLic[xi(ew)]===null)return false;return t>this._expAt();}},{key:"_expAt",value:function _expAt(){return this._decLic[xi(ew)]*1e3;}},{key:"_verify",value:function _verify(t,e){var r;var o;o=this._encodeMessage(t);r=this._decodeSignature(e);r=r.substr(-64);var n=o===r;return n;}},{key:"_encodeMessage",value:function _encodeMessage(t){var e=B3(t);return e;}},{key:"_decodeSignature",value:function _decodeSignature(t){var e;t=io.decode(t);t=mnt(t);t=this._parseBigInt(t,16);e=t.modPowInt(this._e,this._n);e=e.toString(16);return e;}},{key:"_parseBigInt",value:function _parseBigInt(t,e){return new R3(t,e);}},{key:"_parseLicense",value:function _parseLicense(){if(typeof this._l!=="string")return;if(!this._jsonValid())return;this._sig=this._decLic[xi(iw)]||"";delete this._decLic[xi(iw)];this._sig=this._sig.replace(/[^A-Za-z0-9+/=]/g,"");this._message=this._l.replace(new RegExp(",\"".concat(xi(iw),"\":\"([^\"]*)\"")),"");}},{key:"_includesFeature",value:function _includesFeature(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new dc("1.0",true);var r=new dc(this._decLic[xi(ynt)],true);if(e.isMoreRecentThan(r))return true;return this._decLic[xi(z3)]&&this._decLic[xi(z3)].indexOf(t)!==-1;}}]);return U3;}();rw=/*#__PURE__*/function(){function rw(){_classCallCheck(this,rw);}_createClass(rw,[{key:"v",value:function v(){return true;}},{key:"c",value:function c(){return Promise.resolve();}},{key:"isToolAllowed",value:function isToolAllowed(t){return true;}},{key:"isWhiteLabel",value:function isWhiteLabel(){return false;}},{key:"areCustomAssetsAllowed",value:function areCustomAssetsAllowed(){return true;}},{key:"t",value:function t(){return Promise.resolve();}},{key:"isENT",value:function isENT(){return false;}},{key:"exp",value:function exp(){return false;}},{key:"dl",value:function dl(){return 0;}},{key:"isExp",value:function isExp(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Date.now();return false;}}]);return rw;}();Uy=U3;});var mc,Us,tl,N3,Ny;var H3=d(function(){mc=typeof window==="undefined"?global:window;Us=mc.requestAnimationFrame;tl=mc.cancelAnimationFrame;N3=0;Ny=["ms","moz","webkit","o"];for(var i=0;i0&&arguments[0]!==undefined?arguments[0]:new _ot2(0,0);var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new _ot2(1,1);var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:new _ot2(2,-1);var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new _ot2(2,0);_classCallCheck(this,W3);this._p0=t.clone();this._p1=e.clone();this._p2=r.clone();this._p3=o.clone();this._segments=[];this._length=-1;this._sample=[];}_createClass(W3,[{key:"set",value:function set(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:new _ot2(0,0);var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new _ot2(1,1);var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:new _ot2(2,1);var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new _ot2(2,0);this._p0=t.clone();this._p1=e.clone();this._p2=r.clone();this._p3=o.clone();}},{key:"getLength",value:function getLength(){return this._length;}},{key:"calculateSegments",value:function calculateSegments(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:100;var e=0;var r=0;var o=[];var n=1/t;var s=this._p0.clone();for(var a=1;a<=t;a++){var l=[];l.push({t:e,s:r,point:s});e+=n;e=Math.min(e,1);var c=this.evalAt(e);var u=c.clone().subtract(s);r+=u.len();l.push({t:e,s:r,point:c});o.push(l);s=c;}this._segments=o;this._length=r;return r;}},{key:"evalAt",value:function evalAt(t){t=this.normalizeParameter(t);var e=this._p0.clone().multiply(Math.pow(1-t,3));var r=this._p1.clone().multiply(3*(1-t)*(1-t)*t);var o=this._p2.clone().multiply(3*(1-t)*t*t);var n=this._p3.clone().multiply(t*t*t);return e.add(r).add(o).add(n);}},{key:"isInSegment",value:function isInSegment(t,e){t=this.normalizeArcLength(t);return t>=e[0].s&&t<=e[1].s;}},{key:"getArcLengthSegment",value:function getArcLengthSegment(t){t=this.normalizeArcLength(t);for(var e=0;e0&&arguments[0]!==undefined?arguments[0]:100;var e=1/t;var r=[];var o=0;for(var n=0;n<=t+1;n++){r.push(this.evalAt(o));o+=e;}this._sample=r;return[].concat(r);}},{key:"arcLengthApproxSample",value:function arcLengthApproxSample(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:100;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var o=this._length/t;var n=[];var s=0;for(var a=e?1:0;aa.x||e.ya.y){return false;}return true;}},{key:"getLocalBounds",value:function getLocalBounds(){if(this._localBoundsNeedUpdate&&this._texture){var t=this._localBounds;var e=this._texture.getFrame();t.x=-e.width*this._anchor.x;t.y=-e.height*this._anchor.y;t.width=e.width;t.height=e.height;this._localBoundsNeedUpdate=false;}return this._localBounds.clone();}},{key:"getBounds",value:function getBounds(){if(this._boundsNeedUpdate&&this._texture){var t=this._bounds;var e=this._texture.getFrame();var r=this._worldTransform;var o=this._anchor;var n=r.rectangleToCoordinates(e,o);var s=n[0].x;var a=n[0].y;var l=s;var c=a;n.forEach(function(_ref109){var u=_ref109.x,m=_ref109.y;s=Math.min(s,u);a=Math.min(a,m);l=Math.max(l,u);c=Math.max(c,m);});t.x=s;t.width=Math.abs(l-s);t.y=a;t.height=Math.abs(c-a);this._boundsNeedUpdate=false;}return this._bounds.clone();}},{key:"getTexture",value:function getTexture(){return this._texture;}},{key:"clearTexture",value:function clearTexture(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(!this._texture){return;}this._texture.off("update",this._onTextureUpdate);t&&this._texture.dispose();this._texture=null;if(this._potRenderer){t&&this._potRenderer.dispose();delete this._potRenderer;}}},{key:"setTexture",value:function setTexture(t){if(!t)return;if(this._texture){this._texture.off("update",this._onTextureUpdate);}if(this._potRenderer){this._potRenderer.getRenderTexture().getBaseTexture().setDirty(true);}this._texture=t;if(t.getBaseTexture().isLoaded()){this._onTextureUpdate();}t.on("update",this._onTextureUpdate);}},{key:"getShader",value:function getShader(){return this._shader;}},{key:"setShader",value:function setShader(t){this._shader=t;}},{key:"getWidth",value:function getWidth(){return this._width;}},{key:"setWidth",value:function setWidth(t){if(!this._texture)return;this._scale.x=t/this._texture.getFrame().width;this._width=t;this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true;}},{key:"getHeight",value:function getHeight(){return this._height;}},{key:"setHeight",value:function setHeight(t){if(!this._texture)return;this._scale.y=t/this._texture.getFrame().height;this._height=t;this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true;}},{key:"getDimensions",value:function getDimensions(){return new _ot2(this._width,this._height);}},{key:"getAnchor",value:function getAnchor(){return this._anchor;}},{key:"setAnchor",value:function setAnchor(t,e){this._anchor.set(t,e);this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true;}},{key:"isSmoothDownscaling",value:function isSmoothDownscaling(){return this._smoothDownscaling;}},{key:"setSmoothDownscaling",value:function setSmoothDownscaling(t){this._smoothDownscaling=t;}},{key:"dispose",value:function dispose(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(this._texture){this._texture.off("update",this._onTextureUpdate);}(t||e)&&this._texture&&this._texture.dispose(e);if(this._potRenderer){this._potRenderer.dispose();}}}]);return bh;}(_In);});var _nt,L;var gh=d(function(){Oy();U1();Id();Ay();b3();w3();uw();Fd();J1();Y1();rh();y1();Tn();ah();_nt={CanvasFilterManager:lc,Container:_In,BaseTexture:Ae,Texture:_Ja,RenderTexture:mh,WebGLRenderTarget:Ls,CanvasRenderTarget:Ms,Sprite:bh,Filter:Uo,Filters:z1,PixelArrayImage:gd,autoDetectRenderer:function autoDetectRenderer(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};if(pi.isSupported()){return new My(i,t,e);}return new Od(i,t,e);},canvasRenderer:function canvasRenderer(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return new Od(i,t,e);}};L=_nt;});var X3,q3;var Y3=d(function(){X3=/*#__PURE__*/function(){function X3(){_classCallCheck(this,X3);}_createClass(X3,null,[{key:"current",value:function current(){return process.env.ENV;}},{key:"isTest",value:function isTest(){return process.env.ENV==="test";}},{key:"isDevelopment",value:function isDevelopment(){return process.env.ENV==="development";}},{key:"isProduction",value:function isProduction(){return process.env.ENV==="production"||!this.isTest()&&!this.isDevelopment();}}]);return X3;}();q3=X3;});var J3,hc;var Hy=d(function(){J3=/*#__PURE__*/function(){function J3(t){_classCallCheck(this,J3);this._head=0;this._buf=t;}_createClass(J3,[{key:"peekInt8",value:function peekInt8(){return this._buf[this._head];}},{key:"peekInt16",value:function peekInt16(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._buf[this._head];var r=this._buf[this._head+1];if(!t){return(e<<8)+r;}return(r<<8)+e;}},{key:"peekInt24",value:function peekInt24(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._buf[this._head];var r=this._buf[this._head+1];var o=this._buf[this._head+2];if(!t){return(e<<16)+(r<<8)+o;}return(o<<16)+(r<<8)+e;}},{key:"peekInt32",value:function peekInt32(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this._buf[this._head];var r=this._buf[this._head+1];var o=this._buf[this._head+2];var n=this._buf[this._head+3];if(!t){return(e<<32)+(r<<16)+(o<<8)+n;}return(n<<32)+(o<<16)+(r<<8)+e;}},{key:"writeInt8",value:function writeInt8(t){this._buf[this._head]=t&255;}},{key:"writeInt16",value:function writeInt16(t){this._buf[this._head]=t>>8;this._buf[this._head+1]=t&255;}},{key:"readInt8",value:function readInt8(){var t=this.peekInt8();this._head+=1;return t;}},{key:"readInt16",value:function readInt16(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.peekInt16(t);this._head+=2;return e;}},{key:"readInt24",value:function readInt24(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.peekInt24(t);this._head+=3;return e;}},{key:"readInt32",value:function readInt32(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.peekInt32(t);this._head+=4;return e;}},{key:"readString",value:function readString(t){var e="";for(var r=0;r0)){return false;}var r=this._stream.readString(4);if(r!=="Exif"){return false;}return true;}},{key:"_parse",value:function _parse(){if(!this.isValid()){return;}this._stream.setHead(10);var t=this._stream.getHead();this._bigEndian=false;var e=this._stream.readInt16();if(e===18761){this._bigEndian=false;}else if(e===19789){this._bigEndian=true;}else{dw(false,"Invalid TIFF data: No endian type found");}dw(this._stream.readInt16(!this._bigEndian)===42,"Invalid TIFF data: No 0x002A");var r=this._stream.readInt32(!this._bigEndian);dw(r>=8,"Invalid TIFF data: First IFD offset < 8");var o=t+r;var n=this._readTags(this._stream,t,o,this._bigEndian);this._tags=n.tags;this._tagData=n.tagData;}},{key:"getTags",value:function getTags(){return this._tags;}},{key:"getTagData",value:function getTagData(){return this._tagData;}},{key:"setOrientation",value:function setOrientation(t){if(this._tagData.Orientation){var e=this._tagData.Orientation.entryOffset;this._stream.setHead(e+8);this._stream.writeInt16(this._bigEndian?t:(t&255)<<8|t>>8&255);}}},{key:"_readTags",value:function _readTags(t,e,r,o){t.setHead(r);var n=t.readInt16(!o);var s={};var a=[];for(var l=0;l4?h:c+8);g=t.readString(p);break;case 3:t.setHead(p>2?h:c+8);if(p===1){g=t.readInt16(!o);}else{g=[];for(var _x8=0;_x81?h:c+8);if(p===1){g=t.readInt32(!o);}else{g=[];for(var _x9=0;_x9=16)){return false;}var r=this._stream.readString(4);var o=this._stream.readInt8();if(!(r==="JFIF")){return false;}if(!(o===0)){return false;}return true;}},{key:"setUnitDensity",value:function setUnitDensity(t){this._stream.setHead(11);this._stream.writeInt8(t);}},{key:"setDensityX",value:function setDensityX(t){this._stream.setHead(12);this._stream.writeInt16(t);}},{key:"setDensityY",value:function setDensityY(t){this._stream.setHead(14);this._stream.writeInt16(t);}},{key:"getUnitDensity",value:function getUnitDensity(){this._stream.setHead(11);return this._stream.readInt8();}},{key:"getDensityX",value:function getDensityX(){this._stream.setHead(12);return this._stream.readInt16();}},{key:"getDensityY",value:function getDensityY(){this._stream.setHead(14);return this._stream.readInt16();}},{key:"getBuffer",value:function getBuffer(){return this._buf;}}]);return iz;}();mw=iz;});var KFt,yh,Gy,wnt,_En,_h;var pw=d(function(){Hy();yd();Wy();ez();rz();kn();var _z3=z;KFt=_z3.invariant;var _Pd3=Pd;yh=_Pd3.MARKERS;Gy="data:image/jpeg;base64,";wnt=new RegExp("^".concat(Gy),"i");_En=/*#__PURE__*/function(){function En(t){_classCallCheck(this,En);this._buf=t;this._stream=new hc(this._buf);this._stream.setHead(0);this._segments=this._sliceIntoSegments(this._buf);this._exifData=new tz(this._getMarkerBuffer(yh.EXIF));this._jfifData=new mw(this._getMarkerBuffer(yh.JFIF));}_createClass(En,[{key:"restoreSegmentsInArray",value:function restoreSegmentsInArray(t){t=this.restoreExifTagsToImageData(t);return this.restoreJfifSegmentToImageData(t);}},{key:"restoreSegments",value:function restoreSegments(t){var e=_En.fromDataURL(t);e=this.restoreSegmentsInArray(e);return _En.toDataURL(e);}},{key:"restoreExifTagsToImageData",value:function restoreExifTagsToImageData(t){if(!this._exifData.isValid()){return t;}var e=this._sliceIntoSegments(t);var r=e[1][0];var o=t.slice(0,r);var n=t.slice(r);var s=o.concat(this._exifData.getBuffer());s=s.concat(n);return s;}},{key:"restoreJfifSegmentToImageData",value:function restoreJfifSegmentToImageData(t){if(!this._jfifData.isValid()){return t;}var e=this._sliceIntoSegments(t);var r=this._findSegment(yh.JFIF,e);var o=[];if(r){var n=r[0];var s=r[1];var a=t.slice(0,n);var l=t.slice(n,s);var c=t.slice(s);var u=new mw(l);u.setDensityX(this._jfifData.getDensityX());u.setDensityY(this._jfifData.getDensityY());u.setUnitDensity(this._jfifData.getUnitDensity());o=a.concat(l).concat(c);}else{return t;}return o;}},{key:"restoreExifTags",value:function restoreExifTags(t){var e=_En.fromDataURL(t);var r=this.restoreExifTagsToImageData(e);return _En.toDataURL(r);}},{key:"restoreJfifSegment",value:function restoreJfifSegment(t){if(!this._jfifData.isValid()){return t;}var e=_En.fromDataURL(t);var r=this.restoreJfifSegmentToImageData(e);return _En.toDataURL(r);}},{key:"setOrientation",value:function setOrientation(t){return this._exifData.setOrientation(t);}},{key:"_findSegment",value:function _findSegment(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._segments;for(var r=0;r0&&arguments[0]!==undefined?arguments[0]:this._segments;return t[t.length-1];}},{key:"_getMarkerBuffer",value:function _getMarkerBuffer(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._segments;var r=this._findSegment(t,e);if(r){var o=r[0];var n=r[1];return this._buf.slice(o,n);}return false;}},{key:"_sliceIntoSegments",value:function _sliceIntoSegments(t){var e=new hc(t);var r=[];while(e.getHead()=65280&&o<=65535){var n=e.readInt16();var s=e.getHead()+n-2;r.push([e.getHead()-4,s]);e.setHead(s);}else{throw new Error("Invalid marker: 0x".concat(o.toString(16)));}}this._stream.setHead(0);return r;}},{key:"getTags",value:function getTags(){return this._exifData.getTags();}},{key:"getTagData",value:function getTagData(){return this._exifData.getTagData();}},{key:"dispose",value:function dispose(){this._buf=[];this._segments=[];}}],[{key:"toDataURL",value:function toDataURL(t){return Gy+io.encode(t);}},{key:"fromDataURL",value:function fromDataURL(t){var e=t.replace(Gy,"");var r=io.decode(e);return r;}},{key:"isJPEG",value:function isJPEG(t){return wnt.test(t);}},{key:"bufferIsJPEG",value:function bufferIsJPEG(t){return t[0]===255&&t[1]===216&&t[2]===255;}},{key:"fromBase64String",value:function fromBase64String(t){var e=t.replace(Gy,"");var r=io.decode(e);return new _En(r);}}]);return En;}();_h=_En;});var oz,Xi;var Vy=d(function(){if(true){oz=typeof window!=="undefined"&&window.Image;}if(false){oz=null.Image;}Xi=oz;});var _jy,$y;var hw=d(function(){pc();Sd();_jy=/*#__PURE__*/function(_Vi5){_inherits(jy,_Vi5);var _super37=_createSuper(jy);function jy(){var _this68;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];_classCallCheck(this,jy);_this68=_super37.call(this);_this68._onOperationUpdate=_this68._onOperationUpdate.bind(_assertThisInitialized(_this68));_this68._cacheEnabled=true;_this68._stack=t;_this68._stack.forEach(function(e){e.on("update",_this68._onOperationUpdate);});return _this68;}_createClass(jy,[{key:"clear",value:function clear(){var _this69=this;this.forEach(function(t){return _this69.remove(t);});this._stack=[];}},{key:"hasChanges",value:function hasChanges(){return this._stack.filter(function(t){return!!t;}).some(function(t){return t.hasChanges();});}},{key:"_onOperationUpdate",value:function _onOperationUpdate(t,e){this.emit(Rd.OPERATION_UPDATED,t,e);}},{key:"enableCache",value:function enableCache(){this._cacheEnabled=true;}},{key:"disableCache",value:function disableCache(){this._cacheEnabled=false;}},{key:"forEach",value:function forEach(t){return this._stack.filter(function(e){return!!e;}).forEach(t);}},{key:"render",value:function render(t,e){var _this70=this;var r=e;var o=this._stack.filter(function(c){return!!c;}).filter(function(c){return c.getEnabled();});o.reverse();var n=o.filter(function(c){return!c.isDirtyForRenderer(t.getRenderer());})[0];var s=o.indexOf(n);o.reverse();var a=0;if(s!==-1){a=o.length-s-1;}for(var c=0;c0&&arguments[0]!==undefined?arguments[0]:false;this.forEach(function(e){return e.setDirty(true,t);});}},{key:"updateDirtinessForRenderer",value:function updateDirtinessForRenderer(t){var e=false;for(var r=0;r1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,gw);_this71=_super38.call(this,e,{enabled:{type:"boolean","default":true,serializable:false}});_this71._sdk=t;_this71._cacheEnabled=false;_this71._dirtiness={};_this71._sprite=new L.Sprite();_this71._container=new L.Container();_this71._container.addChild(_this71._sprite);return _this71;}_createClass(gw,[{key:"_onOptionsChange",value:function _onOptionsChange(){this.setDirty(true);}},{key:"render",value:function render(t){var _this72=this;if(!this.getEnabled()){Y.info(this.constructor.name,"Disabled - skipping");return Promise.resolve(t);}if(!this._renderTexture){var n=t.getDimensions().floor();this._renderTexture=new L.RenderTexture(this._sdk.getRenderer(),n.x,n.y);}var e=this._sdk.getRenderer();var r;var o;if(Y.canLog("info")){o=new Ky(this.constructor.name,"Rendering");}if(this.isDirtyForRenderer(e)){this._sprite.setTexture(t);var _n3=this.getNewDimensions(t.getDimensions()).floor();this._renderTexture.resizeTo(_n3);this._renderTexture.clear();r=this._render(t).then(function(){var s=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;_this72.setDirtyForRenderer(s,e);return _this72._renderTexture;});}else{Y.info(this.constructor.name,"Rendering from cache");r=Promise.resolve(this._renderTexture);}return r.then(function(n){if(o)o.stop();return n;});}},{key:"_render",value:function _render(t){var e;if(this._sdk.getRenderer().isOfType("webgl")){e=this._renderWebGL.bind(this);}else{e=this._renderCanvas.bind(this);}return e(t);}},{key:"_renderWebGL",value:function _renderWebGL(t){throw new Error("Operation#_renderWebGL is abstract and not implemented in inherited class.");}},{key:"_renderCanvas",value:function _renderCanvas(t){throw new Error("Operation#_renderCanvas is abstract and not implemented in inherited class.");}},{key:"getNewDimensions",value:function getNewDimensions(t){return t.clone();}},{key:"onBeforeExport",value:function onBeforeExport(){if(this.transform&&this._tempTransformChange){this.transform(this._tempTransformChange);}this._onBeforeExport();}},{key:"onAfterExport",value:function onAfterExport(){if(this.transform&&this._tempInverseTransformChange){this.transform(this._tempInverseTransformChange);}this._onAfterExport();}},{key:"_onBeforeExport",value:function _onBeforeExport(){}},{key:"_onAfterExport",value:function _onAfterExport(){}},{key:"setTemporaryTransformChange",value:function setTemporaryTransformChange(t,e){this._tempTransformChange=t;this._tempInverseTransformChange=e;}},{key:"reset",value:function reset(){this._dirty=true;this._glslPrograms={};}},{key:"isDirtyForRenderer",value:function isDirtyForRenderer(t){var e=this._dirtiness[t.id];return typeof e==="undefined"?true:e;}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;this._dirtiness[e.id]=t;}},{key:"setDirty",value:function setDirty(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;for(var r in this._dirtiness){this.setDirtyForRenderer(t,{id:r},e);}}},{key:"getSDK",value:function getSDK(){return this._sdk;}},{key:"getInputDimensions",value:function getInputDimensions(){var _this73=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var e=this._sdk.getInputDimensions();if(t){e.multiply(this._sdk.getZoom()).floor();}var r;this._sdk.getOperationsStack().forEach(function(o){if(r)return;if(o===_this73){r=true;return;}e=o.getNewDimensions(e);});return e.floor();}},{key:"clone",value:function clone(){var t=this.constructor;return new t(this._sdk,this.serializeOptions());}},{key:"disposeRenderTextures",value:function disposeRenderTextures(){if(this._renderTexture){this._renderTexture.dispose();}this._renderTexture=null;}},{key:"dispose",value:function dispose(){this.disposeRenderTextures();this._sprite.dispose();}}]);return gw;}(_t);gw.identifier=null;Lt=gw;});var Tnt,Xy,az;var lz=d(function(){pc();Bs();bw();Tnt=ir.OptionType;Xy=/*#__PURE__*/function(_Lt){_inherits(Xy,_Lt);var _super39=_createSuper(Xy);function Xy(){_classCallCheck(this,Xy);return _super39.apply(this,arguments);}_createClass(Xy,[{key:"getRotation",value:function getRotation(){var t=0;switch(this.getTags().Orientation){case 7:case 8:t=-90;break;case 3:case 4:t=-180;break;case 5:case 6:t=90;break;}return t;}},{key:"_getFlipVertically",value:function _getFlipVertically(){var _this$getTags=this.getTags(),t=_this$getTags.Orientation;return[5,7].indexOf(t)!==-1;}},{key:"_getFlipHorizontally",value:function _getFlipHorizontally(){var _this$getTags2=this.getTags(),t=_this$getTags2.Orientation;return[2,4].indexOf(t)!==-1;}},{key:"_getFinalOptions",value:function _getFinalOptions(){return{rotation:this.getRotation(),flipVertically:this._getFlipVertically(),flipHorizontally:this._getFlipHorizontally()};}},{key:"_render",value:function _render(t){var e=this._getFinalOptions();var r=e.rotation%360;var o=r*(Math.PI/180);this._sprite.setScale(e.flipHorizontally?-1:1,e.flipVertically?-1:1);this._sprite.setRotation(o);this._sprite.setAnchor(.5,.5);this._sprite.updateTransform();var n=this._sprite.getBounds();this._renderTexture.resizeTo(new _ot2(n.width,n.height));this._sprite.setPosition(this._renderTexture.getDimensions().divide(2));this._renderTexture.render(this._container);return Promise.resolve();}},{key:"getNewDimensions",value:function getNewDimensions(t){var e=this._getFinalOptions();t=t.clone();if(e.rotation%180){t.flip();}return t;}},{key:"applyTo",value:function applyTo(t){var e=this._getFinalOptions();var r=z.createCanvas();if(Math.abs(e.rotation%180)===90){r.width=t.height;r.height=t.width;}else{r.width=t.width;r.height=t.height;}var o=r.getContext("2d");var n=e.rotation*Math.PI/180;var s=.5*(r.width-t.width);var a=.5*(r.height-t.height);o.translate(s,a);o.translate(.5*t.width,.5*t.height);o.rotate(n);o.translate(-.5*t.width,-.5*t.height);if(e.flipVertically){o.translate(0,t.height);o.scale(1,-1);}if(e.flipHorizontally){o.translate(t.width,0);o.scale(-1,1);}o.drawImage(t,0,0);return r;}}]);return Xy;}(Lt);Xy.identifier="exif-orientation";Xy.prototype.availableOptions={tags:{type:Tnt.OBJECT,"default":{}}};az=Xy;});var Md={};de(Md,{ExifOrientationOperation:function ExifOrientationOperation(){return az;}});var yw=d(function(){lz();});var _w,cz;var uz=d(function(){To();Ar();gh();oc();kd();Vy();kn();_w=/*#__PURE__*/function(_t8){_inherits(_w,_t8);var _super40=_createSuper(_w);function _w(t){var _this74;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,_w);_this74=_super40.call(this,e);_this74._sdk=t;return _this74;}_createClass(_w,[{key:"export",value:function _export(){var _this75=this;var _this$_options3=this._options,t=_this$_options3.imageFormat,e=_this$_options3.transparent;var r=function r(o){if(!o.renderDone){return _this75._sdk.render().then(function(n){return r(n);});}return o;};return this.validateSettings().then(function(){return _this75._prepareSDK().then(function(o){return r(o);});}).then(function(o){var n=o.outputTexture,s=o.renderDone;var a=_this75._sdk.getRenderer();var l=a.getClearColor();if(t==="image/png"&&e){a.setClearColor(new G(0,0,0,0));}var c=a.getCanvas();if(a.isOfType("webgl")){c=_this75._createCanvasFromTexture(n);}a.setClearColor(l);return _this75._encodeImageFormat(c);}).then(function(o){return _this75._restoreExifMetadata(o,t);}).then(function(o){return _this75._restoreSDK().then(function(){return o;});});}},{key:"_restoreExifMetadata",value:function _restoreExifMetadata(t,e,r){if(e===ic.JPEG){var o=this._sdk.getExif();if(o){if(true){if(typeof t==="string"){t=o.restoreSegments(t);}}if(false){var n=this._options.renderType;if(n===Rr.BUFFER){t=Buffer.from(o.restoreSegmentsInArray(_toConsumableArray(t)));}else if(n===Rr.DATAURL&&typeof t==="string"){t=o.restoreSegments(t);}}}}return Promise.resolve(t);}},{key:"_encodeAsDataURL",value:function _encodeAsDataURL(t,e,r){if(z.isBrowser){var o=t.toDataURL(e,r);$t(t);return Promise.resolve(o);}try{var _o4=t.toDataURL(e,r);$t(t);return Promise.resolve(_o4);}catch(o){return Promise.error(o);}}},{key:"_encodeAsHTMLImage",value:function _encodeAsHTMLImage(t,e,r){return this._encodeAsDataURL(t,e,r).then(function(o){var n=new Xi();n.src=o;$t(t);return Promise.resolve(n);});}},{key:"_encodeAsBuffer",value:function _encodeAsBuffer(t,e,r){if(false){if(e===ic.JPEG){var o=t.toBuffer(e,{quality:r,progressive:true,chromaSubsampling:false});$t(t);return Promise.resolve(o);}if(e===ic.PNG){var _o5=t.toBuffer(e,{quality:r});$t(t);return Promise.resolve(_o5);}if(e===ic.RAW){var _o6=t.toBuffer(e);$t(_o6);return Promise.resolve(_o6);}return Promise.reject(new Error("Unsupported imageFormat: ".concat(e)));}return Promise.reject(new Error("Unsupported platform for RenderType"));}},{key:"_encodeAsMSBlob",value:function _encodeAsMSBlob(t,e,r){var o=t.msToBlob();$t(t);return Promise.resolve(o);}},{key:"_encodeAsBLOB",value:function _encodeAsBLOB(t,e,r){return new Promise(function(o,n){t.toBlob(function(s){o(s);},e,r);});}},{key:"_encodeImageFormat",value:function _encodeImageFormat(t){var _this$_options4=this._options,e=_this$_options4.imageFormat,r=_this$_options4.quality;var o=this._options.renderType;if(o===Rr.BLOB&&t.msToBlob&&!t.toBlob){o=Rr.MSBLOB;}switch(o){case Rr.IMAGE:{return this._encodeAsHTMLImage(t,e,r);}case Rr.DATAURL:{return this._encodeAsDataURL(t,e,r);}case Rr.BUFFER:{return this._encodeAsBuffer(t,e,r);}case Rr.MSBLOB:{return this._encodeAsMSBlob(t,e,r);}case Rr.BLOB:{return this._encodeAsBLOB(t,e,r);}}return Promise.reject(new Error("Unsupported RenderType: ".concat(o,"!")));}},{key:"_prepareSDK",value:function _prepareSDK(){var t=this._sdk.getRenderer();this._sdkSettings={dimensions:t.getDimensions().clone(),textureQuality:this._sdk.getTextureQuality(),rendererPixelRatio:t.getPixelRatio(),renderMode:this._sdk.getRenderMode()};this._sdk.setRenderMode("export");this._sdk.setTextureQuality(1);var e=t.isOfType("canvas");t.setPixelRatio(1);t.resizeTo(this._sdk.getFinalDimensions(),e);this._sdk.setAllOperationsToDirty(true);var r=this._sdk.getOperationsStack();r.forEach(function(o){o.disposeRenderTextures();});r.disableCache();return this._sdk.render();}},{key:"_restoreSDK",value:function _restoreSDK(){var t=this._sdk.getOperationsStack();t.enableCache();this._sdk.setRenderMode(this._sdkSettings.renderMode);var e=this._sdk.getRenderer();var r=e.isOfType("canvas");e.setPixelRatio(this._sdkSettings.rendererPixelRatio);e.resizeTo(this._sdkSettings.dimensions,r);this._sdk.setTextureQuality(this._sdkSettings.textureQuality);this._sdk.setAllOperationsToDirty(true);return this._sdk.render();}},{key:"_createCanvasFromTexture",value:function _createCanvasFromTexture(t){var e=this._sdk.getRenderer();var r=this._sdk.getFinalDimensions();var o=this._sdk.getRenderer().getContext();var n=o.createFramebuffer();o.bindFramebuffer(o.FRAMEBUFFER,n);var s=t.getBaseTexture().getGLTextureForRenderer(e);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,s,0);var a=new Uint8Array(r.x*r.y*4);o.readPixels(0,0,r.x,r.y,o.RGBA,o.UNSIGNED_BYTE,a);var l=this._checkPixelsForTransparency(a);var c;if(l){var h=new L.Sprite(t);h.setFilters([new L.Filters.UnpremultiplyFilter()]);var g=new L.Container();g.addChild(h);c=new L.RenderTexture(e,r.x,r.y);c.render(g);var x=c.getBaseTexture().getGLTextureForRenderer(e);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,x,0);o.readPixels(0,0,r.x,r.y,o.RGBA,o.UNSIGNED_BYTE,a);e.setRenderTarget();c.dispose();}var u=z.createCanvas();u.width=r.x;u.height=r.y;var m=u.getContext("2d");var p=m.createImageData(r.x,r.y);p.data.set(a);m.putImageData(p,0,0);o.deleteFramebuffer(n);return u;}},{key:"_checkPixelsForTransparency",value:function _checkPixelsForTransparency(t){var e=this._sdk.getFinalDimensions();var r=e.x*e.y*4;var o;for(var n=3;n1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,pz);_this76=_super41.call(this);q(_assertThisInitialized(_this76),"_onContextLost",function(){_this76.emit("context-lost");});q(_assertThisInitialized(_this76),"_initWatermark",function(){if(_this76._options.watermark&&_this76._options.watermark.watermarkURI){_this76._watermarkOperation=_this76.createOperation("watermark",{watermarkURI:_this76._options.watermark.watermarkURI,alignment:_this76._options.watermark.alignment,inset:_this76._options.watermark.inset,size:_this76._options.watermark.size,crossOrigin:_this76._options.crossOrigin});}});_this76._onOperationUpdate=_this76._onOperationUpdate.bind(_assertThisInitialized(_this76));_this76._onContextRestored=_this76._onContextRestored.bind(_assertThisInitialized(_this76));_this76.version="3.9.0";_this76[ye("VG04Z1lHRndhVXRsZVdBZ2IzQjBhVzl1SUdkcGRtVnU=")]=true;_this76._preferredRenderer=t;_this76._options=_objectSpread(_objectSpread({},e),{},{extensions:{},renderMode:"dynamic",versionCheck:true,displayWelcomeMessage:true,image:null,canvas:null,transparent:false,textureQuality:1,zoom:1,spriteScale:1,rotation:0,smoothDownscaling:false,smoothUpscaling:false,crossOrigin:"anonymous",logLevel:"warn",pixelRatio:Math.max(typeof window!=="undefined"&&window.devicePixelRatio||1,1)});if(_this76._options.smoothUpscaling){no.BaseTexture.DefaultMagFilter=no.BaseTexture.LinearFilter;}_this76._options.extensions=Object.assign(_this76._options.extensions,{operations:[],controls:[],languages:[]});Ns.setLevel(_this76._options.logLevel);_this76[ye("Wm5KbFpVeHBZMlZ1YzAxdlpHVT0=")]=false;if(!_this76[ye("X29wdGlvbnM=")][ye("bGljZW5zZQ==")]){_this76[ye("Wm5KbFpVeHBZMlZ1YzAxdlpHVT0=")]=true;_this76._l=new fh[ye("RnJlZUxpY2Vuc2VDaGVja2Vy")]();}else{var o=fh[ye("TGljZW5zZUNoZWNrZXI=")];_this76._l=new o(_this76[ye("X29wdGlvbnM=")][ye("bGljZW5zZQ==")]);_this76._cv(true).then(function(){_this76._ct();})["catch"](function(n){Ns.error(ye("TGljZW5zaW5n"),n.message);});}_this76._defaultRenderMode=_this76._options.renderMode;_this76._renderMode=_this76._options.renderMode;_this76._textureQuality=_this76._options.textureQuality;_this76._offset=new vw();_this76._zoom=_this76._options.zoom;_this76._spriteScale=_this76._options.spriteScale;_this76._rotation=_this76._options.rotation;_this76._operations={};_this76._operationsStack=null;_this76.setOperationsStack(new $y());_this76._container=new no.Container();_this76._sprite=new no.Sprite();_this76._container.addChild(_this76._sprite);_this76._inputTexture=_this76._options.inputTexture;_this76._currentInputTexture=null;_this76._currentTexture=null;_this76._resizedTexture=null;_this76._resizedContainer=new no.Container();_this76._resizedSprite=new no.Sprite();_this76._resizedContainer.addChild(_this76._resizedSprite);_this76._texturesToDispose=[];_this76.setSmoothDownscaling(_this76._options.smoothDownscaling);_this76._registerOperations();_this76._initRenderer();var r=_this76._renderer.constructor.type;if(_this76._options.displayWelcomeMessage){if(false){Ns.log("Version:","".concat(_this76.version," (").concat(r,") - https://img.ly/photo-sdk"));}}if(_this76[ye("Wm5KbFpVeHBZMlZ1YzAxdlpHVT0=")]){Ns.log(ye("VGhlIFBob3RvRWRpdG9yIFNESyBpcyBhIGNvbW1lcmNpYWwgcHJvZHVjdC4gQmVmb3JlIGJlaW5nIGFibGUgdG8gdXNlIGl0IHdpdGhvdXQgbGltaXRhdGlvbnMsIHlvdSBuZWVkIHRvIHVubG9jayB0aGUgU0RLIHdpdGggYSBsaWNlbnNlIGZpbGUuIFlvdSBjYW4gb2J0YWluIGEgdGltZS1saW1pdGVkIGV2YWx1YXRpb24gbGljZW5zZSBieSBzdGFydGluZyBhIHRyaWFsIGF0IGh0dHBzOi8vd3d3LmltZy5seS9zaWdudXAgb3IgeW91IGNhbiBwdXJjaGFzZSBhIGxpY2Vuc2UgYnkgcmVxdWVzdGluZyBhIHF1b3RlIGF0IGh0dHBzOi8vd3d3LmltZy5seS9wcmljaW5nLgoKQmVjYXVzZSB5b3UgZGlkIG5vdCBzcGVjaWZ5IGEgbGljZW5zZSBmaWxlIHlldCwgdGhlIFNESyB3aWxsIG5vdyBkaXNwbGF5IGEgd2F0ZXJtYXJrIGltYWdlIG9uIHRvcCBvZiBhbnkgcGhvdG9zIHlvdSBkaXNwbGF5IG9yIGV4cG9ydCB3aXRoIGl0LiBGb3IgaW5zdHJ1Y3Rpb25zIGZvciBob3cgdG8gdW5sb2NrIHRoZSBTREssIHBsZWFzZSB2aXNpdCBodHRwczovL2ltZy5seS9kb2NzL3Blc2RrL3dlYi9pbnRyb2R1Y3Rpb24vZ2V0dGluZ19zdGFydGVkLg=="));}if(_this76._options.image){_this76.setImage(_this76._options.image,_this76._options.exif);}return _this76;}_createClass(pz,[{key:"_ct",value:function _ct(){if(this._l.exp()){var t=this._l.isExp();if(t){Ns.error(ye("TGljZW5zaW5n"),ye("WW91ciB0cmlhbCBsaWNlbnNlIGhhcyBleHBpcmVkLiBQbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAaW1nLmx5Lg=="));}else{Ns.warn(ye("TGljZW5zaW5n"),ye("WW91ciB0cmlhbCBsaWNlbnNlIHdpbGwgZXhwaXJlIGluICVkIGRheXMu").replace("%d",this._l.dl()));}}}},{key:"_cv",value:function _cv(){var _this77=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this._l.c()["catch"](function(e){_this77[ye("VG04Z1lHRndhVXRsZVdBZ2IzQjBhVzl1SUdkcGRtVnU=")]=false;var r=ye("SW52YWxpZCBsaWNlbnNlLg==");if(t){if(e.code==="ELICEXP"){r=ye("WW91ciB0cmlhbCBsaWNlbnNlIGhhcyBleHBpcmVkLiBQbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAaW1nLmx5Lg==");}else if(e.code==="ELICINVHOST"){r=ye("VGhlIGJ1bmRsZSBpZGVudGlmaWVycyB0aGF0IHlvdSBzcGVjaWZpZWQgaW4geW91ciBsaWNlbnNlIGZpbGUgZG8gbm90IG1hdGNoIHRoZSBhcHAncyBidW5kbGUgaWRlbnRpZmllci4gUGxlYXNlIHVwZGF0ZSBhbmQgcmVkb3dubG9hZCB5b3VyIGxpY2Vuc2UgZnJvbSB5b3VyIGN1c3RvbWVyIGRhc2hib2FyZCBhdCBodHRwczovL3d3dy5pbWcubHkvbG9naW4u");}else if(e.code==="ELICINVPLAT"){r=ye("VGhlIGxpY2Vuc2UgdGhhdCB5b3Ugc3BlY2lmaWVkIGlzIGZvciBhbm90aGVyIHBsYXRmb3JtLiBQbGVhc2UgZG93bmxvYWQgeW91ciBsaWNlbnNlIGZvciB0aGUgd2ViIHBsYXRmb3JtIGZyb20geW91ciBjdXN0b21lciBkYXNoYm9hcmQgYXQgaHR0cHM6Ly93d3cuaW1nLmx5L2xvZ2luLg==");}else if(e.code==="ELICINVFMT"){r=ye("SW52YWxpZCBsaWNlbnNlIGZvcm1hdC4gUGxlYXNlIG1ha2Ugc3VyZSB5b3UncmUgcGFzc2luZyB5b3VyIGxpY2Vuc2UgYXMgYSBzdHJpbmcsIG5vdCBhcyBgJGZvcm1hdGAu").replace("$format",_typeof(_this77._options.license));}else if(e.code==="ELICINV"){r=ye("VGhlIHNpZ25hdHVyZSBvZiB5b3VyIGxpY2Vuc2UgaXMgbm90IHZhbGlkLiBQbGVhc2UgdHJ5IHRvIHJlZG93bmxvYWQgeW91ciBsaWNlbnNlIGZyb20geW91ciBjdXN0b21lciBkYXNoYm9hcmQgYXQgaHR0cHM6Ly93d3cuaW1nLmx5L2xvZ2luLg==");}else{r=ye("SW4gY2FzZSB5b3UgZG9uJ3QgaGF2ZSBhIGxpY2Vuc2UgeWV0LCBwbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAaW1nLmx5IHRvIG9idGFpbiBhIGxpY2Vuc2Ugb3IgbG9nIGluIHRvIHlvdXIgY3VzdG9tZXIgZGFzaGJvYXJkLg==");}}e.message=r;throw new Error(e);});}},{key:"_t",value:function _t(){this._l.t();}},{key:"_fl",value:function _fl(){return this[ye("Wm5KbFpVeHBZMlZ1YzAxdlpHVT0=")];}},{key:"_onOperationUpdate",value:function _onOperationUpdate(){for(var _len15=arguments.length,t=new Array(_len15),_key15=0;_key15<_len15;_key15++){t[_key15]=arguments[_key15];}this.emit.apply(this,[xw.OPERATION_UPDATED].concat(t));}},{key:"_onContextRestored",value:function _onContextRestored(){Ns.warn(this.constructor.name,"Trying to re-render after WebGL context has been restored.");this.setAllOperationsToDirty();this._operationsStack.forEach(function(t){t.disposeRenderTextures();});this.render();}},{key:"export",value:function _export(){var _this78=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:Fnt.DATAURL;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Ont.PNG;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:.8;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;return this._cv(true).then(function(){if(_this78.hasChanges()&&!n){_this78._t();}_this78._operationsStack.forEach(function(a){a.onBeforeExport();});var s=new cz(_this78,{renderType:t,imageFormat:e,quality:r,transparent:o});return s["export"]().then(function(a){_this78._operationsStack.forEach(function(l){l.onAfterExport();});return Promise.resolve(a);});});}},{key:"render",value:function render(){var _this79=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(!this._inputTexture){throw new Error("You need to set an image before calling PhotoEditorSDK#render.");}var e=this._renderer.getContext();if(e.startFrame){e.startFrame();}var r;if(Ns.canLog("info")){r=new Ky("\u26A1\u26A1\u26A1","Frame rendering");}Ns.info("\u26A1\u26A1\u26A1","Rendering starts");var o=this._operationsStack;o.updateDirtinessForRenderer(this._renderer);return this._prepareTexture().then(function(n){if(_this79._renderMode==="export"){n=_this79._inputTexture;}_this79._currentTexture=n;_this79._sprite.setTexture(n);_this79._container.updateTransform();}).then(function(){return o.validateSettings();}).then(function(){if(_this79._fl()||!_this79[ye("VG04Z1lHRndhVXRsZVdBZ2IzQjBhVzl1SUdkcGRtVnU=")]){if(!o.getByIdentifier("license-watermark")){_this79.createOperation("license-watermark");}else{o.moveToTop("license-watermark");}}if(!o.getByIdentifier("watermark")){_this79._initWatermark();}else{o.moveToTop("watermark");}return o.render(_this79,_this79._currentTexture);}).then(function(n){var s=n.outputTexture;_this79._currentTexture=s;_this79._sprite.setTexture(_this79._currentTexture);switch(_this79._renderMode){case"dynamic":{var a=_this79._renderer.getDimensions().clone().divide(2).add(_this79._offset);_this79._container.setScale(_this79._zoom/_this79.getTextureScale(),_this79._zoom/_this79.getTextureScale());_this79._container.setPosition(a);_this79._sprite.setAnchor(.5,.5);_this79._sprite.setScale(_this79._spriteScale,_this79._spriteScale);_this79._sprite.setRotation(_this79._rotation);break;}case"export":_this79._container.setScale(1,1);_this79._container.setPosition(0,0);_this79._sprite.setAnchor(0,0);_this79._sprite.setPosition(0,0);_this79._sprite.setScale(_this79._spriteScale,_this79._spriteScale);_this79._sprite.setRotation(0);break;case"adapter":_this79._container.setScale(1,1);_this79._container.setPosition(0,0);_this79._sprite.setAnchor(0,0);_this79._sprite.setPosition(0,0);_this79._sprite.setScale(1,1);_this79._sprite.setRotation(0);break;}if(t){_this79._renderer.render(_this79._container);}return n;}).then(function(n){if(r){r.stop();}if(e.endFrame){e.endFrame();}_this79._disposeTextures();return n;});}},{key:"getTextureScale",value:function getTextureScale(){return Math.min(1,this._textureQuality*this._options.pixelRatio);}},{key:"_prepareTexture",value:function _prepareTexture(){var _this80=this;return new Promise(function(t,e){var r=_this80.getTextureScale();if(_this80._textureQuality===1){return t(_this80._inputTexture);}var o=_this80.getInputDimensions().multiply(r).floor();var n;if(!_this80._resizedTexture){_this80._resizedTexture=new no.RenderTexture(_this80._renderer,o.x,o.y);n=true;}else if(!_this80._resizedTexture.getDimensions().equals(o)){_this80._resizedTexture.resizeTo(o);n=true;}if(n){_this80._resizedSprite.setScale(r,r);_this80._resizedSprite.setTexture(_this80._inputTexture);_this80._resizedTexture.render(_this80._resizedContainer);}t(_this80._resizedTexture);});}},{key:"_registerOperations",value:function _registerOperations(){this._operations={};for(var t in Md){var e=Md[t];this._operations[e.identifier]=e;}this._operations=_objectSpread(_objectSpread({},this._operations),this._options.extensions.operations);}},{key:"registerOperations",value:function registerOperations(t){var _this81=this;t.forEach(function(e){_this81._operations[e.identifier]=e;});}},{key:"setAllOperationsToDirty",value:function setAllOperationsToDirty(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;this._operationsStack.setAllToDirty(t);}},{key:"createOperation",value:function createOperation(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var o=this._operations[t];if(!o){throw new Error("No operation with identifier `".concat(t,"` found."));}var n=new o(this,e);if(r){this.addOperation(n);}return n;}},{key:"addOperation",value:function addOperation(t){this._operationsStack.push(t);}},{key:"removeOperation",value:function removeOperation(t){this._operationsStack.remove(t);}},{key:"getInputDimensions",value:function getInputDimensions(){var t=this._inputTexture.getFrame();return new vw(t.width,t.height);}},{key:"getFinalDimensions",value:function getFinalDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.getInputDimensions();var r=this._operationsStack;r.forEach(function(o){if(!o.getEnabled())return;e=o.getNewDimensions(e);});if(t){e.multiply(this._spriteScale);}return e.floor();}},{key:"getOutputDimensions",value:function getOutputDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this.getFinalDimensions(t).clone().multiply(this._zoom).floor();}},{key:"getOutputTextureDimensions",value:function getOutputTextureDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.getTextureScale();var r=this.getInputDimensions().multiply(e).floor();this._operationsStack.forEach(function(o){r=o.getNewDimensions(r);});return r;}},{key:"getCrossOrigin",value:function getCrossOrigin(){return mz.getCrossOrigin(this._options.crossOrigin||"Anonymous");}},{key:"_initRenderer",value:function _initRenderer(){var t={canvas:this._options.canvas,pixelRatio:this._options.pixelRatio,debug:this._options.debug,transparent:this._options.transparent,clearColor:this._options.clearColor};var e;var r;if(this._renderMode!=="export"&&this._options.canvas){var o=this._options.canvas;e=o.width;r=o.height;}else if(this._inputTexture){var _o7=this.getFinalDimensions();e=_o7.x;r=_o7.y;}else{e=1;r=1;}switch(this._preferredRenderer){case dz.WEBGL:this._renderer=no.autoDetectRenderer(e,r,t);this._renderer.on("context-restored",this._onContextRestored);this._renderer.on("context-lost",this._onContextLost);break;case dz.CANVAS:this._renderer=no.canvasRenderer(e,r,t);this._renderer.on("context-restored",this._onContextRestored);break;default:Ns.warn("PhotoEditorSDK","PhotoEditorSDK Error: Renderer `".concat(this._preferredRenderer,"` not supported. Falling back to automatically detected renderer."));this._renderer=no.autoDetectRenderer(e,r,t);}}},{key:"resizeTo",value:function resizeTo(t){this._renderer.resizeTo(t,true);}},{key:"reset",value:function reset(){this._operationsStack.clear();}},{key:"parseExif",value:function parseExif(t){if(!t){return;}var e=t.src;var r=false;var o=null;if(true){r=_h.isJPEG(e);o=e;}else if(t instanceof Xi&&t.rawSource){var n=t.rawSource;if(!(t.rawSource instanceof Buffer)){var s=t.rawSource.replace("data:image/jpeg;base64,","");n=Buffer.from(s,"base64");e=t.rawSource;}else{e=t.rawSource.toString("base64");}r=_h.bufferIsJPEG(n);if(r){o=e;}}if(r){var _n4=null;try{_n4=_h.fromBase64String(o);}catch(s){}if(!_n4){return;}return _n4;}}},{key:"_handleExifOrientation",value:function _handleExifOrientation(){var t=this._exif.getTags();if(t&&t.Orientation){var e=t.Orientation!==1&&t.Orientation!==2;var r=[2,4,5,7].indexOf(t.Orientation)!==-1;if(e||r){if(typeof navigator==="undefined"){if(!this._exifOperation){this._exifOperation=this.createOperation("exif-orientation");}this._exifOperation.setTags(t);}else{var o=window&&window.navigator&&window.navigator.userAgent||"";if(!!o.match(/msie|trident/i)||o.indexOf("Edge")!==-1||!CSS.supports("image-orientation","from-image")){if(!this._exifOperation){this._exifOperation=this.createOperation("exif-orientation");}this._exifOperation.setTags(t);}}this._exif.setOrientation(1);}}}},{key:"correctExifOrientation",value:function correctExifOrientation(t){var e=this.parseExif(t);if(!e){return t;}var r=e.getTags();if(r&&r.Orientation){var o=r.Orientation!==1&&r.Orientation!==2;var n=[2,4,5,7].indexOf(r.Orientation)!==-1;if(o||n){if(typeof navigator==="undefined"){var s=this.createOperation("exif-orientation",{},false);s.setTags(r);t=s.applyTo(t);}else{var _s4=window&&window.navigator&&window.navigator.userAgent||"";if(!!_s4.match(/msie|trident/i)||_s4.indexOf("Edge")!==-1||!CSS.supports("image-orientation","from-image")){var a=this.createOperation("exif-orientation",{},false);a.setTags(r);t=a.applyTo(t);}}e.setOrientation(1);r.Orientation=1;return t;}}return t;}},{key:"hasImage",value:function hasImage(){return this._image!==null&&typeof this._image!=="undefined";}},{key:"getImage",value:function getImage(){return this._image;}},{key:"disposeTexture",value:function disposeTexture(t){this._texturesToDispose.push(t);}},{key:"_disposeTextures",value:function _disposeTextures(){for(var t=0;t1&&arguments[1]!==undefined?arguments[1]:null;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;this._disposeTextures();if(this._exifOperation){this.removeOperation(this._exifOperation);this._exifOperation=null;}this._options.image=t;this._image=t;this._exif=e||this.parseExif(t);if(this._exif){this._handleExifOrientation();}var o=new no.BaseTexture(this._image);var n=new knt(0,0,this._image.naturalWidth||this._image.width,this._image.naturalHeight||this._image.height);if(r){n.width=r.x;n.height=r.y;}if(this._resizedTexture){this._resizedTexture.dispose();}this._resizedTexture=null;if(this._inputTexture){this.disposeTexture(this._inputTexture.getBaseTexture());}this._inputTexture=new no.Texture(o,n);this._currentTexture=this._inputTexture;this._sprite.clearTexture(false);this._sprite.setTexture(this._inputTexture);this.emit("new-image");this.setAllOperationsToDirty(true);}},{key:"setInputTexture",value:function setInputTexture(t){this._inputTexture=t;}},{key:"getCanvas",value:function getCanvas(){return this._renderer.getCanvas();}},{key:"setCanvas",value:function setCanvas(t){this._renderer.setCanvas(t);}},{key:"getSprite",value:function getSprite(){return this._sprite;}},{key:"getContainer",value:function getContainer(){return this._container;}},{key:"getOperationsStack",value:function getOperationsStack(){return this._operationsStack;}},{key:"setOperationsStack",value:function setOperationsStack(t){if(this._operationsStack){this._operationsStack.off(xw.OPERATION_UPDATED,this._onOperationUpdate);}this._operationsStack=t;this._operationsStack.on(xw.OPERATION_UPDATED,this._onOperationUpdate);}},{key:"getOperations",value:function getOperations(){return this._operations;}},{key:"getRenderer",value:function getRenderer(){return this._renderer;}},{key:"getOffset",value:function getOffset(){return this._offset;}},{key:"setOffset",value:function setOffset(t,e){if(t instanceof vw){this._offset.copy(t);}else{this._offset.set(t,e);}}},{key:"getRenderMode",value:function getRenderMode(){return this._renderMode;}},{key:"setRenderMode",value:function setRenderMode(t){this._renderMode=t;}},{key:"getZoom",value:function getZoom(){return this._zoom;}},{key:"setZoom",value:function setZoom(t){this._zoom=t;this._container.setScale(this._zoom,this._zoom);this._container.updateTransform();}},{key:"getTextureQuality",value:function getTextureQuality(){if(this._renderMode==="export"){return 1;}return this._textureQuality;}},{key:"setTextureQuality",value:function setTextureQuality(t){if(t!==this._textureQuality){this.setAllOperationsToDirty(true);}this._textureQuality=Math.min(1,t);if(this._textureQuality===1&&this._resizedTexture){this._resizedTexture.dispose();this._resizedTexture=null;}}},{key:"getSpriteScale",value:function getSpriteScale(){return this._spriteScale;}},{key:"setSpriteScale",value:function setSpriteScale(t){this._spriteScale=t;this._sprite.setScale(t,t);this._sprite.updateTransform();}},{key:"getPixelRatio",value:function getPixelRatio(){return this._options.pixelRatio;}},{key:"getExif",value:function getExif(){return this._exif;}},{key:"getOptions",value:function getOptions(){return this._options;}},{key:"getInputTexture",value:function getInputTexture(){return this._inputTexture;}},{key:"setSmoothDownscaling",value:function setSmoothDownscaling(t){this._options.smoothDownscaling=t;this._sprite.setSmoothDownscaling(t);this._resizedSprite.setSmoothDownscaling(t);}},{key:"setRotation",value:function setRotation(t){this._rotation=t;}},{key:"getRotation",value:function getRotation(){return this._rotation;}},{key:"hasChanges",value:function hasChanges(){return this.getOperationsStack().hasChanges();}},{key:"dispose",value:function dispose(){this._operationsStack.dispose();this._renderer.dispose();if(this._exif){this._exif.dispose();}if(this._resizedTexture){this._resizedTexture.dispose();}}}]);return pz;}(Dnt);Te=pz;});var Rnt,ft;var xh=d(function(){zo();L4();Ar();gh();yd();oc();kd();Y3();Sd();pw();Vy();ow();lw();hw();kn();yw();bw();hz();Te.version="3.9.0";Te.Math=J;Te.Operations=Md;Te.Engine=L;Te.Color=G;Te.LicenseChecker=Uy;Te.Operation=Lt;Te.EventEmitter=Vi;Te.Utils=z;Te.Env=q3;Te.OperationsStack=$y;Te.EXIF=_h;Te.Image=Xi;Te.Configurable=_t;Te.Log=Y;Te.Loaders=I1;Te.RenderType=Rr;Te.ImageFormat=ic;Te.OptionType=K;Te.RendererType=Ke;Te.UniformType=le;Te.Base64=io;Rnt={};Te.UI=Rnt;ft=Te;});var $=d(function(){xh();xh();});var gz;var fz=d(function(){gz="precision highp float;\n\nvarying vec2 v_texCoord;\nuniform sampler2D u_image;\n\nuniform float u_gamma;\nuniform float u_shadows;\nuniform float u_highlights;\nuniform float u_whites;\nuniform float u_blacks;\n\nuniform mat4 u_colorMatrix;\nuniform vec4 u_colorOffset;\n\nconst float EPSILON = 0.0000001;\n\nfloat calculateLuminance(vec3 rgb) {\n // This is the luminance calculation part of the RGB to HSL formular.\n vec4 p = mix(\n vec4(rgb.gb, 0.0, -1.0 / 3.0),\n vec4(rgb.bg, -1.0, 2.0 / 3.0),\n vec4(rgb.g < rgb.b)\n );\n\n vec4 q = mix(\n vec4(rgb.r, p.yzx),\n vec4(p.xyw, rgb.r),\n vec4(rgb.r < p.x)\n );\n\n float croma = q.x - min(q.w, q.y);\n float luminance = q.x - croma * 0.5;\n return luminance;\n}\n\nvec3 map(vec3 x, float in_min, float in_max, float out_min, float out_max){\n return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;\n}\n\nvoid main() {\n\n vec4 color = clamp(texture2D(u_image, v_texCoord), 0.0, 1.0);\n color.rgb /= max(color.a, EPSILON); // Revert premultiplied alpha\n\n // Apply gamma\n if (u_gamma != 1.0) {\n color.rgb = pow(color.rgb, vec3(1.0 / max(u_gamma, EPSILON)));\n }\n\n // Apply shadows and highlights\n float luminance = calculateLuminance(color.rgb);\n\n float shadow = u_shadows >= 0.0\n ? clamp(\n pow(luminance, 1.0 / (u_shadows + 1.0))\n + pow(luminance, 2.0 / (u_shadows + 1.0)) * -0.76\n - luminance\n , 0.0, max(u_shadows, 1.0))\n : -clamp(\n pow(luminance, 1.0 / (-u_shadows + 1.0))\n + pow(luminance, 2.0 / (-u_shadows + 1.0)) * -0.76\n - luminance\n , 0.0, max(-u_shadows, 1.0));\n\n float highlight = u_highlights < 0.0\n ? clamp(\n 1.0\n - pow(1.0 - luminance, 1.0 / (1.0 - u_highlights))\n - pow(1.0 - luminance, 2.0 / (1.0 - u_highlights)) * -0.8\n - luminance\n , -1.0, 0.0)\n : -clamp(\n 1.0\n - pow(1.0 - luminance, 1.0 / (1.0 + u_highlights))\n - pow(1.0 - luminance, 2.0 / (1.0 + u_highlights)) * -0.8\n - luminance\n , -1.0, 0.0);\n\n // Bright color need more contrast and dark color need more brightness.\n // This is to keep saturatation because the color information of a dark colors is lost.\n float shadowContrast = shadow * luminance * luminance;\n float shadowBrightness = shadow - shadowContrast;\n\n float offset = luminance + shadowContrast + highlight;\n color.rgb = clamp(offset * ((color.rgb + shadowBrightness) / max(luminance, EPSILON)), 0.0, 1.0);\n \n // Apply Color Matrix\n color.rgb = clamp(color * u_colorMatrix + u_colorOffset, 0.0, 1.0).rgb;\n color.rgb = map(color.rgb, 0.0, 1.0, u_blacks / 2.0, 1.0 + u_whites / 2.0);\n color = clamp(color, 0.0, 1.0);\n color.rgb *= color.a; // Reset premultiplied alpha\n\n gl_FragColor = color;\n}\n";});function Cw(i,t,e,r,o){return(i-t)*(o-r)/(e-t)+r;}var Bnt,Ld,Pnt,Sw,qy;var ww=d(function(){$();fz();Bnt=J.ColorMatrix;Ld=1e-7;Pnt=function Pnt(i){var t=Math.max(i.r,i.g,i.b);var e=Math.min(i.r,i.g,i.b);return(t+e)/2;};Sw=/*#__PURE__*/function(_L$Filter){_inherits(Sw,_L$Filter);var _super42=_createSuper(Sw);function Sw(){var _this82;_classCallCheck(this,Sw);_this82=_super42.call(this);_this82._fragmentSource=gz;return _this82;}_createClass(Sw,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var _this$_options5=this._options,c=_this$_options5.colorMatrix,u=_this$_options5.gamma,m=_this$_options5.shadows,p=_this$_options5.highlights,h=_this$_options5.whites,g=_this$_options5.blacks;var x=u!==1;var v=m!==0||p!==0;var b=new G(0,0,0,0);for(var T=0;T=0?z.clamp(Math.pow(E,1/(m+1))+Math.pow(E,2/(m+1))*-.76-E,0,Math.max(m,1)):-z.clamp(Math.pow(E,1/(-m+1))+Math.pow(E,2/(-m+1))*-.76-E,0,Math.max(-m,1));var I=p<0?z.clamp(1-Math.pow(1-E,1/(1-p))-Math.pow(1-E,2/(1-p))*-.8-E,-1,0):-z.clamp(1-Math.pow(1-E,1/(1+p))-Math.pow(1-E,2/(1+p))*-.8-E,-1,0);var F=A*E*E;var Z=A-F;var et=E+F+I;b.r=z.clamp(et*((b.r+Z)/Math.max(E,Ld)),0,1);b.g=z.clamp(et*((b.g+Z)/Math.max(E,Ld)),0,1);b.b=z.clamp(et*((b.b+Z)/Math.max(E,Ld)),0,1);}b=c.apply(b).clamp(0,1);b.r=Cw(b.r,0,1,g/2,1+h/2);b.g=Cw(b.g,0,1,g/2,1+h/2);b.b=Cw(b.b,0,1,g/2,1+h/2);l.data[k]=b.r*255;l.data[k+1]=b.g*255;l.data[k+2]=b.b*255;}a.putImageData(l,0,0);}}]);return Sw;}(L.Filter);Sw.prototype.availableOptions={gamma:{type:"number","default":1,uniformType:"f"},shadows:{type:"number","default":0,uniformType:"f"},highlights:{type:"number","default":1,uniformType:"f"},whites:{type:"number","default":0,uniformType:"f"},blacks:{type:"number","default":0,uniformType:"f"},colorMatrix:{type:"color-matrix","default":new Bnt(),uniformType:"mat4"},colorOffset:{type:"array","default":[],uniformType:"4f"}};qy=Sw;});var yz;var bz=d(function(){yz="precision mediump float;\n\n// Input Image with config WRAP_S and WRAP_T: CLAMP_TO_EDGE\nuniform sampler2D u_image;\n\n// Size of one pixel == vec2(1.0 / u_image.width, 1.0 / u_image.height)\nuniform vec2 u_pixelDimension;\n\n// Range (-1.0 - 1.0)\nuniform float u_clarity;\n\nvarying vec2 v_texCoord;\n\nuniform mat4 u_colorMatrix;\nuniform vec4 u_colorOffset;\n\nconst float EPSILON = 0.000001;\n\nvec4 unpremultiply(vec4 col) {\n col.rgb /= max(col.a, EPSILON);\n return col;\n}\n\nvoid main() {\n vec4 color = texture2D(u_image, v_texCoord);\n color = unpremultiply(color);\n\n // L = Left, R = Right, C = Center, T = Top, B = Bottom\n vec4 colLB = texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x, -u_pixelDimension.y));\n vec4 colLC = texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x, 0.0));\n vec4 colLT = texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x, u_pixelDimension.y));\n\n vec4 colCL = texture2D(u_image, v_texCoord + vec2( 0.0, -u_pixelDimension.y));\n vec4 colCR = texture2D(u_image, v_texCoord + vec2( 0.0, u_pixelDimension.y));\n \n vec4 colRB = texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x, -u_pixelDimension.y));\n vec4 colRC = texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x, 0.0));\n vec4 colRT = texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x, u_pixelDimension.y));\n\n vec4 mergedColor = color;\n mergedColor.rgb += unpremultiply(colLB).rgb + unpremultiply(colLC).rgb + unpremultiply(colLT).rgb;\n mergedColor.rgb += unpremultiply(colCL).rgb + unpremultiply(colCR).rgb;\n mergedColor.rgb += unpremultiply(colRB).rgb + unpremultiply(colRC).rgb + unpremultiply(colRT).rgb;\n\n mergedColor /= 9.0;\n\n float grayValue = clamp(color.r * 0.3 + color.g * 0.59 + color.b * 0.1, 0.111111, 0.999999);\n // 1.0 and 0.0 result in white not black, therefore we clamp\n\n // Here we create a function that will map values below 0.1 to 0. Values above 0.2 will be mapped to 1,\n // and for values between 0.1 and 0.2 it will produce a gradient.\n // The funtion is mirror at 0.5, meaning values between 0.8 and 0.9 will result in a decending gradient.\n // And values above 0.9 will be mapped to 0.\n float frequenceFactor = min(smoothstep(1.0 - grayValue, 0.0, 0.11), smoothstep(grayValue, 0.0, 0.11));\n\n // here we apply the high pass filter. Its strength is determined by the uniform ,\n // and the frequence factor. That means the only the mid tones are affected by this filter.\n // Clarity input is ranging from -1 to 1. But we want to strengthen the effect.\n // Therefore we see this little magic number '3.7'.\n color.rgb = clamp(color + clamp((color - mergedColor) * u_clarity * 3.7 * frequenceFactor, 0.0, 10.0), 0.0, 1.0).rgb;\n\n // apply exposure but only to the mid tones.\n color.rgb = color.rgb * pow(2.0, u_clarity * 0.27 * frequenceFactor);\n\n // apply contrast and desaturation matrix\n color.rgb = clamp(color * u_colorMatrix + u_colorOffset, 0.0, 1.0).rgb;\n\n color.rgb *= color.a; // Premultiply alpha\n\n gl_FragColor = clamp(color, 0.0, 1.0);\n}\n";});var Lnt,znt,Tw,_z;var xz=d(function(){$();bz();Lnt=J.Vector2;znt=J.ColorMatrix;Tw=/*#__PURE__*/function(_L$Filter2){_inherits(Tw,_L$Filter2);var _super43=_createSuper(Tw);function Tw(){var _this83;_classCallCheck(this,Tw);_this83=_super43.call(this);_this83._fragmentSource=yz;return _this83;}_createClass(Tw,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=r.getContext();var s=e.getCanvas();var a=e.getContext();var l=this._options.clarity;var c=this._options.colorMatrix;var u=new G(this._options.colorOffset[0],this._options.colorOffset[1],this._options.colorOffset[2],this._options.colorOffset[3]);var m=s.width;var p=s.height;var h=a.getImageData(0,0,m,p);var g=n.createImageData(m,p);this.canvasShader(h,g,l,c,u);n.putImageData(g,0,0);}},{key:"canvasShader",value:function canvasShader(t,e,r,o,n){var s=function s(b,T,k){return Math.min(Math.max(b,T),k);};var a=function a(b,T,k){var E=s((k-b)/(T-b),0,1);return E*E*(3-2*E);};var l=t.width*4;var c=t.data.length;var u=c-1;var m=0;var p=t.data;var h=e.data;var g=new G();var x=255*9;var v=function v(b){b=bu?u:b;return p[b];};for(var b=0;b 0.0));\n vec4 sharpenedColor = mix(0.2, 5.0, float(u_sharpness > 0.0)) * color;\n \n sharpenedColor += factor * clamp(texture2D(u_image, v_texCoord + u_pixelDimension * vec2(-1.0, 0.0)), 0.0, 1.0);\n sharpenedColor += factor * clamp(texture2D(u_image, v_texCoord + u_pixelDimension * vec2( 0.0, -1.0)), 0.0, 1.0);\n sharpenedColor += factor * clamp(texture2D(u_image, v_texCoord + u_pixelDimension * vec2( 0.0, 1.0)), 0.0, 1.0);\n sharpenedColor += factor * clamp(texture2D(u_image, v_texCoord + u_pixelDimension * vec2( 1.0, 0.0)), 0.0, 1.0);\n \n color.rgb /= max(color.a, EPSILON); // unpremultiply\n sharpenedColor.rgb /= max(sharpenedColor.a, EPSILON); // unpremultiply\n \n sharpenedColor = clamp(sharpenedColor, 0.0, 1.0);\n \n color = clamp(mix(color, sharpenedColor, abs(u_sharpness)), 0.0, 1.0);\n \n gl_FragColor = vec4(color.rgb * color.a, color.a); // premultiply\n}";});var Nnt,kw,Sz;var wz=d(function(){$();vz();Nnt=J.Vector2;kw=/*#__PURE__*/function(_L$Filter3){_inherits(kw,_L$Filter3);var _super44=_createSuper(kw);function kw(){var _this84;_classCallCheck(this,kw);_this84=_super44.call(this);_this84._fragmentSource=Cz;return _this84;}_createClass(kw,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=r.getContext();var s=e.getCanvas();var a=e.getContext();var l=this._options.sharpness;var c=s.width;var u=s.height;var m=a.getImageData(0,0,c,u);var p=n.createImageData(c,u);this.canvasShader(m,p,l);n.putImageData(p,0,0);}},{key:"canvasShader",value:function canvasShader(t,e,r){var o=function o(E,A,I){return Math.min(Math.max(E,A),I);};var n=1e-6;var s=t.width;var a=t.height;var l=t.data;var c=e.data;var u=function u(E,A,I){return E*(1-I)+A*I;};var m=function m(E){return o(l[E]/255,0,1);};var p=function p(E,A){var I=o(E,0,s-1);var F=o(A,0,a-1);return 4*(I+s*F);};var h=[];var g=[];var x=[-1,0,0,1];var v=[0,-1,1,0];var b=r>0?-1:.2;var T=r>0?5:.2;var k=Math.abs(r);for(var E=0;E3&&arguments[3]!==undefined?arguments[3]:false;var n=r.getContext();var s=e.getCanvas();var a=e.getContext();var l=this._options.temperature;var c=s.width;var u=s.height;var m=a.getImageData(0,0,c,u);var p=n.createImageData(c,u);this.canvasShader(m,p,l);n.putImageData(p,0,0);}},{key:"canvasShader",value:function canvasShader(t,e,r){var o=function o(b,T,k){return Math.min(Math.max(b,T),k);};var n=function n(b,T,k){return b*(1-k)+T*k;};var s=function s(b,T){var k=b[0]*T[0]+b[3]*T[1]+b[6]*T[2];var E=b[1]*T[0]+b[4]*T[1]+b[7]*T[2];var A=b[2]*T[0]+b[5]*T[1]+b[8]*T[2];return[k,E,A];};var a=t.data.length;var l=a-1;var c=0;var u=t.data;var m=e.data;var p=function p(b){b=bl?l:b;return u[b];};var h=[.93,.54,0];var g=[.299,.587,.114,.596,-.274,-.322,.212,-.523,.311];var x=[1,.956,.621,1,-.272,-.647,1,-1.105,1.702];var v=0;for(var b=0;b0?this._options.contrast*2:this._options.contrast)+1));o.multiply(el.createBrightnessMatrix(this._options.brightness));this._filter.set({gamma:this._options.gamma,shadows:this._options.shadows,highlights:this._options.highlights,whites:this._options.whites,blacks:this._options.blacks,colorMatrix:o,colorOffset:o.getOffsets()});var n=[];if(this._options.clarity!==0){n.push(this._clarityFilter);}if(this._options.sharpness!==0){n.push(this._sharpnessFilter);}if(this._options.temperature!==0){n.push(this._temperatureFilter);}n.push(this._filter);this._sprite.setFilters(n);this._renderTexture.render(this._container);return Promise.resolve();}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(vh.prototype),"dispose",this).call(this);this._filter.dispose();this._clarityFilter.dispose();this._temperatureFilter.dispose();this._sharpnessFilter.dispose();}}]);return vh;}(Lt);vh.identifier="adjustments";vh.prototype.availableOptions={brightness:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},saturation:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},contrast:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},gamma:{type:"number","default":1,minValue:.5,midValue:1,maxValue:2},exposure:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},shadows:{type:"number","default":0,minValue:-2,midValue:0,maxValue:2},highlights:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},clarity:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},whites:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},blacks:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},temperature:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1},sharpness:{type:"number","default":0,minValue:-1,midValue:0,maxValue:1}};ft.Operations.AdjustmentsOperation=vh;Ez=vh;});var Rz;var Oz=d(function(){Rz="/*\n * Based on evanw's glfx.js tilt shift shader:\n * https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js\n * @license\n */\n\nuniform sampler2D u_image;\nuniform float u_blurRadius;\nuniform vec2 u_delta;\nuniform vec2 u_texSize;\nvarying vec2 v_texCoord;\n\nfloat random(vec2 co)\n{\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float dt = dot(co.xy,vec2(a,b));\n highp float sn = mod(dt, 3.14);\n return fract(sin(sn) * c);\n}\n\nvoid main() {\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n float offset = random(gl_FragCoord.xy / u_texSize.xy);\n float radius = u_blurRadius;\n\n const float steps = 30.0;\n\n for (float t = -steps; t <= steps; t++) {\n float percent = (t + offset - 0.5) / steps;\n float weight = 1.0 - abs(percent);\n\n // Somehow `sample` is a keyword in headless-gl\n vec4 _sample = texture2D(u_image, v_texCoord + u_delta * percent * radius / u_texSize);\n\n color += _sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n}\n";});var Yy,Dw,or;var zd=d(function(){$();Oz();Yy=J.Vector2;Dw=/*#__PURE__*/function(_L$Filter5){_inherits(Dw,_L$Filter5);var _super47=_createSuper(Dw);function Dw(){var _this87;_classCallCheck(this,Dw);for(var _len17=arguments.length,t=new Array(_len17),_key17=0;_key17<_len17;_key17++){t[_key17]=arguments[_key17];}_this87=_super47.call.apply(_super47,[this].concat(t));_this87._fragmentSource=Rz;_this87._lastBlurRadius=null;_this87._lastDimensions=new Yy(0,0);_this87._blurredRenderTarget=new L.CanvasRenderTarget(100,100,1);return _this87;}_createClass(Dw,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;if(this._options.blurQuality==="low"){this._renderLQBlur(t,e,r,o);return;}var s=e.getCanvas();var a=e.getContext();var l=r.getContext();if(this._lastBlurRadius===this._options.blurRadius){l.drawImage(s,0,0);}var c=a.getImageData(0,0,s.width,s.height);var u=l.getImageData(0,0,s.width,s.height);var m=this._options.blurRadius;var p=this._options.delta;var h=30;for(var g=0;g3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=r.getContext();var a=this._options.filteredCanvas;s.save();s.drawImage(n,0,0);s.globalAlpha=this._options.intensity;s.drawImage(a,0,0);s.restore();}}]);return Ew;}(L.Filter);Ew.prototype.availableOptions={filteredImage:{type:"number","default":1,uniformType:"i"},filteredCanvas:{type:"object","default":null},intensity:{type:"number","default":1,uniformType:"f"}};zz=/*#__PURE__*/function(){function zz(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;_classCallCheck(this,zz);this._intensity=t;this._stack=[];this._dirtiness={};this._renderTextures={};this._container=new L.Container();this._sprite=new L.Sprite();this._container.addChild(this._sprite);this._blendFilter=new Ew();}_createClass(zz,[{key:"push",value:function push(t){this._stack.push(t);}},{key:"clear",value:function clear(){this._stack=[];}},{key:"render",value:function render(t,e,r){if(this.isEmpty()){return Promise.resolve();}var o=t.getRenderer();this._sprite.setTexture(e);var n=this._renderTextures[o.id];if(!n){var l=t.getSprite().getTexture().getFrame();n=new L.RenderTexture(t.getRenderer(),l.width,l.height);this._renderTextures[o.id]=n;}var s=r.getDimensions();n.resizeTo(s);var a=this.isDirtyForRenderer(o);if(a){this._stack.forEach(function(c){c.update(t);});var _l2=this._stack.map(function(c){return c.getFilter();});this._sprite.setFilters(_l2);n.render(this._container);this.setDirtyForRenderer(false,o);}this._blendFilter.setIntensity(this._intensity);if(o.isOfType("canvas")){this._blendFilter.setFilteredCanvas(n.getRenderTarget().getCanvas());}else if(o.isOfType("webgl")){var _l3=n.getBaseTexture();_l3.setGLUnit(this._blendFilter.getFilteredImage());o.updateTexture(_l3,false);}this._sprite.setFilters([this._blendFilter]);r.clear(G.TRANSPARENT);r.render(this._container);if(a){this.disposeRenderTextures();}return Promise.resolve();}},{key:"setIntensity",value:function setIntensity(t){this._intensity=t;}},{key:"isEmpty",value:function isEmpty(){return this._stack.length===0;}},{key:"isDirtyForRenderer",value:function isDirtyForRenderer(t){if(!(t.id in this._dirtiness)){this._dirtiness[t.id]=true;}return this._dirtiness[t.id];}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e){this._dirtiness[e.id]=t;}},{key:"setDirty",value:function setDirty(t){for(var e in this._dirtiness){this._dirtiness[e]=t;}}},{key:"disposeRenderTextures",value:function disposeRenderTextures(){for(var t in this._renderTextures){this._renderTextures[t].dispose();delete this._renderTextures[t];}}},{key:"dispose",value:function dispose(){this.disposeRenderTextures();this._stack.forEach(function(t){return t.dispose();});this._stack=[];this._blendFilter.dispose();this._sprite.dispose();}}]);return zz;}();Fw=zz;});var Ud,dt;var Ht=d(function(){$();Uz();Ud=/*#__PURE__*/function(_t9){_inherits(Ud,_t9);var _super50=_createSuper(Ud);function Ud(){var _this90;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Ud);_this90=_super50.call(this,t,_objectSpread({intensity:{type:"number","default":1,setter:function setter(r){this._stack&&this._stack.setIntensity(r);return r;}},dirty:{type:"boolean","default":true}},e));_this90._stack=new Fw(_this90._options.intensity);return _this90;}_createClass(Ud,[{key:"render",value:function render(t,e,r){var _this91=this;return this._stack.render(t,e,r).then(function(o){_this91.setDirty(false);return o;});}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e){this._stack.setDirtyForRenderer(t,e);}},{key:"disposeRenderTextures",value:function disposeRenderTextures(){this._stack.disposeRenderTextures();}},{key:"dispose",value:function dispose(){this._stack.dispose();}}]);return Ud;}(_t);Ud.identifier=null;Ud.isIdentity=false;Ud.displayName=null;Ud.PrimitivesStack=Fw;dt=Ud;});var Hz;var Nz=d(function(){Hz="varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform float u_brightness;\n\nvoid main() {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor = vec4((texColor.rgb + vec3(u_brightness) * texColor.a), texColor.a);;\n}\n";});var Wz,ne;var ki=d(function(){$();Wz=/*#__PURE__*/function(_t10){_inherits(Wz,_t10);var _super51=_createSuper(Wz);function Wz(){_classCallCheck(this,Wz);return _super51.apply(this,arguments);}_createClass(Wz,[{key:"update",value:function update(){}},{key:"getFilter",value:function getFilter(){return this._filter;}},{key:"dispose",value:function dispose(){if(this._filter){this._filter.dispose();this._filter=null;}}}]);return Wz;}(_t);ne=Wz;});var Jy,Ow,fc;var Gz=d(function(){$();Nz();ki();Jy=/*#__PURE__*/function(_L$Filter7){_inherits(Jy,_L$Filter7);var _super52=_createSuper(Jy);function Jy(){var _this92;_classCallCheck(this,Jy);_this92=_super52.call(this);_this92._fragmentSource=Hz;return _this92;}_createClass(Jy,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.brightness;if(c===0){a.putImageData(l,0,0);return;}c*=255;for(var u=0;u3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.contrast;if(c===1){return;}for(var u=0;u3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.colorMatrix;var u=new G(0,0,0,0);for(var m=0;m3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=[.3,.59,.11];var u=this._options.desaturation;for(var m=0;m 0.0) {\n color.rgb = 1.0 - pow(1.0 - color.rgb, vec3(max(intensity + 1.0, EPSILON)));\n } else {\n color.rgb = pow(color.rgb, vec3(max(-intensity + 1.0, EPSILON)));\n }\n \n // Colorimetric (perceptual luminance-preserving) RGB to grayscale conversion\n // https://en.wikipedia.org/wiki/Grayscale#Colorimetric_(perceptual_luminance-preserving)_conversion_to_grayscale\n float luminance = dot(GRAYSCALE_WEIGHTS, color.rgb);\n \n // Apply DuoTone\n vec4 duotone = mix(dark, light, clamp(luminance, 0.0, 1.0));\n duotone.a *= color.a;\n \n duotone.rgb *= duotone.a;\n\n return duotone;\n}\n\nvoid main() {\n vec4 texColor = texture2D(u_image, v_texCoord);\n gl_FragColor = duotoneKernel(texColor, u_lightColor, u_darkColor, u_intensity);\n}';});var i_,Pw,r_;var e8=d(function(){$();Qz();ki();i_=/*#__PURE__*/function(_L$Filter11){_inherits(i_,_L$Filter11);var _super60=_createSuper(i_);function i_(){var _this100;_classCallCheck(this,i_);_this100=_super60.call(this);_this100._fragmentSource=t8;return _this100;}_createClass(i_,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var _this$_options6=this._options,c=_this$_options6.lightColor,u=_this$_options6.darkColor,m=_this$_options6.intensity;for(var p=0;p0){var c=Math.max(o+1,n);t.r=1-Math.pow(1-t.r,c);t.g=1-Math.pow(1-t.g,c);t.b=1-Math.pow(1-t.b,c);}else{var _c4=Math.max(-o+1,n);t.r=Math.pow(t.r,_c4);t.g=Math.pow(t.g,_c4);t.b=Math.pow(t.b,_c4);}var s=.2126*t.r+.7152*t.g+.0722*t.b;var a=Math.min(Math.max(s,0),1);var l=r.clone().mix(e,a);l.a*=t.a;return l;}}]);return i_;}(L.Filter);i_.prototype.availableOptions={lightColor:{type:"color","default":G.RED,uniformType:"4f"},darkColor:{type:"color","default":G.BLACK,uniformType:"4f"},intensity:{type:"number","default":.5,uniformType:"f"}};Pw=/*#__PURE__*/function(_ne6){_inherits(Pw,_ne6);var _super61=_createSuper(Pw);function Pw(){var _this101;_classCallCheck(this,Pw);for(var _len23=arguments.length,t=new Array(_len23),_key23=0;_key23<_len23;_key23++){t[_key23]=arguments[_key23];}_this101=_super61.call.apply(_super61,[this].concat(t));_this101._filter=new i_();return _this101;}_createClass(Pw,[{key:"update",value:function update(){this._filter.setLightColor(this._options.lightColor);this._filter.setDarkColor(this._options.darkColor);var t=2*this._options.intensity-1;this._filter.setIntensity(t);}}]);return Pw;}(ne);Pw.prototype.availableOptions=i_.prototype.availableOptions;r_=Pw;});var r8;var i8=d(function(){r8="varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform vec3 u_gamma;\n\nvoid main() {\n vec4 texColor = texture2D(u_image, v_texCoord);\n vec3 rgb = vec3(texColor.r, texColor.g, texColor.b);\n rgb = pow(rgb, u_gamma);\n gl_FragColor = vec4(rgb * texColor.a, texColor.a);;\n}\n";});var o_,Mw,n_;var o8=d(function(){$();i8();ki();o_=/*#__PURE__*/function(_L$Filter12){_inherits(o_,_L$Filter12);var _super62=_createSuper(o_);function o_(){var _this102;_classCallCheck(this,o_);_this102=_super62.call(this);_this102._fragmentSource=r8;return _this102;}_createClass(o_,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.gamma;var u=new Float32Array(256);for(var h=0;h<256;h++){u[h]=255*Math.pow(h/255,c.r);}var m=new Float32Array(256);for(var _h4=0;_h4<256;_h4++){m[_h4]=255*Math.pow(_h4/255,c.g);}var p=new Float32Array(256);for(var _h5=0;_h5<256;_h5++){p[_h5]=255*Math.pow(_h5/255,c.b);}for(var _h6=0;_h63&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.color;var u;for(var m=0;m3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);for(var c=0;c3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);for(var c=0;c3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.lookupTableData;for(var u=0;u3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=this._options.lookupTableImage;var c=this._createImageCanvas(l);var u=c.getContext("2d");var m=s.getImageData(0,0,n.width,n.height);var p=u.getImageData(0,0,l.width,l.height);var h=new S8();for(var g=0;g3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);var c=this._options.saturation;for(var u=0;u3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);for(var c=0;ca[0];});var e=this._getSplineCurve(t);var r=e[0];var o;if(r[0]>0){for(o=0;os[1]){l=-l;}n.push(l);}return n;}},{key:"_getSplineCurve",value:function _getSplineCurve(t){var e=this._secondDerivative(t);var r=e.length;var o=[];var n;for(n=0;n255){g=255;}else if(g<0){g=0;}s.push([c,g]);}}if(s.length===255){s.push(t[t.length-1]);}return s;}},{key:"_secondDerivative",value:function _secondDerivative(t){var e=t.length;if(e<=0||e===1){return null;}var r=[];var o=[];var n;var s;r[0]=[0,1,0];for(n=1;n0;n--){s=r[n][2]/r[n+1][1];r[n][1]-=s*r[n+1][0];r[n][2]=0;o[n]-=s*o[n+1];}var a=[];for(n=0;n3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=s.getImageData(0,0,n.width,n.height);for(var c=0;c3&&arguments[3]!==undefined?arguments[3]:false;var _this$_options7=this._options,n=_this$_options7.resolution,s=_this$_options7.horizontalTileCount,a=_this$_options7.verticalTileCount;var l=e.getCanvas();var c=e.getContext();var u=r.getContext();var m=this._options.lookupTableImage;var p=this._createImageCanvas(m);var h=p.getContext("2d");var g={width:128,height:128};if(n){g={width:n,height:n};}else if(m.width&&m.height){g={width:m.width,height:m.height};}var x=c.getImageData(0,0,l.width,l.height);var v=h.getImageData(0,0,g.width,g.height);var b=new N8(g.width/s-1|0,g.height/a-1|0,s*a-1|0);var T=new G();var k=new G();var E=new G();var A=new G();var I=new G();var F=new G();var Z=new G();var et=new G();var pt=new h_();var yt=new h_();var bt=function bt(St,fe,se,ee){St.r=fe.r*(1-ee)+se.r*ee;St.g=fe.g*(1-ee)+se.g*ee;St.b=fe.b*(1-ee)+se.b*ee;};var ht=function ht(St,fe,se){fe=.5+fe|0;se=.5+se|0;var ee=(se*g.width+fe)*4;St.r=v.data[ee]/255;St.g=v.data[ee+1]/255;St.b=v.data[ee+2]/255;St.a=v.data[ee+3]/255;};var Qt=new G();var gi=new G();var ii=function ii(St,fe,se,ee,Et,ae,ui){bt(Qt,fe,ee,ae);bt(gi,se,Et,ae);bt(St,Qt,gi,ui);};var Xr=new h_(g.width,g.height).divide(s,a).floor();for(var St=0;St2&&arguments[2]!==undefined?arguments[2]:0;var o=t.getDimensions();var n=this._layoutMode==="vertical-inside";var s=this._spriteGroups[e].start;var a=this._spriteGroups[e].mid;var l=this._spriteGroups[e].end;var c=0;var u=0;var m;var p;if(s){m=s.getTexture().getDimensions();p=m.y/m.x;c=Math.floor(this._frameWidth/p);var h=new Wd(0,r);h.x=n?this._frameWidth:0;s.setPosition(h);s.setHeight(this._frameWidth);s.setWidth(c);}if(l){m=l.getTexture().getDimensions();p=m.y/m.x;u=Math.floor(this._frameWidth*p);var _h7=new Wd(o.x-u,r);_h7.x-=n?this._frameWidth:0;l.setPosition(_h7);l.setHeight(this._frameWidth);l.setWidth(u);}if(a){m=a.getTexture().getDimensions();p=m.y/m.x;var _h8=new Wd(c,r);var g=o.x-c-u;if(n){_h8.x+=this._frameWidth;g-=this._frameWidth*2;}a.setPosition(_h8);a.setWidth(g);a.setHeight(this._frameWidth);if(false){a._canvasSmoothingEnabled=false;}if(this._options.frame.imageGroups[e].mid.mode==="repeat"){var x=this._frameWidth/p;var v=Math.ceil(g/x);var b=0;if(v!==-1){var T=Math.round(g/v);a.setWidth(T);b+=T;this._ensureRepeatSpritesExist(v-1,e,a);for(var k=0;ko){var n=t-o;for(var s=0;s2&&arguments[2]!==undefined?arguments[2]:0;var o=t.getDimensions();var n=this._layoutMode==="horizontal-inside";var s=this._spriteGroups[e].start;var a=this._spriteGroups[e].mid;var l=this._spriteGroups[e].end;var c=0;var u=0;var m;var p;if(s){m=s.getTexture().getDimensions();p=m.y/m.x;c=Math.floor(this._frameWidth*p);var h=new Wd(r,0);h.y=n?this._frameWidth:0;s.setPosition(h);s.setWidth(this._frameWidth);s.setHeight(c);}if(l){m=l.getTexture().getDimensions();p=m.y/m.x;u=Math.floor(this._frameWidth*p);var _h9=new Wd(r,o.y-u);_h9.y-=n?this._frameWidth:0;l.setPosition(_h9);l.setWidth(this._frameWidth);l.setHeight(u);}if(a){m=a.getTexture().getDimensions();p=m.y/m.x;var _h10=new Wd(r,c);var g=o.y-c-u;if(n){_h10.y+=this._frameWidth;g-=this._frameWidth*2;}a.setPosition(_h10);a.setHeight(g);a.setWidth(this._frameWidth);if(false){a._canvasSmoothingEnabled=false;}if(this._options.frame.imageGroups[e].mid.mode==="repeat"){var x=this._frameWidth*p;var v=Math.ceil(g/x);var b=0;if(v!==-1){var T=Math.round(g/v);a.setHeight(T);b+=T;this._ensureRepeatSpritesExist(v-1,e,a);for(var k=0;k 0.8) {\n gl_FragColor = mix(color, watermarkColor, 0.3);\n } else {\n gl_FragColor = color;\n }\n}\n";});var v_;var u9=d(function(){$();l9();v_=/*#__PURE__*/function(_L$Filter22){_inherits(v_,_L$Filter22);var _super119=_createSuper(v_);function v_(){var _this161;_classCallCheck(this,v_);for(var _len71=arguments.length,t=new Array(_len71),_key71=0;_key71<_len71;_key71++){t[_key71]=arguments[_key71];}_this161=_super119.call.apply(_super119,[this].concat(t));_this161._fragmentSource=c9;return _this161;}_createClass(v_,[{key:"_applyWebGL",value:function _applyWebGL(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=t.getContext();var s=n.canvas;var a=this.getShaderForRenderer(t);var l=e.getFrame();var c=this._watermarkCanvas;if(!c||l.width!==c.width||l.height!==c.height){this._createWatermarkCanvas(l.width,l.height);}var u=L.Texture.fromCanvas(this._watermarkCanvas);var m=u.getBaseTexture();t.updateTexture(m);m.setGLUnit(1);t.setRenderTarget(r);if(o){r.clear();}t.setShader(a);var p=t.getCurrentRenderTarget().getProjectionMatrix().toArray();a.setUniform("u_projMatrix",p);a.syncUniforms();n.uniform1i(n.getUniformLocation(a.getProgram(),"u_watermarkTex"),1);n.activeTexture(n.TEXTURE0);n.bindTexture(n.TEXTURE_2D,e.getTexture());n.activeTexture(n.TEXTURE1);n.bindTexture(n.TEXTURE_2D,m.getGLTextureForRenderer(t));n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0);u.dispose();}},{key:"_createWatermarkCanvas",value:function _createWatermarkCanvas(t,e){var r=this._options.watermarkImage;var o=z.createCanvas();o.width=t;o.height=e;var n=o.getContext("2d");var s=n.createPattern(r,"repeat");n.fillStyle=s;n.fillRect(0,0,o.width,o.height);this._watermarkCanvas=o;this._watermarkContext=n;}},{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var l=this._options.watermarkImage;this._createWatermarkCanvas(n.width,n.height);var c=s.getImageData(0,0,n.width,n.height);var u=this._watermarkContext.getImageData(0,0,n.width,n.height);var m=new G();var p=new G();var h=new G();for(var g=0;g.8){h.copy(m.clone().mix(p,.3));}else{h.copy(m);}c.data[g]=h.r*255;c.data[g+1]=h.g*255;c.data[g+2]=h.b*255;c.data[g+3]=h.a*255;}a.putImageData(c,0,0);}}]);return v_;}(L.Filter);v_.prototype.availableOptions={watermarkImage:{type:"object",required:true}};});var wh,d9;var m9=d(function(){$();a9();u9();wh=/*#__PURE__*/function(_Lt7){_inherits(wh,_Lt7);var _super120=_createSuper(wh);function wh(){var _this162;_classCallCheck(this,wh);for(var _len72=arguments.length,t=new Array(_len72),_key72=0;_key72<_len72;_key72++){t[_key72]=arguments[_key72];}_this162=_super120.call.apply(_super120,[this].concat(t));q(_assertThisInitialized(_this162),"_applyWatermarkFilter",function(){if(!_this162._watermarkFilter){_this162._watermarkFilter=new v_({watermarkImage:_this162._watermarkImage});}_this162._sprite.setFilters([_this162._watermarkFilter]);_this162._renderTexture.render(_this162._container);return Promise.resolve();});q(_assertThisInitialized(_this162),"_loadWatermarkImage",function(){if(!_this162._watermarkImage){return new Promise(function(t,e){_this162._watermarkImage=new Xi();_this162._watermarkImage.onload=t;_this162._watermarkImage.src=s9;});}return Promise.resolve();});_this162._watermarkFilter=null;_this162._watermarkImage=null;return _this162;}_createClass(wh,[{key:"_render",value:function _render(t){return this._loadWatermarkImage().then(this._applyWatermarkFilter);}},{key:"dispose",value:function dispose(){if(this._watermarkFilter){this._watermarkFilter.dispose();}_get(_getPrototypeOf(wh.prototype),"dispose",this).call(this);}}]);return wh;}(Lt);wh.identifier="license-watermark";wh.prototype.availableOptions={};ft.Operations.LicenseWatermarkOperation=wh;d9=wh;});var h9;var p9=d(function(){h9="/*!\n * Based on evanw's glfx.js tilt shift shader:\n * https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js\n */\n\nuniform sampler2D u_image;\nuniform float u_blurRadius;\nuniform vec2 u_controlPoint1;\nuniform vec2 u_controlPoint2;\nuniform vec2 u_delta;\nuniform vec2 u_texSize;\nvarying vec2 v_texCoord;\n\nfloat random(vec2 co)\n{\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float dt = dot(co.xy,vec2(a,b));\n highp float sn = mod(dt, 3.14);\n return fract(sin(sn) * c);\n}\n\nvoid main() {\n vec4 color = vec4(0.0);\n float total = 0.0;\n\n vec2 vector = u_controlPoint2 - u_controlPoint1;\n float offset = random(gl_FragCoord.xy / u_texSize.xy);\n\n float radius = smoothstep(0.0, 1.0,\n abs(\n clamp(dot(v_texCoord - u_controlPoint1, vector) / dot(vector, vector), 0.0, 1.0)\n )\n ) * u_blurRadius;\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 _sample = texture2D(u_image, v_texCoord + u_delta * percent * radius / u_texSize);\n\n color += _sample * weight;\n total += weight;\n }\n\n gl_FragColor = color / total;\n}\n";});var Hs,wT,C_;var f9=d(function(){$();zd();p9();Hs=J.Vector2;wT=/*#__PURE__*/function(_L$Filter23){_inherits(wT,_L$Filter23);var _super121=_createSuper(wT);function wT(){var _this163;_classCallCheck(this,wT);for(var _len73=arguments.length,t=new Array(_len73),_key73=0;_key73<_len73;_key73++){t[_key73]=arguments[_key73];}_this163=_super121.call.apply(_super121,[this].concat(t));_this163._fragmentSource=h9;_this163._lastBlurRadius=null;_this163._lastControlPoint1=new Hs();_this163._lastControlPoint2=new Hs();_this163._blurFilter=new or();_this163._blurredRenderTarget=new L.CanvasRenderTarget(100,100,1);_this163._maskRenderTarget=new L.CanvasRenderTarget(100,100,1);return _this163;}_createClass(wT,[{key:"_applyCanvas",value:function _applyCanvas(t,e,r){var _this164=this;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(this._options.blurQuality==="low"){this._renderLQBlur(t,e,r,o);return;}var n=e.getDimensions();var s=!r.getDimensions().equals(n);var a=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){var l=new Hs(this._options.delta.x,this._options.delta.y);this._blurFilter.setDelta(l);var c={blurRadius:this._options.blurRadius,texSize:n};var u=function u(x,v,b){return Math.min(Math.max(x,v),b);};var m=function m(x,v,b){var T=u((b-x)/(v-x),0,1);return T*T*(3-2*T);};var p=this._options.controlPoint2.clone().subtract(this._options.controlPoint1.clone());var h=this._options.blurRadius;var g=function g(x,v){return m(0,1,Math.abs(u(new Hs(x,v).subtract(_this164._options.controlPoint1).dot(p)/p.dot(p),0,1)))*h;};this._blurFilter.set(c);this._blurFilter._applyCanvas(t,e,r,o,g);this._lastBlurRadius=this._options.blurRadius;}}},{key:"_renderLQBlur",value:function _renderLQBlur(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getDimensions();var s=!this._blurredRenderTarget.getDimensions().equals(n);this._blurredRenderTarget.setPixelRatio(e.getPixelRatio());this._blurredRenderTarget.resizeTo(e.getDimensions());this._maskRenderTarget.setPixelRatio(e.getPixelRatio());this._maskRenderTarget.resizeTo(e.getDimensions());var a=!this._lastControlPoint1.equals(this._options.controlPoint1)||!this._lastControlPoint2.equals(this._options.controlPoint2)||s;var l=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){this._renderMask();this._lastControlPoint1=this._options.controlPoint1.clone();this._lastControlPoint2=this._options.controlPoint2.clone();}if(l){this._blurImage(e,this._blurredRenderTarget,this._options.blurRadius);this._lastBlurRadius=this._options.blurRadius;}this._applyMask(e,r);}},{key:"_renderMask",value:function _renderMask(){var t=this._maskRenderTarget.getCanvas();var e=this._maskRenderTarget.getContext();var r=new Hs(t.width,t.height);var o=this._options.controlPoint1.clone().multiply(r);var n=this._options.controlPoint2.clone().multiply(r);var s=e.createLinearGradient(o.x,o.y,n.x,n.y);s.addColorStop(0,"#FFFFFF");s.addColorStop(1,"#000000");e.fillStyle=s;e.fillRect(0,0,t.width,t.height);}},{key:"_applyMask",value:function _applyMask(t,e){var r=e.getContext();var o=t.getCanvas();var n=t.getContext();var s=this._blurredRenderTarget.getContext();var a=this._maskRenderTarget.getContext();var l=n.getImageData(0,0,o.width,o.height);var c=l.data;var u=s.getImageData(0,0,o.width,o.height).data;var m=a.getImageData(0,0,o.width,o.height).data;var p;for(var h=0;h3&&arguments[3]!==undefined?arguments[3]:false;if(this._options.blurQuality==="low"){this._renderLQBlur(t,e,r,o);return;}var n=e.getDimensions();var s=!r.getDimensions().equals(n);var a=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){var l=new Ws(this._options.delta.x,this._options.delta.y);this._blurFilter.setDelta(l);var c={blurRadius:this._options.blurRadius,texSize:n};var u=function u(E,A,I){return Math.min(Math.max(E,A),I);};var m=function m(E,A,I){var F=u((I-E)/(A-E),0,1);return F*F*(3-2*F);};var _this$_options12=this._options,p=_this$_options12.blurRadius,h=_this$_options12.gradientSize,g=_this$_options12.size,x=_this$_options12.start,v=_this$_options12.end,b=_this$_options12.texSize;var T=new Ws(x.y-v.y,v.x-x.x);T.divide(T.len());var k=function k(E,A){return m(0,1,(Math.abs(b.clone().multiply(E,A).subtract(x).dot(T))-g)/h)*p;};this._blurFilter.set(c);this._blurFilter._applyCanvas(t,e,r,o,k);this._lastBlurRadius=this._options.blurRadius;}}},{key:"_renderLQBlur",value:function _renderLQBlur(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getDimensions();var s=!this._blurredRenderTarget.getDimensions().equals(n);this._blurredRenderTarget.setPixelRatio(e.getPixelRatio());this._blurredRenderTarget.resizeTo(e.getDimensions());this._maskRenderTarget.setPixelRatio(e.getPixelRatio());this._maskRenderTarget.resizeTo(e.getDimensions());var a=!this._lastStart.equals(this._options.start)||!this._lastEnd.equals(this._options.end)||this._lastGradientRadius!==this._options.size||s;var l=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){this._renderMask();this._lastStart=this._options.start.clone();this._lastEnd=this._options.end.clone();this._lastGradientRadius=this._options.size;}if(l){this._blurImage(e,this._blurredRenderTarget,this._options.blurRadius);this._lastBlurRadius=this._options.blurRadius;}this._applyMask(e,r);}},{key:"_renderMask",value:function _renderMask(){var t=this._maskRenderTarget.getCanvas();var e=this._maskRenderTarget.getContext();var r=this._maskRenderTarget.getPixelRatio();var o=new Ws(t.width,t.height);var n=this._options.size*o.min()*r;var s=this._options.gradientSize*o.min()*r;var a=this._options.start.clone().multiply(o);var l=this._options.end.clone().multiply(o);var c=l.clone().subtract(a);var u=a.clone().add(c.clone().divide(2));var m=c.len();var p=c.clone().divide(m);var h=u.clone().add((n+s)*p.y,-(n+s)*p.x);var g=u.clone().add(-(n+s)*p.y,(n+s)*p.x);var x=e.createLinearGradient(h.x,h.y,g.x,g.y);var v=g.clone().subtract(h).len();x.addColorStop(0,"#000000");x.addColorStop(s/2/v,"#FFFFFF");x.addColorStop(1-s/2/v,"#FFFFFF");x.addColorStop(1,"#000000");e.fillStyle=x;e.fillRect(0,0,t.width,t.height);}},{key:"_applyMask",value:function _applyMask(t,e){var r=e.getContext();var o=t.getCanvas();var n=t.getContext();var s=this._blurredRenderTarget.getContext();var a=this._maskRenderTarget.getContext();var l=n.getImageData(0,0,o.width,o.height);var c=l.data;var u=s.getImageData(0,0,o.width,o.height).data;var m=a.getImageData(0,0,o.width,o.height).data;var p;for(var h=0;h3&&arguments[3]!==undefined?arguments[3]:false;if(this._options.blurQuality==="low"){this._renderLQBlur(t,e,r,o);return;}var n=e.getDimensions();var s=!r.getDimensions().equals(n);var _this$_options18=this._options,a=_this$_options18.blurRadius,l=_this$_options18.position,c=_this$_options18.texSize,u=_this$_options18.gradientRadius;var m=e.getBaseTexture().isDirty()||this._lastBlurRadius!==a||s;if(m){var p=new jd(this._options.delta.x,this._options.delta.y);this._blurFilter.setDelta(p);var h={blurRadius:a,texSize:n};var g=function g(b,T,k){return Math.min(Math.max(b,T),k);};var x=function x(b,T,k){var E=g((k-b)/(T-b),0,1);return E*E*(3-2*E);};var v=function v(b,T){return x(0,1,(Math.abs(c.clone().multiply(b,T).subtract(l).len())-_this173._options.radius)/(u*2))*a;};this._blurFilter.set(h);this._blurFilter._applyCanvas(t,e,r,o,v);this._lastBlurRadius=a;}}},{key:"_renderLQBlur",value:function _renderLQBlur(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getDimensions();var s=!this._blurredRenderTarget.getDimensions().equals(n);this._blurredRenderTarget.setPixelRatio(e.getPixelRatio());this._blurredRenderTarget.resizeTo(e.getDimensions());this._maskRenderTarget.setPixelRatio(e.getPixelRatio());this._maskRenderTarget.resizeTo(e.getDimensions());var a=!this._lastPosition.equals(this._options.position)||this._lastGradientRadius!==this._options.gradientRadius||s;var l=e.getBaseTexture().isDirty()||this._lastBlurRadius!==this._options.blurRadius||s;if(a){this._renderMask();this._lastPosition=this._options.position.clone();this._lastGradientRadius=this._options.gradientRadius;}if(l){this._blurImage(e,this._blurredRenderTarget,this._options.blurRadius);this._lastBlurRadius=this._options.blurRadius;}this._applyMask(e,r);}},{key:"_renderMask",value:function _renderMask(){var t=this._maskRenderTarget.getCanvas();var e=this._maskRenderTarget.getContext();var r=new jd(t.width,t.height);var o=this._maskRenderTarget.getPixelRatio();var n=this._options.position.clone().multiply(r);var _this$_options19=this._options,s=_this$_options19.radius,a=_this$_options19.gradientRadius;s*=t.height;a*=t.height;var l=e.createRadialGradient(n.x,n.y,0,n.x,n.y,(s+a)*o);l.addColorStop(0,"#FFFFFF");l.addColorStop(s/(s+a),"#FFFFFF");l.addColorStop(1,"#000000");e.fillStyle=l;e.fillRect(0,0,r.x,r.y);}},{key:"_applyMask",value:function _applyMask(t,e){var r=e.getContext();var o=t.getCanvas();var n=t.getContext();var s=this._blurredRenderTarget.getContext();var a=this._maskRenderTarget.getContext();var l=n.getImageData(0,0,o.width,o.height);var c=l.data;var u=s.getImageData(0,0,o.width,o.height).data;var m=a.getImageData(0,0,o.width,o.height).data;var p;for(var h=0;h3&&arguments[3]!==undefined?arguments[3]:false;var n=e.getCanvas();var s=e.getContext();var a=r.getContext();var _this$_options22=this._options,l=_this$_options22.maskCanvas,c=_this$_options22.filterCanvas;var u=l.getContext("2d");var m=c.getContext("2d");var p=u.getImageData(0,0,n.width,n.height).data;var h=s.getImageData(0,0,n.width,n.height);var g=h.data;var x=m.getImageData(0,0,n.width,n.height).data;var v;for(var b=0;b1&&arguments[1]!==undefined?arguments[1]:new E_(100,100);if(!this._renderTextures[t.id]){this._renderTextures[t.id]=new L.RenderTexture(t,e.x,e.y,1);}return this._renderTextures[t.id];}},{key:"dispose",value:function dispose(){this._isDisposed=true;for(var t in this._renderTextures){this._renderTextures[t].dispose();}}},{key:"canBeDuplicated",value:function canBeDuplicated(){return true;}},{key:"canBeDeleted",value:function canBeDeleted(){return true;}},{key:"canMaskCanvas",value:function canMaskCanvas(){return false;}},{key:"canAdjustPadding",value:function canAdjustPadding(){return false;}},{key:"canBeTakenToFront",value:function canBeTakenToFront(){return true;}},{key:"canBeFlippedHorizontally",value:function canBeFlippedHorizontally(){return true;}}]);return U9;}(_t);On=U9;});var hst,rl;var ET=d(function(){$();hst=J.Vector2;rl=/*#__PURE__*/function(_t12){_inherits(rl,_t12);var _super132=_createSuper(rl);function rl(){var _this179;_classCallCheck(this,rl);for(var _len81=arguments.length,t=new Array(_len81),_key81=0;_key81<_len81;_key81++){t[_key81]=arguments[_key81];}_this179=_super132.call.apply(_super132,[this].concat(t));_this179._lastOptions={};_this179._lastInputDimensions=new hst(0,0);_this179._brush=null;return _this179;}_createClass(rl,[{key:"getBrushImage",value:function getBrushImage(t){if(this._brush&&this.optionsEqual(this._lastOptions)&&t.equals(this._lastInputDimensions)){return this._brush;}var _this$_options23=this._options,e=_this$_options23.image,r=_this$_options23.size;e.width=e.height=Math.ceil(r*t.min());var o=z.createCanvas();o.width=e.width;o.height=e.height;var n=o.getContext("2d");n.drawImage(e,0,0,o.width,o.height);var s=this._tintImageData(n.getImageData(0,0,o.width,o.height),o.width,o.height);n.putImageData(s,0,0);this._lastOptions=this.serializeOptions(["size","color"]);this._brush=o;this._lastInputDimensions=t.clone();return o;}},{key:"_tintImageData",value:function _tintImageData(t){var e=this._options.color;for(var r=0;r2&&arguments[2]!==undefined?arguments[2]:3;_classCallCheck(this,H9);this._path=t;this._drawnCanvases=[];this._position=e;this._smooth=r;}_createClass(H9,[{key:"getBezierCurve",value:function getBezierCurve(t,e,r,o){if(!e){return null;}var n;var s;if(!o){n=(r.x-e.x)/this._smooth;s=(r.y-e.y)/this._smooth;}else{n=(o.x-e.x)/this._smooth;s=(o.y-e.y)/this._smooth;}var a;var l;if(!t){a=(r.x-e.x)/this._smooth;l=(r.y-e.y)/this._smooth;}else{a=(r.x-t.x)/this._smooth;l=(r.y-t.y)/this._smooth;}var c=e.clone().add(a,l);var u=r.clone().subtract(n,s);return new gst(e,c,u,r);}},{key:"renderToCanvas",value:function renderToCanvas(t,e,r,o,n){var s=arguments.length>5&&arguments[5]!==undefined?arguments[5]:1;if(this._drawnCanvases.indexOf(e)!==-1){return;}var a=new fst(e.width,e.height);var l=e.getContext("2d");var c=this._position.clone().multiply(a);var u=o?o.getPosition().clone().multiply(a):null;var m=r?r.getPosition().clone().multiply(a):null;var p=n?n.getPosition().clone().multiply(a):null;var h=c.clone().subtract(u).len();var g=t.width/10;var x=this.getBezierCurve(m,u,c,p);var v;if(!x){v=[c];}else{x.calculateSegments(20);var b=x.getLength();v=x.arcLengthApproxSample(Math.ceil(b/g));}for(var _b4=0;_b41&&arguments[1]!==undefined?arguments[1]:false;if(t==="controlPoints"){return this._options.controlPoints.map(function(r){var o=r.getPosition();return e?o.toObject():o.clone();});}return _get(_getPrototypeOf(FT.prototype),"serializeOption",this).call(this,t,e);}},{key:"_optionEquals",value:function _optionEquals(t,e){if(t==="controlPoints"){var r=this._options.controlPoints;for(var o=0,n=r.length;o1&&arguments[1]!==undefined?arguments[1]:false;var r=_get(_getPrototypeOf(bc.prototype),"serializeOptions",this).call(this,t,e);if(!t)r.type="brush";return r;}},{key:"serializeOption",value:function serializeOption(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t==="paths"){return this._options.paths.map(function(r){return r.serializeOptions(void 0,e);});}return _get(_getPrototypeOf(bc.prototype),"serializeOption",this).call(this,t,e);}},{key:"createPath",value:function createPath(t){var e=new Fh(this._operation,{brush:t},this._nextCanvas);e.on("update",this._onPathUpdate);this._options.paths.push(e);this.setDirty(true);return e;}},{key:"_onPathUpdate",value:function _onPathUpdate(){this._operation.setDirty(true);this.setDirty(true);}},{key:"_onPathPersist",value:function _onPathPersist(t){t.renderToCanvas(this._persistCanvas);this._nextCanvas=t.getCanvas();var e=this._nextCanvas.getContext("2d");e.clearRect(0,0,this._nextCanvas.width,this._nextCanvas.height);this._persistedPaths.push(t);}},{key:"_getTexture",value:function _getTexture(){return this._texture;}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;_get(_getPrototypeOf(bc.prototype),"setDirtyForRenderer",this).call(this,t,e,r);if(t&&r){this._persistedPaths=[];this.clearPersistCanvas();this._options.paths.forEach(function(o){o.setDirty(true);});}}},{key:"setDirty",value:function setDirty(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;for(var r in this._dirtiness){this.setDirtyForRenderer(t,this._renderers[r],e);}}},{key:"render",value:function render(t){var _this182=this;var e=this._operation.getSDK().getRenderer();if(!this.isDirtyForRenderer(e)){return;}z.ensureCanvasDimensions(this._outputCanvas,t);z.ensureCanvasDimensions(this._persistCanvas,t);this._options.paths.forEach(function(r){r.render(t);if(r.getClosed()&&_this182._persistedPaths.indexOf(r)===-1){_this182._onPathPersist(r);}});this.clearCanvas();this._outputContext.drawImage(this._persistCanvas,0,0);this._options.paths.forEach(function(r){if(!r.getClosed()){r.renderToCanvas(_this182._outputCanvas);}});this.setDirtyForRenderer(false,e);}},{key:"update",value:function update(t,e){if(e){z.ensureCanvasDimensions(this._outputCanvas,e);z.ensureCanvasDimensions(this._persistCanvas,e);this._texture.getBaseTexture().update();}this.render(e);var r=t.getRenderer();if(r.isOfType("webgl")){r.updateTexture(this._texture.getBaseTexture());}_get(_getPrototypeOf(bc.prototype),"update",this).call(this,t,e);}},{key:"_reset",value:function _reset(){this._persistedPaths=[];if(this._operation){this._operation.setDirty(true);}this.setDirty(true);this.clearCanvas();this.clearPersistCanvas();}},{key:"getCanvas",value:function getCanvas(){return this._outputCanvas;}},{key:"_createRadialBrush",value:function _createRadialBrush(){return new gc();}},{key:"_getTempCanvas",value:function _getTempCanvas(){return this._nextCanvas;}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(bc.prototype),"dispose",this).call(this);this._texture&&this._texture.getBaseTexture().dispose();}}]);return bc;}(On);bc.prototype.availableOptions={id:{type:"string","default":function _default(){return z.getUUID();}},position:{type:"vector2","default":new F_(0,0)},scale:{type:"vector2","default":new F_(1,1)},anchor:{type:"vector2","default":new F_(0,0)},pivot:{type:"vector2","default":new F_(0,0)},rotation:{type:"number","default":0},paths:{type:"array","default":[],setter:function setter(i){var _this183=this;i=i.map(function(t){if(t instanceof Fh)return t;var e=t.brush,r=t.closed;var o=new Fh(_this183._operation,{brush:e,closed:r},_this183._nextCanvas);t.controlPoints.forEach(function(n){o.addControlPoint(n);});return o;});this._reset();return i;}}};bc.type="brush";bc.Brush=rl;bc.Path=Fh;bc.Brushes={RadialBrush:gc};yc=bc;});var j9,Oh,$9;var K9=d(function(){$();zd();z9();OT();j9=J.Vector2;Oh=/*#__PURE__*/function(_Lt14){_inherits(Oh,_Lt14);var _super136=_createSuper(Oh);function Oh(){var _this184;_classCallCheck(this,Oh);for(var _len83=arguments.length,t=new Array(_len83),_key83=0;_key83<_len83;_key83++){t[_key83]=arguments[_key83];}_this184=_super136.call.apply(_super136,[this].concat(t));var e=_this184._sdk.getRenderer();_this184._lastBlurRadius=null;_this184._blurredRenderTexture=new L.RenderTexture(e,100,100,1);_this184._maskRenderTexture=new L.RenderTexture(e,100,100,1);_this184._brushSprite=new yc(_assertThisInitialized(_this184));_this184._brushSpriteContainer=new L.Container();var r=_this184._brushSprite.getDisplayObject();_this184._brushSpriteContainer.addChild(r);_this184._outputSprite=new L.Sprite();_this184._outputContainer=new L.Container();_this184._outputContainer.addChild(_this184._outputSprite);_this184._maskFilter=new L9();if(e.isOfType("webgl")){_this184._horizontalFilter=new or();_this184._verticalFilter=new or();_this184._sprite.setFilters([_this184._horizontalFilter,_this184._verticalFilter]);_this184._horizontalFilter.setDelta(new j9(1,1));_this184._verticalFilter.setDelta(new j9(-1,1));var o=_this184._maskRenderTexture.getBaseTexture();o.setGLUnit(_this184._maskFilter.getMaskImage());e.updateTexture(o,false);o=_this184._blurredRenderTexture.getBaseTexture();o.setGLUnit(_this184._maskFilter.getFilterImage());e.updateTexture(o,false);}else if(e.isOfType("canvas")){_this184._blurFilter=new or();_this184._sprite.setFilters([_this184._blurFilter]);_this184._maskFilter.setMaskCanvas(_this184._maskRenderTexture.getRenderTarget().getCanvas());_this184._maskFilter.setFilterCanvas(_this184._blurredRenderTexture.getRenderTarget().getCanvas());}_this184._outputSprite.setFilters([_this184._maskFilter]);return _this184;}_createClass(Oh,[{key:"flip",value:function flip(t){this._brushSprite.applyFlip(t);this.setDirty(true,true);this._lastBlurRadius=null;}},{key:"rotate",value:function rotate(t){this._brushSprite.applyRotation(t);this.setDirty(true,true);this._lastBlurRadius=null;}},{key:"transform",value:function transform(t,e){this._brushSprite.applyTransform(t,e);this.setDirty(true,true);this._lastBlurRadius=null;}},{key:"_render",value:function _render(t){this._renderBlur(t);this._renderMask(t);this._outputSprite.setTexture(t);this._renderTexture.render(this._outputContainer);return Promise.resolve();}},{key:"_renderMask",value:function _renderMask(t){var e=t.getDimensions();var r=this._maskRenderTexture.getDimensions();if(!r.equals(e)){this._maskRenderTexture.resizeTo(e);}this._brushSprite.update(this._sdk,e);this._maskRenderTexture.clear(G.BLACK);this._maskRenderTexture.render(this._brushSpriteContainer);var o=this._sdk.getRenderer();if(o.isOfType("webgl")){o.updateTexture(this._maskRenderTexture.getBaseTexture(),false);}}},{key:"_renderBlur",value:function _renderBlur(t){var e=t.getDimensions();var r=this._blurredRenderTexture.getDimensions();if(!r.equals(e)){this._blurredRenderTexture.resizeTo(e);}var o=this._options.blurRadius;if(this._lastBlurRadius!==o||!r.equals(e)){var s=this._sdk.getRenderer();var a;if(s.isOfType("webgl")){var l=e.min();a={blurRadius:o*l,texSize:e};this._horizontalFilter.set(a);this._verticalFilter.set(a);}else if(s.isOfType("canvas")){a={blurRadius:o};this._blurFilter.set(a);}this._blurredRenderTexture.render(this._container);this._lastBlurRadius=o;}var n=this._sdk.getRenderer();if(n.isOfType("webgl")){n.updateTexture(this._blurredRenderTexture.getBaseTexture(),false);}}},{key:"getBrush",value:function getBrush(){return this._brushSprite;}},{key:"createPath",value:function createPath(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;var r=new yc.Brushes.RadialBrush({size:t,hardness:e,color:G.WHITE});var o=this._brushSprite.createPath(r);this._options.paths.push(o);this.setDirty(true);return o;}},{key:"setDirtyForRenderer",value:function setDirtyForRenderer(t,e,r){_get(_getPrototypeOf(Oh.prototype),"setDirtyForRenderer",this).call(this,t,e,r);this._brushSprite.setDirtyForRenderer(t,e,r);}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(Oh.prototype),"dispose",this).call(this);var t=this._sdk.getRenderer();if(t.isOfType("webgl")){this._verticalFilter.dispose();this._horizontalFilter.dispose();}else{this._blurFilter.dispose();}this._brushSprite.dispose();this._maskFilter.dispose();this._blurredRenderTexture.dispose();this._maskRenderTexture.dispose();}},{key:"hasChanges",value:function hasChanges(){return true;}}]);return Oh;}(Lt);Oh.identifier="selective-blur";Oh.prototype.availableOptions={blurRadius:{type:"number","default":.05},paths:{type:"array","default":[],setter:function setter(i){if(this._brushSprite){this._brushSprite.setPaths(i);}return i;}}};ft.Operations.SelectiveBlurOperation=Oh;$9=Oh;});var _c,O_,R_,A_;var X9=d(function(){$();ww();$d();_c=J.Vector2;O_=J.ColorMatrix;R_=/*#__PURE__*/function(_On2){_inherits(R_,_On2);var _super137=_createSuper(R_);function R_(){var _this185;_classCallCheck(this,R_);for(var _len84=arguments.length,t=new Array(_len84),_key84=0;_key84<_len84;_key84++){t[_key84]=arguments[_key84];}_this185=_super137.call.apply(_super137,[this].concat(t));var e=_this185._options.image;var r=e.src||e.filePath||e.toDataUrl&&e.toDataURL();_this185._isSVG=r&&(!!r.match(/\w+\.svg(?=\?|$)/i)||r.match(/data:image\/svg/i));if(_this185._isSVG){_this185._canvas=z.createCanvas();_this185._context=_this185._canvas.getContext("2d");_this185._options.smoothDownscaling=false;}if(e){_this185._onImageUpdate();}_this185._tintFilter=new L.Filters.TintFilter();_this185._adjustmentsFilter=new qy();_this185._lastRenderedDimensions=_c.NULL;_this185._lastRenderedInputDimensions=_c.NULL;_this185._onOptionsChange=_this185._onOptionsChange.bind(_assertThisInitialized(_this185));_this185._options.adjustments.on("update",_this185._onOptionsChange);return _this185;}_createClass(R_,[{key:"applyScale",value:function applyScale(t){this.setDimensions(this.getDimensions().multiply(t));}},{key:"serializeOptions",value:function serializeOptions(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=_get(_getPrototypeOf(R_.prototype),"serializeOptions",this).call(this,t,e);if(!t)r.type="sticker";return r;}},{key:"_rendersToRenderTexture",value:function _rendersToRenderTexture(t){var e=this._options.smoothDownscaling&&!this._isSVG&&t.getRenderer().isOfType("webgl");return e||this._hasAdjustments()||this._options.tintMode!=="none";}},{key:"_getTexture",value:function _getTexture(){return this._inputTexture;}},{key:"update",value:function update(t,e){var _this$_options27=this._options,r=_this$_options27.dimensions,o=_this$_options27.image;if(r.equals(_c.NULL)){r.set(o.width,o.height);}this._sprite.setSmoothDownscaling(this._isSVG?false:this.getSmoothDownscaling());var n=!this._lastRenderedInputDimensions.equals(e)||!this._lastRenderedDimensions.equals(r)||this._lastRenderedImage!==o;if(n&&this._isSVG&&t.getRenderer().isOfType("webgl")){o.width=Math.round(r.x);o.height=Math.round(r.y);var a=4096;var l=o.width/o.height;if(o.width>a){o.width=a;o.height=Math.round(o.width/l);}if(o.height>a){o.height=a;o.width=Math.round(o.height*l);}this._canvas.width=o.width;this._canvas.height=o.height;this._context.clearRect(0,0,o.width,o.height);this._context.drawImage(o,0,0,o.width,o.height);this._inputTexture.getBaseTexture().update();}if(this._rendersToRenderTexture(t)){this._prepareRenderTexture(t);}var s=[];if(this._rendersToRenderTexture(t)){if(this._hasAdjustments()){s.push(this._adjustmentsFilter);var _a3=this._options.adjustments;var _l4=new O_();_l4.multiply(O_.createBrightnessMatrix(_a3.getBrightness()));_l4.multiply(O_.createSaturationMatrix(_a3.getSaturation()));_l4.multiply(O_.createContrastMatrix(_a3.getContrast()));this._adjustmentsFilter.set({colorMatrix:_l4});}if(this._options.tintMode&&this._options.tintMode!=="none"){s.push(this._tintFilter);this._tintFilter.set({mode:L.Filters.TintFilter.MODES[this._options.tintMode.toUpperCase()],color:this._options.tintColor});if(this._sprite.getTexture()&&this._sprite.getTexture()._baseTexture){this._sprite.getTexture()._baseTexture.setDirty(true);}}this._renderTextureSprite.setFilters(s);}if(this._rendersToRenderTexture(t)){this._renderToRenderTexture(t);}else{this._sprite.setTexture(this._inputTexture);}this._updateSprite(e);this._applyFlip();this._lastRenderedDimensions.copy(r);this._lastRenderedInputDimensions.copy(e);this._lastRenderedImage=o;}},{key:"_applyFlip",value:function _applyFlip(){var t=this._sprite.getScale();var _this$_options28=this._options,e=_this$_options28.flipHorizontally,r=_this$_options28.flipVertically;if(e&&t.x>0||!e&&t.x<0){t.x*=-1;}if(r&&t.y>0||!r&&t.y<0){t.y*=-1;}this._sprite.setScale(t);}},{key:"applyFlip",value:function applyFlip(t){_get(_getPrototypeOf(R_.prototype),"applyFlip",this).call(this,t);var e={rotation:this._options.rotation};var r=e.rotation/Math.PI*180;var o=r*-1;e.rotation=o*Math.PI/180;switch(t){case"horizontal":e.flipHorizontally=!this._options.flipHorizontally;this.set(e);break;case"vertical":e.flipVertically=!this._options.flipVertically;this.set(e);break;}}},{key:"_hasAdjustments",value:function _hasAdjustments(){var t=this._options.adjustments;return t.getBrightness()!==0||t.getSaturation()!==1||t.getContrast()!==1;}},{key:"_onImageUpdate",value:function _onImageUpdate(){var t=this._options.image;var e=this._operation.getSDK().getRenderer();if(this._isSVG&&e.isOfType("webgl")){t=this._canvas;}if(this._inputTexture){this._inputTexture.dispose();this._inputTexture=null;}this._inputTexture=L.Texture.fromImage(t);this._identitySprite.setTexture(this._inputTexture);this._sprite.setTexture(this._inputTexture);if(this._renderTexture){this._renderTextureSprite.setTexture(this._inputTexture);this._renderTexture.resizeTo(this._inputTexture.getDimensions());}this.setDirty(true);}},{key:"scalesUniformly",value:function scalesUniformly(){return this._options.resizeMode==="keepAspect";}},{key:"setOption",value:function setOption(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;_get(_getPrototypeOf(R_.prototype),"setOption",this).call(this,t,e,r);if(t==="image"&&this._identitySprite){this._onImageUpdate();}}},{key:"_onOptionsChange",value:function _onOptionsChange(){var t=this._dirtiness;for(var e in t){t[e]=true;}}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(R_.prototype),"dispose",this).call(this);if(this._inputTexture){this._inputTexture.dispose();this._inputTexture=null;}this._tintFilter.dispose();this._adjustmentsFilter.dispose();this._options.adjustments.off("updated",this._onOptionsChange);}}]);return R_;}(On);R_.prototype.availableOptions={id:{type:"string","default":function _default(){return z.getUUID();}},identifier:{type:"string","default":""},image:{type:"image",required:true},position:{type:"vector2","default":_c.NULL},dimensions:{type:"vector2","default":_c.NULL},anchor:{type:"vector2","default":new _c(0,0)},pivot:{type:"vector2","default":new _c(.5,.5)},rotation:{type:"number","default":0},flipHorizontally:{type:"boolean","default":false},flipVertically:{type:"boolean","default":false},smoothDownscaling:{type:"boolean","default":false},tintColor:{type:"color","default":G.WHITE},tintMode:{type:"string","default":"none",available:["none","solid","colorized"]},resizeMode:{type:"string","default":"keepAspect",available:["keepAspect","unrestricted"]},alpha:{type:"number","default":1},adjustments:{type:"configurable",structure:{brightness:{type:"number","default":0},saturation:{type:"number","default":1},contrast:{type:"number","default":1}}}};R_.type="sticker";A_=R_;});var _Rn,It;var Br=d(function(){_Rn=/*#__PURE__*/function(){function Rn(t){_classCallCheck(this,Rn);this._seed=t===void 0?_Rn.TimeSeed():t;}_createClass(Rn,[{key:"seed",value:function seed(t){this._seed=t===void 0?_Rn.TimeSeed():t;}},{key:"next",value:function next(){var t=this._seed|0;var e=t/_Rn.SEED_DIVIDER|0;var r=t%_Rn.SEED_DIVIDER|0;t=_Rn.SEED_LOW_MULTIPLY*r-_Rn.SEED_HIGH_MULTIPLY*e;if(t<=0){t+=_Rn.MAX;}if(t===-1){t=_Rn.MAX-1;}this._seed=t;return t;}},{key:"nextInRange",value:function nextInRange(t,e){if(e===void 0){e=t;t=0;}return t+this.next()%(e-t+1);}},{key:"nextBool",value:function nextBool(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return this.nextInRange(t+e-1)>=t;}},{key:"pickNext",value:function pickNext(t){if(!Array.isArray(t)){return null;}return t[this.next()%t.length];}}],[{key:"TimeSeed",value:function TimeSeed(){return Date.now();}}]);return Rn;}();It=_Rn;q(It,"MAX",2147483647);q(It,"SEED_DIVIDER",127773);q(It,"SEED_LOW_MULTIPLY",16807);q(It,"SEED_HIGH_MULTIPLY",2836);});var bst,_e8;var An=d(function(){$();bst=J.Rectangle;_e8=/*#__PURE__*/function(){function _e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,_e);this.width=t;this.height=e;}_createClass(_e,[{key:"set",value:function set(t,e){this.width=t;this.height=e;}},{key:"aspect",value:function aspect(){return this.width/this.height;}},{key:"rectangle",value:function rectangle(t,e){return new bst(t,e,this.width,this.height);}},{key:"clone",value:function clone(){return new _e8(this.width,this.height);}},{key:"scale",value:function scale(t,e){if(e===void 0){e=t;}this.width*=t;this.height*=e;return this;}},{key:"copy",value:function copy(t){this.width=t.width;this.height=t.height;return this;}},{key:"fitInWidthWithOther",value:function fitInWidthWithOther(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new _e8();this.copy(_e8.fitTwoInWidth(t,this,e)[0]);return this;}}],[{key:"fitTwoInWidth",value:function fitTwoInWidth(t,e,r){var o=e.width*r.height+e.height*r.width;var n=r.height*t/o;var s=e.width*n;var a=e.height*n;return[new _e8(s,a),new _e8(t-s,a)];}}]);return _e;}();});var q9,RT,Kt;var so=d(function(){$();q9=y(Ju());RT=/*#__PURE__*/function(_t14){_inherits(RT,_t14);var _super138=_createSuper(RT);function RT(){_classCallCheck(this,RT);return _super138.apply(this,arguments);}_createClass(RT,[{key:"loadImages",value:function(){var _loadImages=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee9(t){var _this186=this;return regeneratorRuntime.wrap(function _callee9$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:return _context10.abrupt("return",(0,q9["default"])(t,/*#__PURE__*/function(){var _ref110=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee8(e){return regeneratorRuntime.wrap(function _callee8$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:return _context9.abrupt("return",_this186.addImage(e.path,e.fullPath,e.image));case 1:case"end":return _context9.stop();}}},_callee8);}));return function(_x13){return _ref110.apply(this,arguments);};}()));case 1:case"end":return _context10.stop();}}},_callee9);}));function loadImages(_x12){return _loadImages.apply(this,arguments);}return loadImages;}()},{key:"addImage",value:function addImage(t,e,r){var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"anonymous";var n=this.getImages();if(!r){return new Promise(function(s,a){r=new Xi();r.onload=function(){n[t]={fullPath:e,image:r};s({fullPath:e,image:r});};r.crossOrigin=z.getCrossOriginValue(o);r.onerror=a;r.src=e;});}n[t]={fullPath:e,image:r};return Promise.resolve({fullPath:e,image:r});}},{key:"getImage",value:function getImage(t){var e=this.getImages();var r=e[t];return r?r.image:null;}},{key:"getVariation",value:function getVariation(t){return this.getFonts()[t];}},{key:"addFont",value:function addFont(t,e){var r=this.getFonts();r[t]=e;return e;}}]);return RT;}(_t);RT.prototype.availableOptions={images:{type:"object","default":{}},fonts:{type:"object","default":{}}};Kt=new RT();});var yst,_st,Y9,xst,vst,Cst,Sst,wst,qi;var Kd=d(function(){$();An();so();yst=function yst(i,t,e,r){var o=e*(r*4)+t*4;var n={r:i[o],g:i[o+1],b:i[o+2],a:i[o+3]};return n;};_st=function _st(i){return i.a<=254;};Y9=function Y9(i,t,e){var r=true;for(var o=0;o4&&arguments[4]!==undefined?arguments[4]:false;var n=0;for(var s=r+1;s4&&arguments[4]!==undefined?arguments[4]:false;var n=0;for(var s=r-1;s>=0;s--){if(!Y9(i,s,t)){n=r-s;}else if(o){break;}}return n;};Cst=function Cst(i,t,e,r,o){i.beginPath();i.moveTo(t,e);i.lineTo(r,o);i.stroke();};Sst=function Sst(i,t,e,r){var o=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"red";i.save();i.strokeStyle=o;Cst(i,e,t,r,t);i.restore();};wst=function wst(i,t,e,r,o){var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:"blue";i.save();i.strokeStyle=n;i.strokeRect(t,e,r,o);i.restore();};qi=/*#__PURE__*/function(_t15){_inherits(qi,_t15);var _super139=_createSuper(qi);function qi(t){var _this187;_classCallCheck(this,qi);_this187=_super139.call(this,t);var e=Kt.getVariation(_this187.getFontIdentifier());if(!e){Y.warn("TextDesignFont: Unable to find font '".concat(_this187._fontIdentifier,"'"));}_this187.set({fontVariation:e});_this187._metrics=null;_this187._canvas=z.createCanvas();_this187._context=_this187._canvas.getContext("2d");_this187._isDirty=true;return _this187;}_createClass(qi,[{key:"_onOptionsChange",value:function _onOptionsChange(){this._isDirty=true;}},{key:"setOption",value:function setOption(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;_get(_getPrototypeOf(qi.prototype),"setOption",this).call(this,t,e,r,o);if(t==="fontIdentifier"&&!o){this.updateFontVariation();}}},{key:"updateFontVariation",value:function updateFontVariation(){var t=Kt.getVariation(this.getFontIdentifier());if(!t){Y.warn("TextDesignFont: Unable to find font '".concat(this._fontIdentifier,"'"));}this.setFontVariation(t);return t;}},{key:"setOptions",value:function setOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._options=_objectSpread(_objectSpread({},this._options),t);this._isDirty=true;}},{key:"_applyTextOptions",value:function _applyTextOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._context;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _this$_options$e=_objectSpread(_objectSpread({},this._options),e),r=_this$_options$e.fontSize,o=_this$_options$e.fontVariation,n=_this$_options$e.lineHeight,s=_this$_options$e.textColor,a=_this$_options$e.alignment;var _o$serializeOptions=o.serializeOptions(),l=_o$serializeOptions.fontStyle,c=_o$serializeOptions.fontWeight,u=_o$serializeOptions.fontFamily;if(false){t.font="".concat(l," ").concat(c," ").concat(r,"px ").concat(u);}if(true){t.font="".concat(l," ").concat(c," ").concat(r,"px / ").concat(n," ").concat(u);}t.fillStyle=s;t.textBaseline="alphabetic";t.textAlign=a||"left";}},{key:"getTextMetrics",value:function getTextMetrics(){if(!this._metrics||this._isDirty){this._calculateTextMetrics();}return _objectSpread({},this._metrics);}},{key:"getSizeValue",value:function getSizeValue(){if(!this._metrics||this._isDirty){this._calculateTextMetrics();}return new _e8(this._metrics.width,this._metrics.height);}},{key:"fitWidth",value:function fitWidth(t){var e=this.getFontVariation();if(!e){Y.warn("TextDesignFont#fitText: missing font variation");return;}this._applyTextOptions(this._context,{fontSize:50});var r=this._context.measureText(this.getText()).width;var o=t/r;var n=Math.floor(o*50);this.setFontSize(n);this._calculateTextMetrics();return this.getTextMetrics();}},{key:"fitHeight",value:function fitHeight(t){var e=this.getFontVariation();if(!e){Y.warn("TextDesignFont#fitText: missing font variation");return;}var r=this._calculateTextMetrics({fontSize:50}).height;var o=t/r;var n=Math.floor(o*50);this.setFontSize(n);this._calculateTextMetrics();return this.getTextMetrics();}},{key:"_calculateTextMetrics",value:function _calculateTextMetrics(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=this._canvas;var r=this._context;var o=_objectSpread(_objectSpread({},this._options),t);var n=this.getText();this._applyTextOptions(r,o);var s=Math.ceil(r.measureText(n).width);var a=Math.floor(s+o.fontSize*2);var l=Math.floor(o.fontSize*3);e.width=a;e.height=l;var c=Math.floor(o.fontSize);var u=Math.floor(l*(3/5));this._applyTextOptions(r,o);r.fillText(n,c,u);var m=r.getImageData(0,0,e.width,e.height).data;var p=vst(m,a,l,u,this._options.excludeAccents);var h=xst(m,a,l,u,this._options.excludeAccents);var g=s;var x=p+h;this._metrics={width:g,height:x,ascender:p,descender:h};this._isDirty=false;return _objectSpread({},this._metrics);}},{key:"draw",value:function draw(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._context;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var o=arguments.length>3?arguments[3]:undefined;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;t.save();if(!this._metrics||this._isDirty){this._calculateTextMetrics();}this._applyTextOptions(t,o);t.fillText(this.getText(),e,r+this._metrics.ascender);if(n){wst(t,e,r,this._metrics.width,this._metrics.height);Sst(t,r+this._metrics.ascender,e,e+this._metrics.width);}t.restore();}}]);return qi;}(_t);qi.prototype.availableOptions={text:{type:"string","default":""},fontIdentifier:{type:"string","default":"imgly_font_open_sans_bold"},fontVariation:{type:"object","default":null},lineHeight:{type:"number","default":1},fontSize:{type:"number","default":22},textColor:{type:"string","default":"black"},strokeStyle:{type:"string","default":"black"},outlineWidth:{type:"number","default":0},textBaseline:{type:"string","default":"alphabetic"},excludeAccents:{type:"boolean","default":false}};});var Yi;var xc=d(function(){$();Yi=/*#__PURE__*/function(_t16){_inherits(Yi,_t16);var _super140=_createSuper(Yi);function Yi(){_classCallCheck(this,Yi);return _super140.apply(this,arguments);}return Yi;}(_t);Yi.prototype.availableOptions={text:{type:"string","default":""},frame:{type:"object","default":null},font:{type:"object","default":null}};});var ao;var Xd=d(function(){$();ao=/*#__PURE__*/function(_t17){_inherits(ao,_t17);var _super141=_createSuper(ao);function ao(){_classCallCheck(this,ao);return _super141.apply(this,arguments);}return ao;}(_t);ao.prototype.availableOptions={tintColor:{type:"color","default":G.BLACK},textColor:{type:"color","default":G.BLACK},alignment:{type:"string","default":"left",available:["left","center","right"]},lineSpacing:{type:"number","default":1},fontIdentifier:{type:"string","default":"imgly_font_open_sans_bold"}};});var Tst,ar;var Rh=d(function(){$();An();Xd();Tst=J.Rectangle;ar=/*#__PURE__*/function(_t18){_inherits(ar,_t18);var _super142=_createSuper(ar);function ar(t){var _this188;_classCallCheck(this,ar);_this188=_super142.call(this,t);_this188.setSize(new _e8(_this188.getWidth(),0));_this188.serverImageSmoothingFix=false;return _this188;}_createClass(ar,[{key:"_getFrame",value:function _getFrame(){var t=this.getSize();return new Tst(0,0,t.width,t.height);}},{key:"_getTextFrame",value:function _getTextFrame(){return this._getFrame();}},{key:"_getTextFrameForElement",value:function _getTextFrameForElement(t){return t.getFrame().clone();}},{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){Y.warn("TextDesignRow is an abstract class.");}},{key:"_getLayoutElements",value:function _getLayoutElements(){if(this._options.elements.length<=0){this.layout();}return this.getElements();}},{key:"_fontSize",value:function _fontSize(t){Y.warn("TextDesignRow#_fontSize not implemented. @TODO: Is it necessary?");return 0;}},{key:"layout",value:function layout(){this.setElements(this._calculateLayoutElements());return this;}},{key:"textFrame",value:function textFrame(t,e){return t.getFrame().clone();}},{key:"willRender",value:function willRender(t){}},{key:"didRender",value:function didRender(t){}},{key:"render",value:function render(t){var _this189=this;t.save();this._getLayoutElements().forEach(function(e){var _e$serializeOptions=e.serializeOptions(),r=_e$serializeOptions.text,o=_e$serializeOptions.frame,n=_e$serializeOptions.font;var s=_this189.getAttributes();n.draw(t,o.x,o.y,{textColor:s.getTextColor().toRGBA(),alignment:s.getAlignment()});});t.restore();}}]);return ar;}(_t);ar.prototype.availableOptions={words:{type:"object","default":null},width:{type:"number","default":100},attributes:{type:"configurable","default":new ao()},shearingAngle:{type:"number","default":0},elements:{type:"array","default":[]},size:{type:"object","default":null}};});var kst,_Ah,No;var J9=d(function(){$();Kd();xc();Rh();kst=J.Rectangle;_Ah=/*#__PURE__*/function(_ar){_inherits(Ah,_ar);var _super143=_createSuper(Ah);function Ah(){_classCallCheck(this,Ah);return _super143.apply(this,arguments);}_createClass(Ah,[{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){if(this.getWords().size()<=0){return[];}var _this$serializeOption=this.serializeOptions(),t=_this$serializeOption.orientation,e=_this$serializeOption.width,r=_this$serializeOption.size,o=_this$serializeOption.relativeRowOffset,n=_this$serializeOption.attributes;var s=n.fontIdentifier;var a=this.getWords().joined(3);var l=t===_Ah.Orientations.Left?[a[0],a[1],a[2]]:[a[1],a[2],a[0]];var c=z.Array.range(0,2).map(function(bt){return new qi({text:l[bt],fontIdentifier:s,fontSize:60});});var u=c.map(function(bt){return bt.getSizeValue();});var m=u[0].width>u[1].width?0:1;var p=(m+1)%2;c[p].fitWidth(u[m].width);u[p]=c[p].getSizeValue();var h=(u[p].height+u[m].height)/(1-o);var g=new qi({text:l[2],fontIdentifier:s});g.fitHeight(h);var x=g.getSizeValue().width;var v=u[m].width;var b=e/(x+v);var T=b*x;var k=b*v;var E=b*h;var A=o*E;r.set(e,E);var I=z.Array.range(0,3).map(function(bt){return new qi({text:l[bt],fontIdentifier:s});});I[0].fitWidth(k);I[1].fitWidth(k);I[2].fitWidth(T);var F=t===_Ah.Orientations.Left?0:T;var Z=t===_Ah.Orientations.Left?k:0;var et=[F,F,Z];var pt=[0,I[0].getSizeValue().height+A,0];var yt=I.map(function(bt,ht){return new kst(et[ht],pt[ht],bt.getSizeValue().width,bt.getSizeValue().height);});return I.map(function(bt,ht){return new Yi({text:l[ht],font:I[ht],frame:yt[ht]});});}}]);return Ah;}(ar);No=_Ah;q(No,"Orientations",{Right:"RIGHT",Left:"LEFT"});No.prototype.availableOptions=_objectSpread(_objectSpread({},ar.prototype.availableOptions),{},{orientation:{type:"string","default":No.Orientations.Left,available:[No.Orientations.Right,No.Orientations.Left]},relativeRowOffset:{type:"number","default":.05}});});var Ist,_vt;var Pr=d(function(){$();Ist=J.Rectangle;_vt=/*#__PURE__*/function(){function vt(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;_classCallCheck(this,vt);this.top=t;this.left=e;this.bottom=r;this.right=o;}_createClass(vt,[{key:"multiply",value:function multiply(t){this.top*=t;this.left*=t;this.bottom*=t;this.right*=t;}},{key:"toObject",value:function toObject(){return _objectSpread({},this);}},{key:"equals",value:function equals(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return Math.abs(t.top-this.top)<=e&&Math.abs(t.left-this.left)<=e&&Math.abs(t.bottom-this.bottom)<=e&&Math.abs(t.right-this.right)<=e;}},{key:"scale",value:function scale(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;var e=arguments.length>1?arguments[1]:undefined;if(e===void 0){e=t;}this.top*=e;this.bottom*=e;this.left*=t;this.right*=t;return this;}},{key:"clone",value:function clone(){return new _vt(this.top,this.left,this.bottom,this.right);}},{key:"applyToRectangle",value:function applyToRectangle(t){return new Ist(t.x+this.left,t.y+this.top,t.width-this.left-this.right,t.height-this.top-this.bottom);}}],[{key:"ZERO",get:function get(){return new _vt(0,0,0,0);}}]);return vt;}();});var xe;var lo=d(function(){$();Kd();Pr();xc();Rh();xe=/*#__PURE__*/function(_ar2){_inherits(xe,_ar2);var _super144=_createSuper(xe);function xe(){_classCallCheck(this,xe);return _super144.apply(this,arguments);}_createClass(xe,[{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){var _this$serializeOption2=this.serializeOptions(),t=_this$serializeOption2.attributes,e=_this$serializeOption2.imageInsets,r=_this$serializeOption2.size,o=_this$serializeOption2.width;var n=this.getWords().joined(1)[0]||"";var s=t.fontIdentifier;var a=new qi({text:n,fontIdentifier:s});a.fitWidth(this._getTextFrame().width);var l=a.getTextMetrics().height+e.top+e.bottom;r.height=l;var c=this._getTextFrame();var u=new Yi({text:n,frame:c,font:a});return[u];}}]);return xe;}(ar);xe.prototype.availableOptions=_objectSpread(_objectSpread({},ar.prototype.availableOptions),{},{imageInsets:{type:"object","default":new _vt()}});});var Gs,Ii,AT,co,B_,qd,BT,Z9,Q9,Vs;var ol=d(function(){$();Gs=J.Rectangle;Ii=J.Vector2;AT=function AT(i,t,e,r){i.drawImage(t,e.x,e.y,e.width,e.height,r.x,r.y,r.width,r.height);};co=function co(i,t,e){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"source-over";var o=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;i.save();i.fillStyle=e.toRGBA();i.globalCompositeOperation=r;i.fillRect(t.x,t.y,t.width,t.height);if(o){i.strokeStyle=e.toRGBA();i.strokeWith=1;i.strokeRect(t.x,t.y,t.width,t.height);}i.restore();};B_=function B_(i,t,e,r){var o=arguments.length>4&&arguments[4]!==undefined?arguments[4]:"source-over";var n=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;i.save();i.fillStyle=r.toRGBA();i.globalCompositeOperation=o;e=Math.min(Math.max(e,0),Math.min(t.height,t.width)*.5);var s=t.x;var a=t.x+t.width;var l=t.y;var c=t.y+t.height;i.beginPath();i.moveTo(s+e,l);i.arcTo(a,l,a,c,e);i.arcTo(a,c,s,c,e);i.arcTo(s,c,s,l,e);i.arcTo(s,l,a,l,e);i.closePath();i.fill();if(n){i.stroke();}i.restore();};qd=function qd(i,t,e){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:4;i.save();i.strokeStyle=e.toRGBA();i.lineWidth=r;i.strokeRect(t.x,t.y,t.width,t.height);i.restore();};BT=function BT(i,t,e){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:"source-over";i.save();var o=t.height/2;var n=t.y+o;var s=t.x+o;var a=t.x+t.width;i.fillStyle=e.toRGBA();i.globalCompositeOperation=r;while(s4&&arguments[4]!==undefined?arguments[4]:"source-atop";i.save();if(r){i.globalAlpha=r.a;}i.drawImage(t,e.x,e.y,e.width,e.height);if(r){i.globalAlpha=1;}if(r){var n=r.clone();n.a=1;co(i,e,n,o);}i.restore();};});var js;var P_=d(function(){$();ol();Pr();lo();js=/*#__PURE__*/function(_xe){_inherits(js,_xe);var _super145=_createSuper(js);function js(){_classCallCheck(this,js);return _super145.apply(this,arguments);}_createClass(js,[{key:"_getTextColor",value:function _getTextColor(){if(this.getAutoAdjustTextColor()&&!this.getIsMasked()){if(this.getBackgroundColor().equals(G.WHITE)){return G.BLACK;}return G.WHITE;}return this.getAttributes().getTextColor().clone();}},{key:"_getTextFrame",value:function _getTextFrame(){return this.getImageInsets().applyToRectangle(this._getFrame());}},{key:"_getTextFrameForElement",value:function _getTextFrameForElement(t){var e=_get(_getPrototypeOf(js.prototype),"_getTextFrameForElement",this).call(this,t);var r=this.getImageInsets();if(this.getIsMasked()||this.getIsUsedInInvertedLayout()){e.y-=r.top;}return e;}},{key:"willRender",value:function willRender(t){if(false){if(this.serverImageSmoothingFix){t.imageSmoothingEnabled=true;}}var e=this.getAttributes();e.setTextColor(this._getTextColor());var r=this.getImage();if(r){var o=this.getCapInsets();var n=this._getFrame();if(o&&!o.equals(_vt.ZERO)){Q9(t,r,n,o);}else{t.drawImage(r,n.x,n.y,n.width,n.height);}co(t,n,this.getBackgroundColor(),"source-atop",true);}if((this.getIsMasked()||this.getIsUsedInInvertedLayout())&&r){t.save();t.globalCompositeOperation="destination-out";}}},{key:"didRender",value:function didRender(t){_get(_getPrototypeOf(js.prototype),"didRender",this).call(this,t);if(this.getIsMasked()||this.getIsUsedInInvertedLayout()){t.restore();}}}]);return js;}(xe);js.prototype.availableOptions=_objectSpread(_objectSpread({},xe.prototype.availableOptions),{},{image:{type:"image","default":null},capInsets:{type:"object","default":new _vt()},backgroundColor:{type:"color","default":G.WHITE},autoAdjustTextColor:{type:"boolean","default":true},isMasked:{type:"boolean","default":true},isUsedInInvertedLayout:{type:"boolean","default":false}});});var _lr;var M_=d(function(){$();Pr();_lr=/*#__PURE__*/function(_t19){_inherits(lr,_t19);var _super146=_createSuper(lr);function lr(){_classCallCheck(this,lr);return _super146.apply(this,arguments);}_createClass(lr,[{key:"insetsForWidth",value:function insetsForWidth(t){return this.getRelativeInsets().clone().scale(t);}}],[{key:"Small",get:function get(){return new _lr({imagePath:"text-design/images/imgly_text_design_asset_banderole_small.png",fontIdentifier:"imgly_font_outfit_bold",relativeInsets:new _vt(.05,.2,.05,.2)});}},{key:"Rectangle",get:function get(){return new _lr({imagePath:"text-design/images/imgly_text_design_asset_black_background.png",fontIdentifier:"imgly_font_outfit_bold",relativeInsets:new _vt(.05,.05,.05,.05),needsImageSmoothingFix:true});}},{key:"Celebrate1",get:function get(){return new _lr({imagePath:"text-design/images/imgly_text_design_asset_celebrate_01.png",fontIdentifier:"imgly_font_rasa_500",relativeInsets:new _vt(.05,.2,.05,.2)});}},{key:"Celebrate2",get:function get(){return new _lr({imagePath:"text-design/images/imgly_text_design_asset_celebrate_02.png",fontIdentifier:"imgly_font_rasa_500",relativeInsets:new _vt(.05,.2,.05,.2)});}}]);return lr;}(_t);_lr.prototype.availableOptions={image:{type:"image","default":null},imagePath:{type:"string","default":null},relativeInsets:{type:"object","default":new _vt()},fontIdentifier:{type:"string","default":"imgly_font_open_sans_bold"},needsImageSmoothingFix:{type:"boolean","default":false}};});var L_;var tU=d(function(){$();Pr();An();L_=/*#__PURE__*/function(_t20){_inherits(L_,_t20);var _super147=_createSuper(L_);function L_(){_classCallCheck(this,L_);return _super147.apply(this,arguments);}_createClass(L_,[{key:"getSize",value:function getSize(){var t=this.getRows();var e=this.getWidth();var r=t.length-1;var o=t.reduce(function(s,a){return s+a.getSize().height;},0);o+=(r+1)*this.getRelativeLineSpacing()*e;var n=this.getRelativeInsets().clone().scale(e);o+=n.top+n.bottom;return new _e8(e,o);}}]);return L_;}(_t);L_.prototype.availableOptions={text:{type:"string","default":""},lines:{type:"array","default":[]},relativeInsets:{type:"object","default":new _vt()},relativeLineSpacing:{type:"number","default":0},rows:{type:"object","default":[]},background:{type:"object","default":null},width:{type:"number","default":0}};});var _hi;var nl=d(function(){$();_hi=/*#__PURE__*/function(){function hi(t){_classCallCheck(this,hi);this.words=[];if(t){this.splitIntoWords(t);}}_createClass(hi,[{key:"splitIntoWords",value:function splitIntoWords(t){this.words=t.match(/\S+/g)||[];return _toConsumableArray(this.words);}},{key:"get",value:function get(){return _toConsumableArray(this.words);}},{key:"getWord",value:function getWord(t){return this.words[t];}},{key:"set",value:function set(t){this.words=_toConsumableArray(t);return this;}},{key:"slice",value:function slice(t,e){return _hi.fromWords(this.words.slice(t,e));}},{key:"getLowerCase",value:function getLowerCase(){return this.words.map(function(t){return t.toLowerCase();});}},{key:"getUpperCase",value:function getUpperCase(){return this.words.map(function(t){return t.toUpperCase();});}},{key:"size",value:function size(){return this.words.length;}},{key:"countNumberOfCharacters",value:function countNumberOfCharacters(){return this.words.reduce(function(t,e){return t+e.length;},0);}},{key:"joined",value:function joined(t){var _this190=this;var e=this.size();var r=Math.floor(e/t);var o=e%t;var n=0;var s=0;return z.Array.range(0,t).map(function(a){n=s;var l=r+(a=this.getMinLineCountOfRandom()){var r=Math.floor(Math.max(1,e*this.getRandomAdditionalLinePercentage()));e+=this._lineNumberRandomizer.nextInRange(0,r);}return Math.min(e,this._maximumNumberOfLines(t));}},{key:"_randomizedNumberOfWordsPerLine",value:function _randomizedNumberOfWordsPerLine(t,e){var _this192=this;if(t>e){Y.warn("TextDesign#_randomizedNumberOfWordsPerLine: Invalid number of lines");return e;}var r=z.Array.repeat(1,t);z.Array.range(t,e).forEach(function(o){var n=_this192._wordsPerLineRandomizer.nextInRange(0,t-1);r[n]+=1;});return r;}},{key:"_textLines",value:function _textLines(t){var e=new _hi(t);var r=this._calculatedNumberOfLines(e);var o=this._randomizedNumberOfWordsPerLine(r,e.size());return o.reduce(function(n,s){return{index:n.index+s,lines:[].concat(_toConsumableArray(n.lines),[e.slice(n.index,Math.min(n.index+s,e.size()))])};},{index:0,lines:[]}).lines;}},{key:"_validTextLines",value:function _validTextLines(t){var e=this._textLines(t);var r=0;do{r=z.Array.findIndex(e,function(o){return o.countNumberOfCharacters()<3;});if(r>=0){var o=e[r-1];var n=e[r+1];var s=o?o.countNumberOfCharacters():Number.MAX_SAFE_INTEGER;var a=n?n.countNumberOfCharacters():Number.MAX_SAFE_INTEGER;if(s-1&&e.length>1);return e;}},{key:"_modifiedLines",value:function _modifiedLines(t){return t;}},{key:"_getBackground",value:function _getBackground(){return this._background;}},{key:"generateLayoutData",value:function generateLayoutData(t,e){var r=this._modifiedText(t);var o=this._modifiedLines(this._validTextLines(r));var n=e*(1-this._relativeInsets.left-this._relativeInsets.right);var s=this._layoutRows(o,n);return new L_({text:r,relativeInsets:this._relativeInsets.clone(),relativeLineSpacing:this.getRelativeLineSpacing(),background:this._background||this._getBackground(),lines:o,rows:s,width:e});}},{key:"_layoutRows",value:function _layoutRows(t,e){var _this193=this;return t.map(function(r,o){return _this193._randomLayoutRow(r,o,e,new ao({fontIdentifier:_this193._fontForRow(o,r)})).layout();});}},{key:"_randomLayoutRow",value:function _randomLayoutRow(t,e,r,o){return new xe({words:t,width:r,attributes:o});}}]);return ri;}(_t);q(ri,"defaultFontIdentifiers",[]);q(ri,"identifier","textdesign");ri.prototype.availableOptions={fontIdentifiers:{type:"array","default":[]},relativeLineSpacing:{type:"number","default":0}};});var oi;var Jd=d(function(){$();Br();J9();lo();P_();Xd();M_();so();Yd();oi=/*#__PURE__*/function(_ri){_inherits(oi,_ri);var _super149=_createSuper(oi);function oi(){var _this194;_classCallCheck(this,oi);for(var _len85=arguments.length,t=new Array(_len85),_key85=0;_key85<_len85;_key85++){t[_key85]=arguments[_key85];}_this194=_super149.call.apply(_super149,[this].concat(t));q(_assertThisInitialized(_this194),"getImagePaths",function(){var t=_this194.getBanderoles();return t&&t.map(function(e){return e.getImagePath();})||[];});q(_assertThisInitialized(_this194),"onImagesLoaded",function(){var t=_this194.getBanderoles();if(t){t.forEach(function(e){var r=Kt.getImage(e.getImagePath());if(!r){Y.warn("TextDesignBlocks#onImagesLoaded: Image not found '".concat(e.getImagePath(),"'"));return;}e.setImage(r);});}});_this194._rowTypeLessThan3WordsRandomizer=new It(0);_this194._rowTypeMoreThan3WordsRandomizer=new It(0);_this194._banderolesRandomizer=new It(0);_this194._seedPool=[].concat(_toConsumableArray(_this194._seedPool),[_this194._rowTypeLessThan3WordsRandomizer,_this194._rowTypeMoreThan3WordsRandomizer,_this194._banderolesRandomizer]);return _this194;}_createClass(oi,[{key:"_modifiedText",value:function _modifiedText(t){return _get(_getPrototypeOf(oi.prototype),"_modifiedText",this).call(this,t).toUpperCase();}},{key:"generateLayoutData",value:function generateLayoutData(t,e){this._options.hasMaskedText=false;return _get(_getPrototypeOf(oi.prototype),"generateLayoutData",this).call(this,t,e);}},{key:"_randomLayoutRow",value:function _randomLayoutRow(t,e,r,o){if(t.size()<3){var s=this._rowTypeLessThan3WordsRandomizer.nextInRange(0,2)===0;return this._layoutRow(t,r,o,s);}var n=this._rowTypeMoreThan3WordsRandomizer.nextInRange(0,3);switch(n){case 0:return new No({words:t,width:r,attributes:o,orientation:No.Orientations.Left});case 1:return new No({words:t,width:r,attributes:o,orientation:No.Orientations.Right});case 2:return this._layoutRow(t,r,o,true);case 3:return new xe({words:t,width:r,attributes:o});default:throw new Error("TextDesignBlocks#_randomLayoutRow: Invalid randomValue generated: ".concat(n,"."));}}},{key:"_layoutRow",value:function _layoutRow(t,e,r,o){if(this.getHasMaskedText()){o=false;}if(o){this.setHasMaskedText(true);var n=this._banderolesRandomizer.pickNext(this.getBanderoles());var s=new js({words:t,width:e,attributes:new ao({alignment:"left",fontIdentifier:n.getFontIdentifier()}),image:n.getImage(),imageInsets:n.insetsForWidth(e),capInsets:null,backgroundColor:G.WHITE});if(n.getNeedsImageSmoothingFix()){s.serverImageSmoothingFix=true;}return s;}return new xe({words:t,width:e,attributes:r});}}]);return oi;}(ri);q(oi,"defaultFontIdentifiers",["imgly_font_outfit_bold"]);q(oi,"identifier","imgly_text_design_blocks");q(oi,"defaultBanderoles",[_lr.Rectangle,_lr.Small]);oi.prototype.availableOptions=_objectSpread(_objectSpread({},ri.prototype.availableOptions),{},{fontIdentifiers:{type:"array","default":oi.defaultFontIdentifiers},relativeLineSpacing:{type:"number","default":.025/3},hasMaskedText:{type:"boolean","default":false},banderoles:{type:"array","default":oi.defaultBanderoles}});});var vc;var eU=d(function(){$();lo();Jd();vc=/*#__PURE__*/function(_oi){_inherits(vc,_oi);var _super150=_createSuper(vc);function vc(){var _this195;_classCallCheck(this,vc);for(var _len86=arguments.length,t=new Array(_len86),_key86=0;_key86<_len86;_key86++){t[_key86]=arguments[_key86];}_this195=_super150.call.apply(_super150,[this].concat(t));_this195._exclusiveFont=null;return _this195;}_createClass(vc,[{key:"generateLayoutData",value:function generateLayoutData(t,e){this._exclusiveFont=this._fontRandomizer.pickNext(this.getFontIdentifiers());return _get(_getPrototypeOf(vc.prototype),"generateLayoutData",this).call(this,t,e);}},{key:"_fontForRow",value:function _fontForRow(t,e){return this._exclusiveFont||_get(_getPrototypeOf(vc.prototype),"_fontForRow",this).call(this,t,e);}},{key:"_layoutRow",value:function _layoutRow(t,e,r,o){return new xe({words:t,width:e,attributes:r});}}]);return vc;}(oi);q(vc,"defaultFontIdentifiers",["imgly_font_ostrich_sans_heavy","imgly_font_ostrich_sans_bold","imgly_font_ostrich_sans_black"]);q(vc,"identifier","imgly_text_design_blocks_condensed");vc.prototype.availableOptions=_objectSpread(_objectSpread({},oi.prototype.availableOptions),{},{fontIdentifiers:{type:"array","default":vc.defaultFontIdentifiers}});});var Bh,_sl,cr;var PT=d(function(){$();ol();An();xc();Rh();Bh=J.Rectangle;_sl=/*#__PURE__*/function(_ar3){_inherits(sl,_ar3);var _super151=_createSuper(sl);function sl(){var _this196;_classCallCheck(this,sl);for(var _len87=arguments.length,t=new Array(_len87),_key87=0;_key87<_len87;_key87++){t[_key87]=arguments[_key87];}_this196=_super151.call.apply(_super151,[this].concat(t));_this196.setSize(new _e8(_this196.getWidth(),_this196.getHeight()));return _this196;}_createClass(sl,[{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){return[new Yi({frame:this._getTextFrame()})];}},{key:"render",value:function render(t){var e=this._getFrame();var r=this.getType();var o=this.getAttributes();var n=o.getTextColor();var s=e.height/3;var a=new Bh(e.x,e.y,e.width,s);var l=new Bh(e.x,e.y+s*2,e.width,s);switch(r){case _sl.FormType.Rect:co(t,e,n);break;case _sl.FormType.DoubleRect:co(t,a,n);co(t,l,n);break;case _sl.FormType.DoubleRectFirstPunctuated:BT(t,a,n);co(t,l,n);break;case _sl.FormType.DoubleRectSecondPunctuated:co(t,a,n);BT(t,l,n);break;case _sl.FormType.LongLine:{var c=e.height/2;var u=new Bh(e.x,e.y,e.width,c);B_(t,u,u.height*.5,n);break;}case _sl.FormType.LongAndShortLine:{var _c5=e.height*.2;var _u3=_c5*.75;a=new Bh(e.x,e.y+_c5,e.width,_c5);var m=e.x+e.width*.25;var p=e.y+e.height-_u3;l=new Bh(m,p,e.width*.5,_u3);B_(t,a,a.height*.5,n);B_(t,l,l.height*.5,n);break;}default:break;}}}]);return sl;}(ar);cr=_sl;q(cr,"FormType",{Rect:"RECT",DoubleRect:"DOUBLE_RECT",DoubleRectFirstPunctuated:"DOUBLE_RECT_FIRST_PUNCTUATED",DoubleRectSecondPunctuated:"DOUBLE_RECT_SECOND_PUNCTUATED",LongLine:"LONG_LINE",LongAndShortLine:"LONG_AND_SHORT_LINE"});cr.prototype.availableOptions=_objectSpread(_objectSpread({},ar.prototype.availableOptions),{},{height:{type:"number","default":100},type:{type:"string","default":cr.FormType.Rect,available:z.values(cr.FormType)}});});var Bn;var MT=d(function(){$();lo();PT();Jd();Bn=/*#__PURE__*/function(_oi2){_inherits(Bn,_oi2);var _super152=_createSuper(Bn);function Bn(){_classCallCheck(this,Bn);return _super152.apply(this,arguments);}_createClass(Bn,[{key:"_layoutRow",value:function _layoutRow(t,e,r,o){return new xe({words:t,width:e,attributes:r});}},{key:"_layoutRows",value:function _layoutRows(t,e){var r=_get(_getPrototypeOf(Bn.prototype),"_layoutRows",this).call(this,t,e);var o=.032*e;var n=.08*e;var s=new cr({width:e,height:o,type:cr.FormType.LongLine,shearingAngle:0}).layout();var a=new cr({width:e,height:n,type:cr.FormType.LongAndShortLine,shearingAngle:0}).layout();return[s].concat(_toConsumableArray(r),[a]);}}]);return Bn;}(oi);q(Bn,"defaultFontIdentifiers",["imgly_font_sue_ellen_francisco"]);q(Bn,"identifier","imgly_text_design_blocks_light");Bn.prototype.availableOptions=_objectSpread(_objectSpread({},oi.prototype.availableOptions),{},{fontIdentifiers:{type:"array","default":Bn.defaultFontIdentifiers}});});var Cc;var iU=d(function(){$();lo();Xd();MT();Cc=/*#__PURE__*/function(_Bn){_inherits(Cc,_Bn);var _super153=_createSuper(Cc);function Cc(){_classCallCheck(this,Cc);return _super153.apply(this,arguments);}_createClass(Cc,[{key:"_layoutRows",value:function _layoutRows(t,e){var _this197=this;return t.map(function(r,o){return _this197._randomLayoutRow(r,o,e,new ao({fontIdentifier:_this197._fontForRow(o,r)})).layout();});}},{key:"_layoutRow",value:function _layoutRow(t,e,r,o){return new xe({words:t,width:e,attributes:r});}}]);return Cc;}(Bn);q(Cc,"defaultFontIdentifiers",["imgly_font_sue_ellen_francisco"]);q(Cc,"identifier","imgly_text_design_blocks_light-v3_1_0");Cc.prototype.availableOptions=_objectSpread(_objectSpread({},Bn.prototype.availableOptions),{},{fontIdentifiers:{type:"array","default":Cc.defaultFontIdentifiers}});});var Ost,_z_,Ho;var U_=d(function(){$();Kd();ol();An();xc();lo();Ost=J.Rectangle;_z_=/*#__PURE__*/function(_xe2){_inherits(z_,_xe2);var _super154=_createSuper(z_);function z_(){_classCallCheck(this,z_);return _super154.apply(this,arguments);}_createClass(z_,[{key:"getImageSize",value:function getImageSize(){var t=this.getLeftImage();var e=this.getRightImage();var r=this.getWords();var o=this.getAttributes();var n=o.getFontIdentifier();var s=t?new _e8(t.width,t.height):new _e8();var a=r.joined(1)[0];if(!a){return s;}var l=new qi({text:a,fontIdentifier:n,fontSize:50});var c=l.getSizeValue();var u=e?2:1;s.scale(u,1);var m=s.clone().fitInWidthWithOther(this._getFrame().width,c);m.scale(1/u,1);return m;}},{key:"_getTextFrame",value:function _getTextFrame(){var t=_get(_getPrototypeOf(z_.prototype),"_getTextFrame",this).call(this).clone();var e=this.getImageSize();var r=this.getRightImage();var o=this.getImagePosition();if(!r){if(o===_z_.ImagePosition.Left){t.x+=e.width;}}else{t.x+=e.width;t.width-=2*e.width;}return t;}},{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){var t=_get(_getPrototypeOf(z_.prototype),"_calculateLayoutElements",this).call(this);var e=this._getFrame();var r=this.getRightImage();var o=this.getImageSize();var n=this.getImagePosition();var s=this._getTextFrame();var a=this.getAttributes();var l=a.getFontIdentifier();var c=new qi({text:"stickerClock",fontIdentifier:l});c.fitWidth(this._getTextFrame().width);var u=new Ost().set(e.x,e.y,o.width,o.height);if(!r&&n===_z_.ImagePosition.Right){u.x+=s.width;}t.push(new Yi({text:"stickerClock",frame:u,font:c}));if(r){var m=t[0];if(m){var p=u.clone();p.translate(m.getFrame().width+p.width,0);t.push(new Yi({text:"stickerClock",frame:p,font:c}));}}return t;}},{key:"render",value:function render(t){var e=this._getLayoutElements();var r=this.getAttributes();var o=r.getTextColor();var n=this.getLeftImage();var s=this.getRightImage();var a=e[0];var l=e[1];var _a$serializeOptions=a.serializeOptions(),c=_a$serializeOptions.font;var u=this._getTextFrameForElement(a);c.draw(t,u.x,u.y,{textColor:r.getTextColor().toRGBA(),alignment:r.getAlignment()});if(n){var m=l.getFrame();t.drawImage(n,m.x,m.y,m.width,m.height);co(t,m,o,"source-atop");}if(e.length>2){var _m3=e[2];var p=_m3.getFrame().clone();t.drawImage(s,p.x,p.y,p.width,p.height);co(t,p,o,"source-atop");}}}]);return z_;}(xe);Ho=_z_;q(Ho,"ImagePosition",{Left:"LEFT",right:"RIGHT"});Ho.prototype.availableOptions=_objectSpread(_objectSpread({},xe.prototype.availableOptions),{},{leftImage:{type:"image","default":null},rightImage:{type:"image","default":null},imagePosition:{type:"string","default":Ho.ImagePosition.Left,available:[Ho.ImagePosition.Left,Ho.ImagePosition.Right]}});});var _Ph,Mr;var LT=d(function(){$();lo();U_();M_();nl();Jd();_Ph=/*#__PURE__*/function(_oi3){_inherits(Ph,_oi3);var _super155=_createSuper(Ph);function Ph(){_classCallCheck(this,Ph);return _super155.apply(this,arguments);}_createClass(Ph,[{key:"_fontForRow",value:function _fontForRow(t,e){var r=this.getFontIdentifiers();return r[t%r.length];}},{key:"_minimumNumberOfLines",value:function _minimumNumberOfLines(t){return Math.max(Math.floor(_get(_getPrototypeOf(Ph.prototype),"_minimumNumberOfLines",this).call(this,t)*.7),1);}},{key:"_maximumNumberOfLines",value:function _maximumNumberOfLines(t){return Math.max(Math.floor(t.countNumberOfCharacters()/5),1);}},{key:"_randomLayoutRow",value:function _randomLayoutRow(t,e,r,o){return this._createSingleRow(_Ph.RowType.Single,t,r,o);}},{key:"_createSingleRow",value:function _createSingleRow(t,e,r,o){var n=o.getFontIdentifier();var s=n==="imgly_font_allison_regular"||n==="imgly_font_handycheera_regular"?new _hi().set(e.getLowerCase()):e;switch(t){case _Ph.RowType.Single:return new xe({words:s,width:r,attributes:o});case _Ph.RowType.SingleImage:return new Ho({words:s,width:r,attributes:o});default:Y.warn("TextDesignCelebrate#_createSingleRow: Invalid row type '".concat(t,"'"));return null;}}}]);return Ph;}(oi);Mr=_Ph;q(Mr,"defaultFontIdentifiers",["imgly_font_handycheera_regular","imgly_font_rasa_regular"]);q(Mr,"defaultBanderoles",[_lr.Celebrate1,_lr.Celebrate2]);q(Mr,"identifier","imgly_text_design_celebrate");q(Mr,"RowType",{Single:"SINGLE",SingleImage:"SINGLE_IMAGE"});Mr.prototype.availableOptions=_objectSpread(_objectSpread({},oi.prototype.availableOptions),{},{relativeLineSpacing:{type:"number","default":.01875},fontIdentifiers:{type:"array","default":Mr.defaultFontIdentifiers},banderoles:{type:"array","default":Mr.defaultBanderoles}});});var ni;var N_=d(function(){$();Kd();nl();ol();An();Xd();xc();Rh();ni=/*#__PURE__*/function(_ar4){_inherits(ni,_ar4);var _super156=_createSuper(ni);function ni(){var _this198;_classCallCheck(this,ni);for(var _len88=arguments.length,t=new Array(_len88),_key88=0;_key88<_len88;_key88++){t[_key88]=arguments[_key88];}_this198=_super156.call.apply(_super156,[this].concat(t));_this198.setSize(new _e8(_this198.getWidth(),_this198.getHeight()));return _this198;}_createClass(ni,[{key:"_getImageFrame",value:function _getImageFrame(){var t=this._getTextFrame().clone();var e=this.getImage();if(this.getDrawingModeAspectFit()&&e){var r=Math.min(t.width/e.width,t.height/e.height);var o=e.width*r;var n=e.height*r;t.x+=(t.width-o)/2;t.y+=(t.height-n)/2;t.width=o;t.height=n;}return t;}},{key:"_calculateLayoutElements",value:function _calculateLayoutElements(){return[new Yi({text:"",frame:this._getImageFrame(),font:new qi()})];}},{key:"render",value:function render(t){var e=this.getImage();var r=this._getImageFrame();var o=this.getAttributes();var n=o.getTextColor();Vs(t,e,r,n);}}]);return ni;}(ar);q(ni,"RowImages",{decorative1:"text-design/images/imgly_text_design_asset_decorative_01.png",decorative2:"text-design/images/imgly_text_design_asset_decorative_02.png",decorative3:"text-design/images/imgly_text_design_asset_decorative_05.png",decorative4:"text-design/images/imgly_text_design_asset_decorative_06.png",celebrate1:"text-design/images/imgly_text_design_asset_celebrate_03.png",celebrate2:"text-design/images/imgly_text_design_asset_celebrate_04.png",celebrate3:"text-design/images/imgly_text_design_asset_celebrate_05.png"});ni.prototype.availableOptions=_objectSpread(_objectSpread({},ar.prototype.availableOptions),{},{words:{type:"object","default":new _hi()},height:{type:"number","default":0},image:{type:"image","default":null},imagePath:{type:"string","default":ni.RowImages.decorative1},drawingModeAspectFit:{type:"boolean","default":false},attributes:{type:"configurable","default":new ao()}});});var Sc;var rU=d(function(){$();Br();lo();U_();N_();M_();so();nl();Jd();LT();Sc=/*#__PURE__*/function(_Mr){_inherits(Sc,_Mr);var _super157=_createSuper(Sc);function Sc(){var _this199;_classCallCheck(this,Sc);for(var _len89=arguments.length,t=new Array(_len89),_key89=0;_key89<_len89;_key89++){t[_key89]=arguments[_key89];}_this199=_super157.call.apply(_super157,[this].concat(t));q(_assertThisInitialized(_this199),"getImagePaths",function(){var t=_this199.getBanderoles();return[].concat(_toConsumableArray(t&&t.map(function(e){return e.getImagePath();})||[]),_toConsumableArray(_this199._celebrateTypes));});q(_assertThisInitialized(_this199),"onImagesLoaded",function(){var t=_this199.getBanderoles();if(t){t.forEach(function(e){var r=Kt.getImage(e.getImagePath());if(!r){Y.warn("TextDesignBlocks#onImagesLoaded: Image not found '".concat(e.getImagePath(),"'"));return;}e.setImage(r);});}});_this199._celebrateTypes=[ni.RowImages.celebrate1,ni.RowImages.celebrate2,ni.RowImages.celebrate3];_this199._exclusiveFont=null;_this199._typeRandomizer=new It(0);_this199._useMaskedRandomizer=new It(0);_this199._seedPool.push(_this199._typeRandomizer);_this199._seedPool.push(_this199._useMaskedRandomizer);return _this199;}_createClass(Sc,[{key:"_fontForRow",value:function _fontForRow(t,e){var r=this.getFontIdentifiers();return r[t%(r.length-1)];}},{key:"_layoutRows",value:function _layoutRows(t,e){var r=this._typeRandomizer.pickNext(this._celebrateTypes);var o=Kt.getImage(r);if(!o){Y.warn("TextDesignCelebrateSimple#_layoutRows: Image not fount '".concat(r,"'"));}var n=new ni({width:e,height:e*.5,drawingModeAspectFit:true,image:o}).layout();var s=_get(_getPrototypeOf(Sc.prototype),"_layoutRows",this).call(this,t,e);return[n].concat(_toConsumableArray(s));}},{key:"_randomLayoutRow",value:function _randomLayoutRow(t,e,r,o){var n=t.countNumberOfCharacters();var s=13;var a=4;if(nthis._maxWidth){if(e.length>0){t.push(e.join(""));e=[c];}var p=c.replace(/\s+$/i,"");if(this._getWidth(p)>this._maxWidth){var h=this._splitWord(c);t=t.concat(h.lines);if(h.rest){e=[h.rest];}}}else{e.push(c);}}t.push(e.join(""));e=[];}return t.map(function(o){return _this202._trimLine(o,_this202._context.textAlign);});}},{key:"_trimLine",value:function _trimLine(t,e){return t;}},{key:"_buildWords",value:function _buildWords(t){var e=[];var r="";var o=t.length;for(var n=0;nthis._maxWidth){if(n.length>0){e.lines.push(n.join(""));}n=[a];}else{n.push(a);}if(s===o-1&&n.length>0){e.rest=n.join("");}}return e;}},{key:"_fontStyleChanged",value:function _fontStyleChanged(){if(this._context.font!==this._lastFontStyle){this._lastFontStyle=this._context.font;return true;}return false;}},{key:"_getWidth",value:function _getWidth(t){return this._context.measureText(t).width;}},{key:"setText",value:function setText(t){this._text=t;this._lines=t.split("\n");}},{key:"setMaxWidth",value:function setMaxWidth(t){this._maxWidth=t;}}]);return BU;}();rx=BU;});var WT,PU,GT;var VT=d(function(){$();HT();WT=J.Vector2;PU=/*#__PURE__*/function(){function PU(t,e){_classCallCheck(this,PU);this._text=t;this._operation=e;this._textOptions={};this.rotation=0;this._createCanvas();this._createTexture();}_createClass(PU,[{key:"_createCanvas",value:function _createCanvas(){this._canvas=z.createCanvas();this._context=this._canvas.getContext("2d");this._textSplitter=new rx(this._context);this._finalCanvas=z.createCanvas();this._finalContext=this._finalCanvas.getContext("2d");}},{key:"_createTexture",value:function _createTexture(){this._texture=L.Texture.fromCanvas(this._canvas);this._finalTexture=L.Texture.fromCanvas(this._finalCanvas);}},{key:"_applyTextOptions",value:function _applyTextOptions(t,e){e.font="".concat(this._text.getFontStyle()," ").concat(this._text.getFontWeight()," ").concat(t.fontSize,"px \"").concat(this._text.getFontFamily(),"\"");if(this._text.getTextMetrics()){e.textBaseline="alphabetic";}else{e.textBaseline="top";}e.textAlign=this._text.getAlignment();e.fillStyle=this._text.getColor().toRGBA();e.strokeStyle=this._text.getOutlineColor().toRGBA();var r=this._text.getOutlineWidth();if(r>0){e.lineWidth=r;}}},{key:"_buildOutputLines",value:function _buildOutputLines(t){this._textSplitter.setText(this._text.getText());this._textSplitter.setMaxWidth(t);return this._textSplitter.getLines().map(function(e){return e.replace(/\s+$/i,"");});}},{key:"_renderTextLine",value:function _renderTextLine(t,e,r){var o=this._text.getAlignment();var n=new WT(0,e);switch(o){case"left":n.x=r;break;case"center":n.x=this._canvas.width/2;break;case"right":n.x=this._canvas.width-r;break;}this._context.save();this._context.translate(n.x,n.y);this._context.fillText(t,0,0);this._context.restore();var s=this._text.getOutlineWidth();if(s>0){this._context.miterLimit=2;this._context.strokeText(t,n.x,n.y);}}},{key:"update",value:function update(t,e){var r=this.calculateFontStyles(t,e);if(r){var _this$_calculateText=this._calculateText(t,r,e),o=_this$_calculateText.dimensions,n=_this$_calculateText.lines;this._renderText(t,o,n,r,e);this._updateFinalTexture();}}},{key:"_updateFinalTexture",value:function _updateFinalTexture(){var _this$_canvas2=this._canvas,t=_this$_canvas2.width,e=_this$_canvas2.height;var r=this.rotation;var o=Math.cos(r);var n=Math.sin(r);var s=new WT(Math.abs(t*o)+Math.abs(e*n),Math.abs(t*n)+Math.abs(e*o));this._finalCanvas.width=s.x;this._finalCanvas.height=s.y;this._finalContext.save();this._finalContext.translate(this._finalCanvas.width/2,this._finalCanvas.height/2);this._finalContext.rotate(r);this._finalContext.drawImage(this._canvas,-t/2,-e/2);this._finalContext.restore();}},{key:"_renderText",value:function _renderText(t,e,r,o,n){this._canvas.width=e.x;this._canvas.height=e.y;if(this._text.getMaxHeight()){this._canvas.height=Math.min(this._text.getMaxHeight()*n.y,this._canvas.height);}this._context=this._canvas.getContext("2d");this._context.fillStyle=this._text.getBackgroundColor().toRGBA();this._context.fillRect(0,0,e.x,e.y);this._applyTextOptions(o,this._context);var s=this._padding(n);var a=this._text.getTextMetrics();var l=this._text.getFontSize()*n.y;var c=1/a.unitsPerEm*l;var u=a.ascender*c;for(var m=0;m2&&arguments[2]!==undefined?arguments[2]:true;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;_get(_getPrototypeOf(Mh.prototype),"setOption",this).call(this,t,e,r,o);if(t==="fontIdentifier"&&!o){this.updateFontVariation();}}},{key:"updateFontVariation",value:function updateFontVariation(){var t=Kt.getVariation(this.getFontIdentifier());if(!t){Y.warn("TextDesignFont: Unable to find font '".concat(this._fontIdentifier,"'"));}this.setFontVariation(t);return t;}},{key:"_applyTextOptions",value:function _applyTextOptions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this._context;var _this$_options$t=_objectSpread(_objectSpread({},this._options),t),r=_this$_options$t.fontSize,o=_this$_options$t.fontVariation,n=_this$_options$t.lineHeight,s=_this$_options$t.textColor,a=_this$_options$t.alignment;var _o$serializeOptions2=o.serializeOptions(),l=_o$serializeOptions2.fontStyle,c=_o$serializeOptions2.fontWeight,u=_o$serializeOptions2.fontFamily;e.font="".concat(l," ").concat(c," ").concat(r,"px \"").concat(u,"\"");e.fillStyle=s;e.textBaseline="top";e.textAlign=a||"left";}},{key:"_buildOutputLines",value:function _buildOutputLines(t){this._textSplitter.setText(this.getText());this._textSplitter.setMaxWidth(t);return this._textSplitter.getLines();}},{key:"_renderTextLine",value:function _renderTextLine(t,e){var r=this.getAlignment();var o=new MU(0,e);switch(r){case"center":o.x=this._canvas.width/2;break;case"right":o.x=this._canvas.width;break;}this._context.fillText(t,o.x,o.y);}},{key:"update",value:function update(){var t=this.calculateFontStyles();if(t){var _this$_calculateText3=this._calculateText(t),e=_this$_calculateText3.dimensions,r=_this$_calculateText3.lines;this._dimensions=e;this._renderText(e,r,t);}}},{key:"draw",value:function draw(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;this.update();t.drawImage(this._canvas,e,r,this._dimensions.x,this._dimensions.y);}},{key:"_renderText",value:function _renderText(t,e,r){this._canvas.width=t.x;this._canvas.height=t.y;this._context=this._canvas.getContext("2d");this._applyTextOptions(r,this._context);for(var o=0;oc){a.x=c;a.y=Math.round(a.x/this._aspect);}if(a.y>c){a.y=c;a.x=Math.round(a.y*this._aspect);}var u=z.ensureCanvasDimensions(this._canvas,a);if(r||u){this._context.clearRect(0,0,this._canvas.width,this._canvas.height);this._renderer.draw(this._context,new _e8(a.x,a.y),this.getColor(),this.getInverted());this.setDimensions(s);this._texture.getBaseTexture().update();if(l.isOfType("webgl")){l.updateTexture(this._texture.getBaseTexture());}}_get(_getPrototypeOf(rm.prototype),"update",this).call(this,t,e);this._applyFlip();}},{key:"_applyFlip",value:function _applyFlip(){var t=this._sprite.getScale();var _this$_options31=this._options,e=_this$_options31.flipHorizontally,r=_this$_options31.flipVertically;if(e&&t.x>0||!e&&t.x<0){t.x*=-1;}if(r&&t.y>0||!r&&t.y<0){t.y*=-1;}this._sprite.setScale(t);}},{key:"_optionEquals",value:function _optionEquals(t,e){if(t==="layout"){var r=this._options.layout;if(!r&&e||!e&&r){return false;}if(!e.constructor||!r.constructor){return false;}if(r.constructor.identifier!==e.constructor.identifier){return false;}return true;}return _get(_getPrototypeOf(rm.prototype),"_optionEquals",this).call(this,t,e);}},{key:"serializeOptions",value:function serializeOptions(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t&&this.getPadding()<0){var o=t.indexOf("padding");if(o>-1){t.splice(o,1);}}var r=_get(_getPrototypeOf(rm.prototype),"serializeOptions",this).call(this,t,e);if(!t)r.type="textdesign";return r;}},{key:"_getTexture",value:function _getTexture(){return this._texture;}},{key:"canBeFlippedHorizontally",value:function canBeFlippedHorizontally(){return false;}},{key:"canBeDuplicated",value:function canBeDuplicated(){return true;}},{key:"canMaskCanvas",value:function canMaskCanvas(){return true;}},{key:"canAdjustPadding",value:function canAdjustPadding(){return true;}},{key:"dispose",value:function dispose(){this._isDisposed=true;this._texture.dispose();this._sprite.dispose();}}]);return rm;}(On);rm.Layouts={TextDesignBlocks:oi,TextDesignBlocksCondensed:vc,TextDesignBlocksLight:Bn,TextDesignCelebrate:Mr,TextDesignCelebrateSimple:Sc,TextDesignEqualWidth:Mn,TextDesignEqualWidthFat:Tc,TextDesignMasked:ke,TextDesignMaskedBadge:cl,TextDesignMaskedSpeechBubble:Lr,TextDesignMaskedSpeechBubbleComic:Ic,TextDesignMultiline:Dc,TextDesignWatercolor:Fc,TextDesignSunshine:vi,TextDesignParticles:$s,TextDesignRotated:Ec};rm.LegacyLayouts={TextDesignBlocksLightV310:Cc,TextDesignSunshineV310:cx};rm.AssetManager=Kt;rm.prototype.availableOptions={id:{type:"string","default":function _default(){return z.getUUID();}},position:{type:"vector2","default":new ml(.5,.5)},dimensions:{type:"vector2","default":ml.NULL},anchor:{type:"vector2","default":new ml(0,0)},pivot:{type:"vector2","default":new ml(.5,.5)},rotation:{type:"number","default":0},flipHorizontally:{type:"boolean","default":false},flipVertically:{type:"boolean","default":false},layout:{type:"object","default":null,setter:function setter(i){this._isLayoutDirty=true;return i;}},text:{type:"string","default":"",setter:function setter(i){this._isLayoutDirty=true;return i;}},color:{type:"color","default":G.BLACK,setter:function setter(i){this._isLayoutDirty=true;return i;}},padding:{type:"number","default":.01,minValue:.01},width:{type:"number","default":.8},inverted:{type:"boolean","default":false,setter:function setter(i){this._isLayoutDirty=true;return i;}},seed:{type:"number","default":-1}};dx=rm;});var $T,mx,px;var ZU=d(function(){$();$d();VT();$T=J.Vector2;mx=/*#__PURE__*/function(_On4){_inherits(mx,_On4);var _super181=_createSuper(mx);function mx(){var _this218;_classCallCheck(this,mx);for(var _len102=arguments.length,t=new Array(_len102),_key102=0;_key102<_len102;_key102++){t[_key102]=arguments[_key102];}_this218=_super181.call.apply(_super181,[this].concat(t));_this218._textRenderer=new GT(_assertThisInitialized(_this218),_this218._operation);_this218._textRenderer.rotation=_this218.getRotation();_this218._sprite.setTexture(_this218._textRenderer.getFinalTexture());_this218._hitTestSprite.setTexture(_this218._textRenderer.getTexture());return _this218;}_createClass(mx,[{key:"serializeOptions",value:function serializeOptions(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=_get(_getPrototypeOf(mx.prototype),"serializeOptions",this).call(this,t,e);if(!t)r.type="text";return r;}},{key:"getDOMStyle",value:function getDOMStyle(t,e){var r=this.getFontSize()*e.y;return{fontWeight:this._options.fontWeight,fontSize:"".concat(r,"px"),fontStyle:this._options.fontStyle,fontFamily:this._options.fontFamily,lineHeight:"".concat(this.getAbsoluteTextHeight(e)*this.getLineHeight(),"px"),color:this._options.color.toRGBA(),backgroundColor:this._options.backgroundColor.toRGBA(),textAlign:this._options.alignment};}},{key:"getAbsoluteTextHeight",value:function getAbsoluteTextHeight(t){var e=this.getFontSize()*t.y;var r=this.getTextMetrics();if(r){var o=1/r.unitsPerEm*e;var n=r.ascender*o;var s=r.descender*o;return n+Math.abs(s);}return e*this.getLineHeight()*1.1;}},{key:"getDimensions",value:function getDimensions(t,e){return this._textRenderer.getDimensions(t,e);}},{key:"applyFlip",value:function applyFlip(t){_get(_getPrototypeOf(mx.prototype),"applyFlip",this).call(this,t);var e=this._options.rotation;switch(t){case"horizontal":e+=(Math.PI-e)*2;this.setRotation(e);break;case"vertical":e+=(Math.PI/2-e)*2;this.setRotation(e);break;}}},{key:"applyTransform",value:function applyTransform(t){_get(_getPrototypeOf(mx.prototype),"applyTransform",this).call(this,t);this.set({fontSize:t.scaleSize(this.getFontSize(),"y"),maxWidth:t.scaleSize(this.getMaxWidth(),"x")},false);}},{key:"applyRotation",value:function applyRotation(t){_get(_getPrototypeOf(mx.prototype),"applyRotation",this).call(this,t);var e=(t+360)%360;var r=this._operation.getInputDimensions();if(e===90||e===270){this.setMaxWidth(this.getMaxWidth()/r.x*r.y);this.setFontSize(this.getFontSize()/r.y*r.x);}}},{key:"setOption",value:function setOption(t,e){var _this$_options32=this._options,r=_this$_options32.flipHorizontally,o=_this$_options32.flipVertically;if(t==="rotation"){var n=e;if(r){n=Math.PI*2-n;}if(o){n=Math.PI*2-n;}this._options.rotation=n;if(this._textRenderer){this._textRenderer.rotation=n;}this._rotation=n;this.emit("update");return;}_get(_getPrototypeOf(mx.prototype),"setOption",this).call(this,t,e);}},{key:"getOption",value:function getOption(t){if(t==="rotation"){return this._rotation;}return _get(_getPrototypeOf(mx.prototype),"getOption",this).call(this,t);}},{key:"getHitTestDisplayObject",value:function getHitTestDisplayObject(){return this._hitTestSprite;}},{key:"update",value:function update(t,e){this._sprite.setVisible(this._options.visible);if(!this._options.visible)return;this._textRenderer.update(t,e);var r=this._textRenderer.getFinalTexture();var o=r.getBaseTexture();o.update();var n=t.getRenderer();if(n.isOfType("webgl")){n.updateTexture(r.getBaseTexture());}_get(_getPrototypeOf(mx.prototype),"update",this).call(this,t,e);this._sprite.setRotation(0);this._textRenderer.getTexture().getBaseTexture().update();this._hitTestSprite.setRotation(this._rotation);this._hitTestSprite.updateTransform();this._applyFlip();}},{key:"_applyFlip",value:function _applyFlip(){var t=this._sprite.getScale();var _this$_options33=this._options,e=_this$_options33.flipHorizontally,r=_this$_options33.flipVertically;if(e&&t.x>0||!e&&t.x<0){t.x*=-1;this.setRotation(this._rotation);}if(r&&t.y>0||!r&&t.y<0){t.y*=-1;this.setRotation(this._rotation);}this._sprite.setScale(t);}},{key:"_getTexture",value:function _getTexture(){return this._textRenderer.getFinalTexture();}},{key:"dispose",value:function dispose(){_get(_getPrototypeOf(mx.prototype),"dispose",this).call(this);this._textRenderer.dispose();this._hitTestSprite.dispose();this._sprite.dispose();}},{key:"canBeFlippedHorizontally",value:function canBeFlippedHorizontally(){return false;}},{key:"canAdjustPadding",value:function canAdjustPadding(){return false;}}]);return mx;}(On);mx.prototype.availableOptions={id:{type:"string","default":function _default(){return z.getUUID();}},fontSize:{type:"number","default":.1},characterSpacing:{type:"number","default":0},lineHeight:{type:"number","default":1.1},fontIdentifier:{type:"string"},fontFamily:{type:"string","default":"Times New Roman"},fontWeight:{type:"*","default":"normal"},fontStyle:{type:"string","default":"normal"},textMetrics:{type:"object","default":null},outlineWidth:{type:"number","default":0},outlineColor:{type:"color","default":G.BLACK},alignment:{type:"string","default":"left",available:["left","center","right"]},verticalAlignment:{type:"string","default":"top",available:["top","center","bottom"]},color:{type:"color","default":new G(1,0,0,1)},backgroundColor:{type:"color","default":G.TRANSPARENT},position:{type:"vector2","default":new $T(.5,.5)},anchor:{type:"vector2","default":new $T(0,0)},pivot:{type:"vector2","default":new $T(.5,.5)},rotation:{type:"number","default":0},text:{type:"string",required:true},maxWidth:{type:"number","default":.5},maxHeight:{type:"number","default":0},visible:{type:"boolean","default":true},flipHorizontally:{type:"boolean","default":false},flipVertically:{type:"boolean","default":false}};mx.type="text";px=mx;});var KT,Ks,QU;var t7=d(function(){$();$d();OT();X9();JU();ZU();KT=J.Vector2;Ks=/*#__PURE__*/function(_Lt15){_inherits(Ks,_Lt15);var _super182=_createSuper(Ks);function Ks(){var _this219;_classCallCheck(this,Ks);for(var _len103=arguments.length,t=new Array(_len103),_key103=0;_key103<_len103;_key103++){t[_key103]=arguments[_key103];}_this219=_super182.call.apply(_super182,[this].concat(t));_this219.setSmoothDownscaling(_this219._sdk.getOptions().smoothDownscaling);_this219._onSpriteUpdate=_this219._onSpriteUpdate.bind(_assertThisInitialized(_this219));_this219._maskCanvas=z.createCanvas();var e=_this219._options.sprites.slice();e.forEach(function(r){_this219.removeSprite(r);_this219.addSprite(r);});return _this219;}_createClass(Ks,[{key:"getSpritesOfType",value:function getSpritesOfType(t){return this._options.sprites.filter(function(e){return e instanceof t;});}},{key:"rotate",value:function rotate(t){this._options.sprites.forEach(function(e){e.applyRotation(t);});}},{key:"flip",value:function flip(t){this._options.sprites.forEach(function(e){e.applyFlip(t);});}},{key:"_onSpriteUpdate",value:function _onSpriteUpdate(t,e){this.emit("update",this);this.setDirty(true);}},{key:"_applyRotation",value:function _applyRotation(t,e){this._options.sprites.forEach(function(r){return r.applyRotation(t,e);});}},{key:"transform",value:function transform(t){this._options.sprites.forEach(function(e){return e.applyTransform(t);});}},{key:"scale",value:function scale(t){this._options.sprites.forEach(function(e){return e.applyScale(t);});}},{key:"serializeOption",value:function serializeOption(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(t==="sprites"){return this._options.sprites.map(function(r){return r.serializeOptions(void 0,e);});}return _get(_getPrototypeOf(Ks.prototype),"serializeOption",this).call(this,t,e);}},{key:"createSticker",value:function createSticker(t){return new A_(this,t);}},{key:"createText",value:function createText(t){return new px(this,t);}},{key:"createBrush",value:function createBrush(t){return new yc(this,t);}},{key:"createTextDesign",value:function createTextDesign(t){return new dx(this,t);}},{key:"addSprite",value:function addSprite(t){this._options.sprites.push(t);var e=this.getSmoothDownscaling();if(t.setSmoothDownscaling)t.setSmoothDownscaling(e);this._container.addChild(t.getDisplayObject());this.setDirty(true);t.on("update",this._onSpriteUpdate);this.emit("update",this,this._options.sprites);}},{key:"removeSprite",value:function removeSprite(t){var e=this._options.sprites;var r=e.indexOf(t);if(r!==-1){t.off("update",this._onSpriteUpdate);this._container.removeChild(t.getDisplayObject());e.splice(r,1);this.setDirty(true);return true;}return false;}},{key:"_getOrientatedStageSize",value:function _getOrientatedStageSize(){var t=this._sdk.getSprite().getTexture().getFrame();var e=this._sdk.getOperationsStack().getByIdentifier("orientation");if(e){var o=e?e.getRotation():0;var n=o===270||o===90;return n?new KT(t.height,t.width):new KT(t.width,t.height);}var r=this._sdk.getOperationsStack().getByIdentifier("output");if(r){return r.getOutputResolution();}return new KT(t.width,t.height);}},{key:"_render",value:function _render(t){var _this220=this;var e=this._container;var r=this._options.sprites;var o=t.getDimensions().clone().floor();var n=new L.Container();n.addChild(this._sprite);return Promise.all(r.map(function(s){return s.validateSettings();})).then(function(){r.forEach(function(s){return s.update(_this220._sdk,o);});}).then(function(){_this220._renderTexture.clear();r.forEach(function(s){if(s.getInverted&&s.getInverted()){_this220._renderTexture.render(n);_this220._renderTexture.render(_this220._renderMaskedSprite(s.getDisplayObject(),s.getColor?s.getColor():G.WHITE,s.getPadding?s.getPadding():-1));n=new L.Container();}else{n.addChild(s.getDisplayObject());}});_this220._renderTexture.render(n);e.addChild(_this220._sprite);r.forEach(function(s){return e.addChild(s.getDisplayObject());});});}},{key:"_renderMaskedSprite",value:function _renderMaskedSprite(t,e,r){var o=this._maskCanvas;var n=t.getWorldTransform();var s=this._getOrientatedStageSize();z.ensureCanvasDimensions(o,s);var a=o.getContext("2d");a.clearRect(0,0,o.width,o.height);a.save();a.fillStyle=e.toRGBA();if(r<0){a.fillRect(0,0,s.x,s.y);}else{var u=Math.abs(t.getWidth()/t.getScale().x);var m=Math.abs(t.getHeight()/t.getScale().y);var p=u*r;a.transform(n.a,n.b,n.c,n.d,n.tx,n.ty);a.fillRect(-p,-p,u+p*2,m+p*2);}a.restore();a.save();a.globalCompositeOperation="destination-out";t._renderCanvas({getCurrentRenderTarget:function getCurrentRenderTarget(){return{getPixelRatio:function getPixelRatio(){return 1;}};},beforeDraw:function beforeDraw(u){var m=t.getWidth();var p=t.getHeight();var h=t.getScale();var g=h.x<0;var x=h.y<0;u.translate(m,p);u.scale(g?-1:1,x?-1:1);u.translate(-m,-p);},getContext:function getContext(){return a;}});a.restore();var l=new L.Container();var c=new L.Sprite(L.Texture.fromCanvas(o));l.addChild(c);return l;}},{key:"takeSpriteToFront",value:function takeSpriteToFront(t){var e=this._options.sprites;var r=e.indexOf(t);if(r===-1)return;z.moveArrayItem(e,r,e.length-1);var o=t.getDisplayObject();this._container.removeChild(o);this._container.addChild(o);this.setDirty(true);}},{key:"getSpritesAtPosition",value:function getSpritesAtPosition(t,e){var _this221=this;var r=[];this._options.sprites.forEach(function(u){return u.update(_this221._sdk,e);});var o=this._sdk.getSprite();var n=o.getWorldTransform().applyInverseToVector(t);var _o$getTexture$getFram=o.getTexture().getFrame(),s=_o$getTexture$getFram.width,a=_o$getTexture$getFram.height;var l=o.getAnchor().clone().multiply(-s,-a);n.subtract(l);var c=this._options.sprites.slice(0).reverse();for(var u=0,m=c.length;u1&&arguments[1]!==undefined?arguments[1]:"y";return t/this._sizeFactor[e];}},{key:"applyToRotation",value:function applyToRotation(t){return(t+this._rotationDelta)%(Math.PI*2);}},{key:"invert",value:function invert(){var t=this._options.start.clone();var e=this._options.end.clone();var r=this._inputDimensions;var o=-this._rotationDelta;var n=Math.cos(o);var s=Math.sin(o);var a=this._oldAbsoluteSize;var l=this._newAbsoluteSize;var c=t.clone().subtract(e).multiply(r);var u=1/this._scaleRatio;var m=new e7(1/this._sizeFactor.x,1/this._sizeFactor.y);var p=1/this._textureScaleFactor;var h=this._oldOptions;this._oldOptions=this._options;this._options=h;this._inputDimensions=r;this._rotationDelta=o;this._deltaCos=n;this._deltaSin=s;this._oldAbsoluteSize=l;this._newAbsoluteSize=a;this._absoluteStartDiff=c;this._scaleRatio=u;this._sizeFactor=m;this._textureScaleFactor=p;return this;}}]);return i7;}();r7=i7;});var XT,om,n7;var s7=d(function(){$();o7();XT=J.Vector2;om=/*#__PURE__*/function(_Lt16){_inherits(om,_Lt16);var _super183=_createSuper(om);function om(){_classCallCheck(this,om);return _super183.apply(this,arguments);}_createClass(om,[{key:"_render",value:function _render(t){this._sprite.setRotation(0);var e=t.getDimensions();var _this$_options34=this._options,r=_this$_options34.start,o=_this$_options34.end,n=_this$_options34.rotation,s=_this$_options34.textureScale;var a=o.clone().subtract(r);var l=a.clone().divide(2);var c=r.clone().add(l);var u=this.calculateScale();var m=u*s;var p=e.clone().multiply(m).multiply(l);this._sprite.setAnchor(c);this._sprite.setRotation(n);this._sprite.setScale(m,m);this._sprite.setPosition(p);this._renderTexture.render(this._container);return Promise.resolve();}},{key:"calculateScale",value:function calculateScale(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._options.rotation;var e=this.getInputDimensions(false);var r=new XT(Math.abs(e.x*Math.cos(t))+Math.abs(e.y*Math.sin(t)),Math.abs(e.x*Math.sin(t))+Math.abs(e.y*Math.cos(t)));var o=e.clone().subtract(r.clone()).divide(2).abs();var n=1;if(o.y>o.x){n=o.y*2/e.y+1;}else{n=o.x*2/e.x+1;}return n;}},{key:"getNewDimensions",value:function getNewDimensions(t){var _this$_options35=this._options,e=_this$_options35.start,r=_this$_options35.end,o=_this$_options35.textureScale;var n=this.calculateScale();var s=t.clone().multiply(o*n).multiply(r.clone().subtract(e));return s.round();}},{key:"flip",value:function flip(t){var _this$_options36=this._options,e=_this$_options36.start,r=_this$_options36.end;var o=e.clone();if(t==="horizontal"){e.set(1-r.x,e.y);r.set(1-o.x,r.y);}else if(t==="vertical"){e.set(e.x,1-r.y);r.set(r.x,1-o.y);}}},{key:"rotate",value:function rotate(t){var _this$_options37=this._options,e=_this$_options37.start,r=_this$_options37.end;var o=(t+360)%360;var n=Math.floor(o/90);for(var s=0;s2&&arguments[2]!==undefined?arguments[2]:{};var r=this.fetch(i,t);if(!r){Y.info("Utils#translate","Unable to translate `".concat(t,"`"));return null;}for(var o in e){r=r.replace("${".concat(o,"}"),e[o]);}return r;},fetch:function fetch(i,t,e){t=t.replace(/\[(\w+)]/g,".$1");t=t.replace(/^\./,"");var r=t.split(".");for(var o=0;o2&&arguments[2]!==undefined?arguments[2]:null;if(!e)e=function e(o){return o;};var r=[];t.forEach(function(o){i.forEach(function(n){var s=e(n);if(s===o){r.push(n);}});});return r;},getJSONP:function getJSONP(i){var t=new ro(i);return t.load();},cloneCategories:function cloneCategories(i,t){return i.map(function(e){e=olt.clone(e);e[t]=e[t].slice(0);return e;});},mergeCategories:function mergeCategories(i,t,e){i=this.cloneCategories(i,e);var r=null;t.forEach(function(o){i.forEach(function(n){if(o.identifier===n.identifier){r=n;}});if(!r){i.push(o);}else{r[e]=r[e].concat(o[e]);}});return i;},wrapFiltersInCategories:function wrapFiltersInCategories(i,t){return i.map(function(e){var r=e;if(!(t in r)){r=_defineProperty({identifier:"imgly_filters_wrapped-".concat(e.identifier),displayFlat:true},t,[e]);}return r;});},getStyleObject:function getStyleObject(i){var t=window.getComputedStyle(i);var e={};for(var r in t){var o=t.getPropertyValue(r);var n=r.replace(/-([a-z])/g,function(s,a){return a.toUpperCase();});if(o!==""){e[n]=o;}}return e;},styleElement:function styleElement(i,t){for(var e in t){i.style[e]=t[e];}},debounce:function debounce(i,t,e){var r;return function(){var _this225=this;for(var _len105=arguments.length,o=new Array(_len105),_key105=0;_key105<_len105;_key105++){o[_key105]=arguments[_key105];}var n=function n(){r=null;if(!e)i.apply(_this225,o);};var s=e&&!r;clearTimeout(r);r=setTimeout(n,t);if(s)i.apply(this,o);};},getScrollbarWidth:function getScrollbarWidth(){var i=document.createElement("div");i.style.visibility="hidden";i.style.width="100px";i.style.msOverflowStyle="scrollbar";document.body.appendChild(i);var t=i.offsetWidth;i.style.overflow="scroll";var e=document.createElement("div");e.style.width="100%";i.appendChild(e);var r=e.offsetWidth;i.parentNode.removeChild(i);return t-r;},findIntegerFraction:function findIntegerFraction(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:100;var e=Number.MAX_VALUE;var r=0;var o=0;var n=1;var s=1;for(var a=0;a0){s++;}else{return new hx(n,s);}var c=Math.abs(n/s-i);if(c1&&arguments[1]!==undefined?arguments[1]:2;var e=i.toFixed(t);return parseFloat(e);},capitalize:function capitalize(i){return i.charAt(0).toUpperCase()+i.slice(1);},flipObject:function flipObject(i){var t={};for(var e in i){t[i[e]]=e;}return t;},Browser:C7};Ji=nlt;});var qT,Ut,m9t,zh,p9t,h9t,Jt,pl,YT,st,f9t,Dt,g9t,b9t,y9t;var ue=d(function(){Ln();ph();_d();zo();v7();w7();var _ft=ft;qT=_ft.Base64;var _ft2=ft;Ut=_ft2.Color;m9t=ft.Math.ColorMatrix;var _ft3=ft;zh=_ft3.EventEmitter;var _ft4=ft;p9t=_ft4.EXIF;var _ft5=ft;h9t=_ft5.OptionType;Jt=ft.Utils;var _ft6=ft;pl=_ft6.RenderType;var _ft7=ft;YT=_ft7.ImageFormat;st=ft;var _ft8=ft;f9t=_ft8.UniformType;Dt=ft.Math.Vector2;g9t=ft.Math.Rectangle;b9t=ft.Math.Range;y9t=typeof window!=="undefined"&&window.performance&&window.performance.now?window.performance.now.bind(window.performance):nh();});var _nm,Oc;var JT=d(function(){ue();_nm=/*#__PURE__*/function(){function nm(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;_classCallCheck(this,nm);this._ui=t;this._options=e;this._categoriesById={};this._filtersByIdentifier={identity:st.Operations.FilterOperation.Filters.IdentityFilter};this._categories=Ji.wrapFiltersInCategories(zs.DEFAULTS.FILTERS.slice(0),_nm.CATEGORY_ITEMS_PROPERTY);this._customAssetsAllowed=r||t.getEditor().getSDK()._l.areCustomAssetsAllowed();if(this._customAssetsAllowed&&this._options.categories){this._options.categories=Ji.wrapFiltersInCategories(this._options.categories,_nm.CATEGORY_ITEMS_PROPERTY);}this._initCategories();}_createClass(nm,[{key:"instantiateFilterWithIdentifier",value:function instantiateFilterWithIdentifier(t){var _this226=this;var e={value:this._ui._options.crossOrigin,cors:true};var r=this.getFilterByIdentifier(t);if(!r){return Promise.reject(new Error("Unknown filter with identifier `".concat(t,"`!")));}if(!(r.prototype instanceof st.Operations.FilterOperation.Filter)){var o=r.lutImage,n=r.resolution,s=r.horizontalTileCount,a=r.verticalTileCount;var l=r.lightColor,c=r.darkColor;if(l&&c){l=Ut.fromHex(l);c=Ut.fromHex(c);return Promise.resolve(new st.Operations.FilterOperation.Filters.DuoToneFilter({lightColor:l,darkColor:c}));}var u;if(this._ui.getPreloader){u=this._ui.getPreloader().getAsset(o);}var m;if(u){m=Promise.resolve(u);}else{m=Wi.loadImage(this._ui.getAssetPath(o),e);}return m.then(function(){return Wi.loadImage(_this226._ui.getAssetPath(o),e).then(function(p){return new st.Operations.FilterOperation.Filters.ThreeDLUTFilter({image:p,resolution:n,horizontalTileCount:s,verticalTileCount:a});});});}return Promise.resolve(new r());}},{key:"_initCategories",value:function _initCategories(){var _this227=this;if(this._customAssetsAllowed&&this._options.categories){if(this._options.replaceCategories){this._categories=Ji.wrapFiltersInCategories(this._options.categories,_nm.CATEGORY_ITEMS_PROPERTY);}else{this._categories=Ji.mergeCategories(this._categories,this._options.categories,_nm.CATEGORY_ITEMS_PROPERTY);}}if(this._customAssetsAllowed&&this._options.availableFilters){var e=[];this._categories.forEach(function(r){var o=r.filters.filter(function(n){return _this227._options.availableFilters.indexOf(n.identifier)!==-1;});if(o.length>0){e.push({identifier:r.identifier,defaultName:r.defaultName,filters:o});}});this._categories=e;}var t={identifier:"all",defaultName:"All",visible:false,filters:this._categories.length<=0?[]:this._categories.map(function(e){return e.filters;}).reduce(function(e,r){return e.concat(r);})};this._categories.unshift(t);this._categoriesById.all=t;this._categories.forEach(function(e){_this227._categoriesById[e.identifier]=e;});t.filters.forEach(function(e){_this227._filtersByIdentifier[e.identifier]=e;});}},{key:"getFiltersForCategory",value:function getFiltersForCategory(t){if(!this._categoriesById[t]){throw new Error("Unknown filter category '".concat(t,"'"));}return this._categoriesById[t].filters;}},{key:"getItemsByCategory",value:function getItemsByCategory(t){return this.getFiltersForCategory(t);}},{key:"getFilterByIdentifier",value:function getFilterByIdentifier(t){return this._filtersByIdentifier[t];}},{key:"getCategories",value:function getCategories(){return this._categories;}},{key:"getCategoryByIdentifier",value:function getCategoryByIdentifier(t){return this._categoriesById[t];}}]);return nm;}();Oc=_nm;q(Oc,"CATEGORY_ITEMS_PROPERTY","filters");});var Uh;var T7=d(function(){Ln();Uh=/*#__PURE__*/function(_t27){_inherits(Uh,_t27);var _super185=_createSuper(Uh);function Uh(){_classCallCheck(this,Uh);return _super185.apply(this,arguments);}return Uh;}(_t);Uh.prototype.availableOptions={fontFamily:{type:"string",required:true},variations:{type:"array",required:true}};});var slt,Rc;var ZT=d(function(){Ln();slt={100:"Extra Light",200:"Light",300:"Book",400:"Regular",500:"Medium",600:"Semibold",700:"Bold",800:"Black",900:"Extra Black",bold:"Bold",normal:"Regular"};Rc=/*#__PURE__*/function(_t28){_inherits(Rc,_t28);var _super186=_createSuper(Rc);function Rc(){_classCallCheck(this,Rc);return _super186.apply(this,arguments);}_createClass(Rc,[{key:"getLabel",value:function getLabel(){var t=slt[this._options.fontWeight];switch(this._options.fontStyle){case"italic":t+=" Italic";break;}return t;}}]);return Rc;}(_t);Rc.prototype.availableOptions={identifier:{type:"string",required:true},fontFamily:{type:"string",required:true},fontWeight:{type:"*","default":400},fontStyle:{type:"string","default":"normal"},textMetrics:{type:"object","default":null},provider:{type:"string",available:["google","file"]},filePath:{type:"string"},"default":{type:"boolean","default":false},font:{type:"object"}};});var Di;var hl=d(function(){ue();T7();ZT();zo();XC();Di=/*#__PURE__*/function(){function Di(t,e){_classCallCheck(this,Di);this._ui=t;this._options=e;this._fonts=[];this._variationsByIdentifier={};this._fontsByFontFamily={};this._initFonts();}_createClass(Di,[{key:"_initFonts",value:function _initFonts(){var _this228=this;var _this$_options39=this._options,t=_this$_options39.fonts,e=_this$_options39.replaceFonts,r=_this$_options39.availableVariations,o=_this$_options39.isTextDesign;var n=true;if(true){n=this._ui.getEditor().getSDK()._l.areCustomAssetsAllowed();}if(t&&n){t.forEach(function(_ref115,c){var l=_ref115.variations;if(l){l.forEach(function(u,m){if(us[u.identifier]){var p=hn(u.identifier,true);t[c].variations[m].identifier=p;var _pe$DEFAULTS$FONTS$fi=pe.DEFAULTS.FONTS.find(function(g){return g.variations.some(function(x){return x.identifier===p;});}),h=_pe$DEFAULTS$FONTS$fi.fontFamily;t[c].fontFamily=h;}});}});}var s=o?pe.DEFAULTS.TEXT_DESIGN_FONTS:pe.DEFAULTS.FONTS;if(n){if(e){s=t;}else{s=s.concat(t||[]);}}var a;s=s.map(function(l){var c=l.fontFamily;var u=l.variations;if(n&&r){u=u.filter(function(p){return r.indexOf(p.identifier)!==-1;});}if(u.length===0)return null;var m=new Uh({fontFamily:c});u=u.map(function(p){var h=new Rc(p);h.setFontFamily(c);h.setFont(m);if(p["default"]&&!a){a=h;}if(h.getTextMetrics()==null){Y.warn("Missing font metrics for ".concat(h.getIdentifier(),". The SDK will fall back to basic font rendering, which may lead to layout issues. Please provide font metrics for your custom fonts. See https://docs.photoeditorsdk.com/guides/html5/ for more details."));}_this228._variationsByIdentifier[h.getIdentifier()]=h;return h;});m.setVariations(u);_this228._fontsByFontFamily[c]=m;return m;}).filter(function(l){return l;});if(!a){var _s$0$getVariations=s[0].getVariations();var _s$0$getVariations2=_slicedToArray(_s$0$getVariations,1);a=_s$0$getVariations2[0];}this._defaultVariation=a;this._fonts=s;}},{key:"getFonts",value:function getFonts(){return this._fonts;}},{key:"getFontByFontFamily",value:function getFontByFontFamily(t){return this._fontsByFontFamily[t];}},{key:"getVariationByIdentifier",value:function getVariationByIdentifier(t){return this._variationsByIdentifier[hn(t)];}},{key:"getVariationsByIdentifier",value:function getVariationsByIdentifier(){return _objectSpread({},this._variationsByIdentifier);}},{key:"getDefaultVariation",value:function getDefaultVariation(){return this._defaultVariation;}}]);return Di;}();});var uo;var sm=d(function(){ue();uo=/*#__PURE__*/function(){function uo(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,uo);this._ui=t;this._options=e;this._defaultLayouts=st.Operations.SpriteOperation.TextDesignSprite.Layouts;this._legacyLayouts=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts;this._layouts=[];this._init();}_createClass(uo,[{key:"_init",value:function _init(){var t=this._options.availableLayouts;var e=_objectSpread(_objectSpread({},this._defaultLayouts),this._legacyLayouts);this._layouts=Object.keys(e).map(function(r){return{identifier:e[r].identifier,layout:e[r]};});if(t){t.push.apply(t,_toConsumableArray(Object.values(this._legacyLayouts).map(function(r){return r.identifier;})));this._layouts=this._layouts.filter(function(r){return t.indexOf(r.identifier)>=0;});}}},{key:"getLayoutByIdentifier",value:function getLayoutByIdentifier(t){var e=Jt.Array.find(this._layouts,function(r){return r.identifier===t;});return e&&e.layout;}},{key:"getLayouts",value:function getLayouts(){return _toConsumableArray(this._layouts);}},{key:"getDefaultLayout",value:function getDefaultLayout(){return this.getLayouts()[0];}}]);return uo;}();});var Ac;var QT=d(function(){ue();Ac=/*#__PURE__*/function(){function Ac(){_classCallCheck(this,Ac);}_createClass(Ac,null,[{key:"downloadDataURL",value:function downloadDataURL(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"photoeditorsdk-export";var r=this.createBlobURLFromDataURL(t);var o=this.getExtensionFromDataURL(t);var n=document.createElement("a");n.download="".concat(e,".").concat(o);n.href=r;document.body.appendChild(n);n.click();document.body.removeChild(n);}},{key:"downloadMSBlob",value:function downloadMSBlob(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"photoeditorsdk-export";if(navigator.msSaveBlob){navigator.msSaveBlob(t,"".concat(e,".png"));}}},{key:"getExtensionFromDataURL",value:function getExtensionFromDataURL(t){var e=t.split(",")[0].split(":")[1].split(";")[0];return e.split("/").pop();}},{key:"createBlobURLFromDataURL",value:function createBlobURLFromDataURL(t){if(!window.Blob||!window.URL||!ArrayBuffer||!Uint8Array){return t;}var e=qT.decode(t.split(",")[1]);var r=t.split(",")[0].split(":")[1].split(";")[0];var o=new ArrayBuffer(e.length);var n=new Uint8Array(o);for(var a=0;a1&&arguments[1]!==undefined?arguments[1]:true;var r=_typeof(t)==="object"?t.constructor.identifier:t;var o=this._stack.getStack();t=this.get(r);delete this._map[r];var n=o.map(function(s){return s.constructor.identifier;}).indexOf(r);if(n!==-1){this._stack.removeAt(n);for(var s=n+1;s1&&arguments[1]!==undefined?arguments[1]:{};if(this._map[t]){var n=this._map[t];n.set(e,false);return n;}var r=this._available[t];var o=new r(this._sdk,e);this.add(o);return o;}},{key:"getStack",value:function getStack(){return this._stack;}},{key:"reset",value:function reset(){this._map={};}},{key:"_fixStack",value:function _fixStack(){var _this231=this;var t=this._stack.getStack().slice();this._stack.clear();t.forEach(function(e){_this231.add(e);});}}]);return gx;}();});var bx;var D7=d(function(){ue();bx=/*#__PURE__*/function(){function bx(t,e,r){_classCallCheck(this,bx);this._image=t;this._maxPixels=e;this._maxDimensions=r;}_createClass(bx,[{key:"needsResize",value:function needsResize(){var t=new Dt(this._image.width,this._image.height);var e=t.x*t.y;var r=e>this._maxPixels;var o=this._maxDimensions!==null&&(t.x>this._maxDimensions||t.y>this._maxDimensions);return r||o;}},{key:"resize",value:function resize(){var _this232=this;var t=null;var e=null;var r=this._maxDimensions;return new Promise(function(o,n){window.setTimeout(function(){var s=new Dt(_this232._image.width,_this232._image.height);var a=s.clone();if(a.x*a.y>_this232._maxPixels){a.copy(_this232._getDimensionsByMaxPixels());t="maxMegaPixels";}if(r!==null&&(a.x>r||a.y>r)){var l=Math.min(r/a.x,r/a.y);a.multiply(l);t="maxDimensions";}a.floor();e=_this232._createResizedImageCanvas(a);o({canvas:e,dimensions:a,reason:t});},1e3);});}},{key:"_createResizedImageCanvas",value:function _createResizedImageCanvas(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:t;var r=this._image;var o=document.createElement("canvas");o.width=t.x;o.height=t.y;var n=t.clone().subtract(e).divide(2);var s=o.getContext("2d");s.drawImage(r,0,0,r.width,r.height,n.x,n.y,e.x,e.y);return o;}},{key:"_getDimensionsByMaxPixels",value:function _getDimensionsByMaxPixels(){var t=this._image;var e=this._maxPixels;var r=t.width/t.height;var o=t.height/t.width;return new Dt(Math.sqrt(e*r),Math.sqrt(e*o)).floor();}}]);return bx;}();});var alt,llt,Nh;var E7=d(function(){ZT();alt=30;llt="abcdefghijklmnopqrstuvwxzy";Nh=/*#__PURE__*/function(){function Nh(t){_classCallCheck(this,Nh);this._fontVariation=t||new Rc({fontFamily:"Times New Roman",fontWeight:"normal",fontStyle:"normal"});this._createRuler();}_createClass(Nh,[{key:"_createRuler",value:function _createRuler(){this._ruler=document.createElement("div");this._ruler.innerText=llt;document.body.appendChild(this._ruler);this._setRulerStyle();}},{key:"_setRulerStyle",value:function _setRulerStyle(){this._ruler.style.cssText="\n position: absolute;\n top: -9999px;\n left: -9999px;\n opacity: 0;\n display: inline-block;\n font: ".concat(this._fontVariation.getFontStyle()," ").concat(this._fontVariation.getFontWeight()," ").concat(alt,"px ").concat(this._fontVariation.getFontFamily(),";\n ");}},{key:"setFontVariation",value:function setFontVariation(t){this._fontVariation=t;this._setRulerStyle();}},{key:"getWidth",value:function getWidth(){return!this._ruler?-1:this._ruler.offsetWidth;}},{key:"dispose",value:function dispose(){if(this._ruler){this._ruler.parentNode.removeChild(this._ruler);this._ruler=null;}}}]);return Nh;}();});var F7,clt,ult,yx;var O7=d(function(){E7();F7=typeof window!=="undefined"&&window.performance&&window.performance.now?window.performance.now.bind(window.performance):nh();clt=50;ult=5e3;yx=/*#__PURE__*/function(){function yx(t){_classCallCheck(this,yx);this._fontVariation=t;this._defaultFontRuler=new Nh();this._customFontRuler=new Nh(this._fontVariation);}_createClass(yx,[{key:"observe",value:function observe(){var _this233=this;var t=F7();return new Promise(function(e,r){var o=window.setInterval(function(){var n=_this233._defaultFontRuler.getWidth()!==_this233._customFontRuler.getWidth();if(n){window.clearInterval(o);return e();}if(F7()-t>=ult){var s=new Error("Failed to load font ".concat(_this233._fontVariation.getFontFamily(),"."));s.font=_this233._fontVariation;return r(s);}},clt);});}},{key:"dispose",value:function dispose(){this._defaultFontRuler.dispose();this._customFontRuler.dispose();}}]);return yx;}();});var am;var t2=d(function(){Ln();O7();am=/*#__PURE__*/function(){function am(t){_classCallCheck(this,am);this._ui=t;this._fonts=[];this._observers=[];}_createClass(am,[{key:"add",value:function add(t){this._fonts.push(t);}},{key:"load",value:function load(){var _this234=this;if(this._fonts.length===0){return Promise.resolve();}this._observers=[];this._fonts.forEach(function(t){_this234._observers.push(new yx(t));});return z.executePromises(this._observers.map(function(t){return t.observe();}));}},{key:"dispose",value:function dispose(){this._observers.forEach(function(t){return t.dispose();});}}]);return am;}();});var _x;var R7=d(function(){t2();_x=/*#__PURE__*/function(_am){_inherits(_x,_am);var _super187=_createSuper(_x);function _x(){_classCallCheck(this,_x);return _super187.apply(this,arguments);}_createClass(_x,[{key:"load",value:function load(){return Promise.resolve();}}]);return _x;}(am);});var dlt,xx;var A7=d(function(){t2();dlt={italic:"i"};xx=/*#__PURE__*/function(_am2){_inherits(xx,_am2);var _super188=_createSuper(xx);function xx(){_classCallCheck(this,xx);return _super188.apply(this,arguments);}_createClass(xx,[{key:"load",value:function load(){if(this._fonts.length){this._addStylesheetTag();}return _get(_getPrototypeOf(xx.prototype),"load",this).call(this);}},{key:"_addStylesheetTag",value:function _addStylesheetTag(){var t=this._getFamiliesString();var e=document.createElement("link");e.rel="stylesheet";e.href="https://fonts.googleapis.com/css?family=".concat(t);var r=document.getElementsByTagName("head")[0];r.appendChild(e);}},{key:"_getFamiliesString",value:function _getFamiliesString(){var t={};this._fonts.forEach(function(r){var o=r.getFontFamily();var n=r.getFontStyle();var s=r.getFontWeight();t[o]=t[o]||[];if(typeof s!=="undefined"){t[o].push("".concat(s).concat(dlt[n]||""));}else{t[o].push(400);}});var e=[];for(var r in t){var o=t[r];var n=o.length?":".concat(o.join(",")):"";var s=r.replace(" ","+")+n;e.push(s);}return e.join("|");}}]);return xx;}(am);});var fl;var vx=d(function(){R7();A7();fl=/*#__PURE__*/function(){function fl(t,e){_classCallCheck(this,fl);this._ui=t;this._fonts=e;this._loadedFonts=[];}_createClass(fl,[{key:"setFonts",value:function setFonts(t){this._fonts=t;}},{key:"needsToLoad",value:function needsToLoad(){var _this235=this;var _loop5=function _loop5(t){var e=void 0;_this235._fonts[t].getVariations().forEach(function(r){e=e||r.getProvider();});if(!e)return"continue";return{v:true};};for(var t=0;t2&&arguments[2]!==undefined?arguments[2]:false;if(!this._assetsByGroupId[t]){this._assetsByGroupId[t]=[e];}else if(r){this._assetsByGroupId[t].unshift(e);}else{this._assetsByGroupId[t].push(e);}}},{key:"setAssets",value:function setAssets(t,e){this._assetsByGroupId[t]=e;}},{key:"getAssets",value:function getAssets(t){this._assetsByGroupId[t]=this._assetsByGroupId[t]||[];return this._assetsByGroupId[t];}}]);return P7;}();M7=P7;});var e2,gl;var Sx=d(function(){ue();Ln();L7();ph();Cd();e2="imgly_sticker_custom";gl=/*#__PURE__*/function(){function gl(t,e,r){_classCallCheck(this,gl);this._ui=t;this._options=e;this._dynamicAssetsLibrary=r||this._ui.getEditor().getDynamicAssetsLibrary()||new M7();this._categoriesById={};this._categories=[];this._stickersById={};this._customStickerCanvas=z.createCanvas();this.reload();}_createClass(gl,[{key:"reload",value:function reload(){this._categoriesById={};this._categories=[];this._stickersById={};var t=this._ui.getEditor().getSDK()._l.areCustomAssetsAllowed();this._addCategories(zs.DEFAULTS.STICKER_CATEGORIES);var _this$_options41=this._options,e=_this$_options41.categories,r=_this$_options41.replaceCategories;if(t&&this._options.categories){this._addCategories(e,r);}else{this._updateCategoriesMap();this._updateAllCategory();}if(t){var o=this._dynamicAssetsLibrary.getAssets("sticker");if(o.length>0){var n=this._createCustomStickerCategory(o);this._addCategories([n],false,true);}}}},{key:"loadExternal",value:function loadExternal(t){var _this238=this;var e=new ro(t);return e.load().then(function(r){_this238._addCategories(r.categories,_this238._options.replaceCategories);});}},{key:"_addCategories",value:function _addCategories(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(e){this._categories=t.slice(0);}else if(r){this._categories=this._mergeCategories(t,this._categories);}else{this._categories=this._mergeCategories(this._categories,t);}this._updateCategoriesMap();this._updateAllCategory();}},{key:"_mergeCategories",value:function _mergeCategories(t,e){t=Ji.cloneCategories(t,"stickers");var _iterator3=_createForOfIteratorHelper(e),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var r=_step3.value;var o=false;var _iterator4=_createForOfIteratorHelper(t),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var n=_step4.value;if(r.identifier===n.identifier){var _iterator5=_createForOfIteratorHelper(r.stickers),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var s=_step5.value;var a=false;var _iterator6=_createForOfIteratorHelper(n.stickers),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var l=_step6.value;if(s.identifier===l.identifier){Object.assign(l,s);a=true;break;}}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}if(!a){n.stickers.push(s);}}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}o=true;break;}}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}if(!o){t.push(r);}}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}return t;}},{key:"_updateCategoriesMap",value:function _updateCategoriesMap(){var _this239=this;this._categoriesById={};this._categories.forEach(function(t){_this239._categoriesById[t.identifier]=t;});this._categories.forEach(function(t){t.stickers.forEach(function(e){_this239._stickersById[e.identifier]=e;});});if(typeof this._options.availableStickers!=="undefined"&&this._options.availableStickers!==null){this._categories.forEach(function(t){if(t.identifier!==e2){t.stickers=t.stickers.filter(function(e){return _this239._options.availableStickers.indexOf(e.identifier)!==-1;});}});this._categories=this._categories.filter(function(t){return t.stickers.length>0;});}this._updateAllCategory();}},{key:"_updateAllCategory",value:function _updateAllCategory(){this._allCategory={identifier:"all",defaultName:"All",stickers:this._categories.map(function(t){return t.stickers;}).reduce(function(t,e){return t.concat(e);},[])};this._categoriesById.all=this._allCategory;}},{key:"renderStickerThumbnailFromImage",value:function renderStickerThumbnailFromImage(t){var e=this._customStickerCanvas;var r=e.getContext("2d");r.save();var o=62;var n=o/t.width;var s=n*t.height;e.width=o;e.height=o;r.clearRect(0,0,t.width,t.height);r.translate(0,.5*(e.height-s));r.scale(n,n);r.drawImage(t,0,0);var a=e.toDataURL("image/png");r.restore();return{data:a,width:o,height:s};}},{key:"addCustomStickerFromImage",value:function addCustomStickerFromImage(t,e){var _this240=this;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"none";var o=function o(b){var T=_this240._ui.getEditor().getSDK();var k=T.getRenderer();var E=new Dt(b.width,b.height);var A=_this240._ui.getEditor().getMaxMegapixels()*1e6;var I=k.getMaxDimensions();var F=E.x*E.y>A;var Z=I!==null&&(E.x>I||E.y>I);if(F){var pt=b.width/b.height;var yt=b.height/b.width;I=new Dt(Math.sqrt(A*pt),Math.sqrt(A*yt)).floor().max();}var et=E.clone();if(F||Z){if(E.x/E.y>1){et.x=I;et.y=I/E.x*E.y;}else{et.x=I/E.y*E.x;et.y=I;}}return et;};var n=function n(b,T){var k=b.x/b.y;if(k>1){return new Dt(T,T/k);}return new Dt(T*k,T);};var s=t.src.substring(0,14)==="data:image/svg";var a=this._ui.getEditor().getSDK();t=a.correctExifOrientation(t);var l=n(new Dt(t.width,t.height),2048);var c=s?l:o(t);var u=this._customStickerCanvas;var m=u.getContext("2d");m.save();var p=this.renderStickerThumbnailFromImage(t);if(s){if(t.width>t.height){u.width=2048;u.height=2048/t.width*t.height;}else{u.height=2048;u.width=2048/t.height*t.width;}t.width=u.width;t.height=u.height;}else{u.width=c.x;u.height=c.y;m.scale(c.x/t.width,c.y/t.height);}m.drawImage(t,0,0,t.width,t.height);var h=u.toDataURL();m.restore();var g={identifier:z.generateUUID(),defaultName:e||"",tintMode:r,images:{mediaThumb:{uris:[p.data],rawData:true,width:p.width,height:p.height},mediaBase:{uris:s?[h,t.src]:[h],rawData:true,isSVG:s,width:c.x,height:c.y}}};var x=this._dynamicAssetsLibrary;x.addAsset("sticker",g,true);var v=x.getAssets("sticker");if(v.length===1){var b=this._createCustomStickerCategory(v);this._addCategories([b],false,true);}else{this.getCategory(e2).stickers=v;this._updateAllCategory();}this._updateCategoriesMap();}},{key:"_createCustomStickerCategory",value:function _createCustomStickerCategory(t){return{identifier:e2,defaultName:"Custom",metaData:{backgroundImage:t[t.length-1].images.mediaBase.uris[0],rawData:true},stickers:t};}},{key:"getStickersForCategory",value:function getStickersForCategory(t){if(!this._categoriesById[t]){throw new Error("Unknown sticker category '".concat(t,"'"));}return this._categoriesById[t].stickers;}},{key:"getStickerByIdentifier",value:function getStickerByIdentifier(t){return this._stickersById[t];}},{key:"getCategories",value:function getCategories(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(t){return[this._allCategory].concat(this._categories);}return this._categories;}},{key:"getCategory",value:function getCategory(t){return this._categoriesById[t];}}],[{key:"getURLForSticker",value:function getURLForSticker(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"base";var r=t.images;var o=e==="base"?r.mediaBase||r.mediaThumb:r.mediaThumb;var n=o.uris||[o.uri];if(true){if(!Ji.Browser.getIEVersion()){var a=n.filter(function(l){return /\.svg$/i.test(l);});return a.length?a[0]:n[0];}}var s=n.filter(function(a){return!/\.svg$/i.test(a);});return s.length?s[0]:n[0];}}]);return gl;}();});var z7,i2,Bc;var r2=d(function(){ue();vx();B7();JT();hl();Sx();z7=y(Ju());if(typeof st.Operations.SpriteOperation!=="undefined"){i2=st.Operations.SpriteOperation.BrushSprite;}Bc=/*#__PURE__*/function(){function Bc(t,e){_classCallCheck(this,Bc);this._editor=t;this._ui=this._editor.getUI();this._data=e;this._filterManager=new Oc(this._ui,this._getOptions("filter"));this._stickerManager=new gl(this._ui,this._getOptions("sticker"));this._brushManager=new Cx(this._ui,this._getOptions("brush"));this._fontManager=new Di(this._ui,this._getOptions("text"));}_createClass(Bc,[{key:"_getOptions",value:function _getOptions(t){var e=this._editor.controls;var r={};if(e&&e.get(t)){r=e.get(t).defaultOptions;}var o=this._editor.getOptions();return Jt.deepDefaults({},o.editor.controlsOptions[t]||{},r);}},{key:"deserialize",value:function deserialize(){var _this241=this;return this._validateVersion().then(function(){return _this241._deserializeInputImage();}).then(function(){return _this241._deserializeOperations();});}},{key:"_validateVersion",value:function _validateVersion(){if(this._data.version!==this.constructor.version){return Promise.reject(new Error("Invalid version ".concat(this._data.version,", expected ").concat(this.constructor.version)));}return Promise.resolve();}},{key:"_deserializeInputImage",value:function _deserializeInputImage(){var _this242=this;return new Promise(function(t,e){var _this242$_data$inputI=_this242._data.inputImage,r=_this242$_data$inputI.data,o=_this242$_data$inputI.type;if(r&&o){var n=new window.Image();n.addEventListener("load",function(){_this242._editor.setImage(n);t();});n.src="data:".concat(o,";base64,").concat(r);}else{t();}});}},{key:"_deserializeOperations",value:function(){var _deserializeOperations2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee11(){var _this243=this;var t;return regeneratorRuntime.wrap(function _callee11$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:t=this._data.operations;return _context12.abrupt("return",(0,z7["default"])(t,/*#__PURE__*/function(){var _ref116=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee10(e){return regeneratorRuntime.wrap(function _callee10$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:return _context11.abrupt("return",_this243._deserializeOperation(e));case 1:case"end":return _context11.stop();}}},_callee10);}));return function(_x18){return _ref116.apply(this,arguments);};}()));case 2:case"end":return _context12.stop();}}},_callee11,this);}));function _deserializeOperations(){return _deserializeOperations2.apply(this,arguments);}return _deserializeOperations;}()},{key:"_deserializeOperation",value:function _deserializeOperation(t){switch(t.type){case"crop":return this._deserializeCropOperation(t);case"orientation":return this._deserializeOrientationOperation(t);case"filter":return this._deserializeFilterOperation(t);case"adjustments":return this._deserializeAdjustmentsOperation(t);case"sprite":return this._deserializeSpriteOperation(t);case"focus":return this._deserializeFocusOperation(t);}}},{key:"_deserializeCropOperation",value:function _deserializeCropOperation(t){var e=t.options;var r=e.rotation;var o=Dt.fromObject(e.start);var n=Dt.fromObject(e.end);if(r>Math.PI){r-=Math.PI*2;}var s={start:o,end:n};if(typeof r!=="undefined"){s.rotation=r;}var a=this._editor.operations.getOrCreate("transform");this._editor.broadcastTransform(a,s);a.set(s);return Promise.resolve(a);}},{key:"_deserializeOrientationOperation",value:function _deserializeOrientationOperation(t){var e=t.options;var r=this._editor.operations.getOrCreate("orientation");if(!r)return Promise.resolve();r.set(e);return Promise.resolve(r);}},{key:"_deserializeFilterOperation",value:function _deserializeFilterOperation(t){var _this244=this;var e=t.options;if(!this._filterManager.getFilterByIdentifier(e.name)){Y.warn("Deserializer","Unknown filter `".concat(e.name,"`"));return Promise.resolve();}return this._filterManager.instantiateFilterWithIdentifier(e.name).then(function(r){var o=_this244._editor.operations.getOrCreate("filter");o.set({identifier:e.name,filter:r,intensity:e.intensity});return o;});}},{key:"_deserializeAdjustmentsOperation",value:function _deserializeAdjustmentsOperation(t){var e=st.Operations.AdjustmentsOperation;var r=t.options;var o=["brightness","saturation","contrast","exposure","shadows","highlights","clarity"];var n={};o.forEach(function(s){if(typeof r[s]==="undefined")return;var _e$prototype$availabl=e.prototype.availableOptions[s],a=_e$prototype$availabl.minValue,l=_e$prototype$availabl.midValue,c=_e$prototype$availabl.maxValue;var u=r[s];u=u<0?l+(l-a)*u:l+(c-l)*u;n[s]=u;});return Promise.resolve(this._editor.operations.getOrCreate("adjustments",n));}},{key:"_deserializeSpriteOperation",value:function _deserializeSpriteOperation(t){var _this245=this;var e=t.options;var r=this._editor.operations.getOrCreate("sprite");if(!r)return Promise.resolve();var o=e.sprites.map(function(n){return _this245._deserializeSprite(r,n);}).filter(function(n){return n;});return Promise.all(o).then(function(n){r.setSprites(n.filter(function(s){return s;}));return r;});}},{key:"_deserializeSprite",value:function _deserializeSprite(t,e){switch(e.type){case"sticker":return this._deserializeSticker(t,e);case"text":return this._deserializeText(t,e);case"brush":return this._deserializeBrush(t,e);case"textdesign":return this._deserializeTextDesign&&this._deserializeTextDesign(t,e);}}},{key:"_deserializeSticker",value:function _deserializeSticker(t,e){var _this246=this;var r=st.Operations.SpriteOperation;var o=e.options;var n=this._stickerManager.getStickerByIdentifier(o.name);var s=this._stickerManager.getURLForSticker(n);if(!n){Y.warn("Deserializer","Unknown sticker '".concat(o.name,"'. Skipping sprite."));return Promise.resolve();}return new Promise(function(a,l){var c=new window.Image();c.addEventListener("load",function(){var u=r.StickerSprite.prototype.availableOptions.adjustments.structure;var m=o.rotation,p=o.flipHorizontally,h=o.flipVertically;var g={identifier:o.name,image:c,position:Dt.fromObject(o.position),dimensions:Dt.fromObject(o.dimensions),rotation:m,flipHorizontally:p,flipVertically:h,adjustments:{}};if(typeof o.adjustments!=="undefined"){["brightness","contrast","saturation"].forEach(function(x){if(typeof o.adjustments[x]!=="undefined"){g.adjustments[x]=o.adjustments[x]+u[x]["default"];}});}a(t.createSticker(g));});c.crossOrigin=_this246._editor.getCrossOrigin();c.src=_this246._editor.getUI().getAssetPath(s);});}},{key:"_deserializeText",value:function _deserializeText(t,e){var r=e.options;var o=r.fontSize,n=r.lineHeight,s=r.fontFamily,a=r.fontWeight,l=r.alignment,c=r.rotation,u=r.maxWidth,m=r.color,p=r.backgroundColor;var h=new fl(this._ui);var g=this._fontManager.getFontByFontFamily(s);if(!g)g=this._fontManager.getDefaultFont();h.setFonts([g]);return h.load().then(function(){var x=t.createText({fontSize:o,lineHeight:n,fontFamily:s,fontWeight:a,alignment:l,rotation:c,maxWidth:u,text:r.text,color:Ut.fromArray(m),backgroundColor:Ut.fromArray(p),position:Dt.fromObject(r.position)});x._edited=true;return x;});}},{key:"_deserializeBrush",value:function _deserializeBrush(t,e){var _this247=this;var r=e.options;var o=r.paths;var n=t.createBrush();o.forEach(function(s){_this247._deserializeBrushPath(n,s);});return Promise.resolve(n);}},{key:"_deserializeBrushPath",value:function _deserializeBrushPath(t,e){var r=e.points;var o=this._createBrushForPath(e);var n=t.createPath(o);n.setClosed(true);r.forEach(function(s){n.addControlPoint(Dt.fromObject(s));});}},{key:"_createBrushForPath",value:function _createBrushForPath(t){var e=t.color,r=t.size;var o=Ut.fromArray(e);var n={color:o,size:r};var s=this._brushManager.getFirstBrush();if(s.prototype&&s.prototype instanceof i2){var c=s;return new c(n);}var a=_objectSpread({},s);delete a.image;var l=/*#__PURE__*/function(_i3){_inherits(l,_i3);var _super189=_createSuper(l);function l(){_classCallCheck(this,l);return _super189.apply(this,arguments);}return l;}(i2);l.identifier=s.identifier;return new l(_objectSpread(_objectSpread({},a),n));}},{key:"_deserializeFocusOperation",value:function _deserializeFocusOperation(t){var e=t.options.options;switch(t.options.type){case"radial":{var r=e.position,o=e.radius,n=e.gradientRadius,s=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("radial-focus",{position:Dt.fromObject(r),radius:o,gradientRadius:n,blurRadius:s}));}case"linear":{var _r8=e.start,_o8=e.end,_n6=e.size,_s5=e.gradientSize,a=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("mirrored-focus",{start:Dt.fromObject(_r8),end:Dt.fromObject(_o8),size:_n6,gradientSize:_s5,blurRadius:a}));}}}},{key:"_getInputDimensionsForOperation",value:function _getInputDimensionsForOperation(t){var e=false;var r=this._editor.getInputDimensions();this._editor.operations.getStack().forEach(function(o){if(o===t)e=true;if(e)return;r=o.getNewDimensions(r);});return r;}}]);return Bc;}();Bc.version="1.0.0";});var lm,Pc;var o2=d(function(){ue();lm=Math.PI*2;Pc=/*#__PURE__*/function(){function Pc(t){_classCallCheck(this,Pc);this._editor=t;this._serializeOperations=this._serializeOperations.bind(this);}_createClass(Pc,[{key:"serialize",value:function serialize(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._options=_objectSpread(_objectSpread({},t),{},{image:true});var e={version:this.constructor.version};return this._serializeInputImage(e).then(this._serializeOperations);}},{key:"_serializeInputImage",value:function _serializeInputImage(t){var e=this._editor.getImage();var r=e.width,o=e.height;if(!this._options.image){t.inputImage={width:r,height:o};return Promise.resolve(t);}var n=Jt.createCanvas();n.width=e.width;n.height=e.height;var s=n.getContext("2d");s.drawImage(e,0,0);var a=n.toDataURL(YT.PNG);t.inputImage={type:YT.PNG,data:a.replace(/^data:image\/(.*?);base64,/,""),width:r,height:o};return Promise.resolve(t);}},{key:"_serializeOperations",value:function _serializeOperations(t){var _this248=this;var e=[];var r=this._editor.operations.getStack();r.forEach(function(o){var n=_this248._serializeOperation(o,e);if(n){e.push(n);}});t.operations=e.filter(function(o){return o;});return Promise.resolve(t);}},{key:"_serializeOperation",value:function _serializeOperation(t,e){switch(t.constructor.identifier){case"transform":return this._serializeTransformOperation(t);case"orientation":return this._serializeOrientationOperation(t);case"filter":return this._serializeFilterOperation(t);case"adjustments":return this._serializeAdjustmentsOperation(t);case"sprite":return this._serializeSpriteOperation(t,e);case"radial-focus":return this._serializeRadialFocusOperation(t);case"mirrored-focus":return this._serializeLinearFocusOperation(t);default:Y.warn("Unable to serialize operation of type ".concat(t.constructor.identifier));}}},{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=t.serializeOptions(["start","end","rotation"],true);e.rotation=(e.rotation+lm)%lm;return{type:"crop",options:e};}},{key:"_serializeOrientationOperation",value:function _serializeOrientationOperation(t){return{type:"orientation",options:t.serializeOptions(["flipVertically","flipHorizontally","rotation"],true)};}},{key:"_serializeFilterOperation",value:function _serializeFilterOperation(t){if(t.getIdentifier()==="identity")return null;return{type:"filter",options:{intensity:t.getIntensity(),name:t.getIdentifier()}};}},{key:"_serializeAdjustmentsOperation",value:function _serializeAdjustmentsOperation(t){var e=t.availableOptions;var r=["brightness","saturation","contrast","exposure","shadows","highlights","clarity"];var o={};r.forEach(function(n){var s=e[n];var a=t.getOption(n);var l=s.minValue,c=s.midValue,u=s.maxValue;o[n]=a<=c?(a-l)/(c-l)-1:(a-c)/(u-c);});return{type:"adjustments",options:o};}},{key:"_serializeSpriteOperation",value:function _serializeSpriteOperation(t,e){var _this249=this;var r=e.filter(function(s){return s.type==="sprite";});var o;var n=true;if(r.length){o=r.pop();n=false;}else{o={type:"sprite",options:{sprites:[]}};}t.getSprites().forEach(function(s){var a=null;if(s instanceof t.constructor.StickerSprite){a=_this249._serializeSticker(t,s);}else if(s instanceof t.constructor.TextSprite){a=_this249._serializeText(t,s);}else if(s instanceof t.constructor.BrushSprite){a=_this249._serializeBrush(t,s);}else if(s instanceof t.constructor.TextDesignSprite){a=_this249._serializeTextDesign&&_this249._serializeTextDesign(t,s);}if(a){o.options.sprites.push(a);}});if(n){return o;}}},{key:"_serializeSticker",value:function _serializeSticker(t,e){var r=e.getAdjustments();var o=e.serializeOptions(["identifier","position","dimensions","flipVertically","flipHorizontally","rotation"],true);o.name=o.identifier;delete o.identifier;o.rotation=(o.rotation+lm)%lm;var n=r.availableOptions;o.adjustments={brightness:r.getBrightness()-n.brightness["default"],saturation:r.getSaturation()-n.saturation["default"],contrast:r.getContrast()-n.contrast["default"]};return{type:"sticker",options:o};}},{key:"_serializeText",value:function _serializeText(t,e){var r=e.serializeOptions(["fontSize","lineHeight","fontFamily","fontWeight","alignment","color","backgroundColor","position","rotation","text","maxWidth"],true);r.rotation=(r.rotation+lm)%lm;return{type:"text",options:r};}},{key:"_serializeBrush",value:function _serializeBrush(t,e){var _this250=this;return{type:"brush",options:{paths:e.getPaths().map(function(r){return _this250._serializePath(r);})}};}},{key:"_serializePath",value:function _serializePath(t){var e=t.getBrush().serializeOptions(["color","size"],true);e.points=t.getControlPoints().map(function(r){return r.getPosition().toObject();});return e;}},{key:"_serializeRadialFocusOperation",value:function _serializeRadialFocusOperation(t){return{type:"focus",options:{type:"radial",options:t.serializeOptions(["position","radius","gradientRadius","blurRadius"],true)}};}},{key:"_serializeLinearFocusOperation",value:function _serializeLinearFocusOperation(t){return{type:"focus",options:{type:"linear",options:t.serializeOptions(["start","end","blurRadius","size","gradientSize"],true)}};}},{key:"_getInputDimensionsForOperation",value:function _getInputDimensionsForOperation(t){var e=false;var r=this._editor.getInputDimensions();this._editor.operations.getStack().forEach(function(o){if(o===t)e=true;if(e)return;r=o.getNewDimensions(r);});return r;}}]);return Pc;}();Pc.version="1.0.0";});var U7={};de(U7,{"default":function _default(){return wx;}});var wx;var N7=d(function(){r2();o2();wx=/*#__PURE__*/function(){function wx(t){_classCallCheck(this,wx);this._editor=t;}_createClass(wx,[{key:"serialize",value:function serialize(){var e=new Pc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Bc(this._editor,t);return e.deserialize();}}]);return wx;}();wx.version="1.0.0";});var Mc;var n2=d(function(){ue();r2();Mc=/*#__PURE__*/function(_Bc){_inherits(Mc,_Bc);var _super190=_createSuper(Mc);function Mc(){_classCallCheck(this,Mc);return _super190.apply(this,arguments);}_createClass(Mc,[{key:"_deserializeOperation",value:function _deserializeOperation(t){if(t.type==="selective-blur"){return this._deserializeSelectiveBlurOperation(t);}return _get(_getPrototypeOf(Mc.prototype),"_deserializeOperation",this).call(this,t);}},{key:"_deserializeCropOperation",value:function _deserializeCropOperation(t){var e=t.options;var r=e.rotation;var o=Dt.fromObject(e.start);var n=Dt.fromObject(e.end);var s=e.dimensions?Dt.fromObject(e.dimensions):null;if(n.x-o.x<=0||n.y-o.y<=0){throw new Error("A crop should not result in negative or zero dimensions - start: ".concat(o," - end: ").concat(n));}if(r>Math.PI){r-=Math.PI*2;}var a={start:o,end:n};if(typeof r!=="undefined")a.rotation=r;var l=this._editor.operations.getOrCreate("transform");if(!l)return Promise.resolve();this._editor.broadcastTransform(l,a);l.set(a);if(s){var c=n.clone().subtract(o);var u=l.getInputDimensions(false).multiply(c);l.setTextureScale(s.x/u.x);}return Promise.resolve(l);}}]);return Mc;}(Bc);Mc.version="1.0.1";});var H7,Lc;var s2=d(function(){o2();H7=Math.PI*2;Lc=/*#__PURE__*/function(_Pc){_inherits(Lc,_Pc);var _super191=_createSuper(Lc);function Lc(){_classCallCheck(this,Lc);return _super191.apply(this,arguments);}_createClass(Lc,[{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=t.serializeOptions(["start","end","rotation","textureScale"],true);e.rotation=(e.rotation+H7)%H7;if(e.textureScale!==1){e.dimensions=t.getNewDimensions(t.getInputDimensions(false));}delete e.textureScale;return{type:"crop",options:e};}}]);return Lc;}(Pc);Lc.version="1.0.1";});var W7={};de(W7,{"default":function _default(){return Tx;}});var Tx;var G7=d(function(){n2();s2();Tx=/*#__PURE__*/function(){function Tx(t){_classCallCheck(this,Tx);this._editor=t;}_createClass(Tx,[{key:"serialize",value:function serialize(){var e=new Lc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Mc(this._editor,t);return e.deserialize();}}]);return Tx;}();Tx.version="1.0.1";});var cm,Hh;var V7=d(function(){_d();ue();var _st2=st;cm=_st2.OptionType;Hh=/*#__PURE__*/function(_st$Configurable){_inherits(Hh,_st$Configurable);var _super192=_createSuper(Hh);function Hh(t){var _this251;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Hh);_this251=_super192.call(this,e);_this251._loaded=false;_this251._loading=false;_this251._ui=t;_this251._frame=st.Utils.deepClone(_this251._options);return _this251;}_createClass(Hh,[{key:"load",value:function load(){var _this252=this;if(this._loaded)return Promise.resolve();if(this._loading)return Promise.reject(new Error("Called Frame#load while it's already loading"));this._loading=true;var t=this._frame.imageGroups;var e=[];["top","left","right","bottom"].forEach(function(r){if(!(r in t))return;var o=t[r];["start","mid","end"].forEach(function(n){if(!(n in o))return;e.push(_this252._loadPart(r,n));});});return Promise.all(e).then(function(){_this252._loaded=true;_this252._loading=false;})["catch"](function(r){_this252._loaded=false;_this252._loading=false;});}},{key:"_loadPart",value:function _loadPart(t,e){var _this253=this;var r=this._frame.imageGroups;var o=r[t][e];var n=o;if(typeof o!=="string"&&"image"in o){n=o.image;}return Wi.load(this._ui.getAssetPath(n)).then(function(s){if(typeof o!=="string"){_this253._frame.imageGroups[t][e].image=s;}else{_this253._frame.imageGroups[t][e]=s;}return s;});}},{key:"getFrame",value:function getFrame(){return this._frame;}}]);return Hh;}(st.Configurable);Hh.prototype.availableOptions={identifier:{type:cm.STRING,required:true},defaultName:{type:cm.STRING},thumbnail:{type:cm.STRING},tintable:{type:cm.BOOLEAN,"default":false},layoutMode:{type:cm.STRING,"default":"horizontal-inside",available:["horizontal-inside","vertical-inside"]},imageGroups:{type:cm.OBJECT,required:true}};});var kx;var j7=d(function(){ue();kx=/*#__PURE__*/function(){function kx(t,e){_classCallCheck(this,kx);this._ui=t;this._options=e;this._categoriesById={};this._categories=[];this._framesById={};this._addCategories(zs.DEFAULTS.FRAME_CATEGORIES);this._customAssetsAllowed=t.getEditor().getSDK()._l.areCustomAssetsAllowed();var _this$_options42=this._options,r=_this$_options42.categories,o=_this$_options42.replaceCategories;if(this._customAssetsAllowed&&this._options.categories){this._addCategories(r,o);}else{this._updateAllCategory();}}_createClass(kx,[{key:"_addCategories",value:function _addCategories(t){var _this254=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(e){this._categories=t.slice(0);}else{this._categories=Ji.mergeCategories(this._categories,t,"frames");}this._categoriesById={};this._categories.forEach(function(o){_this254._categoriesById[o.identifier]=o;});var r=this._options.availableFrames;if(this._customAssetsAllowed&&r){this._categories.forEach(function(o){o.frames=o.frames.filter(function(n){return r.indexOf(n.identifier)!==-1;});});}this._categories.forEach(function(o){o.frames.forEach(function(n){_this254._framesById[n.identifier]=n;});});this._updateAllCategory();}},{key:"_updateAllCategory",value:function _updateAllCategory(){this._allCategory={identifier:"all",defaultName:"All",frames:this._categories.map(function(t){return t.frames;}).reduce(function(t,e){return t.concat(e);},[])};this._categoriesById.all=this._allCategory;}},{key:"getFramesForCategory",value:function getFramesForCategory(t){if(!this._categoriesById[t]){throw new Error("Unknown frame category '".concat(t,"'"));}return this._categoriesById[t].frames;}},{key:"getFrameByIdentifier",value:function getFrameByIdentifier(t){return this._framesById[t];}},{key:"getCategories",value:function getCategories(){return this._categories;}},{key:"getCategory",value:function getCategory(t){return this._categoriesById[t];}}]);return kx;}();});var Ix;var $7=d(function(){ue();Ix=/*#__PURE__*/function(){function Ix(t,e){var _this255=this;_classCallCheck(this,Ix);this._ui=t;this._options=e;this._overlays=zs.DEFAULTS.OVERLAYS.slice(0);this._overlaysByIdentifier={};var r=t.getEditor().getSDK()._l.areCustomAssetsAllowed();if(r&&e.overlays){if(e.replaceOverlays){this._overlays=e.overlays;}else{this._overlays=this._overlays.concat(e.overlays);}}if(r&&e.availableOverlays){this._overlays=this._overlays.filter(function(o){return e.availableOverlays.indexOf(o.identifier)!==-1;});}this._overlays.forEach(function(o){_this255._overlaysByIdentifier[o.identifier]=o;});}_createClass(Ix,[{key:"getOverlays",value:function getOverlays(){return this._overlays;}},{key:"getOverlayByIdentifier",value:function getOverlayByIdentifier(t){return this._overlaysByIdentifier[t];}}]);return Ix;}();});var Xs,um;var Dx=d(function(){var _um;ue();Xs=st.Engine.Filters.OverlayFilter;um=(_um={},_defineProperty(_um,Xs.BLEND_MODES.NORMAL,"normal"),_defineProperty(_um,Xs.BLEND_MODES.OVERLAY,"overlay"),_defineProperty(_um,Xs.BLEND_MODES.HARD_LIGHT,"hard light"),_defineProperty(_um,Xs.BLEND_MODES.SOFT_LIGHT,"soft light"),_defineProperty(_um,Xs.BLEND_MODES.MULTIPLY,"multiply"),_defineProperty(_um,Xs.BLEND_MODES.DARKEN,"darken"),_defineProperty(_um,Xs.BLEND_MODES.LIGHTEN,"lighten"),_defineProperty(_um,Xs.BLEND_MODES.SCREEN,"screen"),_defineProperty(_um,Xs.BLEND_MODES.COLOR_BURN,"color burn"),_um);});var mlt,zc;var a2=d(function(){ue();vx();V7();_d();j7();$7();Sx();n2();Dx();mlt=Jt.flipObject(um);zc=/*#__PURE__*/function(_Mc){_inherits(zc,_Mc);var _super193=_createSuper(zc);function zc(){var _this256;_classCallCheck(this,zc);for(var _len106=arguments.length,t=new Array(_len106),_key106=0;_key106<_len106;_key106++){t[_key106]=arguments[_key106];}_this256=_super193.call.apply(_super193,[this].concat(t));_this256._frameManager=new kx(_this256._ui,_this256._getOptions("frame"));var e=_this256._getOptions("overlay");if(e){_this256._overlayManager=new Ix(_this256._ui,e);}return _this256;}_createClass(zc,[{key:"_deserializeSprite",value:function _deserializeSprite(t,e){if(e.type==="frame"){return this._deserializeFrame(t,e);}if(e.type==="overlay"){return this._deserializeOverlay(t,e);}return _get(_getPrototypeOf(zc.prototype),"_deserializeSprite",this).call(this,t,e);}},{key:"_deserializeOperation",value:function _deserializeOperation(t){if(t.type==="transform"){return this._deserializeTransformOperation(t);}return _get(_getPrototypeOf(zc.prototype),"_deserializeOperation",this).call(this,t);}},{key:"_deserializeOrientationOperation",value:function _deserializeOrientationOperation(t){if(this._data.meta&&this._data.meta.platform!=="html5"){return _get(_getPrototypeOf(zc.prototype),"_deserializeOrientationOperation",this).call(this,t);}var _t$options=t.options,e=_t$options.rotation,r=_t$options.flipHorizontally,o=_t$options.flipVertically;var n=e===90&&!r&&!o;n|=e===90&&r&&o;n|=e===270&&!r&&!o;n|=e===270&&r&&o;if(n){t.options.flipHorizontally=!t.options.flipHorizontally;t.options.flipVertically=!t.options.flipVertically;}return _get(_getPrototypeOf(zc.prototype),"_deserializeOrientationOperation",this).call(this,t);}},{key:"_deserializeTransformOperation",value:function _deserializeTransformOperation(t){var _this257=this;return _get(_getPrototypeOf(zc.prototype),"_deserializeCropOperation",this).call(this,t).then(function(e){if(!e)return;var r=Jt.Array.find(_this257._data.operations,function(o){return o.type==="orientation";});if(r){var o=r.options;var n=o.rotation,s=o.flipHorizontally,a=o.flipVertically;if(n===90||n===270){if(!s&&a||s&&!a){s=!s;a=!a;}}e.rotate(o.rotation);if(s){e.flip("horizontal");e.setRotation(e.getRotation()*-1);}if(a){e.flip("vertical");e.setRotation(e.getRotation()*-1);}}return e;});}},{key:"_deserializeFrame",value:function _deserializeFrame(t,e){var _this258=this;var r=e.options.identifier;var o=this._frameManager.getFrameByIdentifier(r);if(!o){Y.warn("Deserializer","Unknown frame `".concat(r,"`. Skipping frame."));return Promise.resolve();}var n=new Hh(this._ui,o);return n.load().then(function(){_this258._editor.operations.getOrCreate("frame",{frame:n.getFrame()});});}},{key:"_deserializeOverlay",value:function _deserializeOverlay(t,e){var _this259=this;var _e$options=e.options,r=_e$options.blendMode,o=_e$options.intensity,n=_e$options.identifier;var s=this._overlayManager.getOverlayByIdentifier(n);if(!s){Y.warn("Deserializer","Unknown overlay `".concat(n,"`. Skipping overlay."));return Promise.resolve();}var a=this._editor.getUI().getAssetPath(s.image);return Wi.load(a).then(function(l){_this259._editor.operations.getOrCreate("overlay",{alpha:o,identifier:n,blendMode:parseInt(mlt[r||s.blendMode],10),image:l});});}},{key:"_createBrushForPath",value:function _createBrushForPath(t){var e=_get(_getPrototypeOf(zc.prototype),"_createBrushForPath",this).call(this,t);if(typeof t.hardness!=="undefined"&&e.hasOption("hardness")){e.setHardness(t.hardness);}return e;}},{key:"_deserializeSticker",value:function _deserializeSticker(t,e){var _this260=this;var r=st.Operations.SpriteOperation;var o=e.options;var n=this._stickerManager.getStickerByIdentifier(o.identifier);var s=gl.getURLForSticker(n,"base");if(!n){Y.warn("Deserializer","Unknown sticker `".concat(o.identifier,"`. Skipping sprite."));return Promise.resolve();}var a=t.getInputDimensions(false);return new Promise(function(l,c){var u=new window.Image();u.addEventListener("load",function(){var m=r.StickerSprite.prototype.availableOptions.adjustments.structure;var p=o.rotation,h=o.flipHorizontally,g=o.flipVertically;var x={identifier:o.identifier,image:u,position:Dt.fromObject(o.position),dimensions:Dt.fromObject(o.dimensions).multiply(a.min()),rotation:p,flipHorizontally:h,flipVertically:g,adjustments:{}};if(typeof o.adjustments!=="undefined"){["brightness","contrast","saturation"].forEach(function(v){if(typeof o.adjustments[v]!=="undefined"){x.adjustments[v]=o.adjustments[v]+m[v]["default"];}});}if(typeof o.tintColor!=="undefined"&&typeof n.tintMode!=="undefined"){x.tintColor=Ut.fromArray(o.tintColor);x.tintMode=n.tintMode;}l(t.createSticker(x));});u.crossOrigin=_this260._editor.getCrossOrigin();u.src=_this260._editor.getUI().getAssetPath(s);});}},{key:"_deserializeFilterOperation",value:function _deserializeFilterOperation(t){var _this261=this;var e=t.options;if(!this._filterManager.getFilterByIdentifier(e.identifier)){Y.warn("Deserializer","Unknown filter `".concat(e.identifier,"`"));return Promise.resolve();}return this._filterManager.instantiateFilterWithIdentifier(e.identifier).then(function(r){var o=_this261._editor.operations.getOrCreate("filter");if(!o)return;o.set({identifier:e.identifier,filter:r,intensity:e.intensity});return o;});}},{key:"_deserializeFocusOperation",value:function _deserializeFocusOperation(t){var _t$options2=t.options,e=_t$options2.options,r=_t$options2.type;if(r!=="radial")return _get(_getPrototypeOf(zc.prototype),"_deserializeFocusOperation",this).call(this,t);var o=this._editor.getImage();var n=o.width/o.height;var s=e.start,a=e.end,l=e.gradientRadius,c=e.blurRadius;var u=Dt.fromObject(a).subtract(Dt.fromObject(s)).multiply(n,1).len();return Promise.resolve(this._editor.operations.getOrCreate("radial-focus",{position:Dt.fromObject(s),radius:u,gradientRadius:l,blurRadius:c}));}},{key:"_deserializeText",value:function _deserializeText(t,e){var r=e.options;var o=r.fontSize,n=r.lineHeight,s=r.fontIdentifier,a=r.alignment,l=r.rotation,c=r.maxWidth,u=r.color,m=r.backgroundColor;var p=new fl(this._ui);var h=this._fontManager.getVariationByIdentifier(s);if(!h){h=this._fontManager.getDefaultFont();}else{p.setFonts([h.getFont()]);}return p.load().then(function(){var g=t.getInputDimensions(false);var x=c*g.min()/g.x;var v=t.createText({fontSize:o,lineHeight:n,fontFamily:h.getFontFamily(),fontWeight:h.getFontWeight(),fontIdentifier:h.getIdentifier(),alignment:a,rotation:l,maxWidth:x,text:r.text,color:Ut.fromArray(u),backgroundColor:Ut.fromArray(m),position:Dt.fromObject(r.position)});v._edited=true;return v;});}}]);return zc;}(Mc);zc.version="2.0.0";});var Uc;var l2=d(function(){s2();Dx();Uc=/*#__PURE__*/function(_Lc){_inherits(Uc,_Lc);var _super194=_createSuper(Uc);function Uc(){_classCallCheck(this,Uc);return _super194.apply(this,arguments);}_createClass(Uc,[{key:"_serializeSticker",value:function _serializeSticker(t,e){var r=t.getInputDimensions(false);var o=_get(_getPrototypeOf(Uc.prototype),"_serializeSticker",this).call(this,t,e);if(e.getTintMode()!=="none"){o.options.tintColor=e.serializeOption("tintColor",true);}o.options.dimensions=e.getDimensions().clone().divide(r.min()).toObject();o.options.identifier=o.options.name;delete o.options.name;return o;}},{key:"_serializePath",value:function _serializePath(t){var e=_get(_getPrototypeOf(Uc.prototype),"_serializePath",this).call(this,t);var r=t.getBrush();if(r.hasOption("hardness")){e.hardness=r.getOption("hardness");}return e;}},{key:"_serializeOperation",value:function _serializeOperation(t,e){if(t.constructor.identifier==="frame"){this._serializeFrameOperation(t,e);return null;}if(t.constructor.identifier==="overlay"){this._serializeOverlayOperation(t,e);return null;}return _get(_getPrototypeOf(Uc.prototype),"_serializeOperation",this).call(this,t,e);}},{key:"_serializeFrameOperation",value:function _serializeFrameOperation(t,e){var r=e.filter(function(n){return n.type==="sprite";});var o;if(r.length){o=r.pop();}else{o={type:"sprite",options:{sprites:[]}};e.push(o);}o.options.sprites.push({type:"frame",options:this._getFrameOptions(t)});}},{key:"_serializeOverlayOperation",value:function _serializeOverlayOperation(t,e){if(!t.getIdentifier())return;var r=e.filter(function(n){return n.type==="sprite";});var o;if(r.length){o=r.pop();}else{o={type:"sprite",options:{sprites:[]}};e.push(o);}o.options.sprites.push({type:"overlay",options:{identifier:t.getIdentifier(),intensity:t.getAlpha(),blendMode:um[t.getBlendMode()]}});}},{key:"_getFrameOptions",value:function _getFrameOptions(t){return{identifier:t.getFrame().identifier};}},{key:"_serializeOrientationOperation",value:function _serializeOrientationOperation(t){var e=_get(_getPrototypeOf(Uc.prototype),"_serializeOrientationOperation",this).call(this,t);if(e.options.rotation===90||e.options.rotation===270){e.options.flipHorizontally=!e.options.flipHorizontally;e.options.flipVertically=!e.options.flipVertically;}return e;}},{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=this._editor.operations;if(e.exists("orientation")){t=t.clone();var o=e.get("orientation");t.rotate(-o.getRotation());if(o.getFlipVertically()){t.flip("vertical");t.setRotation(t.getRotation()*-1);}if(o.getFlipHorizontally()){t.flip("horizontal");t.setRotation(t.getRotation()*-1);}}var r=_get(_getPrototypeOf(Uc.prototype),"_serializeTransformOperation",this).call(this,t);r.type="transform";return r;}},{key:"_serializeText",value:function _serializeText(t,e){var r=_get(_getPrototypeOf(Uc.prototype),"_serializeText",this).call(this,t,e);var o=t.getInputDimensions(false);r.options.fontIdentifier=e.getFontIdentifier();r.options.maxWidth=r.options.maxWidth*o.x/o.min();delete r.options.fontFamily;return r;}},{key:"_serializeFilterOperation",value:function _serializeFilterOperation(t){var e=_get(_getPrototypeOf(Uc.prototype),"_serializeFilterOperation",this).call(this,t);if(!e)return null;e.options.identifier=e.options.name;delete e.options.name;return e;}},{key:"_serializeRadialFocusOperation",value:function _serializeRadialFocusOperation(t){var e=_get(_getPrototypeOf(Uc.prototype),"_serializeRadialFocusOperation",this).call(this,t);var r=e.options.options;r.start=r.position;delete r.position;r.end={x:r.start.x+r.radius,y:r.start.y};delete r.radius;return e;}}]);return Uc;}(Lc);Uc.version="2.0.0";});var K7={};de(K7,{"default":function _default(){return Ex;}});var Ex;var X7=d(function(){a2();l2();Ex=/*#__PURE__*/function(){function Ex(t){_classCallCheck(this,Ex);this._editor=t;}_createClass(Ex,[{key:"serialize",value:function serialize(){var e=new Uc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new zc(this._editor,t);return e.deserialize();}}]);return Ex;}();Ex.version="2.0.0";});var c2,Nc;var u2=d(function(){ue();_d();hl();Sx();sm();a2();if(typeof st.Operations.SpriteOperation!=="undefined"){c2=st.Operations.SpriteOperation.BrushSprite.Brush;}Nc=/*#__PURE__*/function(_zc){_inherits(Nc,_zc);var _super195=_createSuper(Nc);function Nc(){_classCallCheck(this,Nc);return _super195.apply(this,arguments);}_createClass(Nc,[{key:"_deserializeSticker",value:function _deserializeSticker(t,e){var r=st.Operations.SpriteOperation;var o=e.options;var n=this._stickerManager.getStickerByIdentifier(o.identifier);if(!n){Y.warn("Deserializer","Unknown sticker `".concat(o.identifier,"`. Skipping sprite."));return Promise.resolve();}var s=n.images.mediaBase;var a=gl.getURLForSticker(n,"base");var l=s.rawData?s.uris[0]:this._editor.getUI().getAssetPath(a);var c=t.getInputDimensions(false);return Wi.load(l).then(function(u){var m=r.StickerSprite.prototype.availableOptions.adjustments.structure;var p=o.rotation,h=o.flipHorizontally,g=o.flipVertically;var x={identifier:o.identifier,image:u,position:Dt.fromObject(o.position),dimensions:Dt.fromObject(o.dimensions).multiply(c.min()),rotation:p||0,flipHorizontally:h,flipVertically:g,resizeMode:n.resizeMode||"keepAspect",adjustments:{}};if(typeof o.adjustments!=="undefined"){["brightness","contrast","saturation"].forEach(function(v){if(typeof o.adjustments[v]!=="undefined"){x.adjustments[v]=o.adjustments[v]+m[v]["default"];}});}if(typeof o.tintMode!=="undefined"&&typeof o.tintColor!=="undefined"){x.tintColor=Ut.fromArray(o.tintColor.rgba);x.tintMode=o.tintMode;}else if(typeof o.tintColor!=="undefined"&&typeof n.tintMode!=="undefined"){x.tintColor=Ut.fromArray(o.tintColor.rgba);x.tintMode=n.tintMode;}if(typeof o.alpha!=="undefined"){x.alpha=o.alpha;}return t.createSticker(x);});}},{key:"_deserializeTransformOperation",value:function _deserializeTransformOperation(t){return _get(_getPrototypeOf(Nc.prototype),"_deserializeTransformOperation",this).call(this,t).then(function(e){if(!e)return;e._ratio=null;return e;});}},{key:"_deserializeInputImage",value:function _deserializeInputImage(){var _this262=this;var _this$_data$image=this._data.image,t=_this$_data$image.data,e=_this$_data$image.type,r=_this$_data$image.uri;if(t&&e){r="data:".concat(e,";base64,").concat(t);}if(r){return Wi.load(r).then(function(o){_this262._editor.setImage(o);});}return Promise.resolve();}},{key:"_deserializeAdjustmentsOperation",value:function _deserializeAdjustmentsOperation(t){var e=st.Operations.AdjustmentsOperation;return _get(_getPrototypeOf(Nc.prototype),"_deserializeAdjustmentsOperation",this).call(this,t).then(function(r){if(!r)return null;var o=t.options;var n=["gamma","whites","blacks","temperature"];var s={};n.forEach(function(a){if(typeof o[a]==="undefined")return;var _e$prototype$availabl2=e.prototype.availableOptions[a],l=_e$prototype$availabl2.minValue,c=_e$prototype$availabl2.midValue,u=_e$prototype$availabl2.maxValue;var m=o[a];m=m<0?c+(c-l)*m:c+(u-c)*m;s[a]=m;});r.set(s);return r;});}},{key:"_deserializeFocusOperation",value:function _deserializeFocusOperation(t){var e=t.options.options;switch(t.options.type){case"radial":return _get(_getPrototypeOf(Nc.prototype),"_deserializeFocusOperation",this).call(this,t);case"linear":{var r=e.start,o=e.end,n=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("linear-focus",{controlPoint1:Dt.fromObject(r),controlPoint2:Dt.fromObject(o),blurRadius:n}));}case"mirrored":{var _r9=e.start,_o9=e.end,_n7=e.size,s=e.gradientSize,a=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("mirrored-focus",{start:Dt.fromObject(_r9),end:Dt.fromObject(_o9),size:_n7,gradientSize:s,blurRadius:a}));}case"gaussian":{var _r10=e.blurRadius;return Promise.resolve(this._editor.operations.getOrCreate("blur",{blurRadius:_r10}));}}}},{key:"_deserializeText",value:function _deserializeText(t,e){var r=e.options;var o=r.fontSize,n=r.lineHeight,s=r.fontIdentifier,a=r.alignment,l=r.rotation,c=r.maxWidth,u=r.color,m=r.backgroundColor;var p=this._ui.getFontLoader();var h=this._fontManager.getVariationByIdentifier(s);if(!h){h=this._fontManager.getDefaultVariation();}else{p.setFonts([h.getFont()]);}return p.load().then(function(){var g=t.getInputDimensions(false);var x=c*g.min()/g.x;var v=t.createText({fontSize:o,lineHeight:n,fontFamily:h.getFontFamily(),fontWeight:h.getFontWeight(),fontIdentifier:h.getIdentifier(),textMetrics:h.getTextMetrics(),alignment:a,rotation:l,maxWidth:x,text:r.text,color:Ut.fromArray(u.rgba),backgroundColor:Ut.fromArray(m.rgba),position:Dt.fromObject(r.position)});v._edited=true;return v;});}},{key:"_createBrushForPath",value:function _createBrushForPath(t){var _t$brush=t.brush,e=_t$brush.identifier,r=_t$brush.color,o=_t$brush.size,n=_t$brush.hardness;var s=Ut.fromArray(r.rgba);var a={color:s,size:o};if(typeof n!=="undefined"){a.hardness=n;}var l=this._brushManager.getBrushByIdentifier(e);if(!l){l=this._brushManager.getFirstBrush();}if(l.prototype&&l.prototype instanceof c2){var m=l;return new m(a);}var c=_objectSpread({},l);delete c.image;var u=/*#__PURE__*/function(_c6){_inherits(u,_c6);var _super196=_createSuper(u);function u(){_classCallCheck(this,u);return _super196.apply(this,arguments);}return u;}(c2);u.identifier=l.identifier;return new u(_objectSpread(_objectSpread({},c),a));}},{key:"_deserializeFrame",value:function _deserializeFrame(t,e){var _this263=this;return _get(_getPrototypeOf(Nc.prototype),"_deserializeFrame",this).call(this,t,e).then(function(){var r=_this263._editor.operations.get("frame");var _e$options2=e.options,o=_e$options2.size,n=_e$options2.alpha,s=_e$options2.tintColor;var a={};if(typeof o!=="undefined"){a.scale=o;}if(typeof n!=="undefined"){a.alpha=n;}if(typeof s!=="undefined"){a.tintColor=Ut.fromArray(s.rgba);}r.set(a);});}},{key:"_deserializeTextDesign",value:function _deserializeTextDesign(t,e){var _this264=this;var r=e.options;var o=r.position,n=r.rotation,s=r.flipHorizontally,a=r.flipVertically,l=r.text,c=r.color,u=r.width,m=r.seed,p=r.inverted;var h=r.identifier;if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier;}else if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier;}var g=new uo(this._ui,this._getOptions("textdesign"));var x=new Di(this._ui,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true});var v=t.constructor.TextDesignSprite.AssetManager;var b=this._ui.getFontLoader();var T=g.getLayoutByIdentifier(h);var k=new T();b.setFonts(x.getFonts());v.setFonts(_objectSpread(_objectSpread({},v.getFonts()),x.getVariationsByIdentifier()));return b.load().then(function(){var E=k.getImagePaths().map(function(A){return{path:A,fullPath:_this264._ui.getAssetPath(A),image:null};});return v.loadImages(E).then(function(){k.onImagesLoaded();return t.createTextDesign({position:o,rotation:n,flipHorizontally:s,flipVertically:a,text:l,color:Ut.fromArray(c.rgba),width:u,seed:m,inverted:p,layout:k});});});}}]);return Nc;}(zc);Nc.version="3.0.0";});var Hc;var d2=d(function(){Ln();Hc=/*#__PURE__*/function(_t29){_inherits(Hc,_t29);var _super197=_createSuper(Hc);function Hc(){_classCallCheck(this,Hc);return _super197.apply(this,arguments);}return Hc;}(_t);Hc.prototype.availableOptions={identifier:{type:"string",required:true},defaultName:{type:"string",required:true},ratio:{type:"*",required:false,"default":null},selected:{type:"boolean",required:false},dimensions:{type:"vector2",required:false},lockDimensions:{type:"boolean",required:false,"default":null},forceDimensions:{type:"boolean",required:false,"default":null}};});var Wc;var m2=d(function(){ue();d2();l2();Wc=/*#__PURE__*/function(_Uc){_inherits(Wc,_Uc);var _super198=_createSuper(Wc);function Wc(){_classCallCheck(this,Wc);return _super198.apply(this,arguments);}_createClass(Wc,[{key:"serialize",value:function serialize(){var _this265=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return _get(_getPrototypeOf(Wc.prototype),"serialize",this).call(this,t).then(function(e){e.meta={platform:"html5",version:_this265._editor.getSDK().version,createdAt:Jt.ISODateString(new Date())};e.image=e.inputImage;delete e.inputImage;return e;});}},{key:"_serializeSticker",value:function _serializeSticker(t,e){var r=_get(_getPrototypeOf(Wc.prototype),"_serializeSticker",this).call(this,t,e);r.options.alpha=e.getAlpha();if(r.options.tintColor){r.options.tintColor={rgba:r.options.tintColor};}return r;}},{key:"_serializeText",value:function _serializeText(t,e){var r=_get(_getPrototypeOf(Wc.prototype),"_serializeText",this).call(this,t,e);r.options.color={rgba:r.options.color};r.options.backgroundColor={rgba:r.options.backgroundColor};r.options.flipHorizontally=false;r.options.flipVertically=false;delete r.options.fontWeight;return r;}},{key:"_serializePath",value:function _serializePath(t){var e=_get(_getPrototypeOf(Wc.prototype),"_serializePath",this).call(this,t);delete e.hardness;delete e.size;delete e.color;var r=t.getBrush();e.brush=r.serializeOptions(["identifier","size","color"],true);if(typeof e.brush.identifier==="undefined"){delete e.brush.identifier;}e.brush.color={rgba:e.brush.color};var o=r.getOption("hardness");if(o!=="undefined"){e.brush.hardness=o;}return e;}},{key:"_serializeFrameOperation",value:function _serializeFrameOperation(t,e){_get(_getPrototypeOf(Wc.prototype),"_serializeFrameOperation",this).call(this,t,e);var r=e.filter(function(n){return n.type==="sprite";});var o;if(r.length){o=r.pop();var n=o.options.sprites.filter(function(l){return l.type==="frame";})[0];var s=t.getTintColor();if(!s.equals(new Ut(1,1,1,0))){n.options.tintColor={rgba:t.serializeOption("tintColor",true)};}var a=t.serializeOptions(["scale","alpha"],true);n.options=_objectSpread(_objectSpread({},n.options),a);n.options.size=n.options.scale;delete n.options.scale;}}},{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=_get(_getPrototypeOf(Wc.prototype),"_serializeTransformOperation",this).call(this,t);if(t._ratio){var r;if(t._ratio instanceof Hc){r=t._ratio.getIdentifier();}else{r=t._ratio.identifier;}e.options.meta={identifier:r};}delete e.options.scale;return e;}},{key:"_serializeAdjustmentsOperation",value:function _serializeAdjustmentsOperation(t){var e=_get(_getPrototypeOf(Wc.prototype),"_serializeAdjustmentsOperation",this).call(this,t);var r=["gamma","whites","blacks","temperature"];var o=t.availableOptions;var n={};r.forEach(function(s){var a=o[s];var l=t.getOption(s);var c=a.minValue,u=a.midValue,m=a.maxValue;n[s]=l<=u?(l-c)/(u-c)-1:(l-u)/(m-u);});e.options=_objectSpread(_objectSpread({},e.options),n);return e;}},{key:"_serializeOperation",value:function _serializeOperation(t,e){switch(t.constructor.identifier){case"mirrored-focus":return this._serializeMirroredFocusOperation(t);case"linear-focus":return this._serializeLinearFocusOperation(t);case"blur":return this._serializeBlurOperation(t);default:return _get(_getPrototypeOf(Wc.prototype),"_serializeOperation",this).call(this,t,e);}}},{key:"_serializeMirroredFocusOperation",value:function _serializeMirroredFocusOperation(t){return{type:"focus",options:{type:"mirrored",options:t.serializeOptions(["start","end","blurRadius","size","gradientSize"],true)}};}},{key:"_serializeLinearFocusOperation",value:function _serializeLinearFocusOperation(t){var e=t.serializeOptions(["controlPoint1","controlPoint2","blurRadius"],true);e.start=e.controlPoint1;delete e.controlPoint1;e.end=e.controlPoint2;delete e.controlPoint2;return{type:"focus",options:{type:"linear",options:e}};}},{key:"_serializeBlurOperation",value:function _serializeBlurOperation(t){return{type:"focus",options:{type:"gaussian",options:t.serializeOptions(["blurRadius"],true)}};}}]);return Wc;}(Uc);Wc.version="3.0.0";});var q7={};de(q7,{"default":function _default(){return Fx;}});var Fx;var Y7=d(function(){u2();m2();Fx=/*#__PURE__*/function(){function Fx(t){_classCallCheck(this,Fx);this._editor=t;}_createClass(Fx,[{key:"serialize",value:function serialize(){var e=new Wc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Nc(this._editor,t);return e.deserialize();}}]);return Fx;}();Fx.version="3.0.0";});var Gc;var p2=d(function(){ue();hl();sm();u2();Gc=/*#__PURE__*/function(_Nc){_inherits(Gc,_Nc);var _super199=_createSuper(Gc);function Gc(){_classCallCheck(this,Gc);return _super199.apply(this,arguments);}_createClass(Gc,[{key:"_deserializeTextDesign",value:function _deserializeTextDesign(t,e){var _this266=this;var r=e.options;var o=r.position,n=r.rotation,s=r.flipHorizontally,a=r.flipVertically,l=r.text,c=r.color,u=r.width,m=r.seed,p=r.inverted;var h=r.identifier;if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier;}else if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier;}var g=new uo(this._ui,this._getOptions("textdesign"));var x=new Di(this._ui,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true});var v=t.constructor.TextDesignSprite.AssetManager;var b=this._ui.getFontLoader();var T=g.getLayoutByIdentifier(h);var k=new T();b.setFonts(x.getFonts());v.setFonts(_objectSpread(_objectSpread({},v.getFonts()),x.getVariationsByIdentifier()));return b.load().then(function(){var E=k.getImagePaths().map(function(A){return{path:A,fullPath:_this266._ui.getAssetPath(A),image:null};});return v.loadImages(E).then(function(){k.onImagesLoaded();return t.createTextDesign({position:o,rotation:n,flipHorizontally:s,flipVertically:a,text:l,color:Ut.fromArray(c.rgba),width:u,seed:m,inverted:p,layout:k});});});}}]);return Gc;}(Nc);Gc.version="3.1.0";});var Vc;var h2=d(function(){ue();m2();Vc=/*#__PURE__*/function(_Wc){_inherits(Vc,_Wc);var _super200=_createSuper(Vc);function Vc(){_classCallCheck(this,Vc);return _super200.apply(this,arguments);}_createClass(Vc,[{key:"_serializeTextDesign",value:function _serializeTextDesign(t,e){var r=e.serializeOptions(["position","rotation","flipHorizontally","flipVertically","text","color","width","seed","inverted"],true);r.color={rgba:r.color};var o=e.getLayout();if(o){r.identifier=o.constructor.identifier;}return{type:"textdesign",options:r};}}]);return Vc;}(Wc);Vc.version="3.1.0";});var J7={};de(J7,{"default":function _default(){return Ox;}});var Ox;var Z7=d(function(){p2();h2();Ox=/*#__PURE__*/function(){function Ox(t){_classCallCheck(this,Ox);this._editor=t;}_createClass(Ox,[{key:"serialize",value:function serialize(){var e=new Vc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Gc(this._editor,t);return e.deserialize();}}]);return Ox;}();Ox.version="3.1.0";});var jc;var f2=d(function(){ue();hl();sm();p2();jc=/*#__PURE__*/function(_Gc){_inherits(jc,_Gc);var _super201=_createSuper(jc);function jc(){_classCallCheck(this,jc);return _super201.apply(this,arguments);}_createClass(jc,[{key:"_deserializeTextDesign",value:function _deserializeTextDesign(t,e){var _this267=this;var r=e.options;var o=r.position,n=r.rotation,s=r.flipHorizontally,a=r.flipVertically,l=r.text,c=r.color,u=r.width,m=r.seed,p=r.inverted;var h=r.identifier;if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignBlocksLight.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignBlocksLightV310.identifier;}else if(h===st.Operations.SpriteOperation.TextDesignSprite.Layouts.TextDesignSunshine.identifier){h=st.Operations.SpriteOperation.TextDesignSprite.LegacyLayouts.TextDesignSunshineV310.identifier;}var g="padding"in r?r.padding/u:-1;var x=new uo(this._ui,this._getOptions("textdesign"));var v=new Di(this._ui,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true});var b=t.constructor.TextDesignSprite.AssetManager;var T=this._ui.getFontLoader();var k=x.getLayoutByIdentifier(h);var E=new k();T.setFonts(v.getFonts());b.setFonts(_objectSpread(_objectSpread({},b.getFonts()),v.getVariationsByIdentifier()));return T.load().then(function(){var A=E.getImagePaths().map(function(I){return{path:I,fullPath:_this267._ui.getAssetPath(I),image:null};});return b.loadImages(A).then(function(){E.onImagesLoaded();return t.createTextDesign({position:o,rotation:n,flipHorizontally:s,flipVertically:a,text:l,color:Ut.fromArray(c.rgba),width:u,seed:m,inverted:p,layout:E,padding:g});});});}}]);return jc;}(Gc);jc.version="3.2.0";});var $c;var g2=d(function(){h2();$c=/*#__PURE__*/function(_Vc){_inherits($c,_Vc);var _super202=_createSuper($c);function $c(){_classCallCheck(this,$c);return _super202.apply(this,arguments);}_createClass($c,[{key:"_serializeTextDesign",value:function _serializeTextDesign(t,e){var r=e.serializeOptions(["position","rotation","flipHorizontally","flipVertically","text","color","width","seed","inverted","padding"],true);r.color={rgba:r.color};var o=e.getLayout();if(o){r.identifier=o.constructor.identifier;}r.padding*=r.width;return{type:"textdesign",options:r};}}]);return $c;}(Vc);$c.version="3.2.0";});var Q7={};de(Q7,{"default":function _default(){return Rx;}});var Rx;var tN=d(function(){f2();g2();Rx=/*#__PURE__*/function(){function Rx(t){_classCallCheck(this,Rx);this._editor=t;}_createClass(Rx,[{key:"serialize",value:function serialize(){var e=new $c(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new jc(this._editor,t);return e.deserialize();}}]);return Rx;}();Rx.version="3.2.0";});var Kc;var b2=d(function(){f2();Kc=/*#__PURE__*/function(_jc){_inherits(Kc,_jc);var _super203=_createSuper(Kc);function Kc(){_classCallCheck(this,Kc);return _super203.apply(this,arguments);}_createClass(Kc,[{key:"_deserializeOperation",value:function _deserializeOperation(t){return _get(_getPrototypeOf(Kc.prototype),"_deserializeOperation",this).call(this,t);}},{key:"_deserializeOrientationOperation",value:function _deserializeOrientationOperation(t){var e=t.options;var r=this._editor.operations.getOrCreate("orientation");if(!r)return Promise.resolve();r.set(e);return Promise.resolve(r);}}]);return Kc;}(jc);Kc.version="3.4.0";});var Xc;var y2=d(function(){Dx();g2();Xc=/*#__PURE__*/function(_$c){_inherits(Xc,_$c);var _super204=_createSuper(Xc);function Xc(){_classCallCheck(this,Xc);return _super204.apply(this,arguments);}_createClass(Xc,[{key:"_serializeOperation",value:function _serializeOperation(t,e){switch(t.constructor.identifier){case"artfilter":return this._serializeStyle(t);default:return _get(_getPrototypeOf(Xc.prototype),"_serializeOperation",this).call(this,t,e);}}},{key:"_serializeOrientationOperation",value:function _serializeOrientationOperation(t){return{type:"orientation",options:t.serializeOptions(["flipVertically","flipHorizontally","rotation"],true)};}},{key:"_serializeStyle",value:function _serializeStyle(t){var _t$getOptions=t.getOptions(),e=_t$getOptions.identifier,r=_t$getOptions.intensity,o=_t$getOptions.blendMode;var _t$getStyleTransferMo=t.getStyleTransferModel().getOptions(),n=_t$getStyleTransferMo.tileEdgeLength,s=_t$getStyleTransferMo.overlappingFactor;return{type:"artFilter",options:{identifier:e,intensity:r,blendMode:um[o],tileEdgeLength:n,overlappingFactor:s}};}}]);return Xc;}($c);Xc.version="3.4.0";});var eN={};de(eN,{"default":function _default(){return Ax;}});var Ax;var iN=d(function(){b2();y2();Ax=/*#__PURE__*/function(){function Ax(t){_classCallCheck(this,Ax);this._editor=t;}_createClass(Ax,[{key:"serialize",value:function serialize(){var e=new Xc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Kc(this._editor,t);return e.deserialize();}}]);return Ax;}();Ax.version="3.4.0";});var qc;var _2=d(function(){ue();hl();sm();b2();qc=/*#__PURE__*/function(_Kc){_inherits(qc,_Kc);var _super205=_createSuper(qc);function qc(){_classCallCheck(this,qc);return _super205.apply(this,arguments);}_createClass(qc,[{key:"_deserializeTextDesign",value:function _deserializeTextDesign(t,e){var _this268=this;var r=e.options;var o=r.position,n=r.rotation,s=r.flipHorizontally,a=r.flipVertically,l=r.text,c=r.color,u=r.width,m=r.seed,p=r.inverted,h=r.identifier;var g="padding"in r?r.padding/u:-1;var x=new uo(this._ui,this._getOptions("textdesign"));var v=new Di(this._ui,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true});var b=t.constructor.TextDesignSprite.AssetManager;var T=this._ui.getFontLoader();var k=x.getLayoutByIdentifier(h);var E=new k();T.setFonts(v.getFonts());b.setFonts(_objectSpread(_objectSpread({},b.getFonts()),v.getVariationsByIdentifier()));return T.load().then(function(){var A=E.getImagePaths().map(function(I){return{path:I,fullPath:_this268._ui.getAssetPath(I),image:null};});return b.loadImages(A).then(function(){E.onImagesLoaded();return t.createTextDesign({position:o,rotation:n,flipHorizontally:s,flipVertically:a,text:l,color:Ut.fromArray(c.rgba),width:u,seed:m,inverted:p,layout:E,padding:g});});});}}]);return qc;}(Kc);qc.version="3.5.0";});var Yc;var x2=d(function(){y2();Yc=/*#__PURE__*/function(_Xc){_inherits(Yc,_Xc);var _super206=_createSuper(Yc);function Yc(){_classCallCheck(this,Yc);return _super206.apply(this,arguments);}return Yc;}(Xc);Yc.version="3.5.0";});var rN={};de(rN,{"default":function _default(){return Bx;}});var Bx;var oN=d(function(){_2();x2();Bx=/*#__PURE__*/function(){function Bx(t){_classCallCheck(this,Bx);this._editor=t;}_createClass(Bx,[{key:"serialize",value:function serialize(){var e=new Yc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new qc(this._editor,t);return e.deserialize();}}]);return Bx;}();Bx.version="3.5.0";});var Jc;var v2=d(function(){ue();_2();Jc=/*#__PURE__*/function(_qc){_inherits(Jc,_qc);var _super207=_createSuper(Jc);function Jc(){_classCallCheck(this,Jc);return _super207.apply(this,arguments);}_createClass(Jc,[{key:"_deserializeAdjustmentsOperation",value:function _deserializeAdjustmentsOperation(t){var e=st.Operations.AdjustmentsOperation;return _get(_getPrototypeOf(Jc.prototype),"_deserializeAdjustmentsOperation",this).call(this,t).then(function(r){if(!r)return null;var o=t.options;var n="sharpness";var s={};if(typeof o[n]==="undefined")return;var _e$prototype$availabl3=e.prototype.availableOptions[n],a=_e$prototype$availabl3.minValue,l=_e$prototype$availabl3.midValue,c=_e$prototype$availabl3.maxValue;var u=o[n];u=u<0?l+(l-a)*u:l+(c-l)*u;s[n]=u;r.set(s);return r;});}}]);return Jc;}(qc);Jc.version="3.6.0";});var Zc;var C2=d(function(){x2();Zc=/*#__PURE__*/function(_Yc){_inherits(Zc,_Yc);var _super208=_createSuper(Zc);function Zc(){_classCallCheck(this,Zc);return _super208.apply(this,arguments);}_createClass(Zc,[{key:"_serializeAdjustmentsOperation",value:function _serializeAdjustmentsOperation(t){var e=_get(_getPrototypeOf(Zc.prototype),"_serializeAdjustmentsOperation",this).call(this,t);var r="sharpness";var o=t.availableOptions;var n={};var s=o[r];var a=t.getOption(r);var l=s.minValue,c=s.midValue,u=s.maxValue;n[r]=a<=c?(a-l)/(c-l)-1:(a-c)/(u-c);e.options=_objectSpread(_objectSpread({},e.options),n);return e;}}]);return Zc;}(Yc);Zc.version="3.6.0";});var nN={};de(nN,{"default":function _default(){return Px;}});var Px;var sN=d(function(){v2();C2();Px=/*#__PURE__*/function(){function Px(t){_classCallCheck(this,Px);this._editor=t;}_createClass(Px,[{key:"serialize",value:function serialize(){var e=new Zc(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Jc(this._editor,t);return e.deserialize();}}]);return Px;}();Px.version="3.6.0";});var Qc;var S2=d(function(){Ln();v2();Qc=/*#__PURE__*/function(_Jc){_inherits(Qc,_Jc);var _super209=_createSuper(Qc);function Qc(){_classCallCheck(this,Qc);return _super209.apply(this,arguments);}_createClass(Qc,[{key:"deserialize",value:function deserialize(){var _this269=this;return this._validateVersion().then(function(){return _this269._deserializeAssetLibrary();}).then(function(){return _this269._deserializeInputImage();}).then(function(){return _this269._deserializeOperations();});}},{key:"_deserializeAssetLibrary",value:function _deserializeAssetLibrary(){var _this270=this;return new Promise(function(t,e){var r=_this270._data;if(!r.assetLibrary){t();return;}var o=r.assetLibrary.assets;var n=[];for(var s in o){n.push(_this270._deserializeCustomAssets(s,o[s]));}return Promise.all(n).then(function(){t();})["catch"](function(s){console.error(s);e(s);});});}},{key:"_deserializeCustomAssets",value:function _deserializeCustomAssets(t,e){switch(t){case"stickers":return this._deserializeCustomStickerAssets(e);default:return Promise.reject(new Error("Unknown asset type: ".concat(t)));}}},{key:"_deserializeCustomStickerAssets",value:function _deserializeCustomStickerAssets(t){var _this271=this;var e="none";var r=this._editor.getOptions().editor;if(r&&r.controlsOptions&&r.controlsOptions.sticker){e=r.controlsOptions.sticker.customStickerTintMode||"none";}var o=t.map(function(n){return new Promise(function(s,a){var l=n.identifier,c=n.raster;var u=n.svg!==void 0;var m="data:".concat(c.type,";base64,").concat(c.data);var p=new Xi();p.onload=function(){var h=_this271._editor.getSDK();p=h.correctExifOrientation(p);if(p.toDataURL){m=p.toDataURL();}var g={data:"",width:1,height:1};if(true){g=_this271._stickerManager.renderStickerThumbnailFromImage(p);}var x={identifier:l,defaultName:n.name||"",tintMode:e,images:{mediaBase:{uris:[m],rawData:true,isSVG:u,width:p.width,height:p.height},mediaThumb:{uris:[g.data],rawData:true,width:g.width,height:g.height}}};if(u){var v="data:image/svg+xml;base64,".concat(n.svg.data);x.images.mediaBase.uris.push(v);}s(x);};p.onerror=function(){a(new Error("Invalid base64 data: ".concat(m)));};p.src=m;});});return Promise.all(o).then(function(n){var s=_this271._editor.getDynamicAssetsLibrary();s.setAssets("sticker",n);_this271._stickerManager.reload();});}}]);return Qc;}(Jc);Qc.version="3.7.0";});var tu;var w2=d(function(){C2();tu=/*#__PURE__*/function(_Zc){_inherits(tu,_Zc);var _super210=_createSuper(tu);function tu(){_classCallCheck(this,tu);return _super210.apply(this,arguments);}_createClass(tu,[{key:"serialize",value:function serialize(){var _this272=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return _get(_getPrototypeOf(tu.prototype),"serialize",this).call(this,t).then(function(e){return _this272._serializeAssetLibrary(e).then(function(r){return r;});});}},{key:"_serializeAssetLibrary",value:function _serializeAssetLibrary(t){if(!this._editor.getDynamicAssetsLibrary){return Promise.resolve(t);}var e=this._editor.getDynamicAssetsLibrary();var r=this._serializeCustomStickerAssets(t,e);if(r.length===0){return Promise.resolve(t);}t.assetLibrary={assets:{stickers:r}};return Promise.resolve(t);}},{key:"_serializeCustomStickerAssets",value:function _serializeCustomStickerAssets(t,e){var r=e.getAssets("sticker");if(r.length===0){return[];}var o=t.operations.filter(function(a){return a.type==="sprite";}).flatMap(function(a){return a.options.sprites;}).filter(function(a){return a.type==="sticker";}).map(function(a){return a.options.identifier;});var n={};o.forEach(function(a){n[a]=true;});var s=r.filter(function(a){return n[a.identifier];});return s.map(function(a){var l=a.identifier,c=a.defaultName,u=a.images;var m=u.mediaBase.uris[0];var p=u.mediaBase.isSVG;var h=/^data:(image\/(jpeg|png));base64,(.*)$/g;var g=h.exec(m);var x=g[1];var v=g[3];var b={identifier:l,name:c,raster:{type:x,data:v}};if(c){b.name=c;}if(p){b.svg={data:u.mediaBase.uris[1].replace(/^data:image\/svg\+xml;base64,/g,"")};}return b;});}}]);return tu;}(Zc);tu.version="3.7.0";});var aN={};de(aN,{"default":function _default(){return Mx;}});var Mx;var lN=d(function(){S2();w2();Mx=/*#__PURE__*/function(){function Mx(t){_classCallCheck(this,Mx);this._editor=t;}_createClass(Mx,[{key:"serialize",value:function serialize(){var e=new tu(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Qc(this._editor,t);return e.deserialize();}}]);return Mx;}();Mx.version="3.7.0";});var eu;var T2=d(function(){S2();eu=/*#__PURE__*/function(_Qc){_inherits(eu,_Qc);var _super211=_createSuper(eu);function eu(){_classCallCheck(this,eu);return _super211.apply(this,arguments);}return eu;}(Qc);eu.version="3.8.0";});var iu;var k2=d(function(){w2();iu=/*#__PURE__*/function(_tu){_inherits(iu,_tu);var _super212=_createSuper(iu);function iu(){_classCallCheck(this,iu);return _super212.apply(this,arguments);}_createClass(iu,[{key:"_serializeSticker",value:function _serializeSticker(t,e){var r=_get(_getPrototypeOf(iu.prototype),"_serializeSticker",this).call(this,t,e);r.options.tintMode=e.getTintMode();return r;}}]);return iu;}(tu);iu.version="3.8.0";});var cN={};de(cN,{"default":function _default(){return Lx;}});var Lx;var uN=d(function(){T2();k2();Lx=/*#__PURE__*/function(){function Lx(t){_classCallCheck(this,Lx);this._editor=t;}_createClass(Lx,[{key:"serialize",value:function serialize(){var e=new iu(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new eu(this._editor,t);return e.deserialize();}}]);return Lx;}();Lx.version="3.8.0";});var ru;var I2=d(function(){ue();T2();ru=/*#__PURE__*/function(_eu){_inherits(ru,_eu);var _super213=_createSuper(ru);function ru(){_classCallCheck(this,ru);return _super213.apply(this,arguments);}_createClass(ru,[{key:"_deserializeTransformOperation",value:function _deserializeTransformOperation(t){var _this273=this;return _get(_getPrototypeOf(ru.prototype),"_deserializeCropOperation",this).call(this,t).then(function(e){if(!e)return;var r=Jt.Array.find(_this273._data.operations,function(o){return o.type==="orientation";});if(r){var o=r.options;e.rotate(o.rotation);if(o.flipHorizontally){e.flip("horizontal");e.setRotation(e.getRotation()*-1);}if(o.flipVertically){e.flip("vertical");e.setRotation(e.getRotation()*-1);}}e._ratio=null;return e;});}},{key:"_deserializeText",value:function _deserializeText(t,e){var r=e.options;var o=r.fontSize,n=r.lineHeight,s=r.fontIdentifier,a=r.alignment,l=r.rotation,c=r.maxWidth,u=r.color,m=r.backgroundColor;var p=this._ui.getFontLoader();var h=this._fontManager.getVariationByIdentifier(s);if(!h){h=this._fontManager.getDefaultVariation();}else{p.setFonts([h.getFont()]);}return p.load().then(function(){var g=t.getInputDimensions(false);var x=g.min();var v=g.x;var b=g.y;var T=c*x/v;var k=o*x/b;var E=t.createText({fontSize:k,lineHeight:n,fontFamily:h.getFontFamily(),fontWeight:h.getFontWeight(),fontIdentifier:h.getIdentifier(),textMetrics:h.getTextMetrics(),alignment:a,rotation:l,maxWidth:T,text:r.text,color:Ut.fromArray(u.rgba),backgroundColor:Ut.fromArray(m.rgba),position:Dt.fromObject(r.position)});E._edited=true;return E;});}}]);return ru;}(eu);ru.version="3.9.0";});var dN,ou;var D2=d(function(){d2();k2();dN=Math.PI*2;ou=/*#__PURE__*/function(_iu){_inherits(ou,_iu);var _super214=_createSuper(ou);function ou(){_classCallCheck(this,ou);return _super214.apply(this,arguments);}_createClass(ou,[{key:"_serializeTransformOperation",value:function _serializeTransformOperation(t){var e=this._editor.operations;if(e.exists("orientation")){t=t.clone();var n=e.get("orientation");if(n.getFlipVertically()){t.flip("vertical");t.setRotation(t.getRotation()*-1);}if(n.getFlipHorizontally()){t.flip("horizontal");t.setRotation(t.getRotation()*-1);}t.rotate(-n.getRotation());}var r=t.serializeOptions(["start","end","rotation","textureScale"],true);r.rotation=(r.rotation+dN)%dN;if(r.textureScale!==1){r.dimensions=t.getNewDimensions(t.getInputDimensions(false));}delete r.textureScale;var o={type:"transform",options:r};if(t._ratio){var _n8;if(t._ratio instanceof Hc){_n8=t._ratio.getIdentifier();}else{_n8=t._ratio.identifier;}o.options.meta={identifier:_n8};}delete o.options.scale;return o;}},{key:"_serializeText",value:function _serializeText(t,e){var r=t.getInputDimensions(false);var o=_get(_getPrototypeOf(ou.prototype),"_serializeText",this).call(this,t,e);o.options.fontSize=o.options.fontSize*r.y/r.min();return o;}}]);return ou;}(iu);ou.version="3.9.0";});var mN={};de(mN,{"default":function _default(){return zx;}});var zx;var pN=d(function(){I2();D2();zx=/*#__PURE__*/function(){function zx(t){_classCallCheck(this,zx);this._editor=t;}_createClass(zx,[{key:"serialize",value:function serialize(){var e=new ou(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new ru(this._editor,t);return e.deserialize();}}]);return zx;}();zx.version="3.9.0";});var Wh;var hN=d(function(){I2();Wh=/*#__PURE__*/function(_ru){_inherits(Wh,_ru);var _super215=_createSuper(Wh);function Wh(){_classCallCheck(this,Wh);return _super215.apply(this,arguments);}return Wh;}(ru);Wh.version="3.12.0";});var Gh;var fN=d(function(){D2();Gh=/*#__PURE__*/function(_ou){_inherits(Gh,_ou);var _super216=_createSuper(Gh);function Gh(){_classCallCheck(this,Gh);return _super216.apply(this,arguments);}_createClass(Gh,[{key:"_serializeCustomStickerAssets",value:function _serializeCustomStickerAssets(t,e){var r=e.getAssets("sticker");if(r.length===0){return[];}var o=t.operations.filter(function(a){return a.type==="sprite";}).flatMap(function(a){return a.options.sprites;}).filter(function(a){return a.type==="sticker";}).map(function(a){return a.options.identifier;});var n={};o.forEach(function(a){n[a]=true;});var s=r.filter(function(a){return n[a.identifier];});return s.map(function(a){var l=a.identifier,c=a.defaultName,u=a.images;var m=u.mediaBase.uris[0];var p=u.mediaBase.isSVG;var h=/^data:(image\/(jpeg|png|gif));base64,(.*)$/g;var g=h.exec(m);var x=g[1];var v=g[3];var b={identifier:l,name:c,raster:{type:x,data:v}};if(c){b.name=c;}if(p){b.svg={data:u.mediaBase.uris[1].replace(/^data:image\/svg\+xml;base64,/g,"")};}return b;});}}]);return Gh;}(ou);Gh.version="3.12.0";});var gN={};de(gN,{"default":function _default(){return Ux;}});var Ux;var bN=d(function(){hN();fN();Ux=/*#__PURE__*/function(){function Ux(t){_classCallCheck(this,Ux);this._editor=t;}_createClass(Ux,[{key:"serialize",value:function serialize(){var e=new Gh(this._editor);return e.serialize.apply(e,arguments);}},{key:"deserialize",value:function deserialize(t){var e=new Wh(this._editor,t);return e.deserialize();}}]);return Ux;}();Ux.version="3.12.0";});var yN,_N;var xN=d(function(){QT();k7();hl();To();ue();I7();D7();yN=/*#__PURE__*/function(_zh){_inherits(yN,_zh);var _super217=_createSuper(yN);function yN(t,e,r){var _this274;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;_classCallCheck(this,yN);_this274=_super217.call(this);_this274._ui=t;_this274._options=e;_this274._mediator=r;_this274._shallow=o;if(!o){_this274._initSDK();_this274.operations=new gx(_assertThisInitialized(_this274),_this274._sdk,_this274._mediator);}return _this274;}_createClass(yN,[{key:"_initFonts",value:function _initFonts(){var t=Jt.defaults(this._options.editor.controlsOptions.text,{additionalFonts:[],replaceFonts:false,availableVariations:null});this._fontManager=new Di(this._ui,t);var e=this._fontManager.getFonts();var r=this._ui.getFontLoader();r.setFonts(e);r.load();}},{key:"setImage",value:function setImage(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._options.editor.image;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(e){this.reset();}var r=null;r=this._sdk.parseExif(t);this._setImage(t,r);}},{key:"_initSDK",value:function _initSDK(){var _this$_options43=this._options,t=_this$_options43.logLevel,e=_this$_options43.displayWelcomeMessage,r=_this$_options43.debug,o=_this$_options43.license,n=_this$_options43.crossOrigin,s=_this$_options43.watermark;var _this$_options$editor=this._options.editor,a=_this$_options$editor.smoothDownscaling,l=_this$_options$editor.smoothUpscaling,c=_this$_options$editor.preferredRenderer,u=_this$_options$editor.pixelRatio,m=_this$_options$editor.transparent,p=_this$_options$editor.clearColor;var h;if(Array.isArray(p)){h=Ut.fromArray(p);}else if(typeof p==="string"){h=Ut.fromHex(p);}else if(p instanceof Ut){h=p.clone();}var g={logLevel:t,debug:r,displayWelcomeMessage:e,pixelRatio:u,smoothDownscaling:a,smoothUpscaling:l,transparent:m,crossOrigin:n,clearColor:h,license:o,watermark:s};this._sdk=new st(c,g);}},{key:"getMaxMegapixels",value:function getMaxMegapixels(){var t=this._options.editor.maxMegaPixels;return t;}},{key:"getCrossOrigin",value:function getCrossOrigin(){return Jt.getCrossOriginValue(this._options.crossOrigin||"anonymous");}},{key:"getOutputDimensions",value:function getOutputDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this._sdk.getOutputDimensions(t);}},{key:"getOutputTextureDimensions",value:function getOutputTextureDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this._sdk.getOutputTextureDimensions(t);}},{key:"getFinalDimensions",value:function getFinalDimensions(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return this._sdk.getFinalDimensions(t);}},{key:"_setImage",value:function _setImage(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this._options.editor.image;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;this._sdk.setAllOperationsToDirty();this._options.editor.image=t;this._sdk.setImage(t,e);}},{key:"_ensureImageIsResized",value:function _ensureImageIsResized(){var _this275=this;var t=this._sdk.getImage();var e=this._sdk.getRenderer();var r=this.getMaxMegapixels();var o=r?r*1e6:null;var n=e.getMaxDimensions();var s=new bx(t,o,n);if(!this._resizedImage&&s.needsResize()){return s.resize().then(function(_ref117){var a=_ref117.canvas,l=_ref117.dimensions,c=_ref117.reason;_this275._resizedImage=a;_this275._sdk.setImage(a);return a;});}return Promise.resolve(t);}},{key:"export",value:function _export(){var _this276=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(this._watermarkOperation){this._watermarkOperation.setEnabled(false);}this._sdk.setAllOperationsToDirty();return this._ensureImageIsResized().then(function(e){var r=_this276._options.editor["export"];var o=new fx(_this276._sdk,r,t);return o["export"]().then(function(n){_this276.emit("export",n);_this276._mediator.emit(pe.EVENTS.EXPORT,n,_this276);if(_this276._watermarkOperation){_this276._watermarkOperation.setEnabled(true);_this276._sdk.render();}_this276._sdk.setAllOperationsToDirty();return n;});});}},{key:"broadcastTransform",value:function broadcastTransform(t,e){var _this277=this;var r=new st.Operations.TransformOperation.TransformChange(t,e);var o=["sprite","selective-blur","radial-focus","mirrored-focus","linear-focus","blur"];o.forEach(function(n){var s=_this277.operations.get(n);if(!s){return;}s.transform(r);});}},{key:"broadcastFlip",value:function broadcastFlip(t){var _this278=this;var e=["mirrored-focus","radial-focus","linear-focus","sprite","selective-blur"];e.forEach(function(r){var o=_this278.operations.get(r);if(!o){return;}o.flip(t);});}},{key:"broadcastRotate",value:function broadcastRotate(t){var _this279=this;var e=["transform","mirrored-focus","linear-focus","radial-focus","sprite","selective-blur"];e.forEach(function(r){var o=_this279.operations.get(r);if(!o){return;}o.rotate(t);});}},{key:"_initSerializers",value:function _initSerializers(){this._serializers={"1.0.0":(N7(),Li(U7))["default"],"1.0.1":(G7(),Li(W7))["default"],"2.0.0":(X7(),Li(K7))["default"],"3.0.0":(Y7(),Li(q7))["default"],"3.1.0":(Z7(),Li(J7))["default"],"3.2.0":(tN(),Li(Q7))["default"],"3.4.0":(iN(),Li(eN))["default"],"3.5.0":(oN(),Li(rN))["default"],"3.6.0":(sN(),Li(nN))["default"],"3.7.0":(lN(),Li(aN))["default"],"3.8.0":(uN(),Li(cN))["default"],"3.9.0":(pN(),Li(mN))["default"],"3.12.0":(bN(),Li(gN))["default"]};}},{key:"serialize",value:function serialize(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"3.12.0";var r=this._serializers[e];if(!r){return Promise.reject(new Error("No serializer for version ".concat(e," found.")));}var o=new r(this);return o.serialize(t);}},{key:"deserialize",value:function deserialize(t){var e=this._serializers[t.version];if(!e){return Promise.reject(new Error("No serializer for version ".concat(t.version," found.")));}var r=new e(this);return r.deserialize(t);}},{key:"save",value:function save(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=this._options.editor.save;return this.serialize({image:e}).then(function(o){var n=JSON.stringify(o,null,2);if(t){var s="data:text/json;charset=utf-8;base64,".concat(window.encodeURI(window.btoa(n)));Ac.downloadDataURL(s,r.fileBasename);}return n;});}},{key:"reset",value:function reset(){this._sdk.reset();this.operations.reset();}},{key:"dispose",value:function dispose(){this.stop();if(this._resizedImage){$t(this._resizedImage);}this._sdk.dispose();}},{key:"getRenderer",value:function getRenderer(){return this._sdk.getRenderer();}},{key:"getSDK",value:function getSDK(){return this._sdk;}},{key:"getInputDimensions",value:function getInputDimensions(){return this._sdk.getInputDimensions();}},{key:"getImage",value:function getImage(){return this._sdk.getImage();}},{key:"getOptions",value:function getOptions(){return this._options;}},{key:"getUI",value:function getUI(){return this._ui;}},{key:"getMediator",value:function getMediator(){return this._mediator;}}]);return yN;}(zh);_N=yN;});var qs;var vN=d(function(){ue();Cd();JT();hl();sm();xN();vx();qs=/*#__PURE__*/function(_zh2){_inherits(qs,_zh2);var _super218=_createSuper(qs);function qs(){var _this280;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,qs);_this280=_super218.call(this);_this280._mediator=new zh();_this280._fontLoader=new fl(_assertThisInitialized(_this280));_this280._options=t;_this280._initOptions();_this280._initEvents();_this280._disposed=false;_this280._isReady=false;_this280._editor=new _N(_assertThisInitialized(_this280),_this280._options,_this280._mediator);if(_this280._options.editor.image){_this280._editor.setImage(_this280._options.editor.image);}_this280._mediator.once(pe.EVENTS.EDITOR_READY,function(){_this280._isReady=true;});Y.setLevel(_this280._options.logLevel);return _this280;}_createClass(qs,[{key:"export",value:function _export(){var _this$_editor;return(_this$_editor=this._editor)["export"].apply(_this$_editor,arguments);}},{key:"serialize",value:function serialize(){var _this$_editor2;return(_this$_editor2=this._editor).serialize.apply(_this$_editor2,arguments);}},{key:"deserialize",value:function deserialize(t){return this._editor.deserialize(t);}},{key:"getEditor",value:function getEditor(){return this._editor;}},{key:"isReady",value:function isReady(){return this._isReady;}},{key:"onReady",value:function onReady(t){if(!this._isReady){this._mediator.once(pe.EVENTS.EDITOR_READY,t);}else{t();}}},{key:"createFilter",value:function createFilter(t){var e=new Oc(this,this._getOptions("filter"));return e.instantiateFilterWithIdentifier(t);}},{key:"getTextDesignLayoutByID",value:function getTextDesignLayoutByID(t){var e=new uo(this,this._getOptions("textDesign"));return new(e.getLayoutByIdentifier(t))();}},{key:"getTextDesignAssetManager",value:function getTextDesignAssetManager(){return st.Operations.SpriteOperation.TextDesignSprite.AssetManager;}},{key:"getTextDesignFontManager",value:function getTextDesignFontManager(){var t=new Di(this,{fonts:pe.DEFAULTS.TEXT_DESIGN_FONTS,replaceFonts:true,isTextDesign:true});return t;}},{key:"_getOptions",value:function _getOptions(t){var e=this.getEditor();var r=e.controls;var o={};if(r&&r.get(t)){o=r.get(t).defaultOptions;}var n=e.getOptions();return Jt.deepDefaults({},n.editor.controlsOptions[t]||{},o);}},{key:"_initOptions",value:function _initOptions(){this._options=Jt.defaults(this._options,{language:"en",logLevel:"warn",crossOrigin:"anonymous",editor:{},assets:{},responsive:false,preloader:true,autoRun:true});this._options.editor=Jt.defaults(this._options.editor||{},{enableZoom:true,enableDrag:true,enableExport:true,enableKeyboardControls:true,enablePositionSnapping:true,enableRotationSnapping:true,enableSave:false,enableLoad:false,pixelRatio:Math.max(typeof window!=="undefined"&&window.devicePixelRatio||1,1),preferredRenderer:"webgl",transparent:true,clearColor:[0,0,0,0],displayResizeMessage:true,maxMegaPixels:{},displayCloseButton:false,undoMode:"global",defaultControl:"filter",forceCrop:false,snappingOptions:{},tools:["transform","filter","adjustments","focus","text","textdesign","sticker","brush","frame","overlay","library","artfilter"],controlsOrder:[["library"],["artfilter","transform","filter","adjustments","focus"],["text","textdesign","sticker","brush","frame","overlay"]],operationsOrder:["exif-orientation","artfilter","orientation","transform","filter","adjustments","radial-focus","mirrored-focus","linear-focus","blur","selective-blur","overlay","sprite","frame"],controlsOptions:{focus:{highQualityCanvasBlur:false}}});this._options.editor.snappingOptions=Jt.defaults(this._options.editor.snappingOptions,{position:{},rotation:{}});this._options.editor.snappingOptions.position=Jt.defaults(this._options.editor.snappingOptions.position,{padding:{},threshold:20});this._options.editor.snappingOptions.position.padding=Jt.defaults(this._options.editor.snappingOptions.position.padding,{left:.1,right:.1,top:.1,bottom:.1});this._options.editor.snappingOptions.rotation=Jt.defaults(this._options.editor.snappingOptions.rotation,{angles:[0,45,90,135,180,225,270,315],threshold:20});this._options.editor.controlsOptions.focus=Jt.defaults(this._options.editor.controlsOptions.focus,{highQualityCanvasBlur:false});this._options.editor.maxMegaPixels=Jt.defaults(this._options.editor.maxMegaPixels,{mobile:5,desktop:10});this._options.editor["export"]=Jt.defaults(this._options.editor["export"]||{},{format:"image/png",type:pl.IMAGE,download:true,fileBasename:"photoeditorsdk-export",quality:.8});this._options.editor.save=Jt.defaults(this._options.editor.save||{},{format:"text/json",download:true,fileBasename:"photoeditorsdk-save"});this._options.extensions=Jt.defaults(this._options.extensions||{},{languages:{},operations:[],controls:[]});this._options.assets=Jt.defaults(this._options.assets||{},{baseUrl:"assets",resolver:null});if(!(this._options.editor.image instanceof window.Image)){var t=new window.Image();if(this._options.editor.image){t.src=this._options.editor.image;this._options.editor.image=t;}}}},{key:"_initEvents",value:function _initEvents(){this._mediator.pipeEvents(this);}},{key:"_disposeEvents",value:function _disposeEvents(){this._mediator.unpipeEvents(this);}},{key:"setImage",value:function setImage(t){this._editor.setImage(t);}},{key:"getAssetPath",value:function getAssetPath(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var _this$_options$assets=this._options.assets,o=_this$_options$assets.baseUrl,n=_this$_options$assets.resolver;var s="".concat(o,"/").concat(t);n=n||function(u){return u;};if(t.match(/(ftp|http|https):\/\//)){s=t;}var a=t.replace(/assets\//,"").split("/");var l=a[0];var c={};switch(l){case"art-filters":c={identifier:a[1],type:a[2].split(".")[0]};return n("art-filter",c);case"filters":c={identifier:a[1].replace(/\.png$/g,"")};return n("filter",c);case"fonts":c={identifier:a[1].replace(/\.(woff|otf|ttf)$/g,"")};return n("font",c);case"frames":c={identifier:a[1],filename:a[2]};return n("frame",c);case"overlays":c={identifier:a[1].replace(/\.(png|jpg|jpeg)$/g,"")};return n("overlay",c);case"stickers":{var u=a[3].endsWith(".svg");var m=a[3]==="thumbs";c={category:a[1],identifier:(u?a[3]:a[4]).replace(/\.(png|svg)$/g,""),variant:u?"svg":m?"thumb":"base"};return n("sticker",c);}case"text-design":c={type:a[1]==="fonts"?"font":"image",identifier:a[2].replace(/\.(png|otf|ttf|woff2?)$/g,"")};return n("text-design",c);}if(typeof n!=="undefined"&&n!==null){s=n(s);}return s;}},{key:"getFontLoader",value:function getFontLoader(){return this._fontLoader;}},{key:"dispose",value:function dispose(){if(this._disposed){throw new Error("This instance of PhotoEditorSDK is already disposed.");}this._disposed=true;this._disposeEvents();}},{key:"render",value:function render(t){var _this281=this;return this.deserialize(t).then(function(){return _this281["export"]();});}}]);return qs;}(zh);qs.prototype.identifier="engine-wrapper";qs.Constants=pe;qs.Events=pe.EVENTS;qs.Utils=Ji;qs.JSONLoader=ro;qs.SDK=st;});var Vh=d(function(){vN();});var at={};de(at,{absoluteToRelativePoint:function absoluteToRelativePoint(){return xlt;},absoluteToRelativeSize:function absoluteToRelativeSize(){return ylt;},getBaseLocalToWorldMatrix:function getBaseLocalToWorldMatrix(){return Nx;},getLocalToParentMatrix:function getLocalToParentMatrix(){return SN;},getLocalToWorldMatrix:function getLocalToWorldMatrix(){return dm;},getPointInWorldSpace:function getPointInWorldSpace(){return F2;},getRotationBetweenCoordinateSpaces:function getRotationBetweenCoordinateSpaces(){return vlt;},getScalarInWorldSpace:function getScalarInWorldSpace(){return flt;},getSizeInOutputSpace:function getSizeInOutputSpace(){return glt;},getSizeInWorldSpace:function getSizeInWorldSpace(){return wN;},pointFromSpaceToSpace:function pointFromSpaceToSpace(){return jh;},rectTransformToAffineTransform:function rectTransformToAffineTransform(){return O2;},relativeToAbsolutePoint:function relativeToAbsolutePoint(){return _lt;},relativeToAbsoluteSize:function relativeToAbsoluteSize(){return blt;},scalarFromSpaceToSpace:function scalarFromSpaceToSpace(){return E2;},sizeFromSpaceToSpace:function sizeFromSpaceToSpace(){return hlt;}});function CN(i){return i.x!==void 0;}function O2(i){return wt.fromTRS(i.position.x,i.position.y,i.rotation,i.scale.x,i.scale.y);}function plt(i){if(i.getBaseLocalToParentMatrix){return i.getBaseLocalToParentMatrix();}return O2(i.getTransform());}function Nx(i){var t=i.getParent();var e=plt(i);if(t===void 0){return e;}var r=Nx(t);return wt.multiply(r,e);}function SN(i){if(i.getLocalToParentMatrix){return i.getLocalToParentMatrix();}return O2(i.getTransform());}function dm(i){var t=i.getParent();var e=SN(i);if(t===void 0){return e;}var r=dm(t);return wt.multiply(r,e);}function jh(i,t,e){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;var o=t.type==="output"&&r?Nx(t):dm(t);var n=e.type==="output"&&r?Nx(e):dm(e);var s=wt.getInverted(n);return wt.transformPoint(s,wt.transformPoint(o,i));}function E2(i,t,e){var r=new O(i,0);var o=new O(jh(r,t,e));var n=new O(jh(O.ZERO,t,e));return O.distance(n,o);}function hlt(i,t,e){var r=CN(i)?i.x:i.width;var o=CN(i)?i.y:i.height;var n=E2(r,t,e);var s=E2(o,t,e);return{width:n,height:s};}function F2(i,t){var e=dm(t);return wt.transformPoint(e,i);}function flt(i,t){var e=new O(i,0);var r=new O(F2(e,t));var o=new O(F2(O.ZERO,t));return O.distance(r,o);}function wN(i){var t=dm(i);var e=i.getBounds();var r={x:e.width,y:0};var o={x:0,y:e.height};var n=new O(wt.transformPoint(t,O.ZERO));var s=new O(wt.transformPoint(t,r));var a=new O(wt.transformPoint(t,o));var l=O.distance(n,s);var c=O.distance(n,a);return{width:l,height:c};}function glt(i,t){var e=wN(i);var r=t.getTransform().scale;var o={x:1/r.x,y:1/r.y};var n={width:e.width*o.x,height:e.height*o.y};return n;}function blt(i,t){var e=t.getBounds();return{width:i.width*e.width,height:i.height*e.height};}function ylt(i,t){var e=t.getBounds();return{width:i.width/e.width,height:i.height/e.height};}function _lt(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var r=t.getBounds();return{x:i.x*r.width+(e?0:r.minX),y:i.y*r.height+(e?0:r.minY)};}function xlt(i,t){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var r=t.getBounds();return{x:(i.x-(e?0:r.minX))/r.width,y:(i.y-(e?0:r.minY))/r.height};}function vlt(i,t){var e={x:1,y:0};var r=jh(e,i,t,true);var o=jh(O.ZERO,i,t,true);return Math.atan2(r.y-o.y,r.x-o.x);}var TN=d(function(){U();});function Hx(i){return typeof i!=="string"&&!Array.isArray(i)&&i.a===void 0;}function Wx(i){return typeof i!=="string"&&Array.isArray(i)&&i.length===3;}function Gx(i){return typeof i!=="string"&&!Array.isArray(i)&&i.a!==void 0;}function Vx(i){return typeof i!=="string"&&Array.isArray(i)&&i.length===4;}function kN(i){return typeof i==="string";}var R2=d(function(){});var IN=d(function(){});var A2;var DN=d(function(){U();A2=/*#__PURE__*/function(){function A2(t,e){_classCallCheck(this,A2);this.engine=e;this.transform=_re.IDENTITY;this.canvasPivot={x:0,y:0};this.previewQuality=1;this.canvas=t;}_createClass(A2,[{key:"quality",get:function get(){return this.previewQuality;}},{key:"setQuality",value:function setQuality(t){this.previewQuality=Math.min(Math.max(t,.01),1);}},{key:"getTransform",value:function getTransform(){return this.transform;}},{key:"setTransform",value:function setTransform(t){this.transform=t;}},{key:"getPosition",value:function getPosition(){return this.transform.position;}},{key:"setPosition",value:function setPosition(t,e){var r;if(typeof t==="number"){r={x:t,y:e===void 0?t:e};}else{r=t;}var o=this.transform.scale;var n=this.transform.rotation;this.setTransform(new _re(r,o,n));}},{key:"getScale",value:function getScale(){return this.transform.scale;}},{key:"setScale",value:function setScale(t,e){var r;if(typeof t!=="number"){r=t;}else{r={x:t,y:e===void 0?t:e};}var o=this.transform.position;var n=this.transform.rotation;this.setTransform(new _re(o,r,n));}},{key:"getRotation",value:function getRotation(){return this.transform.rotation;}},{key:"setRotation",value:function setRotation(t){var e=this.transform.position;var r=this.transform.scale;this.setTransform(new _re(e,r,t));}},{key:"getCanvasPivot",value:function getCanvasPivot(){return this.canvasPivot;}},{key:"setCanvasPivot",value:function setCanvasPivot(t,e){if(typeof t==="number"){this.canvasPivot={x:t,y:_typeof(e)===void 0?t:e};}else{this.canvasPivot=t;}}},{key:"getCanvasBounds",value:function getCanvasBounds(){var t=this.canvasPivot;var _this$canvas=this.canvas,e=_this$canvas.width,r=_this$canvas.height;return new je(-t.x*e,-t.y*r,e,r);}}]);return A2;}();});function jx(i){return i.getTransform!==void 0;}function EN(i){return i.getContainer!==void 0;}var FN=d(function(){});var ON=d(function(){});var RN=d(function(){});var AN=d(function(){});var BN=d(function(){});var PN=d(function(){});var MN=d(function(){});var LN=d(function(){});var zN=d(function(){});var UN=d(function(){});var NN=d(function(){});var HN=d(function(){});var WN=d(function(){});var GN=d(function(){});var VN=d(function(){});var jN=d(function(){});var $N=d(function(){});var B2=d(function(){TN();R();R2();IN();DN();FN();ON();RN();AN();BN();PN();MN();LN();zN();UN();NN();HN();WN();GN();VN();jN();$N();});var P2;var KN=d(function(){U();B2();P2=/*#__PURE__*/function(_Tr2){_inherits(P2,_Tr2);var _super219=_createSuper(P2);function P2(t){var _this282;_classCallCheck(this,P2);_this282=_super219.call(this);_this282.config=t;return _this282;}_createClass(P2,[{key:"getOutputDimensions",value:function getOutputDimensions(){var t=this.getOutputContainer();if(!t){return{width:0,height:0};}return t.getResolution();}},{key:"getSmallerOutputSide",value:function getSmallerOutputSide(){var t=this.getOutputContainer();if(!t){return 0;}var e=t.getResolution();return Math.min(e.width,e.height);}},{key:"convertPointFromPreviewIntoOutputSpace",value:function convertPointFromPreviewIntoOutputSpace(t,e){var r=wt.getInverted(at.rectTransformToAffineTransform(e));return wt.transformPoint(r,t);}},{key:"convertPointFromPreviewIntoWorldSpace",value:function convertPointFromPreviewIntoWorldSpace(t,e,r){var o=wt.getInverted(at.rectTransformToAffineTransform(e));var n=r?this.getOutputContainer().getBaseLocalToParentMatrix():this.getOutputContainer().getLocalToParentMatrix();var s=wt.multiply(n,o);return wt.transformPoint(s,t);}},{key:"convertPointFromPreviewIntoFlippedPreviewSpace",value:function convertPointFromPreviewIntoFlippedPreviewSpace(t){var e=this.getOutputContainer().getFlipTransformMatrix();return wt.transformPoint(e,t);}},{key:"convertPointFromWorldIntoPreviewSpace",value:function convertPointFromWorldIntoPreviewSpace(t,e){var r=at.rectTransformToAffineTransform(e);var o=wt.getInverted(this.getOutputContainer().getLocalToParentMatrix());var n=wt.multiply(r,o);return wt.transformPoint(n,t);}},{key:"convertPointFromOutputIntoPreviewSpace",value:function convertPointFromOutputIntoPreviewSpace(t,e){var r=at.rectTransformToAffineTransform(e);return wt.transformPoint(r,t);}},{key:"getContainersAtPreviewPoint",value:function getContainersAtPreviewPoint(t,e){var r=new Array();var o=this.convertPointFromPreviewIntoWorldSpace(t,e);var n=this.getRootContainers();var _iterator7=_createForOfIteratorHelper(n),_step7;try{for(_iterator7.s();!(_step7=_iterator7.n()).done;){var s=_step7.value;this.accumulateContainersAtWorldPointInHierarchy(o,s,r);}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}return r;}},{key:"isPreviewPointInContainer",value:function isPreviewPointInContainer(t,e,r){var o=this.convertPointFromPreviewIntoWorldSpace(t,r);return this.isWorldPointInContainer(o,e);}},{key:"isWorldPointInContainer",value:function isWorldPointInContainer(t,e){var r=at.getLocalToWorldMatrix(e);var o=wt.getInverted(r);var n=wt.transformPoint(o,t);return je.contains(e.getBounds(),n);}},{key:"accumulateContainersAtWorldPointInHierarchy",value:function accumulateContainersAtWorldPointInHierarchy(t,e,r){if(this.isWorldPointInContainer(t,e)){r.push(e);}var o=e.getChildren();var _iterator8=_createForOfIteratorHelper(o),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var n=_step8.value;if(jx(n)){this.accumulateContainersAtWorldPointInHierarchy(t,n,r);}}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}}]);return P2;}(Tr);});var ur=d(function(){B2();KN();});var si;var Go=d(function(){U();si=/*#__PURE__*/function(){function si(t){_classCallCheck(this,si);this.engine=t;this.id=At();}_createClass(si,[{key:"getID",value:function getID(){return this.id;}},{key:"getContainer",value:function getContainer(){return this.engine.getRootContainers()[0];}},{key:"getIndexInParent",value:function getIndexInParent(){var t=this.engine.rootOperations;for(var e=0;e0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;_classCallCheck(this,jt);this._x=t;this._y=e;}_createClass(jt,[{key:"x",get:function get(){return this._x;}},{key:"y",get:function get(){return this._y;}},{key:"set",value:function set(t,e){this._x=t;this._y=e;return this;}},{key:"clone",value:function clone(){return new _jt(this._x,this._y);}},{key:"copy",value:function copy(t){this._x=t.x;this._y=t.y;return this;}},{key:"clamped",value:function clamped(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this;var r=typeof t==="number"?{x:t,y:t}:t;var o=typeof e==="number"?{x:e,y:e}:e;this._x=Math.max(r.x,this._x);this._y=Math.max(r.y,this._y);this._x=Math.min(o.x,this._x);this._y=Math.min(o.y,this._y);return this;}},{key:"divide",value:function divide(t,e){if(typeof t==="number"||t===null){this._x/=t;this._y/=typeof e==="undefined"?t:e;}else{this._x/=t.x;this._y/=t.y;}return this;}},{key:"subtract",value:function subtract(t,e){if(typeof t==="number"||t===null){this._x-=t;this._y-=typeof e==="undefined"?t:e;}else{this._x-=t.x;this._y-=t.y;}return this;}},{key:"multiply",value:function multiply(t,e){if(typeof t==="number"||t===null){this._x*=t;this._y*=typeof e==="undefined"?t:e;}else{this._x*=t.x;this._y*=t.y;}return this;}},{key:"add",value:function add(t,e){if(typeof t==="number"||t===null){this._x+=t;this._y+=typeof e==="undefined"?t:e;}else{this._x+=t.x;this._y+=t.y;}return this;}},{key:"dot",value:function dot(t,e){if(typeof t==="number"||t===null){return this._x*t+this._y*(typeof e==="undefined"?t:e);}else{return this._x*t.x+this._y*t.y;}}},{key:"equals",value:function equals(t,e){if(typeof t==="number"||t===null){return t===this._x&&e===this._y;}else{return t.x===this._x&&t.y===this._y;}}},{key:"flip",value:function flip(){var t=this._x;this._x=this._y;this._y=t;return this;}},{key:"round",value:function round(){this._x=Math.round(this._x);this._y=Math.round(this._y);return this;}},{key:"ceil",value:function ceil(){this._x=Math.ceil(this._x);this._y=Math.ceil(this._y);return this;}},{key:"floor",value:function floor(){this._x=this._x|0;this._y=this._y|0;return this;}},{key:"abs",value:function abs(){this._x=Math.abs(this._x);this._y=Math.abs(this._y);return this;}},{key:"len",value:function len(){return Math.sqrt(this._x*this._x+this._y*this._y);}},{key:"min",value:function min(){return Math.min(this._x,this._y);}},{key:"max",value:function max(){return Math.max(this._x,this._y);}},{key:"toObject",value:function toObject(){return{x:this._x,y:this._y};}},{key:"toString",value:function toString(){return"Vector2({ x: ".concat(this._x,", y: ").concat(this._y," })");}},{key:"roundDecimal",value:function roundDecimal(t){this._x=parseFloat(this._x.toFixed(t));this._y=parseFloat(this._y.toFixed(t));return this;}},{key:"asArray",value:function asArray(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(t){return[this._y,this._x];}return[this._x,this._y];}}],[{key:"fromObject",value:function fromObject(t){return new _jt(t.x,t.y);}},{key:"fromSize",value:function fromSize(t){return new _jt(t.width,t.height);}},{key:"NULL",get:function get(){return new _jt(0,0);}}]);return jt;}();});var zr;var yl=d(function(){U();ur();bl();zr=/*#__PURE__*/function(){function zr(t){_classCallCheck(this,zr);this.engine=t;this.id=At();this.transform=_re.IDENTITY;this.bounds=je.ZERO;}_createClass(zr,[{key:"getID",value:function getID(){return this.id;}},{key:"getParent",value:function getParent(){var t=this.engine.getRootContainers();if(t.length===0||this.id===t[0].id){return void 0;}return t[0];}},{key:"getIndexInParent",value:function getIndexInParent(){var t=this.engine.rootOperations;for(var e=0;e0&&(this.id===t[0].id||this.id===this.engine.getOutputContainer().id)){return this.engine.rootOperations;}return[];}},{key:"getBounds",value:function getBounds(){return this.bounds;}},{key:"setPivotOnSelfAndSprite",value:function setPivotOnSelfAndSprite(t,e,r){if(typeof e==="number"){this.setPivotInternal(e,r);t.setPivot(new _jt(e,r));}else{this.setPivotInternal(e);t.setPivot(_jt.fromObject(e));}}},{key:"setPivot",value:function setPivot(t,e){this.setPivotInternal(t,e);}},{key:"getPivot",value:function getPivot(){var t=this.getBounds();return{x:-t.minX/t.width,y:-t.minY/t.height};}},{key:"getTransform",value:function getTransform(){return this.transform;}},{key:"setTransform",value:function setTransform(t){this.transform=t;}},{key:"updateTransform",value:function updateTransform(){this.setTransform(this.transform);}},{key:"getPosition",value:function getPosition(){return this.transform.position;}},{key:"setPosition",value:function setPosition(t,e){var r;if(typeof t==="number"){r={x:t,y:e===void 0?t:e};}else{r=t;}var o=this.transform.scale;var n=this.transform.rotation;this.setTransform(new _re(r,o,n));}},{key:"getScale",value:function getScale(){return this.transform.scale;}},{key:"setScale",value:function setScale(t,e){var r;if(typeof t!=="number"){r=t;}else{r={x:t,y:e===void 0?t:e};}var _this$transform=this.transform,o=_this$transform.position,n=_this$transform.rotation;this.setTransform(new _re(o,r,n));}},{key:"getRotation",value:function getRotation(){return this.transform.rotation;}},{key:"setRotation",value:function setRotation(t){var _this$transform2=this.transform,e=_this$transform2.position,r=_this$transform2.scale;this.setTransform(new _re(e,r,t));}},{key:"getSizeInWorldSpace",value:function getSizeInWorldSpace(){return at.getSizeInWorldSpace(this);}},{key:"getSizeInOutputSpace",value:function getSizeInOutputSpace(){return at.getSizeInOutputSpace(this,this.engine.getOutputContainer());}},{key:"setSizeInWorldSpace",value:function setSizeInWorldSpace(t){var e=this.getBounds();this.setScale(t.width/e.width,t.height/e.height);}},{key:"setSizeInOutputSpace",value:function setSizeInOutputSpace(t){var e=this.engine.getOutputContainer().getScale();this.setSizeInWorldSpace({width:t.width/e.x,height:t.height/e.y});}},{key:"isValid",value:function isValid(){return this.getIndexInParent()!==-1;}},{key:"setPivotInternal",value:function setPivotInternal(t,e){var r=this.getBounds();if(typeof t==="number"){this.setBoundsFromSize(r.width,r.height,{x:t,y:e});}else{this.setBoundsFromSize(r.width,r.height,t);}}},{key:"setBoundsFromSize",value:function setBoundsFromSize(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.getPivot();this.bounds=new je(-r.x*t,-r.y*e,t,e);}}]);return zr;}();});var z2;var XN=d(function(){U();ur();mm();yl();bl();z2=/*#__PURE__*/function(_zr){_inherits(z2,_zr);var _super221=_createSuper(z2);function z2(t,e){var _this284;_classCallCheck(this,z2);_this284=_super221.call(this,e);_this284.type="drawing";_this284.drawing=t;_this284.operation=e.createSpriteOperation();_this284.sprite=_this284.operation.createBrush({});_this284.operation.addSprite(_this284.sprite);_this284.radialBrush=_this284.sprite._createRadialBrush();var r=e.getRootContainers()[0];var o=r.getBounds();_this284.bounds=new je(0,0,o.width,o.height);_this284.setTransform(_re.IDENTITY);_this284.operation.setDirty(true);_this284.setData(t);return _this284;}_createClass(z2,[{key:"beginStroke",value:function beginStroke(t){if(this.currentStroke){throw new Error("A brush stroke has already been started but not finished.");}if(t.id!=="imgly_brush_radial"){throw new Error("This adapter does not support any brush faces other than the radial img.ly brush.");}this.currentBrush=t;this.currentStroke={brush:t,path:{controlPoints:[]}};this.radialBrush.setColor(dr(t.color));this.radialBrush.setHardness(t.hardness);this.radialBrush.setSize(t.size);this.currentPath=this.sprite.createPath(this.radialBrush.clone());}},{key:"addPointToCurrentStroke",value:function addPointToCurrentStroke(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;if(!this.currentStroke||!this.currentBrush||!this.currentPath){throw new Error('A brush stroke has to first be started with a call to "beginStroke(brush:Brush)"');}if(this.currentStroke.path.controlPoints.length){var l=this.currentStroke.path.controlPoints;var c=l[l.length-1];var u=this.currentBrush.size/10;var m=Math.sqrt(t.x-Math.pow(c.x,2)+(t.y-Math.pow(c.y,2)));if(m=0){this.sprite.setAlpha(t.opacity);}if(t.tintColor){this.sprite.setTintColor(dr(t.tintColor));}if(t.tintMode){this.sprite.setTintMode(t.tintMode);}this.operation.setDirty(true);}},{key:"getData",value:function getData(){return this.data;}},{key:"updateData",value:function updateData(){this.setData(this.getData());}},{key:"setTransform",value:function setTransform(t){_get(_getPrototypeOf(qx.prototype),"setTransform",this).call(this,t);var e=this.engine.getOutputContainer();var r=this.getParent();var o={width:this.bounds.width*t.scale.x,height:this.bounds.height*t.scale.y};var n=at.sizeFromSpaceToSpace(o,r,e);this.sprite.setDimensions(_jt.fromSize(n));var s=at.pointFromSpaceToSpace(t.position,r,e,true);var a=at.absoluteToRelativePoint(s,e,false);this.sprite.setPosition(new _jt(a.x,a.y));var l=at.getRotationBetweenCoordinateSpaces(r,e);var c=t.rotation+l;this.sprite.setRotation(c);this.operation.setDirty(true);}},{key:"setPivot",value:function setPivot(t,e){this.setPivotOnSelfAndSprite(this.sprite,t,e);}},{key:"getOperation",value:function getOperation(){return this.operation;}},{key:"setFlipHorizontally",value:function setFlipHorizontally(t){this.sprite.setFlipHorizontally(t);}},{key:"setFlipVertically",value:function setFlipVertically(t){this.sprite.setFlipVertically(t);}},{key:"getFlipHorizontally",value:function getFlipHorizontally(){return this.sprite.getFlipHorizontally();}},{key:"getFlipVertically",value:function getFlipVertically(){return this.sprite.getFlipVertically();}}]);return qx;}(zr);});var pm,Slt,$h;var hm=d(function(){pm=function pm(i){return 2*Math.PI-i;};Slt=function Slt(i){return-i;};$h=function $h(_ref119){var i=_ref119.rotation,_ref119$outputRotatio=_ref119.outputRotation,t=_ref119$outputRotatio===void 0?0:_ref119$outputRotatio,e=_ref119.flipHorizontally,r=_ref119.flipVertically;var o=i;if(e){o=pm(o);}if(r){o=Slt(o);}return o+t;};});function wlt(i,t){if(t){var e=1/t.unitsPerEm*i;var r=t.ascender*e;var o=t.descender*e;return r+Math.abs(o);}return i*1.1;}function nu(i,t,e,r,o,n,s){i.font="".concat(e.fontStyle||"normal"," ").concat(e.fontWeight||"normal"," ").concat(r,"px \"").concat(e.fontFamily,"\"");var a=new _Yx(i);a.setText(t);a.setMaxWidth(n);var l=a.getLines().map(function(p){return p.replace(/\s+$/i,"");});var c=wlt(r,s);var u=c*o;var m=c/5;return{width:n+m*2,height:l.length*u+m*2};}var _Yx;var ik=d(function(){_Yx=/*#__PURE__*/function(){function Yx(t){_classCallCheck(this,Yx);this.context=t;this.sourceLines=[];this.maxWidth=100;}_createClass(Yx,[{key:"getLines",value:function getLines(){var t=[];var e=[];var r=this.sourceLines.length;for(var o=0;othis.maxWidth){if(e.length>0){t.push(e.join(""));e=[c];}var p=c.replace(/\s+$/i,"");if(this.getWidth(p)>this.maxWidth){var h=this.splitWord(c);t=t.concat(h.lines);if(h.rest){e=[h.rest];}}}else{e.push(c);}}t.push(e.join(""));e=[];}return t;}},{key:"splitWord",value:function splitWord(t){var e={lines:[],rest:null};var r=t.length;var o=[];for(var n=0;nthis.maxWidth){if(o.length>0){e.lines.push(o.join(""));}o=[s];}else{o.push(s);}if(n===r-1&&o.length>0){e.rest=o.join("");}}return e;}},{key:"getWidth",value:function getWidth(t){return this.context.measureText(t).width;}},{key:"setText",value:function setText(t){this.sourceLines=t.split("\n");}},{key:"setMaxWidth",value:function setMaxWidth(t){this.maxWidth=t;}}],[{key:"buildWords",value:function buildWords(t){var e=[];var r="";var o=t.length;for(var n=0;n2&&arguments[2]!==undefined?arguments[2]:true;var o=t.inverted&&r?Math.max(0,2*t.padding):0;var n=t.width/rk;if(this.currentLayoutSize===void 0){e.seed(t.seed);var s=e.generateLayoutData(t.text,rk);this.currentLayoutData=s;this.currentLayoutSize=s.getSize();}return new je(0,0,this.currentLayoutSize.width*n+o,this.currentLayoutSize.height*n+o);}},{key:"findNextUniqueSeed",value:function findNextUniqueSeed(t,e,r){var o=r;var n=this.currentLayoutData?_su.stringify(this.currentLayoutData.getRows()):"";var s;for(var a=0;a<20;a+=1){e.seed(o);s=e.generateLayoutData(t.text,rk);if(n===_su.stringify(s.getRows())){o+=1;}else{break;}}e.seed(o);this.currentLayoutData=s;return o;}},{key:"setData",value:function setData(t){this.textDesign=_objectSpread(_objectSpread({},this.textDesign),t);if(t.id){this.id=t.id;}if(t.padding!==void 0){var e=this.textDesign.width;this.sprite.setPadding(t.padding/e);}else if(t.width){this.textDesign.padding=this.sprite.getPadding()*this.textDesign.width;}if(t.seed!==void 0){if(t.seed<0){t.seed=this.findNextUniqueSeed(this.textDesign,this.layout,Date.now());this.textDesign.seed=t.seed;}this.currentLayoutSize=void 0;this.layout.seed(t.seed);this.sprite.setSeed(t.seed);this.sprite.setLayout(this.layout);}if(t.color){this.sprite.setColor(dr(t.color));}if(t.inverted!==void 0){this.sprite.setInverted(t.inverted);}if(t.text){this.currentLayoutSize=void 0;this.sprite.setText(t.text);}if(t.width){var _e10=this.engine.getOutputContainer();var r=this.getParent();var o=_e10.getBounds();var n=Math.min(o.width,o.height);var s=at.scalarFromSpaceToSpace(t.width/n,r,_e10);this.sprite.setWidth(s);}if(t.padding!==void 0||t.seed!==void 0||t.inverted!==void 0||t.text||t.width){var _e11=this.calculateBounds(this.textDesign,this.layout);this.setBoundsFromSize(_e11.width,_e11.height);this.updatePivot();}this.operation.setDirty(true);}},{key:"getData",value:function getData(){return this.textDesign;}},{key:"updateData",value:function updateData(){this.setData(this.getData());}},{key:"setTransform",value:function setTransform(t){_get(_getPrototypeOf(su.prototype),"setTransform",this).call(this,t);var e=this.engine.getOutputContainer();var r=this.getParent();if(t.scale.x!==1||t.scale.y!==1){throw new Error("This engine doesn't support scaling TextDesign containers! You can change the bounds using the width property of the TextDesign data.");}var o=at.pointFromSpaceToSpace(t.position,r,e,true);var n=at.absoluteToRelativePoint(o,e,false);this.sprite.setPosition(new _jt(n.x,n.y));var s=at.getRotationBetweenCoordinateSpaces(r,e);this.sprite.setRotation(t.rotation+s);this.operation.setDirty(true);}},{key:"setPivot",value:function setPivot(t,e){if(typeof t==="number"){_get(_getPrototypeOf(su.prototype),"setPivot",this).call(this,t,e);}else{_get(_getPrototypeOf(su.prototype),"setPivot",this).call(this,t);}this.updatePivot();}},{key:"getOperation",value:function getOperation(){return this.operation;}},{key:"getLayoutID",value:function getLayoutID(){return this.layoutID;}},{key:"setFlipHorizontally",value:function setFlipHorizontally(t){this.sprite.setFlipHorizontally(t);}},{key:"setFlipVertically",value:function setFlipVertically(t){this.sprite.setFlipVertically(t);}},{key:"getFlipHorizontally",value:function getFlipHorizontally(){return this.sprite.getFlipHorizontally();}},{key:"getFlipVertically",value:function getFlipVertically(){return this.sprite.getFlipVertically();}},{key:"updatePivot",value:function updatePivot(){var t=this.textDesign.inverted?Math.max(0,this.textDesign.padding):0;var e=new O(this.bounds.width-2*t,this.bounds.height-2*t);var r=this.getPivot();var o=new O(r.x*this.bounds.width,r.y*this.bounds.height);var n=new O(t,t);var s=o.subtract(n);var a=s.divide(e);this.sprite.setPivot(new _jt(a.x,a.y));}}],[{key:"stringify",value:function stringify(t){return JSON.stringify(t,_su.serializer());}},{key:"serializer",value:function serializer(){var t=[];var e=[];var r=function r(o,n){if(t[0]===n)return"[Circular ~]";return"[Circular ~.".concat(e.slice(0,t.indexOf(n)).join("."),"]");};return function o(n,s){var a=this;if(t.length>0){var l=t.indexOf(a);if(~l){t.splice(l+1);e.splice(l,Infinity,n);}else{t.push(a);e.push(n);}if(~t.indexOf(s)){s=r.call(a,n,s);}}else{t.push(s);}return s;};}}]);return su;}(zr);});var ai,Jx,fm;var tH=d(function(){Vh();Tt();R();U();ur();L2();XN();N2();qN();YN();V2();j2();K2();q2();J2();Z2();Q2();ek();JN();ZN();QN();bl();ai=st.Operations.OverlayOperation.BLEND_MODES;Jx="imgly_font_open_sans_bold";fm=/*#__PURE__*/function(_P2){_inherits(fm,_P2);var _super235=_createSuper(fm);function fm(t){var _this302;_classCallCheck(this,fm);_this302=_super235.call(this,t);_this302.previews=Array();_this302.rootOperationStack=[];_this302.deferredRenderQueue=[];_this302.operationStackOffset=1;_this302.enforceOperationOrder=function(){_this302.refreshFlipIndex();_this302.refreshFrameIndex();};_this302.isSpriteTop=function(t){var e=_this302.rootOperationStack.findIndex(function(_ref121){var o=_ref121.id;return t===o;});var r=1;if(_this302.rootOperationStack.find(function(o){return o.type==="frame";})){r+=1;}return e+r===_this302.rootOperationStack.length;};_this302.setWatermarkOpacity=function(t){var e=_this302.sdk.getOperationsStack();var r=e.getByIdentifier("watermark");if(r){r.set({alpha:t});}};var r,o;_this302.assetProvider=t.assetProvider||new _p();var e;if(((r=t==null?void 0:t.watermark)==null?void 0:r.watermarkURI)&&typeof t.watermark.watermarkURI==="string"&&t.watermark.watermarkURI.slice(0,5)==="data:"){e=t.watermark.watermarkURI;}else if(((o=t==null?void 0:t.watermark)==null?void 0:o.watermarkURI)&&typeof t.watermark.watermarkURI==="string"&&t.watermark.watermarkURI.trim()){e=cn(t.watermark.watermarkURI)?t.watermark.watermarkURI:_this302.assetProvider.getPath(t.watermark.watermarkURI);}_this302.wrapper=new qs({license:t.license,crossOrigin:t.crossOrigin,assets:{resolver:function resolver(n,s){return _this302.resolveAssetForSDK(n,s);}},editor:{preferredRenderer:t.preferredRenderer,pixelRatio:1,clearColor:ct(t.backgroundColor)},watermark:_objectSpread(_objectSpread({},ct(t.watermark)),{},{watermarkURI:e})});_this302.editor=_this302.wrapper.getEditor();_this302.sdk=_this302.editor.getSDK();_this302.sdk.setRenderMode("adapter");_this302.tempCanvas=document.createElement("canvas");_this302.sdk.setCanvas(_this302.tempCanvas);if(t.preferredRenderer==="webgl"){var n=document.createElement("canvas");var s=n.getContext("webgl")||n.getContext("experimental-webgl");_this302.maxTextureDimension=s.getParameter(s.MAX_TEXTURE_SIZE);$t(n);}else{_this302.maxTextureDimension=Infinity;}return _this302;}_createClass(fm,[{key:"configuration",get:function get(){return this.config;}},{key:"pesdk",get:function get(){return this.sdk;}},{key:"rootOperations",get:function get(){return this.rootOperationStack;}},{key:"dispose",value:function dispose(){$t(this.tempCanvas);this.rootContainer.dispose();this.pesdk.dispose();this.wrapper.dispose();}},{key:"render",value:function render(t){var _this303=this;return new Promise(function(e){var r=function r(){return new Promise(function(o){var n=t.canvas;var s=t.getTransform();var a=_this303.outputContainer.getPivot();var l=t.getCanvasBounds();var c=t.quality;var u=_this303.tempCanvas;_this303.sdk.setTextureQuality(c);var m=_this303.sdk.getOutputDimensions();u.width=m.x;u.height=m.y;_this303.sdk.getRenderer().resizeTo(new _jt(u.width,u.height));return _this303.sdk.render(true).then(function(){var p=n.getContext("2d");p.clearRect(0,0,n.width,n.height);p.save();p.translate(-l.minX,-l.minY);p.translate(s.position.x,s.position.y);p.rotate(s.rotation);p.scale(s.scale.x,s.scale.y);p.translate(-a.x*u.width,-a.y*u.height);p.scale(1/t.quality,1/t.quality);p.drawImage(u,0,0);p.restore();e();_this303.deferredRenderQueue.shift();if(_this303.deferredRenderQueue.length){_this303.sdk.setAllOperationsToDirty();Promise.resolve(_this303.deferredRenderQueue[0]().then(o));}else{o();}});});};_this303.deferredRenderQueue.push(r);if(_this303.deferredRenderQueue.length===1){r();}});}},{key:"createPreview",value:function createPreview(t){var e=new A2(t,this);this.previews.push(e);return e;}},{key:"export",value:function(){var _export2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee14(){var _this304=this;var t,e,r,o,n,_args15=arguments;return regeneratorRuntime.wrap(function _callee14$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:t=_args15.length>0&&_args15[0]!==undefined?_args15[0]:"image";e=_args15.length>1&&_args15[1]!==undefined?_args15[1]:"image/png";r=_args15.length>2&&_args15[2]!==undefined?_args15[2]:1;o=_args15.length>3&&_args15[3]!==undefined?_args15[3]:true;n=_args15.length>4&&_args15[4]!==undefined?_args15[4]:false;return _context15.abrupt("return",new Promise(function(s){var a=function a(){return new Promise(function(l){return _this304.sdk["export"](_this304.mapToRenderType(t),_this304.mapToImageFormat(e),r,o,n).then(function(c){s(c);_this304.deferredRenderQueue.shift();if(_this304.deferredRenderQueue.length){Promise.resolve(_this304.deferredRenderQueue[0]().then(l));}else{l();}});});};_this304.deferredRenderQueue.push(a);if(_this304.deferredRenderQueue.length===1){a();}}));case 6:case"end":return _context15.stop();}}},_callee14);}));function _export(){return _export2.apply(this,arguments);}return _export;}()},{key:"getRootContainers",value:function getRootContainers(){return[this.rootContainer];}},{key:"getOutputContainer",value:function getOutputContainer(){return this.outputContainer;}},{key:"findContainerByID",value:function findContainerByID(t){if(t===this.rootContainer.getID()){return this.rootContainer;}return this.rootOperationStack.find(function(e){return e.getID()===t;});}},{key:"findEffectByID",value:function findEffectByID(t){return this.rootOperationStack.find(function(e){return e.getID()===t;});}},{key:"addImage",value:function addImage(t,e,r){if(this.rootContainer){throw new Error("A background image already exists - did you mean to use addSticker?");}var o=new $x(t,this);this.rootContainer=o;if(!this.outputContainer){var _o$getBounds=o.getBounds(),n=_o$getBounds.width,s=_o$getBounds.height;var a={resolution:{width:n,height:s},flipHorizontally:false,flipVertically:false};var l=this.sdk.createOperation("output",{},false);var c=this.sdk.createOperation("flip",{},false);this.insertIntoOperationsStack(l,this.operationStackOffset-1);this.insertIntoOperationsStack(c,this.operationStackOffset);this.outputContainer=new Kx(a,l,c,this);}return o;}},{key:"addSticker",value:function addSticker(t,e,r){if(!e){throw new Error("This engine does not support adding stickers as root elements.");}this.ensureContainerIsRoot(e);var o=new qx(t,this);this.addToStackAtIndex(o,r);return o;}},{key:"addStickerFromAssets",value:function addStickerFromAssets(t,e,r){var _this305=this;if(!e){throw new Error("This engine does not support adding stickers as root elements.");}this.ensureContainerIsRoot(e);return new Promise(function(o,n){var s=new Image();s.onload=function(){var a={image:s,opacity:1};var l=new qx(a,_this305);_this305.addToStackAtIndex(l,r);o(l);};s.onerror=function(a){n(a);};s.crossOrigin=_this305.config.crossOrigin||null;s.src=_this305.assetProvider.getAssetSource("sticker",t);});}},{key:"addText",value:function addText(t,e,r){if(!e){throw new Error("This engine does not support adding text as root elements.");}var o=this.assetProvider.getFontManager();if(!o.isFontLoaded(t.fontIdentifier||Jx)){throw new Error("Adding text synchronously only works if the required font is already loded! Consider using the asynchronous addTextWithFontLoading function instead!");}this.ensureContainerIsRoot(e);var n=_objectSpread({text:"",fontIdentifier:Jx,fontSize:20,lineHeight:1,alignment:"center",textColor:[1,1,1],backgroundColor:[0,0,0,0],width:100},t);var s=new _Ys(n,this);this.addToStackAtIndex(s,r);return s;}},{key:"addTextWithFontLoading",value:function addTextWithFontLoading(t,e,r){var _this306=this;if(!e){throw new Error("This engine does not support adding text as root elements.");}var o=this.assetProvider.getFontManager();var n=t.fontIdentifier||Jx;return new Promise(function(s,a){o.loadFontWithIdentifier(n).then(function(){_this306.ensureContainerIsRoot(e);var l=_objectSpread({text:"",fontIdentifier:Jx,fontSize:20,lineHeight:1,alignment:"center",textColor:[1,1,1],backgroundColor:[0,0,0,0],width:100},t);var c=new _Ys(l,_this306);_this306.addToStackAtIndex(c,r);s(c);})["catch"](a);});}},{key:"addTextDesignAsync",value:function(){var _addTextDesignAsync=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee15(){var _this307=this;var t,e,r,o,n,s,a,l,c,u,m,p,_args16=arguments;return regeneratorRuntime.wrap(function _callee15$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:t=_args16.length>0&&_args16[0]!==undefined?_args16[0]:"imgly_text_design_blocks";e=_args16.length>1?_args16[1]:undefined;r=_args16.length>2?_args16[2]:undefined;o=_args16.length>3?_args16[3]:undefined;if(r){_context16.next=6;break;}throw new Error("This engine does not support adding TextDesign as a root element.");case 6:n=_objectSpread({seed:Date.now(),padding:0,text:"",color:[0,0,0],inverted:false,width:100},e);s=this.wrapper.getTextDesignLayoutByID(t);if(s){_context16.next=10;break;}throw new Error("The layout could not be loaded for the given id: ".concat(t));case 10:a=s.getImagePaths().map(function(h){var g=h.split("/").pop()||"";return{path:h,fullPath:_this307.assetProvider.getAssetSource("textdesign",g)};});l=this.wrapper.getTextDesignAssetManager();c=this.wrapper.getTextDesignFontManager();u=c.getVariationsByIdentifier();l.setFonts(u);_context16.next=17;return l.loadImages(a);case 17:s.onImagesLoaded();m=Object.keys(u);p=this.assetProvider.getFontManager();return _context16.abrupt("return",p.loadFontsWithIdentifiers(m).then(function(){_this307.ensureContainerIsRoot(r);var h=new _su(n,s,_this307);_this307.addToStackAtIndex(h,o);return Promise.resolve(h);}));case 21:case"end":return _context16.stop();}}},_callee15,this);}));function addTextDesignAsync(){return _addTextDesignAsync.apply(this,arguments);}return addTextDesignAsync;}()},{key:"addDrawing",value:function addDrawing(t,e,r){if(!e){throw new Error("This engine does not support DrawingContainers as root elements.");}this.ensureContainerIsRoot(e);var o=new z2(t,this);this.addToStackAtIndex(o,r);return o;}},{key:"addGaussianBlur",value:function addGaussianBlur(t,e,r){this.ensureContainerIsRoot(e);var o=new G2(t,this,this.sdk.createOperation("blur",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addRadialBlur",value:function addRadialBlur(t,e,r){this.ensureContainerIsRoot(e);var o=new tk(t,this,this.sdk.createOperation("radial-focus",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addMirroredBlur",value:function addMirroredBlur(t,e,r){this.ensureContainerIsRoot(e);var o=new Y2(t,this,this.sdk.createOperation("mirrored-focus",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addLinearBlur",value:function addLinearBlur(t,e,r){this.ensureContainerIsRoot(e);var o=new $2(t,this,this.sdk.createOperation("linear-focus",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addDuoToneFilter",value:function addDuoToneFilter(t,e,r){throw new Error("Not supported! Use addDuoToneFilterFromAssets instead");}},{key:"addDuoToneFilterFromAssets",value:function addDuoToneFilterFromAssets(t,e,r){var _this308=this;this.ensureContainerIsRoot(e);var o=this.sdk.getOperationsStack();var n=o.getByIdentifier("filter");if(n&&n.getIdentifier()!==t){this.sdk.removeOperation(n);}var s=n||this.sdk.createOperation("filter",{identifier:t},false);return new Promise(function(a,l){try{var c=_this308.assetProvider.getDuotoneFilterAsset(t);var u={colorIntensity:c.defaultIntensity||0};var m=new st.Operations.FilterOperation.Filters.DuoToneFilter({intensity:u.colorIntensity,lightColor:st.Color.fromHex(c.lightColor),darkColor:st.Color.fromHex(c.darkColor)});var p=new U2(m,s,u,_this308);_this308.addToStackAtIndex(p,r);a(p);}catch(c){if(c){l(c);}}});}},{key:"addLUTFilter",value:function addLUTFilter(t,e,r){throw new Error("Not supported! Use addLUTFilterFromAssets instead");}},{key:"addLUTFilterFromAssets",value:function addLUTFilterFromAssets(t,e,r){var _this309=this;this.ensureContainerIsRoot(e);var o=this.sdk.getOperationsStack();var n=o.getByIdentifier("filter");if(n&&n.getIdentifier()!==t){this.sdk.removeOperation(n);}var s=n||this.sdk.createOperation("filter",{identifier:t},false);return this.getLutFilterImage(t).then(function(a){var l=_this309.assetProvider.getLUTFilterAsset(t);var c={horizontalTileCount:l.horizontalTileCount||5,verticalTileCount:l.verticalTileCount||5,intensity:l.defaultIntensity||1};var u=new st.Operations.FilterOperation.Filters.ThreeDLUTFilter(_objectSpread(_objectSpread({},c),{},{image:a}));var m=_objectSpread(_objectSpread({},c),{},{lutImage:new Image()});var p=new X2(u,s,m,_this309);_this309.addToStackAtIndex(p,r);return p;});}},{key:"getLutFilterImage",value:function getLutFilterImage(t){var _this310=this;return new Promise(function(e,r){oS({src:_this310.assetProvider.getAssetSource("filter",t),crossOrigin:_this310.config.crossOrigin||null,key:"filter",resolve:e,reject:r});});}},{key:"addAdjustments",value:function addAdjustments(t,e,r){this.ensureContainerIsRoot(e);var o=new M2(t,this,this.sdk.createOperation("adjustments",{},false));this.addToStackAtIndex(o,r);return o;}},{key:"addOverlay",value:function addOverlay(t,e,r){this.ensureContainerIsRoot(e);var o=new Xx(this.sdk.createOperation("overlay",{},false),t,this);this.addToStackAtIndex(o,r);return o;}},{key:"addOverlayFromAssets",value:function addOverlayFromAssets(t,e,r){var _this311=this;this.ensureContainerIsRoot(e);return new Promise(function(o,n){oS({src:_this311.assetProvider.getAssetSource("overlay",t),crossOrigin:_this311.config.crossOrigin||null,key:"overlay",resolve:function resolve(s){var a=_this311.sdk.getOperationsStack();var l=a.getByIdentifier("overlay");if(l&&l.getIdentifier()!==t){a.remove(l);}var c=l||_this311.sdk.createOperation("overlay",{},false);var u={image:s,opacity:1,blendMode:"normal"};var m=new Xx(c,u,_this311);_this311.addToStackAtIndex(m,r);o(m);},reject:n});});}},{key:"addFrame",value:function addFrame(t,e,r){throw new Error("Not supported!");}},{key:"addFrameFromAssets",value:function(){var _addFrameFromAssets=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee16(t,e,r){var o,n,s,a,l,c,u;return regeneratorRuntime.wrap(function _callee16$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:this.ensureContainerIsRoot(e);o=this.assetProvider.getFrameAsset(t);if(o){_context17.next=4;break;}throw new Error("The requested asset does not exist! ".concat(t));case 4:n=new H2(o,this);_context17.next=7;return n.load();case 7:s=this.getOutputContainer().getBounds();a=Math.min(s.width,s.height);l=this.sdk.createOperation("frame",{},false);l.setFrame(n.getFrame());c={opacity:1,tintColor:[1,1,1],tintable:false,width:Math.max(1,.1*a),imageGroups:n.getFrame().imageGroups};u=new W2(l,c,this);this.addToStackAtIndex(u,r);return _context17.abrupt("return",Promise.resolve(u));case 15:case"end":return _context17.stop();}}},_callee16,this);}));function addFrameFromAssets(_x21,_x22,_x23){return _addFrameFromAssets.apply(this,arguments);}return addFrameFromAssets;}()},{key:"removeEffect",value:function removeEffect(t){if(!t.isValid()){return;}var e=t;var r=e.getOperation();this.sdk.removeOperation(r);this.sdk.setAllOperationsToDirty();this.rootOperationStack.splice(t.getIndexInParent(),1);}},{key:"removeContainer",value:function removeContainer(t){if(!t.isValid()||t.type==="output"){return;}var e=t;var r=e.getOperation();this.sdk.removeOperation(r);this.sdk.setAllOperationsToDirty();this.rootOperationStack.splice(t.getIndexInParent(),1);}},{key:"refreshOutputIndex",value:function refreshOutputIndex(){var t=this.sdk.getOperationsStack().getIndexByIdentifier("output");this.moveInOperationsStack(t,this.operationStackOffset-1);}},{key:"refreshFlipIndex",value:function refreshFlipIndex(){var t=this.sdk.getOperationsStack().getIndexByIdentifier("flip");var e=this.sdk.getOperationsStack().getStack().length-1;if(t!==e){this.moveInOperationsStack(t,e);}}},{key:"refreshFrameIndex",value:function refreshFrameIndex(){var t=this.sdk.getOperationsStack().getIndexByIdentifier("frame");var e=this.sdk.getOperationsStack().getStack().length-1;if(t!==-1&&t!==e){this.moveInOperationsStack(t,e);}}},{key:"mapToRenderType",value:function mapToRenderType(t){switch(t){case"image":return st.RenderType.IMAGE;case"data-url":return st.RenderType.DATAURL;case"blob":return st.RenderType.BLOB;case"ms-blob":return st.RenderType.MSBLOB;default:return st.RenderType.IMAGE;}}},{key:"mapToImageFormat",value:function mapToImageFormat(t){switch(t){case"image/png":return st.ImageFormat.PNG;case"image/jpeg":return st.ImageFormat.JPEG;default:return null;}}},{key:"mapBlendMode",value:function mapBlendMode(t){switch(t){case ai.NORMAL:return"normal";case ai.OVERLAY:return"overlay";case ai.HARD_LIGHT:return"hardLight";case ai.SOFT_LIGHT:return"softLight";case ai.MULTIPLY:return"multiply";case ai.DARKEN:return"darken";case ai.LIGHTEN:return"lighten";case ai.SCREEN:return"screen";case ai.COLOR_BURN:return"colorBurn";default:return"normal";}}},{key:"reverseMapBlendMode",value:function reverseMapBlendMode(t){switch(t){case"normal":return ai.NORMAL;case"overlay":return ai.OVERLAY;case"hardLight":return ai.HARD_LIGHT;case"softLight":return ai.SOFT_LIGHT;case"multiply":return ai.MULTIPLY;case"darken":return ai.DARKEN;case"lighten":return ai.LIGHTEN;case"screen":return ai.SCREEN;case"colorBurn":return ai.COLOR_BURN;default:return ai.NORMAL;}}},{key:"createSpriteOperation",value:function createSpriteOperation(){return this.sdk.createOperation("sprite",{},false);}},{key:"moveIndex",value:function moveIndex(t,e){var r=this.getSiblingIndex(t);if(r===-1){throw new Error("The item to be moved is not part of any stack.");}this.moveInStack(this.rootOperationStack,r,e);var o=this.operationStackOffset;this.moveInOperationsStack(r+o,e+o);this.enforceOperationOrder();}},{key:"ensureContainerIsRoot",value:function ensureContainerIsRoot(t){var e=t.getID();if(e!==this.rootContainer.getID()){throw new Error("This engine doesn't support adding this effect/container to anything other than the root image container");}}},{key:"addToStackAtIndex",value:function addToStackAtIndex(t,e){if(e&&e<0){throw new Error("The given index may not be negative: ".concat(e));}if(e===void 0){this.rootOperationStack.push(t);}else{this.rootOperationStack.splice(e,0,t);}var r=this.rootOperationStack.length-1;var o=e!==void 0?e:r;o+=this.operationStackOffset;if(EN(t)){this.insertIntoOperationsStack(t.getOperation(),o);}else{this.insertIntoOperationsStack(t.getOperation(),o);}this.sdk.setAllOperationsToDirty();}},{key:"insertIntoOperationsStack",value:function insertIntoOperationsStack(t,e){var r=this.sdk.getOperationsStack().getStack();var o=r.length;var n=Math.max(Math.min(e,o),0);for(var s=o-1;s>=n;s-=1){var a=r[s];r[s+1]=a;}r[n]=t;this.sdk.setAllOperationsToDirty();this.enforceOperationOrder();}},{key:"moveInStack",value:function moveInStack(t,e,r){var o=t.length;var n=Math.max(Math.min(e,o-1),0);var s=Math.max(Math.min(r,o-1),0);if(n===s){return;}var a=t[n];if(n=s;_l5-=1){t[_l5+1]=t[_l5];}}t[s]=a;}},{key:"moveInOperationsStack",value:function moveInOperationsStack(t,e){var r=this.sdk.getOperationsStack().getStack();var o=r.length;var n=Math.min(Math.max(0,t),o-1);var s=Math.min(Math.max(0,e),o-1);if(n===s){return;}var a=r[n];if(n=s;_l6-=1){r[_l6+1]=r[_l6];}}r[s]=a;this.sdk.getOperationsStack().setAllToDirty();}},{key:"getSiblingIndex",value:function getSiblingIndex(t){return t.getIndexInParent();}},{key:"resolveAssetForSDK",value:function resolveAssetForSDK(t,e){e=e;switch(t){case"filter":return this.assetProvider.getAssetSource("filter",e.identifier);case"overlay":return this.assetProvider.getAssetSource("overlay",e.identifier);case"font":return this.assetProvider.getAssetSource("font",e.identifier);default:return"";}return"";}}]);return fm;}(P2);});var Zx;var eH=d(function(){Vh();R();Zx=/*#__PURE__*/function(){function Zx(t){var _this312=this;_classCallCheck(this,Zx);this.isEmpty=false;this.isValid=false;this.isWhiteLabel=function(){return _this312.isValid&&_this312.licenseChecker.isWhiteLabel();};this.areCustomAssetsAllowed=function(){return _this312.isEmpty||!_this312.isValid||_this312.licenseChecker.areCustomAssetsAllowed();};if(t&&t.length!==0){this.licenseChecker=new st.LicenseChecker(t);this.isValid=this.licenseChecker.validate();}else if(t===""){this.isEmpty=true;}}_createClass(Zx,[{key:"isToolAllowed",value:function isToolAllowed(t){if(this.licenseChecker&&this.isValid&&t!=="customTool"){return this.licenseChecker.isToolAllowed(t);}return true;}}]);return Zx;}();});var iH=d(function(){tH();yl();Go();j2();Z2();V2();ek();J2();K2();N2();q2();L2();Q2();ik();eH();});var zn=d(function(){iH();ur();});var ok,rH,Un,Vo,mr,nk;var pr=d(function(){zn();ok=function ok(i){var t=Number(i).toString(16);if(t.length<2){t="0".concat(t);}return t;};rH=function rH(i,t,e){var r=ok(i*255);var o=ok(t*255);var n=ok(e*255);return"#".concat(r).concat(o).concat(n);};Un=function Un(i){if(Vx(i)){var _i4=_slicedToArray(i,4),t=_i4[0],e=_i4[1],r=_i4[2],o=_i4[3];return"rgba(".concat(t*255,", ").concat(e*255,", ").concat(r*255,", ").concat(o,")");}if(Gx(i)){var _t30=i.r,_e12=i.g,_r11=i.b,_o11=i.a;return"rgba(".concat(_t30*255,", ").concat(_e12*255,", ").concat(_r11*255,", ").concat(_o11,")");}if(Wx(i)){var _i5=_slicedToArray(i,3),_t31=_i5[0],_e13=_i5[1],_r12=_i5[2];return rH(_t31,_e13,_r12);}if(Hx(i)){var _t32=i.r,_e14=i.g,_r13=i.b;return rH(_t32,_e14,_r13);}return i;};Vo=function Vo(i){return i.map(function(t){return{identifier:t.name,color:t.color,colorString:Un(t.color)};});};mr={black:[0/255,0/255,0/255,1],white:[255/255,255/255,255/255,1],gray:[191/255,191/255,191/255,1],blue:[102/255,134/255,255/255,1],skyBlue:[102/255,204/255,255/255,1],red:[231/255,80/255,80/255,1],orange:[242/255,136/255,85/255,1],yellow:[255/255,247/255,99/255,1]};nk={transparent:[0/255,0/255,0/255,0],black:[0/255,0/255,0/255,1],white:[255/255,255/255,255/255,1],blue:[102/255,134/255,255/255,1],skyBlue:[102/255,204/255,255/255,1],red:[231/255,80/255,80/255,1],orange:[242/255,136/255,85/255,1],yellow:[255/255,247/255,99/255,1]};});var Qx;var sk=d(function(){R();Qx=["library",["transform","filter","adjustment"],["focus","frame","overlay"],["text","textdesign","sticker","brush"]];});var _l;var tv=d(function(){R();U();sk();_l={image:"",license:"",order:"default",language:"en",theme:"dark",layout:"advanced",mainCanvasActions:["undo","redo","export","close"],displayResizeWarning:false,displayCloseWarning:true,displayCanvasRendererWarning:true,displayToolControlBarTitle:true,displaySerializationModal:true,displayDiscardChangesWarning:true,engine:{crossOrigin:"anonymous",downscaleOptions:{maxMegaPixels:{desktop:10,mobile:5}},preferredRenderer:WF()?"webgl":"canvas",backgroundColor:[0,0,0,1]},enableZoom:true,scaleImageToFit:true,restrictZoomOutToDefault:true,forceCrop:false,assetBaseUrl:"assets/",defaultTool:"filter",tools:Qx,snapping:new Kg(),filter:new Yg(),focus:new Jg(),adjustment:new qg(),library:new rb(),overlay:new ob(),sticker:new nb(),text:new sb(),textdesign:new lb(),frame:new Zg(),brush:new ab(),transform:new cb(),"export":{image:{exportType:"image",format:"image/png",quality:.9,enableDownload:true,transparent:true},filename:"photoeditorsdk-export"},custom:{},watermark:new Xg()};});var oH=d(function(){});var au;var ev=d(function(){var _au;R();au=(_au={},_defineProperty(_au,"brightness",0),_defineProperty(_au,"saturation",0),_defineProperty(_au,"contrast",0),_defineProperty(_au,"gamma",0),_defineProperty(_au,"clarity",0),_defineProperty(_au,"exposure",0),_defineProperty(_au,"shadows",0),_defineProperty(_au,"highlights",0),_defineProperty(_au,"whites",0),_defineProperty(_au,"blacks",0),_defineProperty(_au,"temperature",0),_defineProperty(_au,"sharpness",0),_au);});var Zi=d(function(){});var _Ne;var Nn=d(function(){U();_Ne=/*#__PURE__*/function(){function Ne(t,e){var _this313=this;_classCallCheck(this,Ne);this.assets=[];this.entityMapper=function(t){if("items"in t){return _this313.categoryMapper(t);}return _this313.itemMapper(t);};this.categoryMapper=function(t){return t?_objectSpread(_objectSpread({},t),{},{thumbnailURI:_this313.getCategoryThumbnailURI(t),name:_this313.config.locale[t.identifier]||t.name,items:t.items.map(_this313.itemMapper)}):null;};this.itemMapper=function(t){return _objectSpread(_objectSpread({},t),{},{thumbnailURI:_this313.getItemThumbnailURI(t),name:_this313.config.locale[t.identifier]||("name"in t?t.name:"")});};this.getCategoryThumbnailURI=function(t){if(t.thumbnailURI){if(cn(t.thumbnailURI)||t.thumbnailURI.substr(0,10)==="data:image"){return t.thumbnailURI;}return _this313.config.getAssetPath(t.thumbnailURI||"");}return"";};this.getItemThumbnailURI=function(t){var r;if((r=t.thumbnailURI)==null?void 0:r.trim()){if(cn(t.thumbnailURI)||t.thumbnailURI.substr(0,10)==="data:image"){return t.thumbnailURI;}return _this313.config.getAssetPath(t.thumbnailURI||"");}var e=t[_this313.config.itemFallbackKey];if(!e)return"";return _this313.config.getAssetPath(e);};this.config=e;this.assets=t.map(this.entityMapper).filter(Boolean);}_createClass(Ne,[{key:"categories",get:function get(){return this.assets.reduce(function(t,e){if(_Ne.isCategory(e)){return[].concat(_toConsumableArray(t),[e]);}return void 0;},[]).filter(Boolean);}},{key:"items",get:function get(){return this.assets.reduce(function(t,e){if(_Ne.isCategory(e)){return[].concat(_toConsumableArray(t),_toConsumableArray(e.items));}return[].concat(_toConsumableArray(t),[e]);},[]).filter(Boolean);}}],[{key:"isCategory",value:function isCategory(t){return Object.prototype.hasOwnProperty.call(t,"items");}}]);return Ne;}();});var Js;var Kh=d(function(){Js=/*#__PURE__*/function(){function Js(t,e){_classCallCheck(this,Js);this.from=t;this.to=e;}_createClass(Js,[{key:"contains",value:function contains(t){return this.from<=t&&t<=this.to;}},{key:"clamp",value:function clamp(t){return Math.min(Math.max(this.from,t),this.to);}}]);return Js;}();});var Tlt,gm;var nH=d(function(){Tt();R();Kh();ev();Tlt=new Js(-1,1);gm=/*#__PURE__*/function(){function gm(t){var _this314=this;_classCallCheck(this,gm);this.editAdjustments=function(_ref122){var t=_ref122.type,e=_ref122.value;var r=Tlt.clamp(e);_this314.state[t]=r;};this.reset=function(){Ve(function(){if(_this314.indexInContainer===-1){Object.keys(au).forEach(function(t){_this314.state[t]=au[t];});_this314.orderHelper.removeIndex("adjustment");}});};this.setAdjustmentEffect=function(t){var e=_this314.orderHelper.addIndex("adjustment");if(_this314.effect){_this314.effect.setProperties(t);}else{_this314.effect=_this314.engineMediator.engine.addAdjustments(t,_this314.engineMediator.image.container,e);}return _this314.effect.getProperties();};this.removeAdjustmentEffect=function(){if(_this314.effect){_this314.engineMediator.engine.removeEffect(_this314.effect);if(_this314.indexInContainer===-1){_this314.effect=void 0;}}};this.engineMediator=t;this.state=au;}_createClass(gm,[{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}},{key:"orderHelper",get:function get(){return this.engineMediator.orderHelper;}}]);return gm;}();f([Q],gm.prototype,"state",2);f([C],gm.prototype,"editAdjustments",2);f([C],gm.prototype,"reset",2);});var Zt;var sH=d(function(){Tt();R();U();Zi();Nn();ev();nH();Zt=/*#__PURE__*/function(){function Zt(t){var _this315=this;_classCallCheck(this,Zt);this.dirty=Q.box(false);this.isHistoryChanged=false;this.editAdjustments=function(_ref123){var t=_ref123.type,e=_ref123.value;_this315.isHistoryChanged=!(0,Ye["default"])(_this315.state[t],e);_this315.pureSetAdjustment({type:t,value:e});_this315.editor.render();};this.toolSnapshot=function(){if((0,Ye["default"])(_this315.state,au)){_this315.dirty.set(false);}else{_this315.dirty.set(true);}if(_this315.isHistoryChanged){_this315.addSnapshot("edit","adjustment");_this315.isHistoryChanged=false;}};this.addSnapshot=function(t,e){_this315.editor.addSnapshot(void 0,t,e);};this.toggleOptionSelection=function(t){_this315.selectedOption=t;};this.pureSetAdjustment=function(_ref124){var t=_ref124.type,e=_ref124.value;var r=_this315.adjustmentsStore.setAdjustmentEffect(_defineProperty({},t,e));_this315.adjustmentsStore.editAdjustments({type:t,value:r[t]});};this.pureReset=function(){_this315.dirty.set(false);_this315.adjustmentsStore.removeAdjustmentEffect();_this315.adjustmentsStore.reset();_this315.selectedOption="";};this.reset=function(){_this315.pureReset();_this315.addSnapshot("delete",_this315.locale.controls.buttonReset);_this315.editor.render();};this.updateStateFromHistory=function(t){if((0,Ye["default"])(t,_this315.state)){return;}if((0,Ye["default"])(t,au)){_this315.pureReset();return;}Ve(function(){_this315.dirty.set(Object.values(t).some(function(e){return e!==0;}));Object.keys(t).forEach(function(e){_this315.pureSetAdjustment({type:e,value:t[e]});});});};this.updateStateFromSerialization=function(t){_this315.updateStateFromHistory(t);};this.editor=t;this.adjustmentsStore=new gm(this.editor.engineMediator);this.selectedOption="";var e=this.editor.assetProvider.getAssets("adjustment");this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},this.config),{},{locale:_objectSpread(_objectSpread({},this.locale.items),this.locale.categories),getAssetPath:this.editor.getAssetPath("adjustment")}));}_createClass(Zt,[{key:"selectedAdjustmentType",get:function get(){return this.selectedOption;}},{key:"isDirty",get:function get(){return this.dirty.get();}},{key:"state",get:function get(){return this.adjustmentsStore.state;}},{key:"selectedOptionLabel",get:function get(){var _this316=this;var t=this.items.find(function(e){return e?e.identifier===_this316.selectedOption:false;});return t?t.name:"";}},{key:"brightness",get:function get(){return this.state.brightness;}},{key:"saturation",get:function get(){return this.state.saturation;}},{key:"contrast",get:function get(){return this.state.contrast;}},{key:"gamma",get:function get(){return this.state.gamma;}},{key:"clarity",get:function get(){return this.state.clarity;}},{key:"exposure",get:function get(){return this.state.exposure;}},{key:"shadows",get:function get(){return this.state.shadows;}},{key:"highlights",get:function get(){return this.state.highlights;}},{key:"whites",get:function get(){return this.state.whites;}},{key:"blacks",get:function get(){return this.state.blacks;}},{key:"temperature",get:function get(){return this.state.temperature;}},{key:"sharpness",get:function get(){return this.state.sharpness;}},{key:"categories",get:function get(){return this.entityManager.categories;}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"config",get:function get(){return this.editor.configStore.config["adjustment"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["adjustment"];}}]);return Zt;}();f([Q],Zt.prototype,"selectedOption",2);f([Q],Zt.prototype,"dirty",2);f([C],Zt.prototype,"editAdjustments",2);f([C],Zt.prototype,"toggleOptionSelection",2);f([C],Zt.prototype,"pureSetAdjustment",2);f([C],Zt.prototype,"pureReset",2);f([C],Zt.prototype,"reset",2);f([C],Zt.prototype,"updateStateFromHistory",2);f([C],Zt.prototype,"updateStateFromSerialization",2);f([S],Zt.prototype,"selectedAdjustmentType",1);f([S],Zt.prototype,"isDirty",1);f([S],Zt.prototype,"state",1);f([S],Zt.prototype,"selectedOptionLabel",1);f([S],Zt.prototype,"brightness",1);f([S],Zt.prototype,"saturation",1);f([S],Zt.prototype,"contrast",1);f([S],Zt.prototype,"gamma",1);f([S],Zt.prototype,"clarity",1);f([S],Zt.prototype,"exposure",1);f([S],Zt.prototype,"shadows",1);f([S],Zt.prototype,"highlights",1);f([S],Zt.prototype,"whites",1);f([S],Zt.prototype,"blacks",1);f([S],Zt.prototype,"temperature",1);f([S],Zt.prototype,"sharpness",1);f([S],Zt.prototype,"categories",1);f([S],Zt.prototype,"items",1);f([S],Zt.prototype,"config",1);f([S],Zt.prototype,"locale",1);});var ak=d(function(){ev();sH();});var iv;var lk=d(function(){iv={identifier:"identity",intensity:1,isDuotone:false};});var klt,xl;var aH=d(function(){Tt();R();Kh();lk();klt=new Js(0,1);xl=/*#__PURE__*/function(){function xl(t){var _this317=this;_classCallCheck(this,xl);this.changeIdentifier=function(t){_this317.state.identifier=t;};this.changeIfDuotone=function(t){_this317.state.isDuotone=t;};this.changeIntensity=function(t){var e=klt.clamp(t);_this317.state.intensity=e;};this.reset=function(){if(_this317.indexInContainer===-1){_this317.state.identifier=iv.identifier;_this317.state.intensity=iv.intensity;_this317.removeIndex();}};this.setFilterEffect=function(_ref125){var t=_ref125.identifier,e=_ref125.intensity,r=_ref125.isDuotone;var o=_this317.state;var n=function n(){_this317.changeIdentifier(t);_this317.changeIntensity(e);_this317.changeIfDuotone(r);};_this317.removeFilterEffect();var s=_this317.engineMediator.orderHelper.addIndex("filter");if(r){return new Promise(function(a,l){_this317.engineMediator.engine.addDuoToneFilterFromAssets(t,_this317.engineMediator.image.container,s).then(function(c){n();_this317.effect=c;_this317.effect.setProperties({colorIntensity:e});a();})["catch"](function(c){_this317.fallbackOnError(o);l(c);});});}return new Promise(function(a,l){_this317.engineMediator.engine.addLUTFilterFromAssets(t,_this317.engineMediator.image.container,s).then(function(c){n();_this317.effect=c;_this317.effect.setProperties({intensity:e});a();})["catch"](function(c){_this317.fallbackOnError(o);l(c);});});};this.removeFilterEffect=function(){if(_this317.effect){_this317.engineMediator.engine.removeEffect(_this317.effect);if(_this317.indexInContainer===-1){_this317.effect=void 0;}}};this.setEffectProperties=function(_ref126){var t=_ref126.intensity;if(_this317.effect){if(_this317.state.isDuotone){_this317.effect.setProperties({colorIntensity:t});}else{_this317.effect.setProperties({intensity:t});}return _this317.effect.getProperties();}return null;};this.removeIndex=function(){_this317.engineMediator.orderHelper.removeIndex("filter");};this.fallbackOnError=function(t){_this317.changeIdentifier(t.identifier);_this317.changeIntensity(t.intensity);if(t.identifier==="identity"){_this317.removeIndex();}};this.engineMediator=t;this.state=iv;}_createClass(xl,[{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}}]);return xl;}();f([Q],xl.prototype,"state",2);f([C],xl.prototype,"changeIdentifier",2);f([C],xl.prototype,"changeIfDuotone",2);f([C],xl.prototype,"changeIntensity",2);f([C],xl.prototype,"reset",2);});var lH,rv,He;var cH=d(function(){lH=y(rd());Tt();R();U();Zi();Nn();aH();rv="identity";He=/*#__PURE__*/function(){function He(t){var _this318=this;_classCallCheck(this,He);this.throttledRender=(0,lH["default"])(function(){if(_this318.editor){_this318.editor.render();}},10,{trailing:true});this.selectFilter=/*#__PURE__*/function(){var _ref127=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee17(t){var e,_r14,_args18=arguments;return regeneratorRuntime.wrap(function _callee17$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:e=_args18.length>1&&_args18[1]!==undefined?_args18[1]:1;if(!(t!==_this318.identifier)){_context18.next=8;break;}_r14=_this318.selectedCategory;_context18.next=5;return _this318.filterStore.setFilterEffect({identifier:t,intensity:e,isDuotone:_this318.isOptionDuoTone(t)});case 5:if(_this318.selectedCategory===rv){_this318.selectedCategory=_r14;}_this318.editor.render();_this318.addSnapshot("add","filter");case 8:case"end":return _context18.stop();}}},_callee17);}));return function(_x24){return _ref127.apply(this,arguments);};}();this.changeIntensity=function(t){var e=_this318.isOptionDuoTone(_this318.identifier);var r=_this318.filterStore.setEffectProperties({intensity:t});if(r){var o=e?r.colorIntensity:r.intensity;_this318.filterStore.changeIntensity(o);_this318.throttledRender();}};this.setImageAndGetPreviews=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee18(){var t;return regeneratorRuntime.wrap(function _callee18$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:t=_this318.editor.activeStore.state.image;_context19.next=3;return _this318.editor.previewThumbnails.addImageToContainer(t);case 3:_context19.next=5;return _this318.getAllFilterPreview();case 5:case"end":return _context19.stop();}}},_callee18);}));this.getAllFilterPreview=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee19(){var t,e,r,o;return regeneratorRuntime.wrap(function _callee19$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:t=_this318.entityManager.items.map(function(n){return{identifier:n.identifier,isDuotone:_this318.isOptionDuoTone(n.identifier)};});_context20.next=3;return _this318.editor.previewThumbnails.getAllFilterPreviewThumbnails(t);case 3:e=_context20.sent;_context20.next=6;return _this318.editor.wait();case 6:r=_this318.config;o=_this318.editor.configStore.assetProvider.getAssets("filter").map(function(n){return _objectSpread(_objectSpread({},n),{},{items:n.items.map(function(s){return _objectSpread(_objectSpread({},s),{},{thumbnailURI:e[s.identifier]});})});});_this318.entityManager=new _Ne(o,_objectSpread(_objectSpread({},r),{},{locale:_this318.locale.items,getAssetPath:_this318.editor.getAssetPath("filter")}));case 9:case"end":return _context20.stop();}}},_callee19);}));this.toolSnapshot=function(){_this318.addSnapshot("edit",_this318.locale.controls.sliderIntensity);};this.addSnapshot=function(t,e){_this318.editor.addSnapshot(void 0,t,e);};this.pureReset=function(){_this318.selectedCategory=rv;_this318.filterStore.removeFilterEffect();_this318.filterStore.reset();};this.reset=function(){_this318.pureReset();_this318.addSnapshot("delete",_this318.locale.controls.buttonReset);_this318.editor.render();};this.toggleCategorySelection=function(t){_this318.selectedCategory=_this318.selectedCategory===t?rv:t;};this.updateStateFromSerialization=function(_ref130){var t=_ref130.identifier,e=_ref130.intensity;var r=_this318.doesFilterAssetExist(t);if(r){var o=Yu(r);return _this318.filterStore.setFilterEffect({identifier:t,intensity:e,isDuotone:o});}throw new Do(t);};this.updateStateFromHistory=/*#__PURE__*/function(){var _ref131=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee20(t){return regeneratorRuntime.wrap(function _callee20$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:if(!(t.identifier==="identity")){_context21.next=3;break;}_this318.pureReset();return _context21.abrupt("return",new Promise(function(e){e();}));case 3:return _context21.abrupt("return",_this318.filterStore.setFilterEffect(t));case 4:case"end":return _context21.stop();}}},_callee20);}));return function(_x25){return _ref131.apply(this,arguments);};}();this.doesFilterAssetExist=function(t){return _this318.entityManager.items.find(function(e){return t===e.identifier;});};this.isOptionDuoTone=function(t){var e=_this318.doesFilterAssetExist(t);if(e){return Yu(e);}return false;};this.editor=t;this.selectedCategory=rv;this.filterStore=new xl(this.editor.engineMediator);var e=this.config;var r=this.editor.configStore.assetProvider.getAssets("filter");this.entityManager=new _Ne(r,_objectSpread(_objectSpread({},e),{},{locale:this.locale.items,getAssetPath:this.editor.getAssetPath("filter")}));}_createClass(He,[{key:"state",get:function get(){return this.filterStore.state;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"intensity",get:function get(){return this.state.intensity;}},{key:"isDuotone",get:function get(){return this.state.isDuotone;}},{key:"selectedCategoryIdentifier",get:function get(){return this.selectedCategory;}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}},{key:"config",get:function get(){return this.editor.configStore.config["filter"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["filter"];}},{key:"categories",get:function get(){return this.entityManager.categories;}},{key:"items",get:function get(){return this.entityManager.items;}}]);return He;}();f([Q],He.prototype,"selectedCategory",2);f([Q],He.prototype,"entityManager",2);f([C],He.prototype,"selectFilter",2);f([C],He.prototype,"changeIntensity",2);f([C],He.prototype,"pureReset",2);f([C],He.prototype,"reset",2);f([C],He.prototype,"toggleCategorySelection",2);f([C],He.prototype,"updateStateFromSerialization",2);f([C],He.prototype,"updateStateFromHistory",2);f([S],He.prototype,"state",1);f([S],He.prototype,"identifier",1);f([S],He.prototype,"intensity",1);f([S],He.prototype,"isDuotone",1);f([S],He.prototype,"selectedCategoryIdentifier",1);f([S],He.prototype,"isOptionSelected",1);f([S],He.prototype,"config",1);f([S],He.prototype,"locale",1);f([S],He.prototype,"categories",1);f([S],He.prototype,"items",1);});var ck=d(function(){cH();lk();});var bm;var uH=d(function(){bm=function bm(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3;var r=Math.tan(t);var o=Math.sqrt(Math.pow(r,2)+1);return{x:i.x+e/o,y:i.y+e*r/o};};});var ov,Ilt,Dlt,Elt,Flt,lu;var nv=d(function(){ov={blurRadius:40,gradientSize:.2};Ilt=_objectSpread({start:{x:0,y:0},end:{x:0,y:0}},ov);Dlt=_objectSpread({center:{x:0,y:0},radius:0},ov);Elt=_objectSpread({origin:{x:0,y:0},rotation:0,size:0},ov);Flt=ov;lu={identifier:"identity",linear:Ilt,radial:Dlt,mirrored:Elt,gaussian:Flt};});var Ei;var dH=d(function(){Tt();R();U();nv();Ei=/*#__PURE__*/function(){function Ei(t){var _this319=this;_classCallCheck(this,Ei);this.selectFocus=function(t,e){Ve(function(){_this319.state.identifier=t;if(e){_this319.state[t].blurRadius=e;}});};this.changeBlurRadius=function(t,e){if(t!=="identity"){_this319.state[t].blurRadius=e;}};this.reset=function(){if(_this319.indexInContainer===-1){_this319.state.identifier=lu.identifier;if(_this319.state.identifier!=="identity"){_this319.state[_this319.state.identifier].blurRadius=lu[_this319.state.identifier].blurRadius;}}};this.setLinear=function(_ref132){var t=_ref132.start,e=_ref132.end;_this319.state.linear.start.x=t.x;_this319.state.linear.start.y=t.y;_this319.state.linear.end.x=e.x;_this319.state.linear.end.y=e.y;};this.setLinearStart=function(t){_this319.state.linear.start.x=t.x;_this319.state.linear.start.y=t.y;};this.setLinearEnd=function(t){_this319.state.linear.end.x=t.x;_this319.state.linear.end.y=t.y;};this.setRadialCenter=function(t){_this319.state.radial.center.x=t.x;_this319.state.radial.center.y=t.y;};this.setRadialRadius=function(t){_this319.state.radial.radius=t;};this.setMirroredOrigin=function(t){_this319.state.mirrored.origin.x=t.x;_this319.state.mirrored.origin.y=t.y;};this.setMirroredRotation=function(t){_this319.state.mirrored.rotation=t;};this.setMirroredSize=function(t){_this319.state.mirrored.size=t;};this.getEffectProperties=function(){if(_this319.effect){return _this319.effect.getProperties();}return null;};this.setLinearFocus=function(t){_this319.effect=_this319.engineMediator.engine.addLinearBlur(t,_this319.imageContainer,_this319.order);_this319.updateLinearState(_this319.effect.getProperties());};this.setGaussianFocus=function(t){_this319.effect=_this319.engineMediator.engine.addGaussianBlur(t,_this319.imageContainer,_this319.order);_this319.updateGaussianState(_this319.effect.getProperties());};this.setRadialFocus=function(t){_this319.effect=_this319.engineMediator.engine.addRadialBlur(t,_this319.imageContainer,_this319.order);_this319.updateRadialState(_this319.effect.getProperties());};this.setMirroredFocus=function(t){_this319.effect=_this319.engineMediator.engine.addMirroredBlur(t,_this319.imageContainer,_this319.order);_this319.updateMirroredState(_this319.effect.getProperties());};this.updateFromEngineState=function(t){var e=_this319.getEffectProperties();if(e&&t!=="identity"){switch(t){case"linear":_this319.updateLinearState(e);break;case"radial":_this319.updateRadialState(e);break;case"mirrored":_this319.updateMirroredState(e);break;default:break;}}};this.updateGaussianState=function(t){_this319.changeBlurRadius("gaussian",t.blurRadius);};this.updateMirroredState=function(t){var e=_this319.editor.worldToPreview(t.mirrorAxisOrigin);var r=new O(_this319.editor.worldToPreview(t.mirrorAxisDirection));var o=r.subtract(e);var n=Math.atan2(o.y,o.x);_this319.setMirroredOrigin(_this319.editor.worldToPreview(t.mirrorAxisOrigin));_this319.setMirroredRotation(n);_this319.setMirroredSize(_this319.editor.worldToPreview(t.clearAreaWidth));_this319.changeBlurRadius("mirrored",t.blurRadius);};this.updateRadialState=function(t){_this319.setRadialCenter(_this319.editor.worldToPreview(t.center));_this319.setRadialRadius(_this319.editor.worldToPreview(t.radius));_this319.changeBlurRadius("radial",t.blurRadius);};this.updateLinearState=function(t){_this319.setLinearStart(_this319.editor.worldToPreview(t.start));_this319.setLinearEnd(_this319.editor.worldToPreview(t.end));_this319.changeBlurRadius("linear",t.blurRadius);};this.setEffectProperties=function(t){if(_this319.effect){_this319.effect.setProperties(t);return _this319.effect.getProperties();}return null;};this.removeFocus=function(){if(_this319.effect){_this319.engineMediator.engine.removeEffect(_this319.effect);_this319.engineMediator.orderHelper.removeIndex("focus");}};this.editor=t;this.engineMediator=this.editor.engineMediator;this.state=lu;}_createClass(Ei,[{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}},{key:"order",get:function get(){return this.engineMediator.orderHelper.addIndex("focus");}},{key:"imageContainer",get:function get(){return this.engineMediator.image.container;}}]);return Ei;}();f([Q],Ei.prototype,"state",2);f([C],Ei.prototype,"selectFocus",2);f([C],Ei.prototype,"changeBlurRadius",2);f([C],Ei.prototype,"reset",2);f([C],Ei.prototype,"setLinear",2);f([C],Ei.prototype,"setLinearStart",2);f([C],Ei.prototype,"setLinearEnd",2);f([C],Ei.prototype,"setRadialCenter",2);f([C],Ei.prototype,"setRadialRadius",2);f([C],Ei.prototype,"setMirroredOrigin",2);f([C],Ei.prototype,"setMirroredRotation",2);f([C],Ei.prototype,"setMirroredSize",2);f([C],Ei.prototype,"updateFromEngineState",2);});var mH,_cu,Bt;var pH=d(function(){mH=y(rd());Tt();R();U();Zi();hm();Nn();uH();nv();dH();_cu=/*#__PURE__*/function(){function cu(t){var _this320=this;_classCallCheck(this,cu);this.throttledRender=(0,mH["default"])(function(){if(_this320.editor){_this320.editor.render();}},10,{trailing:true});this.selectFocus=function(t){if(t!==_this320.identifier){_this320.focusStore.removeFocus();var _e15=_this320.maxIntensity*.2;var _this320$editor$engin=_this320.editor.engine.getOutputContainer().getBounds(),r=_this320$editor$engin.width;var o=_this320.editor.shortestOutputSide*.2;switch(t){case"linear":var n=_this320.editor.outputToWorld({x:-r/2,y:0});var s=_this320.editor.outputToWorld({x:r/2,y:0});_this320.setLinearFocus({start:n,end:s,blurRadius:_e15});break;case"radial":var a=_this320.editor.outputToWorld({x:0,y:0});_this320.setRadialFocus({center:a,radius:o,blurRadius:_e15});break;case"mirrored":var l=_this320.editor.outputToWorld({x:0,y:0});var c=o;var u=_this320.editor.outputToWorld(bm({x:0,y:0},0));_this320.setMirroredFocus({mirrorAxisOrigin:l,clearAreaWidth:c,blurRadius:_e15,mirrorAxisDirection:u});break;case"gaussian":_this320.setGaussianFocus({blurRadius:_e15});break;default:break;}_this320.focusStore.selectFocus(t,_e15);_this320.editor.render();_this320.addSnapshot("add","focus");}};this.changeIntensity=function(t){var e=_this320.focusStore.setEffectProperties({blurRadius:t});if(e){_this320.focusStore.changeBlurRadius(_this320.identifier,e.blurRadius);_this320.throttledRender();}};this.changeRelativeIntensity=function(t){var e=(_this320.maxIntensity-_cu.minIntensity)*t/100+_cu.minIntensity;var r=_this320.focusStore.setEffectProperties({blurRadius:e});if(r){_this320.focusStore.changeBlurRadius(_this320.identifier,r.blurRadius);_this320.throttledRender();}};this.toolSnapshot=function(t){_this320.addSnapshot("edit",t);};this.addSnapshot=function(t,e){_this320.editor.addSnapshot(void 0,t,e);};this.clickableCanvas=function(t){_this320.editor.clickableCanvas(t);};this.pureReset=function(){_this320.focusStore.removeFocus();_this320.focusStore.reset();};this.reset=function(){_this320.pureReset();_this320.editor.render();_this320.addSnapshot("delete",_this320.locale.controls.buttonReset);};this.setStart=function(t){var e=_this320.focusStore.setEffectProperties({start:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setLinearStart(_this320.editor.worldToPreview(e.start));_this320.throttledRender();}};this.setEnd=function(t){var e=_this320.focusStore.setEffectProperties({end:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setLinearEnd(_this320.editor.worldToPreview(e.end));_this320.throttledRender();}};this.setCenter=function(t){var e=_this320.focusStore.setEffectProperties({center:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setRadialCenter(_this320.editor.worldToPreview(e.center));_this320.throttledRender();}};this.setRadius=function(t){var e=_this320.focusStore.setEffectProperties({radius:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setRadialRadius(_this320.editor.worldToPreview(e.radius));_this320.throttledRender();}};this.setOrigin=function(t){var e=_this320.focusStore.setEffectProperties({mirrorAxisOrigin:_this320.editor.previewToWorld(t),mirrorAxisDirection:_this320.editor.previewToWorld(bm(t,_this320.rotation))});if(e){_this320.focusStore.setMirroredOrigin(_this320.editor.worldToPreview(e.mirrorAxisOrigin));_this320.throttledRender();}};this.setSize=function(t){var e=_this320.focusStore.setEffectProperties({clearAreaWidth:_this320.editor.previewToWorld(t)});if(e){_this320.focusStore.setMirroredSize(_this320.editor.worldToPreview(e.clearAreaWidth));_this320.throttledRender();}};this.setRotation=function(t){_this320.focusStore.setEffectProperties({mirrorAxisDirection:_this320.editor.previewToWorld(bm(_this320.origin,t))});_this320.focusStore.setMirroredRotation(t);_this320.throttledRender();};this.updateStateFromHistory=function(t,e){_this320.focusStore.removeFocus();var r=e.magnitude;Ve(function(){_this320.focusStore.selectFocus(t.identifier);switch(t.identifier){case"linear":_this320.setLinearFocus({start:_this320.editor.previewToWorld(new O(t.linear.start).multiply(e)),end:_this320.editor.previewToWorld(new O(t.linear.end).multiply(e)),blurRadius:t.linear.blurRadius});break;case"gaussian":_this320.setGaussianFocus({blurRadius:t.gaussian.blurRadius});break;case"radial":_this320.setRadialFocus({center:_this320.editor.previewToWorld(new O(t.radial.center).multiply(e)),radius:_this320.editor.previewToWorld(t.radial.radius*r),blurRadius:t.radial.blurRadius});break;case"mirrored":{var o=new O(t.mirrored.origin).multiply(e);_this320.setMirroredFocus({mirrorAxisOrigin:_this320.editor.previewToWorld(o),mirrorAxisDirection:_this320.editor.previewToWorld(bm(o,t.mirrored.rotation)),clearAreaWidth:_this320.editor.previewToWorld(t.mirrored.size*r),blurRadius:t.mirrored.blurRadius});break;}case"identity":_this320.pureReset();break;default:break;}});};this.updateStateFromSerialization=/*#__PURE__*/function(){var _ref133=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee21(t){return regeneratorRuntime.wrap(function _callee21$(_context22){while(1){switch(_context22.prev=_context22.next){case 0:if(!_cu.doesFocusIdentifierExist(t.identifier)){_context22.next=5;break;}_this320.focusStore.removeFocus();Ve(function(){_this320.focusStore.selectFocus(t.identifier);switch(t.identifier){case"linear":_this320.setLinearFocus(t.linear);break;case"gaussian":_this320.setGaussianFocus(t.gaussian);break;case"radial":_this320.setRadialFocus(t.radial);break;case"mirrored":_this320.setMirroredFocus({mirrorAxisOrigin:t.mirrored.origin,clearAreaWidth:t.mirrored.size,blurRadius:t.mirrored.blurRadius,mirrorAxisDirection:bm(t.mirrored.origin,t.mirrored.rotation)});break;default:break;}});_context22.next=6;break;case 5:throw new Do(t.identifier);case 6:case"end":return _context22.stop();}}},_callee21);}));return function(_x26){return _ref133.apply(this,arguments);};}();this.updateCanvasControls=function(){_this320.focusStore.updateFromEngineState(_this320.identifier);};this.getFocusStateForHistory=function(){var t=_this320.editor.canvasStore.sizeVector;var e=_this320.focusStore.state.linear;var r=_this320.focusStore.state.radial;var o=_this320.focusStore.state.mirrored;var n=t;var s=n.magnitude;return _objectSpread(_objectSpread({},_this320.focusStore.state),{},{linear:_objectSpread(_objectSpread({},e),{},{start:new O(e.start).divide(n),end:new O(e.end).divide(n)}),radial:_objectSpread(_objectSpread({},r),{},{center:new O(r.center).divide(n),radius:r.radius/s}),mirrored:_objectSpread(_objectSpread({},o),{},{origin:new O(o.origin).divide(n),size:o.size/s}),gaussian:_objectSpread({},_this320.focusStore.state.gaussian)});};this.editor=t;this.focusStore=new Ei(this.editor);var e=this.editor.assetProvider.getAssets("focus");this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},this.config),{},{flattenCategories:true,locale:this.locale.items,getAssetPath:this.editor.getAssetPath("focus")}));}_createClass(cu,[{key:"state",get:function get(){return this.focusStore.state;}},{key:"serializableState",get:function get(){switch(this.identifier){case"linear":return{identifier:this.identifier,linear:this.focusStore.getEffectProperties()};case"radial":return{identifier:this.identifier,radial:this.focusStore.getEffectProperties()};case"mirrored":var t=this.focusStore.getEffectProperties();return{identifier:this.identifier,mirrored:{blurRadius:t.blurRadius,origin:t.mirrorAxisOrigin,rotation:ct(this.state.mirrored.rotation),size:t.clearAreaWidth}};case"gaussian":return{identifier:this.identifier,gaussian:this.focusStore.getEffectProperties()};default:return lu;}}},{key:"start",get:function get(){return this.focusStore.state.linear.start;}},{key:"startOnPreview",get:function get(){var t=this.editor.applyFlipToPreview(this.focusStore.state.linear.start);return{x:Math.abs(t.x),y:Math.abs(t.y)};}},{key:"end",get:function get(){return this.focusStore.state.linear.end;}},{key:"endOnPreview",get:function get(){var t=this.editor.applyFlipToPreview(this.focusStore.state.linear.end);return{x:Math.abs(t.x),y:Math.abs(t.y)};}},{key:"center",get:function get(){return this.focusStore.state.radial.center;}},{key:"radius",get:function get(){return this.focusStore.state.radial.radius;}},{key:"origin",get:function get(){return this.focusStore.state.mirrored.origin;}},{key:"rotation",get:function get(){return this.focusStore.state.mirrored.rotation;}},{key:"rotationOnPreview",get:function get(){var _this$editor$outputCo=this.editor.outputContainer.getData(),t=_this$editor$outputCo.flipHorizontally,e=_this$editor$outputCo.flipVertically;return $h({rotation:this.focusStore.state.mirrored.rotation,flipHorizontally:t,flipVertically:e});}},{key:"size",get:function get(){return this.focusStore.state.mirrored.size;}},{key:"mirroredAreaWidth",get:function get(){var _this$editor$canvasSt=this.editor.canvasStore.canvasSize,t=_this$editor$canvasSt.width,e=_this$editor$canvasSt.height;return Math.sqrt(Math.pow(t,2)+Math.pow(e,2))*2;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"intensity",get:function get(){if(this.identifier==="identity"){return lu.gaussian.blurRadius;}return this.state[this.identifier].blurRadius;}},{key:"relativeIntensity",get:function get(){var _ref134=this.identifier==="identity"?this.state.gaussian:this.state[this.identifier],t=_ref134.blurRadius;return(t-_cu.minIntensity)*100/(this.maxIntensity-_cu.minIntensity);}},{key:"maxIntensity",get:function get(){return this.editor.shortestOutputSide/10;}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}},{key:"config",get:function get(){return this.editor.configStore.config["focus"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["focus"];}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"setGaussianFocus",value:function setGaussianFocus(_ref135){var t=_ref135.blurRadius;this.focusStore.setGaussianFocus({blurRadius:t});}},{key:"setLinearFocus",value:function setLinearFocus(_ref136){var t=_ref136.start,e=_ref136.end,r=_ref136.blurRadius;this.focusStore.setLinearFocus({start:t,end:e,blurRadius:r});}},{key:"setRadialFocus",value:function setRadialFocus(_ref137){var t=_ref137.center,e=_ref137.radius,r=_ref137.blurRadius;this.focusStore.setRadialFocus({center:t,radius:e,blurRadius:r});}},{key:"setMirroredFocus",value:function setMirroredFocus(_ref138){var t=_ref138.mirrorAxisOrigin,e=_ref138.clearAreaWidth,r=_ref138.blurRadius,o=_ref138.mirrorAxisDirection;this.focusStore.setMirroredFocus({mirrorAxisOrigin:t,clearAreaWidth:e,blurRadius:r,mirrorAxisDirection:o});}}],[{key:"minIntensity",get:function get(){return 0;}},{key:"doesFocusIdentifierExist",value:function doesFocusIdentifierExist(t){return Object.keys(cs).map(function(e){return cs[e];}).findIndex(function(e){return e===t;})!==-1;}}]);return cu;}();Bt=_cu;f([C],Bt.prototype,"selectFocus",2);f([C],Bt.prototype,"changeIntensity",2);f([C],Bt.prototype,"changeRelativeIntensity",2);f([C],Bt.prototype,"clickableCanvas",2);f([C],Bt.prototype,"pureReset",2);f([C],Bt.prototype,"reset",2);f([C],Bt.prototype,"setStart",2);f([C],Bt.prototype,"setEnd",2);f([C],Bt.prototype,"setCenter",2);f([C],Bt.prototype,"setRadius",2);f([C],Bt.prototype,"setOrigin",2);f([C],Bt.prototype,"setSize",2);f([C],Bt.prototype,"setRotation",2);f([C],Bt.prototype,"updateStateFromHistory",2);f([C],Bt.prototype,"updateStateFromSerialization",2);f([C],Bt.prototype,"updateCanvasControls",2);f([S],Bt.prototype,"state",1);f([S],Bt.prototype,"start",1);f([S],Bt.prototype,"startOnPreview",1);f([S],Bt.prototype,"end",1);f([S],Bt.prototype,"endOnPreview",1);f([S],Bt.prototype,"center",1);f([S],Bt.prototype,"radius",1);f([S],Bt.prototype,"origin",1);f([S],Bt.prototype,"rotation",1);f([S],Bt.prototype,"rotationOnPreview",1);f([S],Bt.prototype,"size",1);f([S],Bt.prototype,"mirroredAreaWidth",1);f([S],Bt.prototype,"identifier",1);f([S],Bt.prototype,"intensity",1);f([S],Bt.prototype,"relativeIntensity",1);f([S],Bt.prototype,"maxIntensity",1);f([S],Bt.prototype,"isOptionSelected",1);f([S],Bt.prototype,"config",1);f([S],Bt.prototype,"locale",1);f([S],Bt.prototype,"items",1);});var uk=d(function(){pH();nv();});var Xh;var dk=d(function(){R();Xh={identifier:"identity",opacity:1,blendMode:"lighten"};});var Olt,Zs;var hH=d(function(){Tt();R();Kh();dk();Olt=new Js(0,1);Zs=/*#__PURE__*/function(){function Zs(t,e){var _this321=this;_classCallCheck(this,Zs);this.changeIdentifier=function(t){_this321.state.identifier=t;};this.changeOpacity=function(t){var e=Olt.clamp(t);_this321.state.opacity=e;};this.changeBlendMode=function(t){_this321.state.blendMode=t;};this.reset=function(){if(_this321.indexInContainer===-1){_this321.state.identifier=Xh.identifier;_this321.state.opacity=Xh.opacity;_this321.state.blendMode=Xh.blendMode;_this321.removeIndex();}};this.correctOverlayFlip=function(){var _this321$editor$outpu=_this321.editor.outputContainer.getData(),t=_this321$editor$outpu.flipHorizontally,e=_this321$editor$outpu.flipVertically;if(_this321.effect){_this321.effect.setFlipHorizontally(t);_this321.effect.setFlipVertically(e);}};this.removeOverlayEffect=function(){if(_this321.effect){_this321.engineMediator.engine.removeEffect(_this321.effect);_this321.removeIndex();_this321.effect=void 0;}};this.setEffectProperties=function(t){if(_this321.effect){_this321.effect.setProperties(t);return _this321.effect.getProperties();}return null;};this.setOverlayEffect=function(_ref139){var t=_ref139.identifier,e=_ref139.blendMode,r=_ref139.opacity;var o=_objectSpread({},_this321.state);_this321.removeOverlayEffect();var n=_this321.engineMediator.orderHelper.addIndex("overlay");return new Promise(function(s,a){_this321.engineMediator.engine.addOverlayFromAssets(t,_this321.engineMediator.image.container,n).then(function(l){_this321.changeIdentifier(t);_this321.changeOpacity(r);_this321.changeBlendMode(e);_this321.effect=l;_this321.effect.setProperties({blendMode:e,opacity:r});_this321.correctOverlayFlip();s();})["catch"](function(l){_this321.changeIdentifier(o.identifier);_this321.changeOpacity(o.opacity);_this321.changeBlendMode(o.blendMode);if(o.identifier==="identity"){_this321.removeIndex();}a(l);});});};this.removeIndex=function(){_this321.engineMediator.orderHelper.removeIndex("overlay");};this.engineMediator=t;this.editor=e;this.state=Xh;}_createClass(Zs,[{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}}]);return Zs;}();f([Q],Zs.prototype,"state",2);f([C],Zs.prototype,"changeIdentifier",2);f([C],Zs.prototype,"changeOpacity",2);f([C],Zs.prototype,"changeBlendMode",2);f([C],Zs.prototype,"reset",2);f([C],Zs.prototype,"correctOverlayFlip",2);});var fH,Ze;var gH=d(function(){fH=y(rd());Tt();R();U();Zi();Nn();hH();Ze=/*#__PURE__*/function(){function Ze(t){var _this322=this;_classCallCheck(this,Ze);this.throttledRender=(0,fH["default"])(function(){if(_this322.editor){_this322.editor.render();}},10,{trailing:true});this.selectOverlay=/*#__PURE__*/function(){var _ref140=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee22(t){var _e16;return regeneratorRuntime.wrap(function _callee22$(_context23){while(1){switch(_context23.prev=_context23.next){case 0:if(!(t!==_this322.identifier)){_context23.next=6;break;}_e16=_this322.defaultBlendModeForIdentifier(t);_context23.next=4;return _this322.overlayStore.setOverlayEffect({identifier:t,opacity:1,blendMode:_e16});case 4:_this322.addSnapshot("add","overlay");_this322.editor.render();case 6:case"end":return _context23.stop();}}},_callee22);}));return function(_x27){return _ref140.apply(this,arguments);};}();this.changeOpacity=function(t){var e=_this322.overlayStore.setEffectProperties({opacity:t});if(e){_this322.overlayStore.changeOpacity(e.opacity);_this322.throttledRender();}};this.toolSnapshot=function(){_this322.addSnapshot("edit",_this322.locale.controls.sliderOpacity);};this.addSnapshot=function(t,e){_this322.editor.addSnapshot(void 0,t,e);};this.changeBlendMode=function(t){var e=_this322.overlayStore.setEffectProperties({blendMode:t});if(e){_this322.overlayStore.changeBlendMode(e.blendMode);_this322.addSnapshot("edit",_this322.locale.controls.carouselBlendMode);_this322.editor.render();}};this.pureReset=function(){_this322.overlayStore.removeOverlayEffect();_this322.overlayStore.reset();};this.reset=function(){_this322.pureReset();_this322.addSnapshot("delete",_this322.locale.controls.buttonReset);_this322.editor.render();};this.updateStateFromSerialization=/*#__PURE__*/function(){var _ref141=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee23(t){var e;return regeneratorRuntime.wrap(function _callee23$(_context24){while(1){switch(_context24.prev=_context24.next){case 0:e=_this322.entityManager.items.find(function(r){return r.identifier===t.identifier;});if(!e){_context24.next=3;break;}return _context24.abrupt("return",_this322.overlayStore.setOverlayEffect(t).then(function(){_this322.editor.transformToolStore.setOverlayOpacity(t.opacity);}));case 3:throw new Do(t.identifier);case 4:case"end":return _context24.stop();}}},_callee23);}));return function(_x28){return _ref141.apply(this,arguments);};}();this.updateStateFromHistory=/*#__PURE__*/function(){var _ref142=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee24(t){return regeneratorRuntime.wrap(function _callee24$(_context25){while(1){switch(_context25.prev=_context25.next){case 0:if(!(t.identifier==="identity")){_context25.next=3;break;}_this322.pureReset();return _context25.abrupt("return",new Promise(function(e){e();}));case 3:return _context25.abrupt("return",_this322.overlayStore.setOverlayEffect(t));case 4:case"end":return _context25.stop();}}},_callee24);}));return function(_x29){return _ref142.apply(this,arguments);};}();this.correctOverlayFlip=function(){_this322.overlayStore.correctOverlayFlip();};this.defaultBlendModeForIdentifier=function(t){var e=_this322.entityManager.items.findIndex(function(r){return r.identifier===t;});return e!==-1?_this322.entityManager.items[e].defaultBlendMode:"lighten";};this.editor=t;this.overlayStore=new Zs(this.editor.engineMediator,t);var e=this.editor.assetProvider.getAssets("overlay");var r=this.config;this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},r),{},{flattenCategories:true,locale:this.locale.items,getAssetPath:this.editor.getAssetPath("overlay")}));}_createClass(Ze,[{key:"state",get:function get(){return this.overlayStore.state;}},{key:"identifier",get:function get(){return this.overlayStore.state.identifier;}},{key:"opacity",get:function get(){return this.overlayStore.state.opacity;}},{key:"blendMode",get:function get(){return this.overlayStore.state.blendMode;}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}},{key:"config",get:function get(){return this.editor.configStore.config["overlay"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["overlay"];}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"allBlendModes",get:function get(){var t=this.locale.controls;return Object.keys(pn).map(function(e){var r=pn[e];var o="blendMode".concat(r.charAt(0).toUpperCase()).concat(r.slice(1));return{identifier:r,value:t[o]};});}}]);return Ze;}();f([C],Ze.prototype,"selectOverlay",2);f([C],Ze.prototype,"changeOpacity",2);f([C],Ze.prototype,"changeBlendMode",2);f([C],Ze.prototype,"pureReset",2);f([C],Ze.prototype,"reset",2);f([C],Ze.prototype,"updateStateFromSerialization",2);f([C],Ze.prototype,"updateStateFromHistory",2);f([C],Ze.prototype,"correctOverlayFlip",2);f([S],Ze.prototype,"state",1);f([S],Ze.prototype,"identifier",1);f([S],Ze.prototype,"opacity",1);f([S],Ze.prototype,"blendMode",1);f([S],Ze.prototype,"isOptionSelected",1);f([S],Ze.prototype,"config",1);f([S],Ze.prototype,"locale",1);f([S],Ze.prototype,"items",1);f([S],Ze.prototype,"allBlendModes",1);});var mk=d(function(){gH();dk();});var Rlt,Nr,pk;var hk=d(function(){pr();Rlt="white";Nr={identifier:"identity",opacity:1,tintColor:mr[Rlt],tintMode:"none",resizeMode:"keepAspect"};pk={};});var Hn;var ym=d(function(){Xt();pr();Hn=function Hn(){return Object.keys(mr).map(function(i){var t=mr[i];return{identifier:i,color:t,colorString:Un(t)};});};});function sv(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return new Promise(function(e,r){var o=new Image();o.addEventListener("load",function(){var n=document.createElement("canvas");var s=n.getContext("2d");n.width=o.width;n.height=o.height;if(t){n.width=t;n.height=t*o.height/o.width;}s.drawImage(o,0,0,n.width,n.height);var a=n.toDataURL("image/png");$t(n);e(a);});o.addEventListener("error",function(){r();});o.src=i;});}var bH;var fk=d(function(){R();U();bH=function bH(i){return new Promise(function(t,e){var r=new FileReader();r.onload=/*#__PURE__*/function(){var _ref143=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee25(o){var n,s;return regeneratorRuntime.wrap(function _callee25$(_context26){while(1){switch(_context26.prev=_context26.next){case 0:_context26.prev=0;n=o.target.result;_context26.next=4;return sv(n,150);case 4:s=_context26.sent;t({stickerURI:n,thumbnailURI:s,name:i.name||"",type:i.type,identifier:At()});_context26.next=11;break;case 8:_context26.prev=8;_context26.t0=_context26["catch"](0);e(_context26.t0);case 11:case"end":return _context26.stop();}}},_callee25,null,[[0,8]]);}));return function(_x30){return _ref143.apply(this,arguments);};}();r.onerror=function(o){e(o);};r.readAsDataURL(i);});};});var yH,gk,Pt;var bk=d(function(){Tt();R();U();ym();Zi();Nn();fk();pr();hk();yH="identity";gk="imgly_sticker_custom";Pt=/*#__PURE__*/function(){function Pt(t){var _this323=this;_classCallCheck(this,Pt);this.state=Q.map(pk);this.customStickers=[];this.colorList=Hn();this.selectLast=function(){_this323.editor.spriteStore.selectHighestOrderSprite(Array.from(_this323.state.keys()));};this.doesStickerAssetExist=function(t){return _this323.entityManager.items.findIndex(function(e){return e.identifier===t;})!==-1;};this.add=function(t){var e=_this323.entityManager.items.find(function(n){return n.identifier===t;});var r=e?e.tintMode:Nr.tintMode;var o=e?e.resizeMode:Nr.resizeMode;_this323.editor.spriteStore.addSticker({state:{identifier:t,tintMode:r,tintColor:Nr.tintColor,opacity:Nr.opacity,resizeMode:o}});};this.duplicate=function(){if(_this323.id){var _t33=_this323.editor.spriteStore.getDuplicateContainerTransform(_this323.id);var _e17=_this323.editor.spriteStore.getDuplicateContainerFlip(_this323.id);var _this323$editor$outpu=_this323.editor.outputContainer.getData(),_r15=_this323$editor$outpu.flipHorizontally,o=_this323$editor$outpu.flipVertically;_this323.editor.spriteStore.addSticker({state:{identifier:_this323.identifier,tintColor:ct(_this323.tintColor),tintMode:_this323.tintMode,resizeMode:_this323.resizeMode,opacity:_this323.opacity,flipHorizontally:_r15!==_e17.flipHorizontally,flipVertically:o!==_e17.flipVertically},transform:_t33});}};this.bringToFront=function(){if(_this323.id){_this323.editor.spriteStore.bringToFront(_this323.id);}};this.flipHorizontally=function(){if(_this323.id){_this323.editor.spriteStore.flipHorizontally(_this323.id);}};this["delete"]=function(){if(_this323.id){var _t34=_this323.id;_this323.editor.spriteStore.removeSprite(_t34);_this323.state["delete"](_t34);_this323.selectLast();}};this.updateStateFromHistory=function(t,e){if((0,Ye["default"])(e,_this323.state.get(t))){return;}_this323.setState(t,e);_this323.editor.spriteStore.setContainerProperties(t,e);};this.setState=function(t,e){var r=_this323.state.get(t);if(r){if("opacity"in e){r.opacity=e.opacity;}if(e.tintColor){r.tintColor=e.tintColor;}if(e.tintMode){r.tintMode=e.tintMode;}if(e.resizeMode){r.resizeMode=e.resizeMode;}_this323.state.set(t,r);}else{_this323.state.set(t,{identifier:e.identifier,opacity:e.opacity,tintMode:e.tintMode,resizeMode:e.resizeMode,tintColor:e.tintColor?e.tintColor:Nr.tintColor});}};this.changeOpacity=function(t){if(_this323.id){var _e18=_this323.state.get(_this323.id);if(_e18){_this323.editor.spriteStore.setContainerProperties(_this323.id,{opacity:t});var _r16=_this323.editor.spriteStore.getContainerProperties(_this323.id);_e18.opacity=_r16.opacity;_this323.state.set(_this323.id,_e18);}}};this.changeTintColor=function(t){if(_this323.id){var _e19=_this323.state.get(_this323.id);if(_e19){var _this323$entityManage=_this323.entityManager.items.find(function(n){return n.identifier===_this323.identifier;}),_r17=_this323$entityManage.tintMode;_this323.editor.spriteStore.setContainerProperties(_this323.id,{tintColor:t,tintMode:_r17});var o=_this323.editor.spriteStore.getContainerProperties(_this323.id);_e19.tintColor=o.tintColor;_e19.tintMode=o.tintMode||Nr.tintMode;_this323.state.set(_this323.id,_e19);}}};this.tintColorSnapshot=function(){_this323.addSnapshot("edit",_this323.locale.history.color);};this.addFiles=/*#__PURE__*/function(){var _ref144=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee26(t){var _e20,_r18,o;return regeneratorRuntime.wrap(function _callee26$(_context27){while(1){switch(_context27.prev=_context27.next){case 0:_this323.editor.modalStore.showInfoModal("loading");if(!t.length){_context27.next=17;break;}_e20=0;_r18=[];for(_e20=0;_e200){this.colorList=Vo(ct(this.config.colors));}}_createClass(Pt,[{key:"isStickerSelected",get:function get(){return this.editor.spriteStore.isSpriteSticker;}},{key:"isCustomStickerEnabled",get:function get(){return this.config.enableCustomUpload;}},{key:"customStickerTintMode",get:function get(){return this.config.customStickerTintMode;}},{key:"customStickerResizeMode",get:function get(){return this.config.customStickerResizeMode;}},{key:"currentSticker",get:function get(){if(this.isStickerSelected){var t=this.state.get(this.id);if(t){return t;}}return void 0;}},{key:"identifier",get:function get(){if(this.isStickerSelected){var t=this.state.get(this.id);if(t){return t.identifier;}}return"none";}},{key:"id",get:function get(){if(this.isStickerSelected){return this.editor.spriteStore.id;}return void 0;}},{key:"opacity",get:function get(){if(this.currentSticker){return this.currentSticker.opacity;}return Nr.opacity;}},{key:"tintMode",get:function get(){if(this.currentSticker){return this.currentSticker.tintMode;}return Nr.tintMode;}},{key:"resizeMode",get:function get(){if(this.currentSticker){return this.currentSticker.resizeMode;}return Nr.resizeMode;}},{key:"tintable",get:function get(){if(this.currentSticker){return this.currentSticker.tintMode==="solid"||this.currentSticker.tintMode==="colorized";}return false;}},{key:"tintColor",get:function get(){if(this.currentSticker){return this.currentSticker.tintColor;}return Nr.tintColor;}},{key:"config",get:function get(){return this.editor.configStore.config["sticker"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["sticker"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"selectedCategoryIdentifier",get:function get(){return this.selectedCategory;}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"categories",get:function get(){return this.entityManager.categories;}}]);return Pt;}();f([Q],Pt.prototype,"selectedCategory",2);f([Q],Pt.prototype,"entityManager",2);f([C],Pt.prototype,"selectLast",2);f([C],Pt.prototype,"add",2);f([C],Pt.prototype,"duplicate",2);f([C],Pt.prototype,"bringToFront",2);f([C],Pt.prototype,"flipHorizontally",2);f([C],Pt.prototype,"delete",2);f([C],Pt.prototype,"updateStateFromHistory",2);f([C],Pt.prototype,"setState",2);f([C],Pt.prototype,"changeOpacity",2);f([C],Pt.prototype,"changeTintColor",2);f([C],Pt.prototype,"addFiles",2);f([C],Pt.prototype,"addCustomStickerAsset",2);f([C],Pt.prototype,"toggleCategorySelection",2);f([C],Pt.prototype,"pureReset",2);f([C],Pt.prototype,"dispose",2);f([S],Pt.prototype,"isStickerSelected",1);f([S],Pt.prototype,"isCustomStickerEnabled",1);f([S],Pt.prototype,"customStickerTintMode",1);f([S],Pt.prototype,"customStickerResizeMode",1);f([S],Pt.prototype,"currentSticker",1);f([S],Pt.prototype,"identifier",1);f([S],Pt.prototype,"id",1);f([S],Pt.prototype,"opacity",1);f([S],Pt.prototype,"tintMode",1);f([S],Pt.prototype,"resizeMode",1);f([S],Pt.prototype,"tintable",1);f([S],Pt.prototype,"tintColor",1);f([S],Pt.prototype,"config",1);f([S],Pt.prototype,"locale",1);f([S],Pt.prototype,"localeColor",1);f([S],Pt.prototype,"selectedCategoryIdentifier",1);f([S],Pt.prototype,"items",1);f([S],Pt.prototype,"categories",1);});var _H=d(function(){hk();bk();});var Alt,te,yk;var _k=d(function(){pr();Alt="imgly_font_open_sans_bold";te={text:"Write Something",identifier:Alt,fontSize:73.3,defaultFontSize:73.3,fontFamily:"Open Sans",fontStyle:"",fontWeight:"bold",lineHeight:1,alignment:"center",textColor:mr.white,backgroundColor:mr.transparent||[0,0,0,0],width:0};yk={};});var xH;var vH=d(function(){pr();xH=function xH(){return Object.keys(nk).map(function(i){var t=nk[i];return{identifier:i,color:t,colorString:Un(t)};});};});var CH,_m10,gt;var xk=d(function(){Tt();R();zn();U();vH();ym();Zi();pr();_k();CH={100:"Extra Light",200:"Light",300:"Book",400:"Regular",500:"Medium",600:"SemiBold",700:"Bold",800:"Black",900:"Extra Black",bold:"Bold",normal:"Regular",lighter:"Lighter"};_m10=/*#__PURE__*/function(){function _m(t){var _this324=this;_classCallCheck(this,_m);this.state=Q.map(yk);this.colorList=Hn();this.backgroundColorList=xH();this.fontsLoadStatus=Q.object({pending:false,loaded:false});this.doesTextAssetExist=function(t){return _this324.editor.assetProvider.getFontAssets().findIndex(function(e){return e.identifier===t;})!==-1;};this.validFontWithConfig=function(t){return _this324.fonts.find(function(e){return e.identifier===t;})||_this324.fonts[0];};this.addOrselect=function(){if(!_this324.state.size){_this324.add();}else{_this324.selectLast();_this324.loadFonts();}};this.selectLast=function(){_this324.editor.spriteStore.selectHighestOrderSprite(Array.from(_this324.state.keys()));};this.add=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee28(){var t,e,r;return regeneratorRuntime.wrap(function _callee28$(_context29){while(1){switch(_context29.prev=_context29.next){case 0:t=_this324.fontsLoadStatus;e=function e(){_this324.editor.spriteStore.addText({state:{identifier:te.identifier,text:te.text,textColor:te.textColor,backgroundColor:te.backgroundColor,lineHeight:te.lineHeight,alignment:te.alignment,fontSize:0}});};if(!(!t.pending&&!t.loaded)){_context29.next=18;break;}_this324.fontsLoadStatus.pending=true;r=_this324.editor.assetProvider.getFontManager();_context29.prev=5;_context29.next=8;return r.loadFontsWithIdentifiers([te.identifier]);case 8:e();_context29.next=14;break;case 11:_context29.prev=11;_context29.t0=_context29["catch"](5);_this324.editor.modalStore.showActionModal({type:"error",identifier:"fontLoading",error:te.identifier});case 14:_context29.next=16;return _this324.loadFonts();case 16:_context29.next=19;break;case 18:e();case 19:case"end":return _context29.stop();}}},_callee28,null,[[5,11]]);}));this.duplicate=function(){if(_this324.id){var _t35=_this324.editor.spriteStore.getDuplicateContainerTransform(_this324.id);_this324.editor.spriteStore.addText({state:{identifier:_this324.identifier,text:_this324.text,textColor:ct(_this324.textColor),lineHeight:_this324.lineHeight,alignment:_this324.alignment,fontSize:_this324.fontSize,backgroundColor:ct(_this324.backgroundColor),width:_this324.width},transform:_t35});}};this.bringToFront=function(){if(_this324.id){_this324.editor.spriteStore.bringToFront(_this324.id);}};this["delete"]=function(){if(_this324.id){var _t36=_this324.id;_this324.editor.spriteStore.removeSprite(_t36);_this324.state["delete"](_t36);_this324.selectLast();}};this.setEditMode=function(t){_this324.editor.spriteStore.setEditMode(t);};this.changeFont=function(t){var e=_this324.fonts.find(function(r){return r.identifier===t;});_this324.changeIdentifier(e,_this324.id);if(_this324.id){_this324.addSnapshot("edit",_this324.locale.history.fontFamily);}};this.changeIdentifier=function(t,e){Ve(function(){if(t&&e){var r=_this324.state.get(e);if(r){_this324.editor.spriteStore.setContainerProperties(e,{fontIdentifier:t.identifier},true);var o=_this324.editor.spriteStore.getContainerProperties(e);r.identifier=o.fontIdentifier;r.fontFamily=t.fontFamily;r.fontStyle=t.fontStyle;r.fontWeight=t.fontWeight;r.fontSize=o.fontSize;r.width=o.width;r.defaultFontSize=r.fontSize;_this324.state.set(e,r);}}});};this.changeFontSize=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(_this324.id){var r=_this324.state.get(_this324.id);if(r){r.fontSize=t;if(e){r.defaultFontSize=t;}_this324.state.set(_this324.id,r);}}};this.updateDefaultFontSize=function(){if(_this324.id){var _t37=_this324.state.get(_this324.id);if(_t37){_t37.defaultFontSize=_t37.fontSize;_this324.state.set(_this324.id,_t37);}}};this.changeSize=function(t,e){var r=_this324.state.get(t);if(r){r.width=e.width;r.fontSize=e.fontSize;r.defaultFontSize=e.fontSize;_this324.state.set(t,r);}};this.changeWidth=function(t){if(_this324.id){var e=_this324.state.get(_this324.id);if(e){e.width=t;_this324.state.set(_this324.id,e);}}};this.changeText=function(t){if(_this324.id){var e=_this324.state.get(_this324.id);if(e){_this324.editor.spriteStore.setContainerProperties(_this324.id,{text:t},true);var r=_this324.editor.spriteStore.getContainerProperties(_this324.id);var o=_this324.editor.outputContainer.getSizeInOutputSpace();var n=_this324.editor.spriteStore.getSize(_this324.id);if(!_this324.config.disableAutoScaling){if(n.height>o.height){_this324.editor.spriteStore.setContainerProperties(_this324.id,{fontSize:_this324.calculateFitFontSize(_this324.id,o.height)},true);}}r=_this324.editor.spriteStore.getContainerProperties(_this324.id);e.text=r.text;e.fontSize=r.fontSize;e.defaultFontSize=r.fontSize;_this324.state.set(_this324.id,e);_this324.addSnapshot("edit",_this324.locale.history.edit);}}};this.calculateFitFontSize=function(t,e){if(!_m10.measureContext){var h=document.createElement("canvas");_m10.measureContext=h.getContext("2d");}var r=_this324.editor.spriteStore.getContainerProperties(t);var o=_this324.editor.engine.assetProvider.getFontManager().getFontWithId(r.fontIdentifier);var n=_this324.config.minFontSizeForAutoScaling;var s=nu(_m10.measureContext,r.text,o,r.fontSize,r.lineHeight,r.width,o.textMetrics);var a=Math.min(Math.floor(r.fontSize*(e/s.height)),1);var l=Math.round(r.fontSize);var c=0;var u=l-a;var m=Math.floor((l-a)*2);var p=u;while(c<=m){u=c+Math.floor((m-c)/2);var _h15=nu(_m10.measureContext,r.text,o,u,r.lineHeight,r.width,o.textMetrics);if(e<_h15.height){m=u-1;p=u-1;}else if(e>_h15.height){c=u+1;if(a+u>=l){return l;}}else{p=u;break;}}if(n&&p0){this.colorList=Vo(ct(this.config.colors));}if(this.config.backgroundColors&&this.config.backgroundColors.length>0){this.backgroundColorList=Vo(ct(this.config.backgroundColors));}}_createClass(_m,[{key:"loadFonts",value:function(){var _loadFonts2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee29(){var t,e,r,n;return regeneratorRuntime.wrap(function _callee29$(_context30){while(1){switch(_context30.prev=_context30.next){case 0:t=this.fontsLoadStatus;if(!t.loaded){_context30.next=3;break;}return _context30.abrupt("return");case 3:e=this.editor.assetProvider.getFontManager();r=this.editor.assetProvider.getFontAssetsForText().filter(Boolean).map(function(o){return o.identifier;});_context30.prev=5;_context30.next=8;return e.loadFontsWithIdentifiers(r);case 8:_context30.next=14;break;case 10:_context30.prev=10;_context30.t0=_context30["catch"](5);n=r.filter(function(s){return!e.isFontLoaded(s);}).join(", ");this.editor.modalStore.showActionModal({type:"error",identifier:"fontLoading",error:n});case 14:t.loaded=true;case 15:case"end":return _context30.stop();}}},_callee29,this,[[5,10]]);}));function loadFonts(){return _loadFonts2.apply(this,arguments);}return loadFonts;}()},{key:"isEditMode",get:function get(){return this.editor.spriteStore.isEditMode;}},{key:"isTextSelected",get:function get(){return this.editor.spriteStore.isSpriteText;}},{key:"fontsLoaded",get:function get(){return this.fontsLoadStatus.loaded;}},{key:"currentText",get:function get(){if(this.isTextSelected){var t=this.state.get(this.id);if(t){return t;}}return void 0;}},{key:"text",get:function get(){if(this.currentText){return this.currentText.text;}return te.text;}},{key:"fontSize",get:function get(){if(this.currentText){return this.currentText.fontSize;}return te.fontSize;}},{key:"defaultFontSize",get:function get(){if(this.currentText){return this.currentText.defaultFontSize;}return te.defaultFontSize;}},{key:"width",get:function get(){if(this.currentText){return this.currentText.width;}return te.width;}},{key:"fontFamily",get:function get(){if(this.currentText){return this.currentText.fontFamily;}return te.fontFamily;}},{key:"fontStyle",get:function get(){if(this.currentText){return this.currentText.fontStyle;}return te.fontStyle;}},{key:"fontWeight",get:function get(){if(this.currentText){return this.currentText.fontWeight;}return te.fontWeight;}},{key:"lineHeight",get:function get(){if(this.currentText){return this.currentText.lineHeight;}return te.lineHeight;}},{key:"identifier",get:function get(){if(this.currentText){return this.currentText.identifier;}return te.identifier;}},{key:"id",get:function get(){if(this.isTextSelected){return this.editor.spriteStore.id;}return void 0;}},{key:"alignment",get:function get(){if(this.currentText){return this.currentText.alignment;}return te.alignment;}},{key:"textColor",get:function get(){if(this.currentText){return this.currentText.textColor;}return te.textColor;}},{key:"backgroundColor",get:function get(){if(this.currentText){return this.currentText.backgroundColor;}return te.backgroundColor;}},{key:"config",get:function get(){return this.editor.configStore.config["text"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["text"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"rawOptions",get:function get(){return this.editor.assetProvider.getFontAssetsForText();}},{key:"availableOptions",get:function get(){if(this.config.fonts.length){return this.config.fonts.map(function(t){return t.identifier;});}return this.rawOptions.filter(Boolean).map(function(t){return t.identifier;});}},{key:"fonts",get:function get(){var _this325=this;return this.rawOptions.filter(Boolean).reduce(function(t,e){if(_this325.availableOptions.indexOf(e.identifier)!==-1){return[].concat(_toConsumableArray(t),[{identifier:e.identifier,fontFamily:e.fontFamily,fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||""}]);}return t;},[]);}},{key:"fontFamilies",get:function get(){return _toConsumableArray(new Set(this.fonts));}}],[{key:"defaultText",value:function defaultText(){return te.text;}},{key:"getDisplayFontStyle",value:function getDisplayFontStyle(t){var e=t.fontWeight&&CH[t.fontWeight].toLowerCase()!=="regular"?CH[t.fontWeight]:"";var r=t.fontStyle&&t.fontStyle.toLowerCase()!=="normal"?t.fontStyle:"";return"".concat(t.fontFamily.toLowerCase().includes(e.toLowerCase())?"":e," ").concat(r).trim();}}]);return _m;}();gt=_m10;f([C],gt.prototype,"addOrselect",2);f([C],gt.prototype,"selectLast",2);f([C],gt.prototype,"add",2);f([C],gt.prototype,"duplicate",2);f([C],gt.prototype,"bringToFront",2);f([C],gt.prototype,"delete",2);f([C],gt.prototype,"setEditMode",2);f([C],gt.prototype,"changeFont",2);f([C],gt.prototype,"changeIdentifier",2);f([C],gt.prototype,"changeFontSize",2);f([C],gt.prototype,"updateDefaultFontSize",2);f([C],gt.prototype,"changeSize",2);f([C],gt.prototype,"changeWidth",2);f([C],gt.prototype,"changeText",2);f([C],gt.prototype,"changeLineHeight",2);f([C],gt.prototype,"changeColor",2);f([C],gt.prototype,"changeBackgroundColor",2);f([C],gt.prototype,"changeAlignment",2);f([C],gt.prototype,"updateStateFromHistory",2);f([C],gt.prototype,"setState",2);f([C],gt.prototype,"setFontSize",2);f([C],gt.prototype,"pureReset",2);f([C],gt.prototype,"dispose",2);f([S],gt.prototype,"isEditMode",1);f([S],gt.prototype,"isTextSelected",1);f([S],gt.prototype,"fontsLoaded",1);f([S],gt.prototype,"currentText",1);f([S],gt.prototype,"text",1);f([S],gt.prototype,"fontSize",1);f([S],gt.prototype,"defaultFontSize",1);f([S],gt.prototype,"width",1);f([S],gt.prototype,"fontFamily",1);f([S],gt.prototype,"fontStyle",1);f([S],gt.prototype,"fontWeight",1);f([S],gt.prototype,"lineHeight",1);f([S],gt.prototype,"identifier",1);f([S],gt.prototype,"id",1);f([S],gt.prototype,"alignment",1);f([S],gt.prototype,"textColor",1);f([S],gt.prototype,"backgroundColor",1);f([S],gt.prototype,"config",1);f([S],gt.prototype,"locale",1);f([S],gt.prototype,"localeColor",1);f([S],gt.prototype,"rawOptions",1);f([S],gt.prototype,"availableOptions",1);f([S],gt.prototype,"fonts",1);f([S],gt.prototype,"fontFamilies",1);});var SH=d(function(){_k();xk();});var Blt,Qe,vk,Ck;var Sk=d(function(){pr();Blt="imgly_text_design_blocks";Qe={identifier:Blt,color:mr.white,isInverted:false,text:"Write Something With Style",seed:0,padding:0,width:0};vk={imgly_text_design_blocks:835,imgly_text_design_rotated:6,imgly_text_design_blocks_light:3,imgly_text_design_equal_width:727,imgly_text_design_masked:259,imgly_text_design_celebrate:579,imgly_text_design_sunshine:77,imgly_text_design_masked_badge:683,imgly_text_design_blocks_condensed:673,imgly_text_design_celebrate_simple:425,imgly_text_design_equal_width_fat:961,imgly_text_design_watercolor:671,imgly_text_design_particles:683,imgly_text_design_masked_speech_bubble:317,imgly_text_design_masked_speech_bubble_comic:229,imgly_text_design_multiline:831};Ck={};});var Mt;var wk=d(function(){Tt();R();U();ym();Zi();Nn();pr();Sk();Mt=/*#__PURE__*/function(){function Mt(t){var _this326=this;_classCallCheck(this,Mt);this.state=Q.map(Ck);this.colorList=Hn();this.fontsLoaded=false;this.doesTextDesignAssetExist=function(t){return _this326.entityManager.items.findIndex(function(e){return e.identifier===t;})!==-1;};this.addOrselect=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee30(){return regeneratorRuntime.wrap(function _callee30$(_context31){while(1){switch(_context31.prev=_context31.next){case 0:_context31.next=2;return _this326.loadFonts();case 2:if(!_this326.state.size){_this326.add();}else{_this326.selectLast();}case 3:case"end":return _context31.stop();}}},_callee30);}));this.selectLast=function(){_this326.editor.spriteStore.selectHighestOrderSprite(Array.from(_this326.state.keys()));};this.add=function(){_this326.editor.spriteStore.addTextDesign({state:{identifier:Qe.identifier,text:Qe.text,color:Qe.color,isInverted:Qe.isInverted,seed:vk[Qe.identifier]||Qe.seed,padding:0}});};this.updateStateFromHistory=function(t,e){if((0,Ye["default"])(e,_this326.state.get(t))){return;}var r=_this326.state.get(t);if(e.identifier===r.identifier){_this326.setState(t,e);_this326.editor.spriteStore.setContainerProperties(t,e);}else{_this326.changeIdentifier(e.identifier,false,e.seed,t);}};this.setState=function(t,e){var r=_this326.state.get(t);if(r){if(e.inverted){r.isInverted=e.inverted;}if(e.seed){r.seed=e.seed;}if(e.color){r.color=e.color;}if(e.padding){r.padding=e.padding;}if(e.width){r.width=e.width;}}else{_this326.state.set(t,{width:e.width,text:e.text,isInverted:e.inverted,identifier:e.identifier,seed:e.seed,color:e.color?e.color:Qe.color,padding:e.padding});}};this.changeText=function(t){if(_this326.id){var _e21=_this326.state.get(_this326.id);if(_e21){_this326.editor.spriteStore.setContainerProperties(_this326.id,{text:t},true);var r=_this326.editor.spriteStore.getContainerProperties(_this326.id);_e21.text=r.text;_this326.state.set(_this326.id,_e21);_this326.addSnapshot("edit",_this326.locale.history.edit);}}};this.setEditMode=function(t){_this326.editor.spriteStore.setEditMode(t);};this.duplicate=function(){if(_this326.id){var _t38=_this326.editor.spriteStore.getDuplicateContainerTransform(_this326.id);_this326.editor.spriteStore.addTextDesign({state:{identifier:_this326.identifier,text:_this326.text,color:ct(_this326.color),isInverted:_this326.isInverted,seed:_this326.seed,padding:_this326.padding,width:_this326.width},transform:_t38});}};this.bringToFront=function(){if(_this326.id){_this326.editor.spriteStore.bringToFront(_this326.id);}};this.addSnapshot=function(t,e){var r=_this326.editor.historyStore.getCurrentSpritesState();if((r==null?void 0:r.textdesign)&&(0,Ye["default"])(r.textdesign,ct(_this326.state))){return;}if(_this326.currentTextDesign){_this326.editor.spriteStore.addSnapshot(t,e);}};this["delete"]=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this326.id;if(t){_this326.editor.spriteStore.removeSprite(t);_this326.state["delete"](t);_this326.selectLast();}};this.changeSeed=function(){if(_this326.id){var _t39=_this326.state.get(_this326.id);if(_t39){_this326.editor.spriteStore.setContainerProperties(_this326.id,{seed:-1},true);var _e22=_this326.editor.spriteStore.getContainerProperties(_this326.id);_t39.seed=_e22.seed;_this326.state.set(_this326.id,_t39);_this326.addSnapshot("edit",_this326.locale.history.shuffle);}}};this.changeIdentifier=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:_this326.id;if(o&&t!==_this326.identifier){var n=_this326.state.get(o);var s=_this326.editor.spriteStore.getContainerTransform(o);_this326.editor.spriteStore.addTextDesign({spriteId:o,state:{identifier:t,text:n.text,color:ct(n.color),isInverted:n.isInverted,seed:r||vk[t]||n.seed,padding:n.padding,width:n.width},transform:s},e,true);}};this.changeColor=function(t){if(_this326.id){var _e23=_this326.state.get(_this326.id);if(_e23){_this326.editor.spriteStore.setContainerProperties(_this326.id,{color:t});var r=_this326.editor.spriteStore.getContainerProperties(_this326.id);_e23.color=r.color;_this326.state.set(_this326.id,_e23);}}};this.colorSnapshot=function(){_this326.addSnapshot("edit",_this326.locale.history.color);};this.invertBackground=function(){if(_this326.id){var _t40=_this326.state.get(_this326.id);if(_t40){_this326.editor.spriteStore.setContainerProperties(_this326.id,{inverted:!_t40.isInverted},true);var _e24=_this326.editor.spriteStore.getContainerProperties(_this326.id);_t40.isInverted=_e24.inverted;_this326.state.set(_this326.id,_t40);_this326.addSnapshot("edit",_this326.locale.history.invert);}}};this.changeWidth=function(t){if(_this326.id){var _e25=_this326.state.get(_this326.id);if(_e25){_e25.width=t;_this326.state.set(_this326.id,_e25);}}};this.changePadding=function(t){if(_this326.id){var _e26=_this326.state.get(_this326.id);if(_e26){_e26.padding=t;_this326.state.set(_this326.id,_e26);}}};this.pureReset=function(){_this326.state=Q.map(Ck);};this.dispose=function(){_this326.state=null;_this326.fontsLoaded=null;_this326.editor=null;_this326.colorList=null;};this.editor=t;var e=this.editor.assetProvider.getAssets("textdesign");this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},this.config),{},{flattenCategories:true,locale:{},getAssetPath:this.editor.getAssetPath("textdesign")}));if(!this.entityManager.items.find(function(r){return r.identifier===Qe.identifier;})){Qe.identifier=this.entityManager.items[0].identifier;}Qe.text=this.locale.canvasControls.placeholderText;Qe.color=ct(Io(this.config,"defaultColor",Qe.color));if(this.config.colors&&this.config.colors.length>0){this.colorList=Vo(ct(this.config.colors));}}_createClass(Mt,[{key:"loadFonts",value:function(){var _loadFonts3=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee31(){var t,e,o;return regeneratorRuntime.wrap(function _callee31$(_context32){while(1){switch(_context32.prev=_context32.next){case 0:if(!this.fontsLoaded){_context32.next=2;break;}return _context32.abrupt("return");case 2:t=this.editor.assetProvider.getFontManager();e=this.editor.assetProvider.getFontAssetsForTextDesign().map(function(r){return r.identifier;});_context32.prev=4;_context32.next=7;return t.loadFontsWithIdentifiers(e);case 7:_context32.next=13;break;case 9:_context32.prev=9;_context32.t0=_context32["catch"](4);o=e.filter(function(n){return!t.isFontLoaded(n);}).join(", ");this.editor.modalStore.showActionModal({type:"error",identifier:"fontLoading",error:o});case 13:this.fontsLoaded=true;case 14:case"end":return _context32.stop();}}},_callee31,this,[[4,9]]);}));function loadFonts(){return _loadFonts3.apply(this,arguments);}return loadFonts;}()},{key:"isTextDesignSelected",get:function get(){return this.editor.spriteStore.isSpriteTextDesign;}},{key:"isEditMode",get:function get(){return this.editor.spriteStore.isEditMode;}},{key:"currentTextDesign",get:function get(){if(this.isTextDesignSelected&&this.id){var t=this.state.get(this.id);if(t){return t;}}return void 0;}},{key:"id",get:function get(){if(this.isTextDesignSelected){return this.editor.spriteStore.id;}return void 0;}},{key:"text",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.text;}return Qe.text;}},{key:"seed",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.seed;}return Qe.seed;}},{key:"padding",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.padding;}return Qe.padding;}},{key:"width",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.width;}return Qe.width;}},{key:"identifier",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.identifier;}return null;}},{key:"isInverted",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.isInverted;}return Qe.isInverted;}},{key:"color",get:function get(){if(this.currentTextDesign){return this.currentTextDesign.color;}return Qe.color;}},{key:"config",get:function get(){return this.editor.configStore.config["textdesign"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["textdesign"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"items",get:function get(){return this.entityManager.items;}}],[{key:"defaultText",value:function defaultText(){return Qe.text;}}]);return Mt;}();f([C],Mt.prototype,"addOrselect",2);f([C],Mt.prototype,"selectLast",2);f([C],Mt.prototype,"add",2);f([C],Mt.prototype,"updateStateFromHistory",2);f([C],Mt.prototype,"setState",2);f([C],Mt.prototype,"changeText",2);f([C],Mt.prototype,"setEditMode",2);f([C],Mt.prototype,"duplicate",2);f([C],Mt.prototype,"bringToFront",2);f([C],Mt.prototype,"delete",2);f([C],Mt.prototype,"changeSeed",2);f([C],Mt.prototype,"changeIdentifier",2);f([C],Mt.prototype,"changeColor",2);f([C],Mt.prototype,"invertBackground",2);f([C],Mt.prototype,"changeWidth",2);f([C],Mt.prototype,"changePadding",2);f([C],Mt.prototype,"pureReset",2);f([C],Mt.prototype,"dispose",2);f([S],Mt.prototype,"isTextDesignSelected",1);f([S],Mt.prototype,"isEditMode",1);f([S],Mt.prototype,"currentTextDesign",1);f([S],Mt.prototype,"id",1);f([S],Mt.prototype,"text",1);f([S],Mt.prototype,"seed",1);f([S],Mt.prototype,"padding",1);f([S],Mt.prototype,"width",1);f([S],Mt.prototype,"identifier",1);f([S],Mt.prototype,"isInverted",1);f([S],Mt.prototype,"color",1);f([S],Mt.prototype,"config",1);f([S],Mt.prototype,"locale",1);f([S],Mt.prototype,"localeColor",1);f([S],Mt.prototype,"items",1);});var wH=d(function(){Sk();wk();});var Wn;var av=d(function(){pr();Wn={identifier:"identity",opacity:1,width:0,color:mr.white};});var Plt,Qs;var TH=d(function(){Tt();Kh();av();Plt=new Js(0,1);Qs=/*#__PURE__*/function(){function Qs(t){var _this327=this;_classCallCheck(this,Qs);this.changeIdentifier=function(t){_this327.state.identifier=t;};this.changeOpacity=function(t){var e=Plt.clamp(t);_this327.state.opacity=e;};this.changeWidth=function(t){_this327.state.width=t;};this.changeColor=function(t){_this327.state.color=t;};this.reset=function(){if(_this327.indexInContainer===-1){_this327.state.identifier=Wn.identifier;_this327.state.opacity=Wn.opacity;_this327.state.width=Wn.width;_this327.state.color=Wn.color;_this327.removeIndex();}};this.removeFrameEffect=function(){if(_this327.effect){_this327.engine.removeEffect(_this327.effect);_this327.effect=void 0;}};this.setEffectProperties=function(t){if(_this327.effect){_this327.removeIndex();_this327.effect.setProperties(t);return _this327.effect.getProperties();}return null;};this.setFrameEffect=function(_ref150){var t=_ref150.identifier,e=_ref150.width,r=_ref150.opacity,o=_ref150.color;var n=_objectSpread({},_this327.state);_this327.changeIdentifier(t);_this327.changeWidth(e);_this327.changeOpacity(r);_this327.changeColor(o);_this327.removeFrameEffect();return new Promise(function(s,a){_this327.engine.addFrameFromAssets(t,_this327.engineMediator.image.container).then(function(l){_this327.effect=l;_this327.effect.setProperties({tintColor:o,opacity:r,width:e});s();})["catch"](function(l){_this327.changeIdentifier(n.identifier);_this327.changeOpacity(n.opacity);_this327.changeWidth(n.width);_this327.changeColor(n.color);if(n.identifier==="identity"){_this327.removeIndex();}a(l);});});};this.removeIndex=function(){_this327.engineMediator.orderHelper.removeSprite(_this327.state.identifier);};this.engineMediator=t;this.state=Wn;}_createClass(Qs,[{key:"engine",get:function get(){return this.engineMediator.engine;}},{key:"imageContainer",get:function get(){return this.engineMediator.image.container;}},{key:"indexInContainer",get:function get(){if(this.effect){return this.effect.getIndexInParent();}return-1;}}]);return Qs;}();f([Q],Qs.prototype,"state",2);f([C],Qs.prototype,"changeIdentifier",2);f([C],Qs.prototype,"changeOpacity",2);f([C],Qs.prototype,"changeWidth",2);f([C],Qs.prototype,"changeColor",2);f([C],Qs.prototype,"reset",2);});var kH,Be;var IH=d(function(){kH=y(rd());Tt();R();U();ym();Zi();Nn();pr();av();TH();Be=/*#__PURE__*/function(){function Be(t){var _this328=this;_classCallCheck(this,Be);this.colorList=Hn();this.throttledRender=(0,kH["default"])(function(){if(_this328.editor){_this328.editor.render();}},10,{trailing:true});this.selectFrame=/*#__PURE__*/function(){var _ref151=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee32(t){var _e27;return regeneratorRuntime.wrap(function _callee32$(_context33){while(1){switch(_context33.prev=_context33.next){case 0:if(!(t!==_this328.identifier)){_context33.next=6;break;}_e27=.1*_this328.editor.shortestOutputSide;_context33.next=4;return _this328.frameStore.setFrameEffect({identifier:t,width:_e27,opacity:1,color:Wn.color});case 4:_this328.editor.render();_this328.addSnapshot("add","frame");case 6:case"end":return _context33.stop();}}},_callee32);}));return function(_x33){return _ref151.apply(this,arguments);};}();this.changeOpacity=function(t){var e=_this328.frameStore.setEffectProperties({opacity:t});if(e){_this328.frameStore.changeOpacity(e.opacity);_this328.throttledRender();}};this.changeWidth=function(t){var e=_this328.frameStore.setEffectProperties({width:t});if(e){_this328.frameStore.changeWidth(e.width);_this328.throttledRender();}};this.changeColor=function(t){var e=_this328.frameStore.setEffectProperties({tintColor:t});if(e){_this328.frameStore.changeColor(e.tintColor);_this328.throttledRender();}};this.colorSnapshot=function(){_this328.addSnapshot("edit",_this328.locale.controls.selectColor);};this.toolSnapshot=function(t){_this328.addSnapshot("edit",t);};this.addSnapshot=function(t,e){_this328.editor.addSnapshot(void 0,t,e);};this.pureReset=function(){_this328.frameStore.removeFrameEffect();_this328.frameStore.reset();};this.reset=function(){_this328.pureReset();_this328.addSnapshot("delete",_this328.locale.controls.buttonReset);_this328.editor.render();};this.updateStateFromHistory=function(t){if(t.identifier==="identity"){_this328.pureReset();return new Promise(function(e){e();});}return _this328.frameStore.setFrameEffect(t);};this.updateStateFromSerialization=/*#__PURE__*/function(){var _ref152=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee33(t){var e;return regeneratorRuntime.wrap(function _callee33$(_context34){while(1){switch(_context34.prev=_context34.next){case 0:e=_this328.entityManager.items.find(function(r){return r.identifier===t.identifier;});if(!e){_context34.next=3;break;}return _context34.abrupt("return",_this328.frameStore.setFrameEffect(t).then(function(){_this328.editor.transformToolStore.setFrameOpacity(t.opacity);}));case 3:return _context34.abrupt("return",new Promise(function(r,o){o(new Error("Frame Asset doesn't exist"));}));case 4:case"end":return _context34.stop();}}},_callee33);}));return function(_x34){return _ref152.apply(this,arguments);};}();this.editor=t;this.frameStore=new Qs(this.editor.engineMediator);var e=this.editor.assetProvider.getAssets("frame");var r=this.config;this.entityManager=new _Ne(e,_objectSpread(_objectSpread({},r),{},{flattenCategories:true,locale:this.locale.items,getAssetPath:this.editor.getAssetPath("frame")}));Wn.color=ct(Io(this.config,"defaultColor",Wn.color));if(this.config.colors&&this.config.colors.length>0){this.colorList=Vo(ct(this.config.colors));}}_createClass(Be,[{key:"state",get:function get(){return this.frameStore.state;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"color",get:function get(){return this.state.color;}},{key:"size",get:function get(){return this.state.width;}},{key:"tintable",get:function get(){var _this329=this;var t=this.entityManager.items.find(function(e){return e.identifier===_this329.identifier;});return t&&t.tintable||false;}},{key:"opacity",get:function get(){return this.state.opacity;}},{key:"minSize",get:function get(){return this.editor.shortestOutputSide*.05;}},{key:"maxSize",get:function get(){return this.editor.shortestOutputSide*.3;}},{key:"config",get:function get(){return this.editor.configStore.config["frame"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["frame"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}}]);return Be;}();f([C],Be.prototype,"selectFrame",2);f([C],Be.prototype,"changeOpacity",2);f([C],Be.prototype,"changeWidth",2);f([C],Be.prototype,"changeColor",2);f([C],Be.prototype,"pureReset",2);f([C],Be.prototype,"reset",2);f([C],Be.prototype,"updateStateFromHistory",2);f([C],Be.prototype,"updateStateFromSerialization",2);f([S],Be.prototype,"state",1);f([S],Be.prototype,"identifier",1);f([S],Be.prototype,"color",1);f([S],Be.prototype,"size",1);f([S],Be.prototype,"tintable",1);f([S],Be.prototype,"opacity",1);f([S],Be.prototype,"minSize",1);f([S],Be.prototype,"maxSize",1);f([S],Be.prototype,"config",1);f([S],Be.prototype,"locale",1);f([S],Be.prototype,"localeColor",1);f([S],Be.prototype,"items",1);f([S],Be.prototype,"isOptionSelected",1);});var Tk=d(function(){av();IH();});var qh;var kk=d(function(){pr();qh={size:0,color:mr.white,hardness:0,maximumSize:.125,minimumSize:0,maximumHardness:1,minimumHardness:0};});var Ie;var Ik=d(function(){Tt();R();U();ym();Zi();pr();kk();Ie=/*#__PURE__*/function(){function Ie(t){var _this330=this;_classCallCheck(this,Ie);this.strokes={strokes:[]};this.colorList=Hn();this.dirty=Q.box(false);this.id="";this.containerId=function(){return _this330.id;};this.initSize=function(){var _this330$state=_this330.state,t=_this330$state.minimumSize,e=_this330$state.maximumSize;var r=_this330.size;if(r===0){_this330.changeSize(rS(_this330.config,"defaultSize",[t,e]));}};this.changeColor=function(t){_this330.state.color=t;};this.changeSize=function(t){_this330.state.size=t;};this.changeRelativeSize=function(t){var _this330$state2=_this330.state,e=_this330$state2.maximumSize,r=_this330$state2.minimumSize;_this330.state.size=(e-r)*t/100+r;};this.changeHardness=function(t){_this330.state.hardness=t;};this.reset=function(){_this330.pureReset();_this330.addSnapshot("delete",_this330.locale.controls.buttonReset);_this330.editor.render();};this.editor=t;this.state=_objectSpread(_objectSpread({},qh),{},{hardness:rS(this.config,"defaultHardness",[qh.minimumHardness,qh.maximumHardness]),color:ct(Io(this.config,"defaultColor",qh.color))});if(this.config.colors&&this.config.colors.length>0){this.colorList=Vo(ct(this.config.colors));}}_createClass(Ie,[{key:"addSnapshot",value:function addSnapshot(t,e){this.editor.addSnapshot(void 0,t,e);}},{key:"clickableCanvas",value:function clickableCanvas(t){this.editor.clickableCanvas(t);}},{key:"beginStroke",value:function beginStroke(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];if(!this.drawingContainer){var e=this.editor.orderHelper.addSprite("brush");this.drawingContainer=this.editor.engine.addDrawing({strokes:t},this.editor.imageContainer,e);}this.id=this.drawingContainer.getID();this.drawingContainer.beginStroke({id:"imgly_brush_radial",color:ct(this.state.color),size:this.state.size,hardness:this.state.hardness});}},{key:"strokePosition",value:function strokePosition(t){if(this.drawingContainer){var e=this.editor.previewToWorld(t,false);this.drawingContainer.addPointToCurrentStroke(e);this.editor.render();}}},{key:"endStroke",value:function endStroke(){if(this.drawingContainer){this.drawingContainer.endStroke();this.editor.render();this.strokes=this.drawingContainer.getData();this.addSnapshot("edit",this.locale.history.brushStroke);this.dirty.set(true);}}},{key:"updateStateFromHistory",value:function updateStateFromHistory(t){if((0,Ye["default"])(t,this.strokes)){return;}if((0,Ye["default"])(t,{strokes:[]})||!t){this.pureReset();return;}if(this.drawingContainer){if(this.strokes&&this.strokes.strokes.length===t.strokes.length){this.dirty.set(false);return;}this.strokes=t;this.drawingContainer.setData(this.strokes);}else{var e=this.editor.orderHelper.addSprite("brush");this.drawingContainer=this.editor.engine.addDrawing({strokes:t.strokes},this.editor.imageContainer,e);this.strokes=this.drawingContainer.getData();}this.dirty.set(this.strokes.strokes.length!==0);this.id=this.drawingContainer.getID();}},{key:"pureReset",value:function pureReset(){this.dirty.set(false);this.strokes={strokes:[]};if(this.drawingContainer){this.editor.engine.removeContainer(this.drawingContainer);this.drawingContainer=void 0;}}},{key:"config",get:function get(){return this.editor.configStore.config["brush"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["brush"];}},{key:"localeColor",get:function get(){return this.editor.configStore.locale.common.color;}},{key:"color",get:function get(){return this.state.color;}},{key:"size",get:function get(){return this.state.size;}},{key:"relativeSize",get:function get(){var _this$state5=this.state,t=_this$state5.size,e=_this$state5.maximumSize,r=_this$state5.minimumSize;return(t-r)*100/(e-r);}},{key:"sizeOnScreenSpace",get:function get(){var t=this.editor.engineMediator.engine.getSmallerOutputSide();return this.editor.worldToPreview(this.state.size*t);}},{key:"hardness",get:function get(){return this.state.hardness;}},{key:"isDirty",get:function get(){return this.dirty.get();}}]);return Ie;}();f([Q],Ie.prototype,"state",2);f([Q],Ie.prototype,"dirty",2);f([C],Ie.prototype,"initSize",2);f([C],Ie.prototype,"changeColor",2);f([C],Ie.prototype,"changeSize",2);f([C],Ie.prototype,"changeRelativeSize",2);f([C],Ie.prototype,"changeHardness",2);f([C],Ie.prototype,"clickableCanvas",1);f([C],Ie.prototype,"beginStroke",1);f([C],Ie.prototype,"strokePosition",1);f([C],Ie.prototype,"endStroke",1);f([C],Ie.prototype,"updateStateFromHistory",1);f([C],Ie.prototype,"reset",2);f([S],Ie.prototype,"config",1);f([S],Ie.prototype,"locale",1);f([S],Ie.prototype,"localeColor",1);f([S],Ie.prototype,"color",1);f([S],Ie.prototype,"size",1);f([S],Ie.prototype,"relativeSize",1);f([S],Ie.prototype,"sizeOnScreenSpace",1);f([S],Ie.prototype,"hardness",1);f([S],Ie.prototype,"isDirty",1);});var DH=d(function(){kk();Ik();});var jo;var Dk=d(function(){jo={position:{x:0,y:0},size:{height:0,width:0},lockResolution:false,forceDimensions:false,ratio:"*"};});function Ek(i){var t=i&&_typeof(i)==="object";return t&&!Llt(i)&&!Ult(i)&&!zlt(i);}function Nlt(i){return Array.isArray(i)?[]:{};}function Fk(i,t){var e=t&&t.clone===true;return e&&Ek(i)?Ok(Nlt(i),i,t):i;}function Hlt(i,t,e){var r={};if(Ek(i)){Object.keys(i).forEach(function(o){r[o]=Fk(i[o],e);});}Object.keys(t).forEach(function(o){var n=Ek(t[o])&&i[o];r[o]=n?Ok(i[o],t[o],e):Fk(t[o],e);});return r;}function Ok(i,t,e){var r=Array.isArray(t);if(r){return Array.isArray(i)?t:Fk(t,e);}return Hlt(i,t,e);}function Fi(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(!Array.isArray(i)||i.length<2){throw new Error("first argument should be an array with at least two elements");}return i.reduce(function(e,r){return Ok(e,r,t);});}var Mlt,Llt,zlt,Ult;var vl=d(function(){Mlt=typeof Symbol==="function"&&Symbol["for"];Llt=function Llt(i){return Object.prototype.toString.call(i)==="[object RegExp]"||Object.prototype.toString.call(i)==="[object Date]"||Object.prototype.toString.call(i).includes("HTML")||Object.prototype.toString.call(i)==="[object Array]";};zlt=function zlt(i){if(Mlt&&Object.hasOwnProperty.call(i,"$$typeof")){return i.$$typeof===Symbol["for"]("react.element")||i.$$typeof===Symbol["for"]("react.forward_ref");}return false;};Ult=function Ult(i){return Object.hasOwnProperty.call(i,"__ngContext__");};});var Rk;var Ak=d(function(){R();Rk=/*#__PURE__*/function(_Tr3){_inherits(Rk,_Tr3);var _super236=_createSuper(Rk);function Rk(){var _this331;_classCallCheck(this,Rk);_this331=_super236.apply(this,arguments);_this331.prevDimensions={width:0,height:0};return _this331;}_createClass(Rk,[{key:"onExport",value:function onExport(t){this.emit("export",t);}},{key:"onClose",value:function onClose(){this.emit("close");}},{key:"onUndo",value:function onUndo(){this.emit("historyUndo");}},{key:"onRedo",value:function onRedo(){this.emit("historyRedo");}},{key:"onHistoryChange",value:function onHistoryChange(){this.emit("historyChange");}},{key:"onEditorReady",value:function onEditorReady(){this.emit("editorReady");}},{key:"onErrorImageLoading",value:function onErrorImageLoading(t){this.emit("errorImageLoading",t);}},{key:"onImageLoaded",value:function onImageLoaded(){this.emit("imageLoad");}},{key:"onStickerUploadedAdd",value:function onStickerUploadedAdd(t){this.emit("stickerUploadAdd",t);}},{key:"onToolChanged",value:function onToolChanged(t){this.emit("toolEnter",t);}},{key:"onErrorWebGLContextLost",value:function onErrorWebGLContextLost(){this.emit("errorWebGLContextLost");}},{key:"onCropDimensionsChanged",value:function onCropDimensionsChanged(t){if(this.prevDimensions.width!==t.width||this.prevDimensions.height!==t.height){this.emit("cropDimensionsChange",t);this.prevDimensions=t;}}}]);return Rk;}(Tr);});var Bk;var EH=d(function(){vl();tv();Bk=Fi([_l,{layout:"basic",defaultTool:null}]);});var FH=d(function(){tv();EH();});var Pk;var OH=d(function(){var _categories2,_items,_items2;R();Pk=_defineProperty({common:{error:"Fehler",warning:"Warnung",color:{colorPicker:{hex:"Hex",r:"R",g:"G",b:"B",sliderHue:"Farbe",sliderOpacity:"Farbe Transparenz"}}},mainCanvasActions:{buttonExport:"Bild Exportieren",buttonUndo:"R\xFCckg\xE4ngig machen",buttonRedo:"Wiederholen",buttonClose:"Schlie\xDFen"},infoModals:{exporting:{heading:"Exportieren...",body:"Einen Moment bitte..."},saving:{heading:"Speichere...",body:"Einen Moment bitte..."},loading:{heading:"Lade...",body:"Einen Moment bitte..."},resizing:{heading:"Bild wird bearbeitet...",body:"Einen Moment bitte..."},loadingFonts:{heading:"Lade Schriftarten...",body:"Einen Moment bitte..."},stickerLoading:{heading:"Lade Sticker...",body:"Einen Moment bitte..."}},errorModals:{imageLoading:{headingDelimiter:":",body:"Laden des Bildes fehlgeschlagen. Dies kann verschiedene Gr\xFCnde haben, beispielsweise kann die Datei defekt sein oder der Dateityp wird nicht unterst\xFCtzt",buttonYes:"Neu Laden",buttonNo:"Schlie\xDFen"},rendering:{headingDelimiter:":",body:"Beim Rendern des Bildes ist ein Fehler aufgetreten",buttonYes:"Neu Laden",buttonNo:"Schlie\xDFen"},fontLoading:{headingDelimiter:":",heading:"Laden von Schriftarten ist fehlgeschlagen",body:"Die folgenden Schriftarten konnten nicht geladen werden: ${error}",buttonNo:"Schlie\xDFen"},webcamUnavailable:{headingDelimiter:":",body:"Webcam-Bild kann nicht dargestellt werden. (Fehler: ${error})",buttonYes:"Schlie\xDFen"},stickerLoading:{headingDelimiter:":",body:"Laden des Stickers fehlgeschlagen.",buttonNo:"Schlie\xDFen"},unexpectedError:{headingDelimiter:":",body:"Ein unerwarteter Fehler ist aufgetreten, ${error}",buttonYes:"Neu Laden",buttonNo:"Schlie\xDFen"}},warningModals:{imageResized:{headingDelimiter:":",heading:"Bild verkleinert",body:"Ihr Bild \xFCbersteigt die maximale Gr\xF6sse von ${megapixels} megapixels und wurde auf ${width}x${height} Pixel verkleinert",buttonYes:"Weiter"},discardChanges:{headingDelimiter:":",body:"Sind Sie sicher, dass Sie die \xC4nderungen verwerfen wollen?",buttonYes:"\xC4nderungen verwerfen",buttonNo:"\xC4nderungen beibehalten"},unsavedChanges:{headingDelimiter:":",body:"Sind Sie sicher, dass Sie die \xC4nderungen verwerfen wollen?",buttonYes:"Beenden ohne zu speichern",buttonNo:"Schlie\xDFen"},unsupportedSerializationVersion:{headingDelimiter:":",body:"Ihre Daten wurden von einem veralteten Format geladen und k\xF6nnten anders aussehen",buttonYes:"\xC4nderungen anwenden",buttonNo:"Abbrechen"},unsupportedWebGLRenderer:{body:"Es wurde ein Problem im Browser festgestellt, welches zu langen Ladezeiten f\xFChren kann. Bitte probieren sie einen anderen Browser.",buttonYes:"Weiter"}},library:{title:"Bibliothek",controls:{buttonUpload:"Bild Hochladen",buttonWebcamOpen:"Webcam \xD6ffnen",buttonWebcamClose:"Webcam Schlie\xDFen",placeholderSearch:"Bibliothek durchsuchen",noResults:"Keine Ergebnisse",itemAriaLabel:"Bild mit ${label} ersetzen"}},filter:{title:"Filter",controls:{buttonReset:"Zur\xFCcksetzen",sliderIntensity:"Filter Intensit\xE4t",itemAriaLabel:"${label} Filter hinzuf\xFCgen"},categories:(_categories2={},_defineProperty(_categories2,"imgly_filter_category_duotone","DuoTone"),_defineProperty(_categories2,"imgly_filter_category_bw","B & W"),_defineProperty(_categories2,"imgly_filter_category_vintage","Vintage"),_defineProperty(_categories2,"imgly_filter_category_smooth","Smooth"),_defineProperty(_categories2,"imgly_filter_category_cold","Cold"),_defineProperty(_categories2,"imgly_filter_category_warm","Warm"),_defineProperty(_categories2,"imgly_filter_category_legacy","Legacy"),_categories2),items:(_items={},_defineProperty(_items,"imgly_lut_celsius","Inferno"),_defineProperty(_items,"imgly_lut_chest","Chestnut"),_defineProperty(_items,"imgly_lut_fixie","Fixie"),_defineProperty(_items,"imgly_lut_fridge","Fridge"),_defineProperty(_items,"imgly_lut_front","Sunny 70s"),_defineProperty(_items,"imgly_lut_k2","Flat Black"),_defineProperty(_items,"imgly_lut_mellow","Mellow"),_defineProperty(_items,"imgly_lut_sin","Hard Stuff"),_defineProperty(_items,"imgly_lut_texas","Oldtimer"),_defineProperty(_items,"imgly_lut_ad1920","1920 A.D."),_defineProperty(_items,"imgly_lut_ancient","Ancient"),_defineProperty(_items,"imgly_lut_bleached","Kalmen"),_defineProperty(_items,"imgly_lut_bleachedblue","Joran"),_defineProperty(_items,"imgly_lut_blues","Polaroid"),_defineProperty(_items,"imgly_lut_blueshadows","Zephyr"),_defineProperty(_items,"imgly_lut_breeze","Levante"),_defineProperty(_items,"imgly_lut_bw","Greyed"),_defineProperty(_items,"imgly_lut_classic","Classic"),_defineProperty(_items,"imgly_lut_colorful","Colorful"),_defineProperty(_items,"imgly_lut_cool","Snappy"),_defineProperty(_items,"imgly_lut_cottoncandy","Candy"),_defineProperty(_items,"imgly_lut_creamy","Creamy"),_defineProperty(_items,"imgly_lut_eighties","Low Fire"),_defineProperty(_items,"imgly_lut_elder","Colla"),_defineProperty(_items,"imgly_lut_evening","Sunrise"),_defineProperty(_items,"imgly_lut_fall","Moss"),_defineProperty(_items,"imgly_lut_food","Food"),_defineProperty(_items,"imgly_lut_glam","Glam"),_defineProperty(_items,"imgly_lut_gobblin","Gobblin"),_defineProperty(_items,"imgly_lut_highcarb","High Carb"),_defineProperty(_items,"imgly_lut_highcontrast","Hicon"),_defineProperty(_items,"imgly_lut_k1","K1"),_defineProperty(_items,"imgly_lut_k6","K6"),_defineProperty(_items,"imgly_lut_kdynamic","Pebble"),_defineProperty(_items,"imgly_lut_keen","Keen"),_defineProperty(_items,"imgly_lut_lenin","Lemon"),_defineProperty(_items,"imgly_lut_litho","Litho"),_defineProperty(_items,"imgly_lut_lomo","Lomo"),_defineProperty(_items,"imgly_lut_lomo100","Lomo 100"),_defineProperty(_items,"imgly_lut_lucid","Lucid"),_defineProperty(_items,"imgly_lut_neat","Neat"),_defineProperty(_items,"imgly_lut_nogreen","Pumpkin"),_defineProperty(_items,"imgly_lut_orchid","Solanus"),_defineProperty(_items,"imgly_lut_pale","Pale"),_defineProperty(_items,"imgly_lut_pitched","Pitched"),_defineProperty(_items,"imgly_lut_plate","Weathered"),_defineProperty(_items,"imgly_lut_pola669","Green Gap"),_defineProperty(_items,"imgly_lut_polasx","Pola SX"),_defineProperty(_items,"imgly_lut_pro400","Pro 400"),_defineProperty(_items,"imgly_lut_quozi","Quozi"),_defineProperty(_items,"imgly_lut_sepiahigh","Sepia"),_defineProperty(_items,"imgly_lut_settled","Settled"),_defineProperty(_items,"imgly_lut_seventies","Seventies"),_defineProperty(_items,"imgly_lut_soft","Soft"),_defineProperty(_items,"imgly_lut_steel","Steel"),_defineProperty(_items,"imgly_lut_summer","Summer"),_defineProperty(_items,"imgly_lut_sunset","Golden"),_defineProperty(_items,"imgly_lut_tender","Tender"),_defineProperty(_items,"imgly_lut_twilight","Twilight"),_defineProperty(_items,"imgly_lut_winter","Softy"),_defineProperty(_items,"imgly_lut_x400","Dusty"),_defineProperty(_items,"imgly_duotone_desert","Desert"),_defineProperty(_items,"imgly_duotone_peach","Peach"),_defineProperty(_items,"imgly_duotone_clash","Clash"),_defineProperty(_items,"imgly_duotone_plum","Plum"),_defineProperty(_items,"imgly_duotone_breezy","Breezy"),_defineProperty(_items,"imgly_duotone_deepblue","Deep Blue"),_defineProperty(_items,"imgly_duotone_frog","Frog"),_defineProperty(_items,"imgly_duotone_sunset","Sunset"),_items)},adjustment:{title:"Korrekturen",controls:{buttonReset:"Zur\xFCcksetzen"},categories:{basics:"Grundlagen",refinements:"Feinheiten"},items:{brightness:"Helligkeit",saturation:"S\xE4ttigung",contrast:"Kontrast",gamma:"Gamma",sharpness:"Sch\xE4rfe",clarity:"Klarheit",exposure:"Belichtung",shadows:"Schatten",highlights:"Lichter",whites:"Wei\xDF",blacks:"Schwarz",temperature:"Temperatur"}},focus:{title:"Weichzeichnen",controls:{buttonReset:"Zur\xFCcksetzen",sliderIntensity:"Focus Intensit\xE4t",itemAriaLabel:"${label} Fokus hinzuf\xFCgen"},items:{radial:"Kreisf\xF6rmig",mirrored:"Gespiegelt",linear:"Linear",gaussian:"Gau\xDFsch"},history:{focusPosition:"Focus Position",focusSize:"Focus Gr\xF6\xDFe"}},overlay:{title:"Overlays",controls:{buttonReset:"Zur\xFCcksetzen",sliderOpacity:"Overlay Transparenz",carouselBlendMode:"Overlay Mischmodus",blendModeNormal:"Normal",blendModeOverlay:"\xDCberblenden",blendModeHardLight:"Hartes Licht",blendModeSoftLight:"Weiches Licht",blendModeMultiply:"Multiplizieren",blendModeDarken:"Abdunkeln",blendModeLighten:"Aufhellen",blendModeScreen:"Screen",blendModeColorBurn:"Color Burn",tabOpacity:"Transparenz",tabBlendMode:"Mischmodus",itemAriaLabel:"Overlay ${label} hinzuf\xFCgen"},items:(_items2={},_defineProperty(_items2,"imgly_overlay_bokeh","Bokeh"),_defineProperty(_items2,"imgly_overlay_chop","Chop"),_defineProperty(_items2,"imgly_overlay_clouds","Clouds"),_defineProperty(_items2,"imgly_overlay_golden","Golden"),_defineProperty(_items2,"imgly_overlay_grain","Grain"),_defineProperty(_items2,"imgly_overlay_hearts","Hearts"),_defineProperty(_items2,"imgly_overlay_lightleak1","Light Leak 1"),_defineProperty(_items2,"imgly_overlay_lightleak2","Light Leak 2"),_defineProperty(_items2,"imgly_overlay_metal","Metal"),_defineProperty(_items2,"imgly_overlay_mosaic","Mosaic"),_defineProperty(_items2,"imgly_overlay_painting","Painting"),_defineProperty(_items2,"imgly_overlay_paper","Paper"),_defineProperty(_items2,"imgly_overlay_rain","Rain"),_defineProperty(_items2,"imgly_overlay_vintage","Vintage"),_defineProperty(_items2,"imgly_overlay_wall1","Wall"),_defineProperty(_items2,"imgly_overlay_wall2","Wall 2"),_defineProperty(_items2,"imgly_overlay_wood","Wood"),_items2)},sticker:{title:"Sticker",controls:{buttonUpload:"Sticker Hochladen",sliderOpacity:"Sticker Transparenz",selectColor:"Stickerfarbe",tabColor:"Farbe",tabOpacity:"Transparenz",itemAriaLabel:"Sticker ${label} hinzuf\xFCgen"},categories:{imgly_sticker_emoticons:"Emoticons",imgly_sticker_shapes:"Shapes",imgly_sticker_custom:"Custom"},items:{imgly_sticker_emoticons_alien:"Alien",imgly_sticker_emoticons_angel:"Angel",imgly_sticker_emoticons_angry:"Angry",imgly_sticker_emoticons_anxious:"Anxious",imgly_sticker_emoticons_asleep:"Asleep",imgly_sticker_emoticons_attention:"Attention",imgly_sticker_emoticons_baby_chicken:"Baby Chicken",imgly_sticker_emoticons_batman:"Batman",imgly_sticker_emoticons_beer:"Beer",imgly_sticker_emoticons_black:"Black",imgly_sticker_emoticons_blue:"Blue",imgly_sticker_emoticons_blush:"Blush",imgly_sticker_emoticons_boxer:"Boxer",imgly_sticker_emoticons_business:"Business",imgly_sticker_emoticons_chicken:"Chicken",imgly_sticker_emoticons_cool:"Cool",imgly_sticker_emoticons_cry:"Cry",imgly_sticker_emoticons_deceased:"Deceased",imgly_sticker_emoticons_devil:"Devil",imgly_sticker_emoticons_duckface:"Duckface",imgly_sticker_emoticons_furious:"Furious",imgly_sticker_emoticons_grin:"Grin",imgly_sticker_emoticons_guitar:"Guitar",imgly_sticker_emoticons_harry_potter:"Harry Potter",imgly_sticker_emoticons_hippie:"Hippie",imgly_sticker_emoticons_hitman:"Hitman",imgly_sticker_emoticons_humourous:"Humourous",imgly_sticker_emoticons_idea:"Idea",imgly_sticker_emoticons_impatient:"Impatient",imgly_sticker_emoticons_kiss:"Kiss",imgly_sticker_emoticons_kisses:"Kisses",imgly_sticker_emoticons_laugh:"Laugh",imgly_sticker_emoticons_loud_cry:"Loud Cry",imgly_sticker_emoticons_loving:"Loving",imgly_sticker_emoticons_masked:"Masked",imgly_sticker_emoticons_music:"Music",imgly_sticker_emoticons_nerd:"Nerd",imgly_sticker_emoticons_ninja:"Ninja",imgly_sticker_emoticons_not_speaking_to_you:"Not speaking to you",imgly_sticker_emoticons_pig:"Pig",imgly_sticker_emoticons_pumpkin:"Pumpkin",imgly_sticker_emoticons_question:"Question",imgly_sticker_emoticons_rabbit:"Rabbit",imgly_sticker_emoticons_sad:"Sad",imgly_sticker_emoticons_sick:"Sick",imgly_sticker_emoticons_skateboard:"Skateboard",imgly_sticker_emoticons_skull:"Skull",imgly_sticker_emoticons_sleepy:"Sleepy",imgly_sticker_emoticons_smile:"Smile",imgly_sticker_emoticons_smoking:"Smoking",imgly_sticker_emoticons_sobbing:"Sobbing",imgly_sticker_emoticons_star:"Star",imgly_sticker_emoticons_steaming_furious:"Steaming Furious",imgly_sticker_emoticons_sunbathing:"Sunbathing",imgly_sticker_emoticons_tired:"Tired",imgly_sticker_emoticons_tongue_out_wink:"Tongue out wink",imgly_sticker_emoticons_wave:"Wave",imgly_sticker_emoticons_wide_grin:"Wide Grin",imgly_sticker_emoticons_wink:"Wink",imgly_sticker_emoticons_wrestler:"Wrestler",imgly_sticker_shapes_arrow_02:"Arrow 1",imgly_sticker_shapes_arrow_03:"Arrow 2",imgly_sticker_shapes_badge_01:"Badge 1",imgly_sticker_shapes_badge_11:"Badge 5",imgly_sticker_shapes_badge_12:"Badge 6",imgly_sticker_shapes_badge_13:"Badge 7",imgly_sticker_shapes_badge_15:"Badge 8",imgly_sticker_shapes_badge_18:"Badge 9",imgly_sticker_shapes_badge_19:"Badge 10",imgly_sticker_shapes_badge_20:"Badge 11",imgly_sticker_shapes_badge_28:"Badge 12",imgly_sticker_shapes_badge_32:"Badge 13",imgly_sticker_shapes_badge_35:"Badge 14",imgly_sticker_shapes_badge_36:"Badge 15",imgly_sticker_shapes_badge_04:"Badge 2",imgly_sticker_shapes_badge_06:"Badge 3",imgly_sticker_shapes_badge_08:"Badge 4",imgly_sticker_shapes_spray_01:"Spray 1",imgly_sticker_shapes_spray_03:"Spray 2",imgly_sticker_shapes_spray_04:"Spray 3"},canvasActions:{buttonDelete:"L\xF6schen",buttonBringToFront:"In den Vordergrund",buttonDuplicate:"Duplizieren",buttonFlipHorizontal:"Horizontal spiegeln",buttonFlipVertical:"Vertikal spiegeln"},history:{add:"Sticker",resize:"Sticker resize",position:"Sticker position",color:"Sticker color","delete":"Sticker delete",order:"Sticker order",opacity:"Sticker opacity",flip:"Sticker flip"}},text:{title:"Text",controls:{buttonNew:"Neuer Text",dropdownFontFamily:"Schriftart",textFontSize:"Schriftgr\xF6\xDFe",selectAlignment:"Ausrichtung",selectFontColor:"Schriftfarbe",selectBackgroundColor:"Hintergrundfarbe",sliderLineSpacing:"Zeilenabstand",tabColor:"Farbe",tabBgColor:"Hintergrund",tabAlignment:"Ausrichtung",tabLineHeight:"Zeilenh\xF6he",tabFontSize:"Schriftgr\xF6\xDFe"},canvasControls:{placeholderText:"Etwas aufschreiben",buttonSave:"Fertig",buttonClose:"Abbrechen",inputText:"Texteingabe"},canvasActions:{buttonEdit:"Bearbeiten",buttonDelete:"L\xF6schen",buttonBringToFront:"In den Vordergrund",buttonDuplicate:"Duplizieren"},history:{add:"Text",edit:"Text edit",resize:"Text resize",position:"Text position",alignment:"Text alignment",textColor:"Text color",backgroundColor:"Text background color",fontFamily:"Font family",fontStyle:"Font style",lineSpacing:"Line spacing",width:"Text width","delete":"Text delete",order:"Text order"}},textdesign:{title:"Text Design",controls:{buttonNew:"Neues Text Design",buttonShuffle:"Shuffle Layout",selectColor:"Textfarbe",tabColor:"Farbe",tabShuffle:"Shuffle",itemAriaLabel:"Text Design ${label} hinzuf\xFCgen"},canvasControls:{placeholderText:"Etwas aufschreiben mit Style",buttonSave:"Done",buttonClose:"Schlie\xDFen",inputText:"Texteingabe"},canvasActions:{buttonEdit:"Bearbeiten",buttonInvert:"Invertieren",buttonDelete:"L\xF6schen",buttonBringToFront:"In den Vordergrund",buttonDuplicate:"Duplizieren"},history:{add:"Text design",edit:"Text design edit",resize:"Text design resize",position:"Text design position",color:"Text design color",shuffle:"Text design shuffle",invert:"Text design invert",padding:"Text design padding",order:"Text design order","delete":"Text design delete"}},frame:{title:"Rahmen",controls:{buttonReset:"Zur\xFCcksetzen",sliderOpacity:"Rahmen Transparenz",sliderSize:"Rahmen Dicke",selectColor:"Rahmen Farbe",tabColor:"Farbe",tabOpacity:"Transparenz",tabSize:"Dicke",itemAriaLabel:"Rahmen ${label} hinzuf\xFCgen"},items:{imgly_frame_dia:"Dia",imgly_frame_art_decor:"Art Decor",imgly_frame_black_passepartout:"Black",imgly_frame_lowpoly_shadow:"Low Poly",imgly_frame_wood_passepartout:"Wood"}},brush:{title:"Malen",controls:{buttonReset:"Zur\xFCcksetzen",sliderSize:"Dicke",sliderHardness:"H\xE4rte",selectColor:"Farbe",tabSize:"Dicke",tabHardness:"H\xE4rte",tabColor:"Farbe"},history:{brushStroke:"Brush Stroke"}},transform:{title:"Zuschneiden",controls:{buttonReset:"Zur\xFCcksetzen",checkboxKeepResolution:"Fixiere Aufl\xF6sung",inputCropSize:"Bildgr\xF6\xDFe",inputHeight:"h",inputWidth:"b",tabFlipAndRotate:"Spiegeln & Drehen",tabResolution:"Aufl\xF6sung",tabCropSize:"Bildgr\xF6\xDFe",itemAriaLabel:"Zuschneiden ${label}",inputHeightAriaLabel:"H\xF6he",inputWidthAriaLabel:"Breite"},categories:{imgly_transforms_common:"Standard",imgly_transforms_facebook:"Facebook",imgly_transforms_twitter:"Twitter",imgly_transforms_instagram:"Instagram"},items:{imgly_transform_common_custom:"Frei",imgly_transform_common_square:"Quadratisch",imgly_transform_common_4:"4:3",imgly_transform_common_16:"16:9",imgly_transform_common_3:"3:4",imgly_transform_common_9:"9:16",imgly_transform_facebook_profile:"Profile",imgly_transform_facebook_title:"Titel",imgly_transform_facebook_post:"Post",imgly_transform_instagram_story:"Story",imgly_transform_instagram_landscape:"Landscape",imgly_transform_instagram_portrait:"Portrait",imgly_transform_instagram_square:"Square",imgly_transform_twitter_profile:"Profile",imgly_transform_twitter_title:"Title",imgly_transform_twitter_post:"Post"},transformActions:{buttonFlipHorizontal:"Horizontal spiegeln",buttonFlipVertical:"Vertikal spiegeln",buttonRotateClockwise:"Drehe im Uhrzeigersinn",buttonRotateAntiClockwise:"Drehe gegen Uhrzeigersinn"}}},"customTool",{title:"Benutzerdefiniert"});});var uu;var RH=d(function(){var _categories3,_items3,_items4;R();uu=_defineProperty({common:{error:"Error",warning:"Warning",color:{colorPicker:{hex:"Hex",r:"R",g:"G",b:"B",sliderHue:"Color",sliderOpacity:"Color Opacity"}}},mainCanvasActions:{buttonExport:"Export Image",buttonUndo:"Undo",buttonRedo:"Redo",buttonClose:"Close"},infoModals:{exporting:{heading:"Exporting...",body:"Just a few seconds..."},saving:{heading:"Saving...",body:"Just a few seconds..."},loading:{heading:"Loading...",body:"Just a few seconds..."},resizing:{heading:"Resizing...",body:"Just a few seconds..."},loadingFonts:{heading:"Loading Fonts...",body:"Just a few seconds..."},stickerLoading:{heading:"Loading Sticker...",body:"Just a few seconds..."}},errorModals:{imageLoading:{headingDelimiter:":",body:"Failed to load image. This can have multiple reasons, e.g. the file is corrupted or the file type is not supported",buttonYes:"Retry",buttonNo:"Close"},rendering:{headingDelimiter:":",body:"An error has occurred while rendering the image",buttonYes:"Retry",buttonNo:"Close"},fontLoading:{headingDelimiter:":",heading:"Failed to load font",body:"The following fonts could not be loaded: ${error}",buttonNo:"Close"},webcamUnavailable:{headingDelimiter:":",body:"Unable to display webcam image (Error: ${error})",buttonYes:"Close"},stickerLoading:{headingDelimiter:":",body:"Unable to load the sticker",buttonNo:"Close"},unexpectedError:{headingDelimiter:":",body:"An unexpected error has occured ${error}",buttonYes:"Retry",buttonNo:"Close"}},warningModals:{imageResized:{headingDelimiter:":",heading:"Image resized",body:"Your image exceeds the maximum size of ${megapixels} megapixels and has been resized to ${width}x${height} pixels",buttonYes:"Continue"},unsupportedSerializationVersion:{headingDelimiter:":",body:"Your data was restored from a legacy data format and might look different",buttonYes:"Apply changes",buttonNo:"Cancel"},discardChanges:{headingDelimiter:":",body:"You have unsaved changes. Are you sure you want to discard the changes?",buttonYes:"Discard changes",buttonNo:"Keep Changes"},unsavedChanges:{headingDelimiter:":",body:"You have unsaved changes. Are you sure you want to exit?",buttonYes:"Exit without saving",buttonNo:"Cancel"},unsupportedWebGLRenderer:{body:"A problem has been detected in the browser that could cause long loading times. Please try a different browser.",buttonYes:"Continue"}},library:{title:"Library",controls:{buttonUpload:"Upload Image",buttonWebcamOpen:"Open Webcam",buttonWebcamClose:"Close Webcam",placeholderSearch:"Search Library",noResults:"No Results",itemAriaLabel:"Replace image with ${label}"}},filter:{title:"Filters",controls:{buttonReset:"Remove Filter",sliderIntensity:"Filter Intensity",itemAriaLabel:"Add ${label} filter"},categories:(_categories3={},_defineProperty(_categories3,"imgly_filter_category_duotone","DuoTone"),_defineProperty(_categories3,"imgly_filter_category_bw","B & W"),_defineProperty(_categories3,"imgly_filter_category_vintage","Vintage"),_defineProperty(_categories3,"imgly_filter_category_smooth","Smooth"),_defineProperty(_categories3,"imgly_filter_category_cold","Cold"),_defineProperty(_categories3,"imgly_filter_category_warm","Warm"),_defineProperty(_categories3,"imgly_filter_category_legacy","Legacy"),_categories3),items:(_items3={},_defineProperty(_items3,"imgly_lut_celsius","Inferno"),_defineProperty(_items3,"imgly_lut_chest","Chestnut"),_defineProperty(_items3,"imgly_lut_fixie","Fixie"),_defineProperty(_items3,"imgly_lut_fridge","Fridge"),_defineProperty(_items3,"imgly_lut_front","Sunny 70s"),_defineProperty(_items3,"imgly_lut_k2","Flat Black"),_defineProperty(_items3,"imgly_lut_mellow","Mellow"),_defineProperty(_items3,"imgly_lut_sin","Hard Stuff"),_defineProperty(_items3,"imgly_lut_texas","Oldtimer"),_defineProperty(_items3,"imgly_lut_ad1920","1920 A.D."),_defineProperty(_items3,"imgly_lut_ancient","Ancient"),_defineProperty(_items3,"imgly_lut_bleached","Kalmen"),_defineProperty(_items3,"imgly_lut_bleachedblue","Joran"),_defineProperty(_items3,"imgly_lut_blues","Polaroid"),_defineProperty(_items3,"imgly_lut_blueshadows","Zephyr"),_defineProperty(_items3,"imgly_lut_breeze","Levante"),_defineProperty(_items3,"imgly_lut_bw","Greyed"),_defineProperty(_items3,"imgly_lut_classic","Classic"),_defineProperty(_items3,"imgly_lut_colorful","Colorful"),_defineProperty(_items3,"imgly_lut_cool","Snappy"),_defineProperty(_items3,"imgly_lut_cottoncandy","Candy"),_defineProperty(_items3,"imgly_lut_creamy","Creamy"),_defineProperty(_items3,"imgly_lut_eighties","Low Fire"),_defineProperty(_items3,"imgly_lut_elder","Colla"),_defineProperty(_items3,"imgly_lut_evening","Sunrise"),_defineProperty(_items3,"imgly_lut_fall","Moss"),_defineProperty(_items3,"imgly_lut_food","Food"),_defineProperty(_items3,"imgly_lut_glam","Glam"),_defineProperty(_items3,"imgly_lut_gobblin","Gobblin"),_defineProperty(_items3,"imgly_lut_highcarb","High Carb"),_defineProperty(_items3,"imgly_lut_highcontrast","Hicon"),_defineProperty(_items3,"imgly_lut_k1","K1"),_defineProperty(_items3,"imgly_lut_k6","K6"),_defineProperty(_items3,"imgly_lut_kdynamic","Pebble"),_defineProperty(_items3,"imgly_lut_keen","Keen"),_defineProperty(_items3,"imgly_lut_lenin","Lemon"),_defineProperty(_items3,"imgly_lut_litho","Litho"),_defineProperty(_items3,"imgly_lut_lomo","Lomo"),_defineProperty(_items3,"imgly_lut_lomo100","Lomo 100"),_defineProperty(_items3,"imgly_lut_lucid","Lucid"),_defineProperty(_items3,"imgly_lut_neat","Neat"),_defineProperty(_items3,"imgly_lut_nogreen","Pumpkin"),_defineProperty(_items3,"imgly_lut_orchid","Solanus"),_defineProperty(_items3,"imgly_lut_pale","Pale"),_defineProperty(_items3,"imgly_lut_pitched","Pitched"),_defineProperty(_items3,"imgly_lut_plate","Weathered"),_defineProperty(_items3,"imgly_lut_pola669","Green Gap"),_defineProperty(_items3,"imgly_lut_polasx","Pola SX"),_defineProperty(_items3,"imgly_lut_pro400","Pro 400"),_defineProperty(_items3,"imgly_lut_quozi","Quozi"),_defineProperty(_items3,"imgly_lut_sepiahigh","Sepia"),_defineProperty(_items3,"imgly_lut_settled","Settled"),_defineProperty(_items3,"imgly_lut_seventies","Seventies"),_defineProperty(_items3,"imgly_lut_soft","Soft"),_defineProperty(_items3,"imgly_lut_steel","Steel"),_defineProperty(_items3,"imgly_lut_summer","Summer"),_defineProperty(_items3,"imgly_lut_sunset","Golden"),_defineProperty(_items3,"imgly_lut_tender","Tender"),_defineProperty(_items3,"imgly_lut_twilight","Twilight"),_defineProperty(_items3,"imgly_lut_winter","Softy"),_defineProperty(_items3,"imgly_lut_x400","Dusty"),_defineProperty(_items3,"imgly_duotone_desert","Desert"),_defineProperty(_items3,"imgly_duotone_peach","Peach"),_defineProperty(_items3,"imgly_duotone_clash","Clash"),_defineProperty(_items3,"imgly_duotone_plum","Plum"),_defineProperty(_items3,"imgly_duotone_breezy","Breezy"),_defineProperty(_items3,"imgly_duotone_deepblue","Deep Blue"),_defineProperty(_items3,"imgly_duotone_frog","Frog"),_defineProperty(_items3,"imgly_duotone_sunset","Sunset"),_items3)},adjustment:{title:"Adjust",controls:{buttonReset:"Reset Adjustment"},categories:{basics:"Basic",refinements:"Refinements"},items:{brightness:"Brightness",saturation:"Saturation",contrast:"Contrast",gamma:"Gamma",sharpness:"Sharpness",clarity:"Clarity",exposure:"Exposure",shadows:"Shadows",highlights:"Highlights",whites:"Whites",blacks:"Blacks",temperature:"Temperature"}},focus:{title:"Focus",controls:{buttonReset:"Remove Focus",sliderIntensity:"Focus Intensity",itemAriaLabel:"Add ${label} focus"},items:{radial:"Radial",mirrored:"Mirrored",linear:"Linear",gaussian:"Gaussian"},history:{focusPosition:"Focus Position",focusSize:"Focus Size"}},overlay:{title:"Overlays",controls:{buttonReset:"Remove Overlay",sliderOpacity:"Overlay Opacity",carouselBlendMode:"Overlay Blend mode",blendModeNormal:"Normal",blendModeOverlay:"Overlay",blendModeHardLight:"Hard Light",blendModeSoftLight:"Soft Light",blendModeMultiply:"Multiply",blendModeDarken:"Darken",blendModeLighten:"Lighten",blendModeScreen:"Screen",blendModeColorBurn:"Color Burn",tabOpacity:"Opacity",tabBlendMode:"Blend Mode",itemAriaLabel:"Add ${name} overlay"},items:(_items4={},_defineProperty(_items4,"imgly_overlay_bokeh","Bokeh"),_defineProperty(_items4,"imgly_overlay_chop","Chop"),_defineProperty(_items4,"imgly_overlay_clouds","Clouds"),_defineProperty(_items4,"imgly_overlay_golden","Golden"),_defineProperty(_items4,"imgly_overlay_grain","Grain"),_defineProperty(_items4,"imgly_overlay_hearts","Hearts"),_defineProperty(_items4,"imgly_overlay_lightleak1","Light Leak 1"),_defineProperty(_items4,"imgly_overlay_lightleak2","Light Leak 2"),_defineProperty(_items4,"imgly_overlay_metal","Metal"),_defineProperty(_items4,"imgly_overlay_mosaic","Mosaic"),_defineProperty(_items4,"imgly_overlay_painting","Painting"),_defineProperty(_items4,"imgly_overlay_paper","Paper"),_defineProperty(_items4,"imgly_overlay_rain","Rain"),_defineProperty(_items4,"imgly_overlay_vintage","Vintage"),_defineProperty(_items4,"imgly_overlay_wall1","Wall"),_defineProperty(_items4,"imgly_overlay_wall2","Wall 2"),_defineProperty(_items4,"imgly_overlay_wood","Wood"),_items4)},sticker:{title:"Stickers",controls:{buttonUpload:"Upload Sticker",sliderOpacity:"Sticker Opacity",selectColor:"Sticker Color",tabColor:"Color",tabOpacity:"Opacity",itemAriaLabel:"Add ${label} sticker"},categories:{imgly_sticker_emoticons:"Emoticons",imgly_sticker_shapes:"Shapes",imgly_sticker_custom:"Custom"},items:{imgly_sticker_emoticons_alien:"Alien",imgly_sticker_emoticons_angel:"Angel",imgly_sticker_emoticons_angry:"Angry",imgly_sticker_emoticons_anxious:"Anxious",imgly_sticker_emoticons_asleep:"Asleep",imgly_sticker_emoticons_attention:"Attention",imgly_sticker_emoticons_baby_chicken:"Baby Chicken",imgly_sticker_emoticons_batman:"Batman",imgly_sticker_emoticons_beer:"Beer",imgly_sticker_emoticons_black:"Black",imgly_sticker_emoticons_blue:"Blue",imgly_sticker_emoticons_blush:"Blush",imgly_sticker_emoticons_boxer:"Boxer",imgly_sticker_emoticons_business:"Business",imgly_sticker_emoticons_chicken:"Chicken",imgly_sticker_emoticons_cool:"Cool",imgly_sticker_emoticons_cry:"Cry",imgly_sticker_emoticons_deceased:"Deceased",imgly_sticker_emoticons_devil:"Devil",imgly_sticker_emoticons_duckface:"Duckface",imgly_sticker_emoticons_furious:"Furious",imgly_sticker_emoticons_grin:"Grin",imgly_sticker_emoticons_guitar:"Guitar",imgly_sticker_emoticons_harry_potter:"Harry Potter",imgly_sticker_emoticons_hippie:"Hippie",imgly_sticker_emoticons_hitman:"Hitman",imgly_sticker_emoticons_humourous:"Humourous",imgly_sticker_emoticons_idea:"Idea",imgly_sticker_emoticons_impatient:"Impatient",imgly_sticker_emoticons_kiss:"Kiss",imgly_sticker_emoticons_kisses:"Kisses",imgly_sticker_emoticons_laugh:"Laugh",imgly_sticker_emoticons_loud_cry:"Loud Cry",imgly_sticker_emoticons_loving:"Loving",imgly_sticker_emoticons_masked:"Masked",imgly_sticker_emoticons_music:"Music",imgly_sticker_emoticons_nerd:"Nerd",imgly_sticker_emoticons_ninja:"Ninja",imgly_sticker_emoticons_not_speaking_to_you:"Not speaking to you",imgly_sticker_emoticons_pig:"Pig",imgly_sticker_emoticons_pumpkin:"Pumpkin",imgly_sticker_emoticons_question:"Question",imgly_sticker_emoticons_rabbit:"Rabbit",imgly_sticker_emoticons_sad:"Sad",imgly_sticker_emoticons_sick:"Sick",imgly_sticker_emoticons_skateboard:"Skateboard",imgly_sticker_emoticons_skull:"Skull",imgly_sticker_emoticons_sleepy:"Sleepy",imgly_sticker_emoticons_smile:"Smile",imgly_sticker_emoticons_smoking:"Smoking",imgly_sticker_emoticons_sobbing:"Sobbing",imgly_sticker_emoticons_star:"Star",imgly_sticker_emoticons_steaming_furious:"Steaming Furious",imgly_sticker_emoticons_sunbathing:"Sunbathing",imgly_sticker_emoticons_tired:"Tired",imgly_sticker_emoticons_tongue_out_wink:"Tongue out wink",imgly_sticker_emoticons_wave:"Wave",imgly_sticker_emoticons_wide_grin:"Wide Grin",imgly_sticker_emoticons_wink:"Wink",imgly_sticker_emoticons_wrestler:"Wrestler",imgly_sticker_shapes_arrow_02:"Arrow 1",imgly_sticker_shapes_arrow_03:"Arrow 2",imgly_sticker_shapes_badge_01:"Badge 1",imgly_sticker_shapes_badge_11:"Badge 5",imgly_sticker_shapes_badge_12:"Badge 6",imgly_sticker_shapes_badge_13:"Badge 7",imgly_sticker_shapes_badge_15:"Badge 8",imgly_sticker_shapes_badge_18:"Badge 9",imgly_sticker_shapes_badge_19:"Badge 10",imgly_sticker_shapes_badge_20:"Badge 11",imgly_sticker_shapes_badge_28:"Badge 12",imgly_sticker_shapes_badge_32:"Badge 13",imgly_sticker_shapes_badge_35:"Badge 14",imgly_sticker_shapes_badge_36:"Badge 15",imgly_sticker_shapes_badge_04:"Badge 2",imgly_sticker_shapes_badge_06:"Badge 3",imgly_sticker_shapes_badge_08:"Badge 4",imgly_sticker_shapes_spray_01:"Spray 1",imgly_sticker_shapes_spray_03:"Spray 2",imgly_sticker_shapes_spray_04:"Spray 3"},canvasActions:{buttonDelete:"Delete",buttonBringToFront:"Move to front",buttonDuplicate:"Duplicate",buttonFlipHorizontal:"Flip",buttonFlipVertical:"Flip"},history:{add:"Sticker",resize:"Sticker resize",position:"Sticker position",color:"Sticker color","delete":"Sticker delete",order:"Sticker order",opacity:"Sticker opacity",flip:"Sticker flip"}},text:{title:"Text",controls:{buttonNew:"New Text",dropdownFontFamily:"Font Family",textFontSize:"Font Size",selectAlignment:"Alignment",selectFontColor:"Font Color",selectBackgroundColor:"Background Color",sliderLineSpacing:"Line Spacing",tabColor:"Color",tabBgColor:"Bg Color",tabAlignment:"Alignment",tabLineHeight:"Line Height",tabFontSize:"Font Size"},canvasControls:{placeholderText:"Write Something",buttonSave:"Done",buttonClose:"Cancel",inputText:"Text Input"},canvasActions:{buttonEdit:"Edit",buttonDelete:"Delete",buttonBringToFront:"Move to front",buttonDuplicate:"Duplicate"},history:{add:"Text",edit:"Text edit",resize:"Text resize",position:"Text position",alignment:"Text alignment",textColor:"Text color",backgroundColor:"Text background color",fontFamily:"Font family",fontStyle:"Font style",lineSpacing:"Line spacing",width:"Text width","delete":"Text delete",order:"Text order"}},textdesign:{title:"Text Design",controls:{buttonNew:"New Text Design",buttonShuffle:"Shuffle Layout",selectColor:"Text Color",tabColor:"Color",tabShuffle:"Shuffle",itemAriaLabel:"Add ${label} text design"},canvasControls:{placeholderText:"Write Something With Style",buttonSave:"Done",buttonClose:"Schlie\xDFen",inputText:"Text Input"},canvasActions:{buttonEdit:"Edit",buttonInvert:"Invert",buttonDelete:"Delete",buttonBringToFront:"Move to front",buttonDuplicate:"Duplicate"},history:{add:"Text design",edit:"Text design edit",resize:"Text design resize",position:"Text design position",color:"Text design color",shuffle:"Text design shuffle",invert:"Text design invert",padding:"Text design padding",order:"Text design order","delete":"Text design delete"}},frame:{title:"Frames",controls:{buttonReset:"Remove Frame",sliderOpacity:"Frame Opacity",sliderSize:"Frame Size",selectColor:"Frame Color",tabColor:"Color",tabOpacity:"Opacity",tabSize:"Size",itemAriaLabel:"Add ${label} frame"},items:{imgly_frame_dia:"Dia",imgly_frame_art_decor:"Art Decor",imgly_frame_black_passepartout:"Black",imgly_frame_lowpoly_shadow:"Low Poly",imgly_frame_wood_passepartout:"Wood"}},brush:{title:"Brush",controls:{buttonReset:"Remove Brush",sliderSize:"Brush Size",sliderHardness:"Brush Hardness",selectColor:"Brush Color",tabSize:"Size",tabHardness:"Hardness",tabColor:"Color"},history:{brushStroke:"Brush Stroke"}},transform:{title:"Transform",controls:{buttonReset:"Reset to default",checkboxKeepResolution:"Keep Resolution",inputCropSize:"Crop Size",inputHeight:"h",inputWidth:"w",tabFlipAndRotate:"Flip & Rotate",tabResolution:"Resolution",tabCropSize:"Crop Size",itemAriaLabel:"Apply ${label} crop",inputHeightAriaLabel:"crop height",inputWidthAriaLabel:"crop width"},categories:{imgly_transforms_common:"Common",imgly_transforms_facebook:"Facebook",imgly_transforms_twitter:"Twitter",imgly_transforms_instagram:"Instagram"},items:{imgly_transform_common_custom:"Custom",imgly_transform_common_square:"Square",imgly_transform_common_4:"4:3",imgly_transform_common_16:"16:9",imgly_transform_common_3:"3:4",imgly_transform_common_9:"9:16",imgly_transform_facebook_profile:"Profile",imgly_transform_facebook_title:"Title",imgly_transform_facebook_post:"Post",imgly_transform_instagram_story:"Story",imgly_transform_instagram_landscape:"Landscape",imgly_transform_instagram_portrait:"Portrait",imgly_transform_instagram_square:"Square",imgly_transform_twitter_profile:"Profile",imgly_transform_twitter_title:"Title",imgly_transform_twitter_post:"Post"},transformActions:{buttonFlipHorizontal:"Flip Horizontal",buttonFlipVertical:"Flip Vertical",buttonRotateClockwise:"Rotate Clockwise",buttonRotateAntiClockwise:"Rotate Counterclockwise"}}},"customTool",{title:"Custom"});});var Yh=d(function(){OH();RH();});var AH,BH;var PH=d(function(){vl();Yh();AH=function AH(i){if(i==="de"){return Pk;}return uu;};BH=function BH(i,t){if(t&&t[i]){return Fi([AH(i),t[i]]);}return AH(i)||uu;};});var Glt,Vlt,Mk,lv;var Jh=d(function(){vl();Glt={headline1:{size:16,letterSpacing:1.5,"case":"uppercase"},headline2:{size:14,letterSpacing:.8,"case":"uppercase"},body:{size:13,letterSpacing:0,"case":"none"},label:{size:13,letterSpacing:0,"case":"capitalize"},basicUICardLabel:{size:12,letterSpacing:0,"case":"capitalize"},button1:{size:14,letterSpacing:0,"case":"uppercase"},button2:{size:14,letterSpacing:0,"case":"capitalize"},basicUITabLabel:{size:14,letterSpacing:.8,"case":"uppercase"}};Vlt={toast:2,controlsBar:5,buttonGroup:5,toolControlBar:6,toolbar:7,label:10,disable:11,canvas:{knob:4,bar:5,controls:5,snappingGuide:1,crop:{grid:2,dragImage:3,backdrop:4},webcam:{backdrop:7}},input:{list:6},button:{"float":5},dialog:{base:100,backdrop:1,container:2},colorItem:{overlay:2,background:1,tiledBackground:0}};Mk=function Mk(i){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;var e=i;var r=3*t;var o=e-2*r;var n=(o-2*t)/3;var s=(o-t)/2;return{advancedUIToolControlBar:{width:e,paddingTop:2*t,paddingBottom:2*t,paddingLeft:r,paddingRight:r,marginBottom:0,controls:{gutter:2*t}},advancedUICard:{small:{height:n,width:n},medium:{height:s,width:s},large:{height:86,width:o}},advancedUISpacer:t,inputs:{cropSize:{maxWidth:e},checkbox:{maxWidth:e}}};};lv=function lv(){var i=Mk(230);var t={advancedUIToolbar:{width:55,itemHeight:48,separatorHeight:20,marginBottom:0},basicCanvasOffset:40+76-88,basicUIToolbar:{openHeight:88,closeHeight:40},basicUIToolControlBar:{itemsBarHeight:72,controlsBarHeight:80,maxHeight:72+40+4,maxWidth:300},basicCard:{medium:{height:56,width:90},large:{height:60,width:110}},basicSpacer:8,mainCanvasActionBar:{height:50},crop:{minSize:50},canvas:{marginTop:0,transform:{minSliderWidth:435,minValueWidth:235,minFlipWidth:160}},canvasControls:{sprite:{controlOffset:16,rotateHandle:{height:16},minSize:30,controlPadding:16},knob:{size:16,touchable:{desktop:24}},corner:{size:14,touchable:{desktop:24,mobile:48},borderWidth:4},width:{size:14}},buttons:{"float":{size:56}},colorItem:{size:20},color:{colorPicker:{width:214,height:370,saturationSlider:{height:150},thumb:{size:14},arrow:{width:36}}},fontSystem:Glt,zIndex:Vlt};return Fi([i,t]);};});var jlt,cv;var MH=d(function(){jlt=function jlt(){var _ref153=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{primary:"#365afc",background:"#0B0B0B",foreground:"#FFFFFF"},_ref153$primary=_ref153.primary,i=_ref153$primary===void 0?"#365afc":_ref153$primary,_ref153$background=_ref153.background,t=_ref153$background===void 0?"#0B0B0B":_ref153$background,_ref153$foreground=_ref153.foreground,e=_ref153$foreground===void 0?"#FFFFFF":_ref153$foreground;var r="rgba(255, 255, 255, 0.90)";var o="rgba(255, 255, 255, 0.60)";var n="rgba(255, 255, 255, 0.38)";var s="#424242";var a="#333333";var l="#242424";var c="#171717";var u="#0B0B0B";var m="rgba(255, 255, 255, 0.08)";var p="rgba(0, 0, 0, 0.3)";var h="rgba(89, 121, 252, 0.20)";var g="0.3";return{shape:{radiusSmall:2,radiusMedium:4,radiusLarge:4},typography:{fontFamily:"Fira Sans",format:"woff",fontURI:"./fonts/imgly_font_fira_sans_regular.woff",provider:"file"},background:t,foreground:e,primary:i,warning:"#ffba5c",error:"#c2393a",success:"#39c26c",focusOutlineColor:"rgba(255, 255, 255, 0.12)",scrollbar:{handleColor:"rgba(255, 255, 255, 0.2)"},button:{outlinedBorderColor:a,activeForeground:i,containedPrimaryBackground:i,containedPrimaryForeground:r,outlinedPrimaryBackground:l,outlinedPrimaryForeground:r,outlinedSecondaryBackground:"transparent",outlinedSecondaryForeground:o,textPrimaryForeground:i,textSecondaryForeground:o,outlinedInactiveOverlayColor:p,textInactiveOpacity:"0.5",hoverOverlayColor:m},checkbox:{background:a,foreground:e,activeForeground:e,activeBackground:i,inactiveOpacity:g,hoverOpacity:"0.8"},modal:{background:l,bodyForeground:r,headerForeground:o,backdrop:"rgba(0, 0, 0, 0.6)"},card:{background:a,foreground:r,activeBorderColor:i,activeOverlayColor:h,labelBackground:"linear-gradient(transparent, rgba(0, 0, 0, 0.6))",labelForeground:r,inactiveOverlayColor:p,hoverOverlayColor:m},tabTitle:{foreground:o,background:"transparent",activeBackground:"transparent",activeBorderColor:i,activeForeground:r},dropdown:{background:"transparent",foreground:r,hoverBorderColor:o,borderColor:a,caretColor:n,listBackground:a,listBorderColor:a,listItemHoverBackground:s,listForeground:o,listShadow:"0 12px 17px 2px rgba(0,0,0,0.14),\n 0 5px 22px 4px rgba(0,0,0,0.12),\n 0 7px 8px -4px rgba(0,0,0,0.20)",inactiveOpacity:g},textInput:{foreground:r,hoverBorderColor:"rgba(255, 255, 255, 0.40)",background:"transparent",borderColor:a,inactiveOpacity:g},slider:{trackColor:"rgba(255, 255, 255, 0.4)",activeTrackColor:i,thumbBackground:c,thumbBorderColor:i,inactiveOpacity:g,hoverOpacity:"0.7"},selectColor:{activeBorderColor:i,inactiveOpacity:g},toolbar:{foreground:r,background:l,activeBackground:"transparent",activeForeground:i,borderColor:"transparent"},tooltip:{background:s,foreground:r},toolControlBar:{background:"rgba(23, 23, 23, 0.9)",borderColor:"transparent",shadow:"none",separatorColor:a,titleForeground:o,inputLabelForeground:o,inputLabelInactiveOpacity:g},mainCanvasActionBar:{background:"linear-gradient(0deg, transparent 0%, rgba(0, 0, 0, 0.6) 98%)",foreground:r,borderColor:"none"},canvasActionBar:{background:s,foreground:r,separatorColor:n},canvas:{background:u,controlsOutline:"rgba(255, 255, 255, 0.5)",controlsColor:"#ffffff",cropBackdrop:"rgba(0, 0, 0, 0.5)"},colorPicker:{listBackground:a,listShadow:"0 12px 17px 2px rgba(0,0,0,0.14),\n 0 5px 22px 4px rgba(0,0,0,0.12),\n 0 7px 8px -4px rgba(0,0,0,0.20)",controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#424242",highlight:"#565656",shadow:"#333333"}}};};cv=jlt;});var $lt,Lk;var LH=d(function(){$lt=function $lt(){var _ref154=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{primary:"#1e47fb",background:"#FBFBFB",foreground:"#000000"},_ref154$primary=_ref154.primary,i=_ref154$primary===void 0?"#1e47fb":_ref154$primary,_ref154$background=_ref154.background,t=_ref154$background===void 0?"#FBFBFB":_ref154$background,_ref154$foreground=_ref154.foreground,e=_ref154$foreground===void 0?"#000000":_ref154$foreground;var r="rgba(0, 0, 0, 0.90)";var o="rgba(0, 0, 0, 0.60)";var n="rgba(0, 0, 0, 0.38)";var s="#CCCCCC";var a="#D4D4D4";var l="#E6E6E6";var c="#EEEEEE";var u="#FBFBFB";var m="rgba(125, 125, 125, 0.12)";var p="rgba(30, 71, 251, 0.2)";var h="rgba(0, 0, 0, 0.1)";var g="0.3";return{shape:{radiusSmall:2,radiusMedium:4,radiusLarge:4},typography:{fontFamily:"Fira Sans",format:"woff",fontURI:"./fonts/imgly_font_fira_sans_regular.woff",provider:"file"},background:t,foreground:e,primary:i,warning:"#ffb045",error:"#c01a1b",success:"#17c658",focusOutlineColor:"rgba(125, 125, 125, 0.12)",scrollbar:{handleColor:"rgba(0, 0, 0, 0.2)"},button:{outlinedBorderColor:a,activeForeground:i,containedPrimaryBackground:i,containedPrimaryForeground:"rgba(255, 255, 255, 0.9)",outlinedPrimaryBackground:l,outlinedPrimaryForeground:r,outlinedSecondaryBackground:"transparent",outlinedSecondaryForeground:o,textPrimaryForeground:i,textSecondaryForeground:o,outlinedInactiveOverlayColor:h,textInactiveOpacity:"0.5",hoverOverlayColor:m},checkbox:{background:a,foreground:e,activeForeground:e,activeBackground:i,inactiveOpacity:g,hoverOpacity:"0.8"},modal:{background:l,bodyForeground:r,headerForeground:o,backdrop:"rgba(0, 0, 0, 0.6)"},card:{background:a,foreground:r,activeBorderColor:i,activeOverlayColor:p,labelBackground:"linear-gradient(transparent, rgba(0, 0, 0, 0.6))",labelForeground:"rgba(255, 255, 255, 0.87)",inactiveOverlayColor:h,hoverOverlayColor:m},tabTitle:{foreground:o,background:"transparent",activeBackground:"transparent",activeBorderColor:i,activeForeground:r},dropdown:{background:"transparent",foreground:r,hoverBorderColor:o,borderColor:a,listBackground:a,caretColor:n,listForeground:o,listBorderColor:a,listItemHoverBackground:s,listShadow:"0 8px 10px 1px rgba(0,0,0,0.14),\n 0 3px 14px 2px rgba(0,0,0,0.12),\n 0 5px 5px -3px rgba(0,0,0,0.20)",inactiveOpacity:g},textInput:{foreground:r,hoverBorderColor:r,background:"transparent",borderColor:a,inactiveOpacity:g},slider:{trackColor:s,activeTrackColor:i,thumbBackground:c,thumbBorderColor:i,inactiveOpacity:g,hoverOpacity:"0.7"},selectColor:{activeBorderColor:i,inactiveOpacity:g},toolbar:{foreground:r,background:a,activeBackground:"transparent",activeForeground:i,borderColor:"transparent"},tooltip:{background:s,foreground:r},toolControlBar:{background:"rgba(238, 238, 238, 0.9)",borderColor:c,shadow:"none",separatorColor:a,titleForeground:o,inputLabelForeground:o,inputLabelInactiveOpacity:g},mainCanvasActionBar:{background:"transparent",foreground:r,borderColor:"none"},canvasActionBar:{background:s,foreground:r,separatorColor:n},canvas:{background:u,controlsOutline:"rgba(255, 255, 255, 0.6)",controlsColor:"#ffffff",cropBackdrop:"rgba(255, 255, 255, 0.3)"},colorPicker:{listBackground:a,listShadow:"0 8px 10px 1px rgba(0,0,0,0.14),\n 0 3px 14px 2px rgba(0,0,0,0.12),\n 0 5px 5px -3px rgba(0,0,0,0.20)",controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}};};Lk=$lt;});var Zh,uv,Hr;var Qh=d(function(){Jh();MH();LH();Zh=cv();uv=lv();Hr=_objectSpread(_objectSpread({},Zh),{},{measurements:uv});});var Xlt,zH;var UH=d(function(){vl();Qh();Xlt=function Xlt(i){if(i==="light"){return Lk;}return cv;};zH=function zH(i,t){var e=Xlt(i);if(t&&t[i]){var _t$i=t[i],r=_t$i.primary,o=_t$i.background,n=_t$i.foreground;var s={primary:r,background:o,foreground:n};var a=Object.keys(s).reduce(function(l,c){if(s[c]){return _objectSpread(_objectSpread({},l),{},_defineProperty({},c,s[c]));}return l;},{});return Fi([e(a),t[i]]);}return e()||Zh;};});var qlt,NH;var HH=d(function(){vl();Jh();qlt=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];NH=function NH(i){var t=lv();if(i){var e={};Object.keys(i).forEach(function(r){if(qlt.indexOf(r)!==-1){e[r]=i[r];}});return Fi([t,e]);}return t;};});var WH=d(function(){PH();UH();HH();});var Ylt,Qi;var dv=d(function(){Tt();R();zn();U();vl();Ak();FH();sk();Yh();WH();Qh();Ylt={config:_l,locale:uu,theme:Zh,measurements:uv,initialMeasurements:uv};Qi=/*#__PURE__*/function(){function Qi(){var _this332=this;_classCallCheck(this,Qi);this.dispose=function(){_this332.state=null;_this332.events=null;_this332.assetProvider=null;};this.checkDefaultToolAvailability=function(t,e){return e.indexOf(t)!==-1;};this.state=Q(Ylt);this.events=new Rk();this.licenseChecker=null;}_createClass(Qi,[{key:"saveConfig",value:function saveConfig(t){var _this333=this;if(t.mainCanvasActions&&t.mainCanvasActions.length!==4){t.mainCanvasActions.length=4;}var e=t.layout&&t.layout==="basic"?Bk:_l;var r=Fi([e,t],{clone:true});this.licenseChecker=new Zx(r.license);if(!this.licenseChecker.areCustomAssetsAllowed()){r.sticker.enableCustomUpload=false;}var o=BH(r.language,r.custom.languages);var n=zH(r.theme,r.custom.themes);var s=NH(r.custom.measurements);var a=r.library.provider;var l=[];r.adjustment.categories=r.adjustment.categories.reduce(function(m,p){m.push(_objectSpread(_objectSpread({},p),{},{items:p.items.filter(function(h){if(!xC[h.identifier]){l.push(h.identifier);return false;}return true;})}));return m;},[]);if(l.length!==0){console.error("The following identifier are incorrect for the adjustment tool: ".concat(l.join(", ")));}delete r.language;delete r.custom.languages;delete r.custom.themes;delete r.library.provider;var c=r.tools.reduce(function(m,p){if(_typeof(p)==="object"){return[].concat(_toConsumableArray(m),_toConsumableArray(p));}return[].concat(_toConsumableArray(m),[p]);},[]);if(!c.length){console.error("Empty list input for tools");c=Qx.reduce(function(m,p){if(_typeof(p)==="object"){return[].concat(_toConsumableArray(m),_toConsumableArray(p));}return[].concat(_toConsumableArray(m),[p]);},[]);}c=c.filter(function(m){return _this333.licenseChecker.isToolAllowed(m);});if(r.defaultTool){var m=this.checkDefaultToolAvailability(r.defaultTool,c);if(!m){var _c7=c;var _c8=_slicedToArray(_c7,1);r.defaultTool=_c8[0];}}r.tools=c;this.state.config=r;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;var u=this.buildCustomAssetsConfig();this.assetProvider=new _p(u,this.licenseChecker.areCustomAssetsAllowed(),r.assetResolver);this.loadThemeFont();return a;}},{key:"config",get:function get(){return this.state.config;}},{key:"locale",get:function get(){return this.state.locale;}},{key:"theme",get:function get(){return this.state.theme;}},{key:"measurements",get:function get(){return this.state.measurements;}},{key:"initialMeasurements",get:function get(){return this.state.initialMeasurements;}},{key:"tools",get:function get(){return this.config.tools.reduce(function(t,e){if(typeof e==="string"){return[].concat(_toConsumableArray(t),[e]);}return[].concat(_toConsumableArray(t),[""],_toConsumableArray(e));},[]);}},{key:"defaultTool",get:function get(){return this.config.defaultTool;}},{key:"isOrderDefault",get:function get(){return this.config.order==="default";}},{key:"isLayoutAdvanced",get:function get(){return this.config.layout==="advanced";}},{key:"displayCloseButton",get:function get(){return this.config.mainCanvasActions.indexOf("close")!==-1;}},{key:"loadThemeFont",value:function loadThemeFont(){var t=this.theme.typography;if(!t.skipLoading){this.assetProvider.getFontManager().injectFonts([t]);}}},{key:"buildCustomAssetsConfig",value:function buildCustomAssetsConfig(){var t=this.tools;var e=ct(this.state.config);var r=this.state.config.assetBaseUrl;var o=this.state.theme;var n=t.indexOf("filter")!==-1?e["filter"]:void 0;var s=t.indexOf("focus")!==-1?e["focus"]:void 0;var a=t.indexOf("adjustment")!==-1?e["adjustment"]:void 0;var l=t.indexOf("sticker")!==-1?e["sticker"]:void 0;var c=t.indexOf("frame")!==-1?e["frame"]:void 0;var u=t.indexOf("overlay")!==-1?e["overlay"]:void 0;var m=t.indexOf("transform")!==-1?e["transform"]:void 0;var p=t.indexOf("text")!==-1?e["text"]:void 0;var h=t.indexOf("textdesign")!==-1?e["textdesign"]:void 0;return{basePath:r,theme:o,filter:n,focus:s,sticker:l,frame:c,overlay:u,transform:m,text:p,adjustment:a,textdesign:h};}}]);return Qi;}();f([C],Qi.prototype,"saveConfig",1);f([C],Qi.prototype,"dispose",2);f([S],Qi.prototype,"config",1);f([S],Qi.prototype,"locale",1);f([S],Qi.prototype,"theme",1);f([S],Qi.prototype,"measurements",1);f([S],Qi.prototype,"initialMeasurements",1);f([S],Qi.prototype,"tools",1);f([S],Qi.prototype,"defaultTool",1);f([S],Qi.prototype,"isOrderDefault",1);f([S],Qi.prototype,"isLayoutAdvanced",1);f([S],Qi.prototype,"displayCloseButton",1);});var zk;var Uk=d(function(){R();yC();zk=/*#__PURE__*/function(){function zk(t){_classCallCheck(this,zk);this.editor=t;}_createClass(zk,[{key:"setBackgroundImage",value:function setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,originalImage:t,blendMode:"normal",opacity:1});}else{this.container.setData({image:t,originalImage:t});}}},{key:"getchildren",value:function getchildren(){return this.container.getChildren();}},{key:"addImageToContainer",value:function addImageToContainer(){var _this334=this;return new Promise(function(t,e){var r=_this334.editor.activeStore.image;if(jF(r)){_this334.setBackgroundImage(r);t();}else{var o=_this334.editor.libraryStore.getRawUrl(r);_this334.getImageElement(o).then(function(n){_this334.setBackgroundImage(n);t();})["catch"](function(n){e({identifier:"imageLoading",message:n.message});});}});}},{key:"getImageElement",value:function getImageElement(t){var _this335=this;return new Promise(function(e,r){var o=new Image();o.addEventListener("load",function(){e(o);});o.addEventListener("error",function(n){r(n);});o.crossOrigin=_this335.editor.configStore.config.engine.crossOrigin;o.src=t;});}},{key:"getImgageContainerId",value:function getImgageContainerId(){return this.container?this.container.getID():"";}},{key:"engine",get:function get(){return this.editor.engine;}}]);return zk;}();});var Nk;var Hk=d(function(){U();Nk=/*#__PURE__*/function(){function Nk(t){var _this336=this;_classCallCheck(this,Nk);this.applyNewImageTransform=function(){var _this336$editor$engin=_this336.editor.engineMediator.image.container.getBounds(),t=_this336$editor$engin.size,e=_this336$editor$engin.width,r=_this336$editor$engin.height;var o=_this336.container;o.setTransform(_re.IDENTITY);o.setResolution(t);o.setPivot(.5,.5);o.setPosition({x:e/2,y:r/2});};this.editor=t;}_createClass(Nk,[{key:"engine",get:function get(){return this.editor.engine;}},{key:"container",get:function get(){return this.engine.getOutputContainer();}}]);return Nk;}();});function tf(i,t){var e=i.width/i.height;var r=t.width/t.height;if(e>r){return i.height/t.height;}return i.width/t.width;}var GH=d(function(){});var Jlt,ta;var Wk=d(function(){Tt();U();GH();Jlt={transform:_re.IDENTITY};ta=/*#__PURE__*/function(){function ta(t){_classCallCheck(this,ta);this.initialTransform=_re.IDENTITY;this.editor=t;this.state=Q(Jlt);}_createClass(ta,[{key:"createPreview",value:function createPreview(t){this.container=this.editor.engine.createPreview(t);}},{key:"updateTransform",value:function updateTransform(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var r=this.calculateTransform(t);if(r.scale.x){if(e){this.saveInitialTransform(r);}else{this.savePreviewTransform(r);}this.container.setTransform(this.state.transform);return true;}return false;}},{key:"saveInitialTransform",value:function saveInitialTransform(t){this.initialTransform=t;this.savePreviewTransform(t);}},{key:"savePreviewTransform",value:function savePreviewTransform(t){var _this337=this;Ve(function(){_this337.state.transform.position=t.position;_this337.state.transform.scale=t.scale;_this337.state.transform.rotation=t.rotation;var e=Eo();var r=new O(t.scale).divide(e);_this337.previewTransformWithoutDpr={position:new O(t.position).divide(e),scale:r,rotation:t.rotation};});}},{key:"transform",get:function get(){return this.state.transform;}},{key:"position",get:function get(){return this.state.transform.position;}},{key:"scale",get:function get(){return this.state.transform.scale;}},{key:"rotation",get:function get(){return this.state.transform.rotation;}},{key:"calculateTransform",value:function calculateTransform(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=Eo();var r=this.editor.configStore.config.scaleImageToFit;var _this$editor$canvasSt2=this.editor.canvasStore.canvasSize,o=_this$editor$canvasSt2.width,n=_this$editor$canvasSt2.height;var s=this.editor.engine.getOutputDimensions();var a=tf({width:o,height:n},s);var l=r?a:Math.min(1,a);var c=n-s.height*l;var u=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(cn*m){l=tf({width:o,height:n*m},s);}if(s.width*l>o*m){l=tf({width:o*m,height:n},s);}l*=e;var p={x:o*e/2,y:n*e/2};var h={x:l,y:l};return new _re(p,h,t);}}]);return ta;}();f([C],ta.prototype,"updateTransform",1);f([C],ta.prototype,"savePreviewTransform",1);f([S],ta.prototype,"transform",1);f([S],ta.prototype,"position",1);f([S],ta.prototype,"scale",1);f([S],ta.prototype,"rotation",1);});var _Cl,mv;var Gk=d(function(){var _mv$IMAGE_CONTAINER_I;R();_Cl=/*#__PURE__*/function(){function Cl(){_classCallCheck(this,Cl);this.imageContainerOrder=[];this.spriteContainerOrder=[];}_createClass(Cl,[{key:"addIndex",value:function addIndex(t){_Cl.checkTool(t);var _Cl$indexForOrder=_Cl.indexForOrder(_Cl.IMAGE_CONTAINER_INDEX,this.imageContainerOrder,t),e=_Cl$indexForOrder.index,r=_Cl$indexForOrder.order;this.imageContainerOrder=r;return e;}},{key:"removeIndex",value:function removeIndex(t){_Cl.checkTool(t);_Cl.remove(t,this.imageContainerOrder);}},{key:"addSprite",value:function addSprite(t){this.spriteContainerOrder.push(t);return this.imageContainerOrder.length+this.spriteContainerOrder.length-1;}},{key:"removeSprite",value:function removeSprite(t){_Cl.remove(t,this.spriteContainerOrder);}},{key:"renameSprite",value:function renameSprite(t,e){var r=this.spriteContainerOrder.findIndex(function(o){return o===t;});if(r!==-1){this.spriteContainerOrder[r]=e;}}},{key:"bringToFront",value:function bringToFront(t){var e=this.spriteContainerOrder.findIndex(function(r){return r===t;});if(e!==-1){this.spriteContainerOrder.splice(e,1);this.spriteContainerOrder.push(t);}return this.getLastSpriteIndex();}},{key:"getLastSpriteId",value:function getLastSpriteId(){var t=this.spriteContainerOrder.length;return this.spriteContainerOrder[t-1];}},{key:"getSpriteIndex",value:function getSpriteIndex(t){var e=this.spriteContainerOrder.findIndex(function(r){return r===t;});return e+this.imageContainerOrder.length-1;}},{key:"getLastSpriteIndex",value:function getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1;}}],[{key:"checkTool",value:function checkTool(t){if(["sticker","text","textdesign","brush"].indexOf(t)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite");}}},{key:"remove",value:function remove(t,e){var r=e.findIndex(function(o){return o===t;});if(r!==-1){e.splice(r,1);}return void 0;}},{key:"indexForOrder",value:function indexForOrder(t,e,r){var o=t[r];var n=e.findIndex(function(a){return a===r;});if(n!==-1){return{index:n,order:e};}var _e28=e,s=_e28.length;if(s){var a;for(a=0;a0&&t0;}},{key:"canRedo",get:function get(){return this.snapshots.length-1>this.index;}}]);return xm;}();f([S],xm.prototype,"index",1);f([S],xm.prototype,"canUndo",1);f([S],xm.prototype,"canRedo",1);});var du;var pv=d(function(){Tt();R();VH();Zi();du=/*#__PURE__*/function(){function du(t){var _this339=this;_classCallCheck(this,du);this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee34(){var _t41;return regeneratorRuntime.wrap(function _callee34$(_context35){while(1){switch(_context35.prev=_context35.next){case 0:if(_this339.awaitHistoryChange){_context35.next=8;break;}_this339.editor.configStore.events.onUndo();_this339.awaitHistoryChange=true;_t41=_this339.appHistoryManager.undo();_context35.next=6;return _this339.applyState(_t41);case 6:_this339.awaitHistoryChange=false;if(!_this339.canUndo){_this339.isDirtySinceSave=false;}case 8:case"end":return _context35.stop();}}},_callee34);}));this.redo=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee35(){var _t42;return regeneratorRuntime.wrap(function _callee35$(_context36){while(1){switch(_context36.prev=_context36.next){case 0:if(_this339.awaitHistoryChange){_context36.next=7;break;}_this339.editor.configStore.events.onRedo();_this339.awaitHistoryChange=true;_t42=_this339.appHistoryManager.redo();_context36.next=6;return _this339.applyState(_t42);case 6:_this339.awaitHistoryChange=false;case 7:case"end":return _context36.stop();}}},_callee35);}));this.editor=t;this.appHistoryManager=new xm();}_createClass(du,[{key:"canUndo",get:function get(){return this.appHistoryManager.canUndo;}},{key:"canRedo",get:function get(){return this.appHistoryManager.canRedo;}},{key:"getHistoryState",value:function getHistoryState(){var _ref157;var t=ct(this.editor.adjustmentsToolStore.state);var e=ct(this.editor.filterToolStore.state);var r=this.editor.focusToolStore.getFocusStateForHistory();var o=ct(this.editor.overlayToolStore.state);var n=ct(this.editor.frameToolStore.state);var s=this.editor.brushToolStore.strokes;var a=this.editor.spriteStore.getSpriteHistoryState();var l=this.editor.transformToolStore.serializableState;return _ref157={},_defineProperty(_ref157,"adjustment",t),_defineProperty(_ref157,"filter",e),_defineProperty(_ref157,"focus",r),_defineProperty(_ref157,"overlay",o),_defineProperty(_ref157,"frame",n),_defineProperty(_ref157,"brush",s),_defineProperty(_ref157,"sprite",a),_defineProperty(_ref157,"transform",l),_ref157;}},{key:"addInitialSnapshot",value:function addInitialSnapshot(){var t=this.getHistoryState();this.appHistoryManager.addSnapshot({state:t,type:"add",description:"Initial State"});}},{key:"addSnapshot",value:function addSnapshot(t,e,r){var o;if(!t){o=this.getHistoryState();}else if(t.sprite||t.transform){o=_objectSpread(_objectSpread({},this.getHistoryState()),t);}else{o=t;}this.appHistoryManager.addSnapshot({state:o,type:e,description:r});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true;}}},{key:"applyState",value:function(){var _applyState=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee36(_ref158){var _this340=this;var t,e,_i6,_e29,r;return regeneratorRuntime.wrap(function _callee36$(_context37){while(1){switch(_context37.prev=_context37.next){case 0:t=_ref158.state;_context37.prev=1;if(!t){_context37.next=47;break;}e=Object.keys(t);_i6=0,_e29=e;case 5:if(!(_i6<_e29.length)){_context37.next=45;break;}r=_e29[_i6];_context37.t0=r;_context37.next=_context37.t0==="filter"?10:_context37.t0==="adjustment"?13:_context37.t0==="overlay"?16:_context37.t0==="frame"?19:_context37.t0==="focus"?22:_context37.t0==="brush"?25:_context37.t0==="sprite"?28:_context37.t0==="transform"?31:41;break;case 10:_context37.next=12;return this.editor.filterToolStore.updateStateFromHistory(t[r]);case 12:return _context37.abrupt("break",42);case 13:_context37.next=15;return this.editor.adjustmentsToolStore.updateStateFromHistory(t[r]);case 15:return _context37.abrupt("break",42);case 16:_context37.next=18;return this.editor.overlayToolStore.updateStateFromHistory(t[r]);case 18:return _context37.abrupt("break",42);case 19:_context37.next=21;return this.editor.frameToolStore.updateStateFromHistory(t[r]);case 21:return _context37.abrupt("break",42);case 22:_context37.next=24;return this.editor.focusToolStore.updateStateFromHistory(t[r],this.editor.canvasStore.sizeVector);case 24:return _context37.abrupt("break",42);case 25:_context37.next=27;return this.editor.brushToolStore.updateStateFromHistory(t[r]);case 27:return _context37.abrupt("break",42);case 28:_context37.next=30;return this.editor.spriteStore.updateStateFromHistory(t[r]);case 30:return _context37.abrupt("break",42);case 31:this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(t[r]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();_context37.next=40;return this.editor.wait();case 40:return _context37.abrupt("break",42);case 41:return _context37.abrupt("break",42);case 42:_i6++;_context37.next=5;break;case 45:_context37.next=47;return this.editor.renderPromise();case 47:_context37.next=53;break;case 49:_context37.prev=49;_context37.t1=_context37["catch"](1);console.error(_context37.t1);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:_context37.t1,handleConfirm:function handleConfirm(){_this340.applyState({state:t});}});case 53:case"end":return _context37.stop();}}},_callee36,this,[[1,49]]);}));function applyState(_x35){return _applyState.apply(this,arguments);}return applyState;}()},{key:"isDirty",value:function isDirty(){return this.appHistoryManager.snapshots.length>1;}},{key:"reset",value:function reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false;}},{key:"getCurrentSpritesState",value:function getCurrentSpritesState(){var t,e;return(e=(t=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:t.state)==null?void 0:e.sprite;}}]);return du;}();f([C],du.prototype,"undo",2);f([C],du.prototype,"redo",2);f([S],du.prototype,"canUndo",1);f([S],du.prototype,"canRedo",1);});var Zlt,jH,Qlt,$k;var $H=d(function(){Zlt=function Zlt(i,t){return new Promise(function(e,r){var o=new XMLHttpRequest();o.onload=function(){var n=new FileReader();n.onloadend=function(){if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){e(n.result);}else{r(new Error("The image could not be loaded from ".concat(i)));}};n.onerror=function(s){r(s);};n.readAsDataURL(o.response);};o.open("GET",i);o.responseType="blob";o.withCredentials=t==="use-credentials";o.send();});};jH=function jH(i,t){return new Promise(function(e,r){var o=new Image();o.onload=function(){e(o);};o.onerror=function(){r(new Error("Failed to load image with src:".concat(i)));};o.crossOrigin=t;o.src=i;});};Qlt=function Qlt(i,t){return new Promise(function(e,r){Zlt(i,t).then(function(o){var n=new Image();n.addEventListener("load",function(){e(n);});n.src=o;})["catch"](function(){jH(i,t).then(function(o){return e(o);})["catch"](function(o){r(o);});});});};$k=/*#__PURE__*/function(){var _ref160=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee37(_ref159){var i,t,_ref159$crossOrigin,e;return regeneratorRuntime.wrap(function _callee37$(_context38){while(1){switch(_context38.prev=_context38.next){case 0:i=_ref159.url,t=_ref159.image,_ref159$crossOrigin=_ref159.crossOrigin,e=_ref159$crossOrigin===void 0?"anonymous":_ref159$crossOrigin;_context38.prev=1;if(!(t&&t.src&&t.src.substr(0,5)==="data:"||t&&t.src&&t.src.includes(".svg"))){_context38.next=4;break;}return _context38.abrupt("return",t);case 4:if(!(typeof i==="string"&&i.substr(0,5)==="data:"||typeof i==="string"&&i.includes(".svg"))){_context38.next=6;break;}return _context38.abrupt("return",jH(i,e));case 6:return _context38.abrupt("return",Qlt(i||t.src,e));case 9:_context38.prev=9;_context38.t0=_context38["catch"](1);throw new Error(_context38.t0);case 12:case"end":return _context38.stop();}}},_callee37,null,[[1,9]]);}));return function $k(_x36){return _ref160.apply(this,arguments);};}();});var tct,hr;var hv=d(function(){Tt();R();U();$H();tct={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};hr=/*#__PURE__*/function(){function hr(t){var _this341=this;_classCallCheck(this,hr);this.setImage=/*#__PURE__*/function(){var _ref161=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee38(t){var e;return regeneratorRuntime.wrap(function _callee38$(_context39){while(1){switch(_context39.prev=_context39.next){case 0:_context39.prev=0;e=_this341.editor.configStore.config.engine.crossOrigin;if(!(typeof t==="string"&&!t.trim()||t===void 0||t===null)){_context39.next=6;break;}_this341.state.image=null;_context39.next=16;break;case 6:if(!(typeof t==="string")){_context39.next=12;break;}_context39.next=9;return $k({url:cn(t)?t:_this341.editor.assetProvider.getPath(t),crossOrigin:e});case 9:_this341.state.image=_context39.sent;_context39.next=16;break;case 12:if(!(t instanceof HTMLImageElement)){_context39.next=16;break;}_context39.next=15;return $k({image:t,crossOrigin:e});case 15:_this341.state.image=_context39.sent;case 16:if(_this341.isWebcam){_this341.state.isWebcam=false;}_context39.next=22;break;case 19:_context39.prev=19;_context39.t0=_context39["catch"](0);throw new Error(_context39.t0);case 22:case"end":return _context39.stop();}}},_callee38,null,[[0,19]]);}));return function(_x37){return _ref161.apply(this,arguments);};}();this.setImageLoadedToEngine=function(t){_this341.state.imageLoadedToEngine=t;};this.newImage=function(t){_this341.editor.init(t);};this.dispose=function(){_this341.state=null;_this341.editor=null;};this.editor=t;this.state=Q(tct);}_createClass(hr,[{key:"selectTool",value:function selectTool(t){var r,o,n;var e=this.editor.configStore.licenseChecker;if(this.state.tool!==t&&(e==null?void 0:e.isToolAllowed(t))&&(this.image||t==="library"||t==="customTool")){if(this.editor.configStore.isLayoutAdvanced){var s=(n=(o=(r=this.editor.configStore.state.config["customTool"])==null?void 0:r.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(t==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s;}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width;}}}this.editor.onToolChange(this.state.tool,t);this.state.tool=t;this.editor.configStore.events.onToolChanged(t);switch(t){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect();}else{this.editor.spriteStore.textToolStore.loadFonts();}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect();}break;case"brush":{this.editor.brushToolStore.initSize();break;}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break;}}}},{key:"selectWebcam",value:function selectWebcam(t){this.state.isWebcam=t;}},{key:"webcamLabel",get:function get(){return this.editor.libraryStore.locale.controls.buttonWebcamClose;}},{key:"tool",get:function get(){return this.state.tool;}},{key:"isWebcam",get:function get(){return this.state.isWebcam;}},{key:"image",get:function get(){return this.state.image;}},{key:"imageLoadedToEngine",get:function get(){return this.state.imageLoadedToEngine;}}]);return hr;}();f([C],hr.prototype,"selectTool",1);f([C],hr.prototype,"selectWebcam",1);f([C],hr.prototype,"setImage",2);f([C],hr.prototype,"setImageLoadedToEngine",2);f([C],hr.prototype,"newImage",2);f([C],hr.prototype,"dispose",2);f([S],hr.prototype,"webcamLabel",1);f([S],hr.prototype,"tool",1);f([S],hr.prototype,"isWebcam",1);f([S],hr.prototype,"image",1);f([S],hr.prototype,"imageLoadedToEngine",1);});var ect,Kk,_Xk,Oi;var fv=d(function(){Tt();R();U();ect={height:150,width:150};Kk={height:0,width:0};_Xk=/*#__PURE__*/function(){function Xk(t){var _this342=this;_classCallCheck(this,Xk);this.canvasClickDisabled=Q.box(false);this.resizeCanvas=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var e=_this342.editor.activeStore.tool;var r=t==="transform"||!t&&e==="transform";var _this342$editor$confi=_this342.editor.configStore,o=_this342$editor$confi.isLayoutAdvanced,n=_this342$editor$confi.measurements;var s=_this342.editor.canvasStore.storedSize;var a=0;if(!o&&r){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(t==="transform"&&e==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4;}}_this342.setCanvasSize({width:s.width,height:s.height+a});};this.setCanvasSize=function(t){_this342.state.canvasSize=t;};this.dispose=function(){_this342.state=null;_this342.canvas=null;_this342.canvasClickDisabled=null;_this342.editor=null;};this.editor=t;this.state=Q(_Xk.initialState);}_createClass(Xk,[{key:"setCanvasElement",value:function setCanvasElement(t){this.canvas=t;this.editor.engineMediator.preview.createPreview(t);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image);}}},{key:"saveDimensions",value:function saveDimensions(_ref162){var t=_ref162.height,e=_ref162.width,r=_ref162.render;var o=this.editor.activeStore.imageLoadedToEngine;if(t>Kk.height&&e>Kk.width){this.state.storedSize={width:e,height:t};if(this.state.canvasSize.height===0){this.state.canvasSize={width:e,height:t};}if(r&&o){this.editor.resize();}}}},{key:"disableCanvasClick",value:function disableCanvasClick(){this.canvasClickDisabled.set(true);}},{key:"enableCanvasClick",value:function enableCanvasClick(){this.canvasClickDisabled.set(false);}},{key:"isCanvasClickable",get:function get(){return!this.canvasClickDisabled.get();}},{key:"canvasSize",get:function get(){return this.state.canvasSize;}},{key:"storedSize",get:function get(){return this.state.storedSize;}},{key:"sizeVector",get:function get(){return O.fromSize(this.state.canvasSize);}},{key:"sizeVectorMagnitude",get:function get(){return this.sizeVector.magnitude;}},{key:"getContainersAtPreviewPoint",value:function getContainersAtPreviewPoint(t){var _this343=this;var e=this.editor.engine.getContainersAtPreviewPoint(t,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(function(r){return r.getID();}).filter(function(r){return r!==_this343.editor.engineMediator.image.getImgageContainerId();});this.editor.spriteStore.onCanvasClick(e);}}]);return Xk;}();Oi=_Xk;Oi.initialState={canvasSize:Kk,storedSize:ect};f([C],Oi.prototype,"setCanvasElement",1);f([C],Oi.prototype,"saveDimensions",1);f([C],Oi.prototype,"resizeCanvas",2);f([C],Oi.prototype,"disableCanvasClick",1);f([C],Oi.prototype,"enableCanvasClick",1);f([C],Oi.prototype,"setCanvasSize",2);f([C],Oi.prototype,"dispose",2);f([S],Oi.prototype,"isCanvasClickable",1);f([S],Oi.prototype,"canvasSize",1);f([S],Oi.prototype,"storedSize",1);f([S],Oi.prototype,"sizeVector",1);f([S],Oi.prototype,"sizeVectorMagnitude",1);});var ict,Wr;var gv=d(function(){Tt();R();ict={type:null,identifier:null,isVisible:false,error:""};Wr=/*#__PURE__*/function(){function Wr(t){var _this344=this;_classCallCheck(this,Wr);this.showActionModal=function(_ref163){var t=_ref163.type,e=_ref163.identifier,r=_ref163.error,o=_ref163.handleConfirm,n=_ref163.handleDismiss;_this344.resetHandlers();_this344.state.isVisible=true;_this344.state.identifier=e;_this344.state.type=t;_this344.state.error=r||"";_this344.handleConfirm=o;_this344.handleDismiss=n;};this.hideModal=function(){_this344.state.isVisible=false;_this344.state.type=null;_this344.state.error="";_this344.state.identifier=null;_this344.resetHandlers();};this.dispose=function(){_this344.state=null;_this344.configStore=null;};this.resetHandlers=function(){_this344.handleConfirm=null;_this344.handleDismiss=null;};this.configStore=t.configStore;this.state=Q(ict);}_createClass(Wr,[{key:"showInfoModal",value:function showInfoModal(t){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=t;this.state.error="";}},{key:"showTextEditModal",value:function showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error="";}},{key:"modalProps",get:function get(){var t=this.state.isVisible;var e=this.getModalLocale();if(e){var r=e.bodyLabel,o=e.headerLabel,n=e.buttonYes,s=e.buttonNo;return{headerLabel:o,bodyLabel:r,confirmLabel:n,dismissLabel:s,isVisible:t,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss};}return{isVisible:false};}},{key:"isVisible",get:function get(){return this.state.isVisible;}},{key:"type",get:function get(){return this.state.type;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"positionOffset",get:function get(){var _this$configStore=this.configStore,t=_this$configStore.isLayoutAdvanced,_this$configStore$mea=_this$configStore.measurements,e=_this$configStore$mea.basicCanvasOffset,r=_this$configStore$mea.advancedUIToolControlBar,o=_this$configStore$mea.advancedUIToolbar,n=_this$configStore.isOrderDefault;var s=(r.width+o.width)*(!n?-1:1);var a=e;return t?{x:s/2,y:0}:{x:0,y:-a};}},{key:"getModalLocale",value:function getModalLocale(){var _this$state6=this.state,t=_this$state6.identifier,e=_this$state6.error,r=_this$state6.type;var o=this.configStore.locale;if(!r||!t||r==="textEdit")return null;if(r&&t&&o["".concat(r,"Modals")]&&o["".concat(r,"Modals")][t]){var n=o["".concat(r,"Modals")][t];var s=n.body;if(s&&_typeof(e)==="object"){Object.keys(e).forEach(function(l){s=s.replace("${".concat(l,"}"),e[l]);});}else if(s){s=s.replace("${error}",e);}var a=n.heading;if(r==="error"||r==="warning"){var l={error:o.common.error,warning:o.common.warning};var c=r==="error"?l.error:l.warning;a="".concat(c).concat(n.headingDelimiter||""," ").concat(n.header||"");}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo};}return null;}}]);return Wr;}();f([C],Wr.prototype,"showActionModal",2);f([C],Wr.prototype,"showInfoModal",1);f([C],Wr.prototype,"showTextEditModal",1);f([C],Wr.prototype,"hideModal",2);f([C],Wr.prototype,"dispose",2);f([S],Wr.prototype,"modalProps",1);f([S],Wr.prototype,"isVisible",1);f([S],Wr.prototype,"type",1);f([S],Wr.prototype,"identifier",1);f([S],Wr.prototype,"positionOffset",1);});var ti;var bv=d(function(){Tt();U();ti=/*#__PURE__*/function(){function ti(t){var _this345=this;_classCallCheck(this,ti);this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(function(t){return t/100;});this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this["in"]=function(){if(_this345.canZoomIn){_this345.state.scaleIndex+=1;_this345.scaleRender();}};this.out=function(){if(_this345.canZoomOut){_this345.state.scaleIndex-=1;var _this345$checkOffset=_this345.checkOffset({x:0,y:0}),_t43=_this345$checkOffset.maxOffsetX,e=_this345$checkOffset.maxOffsetY;if(_this345.state.scaleIndex===_this345.defaultIndex){_this345.offset.y=e;}if(_this345.state.scaleIndex===_this345.defaultIndex){_this345.offset.x=_t43;}_this345.savePosition();_this345.scaleRender();}};this.setOffset=function(t){var _this345$checkOffset2=_this345.checkOffset(t),e=_this345$checkOffset2.canDragX,r=_this345$checkOffset2.canDragY;if(e){_this345.offset.x=t.x;}if(r){_this345.offset.y=t.y;}_this345.scaleRender();};this.editor=t;}_createClass(ti,[{key:"setInitialTransform",value:function setInitialTransform(){var _this346=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=Eo();var r=this.editor.configStore.config.scaleImageToFit;var o=this.editor.engineMediator.preview.transform;Ve(function(){var n=Math.abs(t||o.scale.x);_this346.setDefaultScale(r?n:Math.min(1*e,n));_this346.setPosition(o.position);});}},{key:"resetScale",value:function resetScale(){this.state.scaleIndex=-1;}},{key:"resetPosition",value:function resetPosition(){var _this$editor$canvasSt3=this.editor.canvasStore.canvas,t=_this$editor$canvasSt3.width,e=_this$editor$canvasSt3.height;this.setPosition({x:t/2,y:e/2});}},{key:"resetOffset",value:function resetOffset(){this.offset={x:0,y:0};}},{key:"setPosition",value:function setPosition(t){this.state.position.x=t.x;this.state.position.y=t.y;}},{key:"savePosition",value:function savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0};}},{key:"setDefaultScale",value:function setDefaultScale(t){var _this347=this;if(this.defaultScale!==1){var r=this.SCALE_LEVELS.findIndex(function(o){return o===_this347.defaultScale;});if(r!==-1){this.SCALE_LEVELS=[].concat(_toConsumableArray(this.SCALE_LEVELS.slice(0,r)),_toConsumableArray(this.SCALE_LEVELS.slice(r+1)));}}var e=this.SCALE_LEVELS.findIndex(function(r){return r===t;});if(e!==-1){this.state.scaleIndex=e;}else{var _r19=this.SCALE_LEVELS.findIndex(function(o,n){if(n===0){return t0;var g=u>0;var x=m-a;var v=p-l;return{canDragX:x<0,canDragY:v<0,maxOffsetX:h?-x:x,maxOffsetY:g?-v:v};}},{key:"calculateScale",value:function calculateScale(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.previewSize;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.defaultScale;var o=e.width,n=e.height;var s=new O({x:o,y:n});var a=new O(Math.abs(s.x*Math.cos(t))+Math.abs(s.y*Math.sin(t)),Math.abs(s.x*Math.sin(t))+Math.abs(s.y*Math.cos(t)));var l=s.subtract(a).divide(2).multiply(r).abs;if(l.y>l.x){return l.y*2/s.y+r;}return l.x*2/s.x+r;}},{key:"defaultIndex",get:function get(){var _this348=this;return this.SCALE_LEVELS.findIndex(function(t){return t===_this348.defaultScale;});}},{key:"getPositionWithOffset",value:function getPositionWithOffset(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.offset;var e=this.position;return{x:e.x-t.x,y:e.y-t.y};}},{key:"scaleRender",value:function scaleRender(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.editor.scale.getPositionWithOffset();var r=t?this.defaultScale:this.scale;var o={x:r,y:r};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(e);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:e,rotation:0});if(!t){this.editor.render();}}},{key:"scale",get:function get(){var t=this.state.scaleIndex;return t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;}},{key:"zoomLevel",get:function get(){var t=Eo();return(this.scale/t*100).toFixed(1);}},{key:"canDrag",get:function get(){return this.defaultScalethis.defaultIndex;}return this.state.scaleIndex!==0;}},{key:"canZoomIn",get:function get(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex;}},{key:"position",get:function get(){return this.state.position;}},{key:"scaledSize",get:function get(){var t=this.state.scaleIndex;var e=t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;var r=this.previewSize;return{width:r.width*e/this.defaultScale,height:r.height*e/this.defaultScale};}},{key:"previewSize",get:function get(){return this.editor.getPreviewSize();}}]);return ti;}();f([Q],ti.prototype,"state",2);f([C],ti.prototype,"in",2);f([C],ti.prototype,"out",2);f([C],ti.prototype,"setInitialTransform",1);f([C],ti.prototype,"resetScale",1);f([C],ti.prototype,"resetPosition",1);f([C],ti.prototype,"setPosition",1);f([C],ti.prototype,"savePosition",1);f([C],ti.prototype,"setDefaultScale",1);f([C],ti.prototype,"setScaleToDefault",1);f([S],ti.prototype,"scale",1);f([S],ti.prototype,"zoomLevel",1);f([S],ti.prototype,"canDrag",1);f([S],ti.prototype,"canZoomOut",1);f([S],ti.prototype,"canZoomIn",1);f([S],ti.prototype,"position",1);f([S],ti.prototype,"scaledSize",1);});var KH,rct,_Gn,ze;var qk=d(function(){Tt();U();KH=[[0,0],[0,1],[1,0],[1,1]];rct=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];_Gn=/*#__PURE__*/function(){function Gn(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"center";var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:false;_classCallCheck(this,Gn);this.considerRotation=true;this.considerFlip=true;this.store=e;this.m=r==="center"?_Gn.movePivotTo([.5,.5]):KH;this.considerRotation=o;this.considerFlip=n;this.configStore=t.configStore;}_createClass(Gn,[{key:"position",get:function get(){return this.store.position;}},{key:"size",get:function get(){return this.store.size;}},{key:"rotation",get:function get(){return this.considerRotation?this.store.rotationWRTOutputRotation:0;}},{key:"flipHorizontally",get:function get(){return this.considerFlip?this.store.isFlippedHorizontal:false;}},{key:"flipVertically",get:function get(){return this.considerFlip?this.store.isFlippedVertical:false;}},{key:"flipCenter",get:function get(){return this.considerFlip?this.store.flipCenter:null;}},{key:"handleOrigin",value:function handleOrigin(t,e,r){var o=_Gn.getFlippedEdgeIndex(t,e,r);var n=this.m[o][0]*this.size.width;var s=this.m[o][1]*this.size.height;return{width:n,height:s};}},{key:"leftTop",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(0,e,r);return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"leftBottom",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(1,e,r);return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"rightTop",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(2,e,r);return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"rightBottom",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(3,e,r);return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"leftBottomHandle",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(1,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"rightBottomHandle",get:function get(){var t=this.position,e=this.flipHorizontally,r=this.flipVertically;var o=this.handleOrigin(3,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return _Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t);}},{key:"leftMid",get:function get(){var t=new O(this.leftTop);var e=new O(this.leftBottom);return t.add(e).divide(2);}},{key:"rightMid",get:function get(){var t=new O(this.rightTop);var e=new O(this.rightBottom);return t.add(e).divide(2);}}],[{key:"getFlippedEdgeIndex",value:function getFlippedEdgeIndex(t,e,r){return rct[(e?1:0)+(r?2:0)][t];}},{key:"movePivotTo",value:function movePivotTo(t){return KH.map(function(e){return[e[0]-t[0],e[1]-t[1]];});}}]);return Gn;}();ze=_Gn;ze.coordinatesWithRotation=function(_ref164,r,o,n,s,a){var t=_ref164.width,e=_ref164.height;var l=t*Math.cos(r)-e*Math.sin(r)+a.x;var c=t*Math.sin(r)+e*Math.cos(r)+a.y;if(o){l=s.x*2-l;}if(n){c=s.y*2-c;}return new O({x:l,y:c}).rounded;};f([S],ze.prototype,"position",1);f([S],ze.prototype,"size",1);f([S],ze.prototype,"rotation",1);f([S],ze.prototype,"flipHorizontally",1);f([S],ze.prototype,"flipVertically",1);f([S],ze.prototype,"flipCenter",1);f([S],ze.prototype,"leftTop",1);f([S],ze.prototype,"leftBottom",1);f([S],ze.prototype,"rightTop",1);f([S],ze.prototype,"rightBottom",1);f([S],ze.prototype,"leftBottomHandle",1);f([S],ze.prototype,"rightBottomHandle",1);f([S],ze.prototype,"leftMid",1);f([S],ze.prototype,"rightMid",1);});var Yk=d(function(){dv();Yh();Qh();Jh();jk();Gk();Uk();Hk();Wk();pv();hv();fv();gv();bv();qk();});var Ft;var XH=d(function(){Tt();U();Dk();Ft=/*#__PURE__*/function(){function Ft(t,e){var _this349=this;_classCallCheck(this,Ft);this.minCropSize=0;this.id="";this.dispose=function(){_this349.state=null;_this349.defaults=null;_this349.configStore=null;};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:Q.map({})};this.configStore=t.configStore;this.id=At();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=e;}_createClass(Ft,[{key:"changeIdentifier",value:function changeIdentifier(t){this.state.identifier=t;var e=this.state.cropState.get("".concat(this.id,"-").concat(t));if(!e){this.state.cropState.set("".concat(this.id,"-").concat(t),_objectSpread({},jo));}}},{key:"changeRatio",value:function changeRatio(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),_objectSpread(_objectSpread({},e),{},{ratio:t}));}}},{key:"changeSize",value:function changeSize(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){if(t.width&&t.width>0){e.size.width=Math.round(t.width);}if(t.height&&t.height>0){e.size.height=Math.round(t.height);}this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}},{key:"changeHeight",value:function changeHeight(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){if(t){e.size.height=Math.round(t);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}}},{key:"changeWidth",value:function changeWidth(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){if(t){e.size.width=Math.round(t);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}}},{key:"changePositionX",value:function changePositionX(t,e){var r=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(r&&t<=e-this.minCropSize&&t>=0){r.position.x=Math.round(t);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),r);return true;}return false;}},{key:"changePositionY",value:function changePositionY(t,e){var r=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(r&&t<=e-this.minCropSize&&t>=0){r.position.y=Math.round(t);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),r);return true;}return false;}},{key:"changePosition",value:function changePosition(t,e){var r=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(r){if(t.x<=e.width-this.minCropSize&&t.x>=0&&t.y<=e.height-this.minCropSize&&t.y>=0){r.position.x=Math.round(t.x);r.position.y=Math.round(t.y);this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),r);return true;}}return false;}},{key:"changeLockResolution",value:function changeLockResolution(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){e.lockResolution=t!==void 0?t:!e.lockResolution;this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}},{key:"changeForceDimensions",value:function changeForceDimensions(t){var e=this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));if(e){e.forceDimensions=t;this.state.cropState.set("".concat(this.id,"-").concat(this.identifier),e);}}},{key:"clearState",value:function clearState(){var _this350=this;this.state.cropState.forEach(function(t,e){return e.startsWith(_this350.id)&&_this350.state.cropState["delete"](e);});}},{key:"setRotation",value:function setRotation(t){this.state.rotationInDegrees=t;}},{key:"resetRotation",value:function resetRotation(){this.state.rotationInDegrees=0;}},{key:"resetOutputRotation",value:function resetOutputRotation(){this.state.outputRotation=0;}},{key:"resetFlip",value:function resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false;}},{key:"updateFlip",value:function updateFlip(_ref165){var t=_ref165.flipHorizontally,e=_ref165.flipVertically;this.state.flipHorizontally=t;this.state.flipVertically=e;}},{key:"setOutputRotation",value:function setOutputRotation(t){this.state.outputRotation=t;}},{key:"flipHorizontally",value:function flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally;}},{key:"flipVertically",value:function flipVertically(){this.state.flipVertically=!this.state.flipVertically;}},{key:"flipCenter",get:function get(){var _this$defaults$maxCro=this.defaults.maxCropMaskSize,t=_this$defaults$maxCro.width,e=_this$defaults$maxCro.height;return new O(t/2,e/2);}},{key:"isFlippedHorizontal",get:function get(){return this.state.flipHorizontally;}},{key:"isFlippedVertical",get:function get(){return this.state.flipVertically;}},{key:"identifier",get:function get(){return this.state.identifier;}},{key:"height",get:function get(){return this.selectedCrop?this.selectedCrop.size.height:jo.size.height;}},{key:"width",get:function get(){return this.selectedCrop?this.selectedCrop.size.width:jo.size.width;}},{key:"position",get:function get(){return this.selectedCrop?this.selectedCrop.position:jo.position;}},{key:"ratio",get:function get(){return this.selectedCrop?this.selectedCrop.ratio:jo.ratio;}},{key:"size",get:function get(){return this.selectedCrop?this.selectedCrop.size:jo.size;}},{key:"x",get:function get(){return this.selectedCrop?this.selectedCrop.position.x:jo.position.x;}},{key:"y",get:function get(){return this.selectedCrop?this.selectedCrop.position.y:jo.position.y;}},{key:"lockResolution",get:function get(){return this.selectedCrop?this.selectedCrop.lockResolution:jo.lockResolution;}},{key:"forceDimensions",get:function get(){return this.selectedCrop?this.selectedCrop.forceDimensions:jo.forceDimensions;}},{key:"selectedCrop",get:function get(){return this.state.cropState.get("".concat(this.id,"-").concat(this.identifier));}},{key:"rotationInDegrees",get:function get(){return this.state.rotationInDegrees;}},{key:"outputRotation",get:function get(){return this.state.outputRotation;}}]);return Ft;}();f([Q],Ft.prototype,"state",2);f([C],Ft.prototype,"changeIdentifier",1);f([C],Ft.prototype,"changeRatio",1);f([C],Ft.prototype,"changeSize",1);f([C],Ft.prototype,"changeHeight",1);f([C],Ft.prototype,"changeWidth",1);f([C],Ft.prototype,"changePositionX",1);f([C],Ft.prototype,"changePositionY",1);f([C],Ft.prototype,"changePosition",1);f([C],Ft.prototype,"changeLockResolution",1);f([C],Ft.prototype,"changeForceDimensions",1);f([C],Ft.prototype,"clearState",1);f([C],Ft.prototype,"setRotation",1);f([C],Ft.prototype,"resetRotation",1);f([C],Ft.prototype,"resetOutputRotation",1);f([C],Ft.prototype,"resetFlip",1);f([C],Ft.prototype,"updateFlip",1);f([C],Ft.prototype,"setOutputRotation",1);f([C],Ft.prototype,"flipHorizontally",1);f([C],Ft.prototype,"flipVertically",1);f([C],Ft.prototype,"dispose",2);f([S],Ft.prototype,"flipCenter",1);f([S],Ft.prototype,"isFlippedHorizontal",1);f([S],Ft.prototype,"isFlippedVertical",1);f([S],Ft.prototype,"identifier",1);f([S],Ft.prototype,"height",1);f([S],Ft.prototype,"width",1);f([S],Ft.prototype,"position",1);f([S],Ft.prototype,"ratio",1);f([S],Ft.prototype,"size",1);f([S],Ft.prototype,"x",1);f([S],Ft.prototype,"y",1);f([S],Ft.prototype,"lockResolution",1);f([S],Ft.prototype,"forceDimensions",1);f([S],Ft.prototype,"selectedCrop",1);f([S],Ft.prototype,"rotationInDegrees",1);f([S],Ft.prototype,"outputRotation",1);});var Jk;var qH=d(function(){Tt();U();hm();Jk=/*#__PURE__*/function(){function Jk(t){var _this351=this;_classCallCheck(this,Jk);this.transforms={output:JSON.stringify(_re.IDENTITY),preview:JSON.stringify(_re.IDENTITY)};this.setFrameOpacity=function(t){_this351.frameOpacity=t;if(_this351.entered&&_this351.editor.frameToolStore.identifier!=="identity"){_this351.editor.frameToolStore.changeOpacity(0);}};this.setOverlayOpacity=function(t){_this351.overlayOpacity=t;if(_this351.entered&&_this351.editor.overlayToolStore.identifier!=="identity"){_this351.editor.overlayToolStore.changeOpacity(0);}};this.editor=t;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false;}_createClass(Jk,[{key:"onLeave",value:function onLeave(){var _this$transformToolSt=this.transformToolStore.rotateFlipState,t=_this$transformToolSt.flipHorizontally,e=_this$transformToolSt.flipVertically,r=_this$transformToolSt.rotation,o=_this$transformToolSt.outputRotation;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity);}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity);}this.editor.engine.setWatermarkOpacity(1);var n=this.editor.previewToWorld(new O(this.transformToolStore.leftTopRespectFlip).add(new O(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new O(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);var s=this.engineMediator.preview.container;var a=this.editor.outputContainer;a.setResolution(ct(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:e,flipHorizontally:t});var l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();var c=1;if(this.transformToolStore.lockResolution){var _this$transformToolSt2=this.transformToolStore,g=_this$transformToolSt2.cropMaskSize,x=_this$transformToolSt2.defaultImageSize;var v=this.transformToolStore.maxCropMaskSize;var b={height:g.height*x.height/v.height,width:g.width*x.width/v.width};c=b.width/this.transformToolStore.localOutputImageSize.width;}var u=Math.abs(l.x);var m=c/(u/this.transformToolStore.defaultScale);var p={x:m,y:m};var h=-(r-o);a.setTransform({scale:p,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls();}},{key:"resetTransforms",value:function resetTransforms(t){this.transforms=t;}},{key:"onEnter",value:function onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0);}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0);}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();var t=this.engineMediator.preview.container;var e=this.editor.outputContainer;var r=JSON.parse(this.transforms.preview);e.setResolution(ct(this.transformToolStore.defaultImageSize));t.setTransform(r);e.setTransform(JSON.parse(this.transforms.output));var o=r.scale;e.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(r);var _this$engineMediator$=this.engineMediator.preview.calculateTransform(),n=_this$engineMediator$.scale;this.editor.scale.setInitialTransform(n.x);}},{key:"rotateOutputContainer",value:function rotateOutputContainer(t){var _this352=this;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var _this$editor$engineMe=this.editor.engineMediator.image.container.getBounds(),r=_this$editor$engineMe.width,o=_this$editor$engineMe.height;var n=UA(t)?{width:o,height:r}:{width:r,height:o};this.editor.outputContainer.rotate(t,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());var s=this.transformToolStore.rotateFlipState.rotation;this.engineMediator.preview.updateTransform(s);Ve(function(){_this352.editor.scale.setInitialTransform();var a=_this352.getScaleWithFlip(s);_this352.engineMediator.preview.container.setScale(a);_this352.transformToolStore.setCropDefaults(true);_this352.transformToolStore.updateCropMask();});if(e){this.editor.render();}}},{key:"applyPreviewTransform",value:function applyPreviewTransform(){var _this$transformToolSt3=this.transformToolStore.rotateFlipState,t=_this$transformToolSt3.rotation,e=_this$transformToolSt3.flipHorizontally,r=_this$transformToolSt3.flipVertically;var o=this.editor.scale.getPositionWithOffset();var n=this.getScaleWithFlip();var s=t;if(e){s=pm(s);}if(r){s=pm(s);}var a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a);}},{key:"getScaleWithFlip",value:function getScaleWithFlip(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.transformToolStore.rotateFlipState.rotation;var _this$transformToolSt4=this.transformToolStore.rotateFlipState,e=_this$transformToolSt4.flipHorizontally,r=_this$transformToolSt4.flipVertically;var o=e?-1:1;var n=r?-1:1;var s=this.editor.scale.calculateScale(t);return{x:s*o,y:s*n};}},{key:"saveTransforms",value:function saveTransforms(){var t=JSON.stringify(this.engineMediator.preview.container.getTransform());var e=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:t,output:e};}},{key:"saveTransformsBasedOnFlip",value:function saveTransformsBasedOnFlip(){var t=this.engineMediator.preview.container.getTransform();var e=t.scale;var _this$editor$outputCo2=this.editor.outputContainer.getData(),r=_this$editor$outputCo2.flipVertically,o=_this$editor$outputCo2.flipHorizontally;var n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify(_objectSpread(_objectSpread({},t),{},{scale:{x:o?-e.x:e.x,y:r?-e.y:e.y}})),output:n};}},{key:"engineMediator",get:function get(){return this.editor.engineMediator;}},{key:"transformToolStore",get:function get(){return this.editor.transformToolStore;}}]);return Jk;}();});var Zk;var YH=d(function(){U();Zk=/*#__PURE__*/function(){function Zk(t){var _this353=this;_classCallCheck(this,Zk);this.store=t;this.initialState={};this.state={};this.dispose=function(){_this353.initialState=null;_this353.state=null;};}_createClass(Zk,[{key:"init",value:function init(){this.initialState=this.store.serializableState;this.state=_objectSpread({},this.initialState);}},{key:"trackChanges",value:function trackChanges(){this.state=this.store.serializableState;}},{key:"isEqual",value:function isEqual(){return(0,Ye["default"])(this.state,this.initialState);}},{key:"hasChanges",value:function hasChanges(){return!this.isEqual();}}]);return Zk;}();});var JH,_mu,tt;var Qk=d(function(){Tt();R();U();Yk();Zi();Nn();XH();qH();YH();JH="identity";_mu=/*#__PURE__*/function(){function mu(t){var _this354=this;_classCallCheck(this,mu);this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=Q.box(false);this.minCropSize=0;this.transformHistory=new Zk(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=function(t){if(!t.trim())return false;var e=_this354.editor.configStore.config.assetBaseUrl;var _e30=e,r=_e30.length;if(e[r-1]!=="/"){e+="/";}if("".concat(e,"transform")===t){return false;}var o=new Image();try{o.src=t;return true;}catch(n){return false;}};this.reset=function(){_this354.transformStore.resetRotation();_this354.transformStore.resetOutputRotation();_this354.transformStore.resetFlip();_this354.resetCrop();_this354.editor.spriteStore.correctTextFlip();_this354.editor.overlayToolStore.correctOverlayFlip();_this354.setDefaultAngle(0);var t=_this354.editor.outputContainer.getRotation();if(t!==0){_this354.engineMediator.output.applyNewImageTransform();}_this354.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});_this354.engineMediator.preview.updateTransform();_this354.editor.scale.setInitialTransform();_this354.setCropDefaults();_this354.applyInitialCrop();_this354.editor.render();_this354.trackChanges();};this.changeLocalOutputSize=function(t){_this354.localOutputSize.height=Math.round(t.height);_this354.localOutputSize.width=Math.round(t.width);_this354.editor.configStore.events.onCropDimensionsChanged({width:Math.round(t.width),height:Math.round(t.height)});};this.changeDefaultScale=function(t){_this354.defaults.scale=t;};this.changeLocalOutputHeight=function(t){_this354.localOutputSize.height=Math.round(t);};this.changeLocalOutputWidth=function(t){_this354.localOutputSize.width=Math.round(t);};this.changeLockResolution=function(){_this354.transformStore.changeLockResolution();_this354.trackChanges();};this.rotateClockwise=function(){var t=_this354.editor.outputContainer.getRotation();var e=_this354.isFlippedVertical?dS:mS;_this354.rotateOutputContainer(e(t));};this.rotateAntiClockwise=function(){var t=_this354.editor.outputContainer.getRotation();var e=_this354.isFlippedVertical?mS:dS;_this354.rotateOutputContainer(e(t));};this.flipHorizontally=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;_this354.transformStore.flipHorizontally();_this354.editor.spriteStore.reverseTextHorizontally(_this354.transformStore.isFlippedHorizontal);_this354.transformRender(t);if(t){_this354.trackChanges();}};this.flipVertically=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;_this354.transformStore.flipVertically();_this354.editor.spriteStore.reverseTextVertically(_this354.transformStore.isFlippedVertical);_this354.transformRender(t);if(t){_this354.trackChanges();}};this.applyDefaultCrop=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(_this354.identifier==="identity"){var _this354$getMatchingI=_this354.getMatchingItem(),_e31=_this354$getMatchingI.identifier;_this354.changeIdentifier(_e31,t);}};this.updateCropMask=function(){_this354.changeIdentifier(_this354.identifier,true);};this.onLeftTop=function(_ref166){var t=_ref166.x,e=_ref166.y;var r=_this354.getRatio();var o=_this354.rightBottom;var n=_this354.minCropMaskSize,s=_this354.maxCropMaskSize;var a=Math.min(Math.max(0,t),o.x-n.width);var l=Math.min(Math.max(0,e),o.y-n.height);var c=o.x-a;var u=o.y-l;var m={width:Math.max(_this354.minCropSize,Math.min(c,s.width-a)),height:Math.max(_this354.minCropSize,Math.min(u,s.height-l))};if(r==="*"){if(_this354.changePosition({x:a,y:l})){_this354.changeCropAndOutputSize(m);}}else{var p=_this354.proportionalSize(r,m);var h=new O(o).subtract({x:p.width,y:p.height});if(_this354.changePosition(h)){_this354.changeCropAndOutputSize(p,r);}}};this.onLeftBottom=function(_ref167){var t=_ref167.x,e=_ref167.y;var r=_this354.getRatio();var o=_this354.rightTop;var n=_this354.minCropMaskSize,s=_this354.maxCropMaskSize;var a=Math.min(Math.max(0,t),o.x-n.width);var l=Math.max(0,e,o.y+n.height);var c=o.x-a;var u=l-o.y;var m={width:Math.max(1,Math.min(c,s.width-a)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){if(_this354.changePositionX(a)){_this354.changeCropAndOutputSize(m);}}else{var p=_this354.proportionalSize(r,m);if(_this354.changePositionX(o.x-p.width)){_this354.changeCropAndOutputSize(p,r);}}};this.onRightTop=function(_ref168){var t=_ref168.x,e=_ref168.y;var r=_this354.getRatio();var o=_this354.leftBottom;var n=_this354.minCropMaskSize,s=_this354.maxCropMaskSize;var a=Math.max(0,t,o.x+n.width);var l=Math.min(Math.max(0,e),o.y-n.height);var c=a-o.x;var u=o.y-l;var m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-l))};if(r==="*"){if(_this354.changePositionY(l)){_this354.changeCropAndOutputSize(m);}}else{var p=_this354.proportionalSize(r,m);if(_this354.changePositionY(o.y-p.height)){_this354.changeCropAndOutputSize(p,r);}}};this.onRightBottom=function(_ref169){var t=_ref169.x,e=_ref169.y;var r=_this354.getRatio();var o=_this354.leftTop;var n=_this354.minCropMaskSize,s=_this354.maxCropMaskSize;var a=Math.max(0,t,o.x+n.width);var l=Math.max(0,e,o.y+n.height);var c=a-o.x;var u=l-o.y;var m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){_this354.changeCropAndOutputSize(m);}else{var p=_this354.proportionalSize(r,m);_this354.changeCropAndOutputSize(p,r);}};this.onPixelWidth=function(t){var e=JSON.stringify(ct(_this354.localOutputSize));var r=_this354.entityManager.items.find(function(n){return n.identifier===_this354.identifier;});var o=_this354.defaults.imageSize;if(r&&r.ratio){var _n10=t;var s=_this354.localOutputSize.height;var a=r.ratio;if(a==="*"&&_this354.lockResolution){a=_this354.localOutputSize.width/_this354.localOutputSize.height;}if(a==="*"&&!_this354.lockResolution){_n10=Math.max(Math.min(t,o.width),_this354.minCropSize);_this354.changeLocalOutputWidth(_n10);_this354.editor.configStore.events.onCropDimensionsChanged({width:Math.round(_n10),height:Math.round(s)});}else{var l=_mu.placeCropMask(a,o);_n10=Math.max(Math.min(_n10,l.width),_this354.minCropSize);s=_n10/a;_this354.changeLocalOutputSize({height:s,width:_n10});}if(!_this354.lockResolution){_this354.updatePreviewSizeWRTImageSize();}_this354.checkAndAddSnapshot(JSON.parse(e));return Math.round(_n10);}return t;};this.onPixelHeight=function(t){var e=JSON.stringify(ct(_this354.localOutputSize));var r=_this354.entityManager.items.find(function(n){return n.identifier===_this354.identifier;});var o=_this354.defaults.imageSize;if(r&&r.ratio){var _n11=t;var s=_this354.localOutputSize.width;var a=r.ratio;if(a==="*"&&_this354.lockResolution){a=_this354.localOutputSize.width/_this354.localOutputSize.height;}if(a==="*"&&!_this354.lockResolution){_n11=Math.max(Math.min(t,o.height),_this354.minCropSize);_this354.changeLocalOutputHeight(_n11);_this354.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(_n11)});}else{var l=_mu.placeCropMask(a,o);_n11=Math.max(Math.min(_n11,l.height),_this354.minCropSize);s=_n11*a;_this354.changeLocalOutputSize({height:_n11,width:s});}if(!_this354.lockResolution){_this354.updatePreviewSizeWRTImageSize();}_this354.checkAndAddSnapshot(JSON.parse(e));return Math.round(_n11);}return t;};this.dispose=function(){if(_this354.transformStore){_this354.transformStore.dispose();_this354.transformStore=null;}if(_this354.transformHistory){_this354.transformHistory.dispose();_this354.transformHistory=null;}_this354.editor=null;_this354.dragMode=null;_this354.selectedCategory=null;_this354.defaults=null;_this354.localOutputSize=null;_this354.rect=null;_this354.transformations=null;_this354.entityManager=null;};this.setFrameOpacity=function(t){_this354.transformations.setFrameOpacity(t);};this.setOverlayOpacity=function(t){_this354.transformations.setOverlayOpacity(t);};this.closestRatioReducer=function(t){return function(e,r){if(r===null)return-1;return Math.abs(t-e.ratio)r.dimensions.x*r.dimensions.y?-1:1;}return Math.abs(t-o)1&&arguments[1]!==undefined?arguments[1]:false;this.transformStore.changeIdentifier(t);var r=this.getCropMask(t,this.defaults.imageSize);if(r){this.transformStore.changeRatio(r.ratio);this.changeLocalOutputSize(r);this.updatePreviewSizeWRTImageSize();if(r.yChanged!==void 0){this.updateInitialCropMaskPosition(r.yChanged);}if(r.dimensions){this.changeLocalOutputSize({width:r.dimensions.x,height:r.dimensions.y});}if(e){this.trackChanges();}}}},{key:"setDragMode",value:function setDragMode(t){this.dragMode.set(t);}},{key:"getCropMask",value:function getCropMask(t,e){var r=this.getTransform(t);if(r){var o=r.ratio,n=r.forceDimensions,s=r.lockDimensions,_r$dimensions=r.dimensions,a=_r$dimensions===void 0?null:_r$dimensions;if(n){this.transformStore.changeForceDimensions(n);}if(s){this.transformStore.changeLockResolution(s);}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return _objectSpread(_objectSpread({},e),{},{yChanged:void 0,ratio:"*",dimensions:a});default:return _objectSpread(_objectSpread({},_mu.placeCropMask(r.ratio,e)),{},{ratio:r.ratio,dimensions:a});}}else{var _r$dimensions2=r.dimensions,l=_r$dimensions2.x,c=_r$dimensions2.y;return _objectSpread(_objectSpread({},_mu.placeCropMask(l/c,e)),{},{ratio:null,dimensions:a});}}return null;}},{key:"setCropDefaults",value:function setCropDefaults(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var e=this.editor.outputContainer.getResolution();this.setDefaultImageSize(e);var r=this.editor.getPreviewSize();var o=this.editor.engineMediator.preview.previewTransformWithoutDpr.position;this.setMaxCropSize(r);this.setDefaultCropPosition({x:o.x-r.width/2,y:o.y-r.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!t){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale;}}},{key:"setDefaultImageSize",value:function setDefaultImageSize(t){this.defaults.imageSize=_objectSpread({},ct(t));if(!this.lockResolution){this.localOutputSize=_objectSpread({},ct(t));}}},{key:"setMaxCropSize",value:function setMaxCropSize(t){this.defaults.maxCropMaskSize.height=t.height;this.defaults.maxCropMaskSize.width=t.width;}},{key:"setDefaultCropPosition",value:function setDefaultCropPosition(t){this.defaults.cropMaskPosition.x=t.x;this.defaults.cropMaskPosition.y=t.y;}},{key:"resetCrop",value:function resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity");}},{key:"toggleCategorySelection",value:function toggleCategorySelection(t){this.selectedCategory=this.selectedCategory===t?JH:t;}},{key:"pureReset",value:function pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();var t=JSON.stringify(this.engineMediator.preview.container.getTransform());var e=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:t,output:e});}},{key:"changePosition",value:function changePosition(t){return this.transformStore.changePosition(t,this.defaults.maxCropMaskSize);}},{key:"changePositionX",value:function changePositionX(t){return this.transformStore.changePositionX(t,this.defaults.maxCropMaskSize.width);}},{key:"changePositionY",value:function changePositionY(t){return this.transformStore.changePositionY(t,this.defaults.maxCropMaskSize.height);}},{key:"changeCropAndOutputSize",value:function changeCropAndOutputSize(_ref170,r){var t=_ref170.width,e=_ref170.height;var o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;this.transformStore.changeWidth(t);this.transformStore.changeHeight(e);if(!this.lockResolution){var _this$defaults$maxCro2=this.defaults.maxCropMaskSize,n=_this$defaults$maxCro2.height,s=_this$defaults$maxCro2.width;var _this$defaults$imageS=this.defaults.imageSize,a=_this$defaults$imageS.height,l=_this$defaults$imageS.width;var c=a/n*e;var u=l/s*t;if(r){c=u/r;}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(u),height:Math.round(c)});}if(e>=this.minCropSize){this.changeLocalOutputHeight(c);}if(t>=this.minCropSize){this.changeLocalOutputWidth(u);}}}},{key:"transformRender",value:function transformRender(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.transformations.applyPreviewTransform();if(t){this.editor.render();}}},{key:"addSnapshot",value:function addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot(_defineProperty({},"transform",this.serializableState),"edit","Transform edit");}},{key:"trackChanges",value:function trackChanges(){this.transformHistory.trackChanges();}},{key:"serializableState",get:function get(){var _this$rotateFlipState=this.rotateFlipState,t=_this$rotateFlipState.flipHorizontally,e=_this$rotateFlipState.flipVertically;var r=this.identifier,o=this.rotationInDegrees;var n=Gl(o);var s=uS(xb(this.editor.engineMediator.output.container.getRotation())+o);var _this$convertUIToOper=this.convertUIToOperationOptions(n,s),a=_this$convertUIToOper.start,l=_this$convertUIToOper.end;return{flipHorizontally:t,flipVertically:e,rotation:n,start:a,end:l,identifier:r,outputRotation:s};}},{key:"getStartEndForOperation",value:function getStartEndForOperation(t){var e=this.leftTop,r=this.rightBottom,o=this.maxCropMaskSize;var n=e.y;var s=e.x;var a=r.x;var l=r.y;switch(t){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}};}}},{key:"getStartEndForUI",value:function getStartEndForUI(t,e,r){var o=this.maxCropMaskSize;var n=e.y;var s=e.x;var a=r.x;var l=r.y;switch(t){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}};}}},{key:"convertOperationOptionsToUI",value:function convertOperationOptionsToUI(_ref171){var t=_ref171.start,e=_ref171.end,r=_ref171.rotation,o=_ref171.outputRotation;var n=o===90||o===270;var s=n?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);var a=Math.cos(r);var l=Math.sin(r);var c=this.calculateScale(r);var u=new O(Math.min(t.x,e.x),Math.min(t.y,e.y));var m=new O(Math.max(t.x,e.x),Math.max(t.y,e.y));var p=m.subtract(u).divide(2);var h=u.add(p).multiply(s);var g=h.subtract(s.multiply(.5));var x=new O(g.x*a-g.y*l,g.x*l+g.y*a).multiply(c);var v=s.multiply(.5).add(x);var b=v.divide(s);var T=b.subtract(p.multiply(c));var k=b.add(p.multiply(c));var E=n?O.fromSize(this.maxCropMaskSize).swapped:O.fromSize(this.maxCropMaskSize);var A=T.multiply(E);var I=k.multiply(E);var _this$getStartEndForU=this.getStartEndForUI(o,A,I),F=_this$getStartEndForU.leftTop,Z=_this$getStartEndForU.rightBottom;return{start:new O(F),end:new O(Z)};}},{key:"convertUIToOperationOptions",value:function convertUIToOperationOptions(t,e){var r=e===90||e===270;var o=r?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);var n=r?O.fromSize(this.maxCropMaskSize).swapped:O.fromSize(this.maxCropMaskSize);var s=Math.cos(-t);var a=Math.sin(-t);var l=this.calculateScale(t,r);var _this$getStartEndForO=this.getStartEndForOperation(e),c=_this$getStartEndForO.leftTop,u=_this$getStartEndForO.rightBottom;var m=new O(c).divide(n);var p=new O(u).divide(n);var h=p.subtract(m).divide(2);var g=m.add(h).multiply(o);var x=g.subtract(o.multiply(.5));var v=new O(x.x*s-x.y*a,x.x*a+x.y*s).divide(l);var b=o.multiply(.5).add(v);var T=b.divide(o);var k=T.subtract(h.divide(l));var E=T.add(h.divide(l));return{start:k,end:E};}},{key:"calculateScale",value:function calculateScale(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r=e?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);var o=new O(Math.abs(r.x*Math.cos(t))+Math.abs(r.y*Math.sin(t)),Math.abs(r.x*Math.sin(t))+Math.abs(r.y*Math.cos(t)));var n=r.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/r.y+1:n.x*2/r.x+1;}},{key:"updateStateFromSerialization",value:function updateStateFromSerialization(t){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform();}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();var e=Math.round(xb(t.rotation));this.transformStore.setRotation(e>180?e-360:e);this.transformations.rotateOutputContainer(Gl(uS(t.outputRotation||0)));if(t.identifier){this.transformStore.changeIdentifier(t.identifier);}if(t.start&&t.end){if(t.end.x===0||t.end.y===0){t.end.x=1;t.end.y=1;}var _this$convertOperatio=this.convertOperationOptionsToUI({start:new O(t.start),end:new O(t.end),rotation:t.rotation,outputRotation:t.outputRotation}),r=_this$convertOperatio.start,o=_this$convertOperatio.end;this.changePositionX(r.x);this.changePositionY(r.y);var n=o.x-r.x;var s=o.y-r.y;this.transformStore.changeSize({width:n,height:s});var _this$defaults=this.defaults,a=_this$defaults.maxCropMaskSize,l=_this$defaults.imageSize;var c={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(c);}if(t.flipHorizontally){this.flipHorizontally(false);}if(t.flipVertically){this.flipVertically(false);}this.editor.overlayToolStore.correctOverlayFlip();}},{key:"setDefaultAngle",value:function setDefaultAngle(t){this.defaultAngle=t;}},{key:"updateCanvasControls",value:function updateCanvasControls(t){var e=ct(this.cropMaskPosition);var r=ct(this.cropMaskSize);var o=ct(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*r.height/t.height,width:o.width*r.width/t.width},void 0,false);this.changePosition({y:o.height*e.y/t.height,x:o.width*e.x/t.width});}},{key:"onLeave",value:function onLeave(){this.transformations.onLeave();}},{key:"onEnter",value:function onEnter(){this.transformations.onEnter();this.transformHistory.init();}},{key:"saveTransforms",value:function saveTransforms(){this.transformations.saveTransforms();}},{key:"saveTransformsBasedOnFlip",value:function saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip();}},{key:"setRotation",value:function setRotation(t){this.transformStore.setRotation(t);this.transformRender();}},{key:"rotateOutputContainer",value:function(){var _rotateOutputContainer=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee39(t){var e,_args40=arguments;return regeneratorRuntime.wrap(function _callee39$(_context40){while(1){switch(_context40.prev=_context40.next){case 0:e=_args40.length>1&&_args40[1]!==undefined?_args40[1]:true;this.setDragMode(true);this.transformations.rotateOutputContainer(t,e);_context40.next=5;return this.editor.wait();case 5:this.setDragMode(false);case 6:case"end":return _context40.stop();}}},_callee39,this);}));function rotateOutputContainer(_x38){return _rotateOutputContainer.apply(this,arguments);}return rotateOutputContainer;}()},{key:"applyInitialCrop",value:function applyInitialCrop(){var _this$getMatchingItem=this.getMatchingItem(),t=_this$getMatchingItem.identifier;this.changeIdentifier(t,false);}},{key:"clickableCanvas",value:function clickableCanvas(t){this.editor.clickableCanvas(t);}},{key:"proportionalSize",value:function proportionalSize(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:this.defaults.maxCropMaskSize;var o=arguments.length>3&&arguments[3]!==undefined?arguments[3]:this.minCropSize;var n=e.height*t;var s=e.height;if(n>r.width||n0&&arguments[0]!==undefined?arguments[0]:this.rotateFlipState.rotation;return this.transformations.getScaleWithFlip(t);}},{key:"cropState",get:function get(){return this.transformStore.selectedCrop;}},{key:"identifier",get:function get(){return this.transformStore.identifier;}},{key:"ratio",get:function get(){return this.transformStore.ratio;}},{key:"height",get:function get(){return this.transformStore.height;}},{key:"width",get:function get(){return this.transformStore.width;}},{key:"localOutputImageSize",get:function get(){return this.localOutputSize;}},{key:"localOutputHeight",get:function get(){return this.localOutputSize.height;}},{key:"localOutputWidth",get:function get(){return this.localOutputSize.width;}},{key:"lockResolution",get:function get(){return this.transformStore.lockResolution;}},{key:"forceDimensions",get:function get(){return this.transformStore.forceDimensions;}},{key:"rotationInDegrees",get:function get(){return this.transformStore.rotationInDegrees;}},{key:"outputRotation",get:function get(){return this.transformStore.outputRotation;}},{key:"isDragMode",get:function get(){return this.dragMode.get();}},{key:"rotateFlipState",get:function get(){var _this$transformStore$=this.transformStore.state,t=_this$transformStore$.flipHorizontally,e=_this$transformStore$.flipVertically,r=_this$transformStore$.rotationInDegrees,o=_this$transformStore$.outputRotation;return{flipHorizontally:t,flipVertically:e,rotation:_mu.inRadians(r),outputRotation:o};}},{key:"selectedCategoryIdentifier",get:function get(){return this.selectedCategory;}},{key:"categories",get:function get(){return this.entityManager.categories;}},{key:"items",get:function get(){return this.entityManager.items;}},{key:"config",get:function get(){return this.editor.configStore.config["transform"];}},{key:"locale",get:function get(){return this.editor.configStore.locale["transform"];}},{key:"isOptionSelected",get:function get(){return this.identifier!=="identity";}},{key:"leftTop",get:function get(){return this.rect.leftTop;}},{key:"leftBottom",get:function get(){return this.rect.leftBottom;}},{key:"rightTop",get:function get(){return this.rect.rightTop;}},{key:"rightBottom",get:function get(){return this.rect.rightBottom;}},{key:"isFlippedHorizontal",get:function get(){return this.transformStore.isFlippedHorizontal;}},{key:"isFlippedVertical",get:function get(){return this.transformStore.isFlippedVertical;}},{key:"leftTopRespectFlip",get:function get(){return this.rectForUi.leftTop;}},{key:"leftBottomRespectFlip",get:function get(){return this.rectForUi.leftBottom;}},{key:"rightTopRespectFlip",get:function get(){return this.rectForUi.rightTop;}},{key:"rightBottomRespectFlip",get:function get(){return this.rectForUi.rightBottom;}},{key:"cropMaskPosition",get:function get(){return this.transformStore.position;}},{key:"cropMaskSize",get:function get(){return this.transformStore.size;}},{key:"state",get:function get(){return this.transformStore.state;}},{key:"defaultImageSize",get:function get(){return this.defaults.imageSize;}},{key:"maxCropMaskSize",get:function get(){return this.defaults.maxCropMaskSize;}},{key:"minCropMaskSize",get:function get(){var t=this.getRatio();if(t==="*"||t===1){return{width:this.minCropSize,height:this.minCropSize};}if(t>1){return{width:this.minCropSize*t,height:this.minCropSize};}return{width:this.minCropSize,height:this.minCropSize*t};}},{key:"defaultCropMaskPosition",get:function get(){return this.defaults.cropMaskPosition;}},{key:"defaultScale",get:function get(){return this.defaults.scale;}},{key:"engineMediator",get:function get(){return this.editor.engineMediator;}},{key:"getRatio",value:function getRatio(){var t=this.getTransform(this.identifier);if(t){if(Object.prototype.hasOwnProperty.call(t,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight;}return t.ratio;}var _t$dimensions=t.dimensions,e=_t$dimensions.x,r=_t$dimensions.y;return e/r;}return"*";}}],[{key:"inRadians",value:function inRadians(t){return t*Math.PI/180;}},{key:"placeCropMask",value:function placeCropMask(t,e){if(e.height*t>e.width){var o=e.width/t;return{height:o,width:e.width,yChanged:true};}var r=e.height*t;return{height:e.height,width:r,yChanged:false};}}]);return mu;}();tt=_mu;f([Q],tt.prototype,"selectedCategory",2);f([Q],tt.prototype,"defaults",2);f([Q],tt.prototype,"localOutputSize",2);f([C],tt.prototype,"changeIdentifier",1);f([C],tt.prototype,"setDragMode",1);f([C],tt.prototype,"setCropDefaults",1);f([C],tt.prototype,"setDefaultImageSize",1);f([C],tt.prototype,"setMaxCropSize",1);f([C],tt.prototype,"setDefaultCropPosition",1);f([C],tt.prototype,"resetCrop",1);f([C],tt.prototype,"toggleCategorySelection",1);f([C],tt.prototype,"pureReset",1);f([C],tt.prototype,"reset",2);f([C],tt.prototype,"changePosition",1);f([C],tt.prototype,"changePositionX",1);f([C],tt.prototype,"changePositionY",1);f([C],tt.prototype,"changeCropAndOutputSize",1);f([C],tt.prototype,"onLeave",1);f([C],tt.prototype,"onEnter",1);f([C],tt.prototype,"changeLocalOutputSize",2);f([C],tt.prototype,"changeDefaultScale",2);f([C],tt.prototype,"changeLocalOutputHeight",2);f([C],tt.prototype,"changeLocalOutputWidth",2);f([C],tt.prototype,"changeLockResolution",2);f([C],tt.prototype,"setRotation",1);f([C],tt.prototype,"rotateClockwise",2);f([C],tt.prototype,"rotateAntiClockwise",2);f([C],tt.prototype,"rotateOutputContainer",1);f([C],tt.prototype,"flipHorizontally",2);f([C],tt.prototype,"flipVertically",2);f([C],tt.prototype,"applyDefaultCrop",2);f([C],tt.prototype,"applyInitialCrop",1);f([C],tt.prototype,"updateCropMask",2);f([C],tt.prototype,"clickableCanvas",1);f([C],tt.prototype,"onLeftTop",2);f([C],tt.prototype,"onLeftBottom",2);f([C],tt.prototype,"onRightTop",2);f([C],tt.prototype,"onRightBottom",2);f([C],tt.prototype,"proportionalSize",1);f([C],tt.prototype,"onPixelWidth",2);f([C],tt.prototype,"onPixelHeight",2);f([C],tt.prototype,"updateInitialCropMaskPosition",1);f([C],tt.prototype,"updatePreviewSizeWRTImageSize",1);f([C],tt.prototype,"dispose",2);f([S],tt.prototype,"cropState",1);f([S],tt.prototype,"identifier",1);f([S],tt.prototype,"ratio",1);f([S],tt.prototype,"height",1);f([S],tt.prototype,"width",1);f([S],tt.prototype,"localOutputImageSize",1);f([S],tt.prototype,"localOutputHeight",1);f([S],tt.prototype,"localOutputWidth",1);f([S],tt.prototype,"lockResolution",1);f([S],tt.prototype,"forceDimensions",1);f([S],tt.prototype,"rotationInDegrees",1);f([S],tt.prototype,"outputRotation",1);f([S],tt.prototype,"isDragMode",1);f([S],tt.prototype,"rotateFlipState",1);f([S],tt.prototype,"selectedCategoryIdentifier",1);f([S],tt.prototype,"categories",1);f([S],tt.prototype,"items",1);f([S],tt.prototype,"config",1);f([S],tt.prototype,"locale",1);f([S],tt.prototype,"isOptionSelected",1);f([S],tt.prototype,"leftTop",1);f([S],tt.prototype,"leftBottom",1);f([S],tt.prototype,"rightTop",1);f([S],tt.prototype,"rightBottom",1);f([S],tt.prototype,"isFlippedHorizontal",1);f([S],tt.prototype,"isFlippedVertical",1);f([S],tt.prototype,"leftTopRespectFlip",1);f([S],tt.prototype,"leftBottomRespectFlip",1);f([S],tt.prototype,"rightTopRespectFlip",1);f([S],tt.prototype,"rightBottomRespectFlip",1);f([S],tt.prototype,"cropMaskPosition",1);f([S],tt.prototype,"cropMaskSize",1);f([S],tt.prototype,"state",1);f([S],tt.prototype,"defaultImageSize",1);f([S],tt.prototype,"maxCropMaskSize",1);f([S],tt.prototype,"minCropMaskSize",1);f([S],tt.prototype,"defaultCropMaskPosition",1);f([S],tt.prototype,"defaultScale",1);});var ZH=d(function(){Dk();Qk();});var QH,oct,tI,nct,_ef,nt;var eI=d(function(){Tt();QH=y(Ju());R();U();Zi();qk();hm();fk();bk();xk();wk();oct={};tI="none";nct={position:{x:0,y:0},rotation:0};_ef=/*#__PURE__*/function(){function ef(t){var _this355=this;_classCallCheck(this,ef);this.state=Q.map(oct);this.selectedId=Q.box(tI);this.editMode=Q.box(false);this.dragMode=Q.box(false);this.minLength=0;this.counter=0;this.addSticker=/*#__PURE__*/function(){var _ref172=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee40(t){var e,_args41=arguments;return regeneratorRuntime.wrap(function _callee40$(_context41){while(1){switch(_context41.prev=_context41.next){case 0:e=_args41.length>1&&_args41[1]!==undefined?_args41[1]:true;_context41.next=3;return _this355.addStickerAsync(t,e);case 3:case"end":return _context41.stop();}}},_callee40);}));return function(_x39){return _ref172.apply(this,arguments);};}();this.addStickerAsync=/*#__PURE__*/function(){var _ref174=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee42(_ref173){var t,e,r,o,_args43=arguments;return regeneratorRuntime.wrap(function _callee42$(_context43){while(1){switch(_context43.prev=_context43.next){case 0:t=_ref173.spriteId,e=_ref173.state,r=_ref173.transform;o=_args43.length>1&&_args43[1]!==undefined?_args43[1]:true;return _context43.abrupt("return",new Promise(function(n,s){r=_this355.getInitialTransform(r);var a=e.identifier;var l=_this355.editor.orderHelper.addSprite(a);_this355.editor.engine.addStickerFromAssets(a,_this355.editor.engineMediator.image.container,l).then(/*#__PURE__*/function(){var _ref175=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee41(c){var u,m,p,v,b,_this355$editor$outpu,h,g,x;return regeneratorRuntime.wrap(function _callee41$(_context42){while(1){switch(_context42.prev=_context42.next){case 0:if(t){c.setData({id:t});}u=c.getID();_this355.container[u]=c;_this355.editor.orderHelper.renameSprite(a,u);m=_this355.getSize(u);m.width*=c.getScale().x;m.height*=c.getScale().y;c.setPivot(.5,.5);if(r.scale){p=r.scale;}else if(r.size){p={x:r.size.width/m.width,y:r.size.height/m.height};}else{v=_this355.editor.shortestOutputSide*.4;b=_ef.magnitude(v)/_ef.sizeMagnitude(c.getSizeInWorldSpace());p={x:b,y:b};}_this355$editor$outpu=_this355.editor.outputContainer.getData(),h=_this355$editor$outpu.flipHorizontally,g=_this355$editor$outpu.flipVertically;c.setFlipHorizontally(h);c.setFlipVertically(g);c.setTransform({position:r.position,scale:p,rotation:r.rotation});if(e.flipHorizontally!==void 0){c.setFlipHorizontally(e.flipHorizontally!==h);}if(e.flipVertically!==void 0){c.setFlipVertically(e.flipVertically!==g);}_this355.setContainerProperties(u,_objectSpread({},e));x=c.getData();_this355.setInitialSpriteState(u,"sticker");_this355.stickerToolStore.setState(u,_objectSpread(_objectSpread({},x),{},{identifier:a}));_context42.next=21;return _this355.editor.renderPromise();case 21:if(o){_this355.setId(u);_this355.addSnapshot("add",_this355.stickerLocale.add);}n();case 23:case"end":return _context42.stop();}}},_callee41);}));return function(_x41){return _ref175.apply(this,arguments);};}())["catch"](function(c){console.error(c);s();});}));case 3:case"end":return _context43.stop();}}},_callee42);}));return function(_x40){return _ref174.apply(this,arguments);};}();this.addText=/*#__PURE__*/function(){var _ref176=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee43(t){var e,_args44=arguments;return regeneratorRuntime.wrap(function _callee43$(_context44){while(1){switch(_context44.prev=_context44.next){case 0:e=_args44.length>1&&_args44[1]!==undefined?_args44[1]:true;_context44.next=3;return _this355.addTextAsync(t,e);case 3:case"end":return _context44.stop();}}},_callee43);}));return function(_x42){return _ref176.apply(this,arguments);};}();this.addTextAsync=function(_ref177){var t=_ref177.spriteId,e=_ref177.state,r=_ref177.transform;var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;return new Promise(function(n,s){r=_this355.getInitialTransform(r);var a=_this355.editor.orderHelper.addSprite(e.identifier);var l=_this355.editor.shortestOutputSide;var c={fontIdentifier:e.identifier,text:e.text,width:e.width||l*.6,fontSize:e.fontSize||l*.1,lineHeight:e.lineHeight,alignment:e.alignment,textColor:e.textColor,backgroundColor:e.backgroundColor};_this355.editor.engine.addTextWithFontLoading(c,_this355.editor.engineMediator.image.container,a).then(/*#__PURE__*/function(){var _ref178=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee44(u){var m,_this355$editor$outpu2,p,h,g;return regeneratorRuntime.wrap(function _callee44$(_context45){while(1){switch(_context45.prev=_context45.next){case 0:if(t){u.setData({id:t});}m=u.getID();_this355.container[m]=u;_this355.editor.orderHelper.renameSprite(e.identifier,m);_this355$editor$outpu2=_this355.editor.outputContainer.getData(),p=_this355$editor$outpu2.flipHorizontally,h=_this355$editor$outpu2.flipVertically;u.setFlipHorizontally(p);u.setFlipVertically(h);u.setPivot(.5,.5);u.setPosition(r.position);u.setRotation(r.rotation);_this355.setInitialSpriteState(m,"text");g=u.getData();_this355.textToolStore.setState(m,_objectSpread({},g));_context45.next=15;return _this355.editor.renderPromise();case 15:if(o){_this355.setId(m);_this355.addSnapshot("add",_this355.textLocale.add);}n();case 17:case"end":return _context45.stop();}}},_callee44);}));return function(_x43){return _ref178.apply(this,arguments);};}())["catch"](function(u){console.error(u);s();});});};this.addTextDesign=/*#__PURE__*/function(){var _ref179=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee45(t){var e,r,_args46=arguments;return regeneratorRuntime.wrap(function _callee45$(_context46){while(1){switch(_context46.prev=_context46.next){case 0:e=_args46.length>1&&_args46[1]!==undefined?_args46[1]:true;r=_args46.length>2&&_args46[2]!==undefined?_args46[2]:false;_context46.prev=2;_context46.next=5;return _this355.addTextDesignAsync(t,e,r);case 5:_context46.next=10;break;case 7:_context46.prev=7;_context46.t0=_context46["catch"](2);console.warn(_context46.t0);case 10:case"end":return _context46.stop();}}},_callee45,null,[[2,7]]);}));return function(_x44){return _ref179.apply(this,arguments);};}();this.addTextDesignAsync=function(_ref180){var t=_ref180.spriteId,e=_ref180.state,r=_ref180.transform;var o=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;return new Promise(function(s,a){r=_this355.getInitialTransform(r);var l=_this355.editor.orderHelper.addSprite(e.identifier);var c=_this355.editor.shortestOutputSide;var u={width:e.width||c*.6,text:e.text,color:e.color,inverted:e.isInverted,seed:e.seed,padding:e.padding};_this355.editor.engine.addTextDesignAsync(e.identifier,u,_this355.editor.engineMediator.image.container,l).then(/*#__PURE__*/function(){var _ref181=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee46(m){var p,_this355$editor$outpu3,h,g,x;return regeneratorRuntime.wrap(function _callee46$(_context47){while(1){switch(_context47.prev=_context47.next){case 0:if(t){if(n){_this355.pureRemoveSprite(t);_this355.textDesignToolStore.state["delete"](t);}m.setData({id:t});}p=m.getID();_this355.container[p]=m;_this355.editor.orderHelper.renameSprite(e.identifier,p);_this355$editor$outpu3=_this355.editor.outputContainer.getData(),h=_this355$editor$outpu3.flipHorizontally,g=_this355$editor$outpu3.flipVertically;m.setFlipHorizontally(h);m.setFlipVertically(g);m.setPivot(.5,.5);m.setPosition(r.position);m.setRotation(r.rotation);_this355.setInitialSpriteState(p,"textdesign");x=m.getData();_this355.textDesignToolStore.setState(p,_objectSpread(_objectSpread({},x),{},{identifier:e.identifier}));_context47.next=15;return _this355.editor.renderPromise();case 15:if(o){_this355.setId(p);_this355.addSnapshot("add",_this355.textDesignLocale.add);}s();case 17:case"end":return _context47.stop();}}},_callee46);}));return function(_x45){return _ref181.apply(this,arguments);};}())["catch"](function(m){a(m);});});};this.spriteLocalTransform=function(){return{position:_this355.editor.previewToOutput(_this355.position),size:_this355.size,rotation:_this355.rotation};};this.clickableCanvas=function(t){_this355.editor.clickableCanvas(t);};this.setContainerProperties=function(t,e){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;_this355.container[t].setData(e);if(r){_this355.updatePositionAndSize();}_this355.editor.render();};this.setContainerPosition=function(t,e){_this355.container[t].setPosition(e);};this.pureRemoveSprite=function(t){_this355.editor.engine.removeContainer(_this355.container[t]);var e=_this355.container[t].getIndexInParent();if(e===-1){delete _this355.container[t];_this355.state["delete"](t);_this355.editor.orderHelper.removeSprite(t);return true;}return false;};this.deleteSprite=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this355.id;var e=_this355.state.get(t);if(e.tool==="sticker"){_this355.stickerToolStore["delete"]();}else if(e.tool==="text"){_this355.textToolStore["delete"]();}else if(e.tool==="textdesign"){_this355.textDesignToolStore["delete"]();}};this.removeSprite=function(t){var e=_this355.pureRemoveSprite(t);if(e){_this355.selectLast();_this355.spriteSnapshot("delete");_this355.editor.render();}};this.addSnapshot=function(t,e){_this355.editor.addSnapshot(void 0,t,e);};this.spriteSnapshot=function(t){_this355.addSnapshot("edit",_this355.historyLocale[t]);};this.addNewText=/*#__PURE__*/function(){var _ref182=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee47(t,e){return regeneratorRuntime.wrap(function _callee47$(_context48){while(1){switch(_context48.prev=_context48.next){case 0:if(!_this355.textToolStore.doesTextAssetExist(e.identifier)){_context48.next=5;break;}_context48.next=3;return _this355.addTextAsync(_objectSpread(_objectSpread({},t),{},{state:e}),false);case 3:_context48.next=6;break;case 5:throw new Do(e.identifier);case 6:case"end":return _context48.stop();}}},_callee47);}));return function(_x46,_x47){return _ref182.apply(this,arguments);};}();this.addNewTextDesign=/*#__PURE__*/function(){var _ref183=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee48(t,e){return regeneratorRuntime.wrap(function _callee48$(_context49){while(1){switch(_context49.prev=_context49.next){case 0:if(!_this355.textDesignToolStore.doesTextDesignAssetExist(e.identifier)){_context49.next=5;break;}_context49.next=3;return _this355.addTextDesignAsync(_objectSpread(_objectSpread({},t),{},{state:e}),false);case 3:_context49.next=6;break;case 5:throw new Do(e.identifier);case 6:case"end":return _context49.stop();}}},_callee48);}));return function(_x48,_x49){return _ref183.apply(this,arguments);};}();this.addNewSticker=/*#__PURE__*/function(){var _ref184=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee49(t,e){return regeneratorRuntime.wrap(function _callee49$(_context50){while(1){switch(_context50.prev=_context50.next){case 0:if(!_this355.stickerToolStore.doesStickerAssetExist(e.identifier)){_context50.next=5;break;}_context50.next=3;return _this355.addStickerAsync(_objectSpread(_objectSpread({},t),{},{state:e}),false);case 3:_context50.next=6;break;case 5:throw new Do(e.identifier);case 6:case"end":return _context50.stop();}}},_callee49);}));return function(_x50,_x51){return _ref184.apply(this,arguments);};}();this.getSpriteHistoryState=function(){var _r20;var t=ct(_this355.textToolStore.state);var e=ct(_this355.textDesignToolStore.state);var r=(_r20={common:ct(_this355.state)},_defineProperty(_r20,"sticker",ct(_this355.stickerToolStore.state)),_defineProperty(_r20,"text",t),_defineProperty(_r20,"textdesign",e),_defineProperty(_r20,"spriteIdList",Object.keys(_this355.container)),_r20);Object.keys(r.common).forEach(function(o){r.common[o].size=_this355.container[o].getSizeInWorldSpace();r.common[o].position=_this355.container[o].getPosition();r.common[o].order=_this355.container[o].getIndexInParent();});return r;};this.updateStateFromSerialization=/*#__PURE__*/function(){var _ref185=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee51(t,e,r){var o;return regeneratorRuntime.wrap(function _callee51$(_context52){while(1){switch(_context52.prev=_context52.next){case 0:if(!(e&&e.length)){_context52.next=13;break;}_context52.prev=1;_context52.next=4;return Promise.all(e.map(/*#__PURE__*/function(){var _ref187=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee50(_ref186){var n,s,a,l,c,u,m;return regeneratorRuntime.wrap(function _callee50$(_context51){while(1){switch(_context51.prev=_context51.next){case 0:n=_ref186.svg,s=_ref186.raster,a=_ref186.name,l=_ref186.identifier;c=(n==null?void 0:n.data)?"image/svg+xml":s.type;u="data:".concat(c,";base64,").concat((n==null?void 0:n.data)||s.data);_context51.next=5;return sv(u,150);case 5:m=_context51.sent;return _context51.abrupt("return",{stickerURI:u,thumbnailURI:m,name:a,type:c,identifier:l});case 7:case"end":return _context51.stop();}}},_callee50);}));return function(_x55){return _ref187.apply(this,arguments);};}()));case 4:o=_context52.sent;_context52.next=7;return _this355.stickerToolStore.addCustomStickerAsset(o);case 7:_context52.next=13;break;case 9:_context52.prev=9;_context52.t0=_context52["catch"](1);_this355.editor.modalStore.hideModal();_this355.editor.modalStore.showInfoModal("stickerLoading");case 13:if(!t.text){_context52.next=16;break;}_context52.next=16;return _this355.textToolStore.loadFonts();case 16:if(!t.textdesign){_context52.next=19;break;}_context52.next=19;return _this355.textDesignToolStore.loadFonts();case 19:_context52.next=21;return _this355.updateStateByHistoryState(t.spriteIdList,t,r);case 21:case"end":return _context52.stop();}}},_callee51,null,[[1,9]]);}));return function(_x52,_x53,_x54){return _ref185.apply(this,arguments);};}();this.updateStateFromHistory=/*#__PURE__*/function(){var _ref188=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee52(t){var e,r;return regeneratorRuntime.wrap(function _callee52$(_context53){while(1){switch(_context53.prev=_context53.next){case 0:e=Object.keys(_this355.container);r=e.filter(function(o){return t.spriteIdList.indexOf(o)===-1;});r.forEach(function(o){_this355.pureRemoveSprite(o);});_context53.next=5;return _this355.updateStateByHistoryState(t.spriteIdList,t,0);case 5:case"end":return _context53.stop();}}},_callee52);}));return function(_x56){return _ref188.apply(this,arguments);};}();this.serializableState=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee54(){var t,e;return regeneratorRuntime.wrap(function _callee54$(_context55){while(1){switch(_context55.prev=_context55.next){case 0:t=_this355.editor.spriteStore.getSpriteHistoryState();Object.keys(t.common).forEach(function(r){var _this355$editor$outpu4=_this355.editor.outputContainer.getData(),o=_this355$editor$outpu4.flipHorizontally,n=_this355$editor$outpu4.flipVertically;var s=_this355.editor.outputContainer.getRotation();var a=n!==o?-t.common[r].rotation:t.common[r].rotation;t.common[r].rotation=n!==o?a+s:a-s;});_context55.next=4;return Promise.all(_this355.editor.spriteStore.stickerToolStore.customStickers.map(/*#__PURE__*/function(){var _ref191=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee53(_ref190){var r,o,n,s,a,_n$split,_n$split2,l,_l$split,_l$split2;return regeneratorRuntime.wrap(function _callee53$(_context54){while(1){switch(_context54.prev=_context54.next){case 0:r=_ref190.identifier,o=_ref190.type,n=_ref190.stickerURI,s=_ref190.name;a={identifier:r,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]};}if(!(o==="image/jpeg"||o==="image/png"||o==="image/gif")){_context54.next=10;break;}_n$split=n.split(",");_n$split2=_slicedToArray(_n$split,2);a.raster.data=_n$split2[1];a.raster.type=o;_context54.next=17;break;case 10:_context54.next=12;return sv(n);case 12:l=_context54.sent;_l$split=l.split(",");_l$split2=_slicedToArray(_l$split,2);a.raster.data=_l$split2[1];a.raster.type="image/png";case 17:return _context54.abrupt("return",a);case 18:case"end":return _context54.stop();}}},_callee53);}));return function(_x57){return _ref191.apply(this,arguments);};}()));case 4:e=_context55.sent;return _context55.abrupt("return",{sprite:t,customStickers:e});case 6:case"end":return _context55.stop();}}},_callee54);}));this.updateCanvasControls=function(){Object.keys(_this355.container).forEach(function(t){_this355.updatePositionAndSize(t,true);var e=_this355.state.get(t);if(e){if(e.tool==="text"){var r=_this355.getContainerProperties(t);_this355.textToolStore.changeSize(t,r);}else if(e.tool==="textdesign"){var _r21=_this355.getContainerProperties(t);_this355.textToolStore.changeWidth(_r21.width);}}});};this.setEditMode=function(t){if(_this355.currentSprite){if(["text","textdesign"].indexOf(_this355.tool)!==-1){if(t){_this355.editor.modalStore.showTextEditModal();}else{_this355.editor.modalStore.hideModal();}_this355.editMode.set(t);}}};this.setDragMode=function(t){_this355.dragMode.set(t);};this.setPosition=function(t){var e=_this355.currentSprite;var r=_this355.container[_this355.id];if(e&&r){r.setPosition(_this355.editor.previewToWorld(t));var _this355$getSizePosit=_this355.getSizePositionFromContainer(),o=_this355$getSizePosit.position;e.position.x=o.x;e.position.y=o.y;_this355.state.set(_this355.id,e);_this355.editor.render();}};this.setSize=function(t){var e=_this355.currentSprite;if(e){e.size.width=t.width;e.size.height=t.height;_this355.state.set(_this355.id,e);}};this.setRotation=function(t){var e=_this355.currentSprite;if(e){var _this355$editor$outpu5=_this355.editor.outputContainer.getData(),r=_this355$editor$outpu5.flipHorizontally,o=_this355$editor$outpu5.flipVertically;var n=_this355.editor.outputContainer.getRotation();var s=$h({rotation:t,outputRotation:n,flipHorizontally:r,flipVertically:o});_this355.container[_this355.id].setRotation(s);e.rotation=_this355.container[_this355.id].getRotation();_this355.state.set(_this355.id,e);_this355.editor.render();}};this.onCanvasClick=function(t){if(!_this355.isEditMode){_this355.selectHighestOrderSprite(t);}};this.select=function(t){var e=_this355.state.get(t);if(e){var r=_this355.editor.activeStore.tool;if(r!==e.tool){_this355.editor.activeStore.selectTool(e.tool);}_this355.setId(t);}};this.selectLast=function(){var t=_this355.editor.orderHelper.getLastSpriteId();if(t){_this355.select(t);}};this.selectNext=function(){if(_this355.currentSprite){var _t44=_this355.container[_this355.id];var e=_t44.getIndexInParent();if(e){var r=Object.keys(_this355.container).find(function(o){return _this355.container[o].getIndexInParent()===e-1;});if(r){_this355.select(r);}}}};this.deselect=function(){_this355.setId(tI);};this.bringToFront=/*#__PURE__*/function(){var _ref192=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee55(t){var e;return regeneratorRuntime.wrap(function _callee55$(_context56){while(1){switch(_context56.prev=_context56.next){case 0:e=_this355.editor.orderHelper.bringToFront(t);_this355.container[t].setIndexInParent(e);_this355.spriteSnapshot("order");_context56.next=5;return _this355.editor.render();case 5:_this355.counter+=1;case 6:case"end":return _context56.stop();}}},_callee55);}));return function(_x58){return _ref192.apply(this,arguments);};}();this.flipHorizontally=function(t){var e=_this355.state.get(t);var r=_this355.container[t];r.setFlipHorizontally(!r.getFlipHorizontally());e.flipHorizontally=r.getFlipHorizontally();_this355.spriteSnapshot("flip");_this355.state.set(t,e);_this355.editor.render();};this.pureReset=function(){_this355.deselect();Array.from(_this355.state.keys()).forEach(function(t){_this355.pureRemoveSprite(t);});_this355.stickerToolStore.pureReset();_this355.textToolStore.pureReset();_this355.textDesignToolStore.pureReset();};this.selectHighestOrderSprite=function(t){var e=_this355.editor.brushToolStore.containerId();t=t.filter(function(n){return n!==e;});if(t.length<1){_this355.deselect();return;}var r="";var o=0;t.forEach(function(n){var s=_this355.container[n];var a=s&&s.getIndexInParent()||0;if(a>=o){o=a;r=n;}});_this355.select(r);};this.onCornerDrag=function(_ref193){var t=_ref193.x,e=_ref193.y;if(_this355.currentSprite){var r=new O(_this355.currentSprite.position);var o=new O(t,e);var n=o.subtract(r).magnitude;var s=_this355.getSize();var a=n*2/_ef.sizeMagnitude(s);if(n>_this355.minLength){if(_this355.isSpriteSticker){if(_this355.stickerToolStore.resizeMode!=="unrestricted"){_this355.setStickerSize({width:s.width*a,height:s.height*a});}else{var l=_this355.rotationWRTOutputRotation;var c=o.subtract(r);var u=Math.cos(l);var m=Math.sin(l);var p=Math.max(Math.abs(c.x*u*2+c.y*m*2),_this355.minLength);var h=Math.max(Math.abs(c.x*-m*2+c.y*u*2),_this355.minLength);_this355.setStickerSize({width:p,height:h});}}else if(_this355.isSpriteText){_this355.setTextSize(s.width*a);}else if(_this355.isSpriteTextDesign){_this355.setTextDesignScale(a);}}_this355.editor.render();}};this.onWidthDrag=function(_ref194){var t=_ref194.x,e=_ref194.y;var r=new O(_this355.currentSprite.position);var o=new O(t,e);var n=o.subtract(r).magnitude;var s=_this355.editor.previewToWorld(2*n);if(s>_this355.minLength){_this355.setContainerProperties(_this355.id,{width:s},true);if(_this355.isSpriteText){var a=_this355.getContainerProperties(_this355.id);_this355.textToolStore.changeWidth(a.width);}}};this.onPaddingDrag=function(_ref195){var t=_ref195.x,e=_ref195.y;if(_this355.isSpriteTextDesign){var r=_this355.getContainerProperties(_this355.id);var o=new O(_this355.currentSprite.position);var n=new O(t,e);var s=n.subtract(o).magnitude;var a=Math.max(_this355.editor.previewToWorld(s)-r.width/2,0);_this355.setContainerProperties(_this355.id,{padding:a},true);if(_this355.isSpriteTextDesign){r=_this355.getContainerProperties(_this355.id);_this355.textDesignToolStore.changePadding(r.padding);}}};this.correctTextFlip=function(){var _this355$editor$outpu6=_this355.editor.outputContainer.getData(),t=_this355$editor$outpu6.flipHorizontally,e=_this355$editor$outpu6.flipVertically;Object.values(_this355.container).forEach(function(r){if(r.type==="text"||r.type==="text-design"){r.setFlipHorizontally(t);r.setFlipVertically(e);}});};this.reverseTextHorizontally=function(t){Object.values(_this355.container).forEach(function(e){if(e.type==="text"||e.type==="text-design"){e.setFlipHorizontally(t);}});};this.reverseTextVertically=function(t){Object.values(_this355.container).forEach(function(e){if(e.type==="text"||e.type==="text-design"){e.setFlipVertically(t);}});};this.dispose=function(){_this355.state=null;if(_this355.stickerToolStore){_this355.stickerToolStore.dispose();_this355.stickerToolStore=null;}if(_this355.textToolStore){_this355.textToolStore.dispose();_this355.textToolStore=null;}if(_this355.textDesignToolStore){_this355.textDesignToolStore.dispose();_this355.textDesignToolStore=null;}_this355.selectedId=null;_this355.editMode=null;_this355.dragMode=null;_this355.editor=null;_this355.rect=null;};this.getOutputProperties=function(){return _this355.editor.outputContainer.getData();};this.getContainerProperties=function(t){return _this355.container[t].getData();};this.getContainerTransform=function(t){return _this355.container[t].getTransform();};this.getDuplicateContainerTransform=function(t){var e=_this355.container[t].getTransform();var r=_this355.editor.shortestOutputSide*.1;var o=new O(e.position).add(new O(r,r));return _objectSpread(_objectSpread({},e),{},{position:o});};this.getDuplicateContainerFlip=function(t){var e=_this355.container[t].getFlipHorizontally();var r=_this355.container[t].getFlipVertically();return{flipHorizontally:e,flipVertically:r};};this.updatePositionAndSize=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this355.id;var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var _this355$getSizePosit2=_this355.getSizePositionFromContainer(t),r=_this355$getSizePosit2.position,o=_this355$getSizePosit2.size;var n=_this355.state.get(t);if(n){n.position.x=r.x;n.position.y=r.y;n.size.width=o.width;n.size.height=o.height;if(e){var s=_this355.container[t].getRotation();_this355.container[t].setRotation(s);n.rotation=_this355.container[t].getRotation();}_this355.state.set(t,n);}};this.getInitialTransform=function(t){var e=_this355.editor.outputToWorld(nct.position);if(!t){var r=_this355.editor.outputContainer.getRotation();return{rotation:r,position:e};}return _objectSpread({position:e},t);};this.setInitialSpriteState=function(t,e){var r=_this355.container[t];var _this355$getSizePosit3=_this355.getSizePositionFromContainer(t),o=_this355$getSizePosit3.position,n=_this355$getSizePosit3.size;var s=r.getRotation();var a=e!=="sticker"?false:r.getFlipHorizontally();var l=e!=="sticker"?false:r.getFlipVertically();_this355.state.set(t,{tool:e,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l});};this.setStickerSize=function(t){var e=_this355.container[_this355.id];e.setSizeInWorldSpace(_this355.editor.previewSizeToWorld(t));var r=_this355.currentSprite;if(r){r.size=_this355.editor.worldSizeToPreview(e.getSizeInWorldSpace());_this355.state.set(_this355.id,r);}};this.setTextSize=function(t){var e=_this355.getContainerProperties(_this355.id);var r={width:_this355.editor.previewToWorld(t)};var o=r.width/e.width;var n={fontSize:Math.round(e.fontSize*o)};var s=_this355.isSpriteText?_objectSpread(_objectSpread({},r),n):r;if(r.width>_this355.minLength&&n.fontSize){_this355.setContainerProperties(_this355.id,s,true);e=_this355.getContainerProperties(_this355.id);_this355.textToolStore.changeFontSize(e.fontSize,true);_this355.textToolStore.changeWidth(e.width);}};this.setTextDesignScale=function(t){var e=_this355.getContainerProperties(_this355.id);var r=e.width*t;if(r>_this355.minLength){_this355.setContainerProperties(_this355.id,{width:r},true);var _this355$getContainer=_this355.getContainerProperties(_this355.id),o=_this355$getContainer.width;_this355.textDesignToolStore.changeWidth(o);e=_this355.getContainerProperties(_this355.id);_this355.textDesignToolStore.changePadding(e.padding);}};this.getSizePositionFromContainer=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this355.id;var e=_this355.container[t];if(e){var r=_this355.editor.worldToPreview(e.getPosition());var o=_this355.editor.worldSizeToPreview(e.getSizeInWorldSpace());return{position:r,size:o};}return{position:{x:0,y:0},size:{height:1,width:1}};};this.getSize=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:_this355.id;var e=_this355.container[t];if(e){return _this355.editor.worldSizeToPreview(e.getSizeInWorldSpace());}return{width:0,height:0};};this.editor=t;this.container={};this.stickerToolStore=new Pt(t);this.textToolStore=new gt(t);this.textDesignToolStore=new Mt(t);this.rect=new ze(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2);}_createClass(ef,[{key:"updateStateByHistoryState",value:function(){var _updateStateByHistoryState=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee57(t,e,r){var _this356=this;return regeneratorRuntime.wrap(function _callee57$(_context58){while(1){switch(_context58.prev=_context58.next){case 0:_context58.next=2;return(0,QH["default"])(t,/*#__PURE__*/function(){var _ref196=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee56(o){var n;return regeneratorRuntime.wrap(function _callee56$(_context57){while(1){switch(_context57.prev=_context57.next){case 0:n=e.common[o];if(n){_context57.next=3;break;}return _context57.abrupt("return");case 3:if(!_this356.state.get(o)){_context57.next=7;break;}_this356.updateExistingItem(o,e);_context57.next=9;break;case 7:_context57.next=9;return _this356.addNewItem(o,e);case 9:case"end":return _context57.stop();}}},_callee56);}));return function(_x62){return _ref196.apply(this,arguments);};}());case 2:t.forEach(function(o){var n=e.common[o];var s=_this356.container[o];if(!n||!s)return;s.setIndexInParent(n.order+r);});this.counter+=1;case 4:case"end":return _context58.stop();}}},_callee57,this);}));function updateStateByHistoryState(_x59,_x60,_x61){return _updateStateByHistoryState.apply(this,arguments);}return updateStateByHistoryState;}()},{key:"addNewItem",value:function(){var _addNewItem=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee58(t,e){var r,o,_this$editor$outputCo3,n,s,a,l,c,u,m,p,_m11;return regeneratorRuntime.wrap(function _callee58$(_context59){while(1){switch(_context59.prev=_context59.next){case 0:r=e.common[t];o=r.size?{width:this.editor.worldToPreview(r.size.width),height:this.editor.worldToPreview(r.size.height)}:void 0;_this$editor$outputCo3=this.editor.outputContainer.getData(),n=_this$editor$outputCo3.flipHorizontally,s=_this$editor$outputCo3.flipVertically;a=this.editor.outputContainer.getRotation();l=s!==n?r.rotation-a:r.rotation+a;c=s!==n?-l:l;u={spriteId:t,transform:{size:o,position:new O(r.position),rotation:c}};if(!e.text[t]){_context59.next=14;break;}m=e.text[t];p=this.textToolStore.validFontWithConfig(m.identifier);m.identifier=p==null?void 0:p.identifier;_context59.next=13;return this.addNewText(u,m);case 13:return _context59.abrupt("return");case 14:if(!e.textdesign[t]){_context59.next=18;break;}_context59.next=17;return this.addNewTextDesign(u,e.textdesign[t]);case 17:return _context59.abrupt("return");case 18:if(!e.sticker[t]){_context59.next=22;break;}_m11=this.stickerToolStore.items.find(function(p){return p.identifier===e.sticker[t].identifier;});_context59.next=22;return this.addNewSticker(u,_objectSpread(_objectSpread({},e.sticker[t]),{},{flipHorizontally:r.flipHorizontally,flipVertically:r.flipVertically,resizeMode:e.sticker[t].resizeMode||(_m11==null?void 0:_m11.resizeMode)||"keepAspect"}));case 22:case"end":return _context59.stop();}}},_callee58,this);}));function addNewItem(_x63,_x64){return _addNewItem.apply(this,arguments);}return addNewItem;}()},{key:"updateExistingItem",value:function updateExistingItem(t,e){var r=e.common[t];var o=this.state.get(t);this.state.set(t,o);var n=this.container[t];n.setPosition(new O(r.position));n.setRotation(r.rotation);o.rotation=n.getRotation();if(r.flipHorizontally!==void 0){n.setFlipHorizontally(r.flipHorizontally);}if(r.flipVertically!==void 0){n.setFlipVertically(r.flipVertically);}if(e.text[t]){var s=e.text[t];this.textToolStore.updateStateFromHistory(t,_objectSpread(_objectSpread({},s),{},{fontIdentifier:s.identifier}));}if(e.textdesign[t]){var _s7=e.textdesign[t];this.textDesignToolStore.updateStateFromHistory(t,_objectSpread(_objectSpread({},_s7),{},{inverted:_s7.isInverted}));}if(e.sticker[t]){n.setSizeInWorldSpace(r.size);this.stickerToolStore.updateStateFromHistory(t,e.sticker[t]);}this.updatePositionAndSize(t);}},{key:"currentSprite",get:function get(){if(this.isSpriteSelected){return this.state.get(this.id);}return void 0;}},{key:"padding",get:function get(){return this.textDesignToolStore.padding;}},{key:"isEditMode",get:function get(){return this.editMode.get();}},{key:"isDragMode",get:function get(){return this.dragMode.get();}},{key:"id",get:function get(){return this.selectedId.get();}},{key:"isSpriteSelected",get:function get(){return this.id!==tI;}},{key:"position",get:function get(){if(this.currentSprite){return this.currentSprite.position;}return void 0;}},{key:"tool",get:function get(){if(this.currentSprite){return this.currentSprite.tool;}return void 0;}},{key:"size",get:function get(){if(this.currentSprite){return this.currentSprite.size;}return void 0;}},{key:"rotation",get:function get(){if(this.currentSprite){return this.currentSprite.rotation;}return void 0;}},{key:"rotationWRTOutputRotation",get:function get(){if(this.currentSprite){var _this$editor$outputCo4=this.editor.outputContainer.getData(),t=_this$editor$outputCo4.flipHorizontally,e=_this$editor$outputCo4.flipVertically;var r=this.editor.outputContainer.getRotation();return $h({rotation:this.currentSprite.rotation-r,flipHorizontally:t,flipVertically:e});}return void 0;}},{key:"flipHorizontal",get:function get(){if(this.currentSprite){return this.currentSprite.flipHorizontally;}return void 0;}},{key:"isSpriteSticker",get:function get(){return this.tool==="sticker";}},{key:"isSpriteText",get:function get(){return this.tool==="text";}},{key:"isSpriteTextDesign",get:function get(){return this.tool==="textdesign";}},{key:"isOnTop",get:function get(){var t=this.counter;return this.editor.engine.isSpriteTop(this.id);}},{key:"spritePosition",get:function get(){if(this.currentSprite){var _this$currentSprite$p=this.currentSprite.position,t=_this$currentSprite$p.x,e=_this$currentSprite$p.y;var _this$currentSprite$s=this.currentSprite.size,r=_this$currentSprite$s.height,o=_this$currentSprite$s.width;return{x:Math.round(t-o/2),y:Math.round(e-r/2)};}return void 0;}},{key:"currentRect",get:function get(){if(this.currentSprite){return this.rect;}return void 0;}},{key:"leftTopPosition",get:function get(){if(this.currentSprite){return this.rect.leftTop;}return void 0;}},{key:"leftBottomPosition",get:function get(){if(this.currentSprite){return this.rect.leftBottom;}return void 0;}},{key:"leftMidPosition",get:function get(){if(this.currentSprite){return this.rect.leftMid;}return void 0;}},{key:"leftMidPadPosition",get:function get(){if(this.currentSprite){var t=this.rect.leftMid;return{x:t.x-this.editor.worldToPreview(this.padding),y:t.y};}return void 0;}},{key:"rightTopPosition",get:function get(){if(this.currentSprite){return this.rect.rightTop;}return void 0;}},{key:"rightBottomPosition",get:function get(){if(this.currentSprite){return this.rect.rightBottom;}return void 0;}},{key:"rightMidPosition",get:function get(){if(this.currentSprite){return this.rect.rightMid;}return void 0;}},{key:"rightMidPadPosition",get:function get(){if(this.currentSprite){var t=this.rect.rightMid;return{x:t.x+this.editor.worldToPreview(this.padding),y:t.y};}return void 0;}},{key:"leftBottomHandlePosition",get:function get(){if(this.currentSprite){return this.rect.leftBottomHandle;}return void 0;}},{key:"rightBottomHandlePosition",get:function get(){if(this.currentSprite){return this.rect.rightBottomHandle;}return void 0;}},{key:"historyLocale",get:function get(){if(this.isSpriteSticker){return this.stickerLocale;}if(this.isSpriteText){return this.textDesignLocale;}return this.textLocale;}},{key:"stickerLocale",get:function get(){return this.editor.configStore.locale["sticker"].history;}},{key:"textLocale",get:function get(){return this.editor.configStore.locale["text"].history;}},{key:"textDesignLocale",get:function get(){return this.editor.configStore.locale["textdesign"].history;}},{key:"setId",value:function setId(t){this.selectedId.set(t);}}],[{key:"magnitude",value:function magnitude(t,e){return new O(t,e||t).magnitude;}},{key:"sizeMagnitude",value:function sizeMagnitude(t){return Math.sqrt(t.width*t.width+t.height*t.height);}}]);return ef;}();nt=_ef;f([Q],nt.prototype,"counter",2);f([C],nt.prototype,"addSticker",2);f([C],nt.prototype,"addStickerAsync",2);f([C],nt.prototype,"addText",2);f([C],nt.prototype,"addTextAsync",2);f([C],nt.prototype,"addTextDesign",2);f([C],nt.prototype,"addTextDesignAsync",2);f([C],nt.prototype,"clickableCanvas",2);f([C],nt.prototype,"setContainerProperties",2);f([C],nt.prototype,"setContainerPosition",2);f([C],nt.prototype,"pureRemoveSprite",2);f([C],nt.prototype,"deleteSprite",2);f([C],nt.prototype,"removeSprite",2);f([C],nt.prototype,"addSnapshot",2);f([C],nt.prototype,"addNewText",2);f([C],nt.prototype,"addNewTextDesign",2);f([C],nt.prototype,"addNewSticker",2);f([C],nt.prototype,"updateStateFromSerialization",2);f([C],nt.prototype,"updateStateFromHistory",2);f([C],nt.prototype,"updateCanvasControls",2);f([C],nt.prototype,"setEditMode",2);f([C],nt.prototype,"setDragMode",2);f([C],nt.prototype,"setPosition",2);f([C],nt.prototype,"setSize",2);f([C],nt.prototype,"setRotation",2);f([C],nt.prototype,"onCanvasClick",2);f([C],nt.prototype,"select",2);f([C],nt.prototype,"selectLast",2);f([C],nt.prototype,"selectNext",2);f([C],nt.prototype,"deselect",2);f([C],nt.prototype,"bringToFront",2);f([C],nt.prototype,"flipHorizontally",2);f([C],nt.prototype,"pureReset",2);f([C],nt.prototype,"onCornerDrag",2);f([C],nt.prototype,"onWidthDrag",2);f([C],nt.prototype,"onPaddingDrag",2);f([C],nt.prototype,"correctTextFlip",2);f([C],nt.prototype,"reverseTextHorizontally",2);f([C],nt.prototype,"reverseTextVertically",2);f([C],nt.prototype,"dispose",2);f([S],nt.prototype,"currentSprite",1);f([S],nt.prototype,"padding",1);f([S],nt.prototype,"isEditMode",1);f([S],nt.prototype,"isDragMode",1);f([S],nt.prototype,"id",1);f([S],nt.prototype,"isSpriteSelected",1);f([S],nt.prototype,"position",1);f([S],nt.prototype,"tool",1);f([S],nt.prototype,"size",1);f([S],nt.prototype,"rotation",1);f([S],nt.prototype,"rotationWRTOutputRotation",1);f([S],nt.prototype,"flipHorizontal",1);f([S],nt.prototype,"isSpriteSticker",1);f([S],nt.prototype,"isSpriteText",1);f([S],nt.prototype,"isSpriteTextDesign",1);f([S],nt.prototype,"isOnTop",1);f([S],nt.prototype,"spritePosition",1);f([S],nt.prototype,"currentRect",1);f([S],nt.prototype,"leftTopPosition",1);f([S],nt.prototype,"leftBottomPosition",1);f([S],nt.prototype,"leftMidPosition",1);f([S],nt.prototype,"leftMidPadPosition",1);f([S],nt.prototype,"rightTopPosition",1);f([S],nt.prototype,"rightBottomPosition",1);f([S],nt.prototype,"rightMidPosition",1);f([S],nt.prototype,"rightMidPadPosition",1);f([S],nt.prototype,"leftBottomHandlePosition",1);f([S],nt.prototype,"rightBottomHandlePosition",1);f([S],nt.prototype,"historyLocale",1);f([S],nt.prototype,"stickerLocale",1);f([S],nt.prototype,"textLocale",1);f([S],nt.prototype,"textDesignLocale",1);});var tW=d(function(){eI();});var sct,fr;var iI=d(function(){Tt();R();sct={categories:[],query:""};fr=/*#__PURE__*/function(){function fr(t){var _this357=this;_classCallCheck(this,fr);this.initProvider=function(t){if(t){_this357.libraryProvider=new t();}};this.fetchImages=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee59(){var t,e,r,o,_args60=arguments;return regeneratorRuntime.wrap(function _callee59$(_context60){while(1){switch(_context60.prev=_context60.next){case 0:t=_args60.length>0&&_args60[0]!==undefined?_args60[0]:"";if(!_this357.libraryProvider){_context60.next=17;break;}e=null;_context60.prev=3;_context60.next=6;return _this357.libraryProvider.getCategories();case 6:r=_context60.sent;_context60.next=9;return _this357.libraryProvider.searchImages(t);case 9:o=_context60.sent;e=r.map(function(n,s){var a=o.filter(function(l){return l.category===n.name;});return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(function(l){return{name:l.title||"image".concat(s),identifier:"".concat(n.name,"-").concat(l.title,"-").concat(s),thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar};})};}).filter(function(n){return n.items.length;});_context60.next=16;break;case 13:_context60.prev=13;_context60.t0=_context60["catch"](3);console.log(_context60.t0);case 16:Ve(function(){_this357.state.query=t;_this357.state.categories=e;});case 17:case"end":return _context60.stop();}}},_callee59,null,[[3,13]]);}));this.toggleCategorySelection=function(t){_this357.selectedCategory=_this357.selectedCategory!==t?t:"";};this.dispose=function(){_this357.state=null;_this357.configStore=null;_this357.libraryProvider=null;_this357.selectedCategory=null;};this.getRawUrl=function(t){var e=_this357.items.findIndex(function(r){return r.identifier===t;});if(e!==-1){return _this357.items[e].rawUrl;}return t;};this.configStore=t.configStore;this.state=Q(sct);this.selectedCategory="";}_createClass(fr,[{key:"selectedCategoryIdentifier",get:function get(){return this.selectedCategory;}},{key:"categories",get:function get(){return this.state.categories;}},{key:"items",get:function get(){return this.state.categories.map(function(t){return t.items;}).reduce(function(t,e){return[].concat(_toConsumableArray(t),_toConsumableArray(e));},[]);}},{key:"query",get:function get(){return this.state.query;}},{key:"config",get:function get(){return this.configStore.config["library"];}},{key:"locale",get:function get(){return this.configStore.locale["library"];}}]);return fr;}();f([Q],fr.prototype,"selectedCategory",2);f([C],fr.prototype,"initProvider",2);f([C],fr.prototype,"fetchImages",2);f([C],fr.prototype,"toggleCategorySelection",2);f([C],fr.prototype,"dispose",2);f([S],fr.prototype,"selectedCategoryIdentifier",1);f([S],fr.prototype,"categories",1);f([S],fr.prototype,"items",1);f([S],fr.prototype,"query",1);f([S],fr.prototype,"config",1);f([S],fr.prototype,"locale",1);});var eW=d(function(){iI();});var iW,_Ri;var rW=d(function(){R();zn();U();iW=function iW(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"image/png";return"data:".concat(i,";base64,");};_Ri=/*#__PURE__*/function(){function Ri(t){var _this358=this;_classCallCheck(this,Ri);this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=function(t){var e=at.relativeToAbsolutePoint(t,_this358.cropSpace,false);return at.pointFromSpaceToSpace(e,_this358.cropSpace,_this358.imageSpace,false);};this.mapRelativeCropSizeToScaledImageSize=function(t){return t*Math.min(_this358.outputSize.height*_this358.outputScale.x,_this358.outputSize.width*_this358.outputScale.y);};this.mapRelativeCropSizeToUnscaledImageSize=function(t){return t*Math.min(_this358.outputSize.height,_this358.outputSize.width);};this.editor=t;}_createClass(Ri,[{key:"validateVersion",value:function validateVersion(t){return this.version===t;}},{key:"checkIsSerialisationValid",value:function checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object");}return false;}},{key:"deserializeImage",value:function deserializeImage(t){var e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(iW(),""):""};e.image.data=e.image.data?iW()+e.image.data:"";}return e;}},{key:"deserializeTransformation",value:function deserializeTransformation(t){var e={};var r=t.operations.find(function(s){return s.type==="orientation";});var o=t.operations.find(function(s){return s.type==="transform";});var _this$editor$engine$g=this.editor.engine.getRootContainers(),_this$editor$engine$g2=_slicedToArray(_this$editor$engine$g,1),n=_this$editor$engine$g2[0];this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=_Ri.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false;}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:"";}return e;}},{key:"deserialize",value:function deserialize(t){var _this359=this;var n,s;var e={};if(t.meta?!_Ri.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform");}var r=this.editor.engineMediator.output.container.getResolution();var _this$editor$engineMe2=this.editor.engineMediator.image.container.getBounds(),o=_this$editor$engineMe2.size;this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(function(a){switch(a.type){case"filter":e.filter=_Ri.deserializeFilter(a.options);break;case"adjustments":e.adjustment=_Ri.deserializeAdjustments(a.options);break;case"focus":e.focus=_this359.deserializeFocus(a.options);break;case"sprite":var l=a.options.sprites;l.forEach(function(c){switch(c.type){case"frame":e.frame=_this359.deserializeFrame(c.options);break;case"overlay":e.overlay=_Ri.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=_this359.deserializeBrush(c.options);}else{var _e$brush$strokes;(_e$brush$strokes=e.brush.strokes).push.apply(_e$brush$strokes,_toConsumableArray(_this359.deserializeBrush(c.options).strokes));}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}};}var u=At();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:_this359.spriteOrder,position:_this359.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};_this359.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:_this359.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:_this359.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=_Ri.deserializeStickers(c.options);}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=_this359.deserializeTexts(c.options);}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=_this359.deserializeTextDesign(c.options);}break;default:break;}});break;default:break;}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[];}return e;}},{key:"deserializeFrame",value:function deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:_Ri.deserialzeColor(t.tintColor)};}},{key:"deserializeFocus",value:function deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:break;}return void 0;}},{key:"deserializeRadialFocus",value:function deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeLinearFocus",value:function deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeGaussianFocus",value:function deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeMirroredFocus",value:function deserializeMirroredFocus(t){var e=new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new O(this.mapRelativeCropPointToImageSpace(t.start)).add(new O(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeTexts",value:function deserializeTexts(t){return{identifier:hn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:_Ri.deserialzeColor(t.color),backgroundColor:_Ri.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text};}},{key:"deserializeTextDesign",value:function deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:_Ri.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted};}},{key:"deserializeBrush",value:function deserializeBrush(t){var _this360=this;return{strokes:t.paths.map(function(e){return{path:{controlPoints:e.points.map(_this360.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:_Ri.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}};})};}}],[{key:"deserializeFilter",value:function deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier};}},{key:"deserializeAdjustments",value:function deserializeAdjustments(t){return _objectSpread({},t);}},{key:"deserializeOverlay",value:function deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,function(e){return e.toUpperCase().replace(" ","").replace("_","");})};}},{key:"initializeEmptyTransform",value:function initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0};}},{key:"deserialzeColor",value:function deserialzeColor(t){if(t){if(t.rgba){return t.rgba;}}return[0,0,0,0];}},{key:"checkIfPlatformHTML",value:function checkIfPlatformHTML(t){return t==="html5";}},{key:"deserializeStickers",value:function deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:_Ri.deserialzeColor(t.tintColor)};}}]);return Ri;}();});var oW,_Ai;var nW=d(function(){R();zn();U();oW=function oW(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"image/png";return"data:".concat(i,";base64,");};_Ai=/*#__PURE__*/function(){function Ai(t){var _this361=this;_classCallCheck(this,Ai);this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=function(t){var e=at.relativeToAbsolutePoint(t,_this361.cropSpace,false);return at.pointFromSpaceToSpace(e,_this361.cropSpace,_this361.imageSpace,false);};this.mapRelativeCropSizeToScaledImageSize=function(t){return t*Math.min(_this361.outputSize.height*_this361.outputScale.x,_this361.outputSize.width*_this361.outputScale.y);};this.mapRelativeCropSizeToUnscaledImageSize=function(t){return t*Math.min(_this361.outputSize.height,_this361.outputSize.width);};this.editor=t;}_createClass(Ai,[{key:"validateVersion",value:function validateVersion(t){return this.version===t;}},{key:"checkIsSerialisationValid",value:function checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object");}return false;}},{key:"deserializeImage",value:function deserializeImage(t){var e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(oW(),""):""};e.image.data=e.image.data?oW()+e.image.data:"";}return e;}},{key:"deserializeTransformation",value:function deserializeTransformation(t){var e={};var r=t.operations.find(function(s){return s.type==="orientation";});var o=t.operations.find(function(s){return s.type==="transform";});var _this$editor$engine$g3=this.editor.engine.getRootContainers(),_this$editor$engine$g4=_slicedToArray(_this$editor$engine$g3,1),n=_this$editor$engine$g4[0];this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=_Ai.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false;}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:"";}return e;}},{key:"deserialize",value:function deserialize(t){var _this362=this;var n,s;var e={};if(t.meta?!_Ai.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform");}var r=this.editor.engineMediator.output.container.getResolution();var _this$editor$engineMe3=this.editor.engineMediator.image.container.getBounds(),o=_this$editor$engineMe3.size;this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(function(a){switch(a.type){case"filter":e.filter=_Ai.deserializeFilter(a.options);break;case"adjustments":e.adjustment=_Ai.deserializeAdjustments(a.options);break;case"focus":e.focus=_this362.deserializeFocus(a.options);break;case"sprite":var l=a.options.sprites;l.forEach(function(c){switch(c.type){case"frame":e.frame=_this362.deserializeFrame(c.options);break;case"overlay":e.overlay=_Ai.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=_this362.deserializeBrush(c.options);}else{var _e$brush$strokes2;(_e$brush$strokes2=e.brush.strokes).push.apply(_e$brush$strokes2,_toConsumableArray(_this362.deserializeBrush(c.options).strokes));}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}};}var u=At();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:_this362.spriteOrder,position:_this362.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};_this362.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:_this362.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:_this362.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=_Ai.deserializeStickers(c.options);}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=_this362.deserializeTexts(c.options);}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=_this362.deserializeTextDesign(c.options);}break;default:break;}});break;default:break;}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[];}return e;}},{key:"deserializeFrame",value:function deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:_Ai.deserialzeColor(t.tintColor)};}},{key:"deserializeFocus",value:function deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:return void 0;}}},{key:"deserializeRadialFocus",value:function deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeLinearFocus",value:function deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeGaussianFocus",value:function deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeMirroredFocus",value:function deserializeMirroredFocus(t){var e=new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new O(this.mapRelativeCropPointToImageSpace(t.start)).add(new O(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)};}},{key:"deserializeTexts",value:function deserializeTexts(t){return{identifier:hn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:_Ai.deserialzeColor(t.color),backgroundColor:_Ai.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text};}},{key:"deserializeTextDesign",value:function deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:_Ai.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted};}},{key:"deserializeBrush",value:function deserializeBrush(t){var _this363=this;return{strokes:t.paths.map(function(e){return{path:{controlPoints:e.points.map(_this363.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:_Ai.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}};})};}}],[{key:"deserializeFilter",value:function deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier};}},{key:"deserializeAdjustments",value:function deserializeAdjustments(t){return _objectSpread({},t);}},{key:"deserializeOverlay",value:function deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,function(e){return e.toUpperCase().replace(" ","").replace("_","");})};}},{key:"initializeEmptyTransform",value:function initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0};}},{key:"deserialzeColor",value:function deserialzeColor(t){if(t){if(t.rgba){return t.rgba;}}return[0,0,0,0];}},{key:"checkIfPlatformHTML",value:function checkIfPlatformHTML(t){return t==="html5";}},{key:"deserializeStickers",value:function deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:_Ai.deserialzeColor(t.tintColor)};}}]);return Ai;}();});var act,lct,cct,uct,dct,mct,pct,hct,fct,gct,bct,yct,_ct,xct,vct,aW;var sW=d(function(){act="@photoeditorsdk/root";lct="5.19.3";cct="The most comprehensive photo editor SDK for HTML5";uct="http://github.com/imgly/pesdk-html5";dct="PhotoEditorSDK (img.ly GmbH) ";mct="SEE LICENSE IN LICENSE.md";pct=true;hct={};fct={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};gct={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};bct={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};yct={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};_ct={eslint:"7.10.0"};xct=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];vct={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};aW={name:act,version:lct,description:cct,repository:uct,author:dct,license:mct,"private":pct,bin:hct,scripts:fct,devDependencies:gct,dependencies:bct,devEngines:yct,resolutions:_ct,workspaces:xct,husky:vct};});var _pu;var lW=d(function(){R();zn();sW();_pu=/*#__PURE__*/function(){function pu(t,e,r,o,n,s){var _this364=this;_classCallCheck(this,pu);this.version="3.12.0";this.mapImagePointToRelativeCropPoint=function(t){var e=at.pointFromSpaceToSpace(t,_this364.imageSpace,_this364.cropSpace,false);return at.absoluteToRelativePoint(e,_this364.cropSpace,false);};this.mapSizeToRelativeUnscaledCropSize=function(t){return t/Math.min(_this364.outputSize.height,_this364.outputSize.width);};this.mapSizeToRelativeScaledCropSize=function(t){return t/Math.min(_this364.outputSize.height*_this364.outputScale.x,_this364.outputSize.width*_this364.outputScale.y);};this.getPointInDirection=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3;var o=Math.tan(e);var n=Math.sqrt(Math.pow(o,2)+1);return{x:t.x+r/n,y:t.y+r*o/n};};this.previewPosition=t;this.previewSize=e;this.outputSize=r;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale();}_createClass(pu,[{key:"serialise",value:function serialise(t,e,r){var _this365=this;var o=_pu.serializeMetaData();var n={width:this.imageSize.width,height:this.imageSize.height};if(e){n.type=r;n.data=e;}var s=[];var a=[];var l=t.adjustment;if(Object.keys(l).map(function(x){return l[x];}).filter(Boolean).length){s.push(_pu.serializeAdjustments(l));}var c=t.filter;if(c.identifier!=="identity"){s.push(_pu.serializeFilters(c));}var u=t.overlay;if(u.identifier!=="identity"){a.push(_pu.serializeOverlay(u));}if(t.transform){var _this$serializeTransf=this.serializeTransform(t.transform),x=_this$serializeTransf.transform,v=_this$serializeTransf.orientation;var b=[x.options.start.x!==0,x.options.start.y!==0,x.options.end.x!==1,x.options.end.y!==1,x.options.rotation!==0];var T=[v.options.rotation!==0,v.options.flipVertically!==false,v.options.flipHorizontally!==false];if(b.some(function(k){return k;})){s.push(x);}if(T.some(function(k){return k;})){s.push(v);}}var m=t.frame;if(m.identifier!=="identity"){a.push(this.serialzeFrame(m));}var p=t.focus;if(p.identifier!=="identity"){s.push(this.serializeFocus(p));}if(t.sprite){t.sprite.spriteIdList.forEach(function(x){var v=t.sprite.common[x];switch(v.tool){case"sticker":var _b9=t.sprite.sticker[x];a.push(_this365.serializeSticker(_b9,v,t.transform));break;case"text":var _T3=t.sprite.text[x];a.push(_this365.serializeText(_T3,v));break;case"textdesign":var k=t.sprite.textdesign[x];a.push(_this365.serializeTextDesign(k,v));break;default:break;}});}if(t.brush.strokes.length){a.push({type:"brush",options:{paths:t.brush.strokes.map(function(x){return{points:x.path.controlPoints.map(_this365.mapImagePointToRelativeCropPoint),brush:{color:{rgba:x.brush.color},size:x.brush.size,hardness:x.brush.hardness}};})}});}if(a.length){var _x65={type:"sprite",options:{sprites:a}};s.push(_x65);}var h=t.customStickers;var g={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:g};}},{key:"serialzeFrame",value:function serialzeFrame(t){return{type:"frame",options:{identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.color},size:this.mapSizeToRelativeUnscaledCropSize(t.width)}};}},{key:"serializeFocus",value:function serializeFocus(t){var e=Math.sqrt(Math.pow(this.previewSize.width,2)+Math.pow(this.previewSize.height,2));switch(t.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(t.linear.start),end:this.mapImagePointToRelativeCropPoint(t.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(t.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(t.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(t.radial.center,0,t.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(t.radial.blurRadius),gradientRadius:.1}}};case"mirrored":var r=t.mirrored;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,e/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,-e/2)),size:this.mapSizeToRelativeScaledCropSize(t.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(t.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(t.gaussian.blurRadius)}}};}}},{key:"serializeSticker",value:function serializeSticker(t,e,r){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(e.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(e.size.width),y:this.mapSizeToRelativeScaledCropSize(e.size.height)},rotation:e.rotation,flipVertically:(e.flipVertically||false)!==(r.flipVertically||false),flipHorizontally:(e.flipHorizontally||false)!==(r.flipHorizontally||false),identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.tintColor},tintMode:t.tintMode}};}},{key:"serializeText",value:function serializeText(t,e){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:t.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(t.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(t.width),text:t.text,lineHeight:t.lineHeight,color:{rgba:t.textColor},backgroundColor:{rgba:t.backgroundColor},alignment:t.alignment}};}},{key:"serializeTextDesign",value:function serializeTextDesign(t,e){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,identifier:t.identifier,inverted:t.isInverted,text:t.text,seed:t.seed,width:this.mapSizeToRelativeScaledCropSize(t.width),padding:this.mapSizeToRelativeScaledCropSize(t.padding),color:{rgba:t.color}}};}},{key:"serializeTransform",value:function serializeTransform(t){var e=t.start,r=t.end;var o={type:"transform",options:{start:e,end:r,rotation:t.rotation,meta:{identifier:t.identifier}}};var n={type:"orientation",options:{rotation:t.outputRotation,flipHorizontally:t.flipHorizontally,flipVertically:t.flipVertically}};return{transform:o,orientation:n};}}],[{key:"serializeFilters",value:function serializeFilters(t){return{type:"filter",options:{intensity:t.intensity,identifier:t.identifier}};}},{key:"serializeAdjustments",value:function serializeAdjustments(t){return{type:"adjustments",options:t};}},{key:"serializeOverlay",value:function serializeOverlay(t){return{type:"overlay",options:{identifier:t.identifier,intensity:t.opacity,blendMode:t.blendMode.replace(/[A-Z]/g,function(e){return" ".concat(e.toLowerCase());})}};}},{key:"serializeMetaData",value:function serializeMetaData(){return{platform:"html5",version:aW.version,createdAt:new Date().toISOString()};}}]);return pu;}();});var rI={};de(rI,{Deserializers:function Deserializers(){return Cct;},Serializer:function Serializer(){return _pu;}});var Cct;var oI=d(function(){rW();nW();lW();Cct={"3.9.0":_Ai,"3.12.0":_Ri};});var cW,Sct,wct,Tct,_rf;var uW=d(function(){Tt();R();U();cW=/^data:image\/(.+?);base64,/;Sct=function Sct(i){return cW.test(i);};wct=function wct(i){return i.match(/^data:([^;]+)/)[1];};Tct=function Tct(i){return i.replace(cW,"");};_rf=/*#__PURE__*/function(){function rf(t){var _this366=this;_classCallCheck(this,rf);this.applySerialization=/*#__PURE__*/function(){var _ref198=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee60(t,e,r,o){var n,s,a,u,l,c;return regeneratorRuntime.wrap(function _callee60$(_context61){while(1){switch(_context61.prev=_context61.next){case 0:_this366.editor.resetToolStates();n=_this366.editor.activeStore.tool==="transform";if(!n){_this366.editor.transformToolStore.onEnter();}_this366.editor.transformToolStore.reset();if(!n){_this366.editor.transformToolStore.onLeave();}s="Unexpected error occured";a=e.deserializeImage(t);if(!(a.image&&a.image.data)){_context61.next=23;break;}u=a.image.data;_context61.next=11;return _this366.editor.setImage(u);case 11:_this366.editor.scale.defaultScale=1;_this366.editor.scale.resetOffset();_this366.editor.transformToolStore.reset();_this366.editor.activeStore.setImage(u);_context61.next=17;return _this366.editor.engineMediator.image.addImageToContainer();case 17:_this366.editor.engineMediator.output.applyNewImageTransform();_this366.editor.engineMediator.preview.updateTransform();_this366.editor.scale.setInitialTransform();_this366.editor.transformToolStore.setCropDefaults();_this366.editor.historyStore.addInitialSnapshot();_this366.editor.transformToolStore.saveTransforms();case 23:l=e.deserializeTransformation(t);if(l){_context61.next=27;break;}o(s);return _context61.abrupt("return");case 27:_context61.next=29;return _this366.applyStateOnUI(l);case 29:c=e.deserialize(t);if(c){_context61.next=33;break;}o(s);return _context61.abrupt("return");case 33:_context61.next=35;return _this366.applyStateOnUI(c);case 35:_this366.editor.historyStore.addInitialSnapshot();if(n){_this366.editor.transformToolStore.onEnter();}_context61.next=39;return _this366.editor.render();case 39:if(_this366.editor.modalStore.identifier==="loading"){_this366.editor.modalStore.hideModal();}r();case 41:case"end":return _context61.stop();}}},_callee60);}));return function(_x66,_x67,_x68,_x69){return _ref198.apply(this,arguments);};}();this.editor=t;}_createClass(rf,[{key:"serialize",value:function serialize(){var _this367=this;var _ref199=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{image:false},t=_ref199.image;var e=this.editor.activeStore.tool==="transform";var r=this.editor.configStore.config.displaySerializationModal;if(r){this.editor.modalStore.showInfoModal("saving");}return new Promise(function(o,n){Promise.resolve().then(function(){return oI(),rI;}).then(/*#__PURE__*/function(){var _ref201=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee61(_ref200){var s,_m12,_this367$editor$image,a,l,c,u,m,_yield$_this367$edito,p,h,g,x,v;return regeneratorRuntime.wrap(function _callee61$(_context62){while(1){switch(_context62.prev=_context62.next){case 0:s=_ref200.Serializer;_context62.prev=1;if(e){_this367.editor.transformToolStore.onLeave();}_context62.next=5;return _this367.editor.wait();case 5:_this367.editor.transformToolStore.applyDefaultCrop(false);_this367$editor$image=_this367.editor.imageContainer.getData(),a=_this367$editor$image.originalImage;l=_this367.editor.engineMediator.output.container.getResolution();c={width:a.width,height:a.height};u=new s(_this367.editor.transformToolStore.defaultCropMaskPosition,_this367.editor.transformToolStore.maxCropMaskSize,l,c,_this367.editor.engine.getRootContainers()[0],_this367.editor.engine.getOutputContainer());m=(_m12={},_defineProperty(_m12,"adjustment",ct(_this367.editor.adjustmentsToolStore.state)),_defineProperty(_m12,"filter",ct(_this367.editor.filterToolStore.state)),_defineProperty(_m12,"focus",ct(_this367.editor.focusToolStore.serializableState)),_defineProperty(_m12,"overlay",ct(_this367.editor.overlayToolStore.state)),_defineProperty(_m12,"frame",ct(_this367.editor.frameToolStore.state)),_defineProperty(_m12,"brush",_this367.editor.brushToolStore.strokes||{strokes:[]}),_m12);_context62.next=13;return _this367.editor.spriteStore.serializableState();case 13:_yield$_this367$edito=_context62.sent;p=_yield$_this367$edito.sprite;h=_yield$_this367$edito.customStickers;p.spriteIdList=p.spriteIdList.sort(function(v,b){var T=p.common[v].order;var k=p.common[b].order;return T-k;});m.sprite=p;m.customStickers=h;m.transform=_this367.editor.transformToolStore.serializableState;if(t){v=_rf.getDataURL(a);x=wct(v);g=Tct(v);}if(r){_this367.editor.modalStore.hideModal();}o(u.serialise(m,g,x));if(e){_this367.editor.transformToolStore.onEnter();}_context62.next=30;break;case 26:_context62.prev=26;_context62.t0=_context62["catch"](1);if(r){_this367.editor.modalStore.hideModal();}n(_context62.t0);case 30:case"end":return _context62.stop();}}},_callee61,null,[[1,26]]);}));return function(_x70){return _ref201.apply(this,arguments);};}());});}},{key:"deserialize",value:function deserialize(t){var _this368=this;this.editor.modalStore.showInfoModal("loading");return new Promise(function(e,r){try{Promise.resolve().then(function(){return oI(),rI;}).then(function(_ref202){var o=_ref202.Deserializers;var n=t.version.match(/[0-3].[0-8].[0-9]/i);var s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](_this368.editor);}else if(o[t.version]){s=new o[t.version](_this368.editor);}else{s=new o["3.12.0"](_this368.editor);}if(n){_this368.editor.modalStore.hideModal();_this368.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:function handleConfirm(){return _this368.applySerialization(t,s,e,r);}});}else{_this368.applySerialization(t,s,e,r);}});}catch(o){if(_this368.editor.modalStore.identifier==="loading"){_this368.editor.modalStore.hideModal();}r(o);}});}},{key:"applyStateOnUI",value:function(){var _applyStateOnUI=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee62(t){var _this369=this;var e,r;return regeneratorRuntime.wrap(function _callee62$(_context63){while(1){switch(_context63.prev=_context63.next){case 0:e=this.editor.activeStore.tool==="transform";_context63.prev=1;if(!t.transform){_context63.next=13;break;}if(!e){this.editor.transformToolStore.onEnter();}this.editor.transformToolStore.updateStateFromSerialization(t.transform);_context63.next=7;return this.editor.wait();case 7:this.editor.transformToolStore.onLeave();if(e){_context63.next=13;break;}this.editor.transformToolStore.onEnter();_context63.next=12;return this.editor.wait();case 12:this.editor.transformToolStore.onLeave();case 13:if(!t.filter){_context63.next=16;break;}_context63.next=16;return this.editor.filterToolStore.updateStateFromSerialization(t.filter);case 16:if(t.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(t.adjustment);}if(!t.focus){_context63.next=20;break;}_context63.next=20;return this.editor.focusToolStore.updateStateFromSerialization(t.focus);case 20:if(!t.overlay){_context63.next=23;break;}_context63.next=23;return this.editor.overlayToolStore.updateStateFromSerialization(t.overlay);case 23:if(!t.sprite){_context63.next=29;break;}r=Object.keys(t).length-1;if(t.customStickers){r-=1;}t.sprite.spriteIdList=t.sprite.spriteIdList.sort(function(o,n){var s=t.sprite.common[o].order;var a=t.sprite.common[n].order;return s-a;});_context63.next=29;return this.editor.spriteStore.updateStateFromSerialization(t.sprite,t.customStickers,Math.max(0,r));case 29:if(t.brush){this.editor.brushToolStore.updateStateFromHistory(t.brush);}if(!t.frame){_context63.next=33;break;}_context63.next=33;return this.editor.frameToolStore.updateStateFromSerialization(t.frame);case 33:this.editor.outputContainer.updateChildrenContainers();_context63.next=39;break;case 36:_context63.prev=36;_context63.t0=_context63["catch"](1);if(_context63.t0.name==="AssetNotFoundError"){console.error(_context63.t0);}else{console.error(_context63.t0);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:_context63.t0.message,handleConfirm:function handleConfirm(){_this369.applyStateOnUI(t);}});}case 39:case"end":return _context63.stop();}}},_callee62,this,[[1,36]]);}));function applyStateOnUI(_x71){return _applyStateOnUI.apply(this,arguments);}return applyStateOnUI;}()}],[{key:"getDataURL",value:function getDataURL(t){if(t instanceof HTMLImageElement){var n=t.src;if(Sct(n)){return n;}}if(t instanceof HTMLCanvasElement){return t.toDataURL("image/png");}var e=document.createElement("canvas");e.width=t.width;e.height=t.height;var r=e.getContext("2d");r.drawImage(t,0,0);var o=e.toDataURL("image/png");$t(e);return o;}}]);return rf;}();});var kct,nI;var dW=d(function(){kct=function kct(i){var t=atob(i.split(",")[1]);var e=i.split(",")[0].split(":")[1].split(";")[0];var r=new ArrayBuffer(t.length);var o=new Uint8Array(r);for(var n=0;nt){return t-r;}for(var n=0;n=a-m){return a+u+(o?r*2:0);}return _this376.mapRange({value:t,fromMin:s,fromLength:a-s,toMin:l,toLength:c-l});}}if(o){return t+(e.length-1)*r*2+r;}return t;};this.mapFromSnapSystem=function(t,e,r,o){if(e.length===0){return t;}if(e[0]>t){if(t>=e[0]-r){return e[0];}return t+r;}var n=t;for(var a=0;a1&&_args71[1]!==undefined?_args71[1]:false;_context71.prev=1;if(_this377.activeStore.image){_context71.next=6;break;}_this377.initWithImage(t);_context71.next=34;break;case 6:_this377.activeStore.setImageLoadedToEngine(false);_this377.modalStore.showInfoModal(_this377.configStore.config.displayResizeWarning?"resizing":"loading");_this377.scale.defaultScale=1;_this377.scale.resetOffset();_context71.next=12;return _this377.activeStore.setImage(t);case 12:_context71.next=14;return _this377.engineMediator.image.addImageToContainer();case 14:_this377.canvasStore.resizeCanvas();_this377.engineMediator.output.applyNewImageTransform();_this377.engineMediator.preview.updateTransform();_this377.scale.setInitialTransform();_this377.transformToolStore.setCropDefaults();_this377$transformToo=_this377.transformToolStore.rotateFlipState,_r22=_this377$transformToo.flipHorizontally,o=_this377$transformToo.flipVertically,n=_this377$transformToo.outputRotation;_this377.outputContainer.setData({flipVertically:o,flipHorizontally:_r22});_context71.next=23;return _this377.transformToolStore.rotateOutputContainer(xp(n),false);case 23:if(e){_this377.focusToolStore.updateCanvasControls();_this377.spriteStore.updateCanvasControls();_this377.transformToolStore.resetCrop();_this377.transformToolStore.applyDefaultCrop();_this377.transformToolStore.saveTransforms();_this377.transformToolStore.onEnter();_this377.transformToolStore.setRotation(_this377.transformToolStore.rotationInDegrees);_this377.transformToolStore.onLeave();_this377.transformToolStore.onEnter();_this377.transformToolStore.onLeave();}else{_this377.transformToolStore.saveTransforms();}_this377.snappingStore.calculatePreviewTopLeftPosition();_this377.historyStore.addInitialSnapshot();_context71.next=28;return _this377.renderPromise();case 28:if(_this377.configStore.config.filter.enablePreviewThumbnails&&_this377.configStore.config.engine.preferredRenderer==="webgl"){_this377.filterToolStore.setImageAndGetPreviews();}s=_this377.activeStore.tool;if(!s){_this377.onReady();}else{_this377.configStore.events.onImageLoaded();}if(!(_this377.modalStore.identifier==="imageResized")){_this377.modalStore.hideModal();}_this377.activeStore.setImageLoadedToEngine(true);_this377.resize();case 34:_context71.next=42;break;case 36:_context71.prev=36;_context71.t0=_context71["catch"](1);_this377.configStore.events.onErrorImageLoading(_context71.t0);_this377.modalStore.hideModal();_this377.modalStore.showActionModal({type:"error",identifier:_context71.t0.identifier?_context71.t0.identifier:"rendering",error:_context71.t0,handleConfirm:function handleConfirm(){_this377.setImage(t,e);},handleDismiss:function handleDismiss(){_this377.activeStore.setImage(void 0);}});throw new Error(_context71.t0);case 42:case"end":return _context71.stop();}}},_callee70,null,[[1,36]]);}));return function(_x79){return _ref211.apply(this,arguments);};}();this.onToolChange=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var o,n;if(t===e){return;}if((n=(o=_this377.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([t,e].indexOf("transform")!==-1){if(t==="transform"){_this377.transformToolStore.onLeave();_this377.transformToolStore.addSnapshot();_this377.snappingStore.calculatePreviewTopLeftPosition();}else if(e==="transform"){_this377.transformToolStore.onEnter();}_this377.resize(e);}else{_this377.scale.resetOffset();_this377.scale.resetPosition();_this377.scale.setScaleToDefault();_this377.scale.scaleRender(true);}if(r){_this377.render();}}};this.resize=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;if(!_this377.engineMediator)return;try{var _e33=_this377.activeStore.tool;var _r23=t==="transform"||!t&&_e33==="transform";_this377.canvasStore.resizeCanvas(t);_this377.transformToolStore.applyDefaultCrop();var o=ct(_this377.transformToolStore.maxCropMaskSize);if(!_r23){_this377.transformToolStore.onEnter();}var n=_this377.engineMediator.preview.container.getRotation();var s=_this377.engineMediator.preview.updateTransform(n);if(s){_this377.scale.setInitialTransform();_this377.transformToolStore.setCropDefaults();_this377.transformToolStore.updateCanvasControls(o);_this377.focusToolStore.updateCanvasControls();_this377.spriteStore.updateCanvasControls();var a=_this377.transformToolStore.getScaleWithFlip(n);_this377.engineMediator.preview.container.setScale(a);if(!_r23){_this377.transformToolStore.onLeave();_this377.transformToolStore.onEnter();_this377.transformToolStore.onLeave();}_this377.snappingStore.calculatePreviewTopLeftPosition();_this377.render();}}catch(e){_this377.configStore.events.onErrorImageLoading(e);_this377.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:function handleConfirm(){_this377.resize(t);},handleDismiss:function handleDismiss(){_this377.activeStore.setImage(void 0);}});}};this["export"]=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee71(){var _ref213,t,e,r,o,n,s,a,l,c,u,m,_args72=arguments;return regeneratorRuntime.wrap(function _callee71$(_context72){while(1){switch(_context72.prev=_context72.next){case 0:_ref213=_args72.length>0&&_args72[0]!==undefined?_args72[0]:{},t=_ref213.preventExportEvent,e=_objectWithoutProperties(_ref213,_excluded7);r=_this377.activeStore.tool==="transform";_context72.prev=2;_this377.modalStore.showInfoModal("exporting");if(r){_this377.transformToolStore.onLeave();}o=_this377.configStore.config;n=_objectSpread(_objectSpread({},o["export"].image),e);s=n.exportType,a=n.format,l=n.quality,c=n.enableDownload,u=n.transparent;_context72.next=10;return _this377.engineMediator.engine["export"](s,a,l,u);case 10:m=_context72.sent;if(!(r&&_this377.transformToolStore)){_context72.next=15;break;}_this377.transformToolStore.onEnter();_context72.next=15;return _this377.render();case 15:if(_this377.historyStore){_this377.historyStore.isDirtySinceSave=false;}if(_this377.modalStore){_this377.modalStore.hideModal();}if(c){_this377.triggerFileDownload(o["export"].filename,a,s,m);}if(!t){_this377.configStore.events.onExport(m);}return _context72.abrupt("return",m);case 22:_context72.prev=22;_context72.t0=_context72["catch"](2);if(_this377.modalStore){_this377.modalStore.hideModal();}if(!(r&&_this377.transformToolStore)){_context72.next=29;break;}_this377.transformToolStore.onEnter();_context72.next=29;return _this377.render();case 29:throw new Error(_context72.t0);case 30:case"end":return _context72.stop();}}},_callee71,null,[[2,22]]);}));this.serialize=function(){var _ref214=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{image:true},t=_ref214.image;if(_this377.serializationMediator){return _this377.serializationMediator.serialize({image:t});}return Promise.resolve({});};this.deserialize=function(t){if(_this377.serializationMediator){return _this377.serializationMediator.deserialize(t);}return Promise.resolve();};this.close=function(){var t,e,r,o,n,s;if((((t=_this377.historyStore)==null?void 0:t.isDirtySinceSave)||((r=(e=_this377.transformToolStore)==null?void 0:e.transformHistory)==null?void 0:r.hasChanges()))&&((n=(o=_this377.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&_this377.modalStore){_this377.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:function handleConfirm(){var a;if((a=_this377.configStore)==null?void 0:a.events){_this377.configStore.events.onClose();}}});}else if((s=_this377.configStore)==null?void 0:s.events){_this377.configStore.events.onClose();}};this.hasChanges=function(){if(_this377.historyStore){return _this377.historyStore.isDirtySinceSave;}return false;};this.getImageDimensions=function(){if(_this377.engine){var _this377$engine$getOu=_this377.engine.getOutputDimensions(),_t45=_this377$engine$getOu.width,_e34=_this377$engine$getOu.height;return{width:_t45,height:_e34};}return{width:0,height:0};};this.wait=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;return new Promise(function(e){return setTimeout(e,t);});};this.clickableCanvas=/*#__PURE__*/function(){var _ref215=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee72(t){return regeneratorRuntime.wrap(function _callee72$(_context73){while(1){switch(_context73.prev=_context73.next){case 0:if(!t){_context73.next=6;break;}_context73.next=3;return new Promise(function(e){return setTimeout(e,0);});case 3:_this377.canvasStore.enableCanvasClick();_context73.next=7;break;case 6:_this377.canvasStore.disableCanvasClick();case 7:case"end":return _context73.stop();}}},_callee72);}));return function(_x80){return _ref215.apply(this,arguments);};}();this.onReady=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee73(){var t,_e35,_r24,o;return regeneratorRuntime.wrap(function _callee73$(_context74){while(1){switch(_context74.prev=_context74.next){case 0:t=_this377.configStore.config.forceCrop;_this377.activeStore.selectTool(_this377.configStore.defaultTool);if(t){_e35=_this377.transformToolStore.localOutputImageSize;_r24=_e35.width/_e35.height;o=_this377.transformToolStore.entityManager.items.map(function(n){if(n.ratio){return n.ratio;}return n.dimensions.x/n.dimensions.y;});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios');}else if(o.indexOf(parseFloat(_r24.toFixed(2)))===-1){_this377.activeStore.selectTool("transform");}}_this377.configStore.events.onEditorReady();case 4:case"end":return _context74.stop();}}},_callee73);}));this.addSnapshot=function(t,e,r){_this377.historyStore.addSnapshot(t,e,r);};this.resetToolStates=function(){_this377.transformToolStore.pureReset();_this377.filterToolStore.pureReset();_this377.focusToolStore.pureReset();_this377.adjustmentsToolStore.pureReset();_this377.overlayToolStore.pureReset();_this377.frameToolStore.pureReset();_this377.brushToolStore.pureReset();_this377.spriteStore.pureReset();_this377.historyStore.reset();_this377.render();};this.getAssetPath=function(t){return _this377.assetProvider.getPathForCategory(t);};this.render=/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee74(){return regeneratorRuntime.wrap(function _callee74$(_context75){while(1){switch(_context75.prev=_context75.next){case 0:_context75.next=2;return _this377.renderPromise();case 2:case"end":return _context75.stop();}}},_callee74);}));this.applyFlipToPreview=function(t){if(!_this377.engineMediator)return{x:0,y:0};return _this377.engineMediator.previewSpaceToFlippedPreviewSpace(t);};this.getPreviewSize=function(){if(!_this377.engine)return{width:0,height:0};var _this377$engine$getOu2=_this377.engine.getOutputDimensions(),t=_this377$engine$getOu2.width,e=_this377$engine$getOu2.height;if(t&&e){return{width:Math.round(_this377.worldToPreview(_this377.outputToWorld(t))),height:Math.round(_this377.worldToPreview(_this377.outputToWorld(e)))};}return{height:e,width:t};};this.getImageMimeType=function(){return pW(_this377.activeStore.image);};this.cleanUpCanvasMemory=function(){var t,e,r;(r=(e=(t=_this377.engineMediator)==null?void 0:t.image)==null?void 0:e.container)==null?void 0:r.dispose();};this.dispose=function(){if(_this377.engineMediator){_this377.engineMediator.dispose();_this377.engineMediator=null;}_this377.serializationMediator=null;if(_this377.spriteStore){_this377.spriteStore.dispose();_this377.spriteStore=null;}_this377.scale=null;_this377.filterToolStore=null;_this377.adjustmentsToolStore=null;_this377.focusToolStore=null;_this377.overlayToolStore=null;_this377.frameToolStore=null;_this377.brushToolStore=null;if(_this377.transformToolStore){_this377.transformToolStore.dispose();_this377.transformToolStore=null;}if(_this377.libraryStore){_this377.libraryStore.dispose();_this377.libraryStore=null;}if(_this377.modalStore){_this377.modalStore.dispose();_this377.modalStore=null;}if(_this377.snappingStore){_this377.snappingStore.dispose();_this377.snappingStore=null;}if(_this377.activeStore){_this377.activeStore.dispose();_this377.activeStore=null;}if(_this377.canvasStore){_this377.canvasStore.dispose();_this377.canvasStore=null;}_this377.historyStore=null;if(_this377.configStore){_this377.configStore.dispose();_this377.configStore=null;}};this.triggerFileDownload=function(t,e,r,o){var n=e==="image/jpeg"&&r!=="ms-blob"?".jpeg":".png";var s=t+n;var a=_this377.blobFromExportData(o);_this377.triggerBlobDownload(s,a);};this.triggerBlobDownload=function(t,e){if(navigator.msSaveBlob){navigator.msSaveBlob(e,t);}else{var _r25=document.createElement("a");var o=URL.createObjectURL(e);_r25.href=o;_r25.download=t;document.body.appendChild(_r25);_r25.click();document.body.removeChild(_r25);if(!HF()){URL.revokeObjectURL(o);}}};this.blobFromExportData=function(t){if(typeof t==="string"){return nI(t);}if(t instanceof HTMLImageElement){return nI(t.src);}return t;};this.configStore=new Qi();if(e){Object.entries(e).forEach(function(_ref218){var _ref219=_slicedToArray(_ref218,2),o=_ref219[0],n=_ref219[1];_this377.configStore.events.on(o,n);});}var r=this.configStore.saveConfig(t);this.engineMediator=new Vk(this);this.serializationMediator=new _rf(this);this.spriteStore=new nt(this);this.scale=new ti(this);this.filterToolStore=new He(this);this.adjustmentsToolStore=new Zt(this);this.focusToolStore=new Bt(this);this.overlayToolStore=new Ze(this);this.frameToolStore=new Be(this);this.brushToolStore=new Ie(this);this.transformToolStore=new tt(this);this.libraryStore=new fr(this);this.modalStore=new Wr(this);this.snappingStore=new $o(this);this.activeStore=new hr(this);this.canvasStore=new Oi(this);this.historyStore=new du(this);this.libraryStore.initProvider(r);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image);}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool);}}}_createClass(Sl,[{key:"shortestOutputSide",get:function get(){var t=this.outputContainer.getBounds();return Math.min(t.width,t.height);}},{key:"assetProvider",get:function get(){return this.configStore.assetProvider;}},{key:"engine",get:function get(){if(!this.engineMediator)return null;return this.engineMediator.engine;}},{key:"imageContainer",get:function get(){if(!this.engineMediator)return null;return this.engineMediator.image.container;}},{key:"orderHelper",get:function get(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper;}},{key:"renderPromise",value:function renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container);}},{key:"previewToWorld",value:function previewToWorld(t,e){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.previewSpaceToWorldSpace(t,e);}return this.engineMediator.previewSpaceToWorldSpace(t,e);}},{key:"worldToPreview",value:function worldToPreview(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.worldSpaceToPreviewSpace(t);}return this.engineMediator.worldSpaceToPreviewSpace(t);}},{key:"worldSizeToPreview",value:function worldSizeToPreview(t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(t.width),height:this.engineMediator.worldSpaceToPreviewSpace(t.height)};}},{key:"previewSizeToWorld",value:function previewSizeToWorld(t,e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(t.width,e),height:this.engineMediator.previewSpaceToWorldSpace(t.height,e)};}},{key:"outputToWorld",value:function outputToWorld(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.outputSpaceToWorldSpace(t);}return this.engineMediator.outputSpaceToWorldSpace(t);}},{key:"previewToOutput",value:function previewToOutput(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.previewSpaceToOutputSpace(t);}return this.engineMediator.previewSpaceToOutputSpace(t);}},{key:"outputContainer",get:function get(){return this.engineMediator.output.container;}}]);return Sl;}();f([C],Sl.prototype,"resize",2);f([C],Sl.prototype,"export",2);f([C],Sl.prototype,"clickableCanvas",2);});var Xt=d(function(){U();pr();tv();oH();ak();ck();uk();mk();_H();SH();wH();Tk();DH();ZH();tW();eW();bv();pv();gW();Ak();dv();hv();fv();gv();sI();Yh();Qh();Jh();vl();Nn();hm();});var nf,sf,bW,yW,Dct,Ect,_W;var xW=d(function(){nf=y(_("react"));B();sf=y(_("styled-components"));R();Xt();U();$e();bW=mt.Button.TextSecondary;yW=sf["default"].span(_templateObject189||(_templateObject189=_taggedTemplateLiteral(["\n font-size: 14px;\n padding: 3px 1px 2px;\n color: ",";\n letter-spacing: ","px;\n display: flex;\n align-self: center;\n"])),function(i){return i.theme.canvasActionBar.foreground;},function(i){return i.theme.measurements.fontSystem.button2.letterSpacing;});Dct=sf["default"].div(_templateObject190||(_templateObject190=_taggedTemplateLiteral(["\n display: inline-flex;\n ","\n"])),function(i){return i.isDisabled&&sf.css(_templateObject191||(_templateObject191=_taggedTemplateLiteral(["\n opacity: 0.5;\n cursor: default;\n pointer-events: none;\n "])));});Ect=function Ect(_ref220){var i=_ref220.isDisabled,t=_ref220.scale,e=_ref220.active;var r=t.canZoomIn;var o=t.canZoomOut;var n=t.zoomLevel;var s=["transform","brush","focus","sticker","text","textdesign"].indexOf(e.tool)!==-1;return!s?nf["default"].createElement(Dct,{isDisabled:i},nf["default"].createElement(bW,{"data-test":N.MainBarButtonZoom,ariaLabel:"Zoom out",isDisabled:!o,onClick:t.out},"-"),nf["default"].createElement(yW,{"data-test":N.ZoomLevel},n," %"),nf["default"].createElement(bW,{ariaLabel:"Zoom in",isDisabled:!r,onClick:t["in"]},"+")):null;};_W=rt("scale","active")(w(Ect));yW.defaultProps={theme:Hr};});var Gr,CW,vW,vm;var SW=d(function(){Gr=y(_("react"));B();CW=y(_("styled-components"));R();W();we();U();$e();xW();vW=(0,CW["default"])(mt.Bar.ButtonGroup)(_templateObject192||(_templateObject192=_taggedTemplateLiteral(["\n > :last-child {\n margin-left: 10px;\n }\n > :first-child {\n margin-left: 0;\n }\n"])));vm=w(function i(){var _D3=D(),t=_D3.config,e=_D3.editor,r=_D3.history,o=_D3.custom,n=_D3.active;var s=t.locale.mainCanvasActions;var a=r.canUndo;var l=r.canRedo;var c=t.config.mainCanvasActions;var u=function u(){e["export"]();};var m=function m(){if(e.activeStore.tool==="transform"){return null;}var v=o.getButton("mainCanvasActionUndo");return Gr["default"].createElement(v,{key:"mainCanvasActionUndo","data-test":N.MainBarButtonUndo,onClick:r.undo,isDisabled:!a||!n.image,label:s.buttonUndo,ariaLabel:s.buttonUndo,icon:Gr["default"].createElement(Xp.undo,null)});};var p=function p(){if(e.activeStore.tool==="transform"){return null;}var v=o.getButton("mainCanvasActionRedo");return Gr["default"].createElement(v,{key:"mainCanvasActionRedo","data-test":N.MainBarButtonRedo,onClick:r.redo,isDisabled:!l||!n.image,label:s.buttonRedo,ariaLabel:s.buttonRedo,icon:Gr["default"].createElement(Xp.redo,null)});};var h=function h(){var v=o.getButton("mainCanvasActionExport");return Gr["default"].createElement(v,{key:"mainCanvasActionExport","data-test":N.MainBarButtonExport,onClick:u,isDisabled:!n.image,label:s.buttonExport,ariaLabel:s.buttonExport,icon:Gr["default"].createElement(Xp["export"],null)});};var g=function g(){if(!t.displayCloseButton){return null;}var v=o.getButton("mainCanvasActionClose");return Gr["default"].createElement(v,{key:"mainCanvasActionClose","data-test":N.MainBarButtonClose,onClick:e.close,isDisabled:!n.image,label:s.buttonClose,ariaLabel:s.buttonClose,icon:Gr["default"].createElement(Xp.close,null)});};var x=c.map(function(v){switch(v){case"undo":return m;case"redo":return p;case"export":return h;case"close":return g;default:return null;}});return Gr["default"].createElement(mt.Bar.Index,null,Gr["default"].createElement(vW,null,x[0]&&x[0]()||null,x[1]&&x[1]()||null),t.config.enableZoom?Gr["default"].createElement(_W,{isDisabled:!n.image}):null,Gr["default"].createElement(vW,null,x[2]&&x[2]()||null,x[3]&&x[3]()||null));});});function Fct(i){return typeof i==="string"&&i.includes("%");}function Oct(i){return typeof i==="string"&&i.includes(".")&&parseFloat(i)===1;}function li(i,t){if(Oct(i)){i="100%";}var e=Fct(i);i=t===360?i:Math.min(t,Math.max(0,parseFloat(i)));if(e){i=parseInt(String(i*t),10)/100;}if(Math.abs(i-t)<1e-6){return 1;}if(t===360){i=(i<0?i%t+t:i%t)/parseFloat(String(t));}else{i=i%t/parseFloat(String(t));}return i;}function _v(i){i=parseFloat(i);if(Number.isNaN(i)||i<0||i>1){i=1;}return i;}function af(i){if(i<=1){return"".concat(Number(i)*100,"%");}return i;}function wl(i){return i.length===1?"0".concat(i):String(i);}var xv=d(function(){});function aI(i,t,e){return{r:li(i,255)*255,g:li(t,255)*255,b:li(e,255)*255};}function lI(i,t,e){i=li(i,255);t=li(t,255);e=li(e,255);var r=Math.max(i,t,e);var o=Math.min(i,t,e);var n=0;var s=0;var a=(r+o)/2;if(r===o){s=0;n=0;}else{var l=r-o;s=a>.5?l/(2-r-o):l/(r+o);switch(r){case i:n=(t-e)/l+(t1){c-=1;}if(c<1/6){return a+(l-a)*(6*c);}if(c<1/2){return l;}if(c<2/3){return a+(l-a)*(2/3-c)*6;}return a;}if(t===0){o=e;n=e;r=e;}else{var a=e<.5?e*(1+t):e+t-e*t;var l=2*e-a;r=s(l,a,i+1/3);o=s(l,a,i);n=s(l,a,i-1/3);}return{r:r*255,g:o*255,b:n*255};}function cI(i,t,e){i=li(i,255);t=li(t,255);e=li(e,255);var r=Math.max(i,t,e);var o=Math.min(i,t,e);var n=0;var s=r;var a=r-o;var l=r===0?0:a/r;if(r===o){n=0;}else{switch(r){case i:n=(t-e)/a+(t0&&arguments[0]!==undefined?arguments[0]:"";var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Vr);if(t instanceof _Vr){return t;}this.originalInput=t;var r=IW(t);this.originalInput=t;this.r=r.r;this.g=r.g;this.b=r.b;this.a=r.a;this.roundA=Math.round(100*this.a)/100;this.format=e.format||r.format;this.gradientType=e.gradientType;if(this.r<1){this.r=Math.round(this.r);}if(this.g<1){this.g=Math.round(this.g);}if(this.b<1){this.b=Math.round(this.b);}this.isValid=r.ok;}_createClass(Vr,[{key:"getAlpha",value:function getAlpha(){return this.a;}},{key:"setAlpha",value:function setAlpha(t){this.a=_v(t);this.roundA=Math.round(100*this.a)/100;return this;}},{key:"toHsv",value:function toHsv(){var t=cI(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a};}},{key:"toHsvString",value:function toHsvString(){var t=cI(this.r,this.g,this.b);var e=Math.round(t.h*360);var r=Math.round(t.s*100);var o=Math.round(t.v*100);return this.a===1?"hsv(".concat(e,", ").concat(r,"%, ").concat(o,"%)"):"hsva(".concat(e,", ").concat(r,"%, ").concat(o,"%, ").concat(this.roundA,")");}},{key:"toHsl",value:function toHsl(){var t=lI(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a};}},{key:"toHslString",value:function toHslString(){var t=lI(this.r,this.g,this.b);var e=Math.round(t.h*360);var r=Math.round(t.s*100);var o=Math.round(t.l*100);return this.a===1?"hsl(".concat(e,", ").concat(r,"%, ").concat(o,"%)"):"hsla(".concat(e,", ").concat(r,"%, ").concat(o,"%, ").concat(this.roundA,")");}},{key:"toHex",value:function toHex(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return uI(this.r,this.g,this.b,t);}},{key:"toHexString",value:function toHexString(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return"#".concat(this.toHex(t));}},{key:"toHex8",value:function toHex8(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return kW(this.r,this.g,this.b,this.a,t);}},{key:"toHex8String",value:function toHex8String(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return"#".concat(this.toHex8(t));}},{key:"toRgb",value:function toRgb(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a};}},{key:"toRgbArray",value:function toRgbArray(){return[Math.round(this.r),Math.round(this.g),Math.round(this.b),this.a];}},{key:"toRgbString",value:function toRgbString(){var t=Math.round(this.r);var e=Math.round(this.g);var r=Math.round(this.b);return"rgba(".concat(t,", ").concat(e,", ").concat(r,", ").concat(this.roundA,")");}},{key:"toPercentageRgb",value:function toPercentageRgb(){var t=function t(e){return"".concat(Math.round(li(e,255)*100),"%");};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a};}},{key:"toPercentageRgbString",value:function toPercentageRgbString(){var t=function t(e){return Math.round(li(e,255)*100);};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")");}},{key:"toName",value:function toName(){if(this.a===0){return"transparent";}if(this.a<1){return false;}var t="#".concat(uI(this.r,this.g,this.b,false));for(var _i9=0,_Object$keys=Object.keys(Cm);_i9<_Object$keys.length;_i9++){var e=_Object$keys[_i9];if(Cm[e]===t){return e;}}return false;}},{key:"toString",value:function toString(t){var e=Boolean(t);t=t||this.format;var r=this.a<1&&this.a>=0;var o=!e&&r&&t&&(t.startsWith("hex")||t==="name");if(o){if(t==="name"&&this.a===0){return this.toName();}return this.toRgbString();}switch(t){case"rgb":return this.toRgbString();case"prgb":return this.toPercentageRgbString();case"hex":case"hex6":return this.toHexString();case"hex3":return this.toHexString(true);case"hex4":return this.toHex8String(true);case"hex8":return this.toHex8String();case"hsl":return this.toHslString();case"hsv":return this.toHsvString();case"name":return this.toName();default:return this.toHexString();}}},{key:"clone",value:function clone(){return new _Vr(this.toString());}}]);return Vr;}();});var hu,Mct,EW;var FW=d(function(){hu=y(_("styled-components"));Mct=hu["default"].div(_templateObject193||(_templateObject193=_taggedTemplateLiteral(["\n position: absolute;\n width: ","px;\n height: ","px;\n overflow: hidden;\n pointer-events: none;\n ","\n left: ","px;\n :after {\n content: '';\n position: absolute;\n width: ","px;\n height: ","px;\n left: 50%;\n ","\n background-color: ",";\n pointer-events: none;\n }\n"])),function(i){return i.theme.measurements.color.colorPicker.arrow.width;},function(i){return i.theme.measurements.color.colorPicker.arrow.width/2;},function(i){return i.direction==="bottom"?hu.css(_templateObject194||(_templateObject194=_taggedTemplateLiteral(["\n bottom: 100%;\n "]))):hu.css(_templateObject195||(_templateObject195=_taggedTemplateLiteral(["\n top: 100%;\n "])));},function(i){return i.arrowOffset;},function(i){return i.theme.measurements.color.colorPicker.arrow.width/2;},function(i){return i.theme.measurements.color.colorPicker.arrow.width/2;},function(i){return i.direction==="bottom"?hu.css(_templateObject196||(_templateObject196=_taggedTemplateLiteral(["\n transform: translate(-50%, 50%) rotate(45deg);\n "]))):hu.css(_templateObject197||(_templateObject197=_taggedTemplateLiteral(["\n transform: translate(-50%, -50%) rotate(45deg);\n "])));},function(i){return i.theme.colorPicker.listBackground;});EW=Mct;});var vv,bI,Lct,zct,Uct,Cv;var OW=d(function(){vv=y(_("react"));bI=y(_("styled-components"));it();Lct=bI["default"].div(_templateObject198||(_templateObject198=_taggedTemplateLiteral(["\n text-align: center;\n width: 28px;\n padding-left: 4px;\n"])));zct=(0,bI["default"])(P.Input.Text)(_templateObject199||(_templateObject199=_taggedTemplateLiteral(["\n input {\n text-align: center;\n border-bottom: 1px solid\n ",";\n }\n"])),function(i){return i.theme.colorPicker.inputBorderColor;});Uct=function Uct(_ref221){var i=_ref221.value,t=_ref221.label,e=_ref221.onChange;return vv["default"].createElement(Lct,null,vv["default"].createElement(P.Input.Label,{label:t}),vv["default"].createElement(zct,{min:0,max:255,value:i,onChange:e}));};Cv=Uct;});var Sv,yI,Nct,Hct,Wct,RW;var AW=d(function(){Sv=y(_("react"));yI=y(_("styled-components"));it();Nct=yI["default"].div(_templateObject200||(_templateObject200=_taggedTemplateLiteral(["\n text-align: left;\n width: 62px;\n"])));Hct=(0,yI["default"])(P.Input.Text)(_templateObject201||(_templateObject201=_taggedTemplateLiteral(["\n input {\n text-align: left;\n border-bottom: 1px solid\n ",";\n }\n"])),function(i){return i.theme.colorPicker.inputBorderColor;});Wct=function Wct(_ref222){var i=_ref222.value,t=_ref222.label,e=_ref222.onChange;return Sv["default"].createElement(Nct,null,Sv["default"].createElement(P.Input.Label,{label:t}),Sv["default"].createElement(Hct,{value:i.toUpperCase(),onChange:e}));};RW=Wct;});var BW,fu;var wv=d(function(){BW=y(_("styled-components"));Xt();fu=BW["default"].div.attrs(function(i){return{style:{left:i.position[0]||"".concat(0,"px"),top:i.position[1]||"".concat(0,"px")}};})(_templateObject202||(_templateObject202=_taggedTemplateLiteral(["\n &&& {\n position: absolute;\n height: ","px;\n width: ","px;\n border-radius: 50%;\n border: 2px solid ",";\n box-sizing: border-box;\n cursor: pointer;\n box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.11), 0 1px 3px 0 rgba(0, 0, 0, 0.46);\n z-index: 2;\n pointer-events: none;\n }\n"])),function(i){return i.theme.measurements.color.colorPicker.thumb.size;},function(i){return i.theme.measurements.color.colorPicker.thumb.size;},function(i){return i.theme.colorPicker.controlsColor;});fu.defaultProps={theme:Hr};});var jr,PW,MW,Gct,Vct,Sm;var Tv=d(function(){jr=y(_("react"));PW=y(Ku());MW=y(_("styled-components"));it();W();Gct=MW["default"].div(_templateObject203||(_templateObject203=_taggedTemplateLiteral(["\n position: relative;\n height: 14px;\n width: 100%;\n"])));Vct=function Vct(i){return function(t){i.forEach(function(e){if(typeof e==="function"){e(t);}else if(e!=null){e.current=t;}});};};Sm=(0,jr.forwardRef)(function(_ref223,o){var i=_ref223.surface,t=_ref223.onChange,e=_ref223.className,r=_ref223.children;var n=(0,jr.useRef)(null);var s=(0,jr.useRef)(null);var _D4=D(),a=_D4.config;var _ref224=(0,jr.useState)(false),_ref225=_slicedToArray(_ref224,2),l=_ref225[0],c=_ref225[1];var u=function u(g){var x=a.measurements.color.colorPicker.thumb.size/2;var v=a.measurements.color.colorPicker.thumb.size;var b=0;var T=0;b=g.clientX;T=g.clientY;var _n$current$getBoundin=n.current.getBoundingClientRect(),k=_n$current$getBoundin.top,E=_n$current$getBoundin.left,A=_n$current$getBoundin.width,I=_n$current$getBoundin.height;var F=b-E-x;var Z=T-k-x;F=Math.max(0,Math.min(A-v,F));Z=Math.max(0,Math.min(I-v,Z));if(t){t([F,Z]);}};var m=function m(g){c(true);u(g);};var p=(0,jr.useCallback)((0,PW["default"])(function(g){if(l){u(g);}},10),[l]);var h=function h(){if(l){c(false);}};return jr["default"].createElement(Gct,{ref:Vct([n,o]),className:e},jr["default"].createElement(P.DraggableCore,{nodeRef:s,onStart:m,onDrag:p,onStop:h},jr["default"].createElement("div",{ref:s},i)),r);});});var LW,jct,gu;var kv=d(function(){LW=_("styled-components");jct=LW.css(_templateObject204||(_templateObject204=_taggedTemplateLiteral(["\n position: absolute;\n top: 3px;\n left: 0;\n width: 100%;\n height: 8px;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n"])));gu=jct;});var Vn,zW,$ct,UW;var NW=d(function(){Vn=y(_("react"));zW=y(_("styled-components"));W();wv();Tv();kv();$ct=zW["default"].div(_templateObject205||(_templateObject205=_taggedTemplateLiteral(["\n ","\n background: linear-gradient(90deg, #F00 0%, #FF0 16.66%, #0F0 33.33%, #0FF 50%, #00F 66.66%, #F0F 83.33%, #F00 100%);\n height: 8px;\n"])),gu);UW=function UW(_ref226){var i=_ref226.hue,t=_ref226.onChange;var _ref227=(0,Vn.useState)(0),_ref228=_slicedToArray(_ref227,2),e=_ref228[0],r=_ref228[1];var o=(0,Vn.useRef)(null);var _D5=D(),n=_D5.config;var s=function s(a){if(o.current){var _a5=_slicedToArray(a,1),l=_a5[0];var c=o.current.offsetWidth;var u=c-n.measurements.color.colorPicker.thumb.size;var m=l*c/u;var p=Math.max(0,Math.min(360,m/c*360));t(p);r(l);}};(0,Vn.useEffect)(function(){if(o.current){var a=o.current.offsetWidth;var l=0;var c=a-n.measurements.color.colorPicker.thumb.size;l=i*a/360;r(l*c/a);}},[i]);return Vn["default"].createElement(Sm,{surface:Vn["default"].createElement($ct,null),ref:o,onChange:s},Vn["default"].createElement(fu,{position:[e,0]}));};});var Xo,_I,Kct,Xct,HW;var WW=d(function(){Xo=y(_("react"));_I=y(_("styled-components"));W();wv();Tv();kv();Kct=_I["default"].div.attrs(function(i){return{style:{background:"linear-gradient(to left, ".concat(i.transparentColor," 0%, ").concat(i.opaqueColor," 100%)")}};})(_templateObject206||(_templateObject206=_taggedTemplateLiteral(["\n ","\n z-index: 1;\n"])),gu);Xct=_I["default"].div.attrs(function(i){return{style:{backgroundImage:"url(".concat(i.url,")")}};})(_templateObject207||(_templateObject207=_taggedTemplateLiteral(["\n ","\n z-index: 0;\n background-repeat: repeat-x;\n background-size: contain;\n background-position: left;\n"])),gu);HW=function HW(_ref229){var i=_ref229.color,t=_ref229.opaqueColor,e=_ref229.transparentColor,r=_ref229.onChange;var _D6=D(),o=_D6.config;var _ref230=(0,Xo.useState)(0),_ref231=_slicedToArray(_ref230,2),n=_ref231[0],s=_ref231[1];var a=(0,Xo.useRef)(null);var l=o.assetProvider.getPath("controls","/tiled-background.png");var c=function c(u){if(a.current){var m=a.current.offsetWidth;var _u13=_slicedToArray(u,1),p=_u13[0];var h=m-o.measurements.color.colorPicker.thumb.size;var g=p*m/h;var x=(m-g)/m;var v=Math.round((x+Number.EPSILON)*100)/100;var b=Math.min(1,Math.max(0,v));r(b);s(p);}};(0,Xo.useEffect)(function(){if(a.current){var u=a.current.offsetWidth;var m=0;var p=u-o.measurements.color.colorPicker.thumb.size;m=(1-i.toHsv().a)*u;s(m*p/u);}},[i.toString()]);return Xo["default"].createElement(Sm,{ref:a,surface:Xo["default"].createElement(Kct,{opaqueColor:t,transparentColor:e}),onChange:c},Xo["default"].createElement(Xct,{url:l}),Xo["default"].createElement(fu,{position:[n,0]}));};});var jn,xI,qct,Yct,GW;var VW=d(function(){jn=y(_("react"));xI=y(_("styled-components"));W();wv();Tv();kv();qct=xI["default"].div.attrs(function(i){return{style:{backgroundColor:"hsl(".concat(i.hue,", 100%, 50%)")}};})(_templateObject208||(_templateObject208=_taggedTemplateLiteral(["\n ","\n background: linear-gradient(to top, rgb(0, 0, 0), rgba(0, 0, 0, 0)),\n linear-gradient(to right, rgb(255, 255, 255), rgba(255, 255, 255, 0));\n height: ","px;\n top: 0px;\n"])),gu,function(i){return i.theme.measurements.color.colorPicker.saturationSlider.height;});Yct=(0,xI["default"])(Sm)(_templateObject209||(_templateObject209=_taggedTemplateLiteral(["\n height: ","px;\n margin-top: 0px;\n"])),function(i){return i.theme.measurements.color.colorPicker.saturationSlider.height;});GW=function GW(_ref232){var i=_ref232.color,t=_ref232.hue,e=_ref232.onChange;var _ref233=(0,jn.useState)([0,0]),_ref234=_slicedToArray(_ref233,2),r=_ref234[0],o=_ref234[1];var n=(0,jn.useRef)(null);var _D7=D(),s=_D7.config;(0,jn.useEffect)(function(){var _i$toHsv=i.toHsv(),l=_i$toHsv.s,c=_i$toHsv.v;if(n.current){var _n$current=n.current,u=_n$current.offsetWidth,m=_n$current.offsetHeight;var p=u-s.measurements.color.colorPicker.thumb.size;var h=m-s.measurements.color.colorPicker.thumb.size;var g=l*u;var x=(1-c)*m;o([g*p/u,x*h/m]);}},[i.toString()]);var a=function a(l){if(n.current){var _l7=_slicedToArray(l,2),c=_l7[0],u=_l7[1];var _n$current2=n.current,m=_n$current2.offsetHeight,p=_n$current2.offsetWidth;var h=p-s.measurements.color.colorPicker.thumb.size;var g=m-s.measurements.color.colorPicker.thumb.size;var x=c*p/h;var v=u*m/g;var b=Math.min(1,Math.max(0,x/p));var T=Math.min(1,Math.max(0,(m-v)/m));e(b,T);o([c,u]);}};return jn["default"].createElement(Yct,{ref:n,surface:jn["default"].createElement(qct,{hue:t}),onChange:a},jn["default"].createElement(fu,{position:r}));};});var ei,$n,Jct,jW,Zct,Qct,tut,eut,lf;var $W=d(function(){ei=y(_("react"));$n=y(_("styled-components"));it();Xt();gI();FW();OW();AW();NW();WW();VW();Jct=$n["default"].div(_templateObject210||(_templateObject210=_taggedTemplateLiteral(["\n position: absolute;\n left: ","px;\n top: ","px;\n z-index: ",";\n display: none;\n opacity: 0;\n transition: opacity 0.3s ease-out;\n ","\n"])),function(i){return i.leftOffset;},function(i){return i.topOffset;},function(i){return i.theme.measurements.zIndex.input.list;},function(i){return i.show&&$n.css(_templateObject211||(_templateObject211=_taggedTemplateLiteral(["\n display: block;\n opacity: 1;\n transition: opacity 0.3s ease-out;\n "])));});jW=$n["default"].div(_templateObject212||(_templateObject212=_taggedTemplateLiteral(["\n &&& {\n position: absolute;\n ","\n padding: 16px;\n box-sizing: border-box;\n box-shadow: ",";\n background: ",";\n border-radius: ","px;\n width: ","px;\n height: ","px;\n left: 8px;\n z-index: 1;\n }\n"])),function(i){return i.direction==="top"&&$n.css(_templateObject213||(_templateObject213=_taggedTemplateLiteral(["\n transform: translate(0, -100%);\n "])));},function(i){return i.theme.colorPicker.listShadow;},function(i){return i.theme.colorPicker.listBackground;},function(i){return i.theme.shape.radiusMedium;},function(i){return i.theme.measurements.color.colorPicker.width;},function(i){return i.theme.measurements.color.colorPicker.height;});Zct=(0,$n["default"])(UW)(_templateObject214||(_templateObject214=_taggedTemplateLiteral(["\n margin-top: 8px;\n"])));Qct=(0,$n["default"])(HW)(_templateObject215||(_templateObject215=_taggedTemplateLiteral(["\n margin-top: 8px;\n"])));tut=$n["default"].div(_templateObject216||(_templateObject216=_taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n margin-top: 30px;\n"])));eut=$n["default"].div(_templateObject217||(_templateObject217=_taggedTemplateLiteral(["\n display: flex;\n"])));lf=/*#__PURE__*/function(_ei$default$Component){_inherits(lf,_ei$default$Component);var _super237=_createSuper(lf);function lf(t){var _this378;_classCallCheck(this,lf);_this378=_super237.call(this,t);_this378.node=ei["default"].createRef();_this378.checkId=function(t,e,r){var o=t;var n=0;while(o.parentElement&&nF){I+=E-F;E-=I;}var Z=true;if(s==="bottom"&&a){var et=a.height;var pt=a.top;var yt=g-pt;var bt=et-(yt+x);var ht=o.measurements.color.colorPicker.height+k;if(bta-r||n>s-r||nn&&x.xn&&x.yt.measurements.canvas.transform.minSliderWidth;var l=!t.isLayoutAdvanced||t.isLayoutAdvanced&&e>t.measurements.canvas.transform.minValueWidth;var c=this.transformTool.rotationInDegrees-this.transformTool.defaultAngle;var u=n===s?c*-1:c;var m=n!==s?r.rotationInDegrees*-1:r.rotationInDegrees;return qo["default"].createElement(vut,{"data-test":N.RotateSlider,className:o},qo["default"].createElement(P.Draggable,{nodeRef:this.rotateRef,axis:"x",position:{x:0,y:0},onStart:this.drag,onDrag:this.drag,onStop:this.stop,updateOnPosition:true,disabled:!a},qo["default"].createElement(Sut,{ref:this.rotateRef},qo["default"].createElement(UG,{isVisible:a},qo["default"].createElement(Vt.dots,{width:90,height:15,x:u})),qo["default"].createElement(Cut,{isVisible:l},m,"\xB0"),qo["default"].createElement(UG,{isVisible:a},qo["default"].createElement(Vt.dots,{width:90,height:15,x:u})))));}}]);return NG;}(qo["default"].Component);HG=rt("transformTool","config")(w(NG));});var go,br,GG,wut,VG,Tut,jG,kut,Iut,Dut,Eut,Fut,$G,Out,Rut,ff;var MI=d(function(){go=y(_("react"));B();br=y(_("styled-components"));Sr();we();U();WG();GG=br.css(_templateObject238||(_templateObject238=_taggedTemplateLiteral(["\n grid-column-start: span 2;\n"])));wut=(0,br["default"])(HG)(_templateObject239||(_templateObject239=_taggedTemplateLiteral(["\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&GG;},GG);VG=br.css(_templateObject240||(_templateObject240=_taggedTemplateLiteral(["\n grid-column-start: 1;\n grid-row-start: 2;\n"])));Tut=br["default"].div(_templateObject241||(_templateObject241=_taggedTemplateLiteral(["\n display: flex;\n gap: 5px;\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&VG;},VG);jG=br.css(_templateObject242||(_templateObject242=_taggedTemplateLiteral(["\n justify-content: flex-end;\n grid-column-start: 2;\n grid-row-start: 2;\n"])));kut=br["default"].div(_templateObject243||(_templateObject243=_taggedTemplateLiteral(["\n display: flex;\n gap: 5px;\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&jG;},jG);Iut=(0,br["default"])(Vt.rotate)(_templateObject244||(_templateObject244=_taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n transform: scaleX(-1);\n"])));Dut=(0,br["default"])(Vt.rotate)(_templateObject245||(_templateObject245=_taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n"])));Eut=(0,br["default"])(Vt.flipHorizontal)(_templateObject246||(_templateObject246=_taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n"])));Fut=(0,br["default"])(Vt.flipVertical)(_templateObject247||(_templateObject247=_taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n"])));$G=br.css(_templateObject248||(_templateObject248=_taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: 1fr 1fr;\n grid-template-rows: 1fr 1fr;\n margin-bottom: 0.5rem;\n"])));Out=br["default"].div(_templateObject249||(_templateObject249=_taggedTemplateLiteral(["\n display: inline-flex;\n gap: 5px;\n\n svg {\n color: ",";\n }\n\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.theme.foreground;},function(i){return i.smallContainer&&$G;},$G);Rut=function Rut(_ref281){var i=_ref281.transformTool,t=_ref281.config,e=_ref281.custom,r=_ref281.canvas;var _ref282=(0,go.useContext)(Oe),o=_ref282.rect;var n=i.locale.transformActions;var s=r.canvasSize.width;var a=!t.isLayoutAdvanced||t.isLayoutAdvanced&&s>t.measurements.canvas.transform.minFlipWidth;var l=function l(_ref283){var x=_ref283.customButtonKey,v=_ref283.onClick,b=_ref283.label,T=_ref283.icon;var k=e.getButton(x);return go["default"].createElement(k,{key:b,onClick:v,label:b,ariaLabel:b,icon:T});};var c=l({label:n.buttonFlipHorizontal,icon:go["default"].createElement(Eut,null),onClick:function onClick(){i.flipHorizontally();},customButtonKey:"transformActionFlipHorizontal"});var u=l({label:n.buttonFlipVertical,icon:go["default"].createElement(Fut,null),onClick:function onClick(){i.flipVertically();},customButtonKey:"transformActionFlipVertical"});var m=l({label:n.buttonRotateClockwise,icon:go["default"].createElement(Iut,null),onClick:i.rotateClockwise,customButtonKey:"transformActionRotateClockwise"});var p=l({label:n.buttonRotateAntiClockwise,icon:go["default"].createElement(Dut,null),onClick:i.rotateAntiClockwise,customButtonKey:"transformActionRotateAntiClockwise"});var h=!!o&&o.width<600;var g=t.isLayoutAdvanced?{transform:"rotate(180deg)"}:{};return go["default"].createElement(Out,{style:g,"data-test":N.FlipRotateControls,smallContainer:h},i.config.enableFlip&&a&&go["default"].createElement(Tut,{smallContainer:h},c,u),i.config.enableRotation&&go["default"].createElement(wut,{canvasWidth:s,smallContainer:h}),i.config.enableRotation&&go["default"].createElement(kut,{smallContainer:h},p,m));};ff=rt("transformTool","config","custom","canvas")(w(Rut));});var oa,Aut,Bv,But,KG;var XG=d(function(){oa=y(_("react"));B();$e();zG();MI();Aut=mt.Bar.Index;Bv=mt.Crop.Backdrop;But=function But(_ref284){var i=_ref284.transformTool,t=_ref284.canvas,e=_ref284.config;var r=i.leftTopRespectFlip,o=i.leftBottomRespectFlip,n=i.rightTopRespectFlip;var s=i.cropMaskSize.height;var _t$canvasSize=t.canvasSize,a=_t$canvasSize.height,l=_t$canvasSize.width;var c=i.defaultCropMaskPosition;var u=i.isDragMode?{transition:"unset"}:{};return oa["default"].createElement(mt.Controls.Container,null,oa["default"].createElement(Bv,{style:_objectSpread({left:0,top:0,width:l,height:r.y+c.y},u)}),oa["default"].createElement(Bv,{style:_objectSpread({left:0,top:r.y+c.y,width:c.x+r.x,height:s},u)}),oa["default"].createElement(Bv,{style:_objectSpread({left:n.x+c.x,top:n.y+c.y,width:l-n.x-c.x,height:s},u)}),oa["default"].createElement(Bv,{style:_objectSpread({left:0,top:o.y+c.y,width:l,height:a-o.y-c.y+e.measurements.basicUIToolControlBar.controlsBarHeight},u)}),oa["default"].createElement(LG,null),e.isLayoutAdvanced?oa["default"].createElement(Aut,{bottom:true},oa["default"].createElement(ff,null)):null);};KG=rt("transformTool","canvas","config")(w(But));});var Pv,Mv,Put,qG,YG;var JG=d(function(){Pv=y(_("react"));B();Mv=y(_("styled-components"));$e();Put=(0,Mv["default"])(mt.Controls.Container)(_templateObject250||(_templateObject250=_taggedTemplateLiteral(["\n ","\n z-index: ",";\n"])),function(i){return i.activeCursor?Mv.css(_templateObject251||(_templateObject251=_taggedTemplateLiteral(["\n cursor: move;\n "]))):"";},function(i){return i.theme.measurements.zIndex.canvas.crop.dragImage;});qG=/*#__PURE__*/function(_Pv$default$Component){_inherits(qG,_Pv$default$Component);var _super245=_createSuper(qG);function qG(t){var _this387;_classCallCheck(this,qG);_this387=_super245.call(this,t);_this387.INITIAL_POSITION={x:void 0,y:void 0};_this387.state=_objectSpread(_objectSpread({},_this387.INITIAL_POSITION),{},{isDragging:false});_this387.containerRef=null;_this387.getCursorCoordinates=function(t){var e=0;var r=0;if(t.type.indexOf("touch")!==-1){var a=t;if(!a.touches.length){return _this387.INITIAL_POSITION;}e=a.touches[0].clientX;r=a.touches[0].clientY;}else{var _a7=t;e=_a7.clientX;r=_a7.clientY;}var o=_this387.containerRef.current.getBoundingClientRect();var n=e-o.left;var s=r-o.top;return{x:n,y:s};};_this387.move=function(t){if(_this387.scale.canDrag){var _this387$getCursorCoo=_this387.getCursorCoordinates(t),e=_this387$getCursorCoo.x,r=_this387$getCursorCoo.y;if(e!==void 0&&r!==void 0){if(_this387.state.isDragging){var o={x:_this387.state.x-e,y:_this387.state.y-r};_this387.scale.setOffset(o);}}}};_this387.touchDrag=function(t){if(_this387.scale.canDrag){var _this387$getCursorCoo2=_this387.getCursorCoordinates(t),e=_this387$getCursorCoo2.x,r=_this387$getCursorCoo2.y;if(e!==void 0&&r!==void 0){_this387.setState({x:e,y:r,isDragging:true});}}};_this387.drag=function(t){t.preventDefault();_this387.touchDrag(t);};_this387.stop=function(){if(_this387.scale.canDrag){_this387.scale.savePosition();_this387.setState(_objectSpread(_objectSpread({},_this387.INITIAL_POSITION),{},{isDragging:false}));}};_this387.touchEnd=function(t){t.preventDefault();t.stopPropagation();var _this387$state=_this387.state,e=_this387$state.x,r=_this387$state.y;if(e&&r){_this387.setState(_objectSpread(_objectSpread({},_this387.INITIAL_POSITION),{},{isDragging:false}));}};_this387.containerRef=Pv["default"].createRef();return _this387;}_createClass(qG,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener("mouseup",this.stop,false);document.addEventListener("touchend",this.stop,{passive:true});}},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener("mouseup",this.stop,false);document.removeEventListener("touchend",this.stop,false);}},{key:"scale",get:function get(){return this.props.scale;}},{key:"render",value:function render(){return Pv["default"].createElement(Put,{ref:this.containerRef,onMouseMove:this.move,onTouchMove:this.move,onMouseDown:this.drag,onTouchStart:this.touchDrag,onMouseUp:this.stop,onTouchEnd:this.touchEnd,activeCursor:this.scale.canDrag});}}]);return qG;}(Pv["default"].Component);YG=rt("scale")(w(qG));});var qn,ZG;var QG=d(function(){qn=y(_("react"));B();R();W();tG();$e();cG();MG();XG();JG();ZG=w(function(_ref285){var i=_ref285.children;var t=(0,qn.useRef)(null);var _D12=D(),e=_D12.active,r=_D12.sprite,o=_D12.canvas;var n=function n(){switch(e.tool){case"focus":return qn["default"].createElement(lG,null);case"text":case"textdesign":case"sticker":return qn["default"].createElement(PG,null);case"brush":return qn["default"].createElement(QW,null);case"transform":return qn["default"].createElement(KG,null);default:return qn["default"].createElement(mt.Controls.Container,null,qn["default"].createElement(YG,null));}};var s=function s(c){c.preventDefault();c.stopPropagation();if(o==null?void 0:o.isCanvasClickable){var u=c.clientX;var m=c.clientY;if(c.type.indexOf("touch")!==-1){var x=c;if(!x.touches.length){return;}u=x.touches[0].clientX;m=x.touches[0].clientY;}var p=t.current.getBoundingClientRect();var h=u-p.left;var g=m-p.top;o.getContainersAtPreviewPoint({x:h,y:g});}};var a=function a(c){if(c.code==="Tab"){r.selectLast();}};var l=o.canvasSize;return qn["default"].createElement(mt.Controls.Wrapper,{"aria-hidden":true,ref:t,onClick:s,onKeyDown:a,height:l.height,width:l.width},i,n());});});var tV,eV,Mut,Lut,LI;var iV=d(function(){tV=y(_("react"));eV=y(_("styled-components"));Mut=eV["default"].div(_templateObject252||(_templateObject252=_taggedTemplateLiteral(["\n display: ",";\n position: absolute;\n z-index: ",";\n"])),function(_ref286){var i=_ref286.isVisible;return i?"block":"none";},function(i){return i.theme.measurements.zIndex.canvas.snappingGuide;});Lut=function Lut(_ref287){var i=_ref287.isVisible,t=_ref287.className;return tV["default"].createElement(Mut,{isVisible:i,className:t});};LI=Lut;});var Lv,_u,zut,Uut,Nut,Hut,rV;var oV=d(function(){Lv=y(_("react"));B();_u=y(_("styled-components"));U();iV();zut=(0,_u["default"])(LI)(_templateObject253||(_templateObject253=_taggedTemplateLiteral(["\n background: ",";\n ","\n"])),function(i){return i.theme.snapping.positionGuideColor;},function(i){if(i.direction==="horizontal"){return _u.css(_templateObject254||(_templateObject254=_taggedTemplateLiteral(["\n width: 100%;\n height: 2px;\n top: ","px;\n "])),function(){return i.position;});}return _u.css(_templateObject255||(_templateObject255=_taggedTemplateLiteral(["\n width: 2px;\n height: 100%;\n left: ","px;\n "])),function(){return i.position;});});Uut=(0,_u["default"])(LI)(_templateObject256||(_templateObject256=_taggedTemplateLiteral(["\n border: none;\n border-top: 2px dashed ",";\n background: transparent;\n left: ","px;\n top: ","px;\n transform: rotate(","rad);\n width: 200%;\n"])),function(i){return i.theme.snapping.rotationGuideColor;},function(_ref288){var i=_ref288.position;return i.x;},function(_ref289){var i=_ref289.position;return i.y;},function(_ref290){var i=_ref290.rotation;return i;});Nut=_u["default"].div(_templateObject257||(_templateObject257=_taggedTemplateLiteral(["\n position: absolute;\n width: ","px;\n height: ","px;\n top: ","px;\n left: ","px;\n overflow: hidden;\n"])),function(_ref291){var i=_ref291.width;return i;},function(_ref292){var i=_ref292.height;return i;},function(_ref293){var i=_ref293.top;return i;},function(_ref294){var i=_ref294.left;return i;});Hut=function Hut(_ref295){var i=_ref295.snapping,t=_ref295.editor;var _t$getPreviewSize=t.getPreviewSize(),e=_t$getPreviewSize.width,r=_t$getPreviewSize.height;var _i$previewTopLeftPosi=i.previewTopLeftPosition,o=_i$previewTopLeftPosi.x,n=_i$previewTopLeftPosi.y;var s=i.positionGuides.map(function(_ref296,m){var l=_ref296.direction,c=_ref296.value,u=_ref296.isVisible;return Lv["default"].createElement(zut,{key:"positionGuide-".concat(m),direction:l,position:c,isVisible:u});});var a=i.rotationGuides.find(function(_ref297){var l=_ref297.isVisible;return l;});return Lv["default"].createElement(Nut,{"data-test":N.SnappingLine,width:e,height:r,left:o,top:n},s,Lv["default"].createElement(Uut,{key:"rotationGuide",rotation:a?a.value:0,position:a?a.position:{x:0,y:0},isVisible:!!a}));};rV=rt("snapping","editor")(w(Hut));});var nV,sV,Wut,aV;var lV=d(function(){nV=y(_("react"));sV=y(_("styled-components"));U();Wut=sV["default"].img(_templateObject258||(_templateObject258=_taggedTemplateLiteral(["\n z-index: 5;\n position: absolute;\n width: 100px;\n bottom: 30px;\n right: 30px;\n"])));aV=function aV(){return nV["default"].createElement(Wut,{alt:"watermark","data-test":N.Watermark,src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaQAAACMCAYAAAAzxN3aAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABMZSURBVHgB7d1tbFTXmQfw4xTXJsZk4hc8LAYPNWDTxOvZJMITNSkInGaTdOUmRWsTdUsrJYvafsh+yDcUqft9VSkftlLYqMRqpJAVQbJ2SeRiU5NCPKAEm1rBr5BxYpKxwNjGJrZxovb+SaYi1Daee8+59zkz/59k0aoUv83c/32e89xzcl7av//XioiIKEA5OTnqLkVERCQAA4mIiERgIBERkQgMJCIiEoGBREREIjCQiIhIBAYSERGJwEAiIiIRGEhERCQCA4mIiERgIBERkQgMJCIiEoGBREREIjCQiIhIBAYSERGJwEAiIiIRGEhERCQCA4mIiERgIBERkQgMJCIiEoGBREREIjCQiIhIBAYSERGJwEAiIiIRGEhERCQCA4mIiERgIBERkQgMJCIiEoGBREREIjCQiIhIBAYSERGJwEAiIiIRGEhERCTCCkWUhUYuXQoNJxJl45OToSuXL6+dn5/Pu379euiL+fn8mbm50EL/nxUrVszmfutbsytyc2dznY+CgoLJVYWF42vLypIlJSUTVVVVo4qIXGMgUVa4du1a/rsnT9YifJyPisVCZylffPFFPj7U3NzN/351fPzmn729vTf/RGCtLixMVkQifZsrKxMMKKL0WBFI//3b3+6d+fzztC8gi6n+7nfjP3zyydPL/ftnz56NHD9+vEEZdk8olHz+uefeVD5qa2ur7e7u3qEMa9qzp7l83boJ5aNUCDmVULUTHhFlGMIKnwcfXV1dauXKlROlxcWJWCwWz9ZwMvHe0fVa+v+3367rO38+pkzIyVEbv/Od7h8//fQJpZH296vzdZaWlib2/vSnLUoAKwLpuhNGcy7uaBczOzubr9I0o/HzL/o5RkdDuIiuXr16Vvnkk0uXIn58b35CO+7dP/2pbnh4OHqzognIzMxM6OORkejHhw9HC1etSt5fUxOv37nznMoyUl9f33/kkXM9PT07TL1GBgYGYs77+bTO93P/wEBU98/zusabfa841CAM7uiVj5LJZLXKEAiig83NDQdfe+2FCxcuxIIMo9tNTU+HOzs7f/Rfv/nNC23Hj/v6O6aFISgeevDBVmUIXn/H2tvrlCYjIyMhPyr9IDGQhEF7SfnkVGdnlaSLtluoKo8cObL996+/vs9500aVYKiaUsHU398fVhSox+rru1fm5RlrJX9dJWl5jznhtl1lOAaSMNempsK6XsB34rxZrK+OcFE/cODAvg97e3fYFK4Ipv89fHjfG4cOPe7X75sWVhuNal3nuRVek2fef79KeYTqyNTN1pYtW8S0kRlIwuh6AS+H7e26o0ePxnBRt3kNbMhpLR549dV9aDcqCoTxKqmvz3OQ9PX1VSgDMHjjrGt2KyEYSAL1a3gB3wmmn2xu16GyONvd/bjKAKiW0G48deqULzci9Pd27txpbMpszFn3wftNedBlaBJ248aNYsIIGEgC+dG2O9fTY+XCOn4ueAwAlYXKILg5ON7R0dTe3i56DSxTPfDAA4mie+9NKEPi8bjr9R+Mes8a6AKgOqrbtk3U1CcDSSA/2nZjly9HlGUQRr87eHBvJk8avRePNzCUgvFwLGZsLQlVktshFox6KwNQHfn9bOCdMJCEunjxorH1HbQPbFx3cdpajRifVhkOoeS1xUPpM10lfdDVlXZXwtSot8TqCBhIQo2NjUVMte1sbNdhzSjTn8G4VeuxY40cdPCfySoJD2qn+542NeotsToCBpJQaNsNDQ0ZqQZsa9e9deTIjkxbM7oT/P5bWlqMb1dF32SySkr3QVlTo95SqyNgIAnWY6CSsa1dhyrhfG9vxj8QuBBUhNzVwX8mq6R0HpQ1NeottToCBpJgnyaT1brbdja16/C9H3rjjb0qi2EjTT446y/TVdJyB5ZMjHpLro6Ax08Ilmrb4Q2iNLGpXXesrS3mZzWH4yNKSkqGCwoKxgsLCydX5uXNpP63iWvXQjdu3MgfHx8PX716NaJ8gmeUsL9hOrvTk3eoko6+805EGYAHZe+0ye7J996rMjHqLbk6AgaScGjb6QokjJ3a0q7zq1WHEKqoqOiu3rKlf7k/Z1Qsp8+cqT7X3b3dj5/n1/sbMpB8hNdCZzyeMDFIk3pQdqnXm/Pa0r5mKr06ArbshPtU4/Y+bsZOg+JUR8bDqLKyMv6rX/zi5WebmlrTCX3sEo3tZl588cWXY3V1LSa3nYGrGp70p/Q1NDQY271hqQdlTY16S6+OgIEkHNp2ui5Gn46MWLF3Hb5fk7t2407xqSeeaEYQeT2rBsGEA+PCa9b0K4MuJhJGFrhpcbh4l5eXG9laZ6kHZU2MettQHQEDyQJ9AwOed22wqV1ncvACb8ymxsZmnetyuHA9//zzh0w+VDmaTEYU+c654TA2cbdQxwLVkYlNj22ojoCBZAE8UKc8GhgaiigLYO3IVHWUCiNTb8x/+8lP3sSalDIA+xsq8h1eK2jtKgMWelAWo966Nz22pToCBpIFdLTtLly4YMX6EY4eV4aYDCNA+2/z5s1Ghg/wGuDODcH44ZNPnjBxo7HQg7ImRr1LS0oSNlRHwECyhJe2HS5kU5bcYZta59q6dWuHH2/KH9TXG7mbhuvT03weKQAmbzTwoGzqP5sa9d61a5extqNuHPu2xNdtu1blgnPXZcUwg6l1LrQsdj/zjC9vSly8Xtq//z8VZRTcaAwODtbpbqfh38NuHHguycSo94b1661YO0phhWQJL227j4eHrTj4refDD418nbW1tdbcIZJMJqskHMhpatTbpuoIGEgWcdO2Q7vOll2yTUySoTp6bNcuUadikp1QJZlYS8L78/BbbzUqzWyrjoCBFAC3L2o303Z9vb2unl/BhVz5zERwlhYXJxSRBiarJBPnfNlWHQEDKQBrw2FXD1G6adu5PW3S7wu5qZ0IampqrBh3JTuYqpJ0s7E6AgZSAMrXr//I7Ys6nSf23bbrCletShYUFvr6Yr702WdGpgB1PgBLZLJK0snG6ggYSAHBhp7KhUQiseyKx227bk1ZWUL5bGpq6h6lWVFRUUIRaSa9SrK1OgIGUkCwu7RyAccRLLe95bZd5/Zr82J6elr7uHdubq741grZR3qVZGt1BAykgGzatClpsm3ntl2HrymINtf8jRvaH/p0KqSkIjIAVZLpXd7dsLk6Aj4YGxDcZa0uLEy6CY2v23ZL3gW5bdcVBzSVdv3zz7VXSKFQSOsb88CrrzZem5gQt+MFjsFQ5Cu8f2uj0RPx06cblCA2V0fAQArQhoqKfjeBhLYdKqCl7oQufnWoW9o2btzoe7sOvvzyS/Hb4qCKs2XHdDIPR4/4dUjjctheHQFbdgHa/uijrh/YdO7MFt0sFTsIj46OugqkrdXVCRUA3VuyEPkBVZISwvbqCBhIAULZ7/YMnaV2NThz5oyrLXgw7m37HRaRn1AlmTwHa7kyoToCBlLAysLhYeUCWn2LHUfgtl0XxLg3ke0ejsUCr0wyoToCBlLAYnV12tt2Y2NjEeVCEOPeRLbDVGqQVVKmVEfAQAoYXkh5LsdHF2rbnersrHKzHhPUuHdKnoER2omJCQ4gkC+CrJIypToCBpIA5eXlfcoFtO1uPwJ5YGDAVbuuOAM3Ib0+NcVAIl8EVSVlUnUEDCQBvLTK3j158httu2QyadW4d0rB3Xdrf1Nddtm6JHIjFkCVlEnVETCQBMDdlesjKW4ZYMCWQm7Hp4Ma9065u6BAeyDhea3bK0giUx70uUrKtOoIGEhChMNhz227cz09tW7+DQnj3iUlJaPKgD/39EQUkU/8rJIyrToCBpIQtR7O7Um17cYuX44oFySMexcVFY0rA3p7e12FNJEbflVJmVgdAQNJCC+braJth3ad2y1MJIx7V2zYYKRCuuKsI7FtR37yo0rKxOoIGEhCpDZbVS6gbfdBV1edcgFHlUs4xM7L+PtSsKb2h7Y2Vz+b22GdCz+v5XyYOC8H/+ZCn0uRKKiSwmvWGLvJy9TqCLi5qiBuN1sFt9N1pYLGvUtLSxMjIyOuznBayuDgYMypkk4j9JUHP9+7t2W5f/dgc3OD7u/loYcean1s1y7XD1KTfyYmJ8uUIZlaHQErJEG8bLbq1j+Ul7vausiE9evWJZQBqJKOvv32duUTbOlkIlg3lJfzfCcLtLW11c4a2gE8k6sjYCAJ4mWzVbeCHve+1bZt2/pNHQ09dOFCrL29XXtILORYW5v28ENrrqqqykggYY0NIcq1Nj26urt3KEMyuToCtuyEwWarbtt26SoqKkpIutvycmjhcpx5//3Hy50qw9SFHU6dOlVlojrS3VrF13m+tzeKoY9bn13DDQF+B1XV1d31O3e6nvzMVqyOvGEgCYPNVnt7e31pL1VUVLh69skk7Al29J13IsoAXHj/7+jRxoJVq5pNvLFRZXR2dv6zMqDGw2MBt0IQ4WtcbCITPyPcEDh/J9Lt3OlHo9EOBtPysTryhi07YUxNmy1kc2WlmPWjFEz8rTT4/WP3ht+//vq+tuPHtT6fdLarqwL/ronTQ3VNQr5x6NDjxzs6mpb7NeJn5QTTj/4HR7eznXdHrI68Y4UkEDZbveCseSiDTK5JeIVTOOOnTzcoQ1AF4EJ76ZNPIrvq6094eaPjQo2BiSGDv6/a2lrPd8YII7dfY3J0tPp3Bw+G/uOFF15RArS0tGh5bfzql79sVhqxOvKOgSQQHlQ1HUiSxr1vh1M4z3V3b58xdLeZ8rGz1nPwtdeiG8rLu9ESS6cKQUWU+OijSP/gYMzk8eu4cfA6ePLWkSM7vAbm1PR0GKG2p6mpVQXMrzXWdLA60oOBJBAujK3Hjs2avNBVbtok+jC+2MMPt/6xo6NR+QDBhA/8zEucoL63qCiZn58/m//tb/9t4m/2xo18pxoKXZ+eDt0+CGBSJBLxdDHCutZ5TWuSCLWzZ8/2S3iQWhpWR3owkITCZqsmprVS/rGmJqEEe+R73+s7d+5cws+7YYQM2lP4UAKgOorV1XkaKNA9gt4Zj29nIH0TqyN9ONQg1JYtW4xNwGHc2+uuBX5oaGhoMfVckg2wduT1YuR2B4/FLHQoZLZjdaQPA0momvvuGzZ1MZY47r0QXIzvv//+rHpDpqA68rpNkJfzsZZy+6GQ2YzVkV4MJKG8bLZ6JxLHvRfzL089FS8vL8+q/dtwI9LU2Oh5AuzSZ5+FlQFYS1N0U//AgLG2erZVR8BAEgybrSrNJI97L+bHTz/dikMEVZZAVajjznhubi5PGTA/N8eWneMDpwI1tcaZjdURMJAEM7HZquRx78WgWty9e/ebK316YDhIW7du7UBVqEi8eDxubEeVbKyOgIEkmInNVqWPey8Gd4tNe/Y0Z3IoVVZWxnc/84y2C1FeXt6cMiA3Ly9rB01SWB2ZwUASDputKo2kj3svJZNDCetkz2p+6HTd2rVG2pylpaVGTve1CasjMxhIwtXcd5+2iThbxr2XkgqlTFpTQpsuncP/lmvTpk1JE5Oako4sCQKrI3MYSMJhAEHXZqu2jHvfCd6w2FcNLS5luWg02qqzTXcr3Hw4v3Ot65DSjiwJwp97eoyNvWdzdQQMJAtgs1WlgU3j3suBFlesrq7FxhYeph3/dffuV0wPMHz/0UdP66yS6nfuDHwvuyCNjIyETO2gUlxcnPVhz0CyADZbVR7ZOO69HNiIFS08m55Vclp0J/79uede8eP3ofPhYlSkmfgaSsex9nZja0exbduyujoCBpIFsHeY17tcG8e9lwsXXazBPPXEE6IHHtDu+vnPfvay06Lr8HMtT8fDxVize1bATt9BMl0dcY9Abq5qDa+brdo67p0OvKGdj5ePtbVFBwYHa69evRpRArg53kI3BPbhI0cm3ZxGjDDDw8kqy7E6Ms+KQCooKJi46y59xVy6z2c4n38WLS+lSb6L50M2O4EyNjYWUS6lO+6Nn5HO79lPaOPhA0cvYLfrscuXI6bPVrodqqGysrLhH9TXx6VMNqIyc34eE8s9awpVOdp9Xta5dL93gjI5OZmP95+J7+We1auTrI6+kvPS/v2/VkQZDhuN9g0MVI2Pj4dNVE64eK8Nh/uLS0qS/xSN9klfnEYVmRgerr5y5UrFrRuw4vtwAjS5YcOGfuwUYvtjAmSPnJwcBhJlHxyfMDQ0FMbmo1NTU/cgpObn5/NxYZ6ZmVmwcsCFOjc3dxZ/Onf9k7nOnwife0OhiUgkkrR5Ogo/j2tTU/mrCwtnGUAUFAQS15Ao6+Cie3O9SamEoq92lmcQkQCcsiMiIhEYSEREJAIDiYiIRGAgERGRCAwkIiISgYFEREQiMJCIiEgEBhIREYnAQCIiIhEYSEREJAIDiYiIRGAgERGRCAwkIiISgYFEREQiMJCIiEgEBhIREYnAQCIiIhEYSEREJAIDiYiIRGAgERGRCAwkIiISgYFEREQiMJCIiEgEBhIREYnAQCIiIhEYSEREJAIDiYiIRGAgERGRCAwkIiISgYFEREQiMJCIiEiEFYqIKAvl5OQoEuUvfwUYvyPZHkPjVwAAAABJRU5ErkJggg=="});};});var $r,cV,Dm;var uV=d(function(){$r=y(_("react"));$g();cV=y(Ku());B();W();U();$e();QG();oV();lV();Dm=w(function i(){var t=(0,$r.useRef)(null);var _D13=D(),e=_D13.canvas,r=_D13.config;var o=function o(){var a=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(t==null?void 0:t.current){var _t$current=t.current,l=_t$current.clientWidth,c=_t$current.clientHeight;var u=Eo();t.current.width=l*u;t.current.height=c*u;e.saveDimensions({width:l,height:c,render:a});}};var n=new Hl((0,cV["default"])(function(){return o();},100,{trailing:true}));(0,$r.useEffect)(function(){var a=t.current;e.setCanvasElement(a);return function(){n.disconnect();};},[]);(0,$r.useLayoutEffect)(function(){o(false);n.observe(t.current);});var s=r.licenseChecker;return $r["default"].createElement($r["default"].Fragment,null,s&&s.isWhiteLabel()?null:$r["default"].createElement(aV,null),$r["default"].createElement(mt.Element,{ref:t,"aria-label":"Canvas","data-test":N.Canvas}),$r["default"].createElement(ZG,null,$r["default"].createElement(rV,null)));});});var zI,zv;var dV=d(function(){zI=y(_("react"));zv=function zv(_ref298){var i=_ref298.children;return zI["default"].createElement(zI["default"].Fragment,null,i);};});var UI=d(function(){dV();});var Em;var mV=d(function(){it();Xt();$e();UI();Em=function Em(){var _this388=this;var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Em);this.getAdvancedCategoryCard=function(){return _this388.components.advancedUICategoryCard;};this.getAdvancedItemCard=function(){return _this388.components.advancedUIItemCard;};this.getAdvancedToolbarItem=function(){return _this388.components.advancedUIToolbarItem;};this.getAdvancedToolbar=function(){return _this388.components.advancedUIToolbar;};this.getAdvancedToolControlBar=function(){return _this388.components.advancedUIToolControlBar;};this.getBasicToolbar=function(){return _this388.components.basicUIToolbar;};this.getBasicToolControlBar=function(){return _this388.components.basicUIToolControlBar;};this.getBasicToolItemsBar=function(){return _this388.components.basicUIToolItemsBar;};this.getDialog=function(){return _this388.components.dialog;};this.getButton=function(t){return _this388.components.buttons[t];};this.getColorItem=function(){return _this388.components.colorItem;};this.getCheckbox=function(){return _this388.components.checkbox;};this.getWindowContainer=function(){return _this388.components.windowContainer;};this.getSlider=function(){return _this388.components.slider;};var r={dialog:P.Dialog,colorItem:P.ColorItem,checkbox:P.Input.Checkbox,slider:P.Input.Slider,buttons:{mainCanvasActionUndo:mt.Button.TextSecondary,mainCanvasActionRedo:mt.Button.TextSecondary,mainCanvasActionExport:Up,mainCanvasActionClose:Ea,canvasActionEdit:mt.Controls.SpriteActionButton,canvasActionBringToFront:mt.Controls.SpriteActionButton,canvasActionDuplicate:mt.Controls.SpriteActionButton,canvasActionDelete:mt.Controls.SpriteActionButton,canvasActionInvert:mt.Controls.SpriteActionButton,canvasActionFlip:mt.Controls.SpriteActionButton,transformActionFlipHorizontal:hs,transformActionFlipVertical:hs,transformActionRotateClockwise:hs,transformActionRotateAntiClockwise:hs,textAlignment:hs,toolControlBarPrimaryButton:zp,toolControlBarSecondaryButton:Ea},windowContainer:zv};this.components=Fi([r,e,t]);};});var na,Gut,Fm;var pV=d(function(){na=y(_("react"));B();R();it();Xt();Gut=function Gut(_ref299){var i=_ref299.modal,t=_ref299.textTool,e=_ref299.textDesignTool,r=_ref299.custom;var o=i.type,n=i.identifier,s=i.isVisible,a=i.modalProps,l=i.positionOffset;var c=a.headerLabel,u=a.bodyLabel,m=a.confirmLabel,p=a.dismissLabel,h=a.handleClose,g=a.handleConfirm,x=a.handleDismiss;var v=r.getDialog();if(o==="info"){return na["default"].createElement(P.InfoModal,{headerLabel:c,bodyLabel:u},na["default"].createElement(v,{type:o,isVisible:s,identifier:n,position:l,handleClose:h,headerLabel:c,bodyLabel:u}));}if(o==="textEdit"){var _t$locale$canvasContr=t.locale.canvasControls,b=_t$locale$canvasContr.buttonSave,T=_t$locale$canvasContr.buttonClose;var k={type:o,isVisible:i.isVisible,confirmLabel:b,dismissLabel:T,headerLabel:t.locale.canvasControls.inputText};if(t.isTextSelected){return na["default"].createElement(P.TextEditModal,_objectSpread(_objectSpread({},k),{},{defaultText:gt.defaultText(),handleConfirm:t.changeText,handleDismiss:t.setEditMode,text:t.text,maxLength:t.config.maxCharacterLimit,allowEmojis:t.config.allowEmojis}),na["default"].createElement(v,{type:o,isVisible:s,identifier:n,position:l,handleClose:h,confirmLabel:b,dismissLabel:T,headerLabel:t.locale.canvasControls.inputText}));}if(e.isTextDesignSelected){return na["default"].createElement(P.TextEditModal,_objectSpread(_objectSpread({},k),{},{defaultText:Mt.defaultText(),handleConfirm:e.changeText,handleDismiss:e.setEditMode,text:e.text,maxLength:e.config.maxCharacterLimit,allowEmojis:e.config.allowEmojis}),na["default"].createElement(v,{type:o,isVisible:s,identifier:n,position:l,handleClose:h,confirmLabel:b,dismissLabel:T,headerLabel:t.locale.canvasControls.inputText}));}}return na["default"].createElement(P.ActionModal,{type:o,headerLabel:c,bodyLabel:u,confirmLabel:m,dismissLabel:p,handleClose:h,handleConfirm:g,handleDismiss:x},na["default"].createElement(v,{type:o,isVisible:s,identifier:n,position:l,confirmLabel:m,dismissLabel:p,headerLabel:c,bodyLabel:u,handleClose:h}));};Fm=rt("textTool","textDesignTool","modal","custom")(w(Gut));});var Uv,hV,Vut,fV,NI;var gV=d(function(){Uv=y(_("react"));hV=y(_("styled-components"));it();U();Vut=(0,hV["default"])(P.Input.Label)(_templateObject259||(_templateObject259=_taggedTemplateLiteral(["\n padding: 0;\n padding-left: 4px;\n"])));fV=/*#__PURE__*/function(_Uv$default$Component){_inherits(fV,_Uv$default$Component);var _super246=_createSuper(fV);function fV(t){var _this389;_classCallCheck(this,fV);_this389=_super246.call(this,t);_this389.onChange=function(t){_this389.setState({value:t.replace(/[^\d.,-]/g,""),isSubmitted:false});};_this389.onSubmit=function(){var t=_this389.props.getCorrectValue;var _this389$state=_this389.state,e=_this389$state.isSubmitted,r=_this389$state.value;if(!e){_this389.setState({value:t(parseInt(r,10)||0).toString(),isSubmitted:true});}};_this389.state={isSubmitted:false,value:t.value.toString()};return _this389;}_createClass(fV,[{key:"componentDidUpdate",value:function componentDidUpdate(t){var e=this.props.value;if(t.value!==e){this.setState({value:e.toString()});}}},{key:"render",value:function render(){var _this$props18=this.props,t=_this$props18.id,e=_this$props18.isDisabled,r=_this$props18.label,o=_this$props18["aria-label"];var n=this.state.value;return Uv["default"].createElement(P.Input.Text,{id:t,"aria-label":o,value:n,isDisabled:e,onChange:this.onChange,onBlur:this.onSubmit,onKeyUp:sA(this.onSubmit)},Uv["default"].createElement(Vut,{label:r,htmlFor:t}));}}]);return fV;}(Uv["default"].Component);NI=fV;});var xu,HI,jut,$ut,Kut,Xut,qut,gf;var bV=d(function(){xu=y(_("react"));HI=y(_("styled-components"));it();gV();jut=HI["default"].div(_templateObject260||(_templateObject260=_taggedTemplateLiteral(["\n display: grid;\n grid-template-columns: 1fr min-content 1fr;\n gap: 1rem;\n align-items: center;\n max-width: ","px;\n"])),function(i){return i.theme.measurements.inputs.cropSize.maxWidth;});$ut=HI["default"].span(_templateObject261||(_templateObject261=_taggedTemplateLiteral(["\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n color: ",";\n"])),function(i){return i.theme.measurements.fontSystem.body.size;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body["case"];},function(i){return i.theme.textInput.foreground;});Kut="photoeditorsdk-transformScaleWidth";Xut="photoeditorsdk-transformScaleHeight";qut=function qut(_ref300){var _ref300$showLabel=_ref300.showLabel,i=_ref300$showLabel===void 0?true:_ref300$showLabel,t=_ref300.label,e=_ref300.isDisabled,r=_ref300.valueHeight,o=_ref300.valueWidth,n=_ref300.labelWidth,s=_ref300.labelHeight,a=_ref300.ariaLabelWidth,l=_ref300.ariaLabelHeight,c=_ref300.onSubmitWidth,u=_ref300.onSubmitHeight;return xu["default"].createElement("div",null,xu["default"].createElement(P.Input.Label,{id:"photoeditorsdk-crop-size-label",label:t,show:i}),xu["default"].createElement(jut,{"aria-labelledby":"photoeditorsdk-crop-size-label"},xu["default"].createElement(NI,{id:Kut,value:o,getCorrectValue:c,label:n,"aria-label":a,isDisabled:e}),xu["default"].createElement($ut,null,"x"),xu["default"].createElement(NI,{id:Xut,value:r,getCorrectValue:u,label:s,"aria-label":l,isDisabled:e})));};gf=qut;});var Ge=d(function(){yy();SW();JW();f1();uV();mV();pV();MI();bV();});var $V=Gt(function(lne,jV){"use strict";var udt=false;var VV=function VV(){};if(udt){GV=function i(t,e){var r=arguments.length;e=new Array(r>1?r-1:0);for(var o=1;o2?r-2:0);for(var o=2;oi;return Ti["default"].createElement(Hdt,null,p.map(function(g){if(g){var x=g.props.label||"";return Ti["default"].createElement(i0,{activeTab:o,key:x,label:x,onClick:c});}return null;}),h&&Ti["default"].createElement(Wdt,{onClick:u,ariaLabel:"Select Next"},"..."),s&&m(),Ti["default"].Children.map(t,function(g){if(!g||g.props&&g.props.label!==o){return null;}return Ti["default"].createElement(WK,{key:g.props.label},g.props.children);}));};});var r0=d(function(){NK();KK();});var Jo,qK,YK,XK,Vdt,JK;var ZK=d(function(){Jo=y(_("react"));qK=y(Ku());YK=y(_("styled-components"));Sr();r0();XK=100;Vdt=YK["default"].div(_templateObject286||(_templateObject286=_taggedTemplateLiteral(["\n position: relative;\n white-space: nowrap;\n display: flex;\n flex-direction: column;\n transition: all 0.2s linear;\n"])));JK=function JK(_ref331){var i=_ref331.children;var _ref332=(0,Jo.useState)(Jo["default"].Children.count(i)),_ref333=_slicedToArray(_ref332,2),t=_ref333[0],e=_ref333[1];var _ref334=(0,Jo.useContext)(Oe),r=_ref334.rect;(0,Jo.useEffect)(function(){window.addEventListener("resize",o);o();return function(){window.removeEventListener("resize",o);};},[r]);var o=(0,qK["default"])(function(){var n=(r==null?void 0:r.width)||0;var s=Jo["default"].Children.count(i);var a=n-32-64-s*XK;if(a<0){var l=Math.round(Math.abs(a/XK));e(s-l);}else{e(s);}},100);if(!t){return null;}return Jo["default"].createElement(Vdt,null,Jo["default"].createElement(Gf,{length:t},i));};});var o0,jdt,QK;var tX=d(function(){o0=y(_("styled-components"));jdt=o0["default"].div(_templateObject287||(_templateObject287=_taggedTemplateLiteral(["\n &:after {\n content: '';\n position: absolute;\n bottom: 0px;\n ","\n border-bottom: 1px solid ",";\n }\n"])),function(i){return i.full?o0.css(_templateObject288||(_templateObject288=_taggedTemplateLiteral(["\n left: -24px;\n width: calc(100% + 48px);\n "]))):"\n left: 24px;\n width: calc(100% - 48px);\n ";},function(i){return i.theme.toolControlBar.separatorColor;});QK=jdt;});var Vf,n0,eX,$dt,iX;var rX=d(function(){Vf=y(_("react"));n0=y(_("styled-components"));Sr();W();eX=n0.css(_templateObject289||(_templateObject289=_taggedTemplateLiteral(["\n width: 100%;\n"])));$dt=n0["default"].div(_templateObject290||(_templateObject290=_taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n width: 100%;\n\n > div {\n position: relative;\n width: 224px;\n\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n }\n"])),function(i){return i.smallContainer&&eX;},eX);iX=function iX(_ref335){var i=_ref335.children,t=_objectWithoutProperties(_ref335,_excluded12);var _D16=D(),e=_D16.custom;var _ref336=(0,Vf.useContext)(Oe),r=_ref336.rect;var o=e.getSlider();if(!o){return null;}return Vf["default"].createElement($dt,{smallContainer:!!r&&r.width<600},Vf["default"].createElement(o,_objectSpread({centerSlider:true},t),i));};});var s0,Kdt,oX;var nX=d(function(){s0=y(_("styled-components"));U();Kdt=s0["default"].div.attrs(function(){return{"data-test":N.CategoryItemsContainer};})(_templateObject291||(_templateObject291=_taggedTemplateLiteral(["\n visibility: hidden;\n opacity: 0;\n display: none;\n\n ","\n"])),function(_ref337){var i=_ref337.show;return i&&s0.css(_templateObject292||(_templateObject292=_taggedTemplateLiteral(["\n opacity: 1;\n visibility: visible;\n display: flex;\n "])));});oX=Kdt;});var jf,fD;var sX=d(function(){jf=y(_("styled-components"));U();fD=jf["default"].div.attrs(function(){return{"data-test":N.ToolControlBar};})(_templateObject293||(_templateObject293=_taggedTemplateLiteral(["\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n position: relative;\n width: 100%;\n z-index: ",";\n\n ","\n"])),function(i){return i.theme.measurements.zIndex.toolControlBar;},function(i){return i.show?jf.css(_templateObject294||(_templateObject294=_taggedTemplateLiteral(["\n transition-timing-function: ease-in;\n transition-duration: 0.3s;\n transition-property: all;\n padding: 2px 0px;\n background: ",";\n color: ",";\n "])),i.theme.toolControlBar.background,i.theme.toolControlBar.inputLabelForeground):jf.css(_templateObject295||(_templateObject295=_taggedTemplateLiteral(["\n max-height: 0px;\n "])));});fD.defaultProps={show:true};});var aX,Xdt,lX;var cX=d(function(){aX=y(_("styled-components"));Xdt=aX["default"].div(_templateObject296||(_templateObject296=_taggedTemplateLiteral(["\n height: ","px;\n width: 2px;\n margin: 0 10px;\n display: inline-flex;\n position: relative;\n &:after {\n content: ' ';\n right: 0px;\n position: absolute;\n top: 8px;\n height: calc(100% - 16px);\n border-right: 1px solid\n ",";\n }\n"])),function(i){return i.theme.measurements.basicUIToolControlBar.itemsBarHeight;},function(i){return i.theme.toolControlBar.separatorColor;});lX=Xdt;});var da,dX,uX,a0,mX,l0;var gD=d(function(){da=y(_("styled-components"));it();dX=da["default"].span(_templateObject297||(_templateObject297=_taggedTemplateLiteral(["\n display: flex;\n cursor: pointer;\n z-index: ",";\n transition: bottom 0.3s linear;\n\n color: ",";\n letter-spacing: ",";\n font-size: ","px;\n\n ","\n\n &:active {\n color: ",";\n }\n"])),function(i){return i.theme.measurements.zIndex.label;},function(i){return i.theme.toolbar.foreground;},function(i){return i.theme.measurements.fontSystem.body.letterSpacing;},function(i){return i.theme.measurements.fontSystem.body.size;},function(_ref338){var i=_ref338.isActive;return i&&da.css(_templateObject298||(_templateObject298=_taggedTemplateLiteral(["\n color: ",";\n "])),function(t){return t.theme.toolbar.activeForeground;});},function(i){return i.theme.toolbar.activeForeground;});uX=da.css(_templateObject299||(_templateObject299=_taggedTemplateLiteral(["\n background-color: ",";\n color: ",";\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.toolbar.activeBackground;},function(i){return i.theme.toolbar.activeForeground;},function(i){return i.theme.toolbar.activeForeground;});a0=(0,da["default"])(yi)(_templateObject300||(_templateObject300=_taggedTemplateLiteral(["\n display: block;\n height: 100%;\n width: 100%;\n color: ",";\n background-color: ",";\n border: unset;\n box-shadow: unset;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n font-family: '","', sans-serif;\n\n ","\n ","\n\n &:active {\n ","\n }\n\n svg {\n display: flex;\n transition: visibility 0s, opacity 0.5s linear;\n visibility: visible;\n opacity: 1;\n }\n"])),function(i){return i.theme.toolbar.foreground;},function(i){return i.theme.toolbar.background;},function(i){return i.theme.measurements.fontSystem.label.size;},function(i){return i.theme.measurements.fontSystem.label.letterSpacing;},function(i){return i.theme.measurements.fontSystem.label["case"];},function(i){return i.theme.typography.fontFamily;},function(_ref339){var i=_ref339.isActive;return i&&uX;},function(_ref340){var i=_ref340.isDisabled;return i&&da.css(_templateObject301||(_templateObject301=_taggedTemplateLiteral(["\n &:disabled {\n cursor: default;\n pointer-events: none;\n opacity: ",";\n }\n "])),function(t){return t.theme.button.textInactiveOpacity;});},uX);mX=da["default"].div(_templateObject302||(_templateObject302=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n svg {\n color: ",";\n }\n"])),function(i){return i.theme.toolbar.foreground;});l0=da["default"].div.attrs({role:"none"})(_templateObject303||(_templateObject303=_taggedTemplateLiteral(["\n display: flex;\n height: ","px;\n text-align: center;\n min-width: 100px;\n /* Allow the text to grow in this limit */\n max-width: 150px;\n position: relative;\n /* Position inline-block box at the top of the line box */\n vertical-align: top;\n /* Allow text to wrap again, overwriting the Toolbar style */\n white-space: normal;\n margin: 1px;\n"])),function(i){return i.theme.measurements.basicUIToolbar.openHeight-2;});});var bD,$f,qdt,pX;var hX=d(function(){bD=y(_("react"));$f=y(_("styled-components"));it();U();gD();qdt=$f["default"].div(_templateObject304||(_templateObject304=_taggedTemplateLiteral(["\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n position: relative;\n width: 100%;\n transition: height 0.2s ease-out, display 0.1s fade-out;\n background-color: ",";\n color: ",";\n z-index: ",";\n\n ","\n"])),function(i){return i.theme.toolbar.background;},function(i){return i.theme.toolbar.foreground;},function(i){return i.theme.measurements.zIndex.toolbar;},function(i){return i.show?$f.css(_templateObject305||(_templateObject305=_taggedTemplateLiteral(["\n height: ","px;\n "," {\n svg {\n visibility: hidden;\n opacity: 0;\n height: 0;\n }\n }\n "," {\n height: ","px;\n }\n "])),i.theme.measurements.basicUIToolbar.closeHeight,a0,l0,i.theme.measurements.basicUIToolbar.closeHeight):$f.css(_templateObject306||(_templateObject306=_taggedTemplateLiteral(["\n height: ","px;\n "])),i.theme.measurements.basicUIToolbar.openHeight);});pX=function pX(_ref341){var _ref341$show=_ref341.show,i=_ref341$show===void 0?false:_ref341$show,t=_ref341.className,e=_ref341.style,r=_ref341.children;return bD["default"].createElement(qdt,{"data-test":N.Toolbar,show:i,className:t,style:e},bD["default"].createElement(Oo,null,r));};});var Kf,fX;var gX=d(function(){Kf=y(_("react"));U();gD();fX=function fX(_ref342){var i=_ref342.children,t=_ref342.label,e=_ref342.isActive,r=_ref342.isDisabled,o=_ref342.onClick;return Kf["default"].createElement(l0,{"aria-haspopup":true,"aria-expanded":e},Kf["default"].createElement(a0,{"data-test":N.ToolbarItem,ariaLabel:t,onClick:o,isActive:e,isDisabled:r},Kf["default"].createElement(mX,null,i,Kf["default"].createElement(dX,{isActive:e},t))));};});var Xf,Ydt,bX;var yX=d(function(){Xf=y(_("styled-components"));Ydt=Xf["default"].li.attrs({role:"none"})(_templateObject307||(_templateObject307=_taggedTemplateLiteral(["\n ","\n width: 2px;\n display: inline-block;\n position: relative;\n &:after {\n content: ' ';\n right: 0px;\n position: absolute;\n top: 8px;\n height: calc(100% - 16px);\n border-right: 1px solid\n ",";\n }\n"])),function(i){return!i.active?Xf.css(_templateObject308||(_templateObject308=_taggedTemplateLiteral(["\n height: ","px;\n "])),i.theme.measurements.basicUIToolbar.openHeight):Xf.css(_templateObject309||(_templateObject309=_taggedTemplateLiteral(["\n height: ","px;\n "])),i.theme.measurements.basicUIToolbar.closeHeight);},function(i){return i.theme.toolControlBar.separatorColor;});bX=Ydt;});var M;var qt=d(function(){it();wK();IK();FK();AK();LK();ZK();tX();rX();r0();nX();sX();cX();hX();gX();yX();M={CardContainer:_K,ExpandableContainer:oX,CategoryContainer:kK,Card:gK,CardAvatar:Jl,CardLabel:CK,Toolbar:{Index:pX,Item:fX,Separator:bX},BarSeparator:QK,ItemsSeparator:lX,Itemsbar:fD,Controlsbar:EK,ControlsbarContainer:MK,ResponsiveTabWrapper:JK,Slider:iX,TabWrapper:Gf,Tab:ua,Other:{ControlsWrapper:RK}};});var Um,_X;var xX=d(function(){Um=y(_("react"));B();R();W();we();qt();_X=w(function i(){var _D17=D(),t=_D17.config,e=_D17.active,r=_D17.custom;var o=t.tools;var n=e.tool;var s=function s(u){var m=t.state.config[u];if("icon"in m){var h=m.icon;return Um["default"].createElement(h,null);}var p=vy[u];return Um["default"].createElement(p,null)||null;};var a=function a(u){return t.locale[u].title;};var l=function l(u,m){return u&&Um["default"].createElement(M.Toolbar.Item,{onClick:function onClick(){return e.selectTool(u);},key:u,label:a(u),isActive:n===u,isDisabled:!(e.image||u==="library"||u==="customTool")},s(u))||Um["default"].createElement(M.Toolbar.Separator,{key:u+m,active:!!n});};var c=r.getBasicToolbar();if(!c){return null;}return Um["default"].createElement(c,{show:!!n},o.map(l));});});var Yn,vX,Jdt,Zdt,CX;var SX=d(function(){Yn=y(_("react"));B();vX=y(_("styled-components"));R();it();we();qt();Jdt=(0,vX["default"])(M.ControlsbarContainer)(_templateObject310||(_templateObject310=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));Zdt=function Zdt(_ref343){var i=_ref343.adjustmentsTool,t=_ref343.custom;var e=i.selectedAdjustmentType.toLowerCase();var r=i[e];var o=t.getButton("toolControlBarSecondaryButton");return Yn["default"].createElement(Jdt,{show:Boolean(e)},o&&Yn["default"].createElement("div",null,Yn["default"].createElement(o,{tool:"adjustment",ariaLabel:i.locale.controls.buttonReset,onClick:i.reset,icon:Yn["default"].createElement(Re.reset,null),label:i.locale.controls.buttonReset})),Yn["default"].createElement(M.Other.ControlsWrapper,null,Yn["default"].createElement(P.Spacer,{count:2}),Yn["default"].createElement(M.Slider,{identifier:i.selectedAdjustmentType,tool:"adjustment","aria-hidden":!e,adjust:true,label:i.selectedOptionLabel,value:r,onChange:function onChange(n){i.editAdjustments({type:e,value:n});},onMouseUp:function onMouseUp(){return i.toolSnapshot();},onTouchEnd:function onTouchEnd(){return i.toolSnapshot();},snap:0}),Yn["default"].createElement(P.Spacer,{count:2})),Yn["default"].createElement(M.BarSeparator,null));};CX=rt("adjustmentsTool","custom")(w(Zdt));});var qf,wX;var TX=d(function(){qf=y(_("react"));B();R();Ge();it();W();wX=w(function(){var _D18=D(),i=_D18.brushTool;var t=i.colorList,e=i.locale,r=i.localeColor;var o=e.controls;var n=r.colorPicker;return qf["default"].createElement(qf["default"].Fragment,null,qf["default"].createElement(P.Input.Selection,{showLabel:false,label:o.selectColor},qf["default"].createElement(De,{tool:"brush",activeColor:i.color,colors:t,labelsColor:n,colorPickerDirection:"top",onChange:i.changeColor})));});});var kX=d(function(){TX();});var IX,DX;var EX=d(function(){IX=y(_("react"));B();R();W();U();qt();DX=w(function(){var _D19=D(),i=_D19.brushTool;var t=i.locale;var e=t.controls;return IX["default"].createElement(M.Slider,{identifier:"brush-hardness",tool:"brush","data-test":N.BrushHardness,showLabel:false,label:e.sliderHardness,value:i.hardness,min:0,max:1,onChange:i.changeHardness});});});var FX=d(function(){EX();});var OX,RX;var AX=d(function(){OX=y(_("react"));B();R();W();U();qt();RX=w(function(){var _D20=D(),i=_D20.brushTool;var t=i.locale;var e=t.controls;return OX["default"].createElement(M.Slider,{identifier:"brush-size",tool:"brush","data-test":N.BrushSize,showLabel:false,label:e.sliderSize,value:i.relativeSize,min:1,max:100,divider:1,onChange:i.changeRelativeSize});});});var BX=d(function(){AX();});var yr,PX,Qdt,yD,tmt,MX;var LX=d(function(){yr=y(_("react"));B();PX=y(_("styled-components"));R();it();W();we();qt();kX();FX();BX();Qdt=M.ResponsiveTabWrapper;var _M2=M;yD=_M2.Tab;tmt=(0,PX["default"])(M.ControlsbarContainer)(_templateObject311||(_templateObject311=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));MX=w(function(){var _D21=D(),i=_D21.brushTool,t=_D21.custom;var e=i.locale,r=i.config;var o=r.basicUIToolControlBarTabsOrder;var n=e.controls;var s=t.getButton("toolControlBarSecondaryButton");var a=function a(l){switch(l){case"brushColor":return yr["default"].createElement(yD,{key:l,label:n.tabColor},yr["default"].createElement(wX,null));case"brushSize":return yr["default"].createElement(yD,{key:l,label:n.tabSize},yr["default"].createElement(RX,null));case"brushHardness":return yr["default"].createElement(yD,{key:l,label:n.tabHardness},yr["default"].createElement(DX,null));default:return null;}};return yr["default"].createElement(tmt,{style:{justifyContent:"center"},show:true},s&&yr["default"].createElement("div",null,yr["default"].createElement(s,{tool:"brush",ariaLabel:n.buttonReset,onClick:i.reset,icon:yr["default"].createElement(Re.reset,null),isDisabled:!i.isDirty,label:n.buttonReset})),yr["default"].createElement(M.Other.ControlsWrapper,null,yr["default"].createElement(P.Input.Form,null,yr["default"].createElement(Qdt,null,o.map(function(l){return a(l);})))));});});var Yf,zX;var UX=d(function(){Yf=y(_("react"));B();R();it();W();qt();zX=w(function(){var _D22=D(),i=_D22.filterTool;var t=i.state;var e=i.locale.controls;var r=function r(){i.toolSnapshot();};return Yf["default"].createElement(M.Other.ControlsWrapper,null,Yf["default"].createElement(P.Spacer,{count:2}),Yf["default"].createElement(M.Slider,{identifier:"filter-intensity",tool:"filter","aria-hidden":!i.isOptionSelected,label:e.sliderIntensity,value:t.intensity,min:0,max:1,onMouseUp:r,onTouchEnd:r,onChange:i.changeIntensity,snap:t.isDuotone?.5:null}),Yf["default"].createElement(P.Spacer,{count:2}));});});var NX=d(function(){UX();});var Au,HX,emt,WX;var GX=d(function(){Au=y(_("react"));B();HX=y(_("styled-components"));R();W();we();qt();NX();emt=(0,HX["default"])(M.ControlsbarContainer)(_templateObject312||(_templateObject312=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));WX=w(function(){var _D23=D(),i=_D23.filterTool,t=_D23.custom;var e=i.config;var r=e.basicUIToolControlBarTabsOrder;var o=t.getButton("toolControlBarSecondaryButton");var n=function n(s){switch(s){case"filterIntensity":return Au["default"].createElement(zX,{key:s});default:return null;}};return Au["default"].createElement(emt,{show:i.isOptionSelected},o&&Au["default"].createElement("div",null,Au["default"].createElement(o,{tool:"filter",ariaLabel:i.locale.controls.buttonReset,onClick:i.reset,icon:Au["default"].createElement(Re.reset,null),label:i.locale.controls.buttonReset})),r.map(function(s){return n(s);}),Au["default"].createElement(M.BarSeparator,null));});});var Jn,VX,imt,jX;var $X=d(function(){Jn=y(_("react"));B();VX=y(_("styled-components"));R();it();W();we();qt();imt=(0,VX["default"])(M.ControlsbarContainer)(_templateObject313||(_templateObject313=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));jX=w(function(){var _D24=D(),i=_D24.focusTool,t=_D24.custom;var e=i.locale.controls;var r=t.getButton("toolControlBarSecondaryButton");var o=function o(){i.toolSnapshot(e.sliderIntensity);};return Jn["default"].createElement(imt,{show:i.isOptionSelected},r&&Jn["default"].createElement("div",null,Jn["default"].createElement(r,{tool:"focus",ariaLabel:e.buttonReset,onClick:i.reset,icon:Jn["default"].createElement(Re.reset,null),label:e.buttonReset})),Jn["default"].createElement(M.Other.ControlsWrapper,null,Jn["default"].createElement(P.Spacer,{count:2}),Jn["default"].createElement(M.Slider,{identifier:"focus-intensity",tool:"focus","aria-hidden":!i.isOptionSelected,label:e.sliderIntensity,value:i.relativeIntensity,min:0,max:100,divider:1,onChange:i.changeRelativeIntensity,onMouseUp:o,onTouchEnd:o}),Jn["default"].createElement(P.Spacer,{count:2})),Jn["default"].createElement(M.BarSeparator,null));});});var _D,KX;var XX=d(function(){_D=y(_("react"));B();R();Ge();it();W();KX=w(function(){var _D25=D(),i=_D25.frameTool;var t=i.locale.controls;var e=i.localeColor.colorPicker;var r=i.colorList;return _D["default"].createElement(P.Input.Selection,{label:t.selectColor,showLabel:false},_D["default"].createElement(De,{tool:"frame",activeColor:i.color,colors:r,labelsColor:e,colorPickerDirection:"top",onChange:i.changeColor,onAddSnapshot:i.colorSnapshot}));});});var qX=d(function(){XX();});var YX,JX;var ZX=d(function(){YX=y(_("react"));B();R();W();qt();JX=w(function(){var _D26=D(),i=_D26.frameTool;var t=i.locale.controls;var e=function e(){i.toolSnapshot(t.sliderOpacity);};return YX["default"].createElement(M.Slider,{identifier:"frame-opacity",tool:"frame","aria-hidden":!i.isOptionSelected,showLabel:false,label:t.sliderOpacity,value:i.opacity,min:0,max:1,onChange:i.changeOpacity,onMouseUp:e,onTouchEnd:e});});});var QX=d(function(){ZX();});var tq,eq;var iq=d(function(){tq=y(_("react"));B();R();W();qt();eq=w(function(){var _D27=D(),i=_D27.frameTool;var t=i.locale.controls;var e=function e(){i.toolSnapshot(t.sliderSize);};return tq["default"].createElement(M.Slider,{identifier:"frame-size",tool:"frame","aria-hidden":!i.isOptionSelected,showLabel:false,label:t.sliderSize,value:i.size,min:i.minSize,max:i.maxSize,divider:1,onChange:i.changeWidth,onMouseUp:e,onTouchEnd:e});});});var rq=d(function(){iq();});var _r,oq,rmt,xD,omt,nq;var sq=d(function(){_r=y(_("react"));B();oq=y(_("styled-components"));R();W();we();qt();qX();QX();rq();rmt=M.TabWrapper;var _M3=M;xD=_M3.Tab;omt=(0,oq["default"])(M.ControlsbarContainer)(_templateObject314||(_templateObject314=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));nq=w(function(){var _D28=D(),i=_D28.frameTool,t=_D28.custom;var e=i.locale.controls;var r=i.tintable,o=i.config;var n=o.basicUIToolControlBarTabsOrder;var s=t.getButton("toolControlBarSecondaryButton");var a=function a(l){switch(l){case"frameOpacity":return _r["default"].createElement(xD,{key:l,label:e.tabOpacity},_r["default"].createElement(JX,null));case"frameSize":return _r["default"].createElement(xD,{key:l,label:e.tabSize},_r["default"].createElement(eq,null));case"frameColor":return r&&_r["default"].createElement(xD,{key:l,label:e.tabColor},_r["default"].createElement(KX,null));default:return null;}};return _r["default"].createElement(omt,{show:i.isOptionSelected},s&&_r["default"].createElement("div",null,_r["default"].createElement(s,{tool:"frame",ariaLabel:e.buttonReset,onClick:i.reset,icon:_r["default"].createElement(Re.reset,null),label:e.buttonReset})),_r["default"].createElement(M.Other.ControlsWrapper,null,_r["default"].createElement(rmt,null,n.map(function(l){return a(l);}))),_r["default"].createElement(M.BarSeparator,null));});});var bo,Jf,nmt,smt,amt,aq;var lq=d(function(){bo=y(_("react"));B();Jf=y(_("styled-components"));R();it();we();U();nD();qt();nmt=(0,Jf["default"])(M.ControlsbarContainer)(_templateObject315||(_templateObject315=_taggedTemplateLiteral(["\n ","\n"])),function(i){return i.firstChildMargin&&Jf.css(_templateObject316||(_templateObject316=_taggedTemplateLiteral(["\n > :first-child {\n margin-right: 16px;\n }\n "])));});smt=(0,Jf["default"])(M.Other.ControlsWrapper)(_templateObject317||(_templateObject317=_taggedTemplateLiteral(["\n grid-column-start: 2;\n align-self: center;\n"])));amt=function amt(_ref344){var i=_ref344.library,t=_ref344.active,e=_ref344.custom;var r=i.locale.controls.placeholderSearch;var o=i.config;var n=e.getButton("toolControlBarPrimaryButton");var s=function s(u){i.fetchImages(u);};var a=function a(u){var m=u.target.files;if(m.length){var p=new FileReader();p.onload=function(h){t.newImage(h.target.result);};p.readAsDataURL(m[0]);}};var l=function l(){t.selectWebcam(true);};var c=function c(){var u=document.getElementById("fileUpload");if(u){u.click();}};return bo["default"].createElement(nmt,{firstChildMargin:o.enableWebcam&&!i.libraryProvider,show:true},o.enableUpload&&n&&bo["default"].createElement("div",null,bo["default"].createElement(n,{tool:"library","data-test":N.LibraryUploadButton,ariaLabel:i.locale.controls.buttonUpload,onClick:c,icon:bo["default"].createElement(Re.uploadImage,null),label:i.locale.controls.buttonUpload},bo["default"].createElement(P.Input.File,{onChange:a}))),i.libraryProvider&&bo["default"].createElement(smt,null,bo["default"].createElement(P.Input.Search,{onChange:s,placeholder:r})),o.enableWebcam&&bo["default"].createElement("div",null,bo["default"].createElement(Xv,{tool:"library",onClick:l,icon:bo["default"].createElement(Re.openWebcam,null),label:i.locale.controls.buttonWebcamOpen})),bo["default"].createElement(M.BarSeparator,null));};aq=rt("library","active","custom")(w(amt));});var cq,uq;var dq=d(function(){cq=y(_("react"));B();it();W();uq=w(function(){var _D29=D(),i=_D29.overlayTool;var t=i.locale.controls;var e=i.blendMode,r=i.allBlendModes;var o=function o(n){i.changeBlendMode(n);};return cq["default"].createElement(P.Input.CarouselSlider,{showLabel:false,label:t.carouselBlendMode,defaultIdentifier:e,onSelect:o,list:r});});});var mq=d(function(){dq();});var pq,hq;var fq=d(function(){pq=y(_("react"));B();R();W();qt();hq=w(function(){var _D30=D(),i=_D30.overlayTool;var t=i.locale.controls;var e=i.state;var r=function r(){i.toolSnapshot();};return pq["default"].createElement(M.Slider,{identifier:"overlay-opacity",tool:"overlay","aria-hidden":!i.isOptionSelected,showLabel:false,label:t.sliderOpacity,value:e.opacity,min:0,max:1,onChange:i.changeOpacity,onMouseUp:r,onTouchEnd:r});});});var gq=d(function(){fq();});var yo,lmt,bq,yq;var _q=d(function(){yo=y(_("react"));B();R();W();we();qt();mq();gq();lmt=M.TabWrapper;var _M4=M;bq=_M4.Tab;yq=w(function(){var _D31=D(),i=_D31.overlayTool,t=_D31.custom;var e=i.config;var r=e.basicUIToolControlBarTabsOrder;var o=i.locale.controls;var n=t.getButton("toolControlBarSecondaryButton");var s=function s(a){switch(a){case"overlayBlendMode":return yo["default"].createElement(bq,{key:a,label:o.tabBlendMode},yo["default"].createElement(uq,null));case"overlayOpacity":return yo["default"].createElement(bq,{key:a,label:o.tabOpacity},yo["default"].createElement(hq,null));default:return null;}};return yo["default"].createElement(M.ControlsbarContainer,{show:i.isOptionSelected},n&&yo["default"].createElement("div",null,yo["default"].createElement(n,{tool:"overlay",ariaLabel:o.buttonReset,onClick:i.reset,icon:yo["default"].createElement(Re.reset,null),label:o.buttonReset})),yo["default"].createElement(M.Other.ControlsWrapper,null,yo["default"].createElement(lmt,null,r.map(function(a){return s(a);}))),yo["default"].createElement(M.BarSeparator,null));});});var Zf,xq;var vq=d(function(){Zf=y(_("react"));B();R();Ge();it();W();xq=w(function(){var _D32=D(),i=_D32.stickerTool;var t=i.locale.controls;var e=i.localeColor.colorPicker;var r=i.colorList;return Zf["default"].createElement(Zf["default"].Fragment,null,Zf["default"].createElement(P.Input.Selection,{isDisabled:!i.isStickerSelected,showLabel:false,label:t.selectColor},Zf["default"].createElement(De,{tool:"sticker",activeSprite:i.id,activeColor:i.tintColor,colors:r,labelsColor:e,isDisabled:!i.isStickerSelected,colorPickerDirection:"top",onChange:i.changeTintColor,onAddSnapshot:i.tintColorSnapshot})));});});var Cq=d(function(){vq();});var Sq,wq;var Tq=d(function(){Sq=y(_("react"));B();R();W();qt();wq=w(function(){var _D33=D(),i=_D33.stickerTool;var t=i.locale.controls;var e=function e(){i.toolSnapshot();};return Sq["default"].createElement(M.Slider,{identifier:"sticker-opacity",tool:"sticker",isDisabled:!i.isStickerSelected,showLabel:false,label:t.sliderOpacity,value:i.opacity,min:0,max:1,onMouseUp:e,onTouchEnd:e,onChange:i.changeOpacity});});});var kq=d(function(){Tq();});var Kr,vD,cmt,Iq,umt,dmt,Dq;var Eq=d(function(){Kr=y(_("react"));B();vD=y(_("styled-components"));R();it();W();we();qt();Cq();kq();cmt=M.TabWrapper;var _M5=M;Iq=_M5.Tab;umt=vD["default"].input.attrs({type:"file",id:"fileUpload",accept:"image/*",multiple:true})(_templateObject318||(_templateObject318=_taggedTemplateLiteral(["\n ","\n"])),gy.VisuallyHidden);dmt=(0,vD["default"])(M.ControlsbarContainer)(_templateObject319||(_templateObject319=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));Dq=w(function(){var _D34=D(),i=_D34.stickerTool,t=_D34.custom;var e=i.config;var r=e.basicUIToolControlBarTabsOrder;var o=i.locale.controls;var n=t.getButton("toolControlBarPrimaryButton");var s=function s(){var u=document.getElementById("fileUpload");if(u){u.value=null;u.click();}};var a=function a(u){var m=u.target.files;i.addFiles(m);};var l=function l(u){switch(u){case"stickerColor":if(!i.tintable)return null;return Kr["default"].createElement(Iq,{key:u,label:o.tabColor},Kr["default"].createElement(xq,null));case"stickerOpacity":return Kr["default"].createElement(Iq,{key:u,label:o.tabOpacity},Kr["default"].createElement(wq,null));default:return null;}};var c=function c(){if(i.isCustomStickerEnabled&&n){return Kr["default"].createElement("div",null,Kr["default"].createElement(n,{tool:"sticker",ariaLabel:o.buttonUpload,onClick:s,icon:Kr["default"].createElement(Re.uploadImage,null),label:o.buttonUpload},Kr["default"].createElement(umt,{onChange:a})));}return null;};return Kr["default"].createElement(dmt,{show:true},c(),Kr["default"].createElement(M.Other.ControlsWrapper,null,Kr["default"].createElement(cmt,null,r.map(function(u){return l(u);}))),Kr["default"].createElement(M.BarSeparator,null));});});var CD,Fq;var Oq=d(function(){CD=y(_("react"));B();R();Ge();it();W();Fq=w(function(){var _D35=D(),i=_D35.textTool;var t=i.backgroundColorList;var e=i.locale.controls;var r=i.localeColor.colorPicker;return CD["default"].createElement(P.Input.Selection,{isDisabled:!i.isTextSelected,showLabel:false,label:e.selectBackgroundColor},CD["default"].createElement(De,{tool:"text",activeSprite:i.id,activeColor:i.backgroundColor,colors:t,labelsColor:r,colorPickerDirection:"top",isDisabled:!i.isTextSelected,onChange:i.changeBackgroundColor,onAddSnapshot:i.backgroundColorSnapshot}));});});var Rq=d(function(){Oq();});var Aq,Bq,mmt,Pq;var Mq=d(function(){Aq=y(_("react"));B();Bq=y(_("styled-components"));it();W();mmt=(0,Bq["default"])(P.Input.NumericInput)(_templateObject320||(_templateObject320=_taggedTemplateLiteral(["\n max-width: 55px;\n > div > input {\n text-align: center;\n }\n"])));Pq=w(function(){var r;var _D36=D(),i=_D36.textTool;var t=i.locale;var e=function e(o){var n=o?parseFloat(o):0;i.setFontSize(Math.max(10,Math.min(690,n)));};return Aq["default"].createElement(mmt,{id:"photoeditorsdk-text-font-size-input",value:i.fontSize.toFixed(0),onSubmit:e,isDisabled:!i.isTextSelected,label:(r=t.controls)==null?void 0:r.textFontSize,showLabel:false});});});var Lq=d(function(){Mq();});var zq,Uq;var Nq=d(function(){zq=y(_("react"));B();R();W();qt();Uq=w(function(){var _D37=D(),i=_D37.textTool;var t=i.locale.controls;var e=function e(){i.toolSnapshot();};return zq["default"].createElement(M.Slider,{identifier:"text-line-spacing",tool:"text",isDisabled:!i.isTextSelected,showLabel:false,label:t.sliderLineSpacing,value:i.lineHeight,min:.5,max:3,onChange:i.changeLineHeight,onMouseUp:e,onTouchEnd:e,snap:1,divider:1,decimal:1});});});var Hq=d(function(){Nq();});var c0,Wq;var Gq=d(function(){c0=y(_("react"));B();it();W();we();U();Wq=w(function(){var _D38=D(),i=_D38.textTool,t=_D38.custom;var e=i.locale.controls;var r=["left","center","right"];var o=t.getButton("textAlignment");return c0["default"].createElement(P.Input.Selection,{isDisabled:!i.isTextSelected,showLabel:false,label:e.selectAlignment,"data-test":N.TextAlignment},r.map(function(n){var s=Cy[n];return c0["default"].createElement(o,{tool:n,isDisabled:!i.isTextSelected,ariaLabel:"Align ".concat(n),isActive:n===i.alignment,key:n,icon:c0["default"].createElement(s,null),onClick:function onClick(){return i.changeAlignment(n);}});}));});});var Vq=d(function(){Gq();});var SD,jq;var $q=d(function(){SD=y(_("react"));B();R();Ge();it();W();jq=w(function(){var _D39=D(),i=_D39.textTool;var t=i.colorList;var e=i.locale.controls;var r=i.localeColor.colorPicker;return SD["default"].createElement(P.Input.Selection,{isDisabled:!i.isTextSelected,showLabel:false,label:e.selectFontColor},SD["default"].createElement(De,{tool:"text",activeSprite:i.id,activeColor:i.textColor,colors:t,labelsColor:r,colorPickerDirection:"top",isDisabled:!i.isTextSelected,onChange:i.changeColor,onAddSnapshot:i.colorSnapshot}));});});var Kq=d(function(){$q();});var fi,Xq,pmt,hmt,qq;var Yq=d(function(){fi=y(_("react"));B();Xq=y(_("styled-components"));R();W();we();qt();r0();Rq();Lq();Hq();Vq();Kq();pmt=M.ResponsiveTabWrapper;hmt=(0,Xq["default"])(M.ControlsbarContainer)(_templateObject321||(_templateObject321=_taggedTemplateLiteral(["\n > div {\n grid-template-columns: 1fr 5fr minmax(56px, 1fr);\n }\n"])));qq=w(function(){var _D40=D(),i=_D40.textTool,t=_D40.custom;var e=i.config;var r=e.basicUIToolControlBarTabsOrder;var o=i.locale.controls;var n=t.getButton("toolControlBarPrimaryButton");var s=function s(a){switch(a){case"fontSize":return fi["default"].createElement(ua,{key:a,label:o.tabFontSize},fi["default"].createElement(Pq,null));case"textAlignment":return fi["default"].createElement(ua,{key:a,label:o.tabAlignment},fi["default"].createElement(Wq,null));case"textColor":return fi["default"].createElement(ua,{key:a,label:o.tabColor},fi["default"].createElement(jq,null));case"backgroundColor":return fi["default"].createElement(ua,{key:a,label:o.tabBgColor},fi["default"].createElement(Fq,null));case"lineSpacing":return fi["default"].createElement(ua,{key:a,label:o.tabLineHeight},fi["default"].createElement(Uq,null));default:return null;}};return fi["default"].createElement(hmt,{show:true},fi["default"].createElement("div",null,fi["default"].createElement(n,{tool:"text",ariaLabel:o.buttonNew,onClick:i.add,icon:fi["default"].createElement(Re.addText,null),label:o.buttonNew})),fi["default"].createElement(M.Other.ControlsWrapper,null,fi["default"].createElement(pmt,null,r.map(function(a){return s(a);}))),fi["default"].createElement(M.BarSeparator,null));});});var _o,Jq,fmt,gmt,Zq;var Qq=d(function(){_o=y(_("react"));B();Jq=y(_("styled-components"));R();Ge();it();we();qt();fmt=(0,Jq["default"])(De)(_templateObject322||(_templateObject322=_taggedTemplateLiteral(["\n height: 40px;\n"])));gmt=function gmt(_ref345){var i=_ref345.textDesignTool,t=_ref345.custom;var e=i.locale.controls;var r=i.localeColor.colorPicker;var o=i.colorList;var n=t.getButton("toolControlBarSecondaryButton");var s=t.getButton("toolControlBarPrimaryButton");return _o["default"].createElement(M.ControlsbarContainer,{show:true},s&&_o["default"].createElement("div",null,_o["default"].createElement(s,{tool:"textdesign",ariaLabel:e.buttonNew,onClick:i.add,icon:_o["default"].createElement(Re.addText,null),label:e.buttonNew})),_o["default"].createElement(M.Other.ControlsWrapper,null,_o["default"].createElement(P.Input.Selection,{isDisabled:!i.isTextDesignSelected,label:e.selectColor},_o["default"].createElement(fmt,{tool:"textdesign",activeSprite:i.id,activeColor:i.color,colors:o,labelsColor:r,colorPickerDirection:"top",isDisabled:!i.isTextDesignSelected,onChange:i.changeColor,onAddSnapshot:i.colorSnapshot}))),n&&_o["default"].createElement("div",null,_o["default"].createElement(n,{tool:"textdesign",ariaLabel:e.buttonShuffle,onClick:i.changeSeed,icon:_o["default"].createElement(Re.shuffle,null),label:e.buttonShuffle})),_o["default"].createElement(M.BarSeparator,null));};Zq=rt("textDesignTool","custom")(w(gmt));});var tY,eY;var iY=d(function(){tY=y(_("react"));B();Ge();W();eY=w(function(){var _D41=D(),i=_D41.transformTool;var t=i.locale.controls;var e=i.forceDimensions;return tY["default"].createElement(gf,{isDisabled:e,showLabel:false,valueHeight:i.localOutputHeight,valueWidth:i.localOutputWidth,onSubmitWidth:i.onPixelWidth,onSubmitHeight:i.onPixelHeight,label:t.inputCropSize,labelHeight:t.inputHeight,labelWidth:t.inputWidth,ariaLabelHeight:t.inputHeightAriaLabel,ariaLabelWidth:t.inputWidthAriaLabel});});});var rY=d(function(){iY();});var oY,nY;var sY=d(function(){oY=y(_("react"));Ge();nY=function nY(){return oY["default"].createElement(ff,null);};});var aY=d(function(){sY();});var lY,cY;var uY=d(function(){lY=y(_("react"));B();R();W();cY=w(function(){var _D42=D(),i=_D42.transformTool,t=_D42.custom;var e=i.locale.controls;var r=i.forceDimensions;var o=t.getCheckbox();if(!o){return null;}return lY["default"].createElement(o,{tool:"transform",isDisabled:r,style:{paddingTop:"5px",justifyContent:"center"},value:i.lockResolution,checkMarkPosition:"left",label:e.checkboxKeepResolution,onClick:i.changeLockResolution});});});var dY=d(function(){uY();});var Mi,u0,bmt,wD,mY,ymt,pY;var hY=d(function(){Mi=y(_("react"));B();u0=y(_("styled-components"));R();Sr();W();we();qt();rY();aY();dY();bmt=M.ResponsiveTabWrapper;var _M6=M;wD=_M6.Tab;mY=u0.css(_templateObject323||(_templateObject323=_taggedTemplateLiteral(["\n min-width: unset;\n"])));ymt=(0,u0["default"])(M.Other.ControlsWrapper)(_templateObject324||(_templateObject324=_taggedTemplateLiteral(["\n min-width: 365px;\n\n ","\n @media all and (min-width: 0) and (max-width: 599px) {\n ","\n }\n"])),function(i){return i.smallContainer&&mY;},mY);pY=w(function(){var _D43=D(),i=_D43.transformTool,t=_D43.custom;var _ref346=(0,Mi.useContext)(Oe),e=_ref346.rect;var r=i.config;var o=r.basicUIToolControlBarTabsOrder;var n=i.locale.controls;var s=t.getButton("toolControlBarSecondaryButton");var a=function a(l){switch(l){case"flipRotate":return Mi["default"].createElement(wD,{key:l,label:n.tabFlipAndRotate},Mi["default"].createElement(nY,null));case"resolution":return Mi["default"].createElement(wD,{key:l,label:n.tabResolution},Mi["default"].createElement(cY,null));case"cropSize":return Mi["default"].createElement(wD,{key:l,label:n.tabCropSize},Mi["default"].createElement(eY,null));default:return null;}};return Mi["default"].createElement(M.ControlsbarContainer,{show:true},s&&Mi["default"].createElement("div",null,Mi["default"].createElement(s,{tool:"transform",ariaLabel:i.locale.controls.buttonReset,onClick:i.reset,icon:Mi["default"].createElement(Re.reset,null),label:i.locale.controls.buttonReset})),Mi["default"].createElement(ymt,{smallContainer:!!e&&e.width<600},Mi["default"].createElement(bmt,null,o.map(function(l){return a(l);}))),Mi["default"].createElement(M.BarSeparator,null));});});var Ee,fY;var gY=d(function(){Ee=y(_("react"));B();R();it();W();SX();LX();GX();$X();sq();lq();_q();Eq();Yq();Qq();hY();fY=w(function i(){var _D44=D(),t=_D44.active,e=_D44.custom;var r=t.tool;var o=e.getBasicToolControlBar();if(!o){return null;}return Ee["default"].createElement(o,{show:!!r,tool:r},Ee["default"].createElement(P.Switch.Index,{type:r},Ee["default"].createElement(P.Switch.Case,{value:"filter"},Ee["default"].createElement(WX,null)),Ee["default"].createElement(P.Switch.Case,{value:"focus"},Ee["default"].createElement(jX,null)),Ee["default"].createElement(P.Switch.Case,{value:"adjustment"},Ee["default"].createElement(CX,null)),Ee["default"].createElement(P.Switch.Case,{value:"overlay"},Ee["default"].createElement(yq,null)),Ee["default"].createElement(P.Switch.Case,{value:"sticker"},Ee["default"].createElement(Dq,null)),Ee["default"].createElement(P.Switch.Case,{value:"text"},Ee["default"].createElement(qq,null)),Ee["default"].createElement(P.Switch.Case,{value:"textdesign"},Ee["default"].createElement(Zq,null)),Ee["default"].createElement(P.Switch.Case,{value:"library"},Ee["default"].createElement(aq,null)),Ee["default"].createElement(P.Switch.Case,{value:"frame"},Ee["default"].createElement(nq,null)),Ee["default"].createElement(P.Switch.Case,{value:"brush"},Ee["default"].createElement(MX,null)),Ee["default"].createElement(P.Switch.Case,{value:"transform"},Ee["default"].createElement(pY,null))));});});var Nm,bY,_mt,xmt,yY;var _Y=d(function(){Nm=y(_("react"));B();bY=y(_("styled-components"));R();we();U();qt();_mt=bY["default"].div(_templateObject325||(_templateObject325=_taggedTemplateLiteral(["\n position: relative;\n top: -8px;\n color: ",";\n"])),function(i){return i.theme.card.foreground;});xmt=function xmt(_ref347){var i=_ref347.adjustmentsTool;var t=function t(e,r){var o=wL[e.identifier];return Nm["default"].createElement(M.Card,{"data-test":e.identifier,tool:"adjustment",type:"medium",onClick:function onClick(){return i.toggleOptionSelection(e.identifier);},isActive:e.identifier===i.selectedAdjustmentType,key:"".concat(e.identifier,"-").concat(r),label:e.name,style:{animationDelay:"".concat(kt(r),"s")}},Nm["default"].createElement(_mt,null,Nm["default"].createElement(o,null)),Nm["default"].createElement(M.CardLabel,null,i.locale.items[e.identifier]||e.name));};return Nm["default"].createElement(M.CardContainer,null,i.items.map(t));};yY=rt("adjustmentsTool")(w(xmt));});var xY,vY;var CY=d(function(){xY=y(_("react"));R();W();vY=function vY(){var _D45=D(),i=_D45.config;var t=i.state.config["customTool"].toolControlBar;return xY["default"].createElement(t,{language:i.state.locale["customTool"]});};});var SY=d(function(){CY();});var Zn,Qf;var wY=d(function(){Zn=y(_("react"));B();R();U();qt();Qf=/*#__PURE__*/function(_Zn$default$Component){_inherits(Qf,_Zn$default$Component);var _super248=_createSuper(Qf);function Qf(){var _this391;_classCallCheck(this,Qf);_this391=_super248.apply(this,arguments);_this391.onCategoryClick=function(t){var e=_this391.props.filterTool;e.toggleCategorySelection(t);};_this391.renderItem=function(t,e){var n,s;var r=_this391.props.filterTool;var o=(s=(n=r.locale)==null?void 0:n.controls)==null?void 0:s.itemAriaLabel;return Zn["default"].createElement(M.Card,{tool:"filter",type:"medium",onClick:function onClick(){return r.selectFilter(t.identifier,t.defaultIntensity);},isActive:r.identifier===t.identifier,key:"".concat(t.identifier,"-").concat(e),image:t.thumbnailURI,label:t.name,"aria-label":o==null?void 0:o.replace("${label}",t.name),style:{animationDelay:"".concat(kt(e),"s")}},Zn["default"].createElement(M.CardLabel,{withBackground:true},r.locale.categories[t.identifier]||r.locale.items[t.identifier]||t.name));};_this391.renderCategory=function(t,e){var l;var r=_this391.props.filterTool;var o=r.selectedCategoryIdentifier,n=r.locale;var s=(l=n.controls)==null?void 0:l.categoryAriaLabel;var a=o===t.identifier;if(!t.items)return null;return Zn["default"].createElement(M.CategoryContainer,{key:t.identifier},Zn["default"].createElement(M.Card,{role:"button","aria-expanded":a,"aria-label":s==null?void 0:s.replace("${label}",t.name),tool:"filter",type:"large",onClick:function onClick(){return _this391.onCategoryClick(t.identifier);},image:t.thumbnailURI,label:t.name,style:{animationDelay:"".concat(kt(e),"s")}},Zn["default"].createElement(M.CardLabel,{withBackground:true},t.name)),Zn["default"].createElement(M.ExpandableContainer,{show:a},t.items.map(_this391.renderItem)));};return _this391;}_createClass(Qf,[{key:"render",value:function render(){var t=this.props.filterTool;var e=t.categories,r=t.config,o=t.items;if(r.flattenCategories)return Zn["default"].createElement(M.CardContainer,null,o.map(this.renderItem));return Zn["default"].createElement(M.CardContainer,null,e.map(this.renderCategory));}}]);return Qf;}(Zn["default"].Component);Qf=f([rt("filterTool","active"),w],Qf);});var d0,vmt,TY;var kY=d(function(){d0=y(_("react"));B();R();U();qt();vmt=function vmt(_ref348){var i=_ref348.focusTool;var o,n;var t=(n=(o=i.locale)==null?void 0:o.controls)==null?void 0:n.itemAriaLabel;var e=function e(s){i.selectFocus(s);};var r=function r(s,a){return d0["default"].createElement(M.Card,{isActive:s.identifier===i.identifier,tool:"focus",type:"medium",onClick:function onClick(){return e(s.identifier);},key:"".concat(s.identifier,"-").concat(a),image:s.thumbnailURI,label:s.name,"aria-label":t==null?void 0:t.replace("${label}",s.name),style:{animationDelay:"".concat(kt(a),"s")}},d0["default"].createElement(M.CardLabel,{withBackground:true},i.locale.items[s.identifier]||s.name));};return d0["default"].createElement(M.CardContainer,null,i.items.map(r));};TY=rt("focusTool")(w(vmt));});var m0,Cmt,IY;var DY=d(function(){m0=y(_("react"));B();R();U();qt();Cmt=function Cmt(_ref349){var i=_ref349.frameTool;var o,n;var t=i.identifier;var e=(n=(o=i.locale)==null?void 0:o.controls)==null?void 0:n.itemAriaLabel;var r=function r(s,a){return m0["default"].createElement(M.Card,{tool:"frame",type:"medium",onClick:function onClick(){return i.selectFrame(s.identifier);},isActive:s.identifier===t,key:"".concat(s.identifier,"-").concat(a),image:s.thumbnailURI,label:s.name,"aria-label":e==null?void 0:e.replace("${label}",s.name),style:{animationDelay:"".concat(kt(a),"s"),backgroundSize:"60%"}}," ",m0["default"].createElement(M.CardLabel,{hidden:true},i.locale.items[s.identifier]||s.name));};return m0["default"].createElement(M.CardContainer,null,i.items.map(r));};IY=rt("frameTool")(w(Cmt));});var EY,FY;var OY=d(function(){EY=y(_("styled-components"));FY=EY["default"].p(_templateObject326||(_templateObject326=_taggedTemplateLiteral(["\n height: ","px;\n"])),function(i){return i.theme.measurements.basicUIToolControlBar.itemsBarHeight;});});var RY=d(function(){OY();});var Zo,tg;var AY=d(function(){Zo=y(_("react"));B();R();U();qt();RY();tg=/*#__PURE__*/function(_Zo$default$Component){_inherits(tg,_Zo$default$Component);var _super249=_createSuper(tg);function tg(){var _this392;_classCallCheck(this,tg);_this392=_super249.apply(this,arguments);_this392.onCategoryClick=function(t){var e=_this392.props.library;e.toggleCategorySelection(t);};_this392.renderItem=function(t,e){var s,a;var _this392$props=_this392.props,r=_this392$props.active,o=_this392$props.library;var n=(a=(s=o.locale)==null?void 0:s.controls)==null?void 0:a.itemAriaLabel;return Zo["default"].createElement(M.Card,{tool:"library",type:"medium",onClick:function onClick(){return r.newImage(t.rawUrl);},key:"".concat(t.identifier,"-").concat(e),image:t.thumbnailURI,label:t.name,"aria-label":n==null?void 0:n.replace("${label}",t.name),style:{animationDelay:"".concat(kt(e),"s")}});};_this392.renderCategory=function(t,e){var l;var r=_this392.props.library;var o=r.selectedCategoryIdentifier,n=r.locale;var s=(l=n.controls)==null?void 0:l.categoryAriaLabel;var a=o===t.identifier;if(!t.items)return null;return Zo["default"].createElement(M.CategoryContainer,{key:t.identifier},Zo["default"].createElement(M.Card,{role:"button","aria-expanded":a,"aria-label":s==null?void 0:s.replace("${label}",t.name),tool:"library",type:"large",onClick:function onClick(){return _this392.onCategoryClick(t.identifier);},image:t.thumbnailURI,label:t.name,style:{animationDelay:"".concat(kt(e),"s")}},Zo["default"].createElement(M.CardLabel,{withBackground:true},t.name)),Zo["default"].createElement(M.ExpandableContainer,{show:a},t.items.map(_this392.renderItem)));};return _this392;}_createClass(tg,[{key:"render",value:function render(){var t=this.props.library;var e=t.query,r=t.categories,o=t.items,n=t.locale,s=t.config;if(e){return o.length?Zo["default"].createElement(M.CardContainer,null,o.map(this.renderItem)):Zo["default"].createElement(FY,{"data-test":N.NoResult},n.controls.noResults);}if(s.flattenCategories)return Zo["default"].createElement(M.CardContainer,null,o.map(this.renderItem));return Zo["default"].createElement(M.CardContainer,null,r.map(this.renderCategory));}}]);return tg;}(Zo["default"].Component);tg=f([rt("library","active"),w],tg);});var p0,Smt,BY;var PY=d(function(){p0=y(_("react"));B();R();U();qt();Smt=function Smt(_ref350){var i=_ref350.overlayTool;var a;var t=i.identifier,e=i.items,r=i.selectOverlay,o=i.locale;var n=(a=o.controls)==null?void 0:a.itemAriaLabel;var s=function s(l,c){return p0["default"].createElement(M.Card,{tool:"overlay",type:"medium",onClick:function onClick(){return r(l.identifier);},isActive:l.identifier===t,key:"".concat(l.identifier,"-").concat(c),image:l.thumbnailURI,label:l.name,"aria-label":n==null?void 0:n.replace("${label}",l.name),style:{animationDelay:"".concat(kt(c),"s")}},p0["default"].createElement(M.CardLabel,{withBackground:true},o.items[l.identifier]||l.name));};return p0["default"].createElement(M.CardContainer,null,e.map(s));};BY=rt("overlayTool")(w(Smt));});var Qn,eg;var MY=d(function(){Qn=y(_("react"));B();R();U();qt();eg=/*#__PURE__*/function(_Qn$default$Component){_inherits(eg,_Qn$default$Component);var _super250=_createSuper(eg);function eg(){var _this393;_classCallCheck(this,eg);_this393=_super250.apply(this,arguments);_this393.onCategoryClick=function(t){var e=_this393.props.stickerTool;e.toggleCategorySelection(t);};_this393.renderItem=function(t,e){var n,s;var r=_this393.props.stickerTool;var o=(s=(n=r.locale)==null?void 0:n.controls)==null?void 0:s.itemAriaLabel;return Qn["default"].createElement(M.Card,{tool:"sticker",type:"medium",onClick:function onClick(){return r.add(t.identifier);},key:"".concat(t.identifier,"-").concat(e),image:t.thumbnailURI,label:t.name,"aria-label":o==null?void 0:o.replace("${label}",t.name),style:{backgroundSize:"55%",animationDelay:"".concat(yb(e),"s")}},Qn["default"].createElement(M.CardLabel,{hidden:true},r.locale.items[t.identifier]||t.name));};_this393.renderCategory=function(t,e){var l;var r=_this393.props.stickerTool;var o=r.selectedCategoryIdentifier,n=r.locale;var s=(l=n.controls)==null?void 0:l.categoryAriaLabel;var a=o===t.identifier;if(!t.items)return null;return Qn["default"].createElement(M.CategoryContainer,{key:t.identifier},Qn["default"].createElement(M.Card,{role:"button","aria-expanded":a,"aria-label":s==null?void 0:s.replace("${label}",t.name),tool:"sticker",type:"large",onClick:function onClick(){return _this393.onCategoryClick(t.identifier);},image:t.thumbnailURI,label:t.name,style:{animationDelay:"".concat(kt(e),"s")}},Qn["default"].createElement(M.CardLabel,{withBackground:true},n.categories[t.identifier]||t.name)),Qn["default"].createElement(M.ExpandableContainer,{show:a},t.items.map(_this393.renderItem)));};return _this393;}_createClass(eg,[{key:"render",value:function render(){var t=this.props.stickerTool;var e=t.categories,r=t.items,o=t.config;if(o.flattenCategories)return Qn["default"].createElement(M.CardContainer,null,r.map(this.renderItem));return Qn["default"].createElement(M.CardContainer,null,e.map(this.renderCategory));}}]);return eg;}(Qn["default"].Component);eg=f([rt("stickerTool","active"),w],eg);});var ig,LY,wmt,zY,UY;var NY=d(function(){ig=y(_("react"));B();LY=y(_("styled-components"));R();Xt();U();qt();wmt=LY["default"].div(_templateObject327||(_templateObject327=_taggedTemplateLiteral(["\n font-size: 20px;\n position: absolute;\n left: 50%;\n top: 50%;\n transform-origin: left top;\n"])));zY=/*#__PURE__*/function(_ig$default$Component){_inherits(zY,_ig$default$Component);var _super251=_createSuper(zY);function zY(){var _this394;_classCallCheck(this,zY);_this394=_super251.apply(this,arguments);_this394.getWidth=function(_ref351,o){var t=_ref351.fontFamily,e=_ref351.fontStyle,r=_ref351.fontWeight;var n=document.createElement("canvas");var s=n.getContext("2d");s.font="".concat(e," ").concat(r," 20px ").concat(t);s.fillText(o,0,0);return s.measureText(o).width;};_this394.renderItem=function(t,e){var _this394$props=_this394.props,r=_this394$props.config,o=_this394$props.textTool;var n=t.fontFamily,s=t.fontWeight,a=t.fontStyle,l=t.identifier;var c="".concat(t.fontFamily," ").concat(gt.getDisplayFontStyle(t));var u=_this394.getWidth(t,c);var m=(r.measurements.basicCard.medium.width-20)/u;return ig["default"].createElement(M.Card,{tool:"text",type:"medium",onClick:function onClick(){return o.changeFont(l);},isDisabled:!_this394.textTool.isTextSelected,isActive:o.identifier===l,key:"".concat(t.identifier,"-").concat(e),label:c,style:{animationDelay:"".concat(kt(e),"s")}},ig["default"].createElement(wmt,{style:{transform:"scale(".concat(m,") translate(-50%, -50%)"),fontFamily:n,fontStyle:a,fontWeight:s}},c));};return _this394;}_createClass(zY,[{key:"textTool",get:function get(){return this.props.textTool;}},{key:"render",value:function render(){var t=this.props.textTool;var e=t.fontsLoaded,r=t.fontFamilies;if(!e)return null;return ig["default"].createElement(M.CardContainer,null,r.map(this.renderItem));}}]);return zY;}(ig["default"].Component);UY=rt("textTool","config")(w(zY));});var h0,Tmt,HY;var WY=d(function(){h0=y(_("react"));B();R();U();qt();Tmt=function Tmt(_ref352){var i=_ref352.textDesignTool;var l;var t=i.items,e=i.changeIdentifier,r=i.isTextDesignSelected,o=i.identifier,n=i.locale;var s=(l=n.controls)==null?void 0:l.itemAriaLabel;var a=function a(c,u){return h0["default"].createElement(M.Card,{tool:"textdesign",type:"medium",onClick:function onClick(){return e(c.identifier);},isDisabled:!r,isActive:o===c.identifier,key:"".concat(c.identifier,"-").concat(u),image:c.thumbnailURI,label:c.name,"aria-label":s==null?void 0:s.replace("${label}",c.name),style:{animationDelay:"".concat(kt(u),"s"),backgroundSize:"60%"}},h0["default"].createElement(M.CardLabel,{hidden:true},c.name));};return h0["default"].createElement(M.CardContainer,null,t.map(a));};HY=rt("textDesignTool")(w(Tmt));});var xr,TD,kmt,Imt,rg;var GY=d(function(){xr=y(_("react"));B();TD=y(_("styled-components"));R();we();U();qt();kmt=TD["default"].div(_templateObject328||(_templateObject328=_taggedTemplateLiteral(["\n svg {\n margin-bottom: 12px;\n }\n"])));Imt=TD["default"].div(_templateObject329||(_templateObject329=_taggedTemplateLiteral(["\n svg {\n width: ","px;\n height: ","px;\n }\n\n "," {\n width: ","px;\n height: ","px;\n padding: 6px 0px 24px;\n }\n"])),function(i){return i.theme.measurements.basicCard.medium.height;},function(i){return i.theme.measurements.basicCard.medium.height;},Ni,function(i){return i.theme.measurements.basicCard.medium.width-32;},function(i){return i.theme.measurements.basicCard.medium.height-32;});rg=/*#__PURE__*/function(_xr$default$Component){_inherits(rg,_xr$default$Component);var _super252=_createSuper(rg);function rg(){var _this395;_classCallCheck(this,rg);_this395=_super252.apply(this,arguments);_this395.onCategoryClick=function(t){var e=_this395.props.transformTool;e.toggleCategorySelection(t);};_this395.renderItem=function(t,e){var p;var _this395$props=_this395.props,r=_this395$props.transformTool,o=_this395$props.config;var n=r.locale,s=r.identifier;var a=(p=n.controls)==null?void 0:p.itemAriaLabel;var l=r.checkIfTransformThumbnailExits(t.thumbnailURI);var c=Vt.crops[t.identifier]||Vt.crops.imgly_transform_common_custom;var u=xr["default"].createElement(M.CardLabel,null,n.items[t.identifier]||t.name);var m=l?u:xr["default"].createElement(Imt,null,xr["default"].createElement(c,{main:o.theme.transform.crops.main,highlight:o.theme.transform.crops.highlight,shadow:o.theme.transform.crops.shadow}),u);return xr["default"].createElement(M.Card,{tool:"transform",type:"medium",onClick:function onClick(){return r.changeIdentifier(t.identifier,true);},key:"".concat(t.identifier,"-").concat(e),image:t.thumbnailURI,label:t.name,"aria-label":a==null?void 0:a.replace("${label}",t.name),isActive:t.identifier===s,style:{backgroundSize:"55%",animationDelay:"".concat(kt(e),"s")}},m);};_this395.renderCategory=function(t,e){var m;var r=_this395.props.transformTool;var o=r.selectedCategoryIdentifier,n=r.locale;var s=(m=n.controls)==null?void 0:m.categoryAriaLabel;var a=o===t.identifier;if(!t.items)return null;var l=r.checkIfTransformThumbnailExits(t.thumbnailURI);var c=xr["default"].createElement(M.CardLabel,null,n.categories[t.identifier]||t.name);var u=l?c:xr["default"].createElement(kmt,null,Vt.categories[t.identifier]&&xr["default"].createElement(Vt.categories[t.identifier]),c);return xr["default"].createElement(M.CategoryContainer,{key:t.identifier},xr["default"].createElement(M.Card,{role:"button","aria-expanded":a,"aria-label":s==null?void 0:s.replace("${label}",t.name),tool:"transform",type:"large",onClick:function onClick(){return _this395.onCategoryClick(t.identifier);},image:l?t.thumbnailURI:"",label:t.name,style:{animationDelay:"".concat(kt(e),"s")}},u),xr["default"].createElement(M.ExpandableContainer,{show:a},t.items.map(_this395.renderItem)));};return _this395;}_createClass(rg,[{key:"render",value:function render(){var t=this.props.transformTool;var e=t.categories,r=t.config,o=t.items;if(r.flattenCategories)return xr["default"].createElement(M.CardContainer,null,o.map(this.renderItem));return xr["default"].createElement(M.CardContainer,null,e.map(this.renderCategory));}}]);return rg;}(xr["default"].Component);rg=f([rt("transformTool","config"),w],rg);});var er,VY;var jY=d(function(){er=y(_("react"));B();R();W();_Y();SY();wY();kY();DY();AY();PY();MY();NY();WY();GY();VY=w(function i(){var _D46=D(),t=_D46.active,e=_D46.library,r=_D46.custom;var o=t.tool;var n=(0,er.useMemo)(function(){switch(o){case"library":return er["default"].createElement(tg,null);case"filter":return er["default"].createElement(Qf,null);case"focus":return er["default"].createElement(TY,null);case"adjustment":return er["default"].createElement(yY,null);case"overlay":return er["default"].createElement(BY,null);case"sticker":return er["default"].createElement(eg,null);case"text":return er["default"].createElement(UY,null);case"textdesign":return er["default"].createElement(HY,null);case"frame":return er["default"].createElement(IY,null);case"transform":return er["default"].createElement(rg,null);case"customTool":return er["default"].createElement(vY,null);default:return null;}},[o]);var s=r.getBasicToolItemsBar();if(!s||o==="brush"||o==="library"&&!e.libraryProvider){return null;}return er["default"].createElement(s,{show:!!o},n);});});var vr,$Y,Dmt,og;var KY=d(function(){vr=y(_("react"));B();$Y=y(_("styled-components"));Ge();QI();tD();it();U();xX();gY();jY();Dmt=$Y["default"].div(_templateObject330||(_templateObject330=_taggedTemplateLiteral(["\n position: absolute;\n width: 100%;\n height: ","px;\n bottom: 0;\n left: 0;\n background: ",";\n z-index: ",";\n"])),function(i){return i.theme.measurements.basicUIToolControlBar.maxHeight;},function(i){return i.theme.webcam.backdrop;},function(i){return i.theme.measurements.zIndex.disable;});og=/*#__PURE__*/function(_vr$default$Component){_inherits(og,_vr$default$Component);var _super253=_createSuper(og);function og(){_classCallCheck(this,og);return _super253.apply(this,arguments);}_createClass(og,[{key:"render",value:function render(){var _this$props20=this.props,t=_this$props20.active,e=_this$props20.custom;var r=e.getWindowContainer();return vr["default"].createElement(P.Container,{"data-test":N.EditorContainer},t.isWebcam?vr["default"].createElement(Dmt,null):null,vr["default"].createElement(Fm,null),vr["default"].createElement(ja,null,vr["default"].createElement(vm,null),r&&vr["default"].createElement(r,{tool:t.tool},vr["default"].createElement(wf,null,t.isWebcam?vr["default"].createElement(Sf,null):null,t.image&&vr["default"].createElement(Dm,null))),vr["default"].createElement(fY,null),vr["default"].createElement(VY,null),vr["default"].createElement(_X,null)));}}],[{key:"getDerivedStateFromError",value:function getDerivedStateFromError(t){console.error(t);return{hasError:true};}}]);return og;}(vr["default"].Component);og=f([rt("active","custom"),w],og);});var ng,XY,kD;var qY=d(function(){ng=y(_("react"));B();XY=_("styled-components");Ge();qt();KY();kD=/*#__PURE__*/function(_ng$default$Component){_inherits(kD,_ng$default$Component);var _super254=_createSuper(kD);function kD(){var _this396;_classCallCheck(this,kD);_this396=_super254.apply(this,arguments);_this396.componentWillUnmount=function(){_this396.editor.cleanUpCanvasMemory();};return _this396;}_createClass(kD,[{key:"componentDidMount",value:function componentDidMount(){var _this$props21=this.props,t=_this$props21.editor,e=_this$props21.storeProps;this.editor=t;this.storeProps=e;var r=new Em(this.editor.configStore.config.custom.components,{basicUIToolbar:M.Toolbar.Index,basicUIToolControlBar:M.Controlsbar,basicUIToolItemsBar:M.Itemsbar});var o={getDialog:r.getDialog,getButton:r.getButton,getColorItem:r.getColorItem,getCheckbox:r.getCheckbox,getSlider:r.getSlider,getBasicToolbar:r.getBasicToolbar,getBasicToolControlBar:r.getBasicToolControlBar,getBasicToolItemsBar:r.getBasicToolItemsBar,getWindowContainer:r.getWindowContainer};this.storeProps.custom=o;this.forceUpdate();}},{key:"render",value:function render(){return this.storeProps?ng["default"].createElement(ep,_objectSpread({},this.storeProps),ng["default"].createElement(XY.ThemeProvider,{theme:_objectSpread(_objectSpread({},this.editor.configStore.theme),{},{measurements:this.editor.configStore.measurements})},ng["default"].createElement(og,null))):null;}}]);return kD;}(ng["default"].Component);});var YY={};de(YY,{"default":function _default(){return kD;}});var JY=d(function(){qY();});var ypt={};de(ypt,{AdjustmentConfiguration:function AdjustmentConfiguration(){return qg;},AdjustmentIdentifier:function AdjustmentIdentifier(){return qu;},AdjustmentIdentifierKeys:function AdjustmentIdentifierKeys(){return xC;},AdvancedAdjustmentControlBarItem:function AdvancedAdjustmentControlBarItem(){return vC;},AdvancedBrushControlBarItem:function AdvancedBrushControlBarItem(){return HC;},AdvancedFilterControlBarItem:function AdvancedFilterControlBarItem(){return CC;},AdvancedFocusControlBarItem:function AdvancedFocusControlBarItem(){return TC;},AdvancedFrameControlBarItem:function AdvancedFrameControlBarItem(){return kC;},AdvancedLibraryControlBarItem:function AdvancedLibraryControlBarItem(){return RC;},AdvancedOverlayControlBarItem:function AdvancedOverlayControlBarItem(){return AC;},AdvancedStickerControlBarItem:function AdvancedStickerControlBarItem(){return PC;},AdvancedTextControlBarItem:function AdvancedTextControlBarItem(){return LC;},AdvancedTextDesignControlBarItem:function AdvancedTextDesignControlBarItem(){return GC;},AdvancedTransformControlBarItem:function AdvancedTransformControlBarItem(){return VC;},AdvancedUICardLabel:function AdvancedUICardLabel(){return Se;},AdvancedUICategoryCard:function AdvancedUICategoryCard(){return cpt;},AdvancedUIControlsBarSection:function AdvancedUIControlsBarSection(){return hpt;},AdvancedUIItemCard:function AdvancedUIItemCard(){return upt;},AdvancedUIToolControlBar:function AdvancedUIToolControlBar(){return ppt;},AdvancedUIToolbar:function AdvancedUIToolbar(){return mpt;},AdvancedUIToolbarItem:function AdvancedUIToolbarItem(){return Uf;},AlignmentMode:function AlignmentMode(){return OO;},BasicBrushControlBarTabs:function BasicBrushControlBarTabs(){return WC;},BasicFilterControlBarTabs:function BasicFilterControlBarTabs(){return SC;},BasicFocusControlBarTabs:function BasicFocusControlBarTabs(){return iR;},BasicFrameControlBarTabs:function BasicFrameControlBarTabs(){return IC;},BasicOverlayControlBarTabs:function BasicOverlayControlBarTabs(){return BC;},BasicStickerControlBarTabs:function BasicStickerControlBarTabs(){return MC;},BasicTextControlBarTabs:function BasicTextControlBarTabs(){return zC;},BasicTransformControlBarTabs:function BasicTransformControlBarTabs(){return jC;},BasicUIToolControlBar:function BasicUIToolControlBar(){return gpt;},BasicUIToolItemsBar:function BasicUIToolItemsBar(){return bpt;},BasicUIToolbar:function BasicUIToolbar(){return fpt;},BlendMode:function BlendMode(){return pn;},BrushConfiguration:function BrushConfiguration(){return ab;},CanvasAction:function CanvasAction(){return ko;},CanvasBarTextSecondaryButton:function CanvasBarTextSecondaryButton(){return by;},CardAvatar:function CardAvatar(){return Jl;},CardType:function CardType(){return Ue;},CategoryHeaderType:function CategoryHeaderType(){return un;},Checkbox:function Checkbox(){return Zmt;},CheckboxBase:function CheckboxBase(){return Qmt;},CheckboxCheckMark:function CheckboxCheckMark(){return ept;},CheckboxInput:function CheckboxInput(){return tpt;},ColorItem:function ColorItem(){return Lmt;},ColorItemActiveOverlay:function ColorItemActiveOverlay(){return Hmt;},ColorItemBackground:function ColorItemBackground(){return Umt;},ColorItemBase:function ColorItemBase(){return zmt;},ColorItemTiledBackground:function ColorItemTiledBackground(){return Nmt;},Configuration:function Configuration(){return GO;},ContainedPrimaryButton:function ContainedPrimaryButton(){return Up;},Container:function Container(){return Pmt;},CustomToolConfiguration:function CustomToolConfiguration(){return YO;},Dialog:function Dialog(){return Wmt;},DialogBackdrop:function DialogBackdrop(){return jmt;},DialogBase:function DialogBase(){return Gmt;},DialogBody:function DialogBody(){return Kmt;},DialogContainer:function DialogContainer(){return Vmt;},DialogFooter:function DialogFooter(){return Xmt;},DialogHeader:function DialogHeader(){return $mt;},DialogSpinner:function DialogSpinner(){return qmt;},Dropdown:function Dropdown(){return ipt;},DropdownCaret:function DropdownCaret(){return Jb;},EventEmitter:function EventEmitter(){return Tr;},ExportConfiguration:function ExportConfiguration(){return BO;},ExportFormat:function ExportFormat(){return Wl;},FilterCategoryIdentifier:function FilterCategoryIdentifier(){return cp;},FilterConfiguration:function FilterConfiguration(){return Yg;},FilterIdentifier:function FilterIdentifier(){return lp;},FocusConfiguration:function FocusConfiguration(){return Jg;},FocusIdentifier:function FocusIdentifier(){return cs;},FrameConfiguration:function FrameConfiguration(){return Zg;},IconButton:function IconButton(){return hs;},ImageFormat:function ImageFormat(){return mn;},ImageMimeType:function ImageMimeType(){return ap;},Label:function Label(){return Jmt;},LibraryCategory:function LibraryCategory(){return Qg;},LibraryConfiguration:function LibraryConfiguration(){return rb;},LibraryImage:function LibraryImage(){return tb;},LibraryProvider:function LibraryProvider(){return ib;},ModalType:function ModalType(){return dn;},OutlinedPrimaryButton:function OutlinedPrimaryButton(){return zp;},OutlinedSecondaryButton:function OutlinedSecondaryButton(){return Ea;},OverlayConfiguration:function OverlayConfiguration(){return ob;},OverlayIdentifier:function OverlayIdentifier(){return up;},PhotoEditorSDKUI:function PhotoEditorSDKUI(){return tJ;},PhotoEditorSDKUIComponent:function PhotoEditorSDKUIComponent(){return iJ;},SearchField:function SearchField(){return dpt;},SerializationExportType:function SerializationExportType(){return AO;},Slider:function Slider(){return rpt;},SliderBase:function SliderBase(){return opt;},SliderContainer:function SliderContainer(){return npt;},SliderIdentifier:function SliderIdentifier(){return qe;},SliderInput:function SliderInput(){return spt;},SliderLabel:function SliderLabel(){return lpt;},SliderTrack:function SliderTrack(){return apt;},SnappingConfiguration:function SnappingConfiguration(){return Kg;},SpriteActionButton:function SpriteActionButton(){return _n;},StickerConfiguration:function StickerConfiguration(){return nb;},TextConfiguration:function TextConfiguration(){return sb;},TextDesignConfiguration:function TextDesignConfiguration(){return lb;},TextPrimaryButton:function TextPrimaryButton(){return Xl;},TextSecondaryButton:function TextSecondaryButton(){return Ro;},Tool:function Tool(){return H;},TransformConfiguration:function TransformConfiguration(){return cb;},TransformIdentifier:function TransformIdentifier(){return $C;},UIEvent:function UIEvent(){return dp;},WatermarkConfiguration:function WatermarkConfiguration(){return Xg;},WindowContainer:function WindowContainer(){return zv;},calculateAdvancedUIToolControlBarMeasurements:function calculateAdvancedUIToolControlBarMeasurements(){return Mk;},deepmergeAll:function deepmergeAll(){return Fi;},defaultConfig:function defaultConfig(){return _l;},isDuoToneFilterAsset:function isDuoToneFilterAsset(){return Yu;},isExistingCategory:function isExistingCategory(){return vQ;},isExistingItem:function isExistingItem(){return xQ;},isGoogleFontAsset:function isGoogleFontAsset(){return NC;},isLUTFilterAsset:function isLUTFilterAsset(){return wC;},isWebFontAsset:function isWebFontAsset(){return UC;},useGetImage:function useGetImage(){return Amt;},useIsLayoutAdvanced:function useIsLayoutAdvanced(){return Bmt;},useSetImage:function useSetImage(){return Rmt;}});var OD={react:"React","react-dom":"ReactDOM","react-dom/server":"ReactDOMServer","styled-components":"styled"};window.require=function(i){if(Object.hasOwnProperty.call(OD,i)){var t=OD[i];if(Object.hasOwnProperty.call(window,t)){return window[t];}console.log("Cannot find umd script for ".concat(i));}return void 0;};Tt();var Nf=y(_("react"));B();var lK=_("styled-components");Ge();var TV=y(_("react"));R();var yV=y(_("react"));var _V=y(_("styled-components"));it();var Yut=(0,_V["default"])(Dr)(_templateObject331||(_templateObject331=_taggedTemplateLiteral(["\n width: ","px;\n height: ","px;\n margin-bottom: ","px;\n color: ",";\n"])),function(i){return i.theme.measurements.advancedUICard.large.width;},function(i){return i.theme.measurements.advancedUICard.large.height;},function(i){return i.theme.measurements.advancedUISpacer;},function(i){return i.theme.card.foreground;});var Jut=function Jut(_ref353){var i=_ref353.isActive,t=_objectWithoutProperties(_ref353,_excluded13);return yV["default"].createElement(Yut,_objectSpread({},t));};var xV=Jut;var vV=y(_("styled-components"));it();var CV=(0,vV["default"])(Dr)(_templateObject332||(_templateObject332=_taggedTemplateLiteral(["\n width: ","px;\n height: ","px;\n margin-bottom: ","px;\n color: ",";\n &:nth-child(2n + 1) {\n margin-right: ","px;\n }\n"])),function(i){return i.theme.measurements.advancedUICard.medium.width;},function(i){return i.theme.measurements.advancedUICard.medium.height;},function(i){return i.theme.measurements.advancedUISpacer;},function(i){return i.theme.card.foreground;},function(i){return i.theme.measurements.advancedUISpacer;});var SV=y(_("styled-components"));it();var wV=(0,SV["default"])(Dr)(_templateObject333||(_templateObject333=_taggedTemplateLiteral(["\n width: ","px;\n height: ","px;\n margin-bottom: ","px;\n color: ",";\n &:nth-child(3n + 1),\n &:nth-child(3n + 2) {\n margin-right: ","px;\n }\n"])),function(i){return i.theme.measurements.advancedUICard.small.width;},function(i){return i.theme.measurements.advancedUICard.small.height;},function(i){return i.theme.measurements.advancedUISpacer;},function(i){return i.theme.card.foreground;},function(i){return i.theme.measurements.advancedUISpacer;});var bf=function bf(_ref354){var i=_ref354.type,t=_objectWithoutProperties(_ref354,_excluded14);var e=i==="large";var r=i==="small";var o=CV;if(e){o=xV;}else if(r){o=wV;}return TV["default"].createElement(o,_objectSpread({type:i},t));};var kV=y(_("styled-components"));U();var Nv=kV["default"].div.attrs(function(i){return{"data-test":i["data-test"]||N.CardContainer};})(_templateObject334||(_templateObject334=_taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n /* width - padding on both sides */\n width: ","px;\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.width-48;});var IV=y(_("react"));var yf=y(_("styled-components"));U();var Zut=yf["default"].div(_templateObject335||(_templateObject335=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n\n position: relative;\n width: ","px;\n /* for Firefox */\n min-height: 0;\n margin-bottom: ","px;\n\n z-index: ",";\n\n background: ",";\n transition: width 0.4s ease-in;\n ","\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.width;},function(i){return i.theme.measurements.advancedUIToolControlBar.marginBottom;},function(i){return i.theme.measurements.zIndex.toolControlBar;},function(i){return i.theme.toolControlBar.background;},function(i){return!i.reverse?yf.css(_templateObject336||(_templateObject336=_taggedTemplateLiteral(["\n border-right: 1px solid ",";\n "])),i.theme.toolControlBar.borderColor):yf.css(_templateObject337||(_templateObject337=_taggedTemplateLiteral(["\n border-left: 1px solid ",";\n "])),i.theme.toolControlBar.borderColor);});var DV=function DV(_ref355){var _ref355$reverse=_ref355.reverse,i=_ref355$reverse===void 0?false:_ref355$reverse,t=_ref355.style,e=_ref355.className,r=_ref355.children;return IV["default"].createElement(Zut,{"data-test":N.ToolControlBar,reverse:i,className:e,style:t},r);};var Om=y(_("styled-components"));U();var EV=Om["default"].div.attrs(function(){return{"data-test":N.CategoryItemsContainer};})(_templateObject338||(_templateObject338=_taggedTemplateLiteral(["\n transition: max-height 0.8s ease-out, transform 0.8s ease-out;\n background: ",";\n visibility: hidden;\n opacity: 0;\n transform-origin: 0 0;\n display: none;\n flex-wrap: wrap;\n\n ","\n"])),function(i){return i.theme.toolControlBar.background;},function(_ref356){var i=_ref356.show;return i&&Om.css(_templateObject339||(_templateObject339=_taggedTemplateLiteral(["\n opacity: 1;\n visibility: visible;\n ","\n "])),ve()?Om.css(_templateObject340||(_templateObject340=_taggedTemplateLiteral(["\n display: block;\n "]))):Om.css(_templateObject341||(_templateObject341=_taggedTemplateLiteral(["\n display: flex;\n "]))));});var WI=y(_("react"));var GI=y(_("styled-components"));it();U();var Qut=(0,GI["default"])(c1)(_templateObject342||(_templateObject342=_taggedTemplateLiteral(["\n color: ",";\n\n /* the padding and margin should only be applied to the children */\n margin: 0 !important;\n padding: 0 !important;\n"])),function(i){return i.theme.toolControlBar.inputLabelForeground;});var tdt=GI["default"].div(_templateObject343||(_templateObject343=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n\n > * {\n margin-left: ","px;\n margin-right: ","px;\n margin-bottom: ","px;\n }\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.paddingLeft;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingRight;},function(i){return i.theme.measurements.advancedUIToolControlBar.controls.gutter;});var FV=function FV(_ref357){var i=_ref357.show,t=_ref357.children;return WI["default"].createElement(Qut,{duration:300,height:i?"auto":0,easing:"ease-in-out",animateOpacity:true},WI["default"].createElement(tdt,{"data-test":N.ToolControlBarExpandableControls},t));};var Hv=y(_("styled-components"));it();U();var _f=(0,Hv["default"])(Oo)(_templateObject344||(_templateObject344=_taggedTemplateLiteral(["\n position: relative;\n\n box-sizing: border-box;\n\n /* for Firefox */\n min-height: 0;\n\n transition: height 0.4s cubic-bezier(0.17, 0.04, 0.03, 0.94);\n color: ",";\n\n /* compensate the padding in IE and Edge */\n ","\n"])),function(i){return i.theme.toolControlBar.inputLabelForeground;},function(){if(ve()||wr()){return Hv.css(_templateObject345||(_templateObject345=_taggedTemplateLiteral(["\n > ul {\n padding-right: 34px;\n margin-right: -34px;\n }\n "])));}return"";});_f.defaultProps={direction:"vertical"};var Wv=y(_("styled-components"));var edt=Wv["default"].div(_templateObject346||(_templateObject346=_taggedTemplateLiteral(["\n position: relative;\n &:after {\n content: '';\n position: absolute;\n bottom: 0px;\n ","\n border-bottom: 2px solid ",";\n }\n"])),function(i){return i.full?Wv.css(_templateObject347||(_templateObject347=_taggedTemplateLiteral(["\n left: -","px;\n width: calc(\n 100% + ","px\n );\n "])),3*i.theme.measurements.advancedUISpacer/2,3*i.theme.measurements.advancedUISpacer):"\n left: ".concat(3*i.theme.measurements.advancedUISpacer/2,"px;\n width: calc(100% - ").concat(3*i.theme.measurements.advancedUISpacer,"px);\n ");},function(i){return i.theme.toolControlBar.separatorColor;});var Gv=edt;var OV=y(_("styled-components"));var idt=OV["default"].h2(_templateObject348||(_templateObject348=_taggedTemplateLiteral(["\n color: ",";\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n font-weight: 500;\n min-height: ","px;\n margin-top: 0;\n"])),function(i){return i.theme.toolControlBar.titleForeground;},function(i){return i.theme.measurements.fontSystem.headline2.size;},function(i){return i.theme.measurements.fontSystem.headline2.letterSpacing;},function(i){return i.theme.measurements.fontSystem.headline2["case"];},function(i){return 2*i.theme.measurements.advancedUISpacer;});var Vv=idt;var sa=y(_("react"));var RV=y(_("styled-components"));it();U();var rdt=RV["default"].div(_templateObject349||(_templateObject349=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n flex: 1 0 auto;\n"])));var AV=function AV(_ref358){var i=_ref358.name,t=_ref358.isFirstCategory,e=_ref358.isLastCategory,r=_ref358.children;return sa["default"].createElement(rdt,null,!t&&sa["default"].createElement(P.Spacer,{count:2}),sa["default"].createElement(Vv,{"data-test":i},i),sa["default"].createElement(Nv,{"data-test":N.CategoryItemsContainer},r),!e&&sa["default"].createElement(sa["default"].Fragment,null,sa["default"].createElement(P.Spacer,{count:2}),sa["default"].createElement(Gv,{full:true})));};var BV=y(_("styled-components"));var odt=BV["default"].h1(_templateObject350||(_templateObject350=_taggedTemplateLiteral(["\n /* Center text horizontally and vertically */\n display: flex;\n align-items: center;\n justify-content: center;\n flex-grow: 0;\n padding: 0 4px;\n margin: 0;\n min-height: ","px;\n font-size: ","px;\n letter-spacing: ","px;\n text-transform: ",";\n background: ",";\n color: ",";\n border-bottom: 1px solid ",";\n font-weight: 500;\n text-align: center;\n /* prevent the padding from leaving the width of the parent */\n box-sizing: border-box;\n"])),function(i){return i.theme.measurements.mainCanvasActionBar.height-2;},function(i){return i.theme.measurements.fontSystem.headline1.size;},function(i){return i.theme.measurements.fontSystem.headline1.letterSpacing;},function(i){return i.theme.measurements.fontSystem.headline1["case"];},function(i){return i.theme.toolControlBar.background;},function(i){return i.theme.toolControlBar.titleForeground;},function(i){return i.theme.toolControlBar.separatorColor;});var PV=odt;var MV=y(_("react"));var LV=y(_("styled-components"));W();var ndt=LV["default"].div(_templateObject351||(_templateObject351=_taggedTemplateLiteral(["\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n\n overflow-y: auto;\n overflow-x: hidden;\n\n /* calculate the max-height based on the padding and if the heading is used */\n max-height: calc(\n 100% -\n ","px -\n ","px\n );\n\n padding-top: ","px;\n padding-bottom: ","px;\n\n > * {\n margin-left: ","px;\n margin-right: ","px;\n }\n\n /* The scrollable content needs a padding for the scrollbar position */\n > "," {\n margin-left: 0px;\n margin-right: 0px;\n padding-left: ","px;\n padding-right: ","px;\n }\n\n > :not(:last-child) {\n margin-bottom: ","px;\n }\n"])),function(i){return i.theme.measurements.advancedUIToolControlBar.paddingBottom+i.theme.measurements.advancedUIToolControlBar.paddingTop;},function(i){return i.displayTitle?i.theme.measurements.mainCanvasActionBar.height-2:"0";},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingTop;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingBottom;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingLeft;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingRight;},_f,function(i){return i.theme.measurements.advancedUIToolControlBar.paddingLeft;},function(i){return i.theme.measurements.advancedUIToolControlBar.paddingRight;},function(i){return i.theme.measurements.advancedUIToolControlBar.controls.gutter;});var zV=function zV(_ref359){var i=_ref359.children;var _D47=D(),t=_D47.config;var e=t.config.displayToolControlBarTitle;return MV["default"].createElement(ndt,{displayTitle:e},i);};var VI=y(_("react"));var Rm=y(_("styled-components"));it();U();var sdt=Rm["default"].div(_templateObject352||(_templateObject352=_taggedTemplateLiteral(["\n display: flex;\n flex: 1 0 auto;\n flex-direction: column;\n align-items: center;\n height: 100%;\n width: ","px;\n\n z-index: ",";\n\n background-color: ",";\n color: ",";\n ","\n margin-bottom: ","px;\n"])),function(i){return i.theme.measurements.advancedUIToolbar.width;},function(i){return i.theme.measurements.zIndex.toolbar;},function(i){return i.theme.toolbar.background;},function(i){return i.theme.toolbar.foreground;},function(i){var t=i.theme.toolbar.border?i.theme.toolbar.border:Rm.css(_templateObject353||(_templateObject353=_taggedTemplateLiteral(["\n 1px solid ",";\n "])),i.theme.toolbar.borderColor);return!i.reverse?Rm.css(_templateObject354||(_templateObject354=_taggedTemplateLiteral(["\n border-right: ",";\n "])),t):Rm.css(_templateObject355||(_templateObject355=_taggedTemplateLiteral(["\n border-left: ",";\n "])),t);},function(i){return i.theme.measurements.advancedUIToolbar.marginBottom;});var UV=function UV(_ref360){var i=_ref360.reverse,t=_ref360.style,e=_ref360.className,r=_ref360.children;return VI["default"].createElement(sdt,{reverse:i,"data-test":N.Toolbar,className:e,style:t},VI["default"].createElement(Oo,{direction:"vertical"},r));};var jI=y(_("react"));var vu=y(_("styled-components"));it();U();var adt=(0,vu["default"])(Ro)(_templateObject356||(_templateObject356=_taggedTemplateLiteral(["\n width: inherit;\n height: inherit;\n padding: 0;\n margin: 0;\n ","\n\n ","\n"])),ve()?vu.css(_templateObject357||(_templateObject357=_taggedTemplateLiteral(["\n background-color: transparent;\n "]))):vu.css(_templateObject358||(_templateObject358=_taggedTemplateLiteral(["\n background-color: inherit;\n "]))),function(i){return i.isActive&&vu.css(_templateObject359||(_templateObject359=_taggedTemplateLiteral(["\n background-color: ",";\n color: ",";\n\n svg {\n color: ",";\n }\n "])),i.theme.toolbar.activeBackground,i.theme.toolbar.activeForeground,i.theme.toolbar.activeForeground);});var ldt=vu["default"].li.attrs({"aria-haspopup":true,"aria-hidden":true,role:"menuitem"})(_templateObject360||(_templateObject360=_taggedTemplateLiteral(["\n height: ","px;\n cursor: pointer;\n position: relative;\n"])),function(i){return i.theme.measurements.advancedUIToolbar.itemHeight;});var NV=function NV(i){return jI["default"].createElement(ldt,null,jI["default"].createElement(adt,_objectSpread(_objectSpread({},i),{},{"data-test":N.ToolbarItem})));};var HV=y(_("styled-components"));var cdt=HV["default"].li.attrs({role:"none"})(_templateObject361||(_templateObject361=_taggedTemplateLiteral(["\n height: ","px;\n cursor: pointer;\n position: relative;\n"])),function(i){return i.theme.measurements.advancedUIToolbar.separatorHeight;});var WV=cdt;var wu=y(_("react"));var xf=_("react");var cne=y(_("react"));var tr=_("react");var ddt=y($V());var KV=mdt()?tr.useLayoutEffect:tr.useEffect;if(false){une=typeof process!=="undefined"?process:{env:{NODE_ENV:"development"}},dne=une.env;checkStyles=function i(t){if(checkedPkgs[t])return;checkedPkgs[t]=true;if(dne.NODE_ENV!=="test"&&parseInt(window.getComputedStyle(document.body).getPropertyValue("--reach-"+t),10)!==1){console.warn("@reach/"+t+' styles not found. If you are using a bundler like webpack or parcel include this in the entry file of your app before any of your own styles:\n\n import "@reach/'+t+"/styles.css\";\n\n Otherwise you'll need to include them some other way:\n\n \n\n For more information visit https://ui.reach.tech/styling.\n ');}};}var une;var dne;var mne=typeof window!="undefined"&&window.Math==Math?window:typeof self!="undefined"&&self.Math==Math?self:Function("return this")();function mdt(){return!!(typeof window!=="undefined"&&window.document&&window.document.createElement);}if(false){useControlledSwitchWarning=function i(t,e,r){var o=(0,tr.useRef)(t!=null);var n=(0,tr.useRef)({componentName:r,controlledPropName:e});(0,tr.useEffect)(function(){n.current={componentName:r,controlledPropName:e};},[r,e]);(0,tr.useEffect)(function(){var s=o.current;var a=n.current,l=a.componentName,c=a.controlledPropName;var u=t!=null;if(s!==u){console.error("A component is changing an "+(s?"":"un")+"controlled `"+c+"` state of "+l+" to be "+(s?"un":"")+"controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled "+l+" element for the lifetime of the component.\nMore info: https://fb.me/react-controlled-components");}},[t]);};}if(false){useCheckStyles=function i(t){var e=(0,tr.useRef)(t);(0,tr.useEffect)(function(){return void(e.current=t);},[t]);(0,tr.useEffect)(function(){return checkStyles(e.current);},[]);};}function XV(){var i=(0,tr.useState)(Object.create(null)),t=i[1];return(0,tr.useCallback)(function(){t(Object.create(null));},[]);}if(false){useStateLogger=function i(t,e){if(e===void 0){e=false;}var r=(0,tr.useRef)(e);(0,tr.useEffect)(function(){r.current=e;},[e]);(0,tr.useEffect)(function(){if(r.current){console.group("State Updated");console.log("%c"+t,"font-weight: normal; font-size: 120%; font-style: italic;");console.groupEnd();}},[t]);};}var qV=_("react-dom");var pdt=function i(t){var e=t.children,r=t.type,o=r===void 0?"reach-portal":r;var n=(0,xf.useRef)(null);var s=(0,xf.useRef)(null);var a=XV();KV(function(){if(!n.current)return;var l=n.current.ownerDocument;s.current=l===null||l===void 0?void 0:l.createElement(o);l.body.appendChild(s.current);a();return function(){if(s.current&&s.current.ownerDocument){s.current.ownerDocument.body.removeChild(s.current);}};},[o,a]);return s.current?(0,qV.createPortal)(e,s.current):(0,xf.createElement)("span",{ref:n});};if(false){pdt.displayName="Portal";}var YV=pdt;function $I(i,t){if(i==null)return{};var e={};var r=Object.keys(i);var o,n;for(n=0;n=0)continue;e[o]=i[o];}return e;}function KI(i,t){i.prototype=Object.create(t.prototype);i.prototype.constructor=i;i.__proto__=t;}var gdt=y(oj());var vf=y(_("react"));var jv=y(_("react-dom"));var XI={disabled:false};var nj=y(_("react"));var qI=nj["default"].createContext(null);var Cf="unmounted";var Cu="exited";var Su="entering";var Bm="entered";var YI="exiting";var aa=function(i){KI(t,i);function t(r,o){var n;n=i.call(this,r,o)||this;var s=o;var a=s&&!s.isMounting?r.enter:r.appear;var l;n.appearStatus=null;if(r["in"]){if(a){l=Cu;n.appearStatus=Su;}else{l=Bm;}}else{if(r.unmountOnExit||r.mountOnEnter){l=Cf;}else{l=Cu;}}n.state={status:l};n.nextCallback=null;return n;}t.getDerivedStateFromProps=function r(o,n){var s=o["in"];if(s&&n.status===Cf){return{status:Cu};}return null;};var e=t.prototype;e.componentDidMount=function r(){this.updateStatus(true,this.appearStatus);};e.componentDidUpdate=function r(o){var n=null;if(o!==this.props){var s=this.state.status;if(this.props["in"]){if(s!==Su&&s!==Bm){n=Su;}}else{if(s===Su||s===Bm){n=YI;}}}this.updateStatus(false,n);};e.componentWillUnmount=function r(){this.cancelNextCallback();};e.getTimeouts=function r(){var o=this.props.timeout;var n,s,a;n=s=a=o;if(o!=null&&typeof o!=="number"){n=o.exit;s=o.enter;a=o.appear!==void 0?o.appear:s;}return{exit:n,enter:s,appear:a};};e.updateStatus=function r(o,n){if(o===void 0){o=false;}if(n!==null){this.cancelNextCallback();if(n===Su){this.performEnter(o);}else{this.performExit();}}else if(this.props.unmountOnExit&&this.state.status===Cu){this.setState({status:Cf});}};e.performEnter=function r(o){var n=this;var s=this.props.enter;var a=this.context?this.context.isMounting:o;var l=this.props.nodeRef?[a]:[jv["default"].findDOMNode(this),a],c=l[0],u=l[1];var m=this.getTimeouts();var p=a?m.appear:m.enter;if(!o&&!s||XI.disabled){this.safeSetState({status:Bm},function(){n.props.onEntered(c);});return;}this.props.onEnter(c,u);this.safeSetState({status:Su},function(){n.props.onEntering(c,u);n.onTransitionEnd(p,function(){n.safeSetState({status:Bm},function(){n.props.onEntered(c,u);});});});};e.performExit=function r(){var o=this;var n=this.props.exit;var s=this.getTimeouts();var a=this.props.nodeRef?void 0:jv["default"].findDOMNode(this);if(!n||XI.disabled){this.safeSetState({status:Cu},function(){o.props.onExited(a);});return;}this.props.onExit(a);this.safeSetState({status:YI},function(){o.props.onExiting(a);o.onTransitionEnd(s.exit,function(){o.safeSetState({status:Cu},function(){o.props.onExited(a);});});});};e.cancelNextCallback=function r(){if(this.nextCallback!==null){this.nextCallback.cancel();this.nextCallback=null;}};e.safeSetState=function r(o,n){n=this.setNextCallback(n);this.setState(o,n);};e.setNextCallback=function r(o){var n=this;var s=true;this.nextCallback=function(a){if(s){s=false;n.nextCallback=null;o(a);}};this.nextCallback.cancel=function(){s=false;};return this.nextCallback;};e.onTransitionEnd=function r(o,n){this.setNextCallback(n);var s=this.props.nodeRef?this.props.nodeRef.current:jv["default"].findDOMNode(this);var a=o==null&&!this.props.addEndListener;if(!s||a){setTimeout(this.nextCallback,0);return;}if(this.props.addEndListener){var l=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],c=l[0],u=l[1];this.props.addEndListener(c,u);}if(o!=null){setTimeout(this.nextCallback,o);}};e.render=function r(){var o=this.state.status;if(o===Cf){return null;}var n=this.props,s=n.children,a=n["in"],l=n.mountOnEnter,c=n.unmountOnExit,u=n.appear,m=n.enter,p=n.exit,h=n.timeout,g=n.addEndListener,x=n.onEnter,v=n.onEntering,b=n.onEntered,T=n.onExit,k=n.onExiting,E=n.onExited,A=n.nodeRef,I=$I(n,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return vf["default"].createElement(qI.Provider,{value:null},typeof s==="function"?s(o,I):vf["default"].cloneElement(vf["default"].Children.only(s),I));};return t;}(vf["default"].Component);aa.contextType=qI;aa.propTypes=false?{nodeRef:gdt["default"].shape({current:typeof Element==="undefined"?gdt["default"].any:gdt["default"].instanceOf(Element)}),children:gdt["default"].oneOfType([gdt["default"].func.isRequired,gdt["default"].element.isRequired]).isRequired,"in":gdt["default"].bool,mountOnEnter:gdt["default"].bool,unmountOnExit:gdt["default"].bool,appear:gdt["default"].bool,enter:gdt["default"].bool,exit:gdt["default"].bool,timeout:function i(t){var e=timeoutsShape;if(!t.addEndListener)e=e.isRequired;for(var r=arguments.length,o=new Array(r>1?r-1:0),n=1;n{Lb();_pe();vpe();zb=Bw();Mw=Pw();Do={...zb,measurements:Mw}});var yKe,xpe;var Cpe=p(()=>{rc();Ub();yKe=r=>{if(r==="light"){return zM}return Bw};xpe=(r,e)=>{const t=yKe(r);if(e&&e[r]){const{primary:i,background:o,foreground:n}=e[r];const s={primary:i,background:o,foreground:n};const a=Object.keys(s).reduce((l,u)=>{if(s[u]){return{...l,[u]:s[u]}}return l},{});return ri([t(a),e[r]])}return t()||zb}});var bKe,Spe;var wpe=p(()=>{rc();Lb();bKe=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];Spe=r=>{const e=Pw();if(r){const t={};Object.keys(r).forEach(i=>{if(bKe.indexOf(i)!==-1){t[i]=r[i]}});return ri([e,t])}return e}});var Tpe=p(()=>{bpe();Cpe();wpe()});var _Ke,Ei;var Lw=p(()=>{ze();B();Ks();W();rc();PM();mpe();aM();Mb();Tpe();Ub();_Ke={config:ec,locale:lp,theme:zb,measurements:Mw,initialMeasurements:Mw};Ei=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(e,t)=>{return t.indexOf(e)!==-1};this.state=ae(_Ke);this.events=new FM;this.licenseChecker=null}saveConfig(e){if(e.mainCanvasActions&&e.mainCanvasActions.length!==4){e.mainCanvasActions.length=4}const t=e.layout&&e.layout==="basic"?BM:ec;const i=ri([t,e],{clone:true});this.licenseChecker=new ww(i.license);if(!this.licenseChecker.areCustomAssetsAllowed()){i.sticker.enableCustomUpload=false}const o=ype(i.language,i.custom.languages);const n=xpe(i.theme,i.custom.themes);const s=Spe(i.custom.measurements);const{provider:a}=i.library;const l=[];i.adjustment.categories=i.adjustment.categories.reduce((d,m)=>{d.push({...m,items:m.items.filter(h=>{if(!xO[h.identifier]){l.push(h.identifier);return false}return true})});return d},[]);if(l.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${l.join(", ")}`)}delete i.language;delete i.custom.languages;delete i.custom.themes;delete i.library.provider;let u=i.tools.reduce((d,m)=>{if(typeof m==="object"){return[...d,...m]}return[...d,m]},[]);if(!u.length){console.error(`Empty list input for tools`);u=Tw.reduce((d,m)=>{if(typeof m==="object"){return[...d,...m]}return[...d,m]},[])}u=u.filter(d=>this.licenseChecker.isToolAllowed(d));if(i.defaultTool){const d=this.checkDefaultToolAvailability(i.defaultTool,u);if(!d){[i.defaultTool]=u}}i.tools=u;this.state.config=i;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;const c=this.buildCustomAssetsConfig();this.assetProvider=new ny(c,this.licenseChecker.areCustomAssetsAllowed(),i.assetResolver);this.loadThemeFont();return a}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((e,t)=>{if(typeof t==="string"){return[...e,t]}return[...e,"",...t]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:e}=this.theme;if(!e.skipLoading){this.assetProvider.getFontManager().injectFonts([e])}}buildCustomAssetsConfig(){const e=this.tools;const t=ve(this.state.config);const i=this.state.config.assetBaseUrl;const{theme:o}=this.state;const n=e.indexOf("filter")!==-1?t["filter"]:void 0;const s=e.indexOf("focus")!==-1?t["focus"]:void 0;const a=e.indexOf("adjustment")!==-1?t["adjustment"]:void 0;const l=e.indexOf("sticker")!==-1?t["sticker"]:void 0;const u=e.indexOf("frame")!==-1?t["frame"]:void 0;const c=e.indexOf("overlay")!==-1?t["overlay"]:void 0;const d=e.indexOf("transform")!==-1?t["transform"]:void 0;const m=e.indexOf("text")!==-1?t["text"]:void 0;const h=e.indexOf("textdesign")!==-1?t["textdesign"]:void 0;return{basePath:i,theme:o,filter:n,focus:s,sticker:l,frame:u,overlay:c,transform:d,text:m,adjustment:a,textdesign:h}}};g([S],Ei.prototype,"saveConfig",1);g([S],Ei.prototype,"dispose",2);g([w],Ei.prototype,"config",1);g([w],Ei.prototype,"locale",1);g([w],Ei.prototype,"theme",1);g([w],Ei.prototype,"measurements",1);g([w],Ei.prototype,"initialMeasurements",1);g([w],Ei.prototype,"tools",1);g([w],Ei.prototype,"defaultTool",1);g([w],Ei.prototype,"isOrderDefault",1);g([w],Ei.prototype,"isLayoutAdvanced",1);g([w],Ei.prototype,"displayCloseButton",1)});var UM;var NM=p(()=>{B();_O();UM=class{constructor(e){this.editor=e}setBackgroundImage(e){if(!this.container){this.container=this.engine.addImage({image:e,originalImage:e,blendMode:"normal",opacity:1})}else{this.container.setData({image:e,originalImage:e})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((e,t)=>{const{image:i}=this.editor.activeStore;if(kK(i)){this.setBackgroundImage(i);e()}else{const o=this.editor.libraryStore.getRawUrl(i);this.getImageElement(o).then(n=>{this.setBackgroundImage(n);e()}).catch(n=>{t({identifier:"imageLoading",message:n.message})})}})}getImageElement(e){return new Promise((t,i)=>{const o=new Image;o.addEventListener("load",()=>{t(o)});o.addEventListener("error",n=>{i(n)});o.crossOrigin=this.editor.configStore.config.engine.crossOrigin;o.src=e})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}}});var qM;var HM=p(()=>{W();qM=class{constructor(e){this.applyNewImageTransform=()=>{const{size:e,width:t,height:i}=this.editor.engineMediator.image.container.getBounds();const o=this.container;o.setTransform(bt.IDENTITY);o.setResolution(e);o.setPivot(.5,.5);o.setPosition({x:t/2,y:i/2})};this.editor=e}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}}});function Nb(r,e){const t=r.width/r.height;const i=e.width/e.height;if(t>i){return r.height/e.height}return r.width/e.width}var Ipe=p(()=>{});var vKe,Sl;var WM=p(()=>{ze();W();Ipe();vKe={transform:bt.IDENTITY};Sl=class{constructor(e){this.initialTransform=bt.IDENTITY;this.editor=e;this.state=ae(vKe)}createPreview(e){this.container=this.editor.engine.createPreview(e)}updateTransform(e=0,t=true){const i=this.calculateTransform(e);if(i.scale.x){if(t){this.saveInitialTransform(i)}else{this.savePreviewTransform(i)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(e){this.initialTransform=e;this.savePreviewTransform(e)}savePreviewTransform(e){lr(()=>{this.state.transform.position=e.position;this.state.transform.scale=e.scale;this.state.transform.rotation=e.rotation;const t=kn();const i=new F(e.scale).divide(t);this.previewTransformWithoutDpr={position:new F(e.position).divide(t),scale:i,rotation:e.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(e=0){const t=kn();const{scaleImageToFit:i}=this.editor.configStore.config;const{width:o,height:n}=this.editor.canvasStore.canvasSize;const s=this.editor.engine.getOutputDimensions();const a=Nb({width:o,height:n},s);let l=i?a:Math.min(1,a);const u=n-s.height*l;const c=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(un*d){l=Nb({width:o,height:n*d},s)}if(s.width*l>o*d){l=Nb({width:o*d,height:n},s)}l*=t;const m={x:o*t/2,y:n*t/2};const h={x:l,y:l};return new bt(m,h,e)}};g([S],Sl.prototype,"updateTransform",1);g([S],Sl.prototype,"savePreviewTransform",1);g([w],Sl.prototype,"transform",1);g([w],Sl.prototype,"position",1);g([w],Sl.prototype,"scale",1);g([w],Sl.prototype,"rotation",1)});var ic,zw;var GM=p(()=>{B();ic=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(e){if(["sticker","text","textdesign","brush"].indexOf(e)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(e,t){const i=t.findIndex(o=>o===e);if(i!==-1){t.splice(i,1)}return void 0}static indexForOrder(e,t,i){const o=e[i];const n=t.findIndex(a=>a===i);if(n!==-1){return{index:n,order:t}}const{length:s}=t;if(s){let a;for(a=0;ao===e);if(i!==-1){this.spriteContainerOrder[i]=t}}bringToFront(e){const t=this.spriteContainerOrder.findIndex(i=>i===e);if(t!==-1){this.spriteContainerOrder.splice(t,1);this.spriteContainerOrder.push(e)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:e}=this.spriteContainerOrder;return this.spriteContainerOrder[e-1]}getSpriteIndex(e){const t=this.spriteContainerOrder.findIndex(i=>i===e);return t+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};zw=ic;zw.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3}});var VM;var jM=p(()=>{Ks();W();NM();HM();WM();GM();VM=class{constructor(e){this.orderHelper=new zw;this.init=()=>{const e=this.editor.configStore.config.engine;this.engine=new Zh({...e,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new UM(this.editor);this.output=new qM(this.editor);this.preview=new Sl(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=e}render(e){return this.engine.render(e)}previewSpaceToWorldSpace(e,t){const i=this.preview.previewTransformWithoutDpr;if(Wo(e)){const o=this.editor.engine.convertPointFromPreviewIntoWorldSpace(F.ZERO,i,t);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:e,y:0},i,t);return F.distance(new F(o),new F(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(e,i,t)}worldSpaceToPreviewSpace(e){const t=this.preview.previewTransformWithoutDpr;if(Wo(e)){const i=this.editor.engine.convertPointFromWorldIntoPreviewSpace(F.ZERO,t);const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:e,y:0},t);return F.distance(new F(i),new F(o))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(e,t)}outputSpaceToWorldSpace(e){if(Wo(e)){return ye.getScalarInWorldSpace(e,this.editor.engine.getOutputContainer())}return ye.getPointInWorldSpace(e,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(e){const t=this.preview.previewTransformWithoutDpr;if(Wo(e)){const i=this.editor.engine.convertPointFromPreviewIntoOutputSpace(F.ZERO,t);const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:e,y:0},t);return F.distance(new F(i),new F(o))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(e,t)}previewSpaceToFlippedPreviewSpace(e){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(e)}}});var of;var Epe=p(()=>{ze();of=class{constructor(){this.snapshots=[];this.observeIndex=ae.box(-1)}addSnapshot(e){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(e))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(e)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(e){if(e>0&&e0}get canRedo(){return this.snapshots.length-1>this.index}};g([w],of.prototype,"index",1);g([w],of.prototype,"canUndo",1);g([w],of.prototype,"canRedo",1)});var up;var Uw=p(()=>{ze();B();Epe();Ii();up=class{constructor(e){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const e=this.appHistoryManager.undo();await this.applyState(e);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const e=this.appHistoryManager.redo();await this.applyState(e);this.awaitHistoryChange=false}};this.editor=e;this.appHistoryManager=new of}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const e=ve(this.editor.adjustmentsToolStore.state);const t=ve(this.editor.filterToolStore.state);const i=this.editor.focusToolStore.getFocusStateForHistory();const o=ve(this.editor.overlayToolStore.state);const n=ve(this.editor.frameToolStore.state);const{strokes:s}=this.editor.brushToolStore;const a=this.editor.spriteStore.getSpriteHistoryState();const l=this.editor.transformToolStore.serializableState;return{["adjustment"]:e,["filter"]:t,["focus"]:i,["overlay"]:o,["frame"]:n,["brush"]:s,sprite:a,["transform"]:l}}addInitialSnapshot(){const e=this.getHistoryState();this.appHistoryManager.addSnapshot({state:e,type:"add",description:"Initial State"})}addSnapshot(e,t,i){let o;if(!e){o=this.getHistoryState()}else if(e.sprite||e.transform){o={...this.getHistoryState(),...e}}else{o=e}this.appHistoryManager.addSnapshot({state:o,type:t,description:i});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:e}){try{if(e){const t=Object.keys(e);for(const i of t){switch(i){case"filter":await this.editor.filterToolStore.updateStateFromHistory(e[i]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(e[i]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(e[i]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(e[i]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(e[i],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(e[i]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(e[i]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(e[i]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(t){console.error(t);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:t,handleConfirm:()=>{this.applyState({state:e})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var e,t;return(t=(e=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:e.state)==null?void 0:t.sprite}};g([S],up.prototype,"undo",2);g([S],up.prototype,"redo",2);g([w],up.prototype,"canUndo",1);g([w],up.prototype,"canRedo",1)});var xKe,kpe,CKe,$M;var Dpe=p(()=>{xKe=(r,e)=>new Promise((t,i)=>{const o=new XMLHttpRequest;o.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){t(n.result)}else{i(new Error(`The image could not be loaded from ${r}`))}};n.onerror=s=>{i(s)};n.readAsDataURL(o.response)};o.open("GET",r);o.responseType="blob";o.withCredentials=e==="use-credentials";o.send()});kpe=(r,e)=>{return new Promise((t,i)=>{const o=new Image;o.onload=()=>{t(o)};o.onerror=()=>{i(new Error(`Failed to load image with src:${r}`))};o.crossOrigin=e;o.src=r})};CKe=(r,e)=>new Promise((t,i)=>{xKe(r,e).then(o=>{const n=new Image;n.addEventListener("load",()=>{t(n)});n.src=o}).catch(()=>{kpe(r,e).then(o=>t(o)).catch(o=>{i(o)})})});$M=async({url:r,image:e,crossOrigin:t="anonymous"})=>{try{if(e&&e.src&&e.src.substr(0,5)==="data:"||e&&e.src&&e.src.includes(".svg")){return e}if(typeof r==="string"&&r.substr(0,5)==="data:"||typeof r==="string"&&r.includes(".svg")){return kpe(r,t)}return CKe(r||e.src,t)}catch(i){throw new Error(i)}}});var SKe,Xi;var Nw=p(()=>{ze();B();W();Dpe();SKe={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};Xi=class{constructor(e){this.setImage=async e=>{try{const{crossOrigin:t}=this.editor.configStore.config.engine;if(typeof e==="string"&&!e.trim()||e===void 0||e===null){this.state.image=null}else if(typeof e==="string"){this.state.image=await $M({url:_s(e)?e:this.editor.assetProvider.getPath(e),crossOrigin:t})}else if(e instanceof HTMLImageElement){this.state.image=await $M({image:e,crossOrigin:t})}if(this.isWebcam){this.state.isWebcam=false}}catch(t){throw new Error(t)}};this.setImageLoadedToEngine=e=>{this.state.imageLoadedToEngine=e};this.newImage=e=>{this.editor.init(e)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=e;this.state=ae(SKe)}selectTool(e){var i,o,n;const{licenseChecker:t}=this.editor.configStore;if(this.state.tool!==e&&(t==null?void 0:t.isToolAllowed(e))&&(this.image||e==="library"||e==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const s=(n=(o=(i=this.editor.configStore.state.config["customTool"])==null?void 0:i.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(e==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,e);this.state.tool=e;this.editor.configStore.events.onToolChanged(e);switch(e){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(e){this.state.isWebcam=e}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};g([S],Xi.prototype,"selectTool",1);g([S],Xi.prototype,"selectWebcam",1);g([S],Xi.prototype,"setImage",2);g([S],Xi.prototype,"setImageLoadedToEngine",2);g([S],Xi.prototype,"newImage",2);g([S],Xi.prototype,"dispose",2);g([w],Xi.prototype,"webcamLabel",1);g([w],Xi.prototype,"tool",1);g([w],Xi.prototype,"isWebcam",1);g([w],Xi.prototype,"image",1);g([w],Xi.prototype,"imageLoadedToEngine",1)});var wKe,KM,XM,ii;var qw=p(()=>{ze();B();W();wKe={height:150,width:150};KM={height:0,width:0};XM=class{constructor(e){this.canvasClickDisabled=ae.box(false);this.resizeCanvas=(e=null)=>{const t=this.editor.activeStore.tool;const i=e==="transform"||!e&&t==="transform";const{isLayoutAdvanced:o,measurements:n}=this.editor.configStore;const{storedSize:s}=this.editor.canvasStore;let a=0;if(!o&&i){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(e==="transform"&&t==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:s.width,height:s.height+a})};this.setCanvasSize=e=>{this.state.canvasSize=e};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=e;this.state=ae(XM.initialState)}setCanvasElement(e){this.canvas=e;this.editor.engineMediator.preview.createPreview(e);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:e,width:t,render:i}){const{imageLoadedToEngine:o}=this.editor.activeStore;if(e>KM.height&&t>KM.width){this.state.storedSize={width:t,height:e};if(this.state.canvasSize.height===0){this.state.canvasSize={width:t,height:e}}if(i&&o){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return F.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(e){const t=this.editor.engine.getContainersAtPreviewPoint(e,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(i=>i.getID()).filter(i=>i!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(t)}};ii=XM;ii.initialState={canvasSize:KM,storedSize:wKe};g([S],ii.prototype,"setCanvasElement",1);g([S],ii.prototype,"saveDimensions",1);g([S],ii.prototype,"resizeCanvas",2);g([S],ii.prototype,"disableCanvasClick",1);g([S],ii.prototype,"enableCanvasClick",1);g([S],ii.prototype,"setCanvasSize",2);g([S],ii.prototype,"dispose",2);g([w],ii.prototype,"isCanvasClickable",1);g([w],ii.prototype,"canvasSize",1);g([w],ii.prototype,"storedSize",1);g([w],ii.prototype,"sizeVector",1);g([w],ii.prototype,"sizeVectorMagnitude",1)});var TKe,Oo;var Hw=p(()=>{ze();B();TKe={type:null,identifier:null,isVisible:false,error:""};Oo=class{constructor(e){this.showActionModal=({type:e,identifier:t,error:i,handleConfirm:o,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=t;this.state.type=e;this.state.error=i||"";this.handleConfirm=o;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=e.configStore;this.state=ae(TKe)}showInfoModal(e){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=e;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:e}=this.state;const t=this.getModalLocale();if(t){const{bodyLabel:i,headerLabel:o,buttonYes:n,buttonNo:s}=t;return{headerLabel:o,bodyLabel:i,confirmLabel:n,dismissLabel:s,isVisible:e,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:e,measurements:{basicCanvasOffset:t,advancedUIToolControlBar:i,advancedUIToolbar:o},isOrderDefault:n}=this.configStore;const s=(i.width+o.width)*(!n?-1:1);const a=t;return e?{x:s/2,y:0}:{x:0,y:-a}}getModalLocale(){const{identifier:e,error:t,type:i}=this.state;const{locale:o}=this.configStore;if(!i||!e||i==="textEdit")return null;if(i&&e&&o[`${i}Modals`]&&o[`${i}Modals`][e]){const n=o[`${i}Modals`][e];let{body:s}=n;if(s&&typeof t==="object"){Object.keys(t).forEach(l=>{s=s.replace(`\${${l}}`,t[l])})}else if(s){s=s.replace("${error}",t)}let a=n.heading;if(i==="error"||i==="warning"){const l={error:o.common.error,warning:o.common.warning};const u=i==="error"?l.error:l.warning;a=`${u}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};g([S],Oo.prototype,"showActionModal",2);g([S],Oo.prototype,"showInfoModal",1);g([S],Oo.prototype,"showTextEditModal",1);g([S],Oo.prototype,"hideModal",2);g([S],Oo.prototype,"dispose",2);g([w],Oo.prototype,"modalProps",1);g([w],Oo.prototype,"isVisible",1);g([w],Oo.prototype,"type",1);g([w],Oo.prototype,"identifier",1);g([w],Oo.prototype,"positionOffset",1)});var vr;var Ww=p(()=>{ze();W();vr=class{constructor(e){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(e=>e/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:e,maxOffsetY:t}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=t}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=e}this.savePosition();this.scaleRender()}};this.setOffset=e=>{const{canDragX:t,canDragY:i}=this.checkOffset(e);if(t){this.offset.x=e.x}if(i){this.offset.y=e.y}this.scaleRender()};this.editor=e}setInitialTransform(e=0){const t=kn();const{scaleImageToFit:i}=this.editor.configStore.config;const{transform:o}=this.editor.engineMediator.preview;lr(()=>{const n=Math.abs(e||o.scale.x);this.setDefaultScale(i?n:Math.min(1*t,n));this.setPosition(o.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:e,height:t}=this.editor.canvasStore.canvas;this.setPosition({x:e/2,y:t/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(e){this.state.position.x=e.x;this.state.position.y=e.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(e){if(this.defaultScale!==1){const i=this.SCALE_LEVELS.findIndex(o=>o===this.defaultScale);if(i!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,i),...this.SCALE_LEVELS.slice(i+1)]}}const t=this.SCALE_LEVELS.findIndex(i=>i===e);if(t!==-1){this.state.scaleIndex=t}else{const i=this.SCALE_LEVELS.findIndex((o,n)=>{if(n===0){return e0;const f=c>0;const b=d-a;const _=m-l;return{canDragX:b<0,canDragY:_<0,maxOffsetX:h?-b:b,maxOffsetY:f?-_:_}}calculateScale(e=0,t=this.previewSize,i=this.defaultScale){const{width:o,height:n}=t;const s=new F({x:o,y:n});const a=new F(Math.abs(s.x*Math.cos(e))+Math.abs(s.y*Math.sin(e)),Math.abs(s.x*Math.sin(e))+Math.abs(s.y*Math.cos(e)));const l=s.subtract(a).divide(2).multiply(i).abs;if(l.y>l.x){return l.y*2/s.y+i}return l.x*2/s.x+i}get defaultIndex(){return this.SCALE_LEVELS.findIndex(e=>e===this.defaultScale)}getPositionWithOffset(e=this.offset){const{position:t}=this;return{x:t.x-e.x,y:t.y-e.y}}scaleRender(e=false){const t=this.editor.scale.getPositionWithOffset();const i=e?this.defaultScale:this.scale;const o={x:i,y:i};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(t);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:t,rotation:0});if(!e){this.editor.render()}}get scale(){const e=this.state.scaleIndex;return e!==-1?this.SCALE_LEVELS[e]:this.defaultScale}get zoomLevel(){const e=kn();return(this.scale/e*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const e=this.state.scaleIndex;const t=e!==-1?this.SCALE_LEVELS[e]:this.defaultScale;const{previewSize:i}=this;return{width:i.width*t/this.defaultScale,height:i.height*t/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};g([ae],vr.prototype,"state",2);g([S],vr.prototype,"in",2);g([S],vr.prototype,"out",2);g([S],vr.prototype,"setInitialTransform",1);g([S],vr.prototype,"resetScale",1);g([S],vr.prototype,"resetPosition",1);g([S],vr.prototype,"setPosition",1);g([S],vr.prototype,"savePosition",1);g([S],vr.prototype,"setDefaultScale",1);g([S],vr.prototype,"setScaleToDefault",1);g([w],vr.prototype,"scale",1);g([w],vr.prototype,"zoomLevel",1);g([w],vr.prototype,"canDrag",1);g([w],vr.prototype,"canZoomOut",1);g([w],vr.prototype,"canZoomIn",1);g([w],vr.prototype,"position",1);g([w],vr.prototype,"scaledSize",1)});var Ope,IKe,Qs,rr;var YM=p(()=>{ze();W();Ope=[[0,0],[0,1],[1,0],[1,1]];IKe=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];Qs=class{constructor(e,t,i="center",o=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=t;this.m=i==="center"?Qs.movePivotTo([.5,.5]):Ope;this.considerRotation=o;this.considerFlip=n;this.configStore=e.configStore}static getFlippedEdgeIndex(e,t,i){return IKe[(t?1:0)+(i?2:0)][e]}static movePivotTo(e){return Ope.map(t=>[t[0]-e[0],t[1]-e[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(e,t,i){const o=Qs.getFlippedEdgeIndex(e,t,i);const n=this.m[o][0]*this.size.width;const s=this.m[o][1]*this.size.height;return{width:n,height:s}}get leftTop(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(0,t,i);return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftBottom(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(1,t,i);return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightTop(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(2,t,i);return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightBottom(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(3,t,i);return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftBottomHandle(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(1,t,i);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightBottomHandle(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(3,t,i);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftMid(){const e=new F(this.leftTop);const t=new F(this.leftBottom);return e.add(t).divide(2)}get rightMid(){const e=new F(this.rightTop);const t=new F(this.rightBottom);return e.add(t).divide(2)}};rr=Qs;rr.coordinatesWithRotation=({width:e,height:t},i,o,n,s,a)=>{let l=e*Math.cos(i)-t*Math.sin(i)+a.x;let u=e*Math.sin(i)+t*Math.cos(i)+a.y;if(o){l=s.x*2-l}if(n){u=s.y*2-u}return new F({x:l,y:u}).rounded};g([w],rr.prototype,"position",1);g([w],rr.prototype,"size",1);g([w],rr.prototype,"rotation",1);g([w],rr.prototype,"flipHorizontally",1);g([w],rr.prototype,"flipVertically",1);g([w],rr.prototype,"flipCenter",1);g([w],rr.prototype,"leftTop",1);g([w],rr.prototype,"leftBottom",1);g([w],rr.prototype,"rightTop",1);g([w],rr.prototype,"rightBottom",1);g([w],rr.prototype,"leftBottomHandle",1);g([w],rr.prototype,"rightBottomHandle",1);g([w],rr.prototype,"leftMid",1);g([w],rr.prototype,"rightMid",1)});var JM=p(()=>{Lw();Mb();Ub();Lb();jM();GM();NM();HM();WM();Uw();Nw();qw();Hw();Ww();YM()});var He;var Rpe=p(()=>{ze();W();DM();He=class{constructor(e,t){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:ae.map({})};this.configStore=e.configStore;this.id=Ge();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=t}changeIdentifier(e){this.state.identifier=e;const t=this.state.cropState.get(`${this.id}-${e}`);if(!t){this.state.cropState.set(`${this.id}-${e}`,{...Gn})}}changeRatio(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){this.state.cropState.set(`${this.id}-${this.identifier}`,{...t,ratio:e})}}changeSize(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e.width&&e.width>0){t.size.width=Math.round(e.width)}if(e.height&&e.height>0){t.size.height=Math.round(e.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}changeHeight(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e){t.size.height=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}}changeWidth(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e){t.size.width=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}}changePositionX(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i&&e<=t-this.minCropSize&&e>=0){i.position.x=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}return false}changePositionY(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i&&e<=t-this.minCropSize&&e>=0){i.position.y=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}return false}changePosition(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i){if(e.x<=t.width-this.minCropSize&&e.x>=0&&e.y<=t.height-this.minCropSize&&e.y>=0){i.position.x=Math.round(e.x);i.position.y=Math.round(e.y);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}}return false}changeLockResolution(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){t.lockResolution=e!==void 0?e:!t.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}changeForceDimensions(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){t.forceDimensions=e;this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}clearState(){this.state.cropState.forEach((e,t)=>t.startsWith(this.id)&&this.state.cropState.delete(t))}setRotation(e){this.state.rotationInDegrees=e}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:e,flipVertically:t}){this.state.flipHorizontally=e;this.state.flipVertically=t}setOutputRotation(e){this.state.outputRotation=e}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:e,height:t}=this.defaults.maxCropMaskSize;return new F(e/2,t/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:Gn.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:Gn.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:Gn.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:Gn.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:Gn.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:Gn.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:Gn.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:Gn.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:Gn.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};g([ae],He.prototype,"state",2);g([S],He.prototype,"changeIdentifier",1);g([S],He.prototype,"changeRatio",1);g([S],He.prototype,"changeSize",1);g([S],He.prototype,"changeHeight",1);g([S],He.prototype,"changeWidth",1);g([S],He.prototype,"changePositionX",1);g([S],He.prototype,"changePositionY",1);g([S],He.prototype,"changePosition",1);g([S],He.prototype,"changeLockResolution",1);g([S],He.prototype,"changeForceDimensions",1);g([S],He.prototype,"clearState",1);g([S],He.prototype,"setRotation",1);g([S],He.prototype,"resetRotation",1);g([S],He.prototype,"resetOutputRotation",1);g([S],He.prototype,"resetFlip",1);g([S],He.prototype,"updateFlip",1);g([S],He.prototype,"setOutputRotation",1);g([S],He.prototype,"flipHorizontally",1);g([S],He.prototype,"flipVertically",1);g([S],He.prototype,"dispose",2);g([w],He.prototype,"flipCenter",1);g([w],He.prototype,"isFlippedHorizontal",1);g([w],He.prototype,"isFlippedVertical",1);g([w],He.prototype,"identifier",1);g([w],He.prototype,"height",1);g([w],He.prototype,"width",1);g([w],He.prototype,"position",1);g([w],He.prototype,"ratio",1);g([w],He.prototype,"size",1);g([w],He.prototype,"x",1);g([w],He.prototype,"y",1);g([w],He.prototype,"lockResolution",1);g([w],He.prototype,"forceDimensions",1);g([w],He.prototype,"selectedCrop",1);g([w],He.prototype,"rotationInDegrees",1);g([w],He.prototype,"outputRotation",1)});var ZM;var Ape=p(()=>{ze();W();Jh();ZM=class{constructor(e){this.transforms={output:JSON.stringify(bt.IDENTITY),preview:JSON.stringify(bt.IDENTITY)};this.setFrameOpacity=e=>{this.frameOpacity=e;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=e=>{this.overlayOpacity=e;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=e;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:e,flipVertically:t,rotation:i,outputRotation:o}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new F(this.transformToolStore.leftTopRespectFlip).add(new F(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new F(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const s=this.engineMediator.preview.container;const{outputContainer:a}=this.editor;a.setResolution(ve(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:t,flipHorizontally:e});const l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let u=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:f,defaultImageSize:b}=this.transformToolStore;const _=this.transformToolStore.maxCropMaskSize;const y={height:f.height*b.height/_.height,width:f.width*b.width/_.width};u=y.width/this.transformToolStore.localOutputImageSize.width}const c=Math.abs(l.x);const d=u/(c/this.transformToolStore.defaultScale);const m={x:d,y:d};const h=-(i-o);a.setTransform({scale:m,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(e){this.transforms=e}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const e=this.engineMediator.preview.container;const{outputContainer:t}=this.editor;const i=JSON.parse(this.transforms.preview);t.setResolution(ve(this.transformToolStore.defaultImageSize));e.setTransform(i);t.setTransform(JSON.parse(this.transforms.output));const o=i.scale;t.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(i);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(e,t=true){const{width:i,height:o}=this.editor.engineMediator.image.container.getBounds();const n=CJ(e)?{width:o,height:i}:{width:i,height:o};this.editor.outputContainer.rotate(e,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:s}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(s);lr(()=>{this.editor.scale.setInitialTransform();const a=this.getScaleWithFlip(s);this.engineMediator.preview.container.setScale(a);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(t){this.editor.render()}}applyPreviewTransform(){const{rotation:e,flipHorizontally:t,flipVertically:i}=this.transformToolStore.rotateFlipState;const o=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let s=e;if(t){s=Yh(s)}if(i){s=Yh(s)}const a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a)}getScaleWithFlip(e=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:t,flipVertically:i}=this.transformToolStore.rotateFlipState;const o=t?-1:1;const n=i?-1:1;const s=this.editor.scale.calculateScale(e);return{x:s*o,y:s*n}}saveTransforms(){const e=JSON.stringify(this.engineMediator.preview.container.getTransform());const t=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:e,output:t}}saveTransformsBasedOnFlip(){const e=this.engineMediator.preview.container.getTransform();const{scale:t}=e;const{flipVertically:i,flipHorizontally:o}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...e,scale:{x:o?-t.x:t.x,y:i?-t.y:t.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}}});var QM;var Fpe=p(()=>{W();QM=class{constructor(e){this.store=e;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,gr.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}}});var Ppe,cp,le;var e5=p(()=>{ze();B();W();JM();Ii();Ys();Rpe();Ape();Fpe();Ppe="identity";cp=class{constructor(e){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=ae.box(false);this.minCropSize=0;this.transformHistory=new QM(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=e=>{if(!e.trim())return false;let t=this.editor.configStore.config.assetBaseUrl;const{length:i}=t;if(t[i-1]!=="/"){t+="/"}if(`${t}transform`===e){return false}const o=new Image;try{o.src=e;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const e=this.editor.outputContainer.getRotation();if(e!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=e=>{this.localOutputSize.height=Math.round(e.height);this.localOutputSize.width=Math.round(e.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(e.width),height:Math.round(e.height)})};this.changeDefaultScale=e=>{this.defaults.scale=e};this.changeLocalOutputHeight=e=>{this.localOutputSize.height=Math.round(e)};this.changeLocalOutputWidth=e=>{this.localOutputSize.width=Math.round(e)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const e=this.editor.outputContainer.getRotation();const t=this.isFlippedVertical?pR:mR;this.rotateOutputContainer(t(e))};this.rotateAntiClockwise=()=>{const e=this.editor.outputContainer.getRotation();const t=this.isFlippedVertical?mR:pR;this.rotateOutputContainer(t(e))};this.flipHorizontally=(e=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(e);if(e){this.trackChanges()}};this.flipVertically=(e=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(e);if(e){this.trackChanges()}};this.applyDefaultCrop=(e=false)=>{if(this.identifier==="identity"){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,e)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:e,y:t})=>{const i=this.getRatio();const o=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,e),o.x-n.width);const l=Math.min(Math.max(0,t),o.y-n.height);const u=o.x-a;const c=o.y-l;const d={width:Math.max(this.minCropSize,Math.min(u,s.width-a)),height:Math.max(this.minCropSize,Math.min(c,s.height-l))};if(i==="*"){if(this.changePosition({x:a,y:l})){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);const h=new F(o).subtract({x:m.width,y:m.height});if(this.changePosition(h)){this.changeCropAndOutputSize(m,i)}}};this.onLeftBottom=({x:e,y:t})=>{const i=this.getRatio();const o=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,e),o.x-n.width);const l=Math.max(0,t,o.y+n.height);const u=o.x-a;const c=l-o.y;const d={width:Math.max(1,Math.min(u,s.width-a)),height:Math.max(1,Math.min(c,s.height-o.y))};if(i==="*"){if(this.changePositionX(a)){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);if(this.changePositionX(o.x-m.width)){this.changeCropAndOutputSize(m,i)}}};this.onRightTop=({x:e,y:t})=>{const i=this.getRatio();const o=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,e,o.x+n.width);const l=Math.min(Math.max(0,t),o.y-n.height);const u=a-o.x;const c=o.y-l;const d={width:Math.max(1,Math.min(u,s.width-o.x)),height:Math.max(1,Math.min(c,s.height-l))};if(i==="*"){if(this.changePositionY(l)){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);if(this.changePositionY(o.y-m.height)){this.changeCropAndOutputSize(m,i)}}};this.onRightBottom=({x:e,y:t})=>{const i=this.getRatio();const o=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,e,o.x+n.width);const l=Math.max(0,t,o.y+n.height);const u=a-o.x;const c=l-o.y;const d={width:Math.max(1,Math.min(u,s.width-o.x)),height:Math.max(1,Math.min(c,s.height-o.y))};if(i==="*"){this.changeCropAndOutputSize(d)}else{const m=this.proportionalSize(i,d);this.changeCropAndOutputSize(m,i)}};this.onPixelWidth=e=>{const t=JSON.stringify(ve(this.localOutputSize));const i=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(i&&i.ratio){let n=e;let s=this.localOutputSize.height;let{ratio:a}=i;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(e,o.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(s)})}else{const l=cp.placeCropMask(a,o);n=Math.max(Math.min(n,l.width),this.minCropSize);s=n/a;this.changeLocalOutputSize({height:s,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(t));return Math.round(n)}return e};this.onPixelHeight=e=>{const t=JSON.stringify(ve(this.localOutputSize));const i=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(i&&i.ratio){let n=e;let s=this.localOutputSize.width;let{ratio:a}=i;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(e,o.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(n)})}else{const l=cp.placeCropMask(a,o);n=Math.max(Math.min(n,l.height),this.minCropSize);s=n*a;this.changeLocalOutputSize({height:n,width:s})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(t));return Math.round(n)}return e};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=e=>{this.transformations.setFrameOpacity(e)};this.setOverlayOpacity=e=>{this.transformations.setOverlayOpacity(e)};this.closestRatioReducer=e=>(t,i)=>{if(i===null)return-1;return Math.abs(e-t.ratio)(t,i)=>{if(i===null)return-1;const o=Math.abs(t.dimensions.x/t.dimensions.y);const n=Math.abs(i.dimensions.x/i.dimensions.y);if(o===n){return t.dimensions.x*t.dimensions.y>i.dimensions.x*i.dimensions.y?-1:1}return Math.abs(e-o){const e=this.entityManager.items.findIndex(l=>l.identifier==="imgly_transform_common_custom");if(e!==-1)return this.entityManager.items[e];const t=this.entityManager.items.findIndex(l=>l.ratio==="*");if(t!==-1)return this.entityManager.items[t];const i=ve(this.editor.outputContainer.getResolution());const o=Math.abs(i.width/i.height);const[n]=this.entityManager.items.filter(l=>l.ratio&&typeof l.ratio==="number").sort(this.closestRatioReducer(o));const[s]=this.entityManager.items.filter(l=>l.dimensions&&!l.ratio).sort(this.closestDimensionsReducer(o));if(!n||!s||!n.ratio&&!s.dimensions){return this.entityManager.items[0]}if(!s||!s.dimensions)return n;if(!n||!n.ratio)return s;const a=Math.abs(s.dimensions.x/s.dimensions.y);if(a===n.ratio)return n;return Math.abs(o-n.ratio){let t=this.entityManager.items.find(i=>i.identifier===e);if(!t){t=this.getMatchingItem()}return t};this.editor=e;this.selectedCategory=Ppe;this.transformStore=new He(e,this.defaults);this.transformations=new ZM(e);const{enableRotation:t,enableFlip:i,...o}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new or(n,{...o,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new rr(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new rr(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(e){return e*Math.PI/180}static placeCropMask(e,t){if(t.height*e>t.width){const o=t.width/e;return{height:o,width:t.width,yChanged:true}}const i=t.height*e;return{height:t.height,width:i,yChanged:false}}changeIdentifier(e,t=false){this.transformStore.changeIdentifier(e);const i=this.getCropMask(e,this.defaults.imageSize);if(i){this.transformStore.changeRatio(i.ratio);this.changeLocalOutputSize(i);this.updatePreviewSizeWRTImageSize();if(i.yChanged!==void 0){this.updateInitialCropMaskPosition(i.yChanged)}if(i.dimensions){this.changeLocalOutputSize({width:i.dimensions.x,height:i.dimensions.y})}if(t){this.trackChanges()}}}setDragMode(e){this.dragMode.set(e)}getCropMask(e,t){const i=this.getTransform(e);if(i){const{ratio:o,forceDimensions:n,lockDimensions:s,dimensions:a=null}=i;if(n){this.transformStore.changeForceDimensions(n)}if(s){this.transformStore.changeLockResolution(s)}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return{...t,yChanged:void 0,ratio:"*",dimensions:a};default:return{...cp.placeCropMask(i.ratio,t),ratio:i.ratio,dimensions:a}}}else{const{x:l,y:u}=i.dimensions;return{...cp.placeCropMask(l/u,t),ratio:null,dimensions:a}}}return null}setCropDefaults(e=false){const t=this.editor.outputContainer.getResolution();this.setDefaultImageSize(t);const i=this.editor.getPreviewSize();const{position:o}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(i);this.setDefaultCropPosition({x:o.x-i.width/2,y:o.y-i.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!e){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(e){this.defaults.imageSize={...ve(e)};if(!this.lockResolution){this.localOutputSize={...ve(e)}}}setMaxCropSize(e){this.defaults.maxCropMaskSize.height=e.height;this.defaults.maxCropMaskSize.width=e.width}setDefaultCropPosition(e){this.defaults.cropMaskPosition.x=e.x;this.defaults.cropMaskPosition.y=e.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(e){this.selectedCategory=this.selectedCategory===e?Ppe:e}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=JSON.stringify(this.engineMediator.preview.container.getTransform());const t=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:e,output:t})}changePosition(e){return this.transformStore.changePosition(e,this.defaults.maxCropMaskSize)}changePositionX(e){return this.transformStore.changePositionX(e,this.defaults.maxCropMaskSize.width)}changePositionY(e){return this.transformStore.changePositionY(e,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:e,height:t},i,o=true){this.transformStore.changeWidth(e);this.transformStore.changeHeight(t);if(!this.lockResolution){const{height:n,width:s}=this.defaults.maxCropMaskSize;const{height:a,width:l}=this.defaults.imageSize;let u=a/n*t;const c=l/s*e;if(i){u=c/i}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(c),height:Math.round(u)})}if(t>=this.minCropSize){this.changeLocalOutputHeight(u)}if(e>=this.minCropSize){this.changeLocalOutputWidth(c)}}}transformRender(e=true){this.transformations.applyPreviewTransform();if(e){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:e,flipVertically:t}=this.rotateFlipState;const{identifier:i,rotationInDegrees:o}=this;const n=qc(o);const s=dR(j0(this.editor.engineMediator.output.container.getRotation())+o);const{start:a,end:l}=this.convertUIToOperationOptions(n,s);return{flipHorizontally:e,flipVertically:t,rotation:n,start:a,end:l,identifier:i,outputRotation:s}}getStartEndForOperation(e){const{leftTop:t,rightBottom:i,maxCropMaskSize:o}=this;const n=t.y;const s=t.x;const a=i.x;const l=i.y;switch(e){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}getStartEndForUI(e,t,i){const{maxCropMaskSize:o}=this;const n=t.y;const s=t.x;const a=i.x;const l=i.y;switch(e){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}convertOperationOptionsToUI({start:e,end:t,rotation:i,outputRotation:o}){const n=o===90||o===270;const s=n?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const a=Math.cos(i);const l=Math.sin(i);const u=this.calculateScale(i);const c=new F(Math.min(e.x,t.x),Math.min(e.y,t.y));const d=new F(Math.max(e.x,t.x),Math.max(e.y,t.y));const m=d.subtract(c).divide(2);const h=c.add(m).multiply(s);const f=h.subtract(s.multiply(.5));const b=new F(f.x*a-f.y*l,f.x*l+f.y*a).multiply(u);const _=s.multiply(.5).add(b);const y=_.divide(s);const I=y.subtract(m.multiply(u));const T=y.add(m.multiply(u));const D=n?F.fromSize(this.maxCropMaskSize).swapped:F.fromSize(this.maxCropMaskSize);const P=I.multiply(D);const k=T.multiply(D);const{leftTop:A,rightBottom:Q}=this.getStartEndForUI(o,P,k);return{start:new F(A),end:new F(Q)}}convertUIToOperationOptions(e,t){const i=t===90||t===270;const o=i?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const n=i?F.fromSize(this.maxCropMaskSize).swapped:F.fromSize(this.maxCropMaskSize);const s=Math.cos(-e);const a=Math.sin(-e);const l=this.calculateScale(e,i);const{leftTop:u,rightBottom:c}=this.getStartEndForOperation(t);const d=new F(u).divide(n);const m=new F(c).divide(n);const h=m.subtract(d).divide(2);const f=d.add(h).multiply(o);const b=f.subtract(o.multiply(.5));const _=new F(b.x*s-b.y*a,b.x*a+b.y*s).divide(l);const y=o.multiply(.5).add(_);const I=y.divide(o);const T=I.subtract(h.divide(l));const D=I.add(h.divide(l));return{start:T,end:D}}calculateScale(e,t=false){const i=t?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const o=new F(Math.abs(i.x*Math.cos(e))+Math.abs(i.y*Math.sin(e)),Math.abs(i.x*Math.sin(e))+Math.abs(i.y*Math.cos(e)));const n=i.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/i.y+1:n.x*2/i.x+1}updateStateFromSerialization(e){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=Math.round(j0(e.rotation));this.transformStore.setRotation(t>180?t-360:t);this.transformations.rotateOutputContainer(qc(dR(e.outputRotation||0)));if(e.identifier){this.transformStore.changeIdentifier(e.identifier)}if(e.start&&e.end){if(e.end.x===0||e.end.y===0){e.end.x=1;e.end.y=1}const{start:i,end:o}=this.convertOperationOptionsToUI({start:new F(e.start),end:new F(e.end),rotation:e.rotation,outputRotation:e.outputRotation});this.changePositionX(i.x);this.changePositionY(i.y);const n=o.x-i.x;const s=o.y-i.y;this.transformStore.changeSize({width:n,height:s});const{maxCropMaskSize:a,imageSize:l}=this.defaults;const u={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(u)}if(e.flipHorizontally){this.flipHorizontally(false)}if(e.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(e){this.defaultAngle=e}updateCanvasControls(e){const t=ve(this.cropMaskPosition);const i=ve(this.cropMaskSize);const o=ve(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*i.height/e.height,width:o.width*i.width/e.width},void 0,false);this.changePosition({y:o.height*t.y/e.height,x:o.width*t.x/e.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(e){this.transformStore.setRotation(e);this.transformRender()}async rotateOutputContainer(e,t=true){this.setDragMode(true);this.transformations.rotateOutputContainer(e,t);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,false)}clickableCanvas(e){this.editor.clickableCanvas(e)}proportionalSize(e,t,i=this.defaults.maxCropMaskSize,o=this.minCropSize){let n=t.height*e;let{height:s}=t;if(n>i.width||n1){return{width:this.minCropSize*e,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*e}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const e=this.getTransform(this.identifier);if(e){if(Object.prototype.hasOwnProperty.call(e,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return e.ratio}const{x:t,y:i}=e.dimensions;return t/i}return"*"}};le=cp;g([ae],le.prototype,"selectedCategory",2);g([ae],le.prototype,"defaults",2);g([ae],le.prototype,"localOutputSize",2);g([S],le.prototype,"changeIdentifier",1);g([S],le.prototype,"setDragMode",1);g([S],le.prototype,"setCropDefaults",1);g([S],le.prototype,"setDefaultImageSize",1);g([S],le.prototype,"setMaxCropSize",1);g([S],le.prototype,"setDefaultCropPosition",1);g([S],le.prototype,"resetCrop",1);g([S],le.prototype,"toggleCategorySelection",1);g([S],le.prototype,"pureReset",1);g([S],le.prototype,"reset",2);g([S],le.prototype,"changePosition",1);g([S],le.prototype,"changePositionX",1);g([S],le.prototype,"changePositionY",1);g([S],le.prototype,"changeCropAndOutputSize",1);g([S],le.prototype,"onLeave",1);g([S],le.prototype,"onEnter",1);g([S],le.prototype,"changeLocalOutputSize",2);g([S],le.prototype,"changeDefaultScale",2);g([S],le.prototype,"changeLocalOutputHeight",2);g([S],le.prototype,"changeLocalOutputWidth",2);g([S],le.prototype,"changeLockResolution",2);g([S],le.prototype,"setRotation",1);g([S],le.prototype,"rotateClockwise",2);g([S],le.prototype,"rotateAntiClockwise",2);g([S],le.prototype,"rotateOutputContainer",1);g([S],le.prototype,"flipHorizontally",2);g([S],le.prototype,"flipVertically",2);g([S],le.prototype,"applyDefaultCrop",2);g([S],le.prototype,"applyInitialCrop",1);g([S],le.prototype,"updateCropMask",2);g([S],le.prototype,"clickableCanvas",1);g([S],le.prototype,"onLeftTop",2);g([S],le.prototype,"onLeftBottom",2);g([S],le.prototype,"onRightTop",2);g([S],le.prototype,"onRightBottom",2);g([S],le.prototype,"proportionalSize",1);g([S],le.prototype,"onPixelWidth",2);g([S],le.prototype,"onPixelHeight",2);g([S],le.prototype,"updateInitialCropMaskPosition",1);g([S],le.prototype,"updatePreviewSizeWRTImageSize",1);g([S],le.prototype,"dispose",2);g([w],le.prototype,"cropState",1);g([w],le.prototype,"identifier",1);g([w],le.prototype,"ratio",1);g([w],le.prototype,"height",1);g([w],le.prototype,"width",1);g([w],le.prototype,"localOutputImageSize",1);g([w],le.prototype,"localOutputHeight",1);g([w],le.prototype,"localOutputWidth",1);g([w],le.prototype,"lockResolution",1);g([w],le.prototype,"forceDimensions",1);g([w],le.prototype,"rotationInDegrees",1);g([w],le.prototype,"outputRotation",1);g([w],le.prototype,"isDragMode",1);g([w],le.prototype,"rotateFlipState",1);g([w],le.prototype,"selectedCategoryIdentifier",1);g([w],le.prototype,"categories",1);g([w],le.prototype,"items",1);g([w],le.prototype,"config",1);g([w],le.prototype,"locale",1);g([w],le.prototype,"isOptionSelected",1);g([w],le.prototype,"leftTop",1);g([w],le.prototype,"leftBottom",1);g([w],le.prototype,"rightTop",1);g([w],le.prototype,"rightBottom",1);g([w],le.prototype,"isFlippedHorizontal",1);g([w],le.prototype,"isFlippedVertical",1);g([w],le.prototype,"leftTopRespectFlip",1);g([w],le.prototype,"leftBottomRespectFlip",1);g([w],le.prototype,"rightTopRespectFlip",1);g([w],le.prototype,"rightBottomRespectFlip",1);g([w],le.prototype,"cropMaskPosition",1);g([w],le.prototype,"cropMaskSize",1);g([w],le.prototype,"state",1);g([w],le.prototype,"defaultImageSize",1);g([w],le.prototype,"maxCropMaskSize",1);g([w],le.prototype,"minCropMaskSize",1);g([w],le.prototype,"defaultCropMaskPosition",1);g([w],le.prototype,"defaultScale",1)});var Bpe=p(()=>{DM();e5()});var Mpe,EKe,t5,kKe,qb,fe;var r5=p(()=>{ze();Mpe=v(Pm());B();W();Ii();YM();Jh();gM();bM();xM();TM();EKe={};t5="none";kKe={position:{x:0,y:0},rotation:0};qb=class{constructor(e){this.state=ae.map(EKe);this.selectedId=ae.box(t5);this.editMode=ae.box(false);this.dragMode=ae.box(false);this.minLength=0;this.counter=0;this.addSticker=async(e,t=true)=>{await this.addStickerAsync(e,t)};this.addStickerAsync=async({spriteId:e,state:t,transform:i},o=true)=>{return new Promise((n,s)=>{i=this.getInitialTransform(i);const{identifier:a}=t;const l=this.editor.orderHelper.addSprite(a);this.editor.engine.addStickerFromAssets(a,this.editor.engineMediator.image.container,l).then(async u=>{if(e){u.setData({id:e})}const c=u.getID();this.container[c]=u;this.editor.orderHelper.renameSprite(a,c);const d=this.getSize(c);d.width*=u.getScale().x;d.height*=u.getScale().y;u.setPivot(.5,.5);let m;if(i.scale){m=i.scale}else if(i.size){m={x:i.size.width/d.width,y:i.size.height/d.height}}else{const _=this.editor.shortestOutputSide*.4;const y=qb.magnitude(_)/qb.sizeMagnitude(u.getSizeInWorldSpace());m={x:y,y}}const{flipHorizontally:h,flipVertically:f}=this.editor.outputContainer.getData();u.setFlipHorizontally(h);u.setFlipVertically(f);u.setTransform({position:i.position,scale:m,rotation:i.rotation});if(t.flipHorizontally!==void 0){u.setFlipHorizontally(t.flipHorizontally!==h)}if(t.flipVertically!==void 0){u.setFlipVertically(t.flipVertically!==f)}this.setContainerProperties(c,{...t});const b=u.getData();this.setInitialSpriteState(c,"sticker");this.stickerToolStore.setState(c,{...b,identifier:a});await this.editor.renderPromise();if(o){this.setId(c);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(u=>{console.error(u);s()})})};this.addText=async(e,t=true)=>{await this.addTextAsync(e,t)};this.addTextAsync=({spriteId:e,state:t,transform:i},o=true)=>{return new Promise((n,s)=>{i=this.getInitialTransform(i);const a=this.editor.orderHelper.addSprite(t.identifier);const l=this.editor.shortestOutputSide;const u={fontIdentifier:t.identifier,text:t.text,width:t.width||l*.6,fontSize:t.fontSize||l*.1,lineHeight:t.lineHeight,alignment:t.alignment,textColor:t.textColor,backgroundColor:t.backgroundColor};this.editor.engine.addTextWithFontLoading(u,this.editor.engineMediator.image.container,a).then(async c=>{if(e){c.setData({id:e})}const d=c.getID();this.container[d]=c;this.editor.orderHelper.renameSprite(t.identifier,d);const{flipHorizontally:m,flipVertically:h}=this.editor.outputContainer.getData();c.setFlipHorizontally(m);c.setFlipVertically(h);c.setPivot(.5,.5);c.setPosition(i.position);c.setRotation(i.rotation);this.setInitialSpriteState(d,"text");const f=c.getData();this.textToolStore.setState(d,{...f});await this.editor.renderPromise();if(o){this.setId(d);this.addSnapshot("add",this.textLocale.add)}n()}).catch(c=>{console.error(c);s()})})};this.addTextDesign=async(e,t=true,i=false)=>{try{await this.addTextDesignAsync(e,t,i)}catch(o){console.warn(o)}};this.addTextDesignAsync=({spriteId:e,state:t,transform:i},o=true,n=false)=>{return new Promise((s,a)=>{i=this.getInitialTransform(i);const l=this.editor.orderHelper.addSprite(t.identifier);const u=this.editor.shortestOutputSide;const c={width:t.width||u*.6,text:t.text,color:t.color,inverted:t.isInverted,seed:t.seed,padding:t.padding};this.editor.engine.addTextDesignAsync(t.identifier,c,this.editor.engineMediator.image.container,l).then(async d=>{if(e){if(n){this.pureRemoveSprite(e);this.textDesignToolStore.state.delete(e)}d.setData({id:e})}const m=d.getID();this.container[m]=d;this.editor.orderHelper.renameSprite(t.identifier,m);const{flipHorizontally:h,flipVertically:f}=this.editor.outputContainer.getData();d.setFlipHorizontally(h);d.setFlipVertically(f);d.setPivot(.5,.5);d.setPosition(i.position);d.setRotation(i.rotation);this.setInitialSpriteState(m,"textdesign");const b=d.getData();this.textDesignToolStore.setState(m,{...b,identifier:t.identifier});await this.editor.renderPromise();if(o){this.setId(m);this.addSnapshot("add",this.textDesignLocale.add)}s()}).catch(d=>{a(d)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=e=>{this.editor.clickableCanvas(e)};this.setContainerProperties=(e,t,i=false)=>{this.container[e].setData(t);if(i){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(e,t)=>{this.container[e].setPosition(t)};this.pureRemoveSprite=e=>{this.editor.engine.removeContainer(this.container[e]);const t=this.container[e].getIndexInParent();if(t===-1){delete this.container[e];this.state.delete(e);this.editor.orderHelper.removeSprite(e);return true}return false};this.deleteSprite=(e=this.id)=>{const t=this.state.get(e);if(t.tool==="sticker"){this.stickerToolStore.delete()}else if(t.tool==="text"){this.textToolStore.delete()}else if(t.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=e=>{const t=this.pureRemoveSprite(e);if(t){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(e,t)=>{this.editor.addSnapshot(void 0,e,t)};this.spriteSnapshot=e=>{this.addSnapshot("edit",this.historyLocale[e])};this.addNewText=async(e,t)=>{if(this.textToolStore.doesTextAssetExist(t.identifier)){await this.addTextAsync({...e,state:t},false)}else{throw new En(t.identifier)}};this.addNewTextDesign=async(e,t)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(t.identifier)){await this.addTextDesignAsync({...e,state:t},false)}else{throw new En(t.identifier)}};this.addNewSticker=async(e,t)=>{if(this.stickerToolStore.doesStickerAssetExist(t.identifier)){await this.addStickerAsync({...e,state:t},false)}else{throw new En(t.identifier)}};this.getSpriteHistoryState=()=>{const e=ve(this.textToolStore.state);const t=ve(this.textDesignToolStore.state);const i={common:ve(this.state),["sticker"]:ve(this.stickerToolStore.state),["text"]:e,["textdesign"]:t,spriteIdList:Object.keys(this.container)};Object.keys(i.common).forEach(o=>{i.common[o].size=this.container[o].getSizeInWorldSpace();i.common[o].position=this.container[o].getPosition();i.common[o].order=this.container[o].getIndexInParent()});return i};this.updateStateFromSerialization=async(e,t,i)=>{if(t&&t.length){try{const o=await Promise.all(t.map(async({svg:n,raster:s,name:a,identifier:l})=>{const u=(n==null?void 0:n.data)?"image/svg+xml":s.type;const c=`data:${u};base64,${(n==null?void 0:n.data)||s.data}`;const d=await Aw(c,150);return{stickerURI:c,thumbnailURI:d,name:a,type:u,identifier:l}}));await this.stickerToolStore.addCustomStickerAsset(o)}catch(o){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(e.text){await this.textToolStore.loadFonts()}if(e.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(e.spriteIdList,e,i)};this.updateStateFromHistory=async e=>{const t=Object.keys(this.container);const i=t.filter(o=>e.spriteIdList.indexOf(o)===-1);i.forEach(o=>{this.pureRemoveSprite(o)});await this.updateStateByHistoryState(e.spriteIdList,e,0)};this.serializableState=async()=>{const e=this.editor.spriteStore.getSpriteHistoryState();Object.keys(e.common).forEach(i=>{const{flipHorizontally:o,flipVertically:n}=this.editor.outputContainer.getData();const s=this.editor.outputContainer.getRotation();const a=n!==o?-e.common[i].rotation:e.common[i].rotation;e.common[i].rotation=n!==o?a+s:a-s});const t=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:i,type:o,stickerURI:n,name:s})=>{const a={identifier:i,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]}}if(o==="image/jpeg"||o==="image/png"||o==="image/gif"){[,a.raster.data]=n.split(",");a.raster.type=o}else{const l=await Aw(n);[,a.raster.data]=l.split(",");a.raster.type="image/png"}return a}));return{sprite:e,customStickers:t}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(e=>{this.updatePositionAndSize(e,true);const t=this.state.get(e);if(t){if(t.tool==="text"){const i=this.getContainerProperties(e);this.textToolStore.changeSize(e,i)}else if(t.tool==="textdesign"){const i=this.getContainerProperties(e);this.textToolStore.changeWidth(i.width)}}})};this.setEditMode=e=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(e){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(e)}}};this.setDragMode=e=>{this.dragMode.set(e)};this.setPosition=e=>{const t=this.currentSprite;const i=this.container[this.id];if(t&&i){i.setPosition(this.editor.previewToWorld(e));const{position:o}=this.getSizePositionFromContainer();t.position.x=o.x;t.position.y=o.y;this.state.set(this.id,t);this.editor.render()}};this.setSize=e=>{const t=this.currentSprite;if(t){t.size.width=e.width;t.size.height=e.height;this.state.set(this.id,t)}};this.setRotation=e=>{const t=this.currentSprite;if(t){const{flipHorizontally:i,flipVertically:o}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const s=Ab({rotation:e,outputRotation:n,flipHorizontally:i,flipVertically:o});this.container[this.id].setRotation(s);t.rotation=this.container[this.id].getRotation();this.state.set(this.id,t);this.editor.render()}};this.onCanvasClick=e=>{if(!this.isEditMode){this.selectHighestOrderSprite(e)}};this.select=e=>{const t=this.state.get(e);if(t){const i=this.editor.activeStore.tool;if(i!==t.tool){this.editor.activeStore.selectTool(t.tool)}this.setId(e)}};this.selectLast=()=>{const e=this.editor.orderHelper.getLastSpriteId();if(e){this.select(e)}};this.selectNext=()=>{if(this.currentSprite){const e=this.container[this.id];const t=e.getIndexInParent();if(t){const i=Object.keys(this.container).find(o=>this.container[o].getIndexInParent()===t-1);if(i){this.select(i)}}}};this.deselect=()=>{this.setId(t5)};this.bringToFront=async e=>{const t=this.editor.orderHelper.bringToFront(e);this.container[e].setIndexInParent(t);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=e=>{const t=this.state.get(e);const i=this.container[e];i.setFlipHorizontally(!i.getFlipHorizontally());t.flipHorizontally=i.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(e,t);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(e=>{this.pureRemoveSprite(e)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=e=>{const t=this.editor.brushToolStore.containerId();e=e.filter(n=>n!==t);if(e.length<1){this.deselect();return}let i="";let o=0;e.forEach(n=>{const s=this.container[n];const a=s&&s.getIndexInParent()||0;if(a>=o){o=a;i=n}});this.select(i)};this.onCornerDrag=({x:e,y:t})=>{if(this.currentSprite){const i=new F(this.currentSprite.position);const o=new F(e,t);const n=o.subtract(i).magnitude;const s=this.getSize();const a=n*2/qb.sizeMagnitude(s);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:s.width*a,height:s.height*a})}else{const l=this.rotationWRTOutputRotation;const u=o.subtract(i);const c=Math.cos(l);const d=Math.sin(l);const m=Math.max(Math.abs(u.x*c*2+u.y*d*2),this.minLength);const h=Math.max(Math.abs(u.x*-d*2+u.y*c*2),this.minLength);this.setStickerSize({width:m,height:h})}}else if(this.isSpriteText){this.setTextSize(s.width*a)}else if(this.isSpriteTextDesign){this.setTextDesignScale(a)}}this.editor.render()}};this.onWidthDrag=({x:e,y:t})=>{const i=new F(this.currentSprite.position);const o=new F(e,t);const n=o.subtract(i).magnitude;const s=this.editor.previewToWorld(2*n);if(s>this.minLength){this.setContainerProperties(this.id,{width:s},true);if(this.isSpriteText){const a=this.getContainerProperties(this.id);this.textToolStore.changeWidth(a.width)}}};this.onPaddingDrag=({x:e,y:t})=>{if(this.isSpriteTextDesign){let i=this.getContainerProperties(this.id);const o=new F(this.currentSprite.position);const n=new F(e,t);const s=n.subtract(o).magnitude;const a=Math.max(this.editor.previewToWorld(s)-i.width/2,0);this.setContainerProperties(this.id,{padding:a},true);if(this.isSpriteTextDesign){i=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(i.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:e,flipVertically:t}=this.editor.outputContainer.getData();Object.values(this.container).forEach(i=>{if(i.type==="text"||i.type==="text-design"){i.setFlipHorizontally(e);i.setFlipVertically(t)}})};this.reverseTextHorizontally=e=>{Object.values(this.container).forEach(t=>{if(t.type==="text"||t.type==="text-design"){t.setFlipHorizontally(e)}})};this.reverseTextVertically=e=>{Object.values(this.container).forEach(t=>{if(t.type==="text"||t.type==="text-design"){t.setFlipVertically(e)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=e=>{return this.container[e].getData()};this.getContainerTransform=e=>{return this.container[e].getTransform()};this.getDuplicateContainerTransform=e=>{const t=this.container[e].getTransform();const i=this.editor.shortestOutputSide*.1;const o=new F(t.position).add(new F(i,i));return{...t,position:o}};this.getDuplicateContainerFlip=e=>{const t=this.container[e].getFlipHorizontally();const i=this.container[e].getFlipVertically();return{flipHorizontally:t,flipVertically:i}};this.updatePositionAndSize=(e=this.id,t=false)=>{const{position:i,size:o}=this.getSizePositionFromContainer(e);const n=this.state.get(e);if(n){n.position.x=i.x;n.position.y=i.y;n.size.width=o.width;n.size.height=o.height;if(t){const s=this.container[e].getRotation();this.container[e].setRotation(s);n.rotation=this.container[e].getRotation()}this.state.set(e,n)}};this.getInitialTransform=e=>{const t=this.editor.outputToWorld(kKe.position);if(!e){const i=this.editor.outputContainer.getRotation();return{rotation:i,position:t}}return{position:t,...e}};this.setInitialSpriteState=(e,t)=>{const i=this.container[e];const{position:o,size:n}=this.getSizePositionFromContainer(e);const s=i.getRotation();const a=t!=="sticker"?false:i.getFlipHorizontally();const l=t!=="sticker"?false:i.getFlipVertically();this.state.set(e,{tool:t,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l})};this.setStickerSize=e=>{const t=this.container[this.id];t.setSizeInWorldSpace(this.editor.previewSizeToWorld(e));const i=this.currentSprite;if(i){i.size=this.editor.worldSizeToPreview(t.getSizeInWorldSpace());this.state.set(this.id,i)}};this.setTextSize=e=>{let t=this.getContainerProperties(this.id);const i={width:this.editor.previewToWorld(e)};const o=i.width/t.width;const n={fontSize:Math.round(t.fontSize*o)};const s=this.isSpriteText?{...i,...n}:i;if(i.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,s,true);t=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(t.fontSize,true);this.textToolStore.changeWidth(t.width)}};this.setTextDesignScale=e=>{let t=this.getContainerProperties(this.id);const i=t.width*e;if(i>this.minLength){this.setContainerProperties(this.id,{width:i},true);const{width:o}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(o);t=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(t.padding)}};this.getSizePositionFromContainer=(e=this.id)=>{const t=this.container[e];if(t){const i=this.editor.worldToPreview(t.getPosition());const o=this.editor.worldSizeToPreview(t.getSizeInWorldSpace());return{position:i,size:o}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(e=this.id)=>{const t=this.container[e];if(t){return this.editor.worldSizeToPreview(t.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=e;this.container={};this.stickerToolStore=new je(e);this.textToolStore=new Ee(e);this.textDesignToolStore=new $e(e);this.rect=new rr(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(e,t){return new F(e,t||e).magnitude}static sizeMagnitude(e){return Math.sqrt(e.width*e.width+e.height*e.height)}async updateStateByHistoryState(e,t,i){await(0,Mpe.default)(e,async o=>{const n=t.common[o];if(!n)return;if(this.state.get(o)){this.updateExistingItem(o,t)}else{await this.addNewItem(o,t)}});e.forEach(o=>{const n=t.common[o];const s=this.container[o];if(!n||!s)return;s.setIndexInParent(n.order+i)});this.counter+=1}async addNewItem(e,t){const i=t.common[e];const o=i.size?{width:this.editor.worldToPreview(i.size.width),height:this.editor.worldToPreview(i.size.height)}:void 0;const{flipHorizontally:n,flipVertically:s}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=s!==n?i.rotation-a:i.rotation+a;const u=s!==n?-l:l;const c={spriteId:e,transform:{size:o,position:new F(i.position),rotation:u}};if(t.text[e]){const d=t.text[e];const m=this.textToolStore.validFontWithConfig(d.identifier);d.identifier=m==null?void 0:m.identifier;await this.addNewText(c,d);return}if(t.textdesign[e]){await this.addNewTextDesign(c,t.textdesign[e]);return}if(t.sticker[e]){const d=this.stickerToolStore.items.find(m=>m.identifier===t.sticker[e].identifier);await this.addNewSticker(c,{...t.sticker[e],flipHorizontally:i.flipHorizontally,flipVertically:i.flipVertically,resizeMode:t.sticker[e].resizeMode||(d==null?void 0:d.resizeMode)||"keepAspect"})}}updateExistingItem(e,t){const i=t.common[e];const o=this.state.get(e);this.state.set(e,o);const n=this.container[e];n.setPosition(new F(i.position));n.setRotation(i.rotation);o.rotation=n.getRotation();if(i.flipHorizontally!==void 0){n.setFlipHorizontally(i.flipHorizontally)}if(i.flipVertically!==void 0){n.setFlipVertically(i.flipVertically)}if(t.text[e]){const s=t.text[e];this.textToolStore.updateStateFromHistory(e,{...s,fontIdentifier:s.identifier})}if(t.textdesign[e]){const s=t.textdesign[e];this.textDesignToolStore.updateStateFromHistory(e,{...s,inverted:s.isInverted})}if(t.sticker[e]){n.setSizeInWorldSpace(i.size);this.stickerToolStore.updateStateFromHistory(e,t.sticker[e])}this.updatePositionAndSize(e)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==t5}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:e,flipVertically:t}=this.editor.outputContainer.getData();const i=this.editor.outputContainer.getRotation();return Ab({rotation:this.currentSprite.rotation-i,flipHorizontally:e,flipVertically:t})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const e=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:e,y:t}=this.currentSprite.position;const{height:i,width:o}=this.currentSprite.size;return{x:Math.round(e-o/2),y:Math.round(t-i/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:e}=this.rect;return{x:e.x-this.editor.worldToPreview(this.padding),y:e.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:e}=this.rect;return{x:e.x+this.editor.worldToPreview(this.padding),y:e.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(e){this.selectedId.set(e)}};fe=qb;g([ae],fe.prototype,"counter",2);g([S],fe.prototype,"addSticker",2);g([S],fe.prototype,"addStickerAsync",2);g([S],fe.prototype,"addText",2);g([S],fe.prototype,"addTextAsync",2);g([S],fe.prototype,"addTextDesign",2);g([S],fe.prototype,"addTextDesignAsync",2);g([S],fe.prototype,"clickableCanvas",2);g([S],fe.prototype,"setContainerProperties",2);g([S],fe.prototype,"setContainerPosition",2);g([S],fe.prototype,"pureRemoveSprite",2);g([S],fe.prototype,"deleteSprite",2);g([S],fe.prototype,"removeSprite",2);g([S],fe.prototype,"addSnapshot",2);g([S],fe.prototype,"addNewText",2);g([S],fe.prototype,"addNewTextDesign",2);g([S],fe.prototype,"addNewSticker",2);g([S],fe.prototype,"updateStateFromSerialization",2);g([S],fe.prototype,"updateStateFromHistory",2);g([S],fe.prototype,"updateCanvasControls",2);g([S],fe.prototype,"setEditMode",2);g([S],fe.prototype,"setDragMode",2);g([S],fe.prototype,"setPosition",2);g([S],fe.prototype,"setSize",2);g([S],fe.prototype,"setRotation",2);g([S],fe.prototype,"onCanvasClick",2);g([S],fe.prototype,"select",2);g([S],fe.prototype,"selectLast",2);g([S],fe.prototype,"selectNext",2);g([S],fe.prototype,"deselect",2);g([S],fe.prototype,"bringToFront",2);g([S],fe.prototype,"flipHorizontally",2);g([S],fe.prototype,"pureReset",2);g([S],fe.prototype,"onCornerDrag",2);g([S],fe.prototype,"onWidthDrag",2);g([S],fe.prototype,"onPaddingDrag",2);g([S],fe.prototype,"correctTextFlip",2);g([S],fe.prototype,"reverseTextHorizontally",2);g([S],fe.prototype,"reverseTextVertically",2);g([S],fe.prototype,"dispose",2);g([w],fe.prototype,"currentSprite",1);g([w],fe.prototype,"padding",1);g([w],fe.prototype,"isEditMode",1);g([w],fe.prototype,"isDragMode",1);g([w],fe.prototype,"id",1);g([w],fe.prototype,"isSpriteSelected",1);g([w],fe.prototype,"position",1);g([w],fe.prototype,"tool",1);g([w],fe.prototype,"size",1);g([w],fe.prototype,"rotation",1);g([w],fe.prototype,"rotationWRTOutputRotation",1);g([w],fe.prototype,"flipHorizontal",1);g([w],fe.prototype,"isSpriteSticker",1);g([w],fe.prototype,"isSpriteText",1);g([w],fe.prototype,"isSpriteTextDesign",1);g([w],fe.prototype,"isOnTop",1);g([w],fe.prototype,"spritePosition",1);g([w],fe.prototype,"currentRect",1);g([w],fe.prototype,"leftTopPosition",1);g([w],fe.prototype,"leftBottomPosition",1);g([w],fe.prototype,"leftMidPosition",1);g([w],fe.prototype,"leftMidPadPosition",1);g([w],fe.prototype,"rightTopPosition",1);g([w],fe.prototype,"rightBottomPosition",1);g([w],fe.prototype,"rightMidPosition",1);g([w],fe.prototype,"rightMidPadPosition",1);g([w],fe.prototype,"leftBottomHandlePosition",1);g([w],fe.prototype,"rightBottomHandlePosition",1);g([w],fe.prototype,"historyLocale",1);g([w],fe.prototype,"stickerLocale",1);g([w],fe.prototype,"textLocale",1);g([w],fe.prototype,"textDesignLocale",1)});var Lpe=p(()=>{r5()});var DKe,Yi;var i5=p(()=>{ze();B();DKe={categories:[],query:""};Yi=class{constructor(e){this.initProvider=e=>{if(e){this.libraryProvider=new e}};this.fetchImages=async(e="")=>{if(this.libraryProvider){let t=null;try{const i=await this.libraryProvider.getCategories();const o=await this.libraryProvider.searchImages(e);t=i.map((n,s)=>{const a=o.filter(l=>l.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(l=>({name:l.title||`image${s}`,identifier:`${n.name}-${l.title}-${s}`,thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar}))}}).filter(n=>n.items.length)}catch(i){console.log(i)}lr(()=>{this.state.query=e;this.state.categories=t})}};this.toggleCategorySelection=e=>{this.selectedCategory=this.selectedCategory!==e?e:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=e=>{const t=this.items.findIndex(i=>i.identifier===e);if(t!==-1){return this.items[t].rawUrl}return e};this.configStore=e.configStore;this.state=ae(DKe);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(e=>e.items).reduce((e,t)=>[...e,...t],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};g([ae],Yi.prototype,"selectedCategory",2);g([S],Yi.prototype,"initProvider",2);g([S],Yi.prototype,"fetchImages",2);g([S],Yi.prototype,"toggleCategorySelection",2);g([S],Yi.prototype,"dispose",2);g([w],Yi.prototype,"selectedCategoryIdentifier",1);g([w],Yi.prototype,"categories",1);g([w],Yi.prototype,"items",1);g([w],Yi.prototype,"query",1);g([w],Yi.prototype,"config",1);g([w],Yi.prototype,"locale",1)});var zpe=p(()=>{i5()});var Upe,oi;var Npe=p(()=>{B();Ks();W();Upe=(r="image/png")=>`data:${r};base64,`;oi=class{constructor(e){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const t=ye.relativeToAbsolutePoint(e,this.cropSpace,false);return ye.pointFromSpaceToSpace(t,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,t=>t.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:oi.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const t={};if(e.image){t.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(Upe(),""):""};t.image.data=t.image.data?Upe()+t.image.data:""}return t}deserializeTransformation(e){const t={};const i=e.operations.find(s=>s.type==="orientation");const o=e.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;t.transform=oi.initializeEmptyTransform();if(i!=null){t.transform.outputRotation=i.options.rotation;t.transform.flipHorizontally=i.options.flipHorizontally||false;t.transform.flipVertically=i.options.flipVertically||false}if(o){t.transform.start=o.options.start;t.transform.end=o.options.end;t.transform.rotation=o.options.rotation||0;t.transform.identifier=o.options.meta?o.options.meta.identifier:""}return t}deserialize(e){var n,s;const t={};if(e.meta?!oi.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const i=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=i;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(a=>{switch(a.type){case"filter":t.filter=oi.deserializeFilter(a.options);break;case"adjustments":t.adjustment=oi.deserializeAdjustments(a.options);break;case"focus":t.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(u=>{switch(u.type){case"frame":t.frame=this.deserializeFrame(u.options);break;case"overlay":t.overlay=oi.deserializeOverlay(u.options);break;case"brush":if(!t.brush){t.brush=this.deserializeBrush(u.options)}else{t.brush.strokes.push(...this.deserializeBrush(u.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!t.sprite){t.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const c=Ge();t.sprite.spriteIdList.push(c);t.sprite.common[c]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(u.options.position),tool:"sticker",rotation:u.options.rotation||0,flipHorizontally:u.options.flipHorizontally,flipVertically:u.options.flipVertically};this.spriteOrder+=1;if(u.type==="sticker"){t.sprite.common[c].tool="sticker";t.sprite.common[c].size={width:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.y)};t.sprite.sticker[c]=oi.deserializeStickers(u.options)}else if(u.type==="text"){t.sprite.common[c].tool="text";t.sprite.text[c]=this.deserializeTexts(u.options)}else if(u.type==="textdesign"){t.sprite.common[c].tool="textdesign";t.sprite.textdesign[c]=this.deserializeTextDesign(u.options)}break;default:break}});break;default:break}});if(e.assetLibrary){t.customStickers=((s=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return t}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:oi.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:break}return void 0}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new F(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const t=new F(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new F(this.mapRelativeCropPointToImageSpace(e.start)).add(new F(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(t.y,t.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:ws(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:oi.deserialzeColor(e.color),backgroundColor:oi.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:oi.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(t=>{return{path:{controlPoints:t.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:oi.deserialzeColor(t.brush.color),size:t.brush.size,hardness:t.brush.hardness}}})}}}});var qpe,ni;var Hpe=p(()=>{B();Ks();W();qpe=(r="image/png")=>`data:${r};base64,`;ni=class{constructor(e){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const t=ye.relativeToAbsolutePoint(e,this.cropSpace,false);return ye.pointFromSpaceToSpace(t,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,t=>t.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:ni.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const t={};if(e.image){t.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(qpe(),""):""};t.image.data=t.image.data?qpe()+t.image.data:""}return t}deserializeTransformation(e){const t={};const i=e.operations.find(s=>s.type==="orientation");const o=e.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;t.transform=ni.initializeEmptyTransform();if(i!=null){t.transform.outputRotation=i.options.rotation;t.transform.flipHorizontally=i.options.flipHorizontally||false;t.transform.flipVertically=i.options.flipVertically||false}if(o){t.transform.start=o.options.start;t.transform.end=o.options.end;t.transform.rotation=o.options.rotation||0;t.transform.identifier=o.options.meta?o.options.meta.identifier:""}return t}deserialize(e){var n,s;const t={};if(e.meta?!ni.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const i=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=i;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(a=>{switch(a.type){case"filter":t.filter=ni.deserializeFilter(a.options);break;case"adjustments":t.adjustment=ni.deserializeAdjustments(a.options);break;case"focus":t.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(u=>{switch(u.type){case"frame":t.frame=this.deserializeFrame(u.options);break;case"overlay":t.overlay=ni.deserializeOverlay(u.options);break;case"brush":if(!t.brush){t.brush=this.deserializeBrush(u.options)}else{t.brush.strokes.push(...this.deserializeBrush(u.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!t.sprite){t.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const c=Ge();t.sprite.spriteIdList.push(c);t.sprite.common[c]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(u.options.position),tool:"sticker",rotation:u.options.rotation||0,flipHorizontally:u.options.flipHorizontally,flipVertically:u.options.flipVertically};this.spriteOrder+=1;if(u.type==="sticker"){t.sprite.common[c].tool="sticker";t.sprite.common[c].size={width:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.y)};t.sprite.sticker[c]=ni.deserializeStickers(u.options)}else if(u.type==="text"){t.sprite.common[c].tool="text";t.sprite.text[c]=this.deserializeTexts(u.options)}else if(u.type==="textdesign"){t.sprite.common[c].tool="textdesign";t.sprite.textdesign[c]=this.deserializeTextDesign(u.options)}break;default:break}});break;default:break}});if(e.assetLibrary){t.customStickers=((s=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return t}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:ni.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:return void 0}}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new F(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const t=new F(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new F(this.mapRelativeCropPointToImageSpace(e.start)).add(new F(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(t.y,t.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:ws(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:ni.deserialzeColor(e.color),backgroundColor:ni.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:ni.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(t=>{return{path:{controlPoints:t.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:ni.deserialzeColor(t.brush.color),size:t.brush.size,hardness:t.brush.hardness}}})}}}});var OKe,RKe,AKe,FKe,PKe,BKe,MKe,LKe,zKe,UKe,NKe,qKe,HKe,WKe,GKe,Gpe;var Wpe=p(()=>{OKe="@photoeditorsdk/root";RKe="5.19.2";AKe="The most comprehensive photo editor SDK for HTML5";FKe="http://github.com/imgly/pesdk-html5";PKe="PhotoEditorSDK (img.ly GmbH) ";BKe="SEE LICENSE IN LICENSE.md";MKe=true;LKe={};zKe={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};UKe={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};NKe={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};qKe={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};HKe={eslint:"7.10.0"};WKe=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];GKe={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};Gpe={name:OKe,version:RKe,description:AKe,repository:FKe,author:PKe,license:BKe,private:MKe,bin:LKe,scripts:zKe,devDependencies:UKe,dependencies:NKe,devEngines:qKe,resolutions:HKe,workspaces:WKe,husky:GKe}});var dp;var Vpe=p(()=>{B();Ks();Wpe();dp=class{constructor(e,t,i,o,n,s){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=e=>{const t=ye.pointFromSpaceToSpace(e,this.imageSpace,this.cropSpace,false);return ye.absoluteToRelativePoint(t,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=e=>{return e/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=e=>{return e/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(e,t=0,i=3)=>{const o=Math.tan(t);const n=Math.sqrt(o**2+1);return{x:e.x+i/n,y:e.y+i*o/n}};this.previewPosition=e;this.previewSize=t;this.outputSize=i;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale()}static serializeFilters(e){return{type:"filter",options:{intensity:e.intensity,identifier:e.identifier}}}static serializeAdjustments(e){return{type:"adjustments",options:e}}static serializeOverlay(e){return{type:"overlay",options:{identifier:e.identifier,intensity:e.opacity,blendMode:e.blendMode.replace(/[A-Z]/g,t=>` ${t.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:Gpe.version,createdAt:new Date().toISOString()}}serialise(e,t,i){const o=dp.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(t){n.type=i;n.data=t}const s=[];const a=[];const{adjustment:l}=e;if(Object.keys(l).map(b=>l[b]).filter(Boolean).length){s.push(dp.serializeAdjustments(l))}const{filter:u}=e;if(u.identifier!=="identity"){s.push(dp.serializeFilters(u))}const{overlay:c}=e;if(c.identifier!=="identity"){a.push(dp.serializeOverlay(c))}if(e.transform){const{transform:b,orientation:_}=this.serializeTransform(e.transform);const y=[b.options.start.x!==0,b.options.start.y!==0,b.options.end.x!==1,b.options.end.y!==1,b.options.rotation!==0];const I=[_.options.rotation!==0,_.options.flipVertically!==false,_.options.flipHorizontally!==false];if(y.some(T=>T)){s.push(b)}if(I.some(T=>T)){s.push(_)}}const{frame:d}=e;if(d.identifier!=="identity"){a.push(this.serialzeFrame(d))}const{focus:m}=e;if(m.identifier!=="identity"){s.push(this.serializeFocus(m))}if(e.sprite){e.sprite.spriteIdList.forEach(b=>{const _=e.sprite.common[b];switch(_.tool){case"sticker":const y=e.sprite.sticker[b];a.push(this.serializeSticker(y,_,e.transform));break;case"text":const I=e.sprite.text[b];a.push(this.serializeText(I,_));break;case"textdesign":const T=e.sprite.textdesign[b];a.push(this.serializeTextDesign(T,_));break;default:break}})}if(e.brush.strokes.length){a.push({type:"brush",options:{paths:e.brush.strokes.map(b=>{return{points:b.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:b.brush.color},size:b.brush.size,hardness:b.brush.hardness}}})}})}if(a.length){const b={type:"sprite",options:{sprites:a}};s.push(b)}const h=e.customStickers;const f={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:f}}serialzeFrame(e){return{type:"frame",options:{identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.color},size:this.mapSizeToRelativeUnscaledCropSize(e.width)}}}serializeFocus(e){const t=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(e.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(e.linear.start),end:this.mapImagePointToRelativeCropPoint(e.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(e.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(e.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(e.radial.center,0,e.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(e.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:i}=e;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(i.origin,i.rotation,t/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(i.origin,i.rotation,-t/2)),size:this.mapSizeToRelativeScaledCropSize(e.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(e.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(e.gaussian.blurRadius)}}}}}serializeSticker(e,t,i){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(t.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(t.size.width),y:this.mapSizeToRelativeScaledCropSize(t.size.height)},rotation:t.rotation,flipVertically:(t.flipVertically||false)!==(i.flipVertically||false),flipHorizontally:(t.flipHorizontally||false)!==(i.flipHorizontally||false),identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.tintColor},tintMode:e.tintMode}}}serializeText(e,t){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(t.position),rotation:t.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:e.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(e.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(e.width),text:e.text,lineHeight:e.lineHeight,color:{rgba:e.textColor},backgroundColor:{rgba:e.backgroundColor},alignment:e.alignment}}}serializeTextDesign(e,t){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(t.position),rotation:t.rotation,flipVertically:false,flipHorizontally:false,identifier:e.identifier,inverted:e.isInverted,text:e.text,seed:e.seed,width:this.mapSizeToRelativeScaledCropSize(e.width),padding:this.mapSizeToRelativeScaledCropSize(e.padding),color:{rgba:e.color}}}}serializeTransform(e){const{start:t,end:i}=e;const o={type:"transform",options:{start:t,end:i,rotation:e.rotation,meta:{identifier:e.identifier}}};const n={type:"orientation",options:{rotation:e.outputRotation,flipHorizontally:e.flipHorizontally,flipVertically:e.flipVertically}};return{transform:o,orientation:n}}}});var o5={};wt(o5,{Deserializers:()=>VKe,Serializer:()=>dp});var VKe;var n5=p(()=>{Npe();Hpe();Vpe();VKe={"3.9.0":ni,"3.12.0":oi}});var jpe,jKe,$Ke,KKe,Hb;var $pe=p(()=>{ze();B();W();jpe=/^data:image\/(.+?);base64,/;jKe=r=>jpe.test(r);$Ke=r=>r.match(/^data:([^;]+)/)[1];KKe=r=>r.replace(jpe,"");Hb=class{constructor(e){this.applySerialization=async(e,t,i,o)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const s="Unexpected error occured";const a=t.deserializeImage(e);if(a.image&&a.image.data){const c=a.image.data;await this.editor.setImage(c);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(c);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const l=t.deserializeTransformation(e);if(!l){o(s);return}await this.applyStateOnUI(l);const u=t.deserialize(e);if(!u){o(s);return}await this.applyStateOnUI(u);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}i()};this.editor=e}serialize({image:e}={image:false}){const t=this.editor.activeStore.tool==="transform";const{displaySerializationModal:i}=this.editor.configStore.config;if(i){this.editor.modalStore.showInfoModal("saving")}return new Promise((o,n)=>{Promise.resolve().then(()=>(n5(),o5)).then(async({Serializer:s})=>{try{if(t){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:a}=this.editor.imageContainer.getData();const l=this.editor.engineMediator.output.container.getResolution();const u={width:a.width,height:a.height};const c=new s(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,l,u,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const d={["adjustment"]:ve(this.editor.adjustmentsToolStore.state),["filter"]:ve(this.editor.filterToolStore.state),["focus"]:ve(this.editor.focusToolStore.serializableState),["overlay"]:ve(this.editor.overlayToolStore.state),["frame"]:ve(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:m,customStickers:h}=await this.editor.spriteStore.serializableState();m.spriteIdList=m.spriteIdList.sort((_,y)=>{const I=m.common[_].order;const T=m.common[y].order;return I-T});d.sprite=m;d.customStickers=h;d.transform=this.editor.transformToolStore.serializableState;let f;let b;if(e){const _=Hb.getDataURL(a);b=$Ke(_);f=KKe(_)}if(i){this.editor.modalStore.hideModal()}o(c.serialise(d,f,b));if(t){this.editor.transformToolStore.onEnter()}}catch(a){if(i){this.editor.modalStore.hideModal()}n(a)}})})}deserialize(e){this.editor.modalStore.showInfoModal("loading");return new Promise((t,i)=>{try{Promise.resolve().then(()=>(n5(),o5)).then(({Deserializers:o})=>{const n=e.version.match(/[0-3].[0-8].[0-9]/i);let s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](this.editor)}else if(o[e.version]){s=new o[e.version](this.editor)}else{s=new o["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(e,s,t,i)})}else{this.applySerialization(e,s,t,i)}})}catch(o){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}i(o)}})}static getDataURL(e){if(e instanceof HTMLImageElement){const{src:n}=e;if(jKe(n)){return n}}if(e instanceof HTMLCanvasElement){return e.toDataURL("image/png")}const t=document.createElement("canvas");t.width=e.width;t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0);const o=t.toDataURL("image/png");st(t);return o}async applyStateOnUI(e){const t=this.editor.activeStore.tool==="transform";try{if(e.transform){if(!t){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(e.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!t){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(e.filter){await this.editor.filterToolStore.updateStateFromSerialization(e.filter)}if(e.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(e.adjustment)}if(e.focus){await this.editor.focusToolStore.updateStateFromSerialization(e.focus)}if(e.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(e.overlay)}if(e.sprite){let i=Object.keys(e).length-1;if(e.customStickers){i-=1}e.sprite.spriteIdList=e.sprite.spriteIdList.sort((o,n)=>{const s=e.sprite.common[o].order;const a=e.sprite.common[n].order;return s-a});await this.editor.spriteStore.updateStateFromSerialization(e.sprite,e.customStickers,Math.max(0,i))}if(e.brush){this.editor.brushToolStore.updateStateFromHistory(e.brush)}if(e.frame){await this.editor.frameToolStore.updateStateFromSerialization(e.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(i){if(i.name==="AssetNotFoundError"){console.error(i)}else{console.error(i);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:i.message,handleConfirm:()=>{this.applyStateOnUI(e)}})}}}}});var XKe,s5;var Kpe=p(()=>{XKe=r=>{const e=atob(r.split(",")[1]);const t=r.split(",")[0].split(":")[1].split(";")[0];const i=new ArrayBuffer(e.length);const o=new Uint8Array(i);for(let n=0;n{B();Xpe=r=>r.split(",")[0].split(":")[1].split(";")[0];Ype=r=>{if(typeof r==="string"){return Xpe(r)}if(r.src.includes(".svg")){return"image/svg+xml"}if(r.src){return Xpe(r.src)}return"image/jpeg"}});var Gw,Wb;var Zpe=p(()=>{Ob();Gw=v(Pm());B();Ks();Wb=class{static isImageElement(e){return e instanceof HTMLImageElement}constructor({license:e,assetProvider:t,crossOrigin:i,backgroundColor:o}){this.crossOrigin=i;this.engine=new Zh({license:e,crossOrigin:i,assetProvider:t,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:o})}getAllFilterPreviewThumbnails(e){return new Promise((t,i)=>{const o=[];const n=[];e.forEach(s=>{if(s.isDuotone)o.push(s.identifier);else n.push(s.identifier)});this.getAllDuotonePreview(o).then(s=>{this.getAllLutPreview(n).then(a=>{t(Object.assign(s,a))}).catch(a=>{i(a)})}).catch(s=>{i(s)})})}async getAllDuotonePreview(e){const t={};if(!e.length)return t;const i=await this.engine.addDuoToneFilterFromAssets(e[0],this.container);await(0,Gw.default)(e,async o=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(o);const s=i.filterOperation.getFilter();s.set({intensity:.5,lightColor:ge.Color.fromHex(n.lightColor),darkColor:ge.Color.fromHex(n.darkColor)});const a=await this.engine.export("data-url","image/jpeg",.8,false,true);t[o]=a},{concurrency:1});this.engine.removeEffect(i);return t}async loadLutAssets(e){const t={};await(0,Gw.default)(e,async i=>{t[i]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",i))});return t}async getAllLutPreview(e){const t={};if(!e.length)return t;const i=await this.loadLutAssets(e);const o=await this.engine.addLUTFilterFromAssets(e[0],this.container);await(0,Gw.default)(e,async n=>{const s=this.engine.assetProvider.getLUTFilterAsset(n);const a=o.filterOperation.getFilter();const l={horizontalTileCount:s.horizontalTileCount||5,verticalTileCount:s.verticalTileCount||5,image:i[n]};a.set({...l,intensity:s.defaultIntensity||1});o.setProperties({intensity:1});a._lutPrimitive.set(l);const u=await this.engine.export("data-url","image/jpeg",.8,false,true);t[n]=u},{concurrency:1});this.engine.removeEffect(o);return t}addImageToContainer(e){return new Promise((t,i)=>{let o;if(Wb.isImageElement(e)){o=e;this.setBackgroundImage(o);t()}else{this.getImageElement(e).then(n=>{o=n;this.setBackgroundImage(o);t()}).catch(n=>{i({identifier:"imageLoading",message:n.message})})}})}getImageElement(e){return new Promise((t,i)=>{const o=new Image;o.addEventListener("load",()=>{t(o)});o.addEventListener("error",n=>{i(n)});o.crossOrigin=this.crossOrigin;o.src=e})}setBackgroundImage(e){if(!this.container){this.container=this.engine.addImage({image:e,blendMode:"normal",opacity:1})}else{this.container.setData({image:e})}const{size:t}=this.container.getBounds();const i=this.engine.getOutputContainer();i.setResolution(t)}}});var YKe,Vn;var a5=p(()=>{ze();W();YKe={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};Vn=class{constructor(e){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(e,t)=>{const{height:i,width:o}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:s,snapToTop:a,snapToBottom:l}=this.configStore.config.snapping.position;const u=Math.min(i,o);let c=0;if(t==="bottom"){c=Math.round(i-u*l)}else if(t==="top"){c=Math.round(u*a)}else if(t==="right"){c=Math.round(o-u*s)}else if(t==="left"){c=Math.round(u*n)}else if(e==="vertical"&&t==="center"){c=Math.round(o/2)}else if(e==="horizontal"&&t==="center"){c=Math.round(i/2)}return c};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:e,snapToLeft:t,snapToRight:i}=this.configStore.config.snapping.position;const o=[];if(e){o.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(t){o.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(i){o.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return o};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:e,snapToTop:t,snapToBottom:i}=this.configStore.config.snapping.position;const o=[];if(e){o.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(t){o.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(i){o.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return o};this.getRotationGuidesFromConfig=()=>{const{angles:e}=this.configStore.config.snapping.rotation;const t=[];e.forEach(o=>{t.push(o);t.push(o+360);t.push(o-360)});const i=t.filter((o,n)=>t.indexOf(o)===n);return i.map(o=>({value:o*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:e,leftBottom:t,rightTop:i,rightBottom:o})=>{const n=Math.min(e.y,i.y,t.y,o.y);const s=Math.max(e.y,i.y,t.y,o.y);const a=Math.min(e.x,i.x,t.x,o.x);const l=Math.max(e.x,i.x,t.x,o.x);return{height:Math.round(s-n),width:Math.round(l-a)}};this.mapRange=({value:e,fromMin:t,fromLength:i,toMin:o,toLength:n})=>{return(e-t)*n/i+o};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(e,t,i,o)=>{if(t.length===0){return e}if(t[0]>e){return e-i}for(let n=0;n=a-d){return a+c+(o?i*2:0)}return this.mapRange({value:e,fromMin:s,fromLength:a-s,toMin:l,toLength:u-l})}}if(o){return e+(t.length-1)*i*2+i}return e};this.mapFromSnapSystem=(e,t,i,o)=>{if(t.length===0){return e}if(t[0]>e){if(e>=t[0]-i){return t[0]}return e+i}let n=e;for(let a=0;a{const i=t*.5;const{value:o,edge:n}=e;let s=o;if(n==="leading"){s+=i}else if(n==="trailing"){s-=i}return s};this.mapSnappingGuidesToCenter=(e,t)=>{const i=[];e.forEach(o=>{i.push(this.centerSnapValue(o,t))});return i};this.calcSnapThresholdInRadians=(e,t)=>{if(e===0){return 0}return t/e};this.calculatePreviewTopLeftPosition=()=>{const e=this.editor.engineMediator.preview.container.getPosition();const t=this.editor.getPreviewSize();const i=kn();this.previewTopLeftPosition={x:e.x/i-t.width/2,y:e.y/i-t.height/2}};this.snapToRotation=(e,t,i)=>{const{rotationGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.rotation;const{x:a,y:l}=this.previewTopLeftPosition;const{width:u}=this.editor.getPreviewSize();let c=(e+Math.PI*2)%(Math.PI*2);if(n){const d=new F(t).magnitude;const m=o.map(b=>b.value).sort((b,_)=>b-_);const h=this.calcSnapThresholdInRadians(d,s);if(!this.rotationOffset){const b=this.mapToSnapSystem(e,m,h,false);this.rotationOffset=b-c}c=this.mapFromSnapSystem(c+this.rotationOffset,m,h,false);const f={x:i.position.x-a-u,y:i.position.y-l};o.forEach(b=>{b.isVisible=b.value===c;b.position=f});return c}return e};this.snapToPosition=(e,t)=>{const{horizontalGuides:i,verticalGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.position;const a=new F(this.previewTopLeftPosition);const{height:l,width:u}=this.getSpriteDimensions(t);const{x:c,y:d}=new F(e).subtract(a);if(n){const m=this.mapSnappingGuidesToCenter(i,l).sort((_,y)=>_-y);const h=this.mapSnappingGuidesToCenter(o,u).sort((_,y)=>_-y);if(!this.positionOffset){const _=this.mapToSnapSystem(c,h,s,true);const y=this.mapToSnapSystem(d,m,s,true);this.positionOffset=new F(_,y).subtract(new F(c,d))}let f=this.mapFromSnapSystem(c+this.positionOffset.x,h,s,true);let b=this.mapFromSnapSystem(d+this.positionOffset.y,m,s,true);f=Math.round(f);b=Math.round(b);i.forEach(_=>{const y=Math.round(this.centerSnapValue(_,l));_.isVisible=y===b});o.forEach(_=>{const y=Math.round(this.centerSnapValue(_,u));_.isVisible=y===f});return new F(f,b).add(a)}return{x:c,y:d}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=e;this.configStore=e.configStore;this.state=ae(YKe);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(e=>({...e,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(e=>({...e,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(e=>({...e,isVisible:false}))}get positionGuides(){const{verticalGuides:e,horizontalGuides:t}=this.state;return[...e,...t]}get rotationGuides(){return this.state.rotationGuides}};g([ae],Vn.prototype,"state",2);g([S],Vn.prototype,"snapToRotation",2);g([S],Vn.prototype,"snapToPosition",2);g([S],Vn.prototype,"hidePositionGuides",1);g([S],Vn.prototype,"hideRotationGuides",1);g([S],Vn.prototype,"dispose",2);g([w],Vn.prototype,"positionGuides",1);g([w],Vn.prototype,"rotationGuides",1)});var oc;var Qpe=p(()=>{ze();B();Ks();W();Nw();qw();Lw();jM();Uw();Hw();Ww();$pe();lM();cM();dM();IM();i5();mM();Kpe();Jpe();Zpe();kM();a5();r5();e5();oc=class{constructor(e,t){this.initWithImage=async e=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(e);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const t=this.configStore.config.engine;this.previewThumbnails=new Wb({...t,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(t){this.configStore.events.onErrorImageLoading(t);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:t.identifier?t.identifier:"rendering",error:t,handleConfirm:()=>{this.initWithImage(e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:e,height:t})=>{const{maxMegaPixels:i}=this.configStore.config.engine.downscaleOptions;const o=Zg.isMobile()?i.mobile:i.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${o}`,width:`${e}`,height:`${t}`}})})};this.init=e=>{var o,n;if(!((o=this.activeStore)==null?void 0:o.image)){this.initWithImage(e);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const t=this.historyStore.isDirty();const{displayDiscardChangesWarning:i}=this.configStore.config;if(t&&i){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(e);this.resetToolStates()},handleDismiss:()=>{this.setImage(e,true)}});return}if(t&&!i){this.setImage(e,true);return}this.historyStore.reset();this.setImage(e,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:s,displayCanvasRendererWarning:a}=this.configStore.config;if(s.preferredRenderer==="canvas"&&a){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(e,t=false)=>{try{if(!this.activeStore.image){this.initWithImage(e)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(e);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:i,flipVertically:o,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:o,flipHorizontally:i});await this.transformToolStore.rotateOutputContainer(sy(n),false);if(t){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const s=this.activeStore.tool;if(!s){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(i){this.configStore.events.onErrorImageLoading(i);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:i.identifier?i.identifier:"rendering",error:i,handleConfirm:()=>{this.setImage(e,t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(i)}};this.onToolChange=(e,t=null,i=true)=>{var o,n;if(e===t){return}if((n=(o=this.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([e,t].indexOf("transform")!==-1){if(e==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(t==="transform"){this.transformToolStore.onEnter()}this.resize(t)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(i){this.render()}}};this.resize=(e=null)=>{if(!this.engineMediator)return;try{const t=this.activeStore.tool;const i=e==="transform"||!e&&t==="transform";this.canvasStore.resizeCanvas(e);this.transformToolStore.applyDefaultCrop();const o=ve(this.transformToolStore.maxCropMaskSize);if(!i){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const s=this.engineMediator.preview.updateTransform(n);if(s){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(o);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const a=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(a);if(!i){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(t){this.configStore.events.onErrorImageLoading(t);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:e,...t}={})=>{const i=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(i){this.transformToolStore.onLeave()}const{config:o}=this.configStore;const n={...o.export.image,...t};const{exportType:s,format:a,quality:l,enableDownload:u,transparent:c}=n;const d=await this.engineMediator.engine.export(s,a,l,c);if(i&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(u){this.triggerFileDownload(o.export.filename,a,s,d)}if(!e){this.configStore.events.onExport(d)}return d}catch(o){if(this.modalStore){this.modalStore.hideModal()}if(i&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(o)}};this.serialize=({image:e}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:e})}return Promise.resolve({})};this.deserialize=e=>{if(this.serializationMediator){return this.serializationMediator.deserialize(e)}return Promise.resolve()};this.close=()=>{var e,t,i,o,n,s;if((((e=this.historyStore)==null?void 0:e.isDirtySinceSave)||((i=(t=this.transformToolStore)==null?void 0:t.transformHistory)==null?void 0:i.hasChanges()))&&((n=(o=this.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var a;if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}}})}else if((s=this.configStore)==null?void 0:s.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:e,height:t}=this.engine.getOutputDimensions();return{width:e,height:t}}return{width:0,height:0}};this.wait=(e=0)=>new Promise(t=>setTimeout(t,e));this.clickableCanvas=async e=>{if(e){await new Promise(t=>setTimeout(t,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:e}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(e){const t=this.transformToolStore.localOutputImageSize;const i=t.width/t.height;const o=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(o.indexOf(parseFloat(i.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(e,t,i)=>{this.historyStore.addSnapshot(e,t,i)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=e=>this.assetProvider.getPathForCategory(e);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=e=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(e)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:e,height:t}=this.engine.getOutputDimensions();if(e&&t){return{width:Math.round(this.worldToPreview(this.outputToWorld(e))),height:Math.round(this.worldToPreview(this.outputToWorld(t)))}}return{height:t,width:e}};this.getImageMimeType=()=>{return Ype(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var e,t,i;(i=(t=(e=this.engineMediator)==null?void 0:e.image)==null?void 0:t.container)==null?void 0:i.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(e,t,i,o)=>{const n=t==="image/jpeg"&&i!=="ms-blob"?".jpeg":".png";const s=e+n;const a=this.blobFromExportData(o);this.triggerBlobDownload(s,a)};this.triggerBlobDownload=(e,t)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(t,e)}else{const i=document.createElement("a");const o=URL.createObjectURL(t);i.href=o;i.download=e;document.body.appendChild(i);i.click();document.body.removeChild(i);if(!wK()){URL.revokeObjectURL(o)}}};this.blobFromExportData=e=>{if(typeof e==="string"){return s5(e)}if(e instanceof HTMLImageElement){return s5(e.src)}return e};this.configStore=new Ei;if(t){Object.entries(t).forEach(([o,n])=>{this.configStore.events.on(o,n)})}const i=this.configStore.saveConfig(e);this.engineMediator=new VM(this);this.serializationMediator=new Hb(this);this.spriteStore=new fe(this);this.scale=new vr(this);this.filterToolStore=new nr(this);this.adjustmentsToolStore=new pt(this);this.focusToolStore=new Ve(this);this.overlayToolStore=new br(this);this.frameToolStore=new Yt(this);this.brushToolStore=new Ht(this);this.transformToolStore=new le(this);this.libraryStore=new Yi(this);this.modalStore=new Oo(this);this.snappingStore=new Vn(this);this.activeStore=new Xi(this);this.canvasStore=new ii(this);this.historyStore=new up(this);this.libraryStore.initProvider(i);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const e=this.outputContainer.getBounds();return Math.min(e.width,e.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(e,t){if(!this.engineMediator)return{x:0,y:0};if(Wo(e)){return this.engineMediator.previewSpaceToWorldSpace(e,t)}return this.engineMediator.previewSpaceToWorldSpace(e,t)}worldToPreview(e){if(!this.engineMediator)return{x:0,y:0};if(Wo(e)){return this.engineMediator.worldSpaceToPreviewSpace(e)}return this.engineMediator.worldSpaceToPreviewSpace(e)}worldSizeToPreview(e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(e.width),height:this.engineMediator.worldSpaceToPreviewSpace(e.height)}}previewSizeToWorld(e,t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(e.width,t),height:this.engineMediator.previewSpaceToWorldSpace(e.height,t)}}outputToWorld(e){if(!this.engineMediator)return{x:0,y:0};if(Wo(e)){return this.engineMediator.outputSpaceToWorldSpace(e)}return this.engineMediator.outputSpaceToWorldSpace(e)}previewToOutput(e){if(!this.engineMediator)return{x:0,y:0};if(Wo(e)){return this.engineMediator.previewSpaceToOutputSpace(e)}return this.engineMediator.previewSpaceToOutputSpace(e)}get outputContainer(){return this.engineMediator.output.container}};g([S],oc.prototype,"resize",2);g([S],oc.prototype,"export",2);g([S],oc.prototype,"clickableCanvas",2)});var lt=p(()=>{W();Ki();Iw();qde();lM();cM();dM();mM();rpe();spe();ape();IM();dpe();Bpe();Lpe();zpe();Ww();Uw();Qpe();PM();Lw();Nw();qw();Hw();a5();Mb();Ub();Lb();rc();Ys();Jh()});var Gb,Vb,eme,tme,JKe,ZKe,rme;var ime=p(()=>{Gb=v(x("react"));L();Vb=v(x("styled-components"));B();lt();W();cr();eme=we.Button.TextSecondary;tme=Vb.default.span` + 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:t,background:c},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};zM=fKe});var zb,Mw,Do;var Ub=p(()=>{Lb();_pe();vpe();zb=Bw();Mw=Pw();Do={...zb,measurements:Mw}});var yKe,xpe;var Cpe=p(()=>{rc();Ub();yKe=r=>{if(r==="light"){return zM}return Bw};xpe=(r,e)=>{const t=yKe(r);if(e&&e[r]){const{primary:i,background:o,foreground:n}=e[r];const s={primary:i,background:o,foreground:n};const a=Object.keys(s).reduce((l,u)=>{if(s[u]){return{...l,[u]:s[u]}}return l},{});return ri([t(a),e[r]])}return t()||zb}});var bKe,Spe;var wpe=p(()=>{rc();Lb();bKe=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];Spe=r=>{const e=Pw();if(r){const t={};Object.keys(r).forEach(i=>{if(bKe.indexOf(i)!==-1){t[i]=r[i]}});return ri([e,t])}return e}});var Tpe=p(()=>{bpe();Cpe();wpe()});var _Ke,Ei;var Lw=p(()=>{ze();B();Ks();W();rc();PM();mpe();aM();Mb();Tpe();Ub();_Ke={config:ec,locale:lp,theme:zb,measurements:Mw,initialMeasurements:Mw};Ei=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(e,t)=>{return t.indexOf(e)!==-1};this.state=ae(_Ke);this.events=new FM;this.licenseChecker=null}saveConfig(e){if(e.mainCanvasActions&&e.mainCanvasActions.length!==4){e.mainCanvasActions.length=4}const t=e.layout&&e.layout==="basic"?BM:ec;const i=ri([t,e],{clone:true});this.licenseChecker=new ww(i.license);if(!this.licenseChecker.areCustomAssetsAllowed()){i.sticker.enableCustomUpload=false}const o=ype(i.language,i.custom.languages);const n=xpe(i.theme,i.custom.themes);const s=Spe(i.custom.measurements);const{provider:a}=i.library;const l=[];i.adjustment.categories=i.adjustment.categories.reduce((d,m)=>{d.push({...m,items:m.items.filter(h=>{if(!xO[h.identifier]){l.push(h.identifier);return false}return true})});return d},[]);if(l.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${l.join(", ")}`)}delete i.language;delete i.custom.languages;delete i.custom.themes;delete i.library.provider;let u=i.tools.reduce((d,m)=>{if(typeof m==="object"){return[...d,...m]}return[...d,m]},[]);if(!u.length){console.error(`Empty list input for tools`);u=Tw.reduce((d,m)=>{if(typeof m==="object"){return[...d,...m]}return[...d,m]},[])}u=u.filter(d=>this.licenseChecker.isToolAllowed(d));if(i.defaultTool){const d=this.checkDefaultToolAvailability(i.defaultTool,u);if(!d){[i.defaultTool]=u}}i.tools=u;this.state.config=i;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;const c=this.buildCustomAssetsConfig();this.assetProvider=new ny(c,this.licenseChecker.areCustomAssetsAllowed(),i.assetResolver);this.loadThemeFont();return a}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((e,t)=>{if(typeof t==="string"){return[...e,t]}return[...e,"",...t]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:e}=this.theme;if(!e.skipLoading){this.assetProvider.getFontManager().injectFonts([e])}}buildCustomAssetsConfig(){const e=this.tools;const t=ve(this.state.config);const i=this.state.config.assetBaseUrl;const{theme:o}=this.state;const n=e.indexOf("filter")!==-1?t["filter"]:void 0;const s=e.indexOf("focus")!==-1?t["focus"]:void 0;const a=e.indexOf("adjustment")!==-1?t["adjustment"]:void 0;const l=e.indexOf("sticker")!==-1?t["sticker"]:void 0;const u=e.indexOf("frame")!==-1?t["frame"]:void 0;const c=e.indexOf("overlay")!==-1?t["overlay"]:void 0;const d=e.indexOf("transform")!==-1?t["transform"]:void 0;const m=e.indexOf("text")!==-1?t["text"]:void 0;const h=e.indexOf("textdesign")!==-1?t["textdesign"]:void 0;return{basePath:i,theme:o,filter:n,focus:s,sticker:l,frame:u,overlay:c,transform:d,text:m,adjustment:a,textdesign:h}}};g([S],Ei.prototype,"saveConfig",1);g([S],Ei.prototype,"dispose",2);g([w],Ei.prototype,"config",1);g([w],Ei.prototype,"locale",1);g([w],Ei.prototype,"theme",1);g([w],Ei.prototype,"measurements",1);g([w],Ei.prototype,"initialMeasurements",1);g([w],Ei.prototype,"tools",1);g([w],Ei.prototype,"defaultTool",1);g([w],Ei.prototype,"isOrderDefault",1);g([w],Ei.prototype,"isLayoutAdvanced",1);g([w],Ei.prototype,"displayCloseButton",1)});var UM;var NM=p(()=>{B();_O();UM=class{constructor(e){this.editor=e}setBackgroundImage(e){if(!this.container){this.container=this.engine.addImage({image:e,originalImage:e,blendMode:"normal",opacity:1})}else{this.container.setData({image:e,originalImage:e})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((e,t)=>{const{image:i}=this.editor.activeStore;if(kK(i)){this.setBackgroundImage(i);e()}else{const o=this.editor.libraryStore.getRawUrl(i);this.getImageElement(o).then(n=>{this.setBackgroundImage(n);e()}).catch(n=>{t({identifier:"imageLoading",message:n.message})})}})}getImageElement(e){return new Promise((t,i)=>{const o=new Image;o.addEventListener("load",()=>{t(o)});o.addEventListener("error",n=>{i(n)});o.crossOrigin=this.editor.configStore.config.engine.crossOrigin;o.src=e})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}}});var qM;var HM=p(()=>{W();qM=class{constructor(e){this.applyNewImageTransform=()=>{const{size:e,width:t,height:i}=this.editor.engineMediator.image.container.getBounds();const o=this.container;o.setTransform(bt.IDENTITY);o.setResolution(e);o.setPivot(.5,.5);o.setPosition({x:t/2,y:i/2})};this.editor=e}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}}});function Nb(r,e){const t=r.width/r.height;const i=e.width/e.height;if(t>i){return r.height/e.height}return r.width/e.width}var Ipe=p(()=>{});var vKe,Sl;var WM=p(()=>{ze();W();Ipe();vKe={transform:bt.IDENTITY};Sl=class{constructor(e){this.initialTransform=bt.IDENTITY;this.editor=e;this.state=ae(vKe)}createPreview(e){this.container=this.editor.engine.createPreview(e)}updateTransform(e=0,t=true){const i=this.calculateTransform(e);if(i.scale.x){if(t){this.saveInitialTransform(i)}else{this.savePreviewTransform(i)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(e){this.initialTransform=e;this.savePreviewTransform(e)}savePreviewTransform(e){lr(()=>{this.state.transform.position=e.position;this.state.transform.scale=e.scale;this.state.transform.rotation=e.rotation;const t=kn();const i=new F(e.scale).divide(t);this.previewTransformWithoutDpr={position:new F(e.position).divide(t),scale:i,rotation:e.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(e=0){const t=kn();const{scaleImageToFit:i}=this.editor.configStore.config;const{width:o,height:n}=this.editor.canvasStore.canvasSize;const s=this.editor.engine.getOutputDimensions();const a=Nb({width:o,height:n},s);let l=i?a:Math.min(1,a);const u=n-s.height*l;const c=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(un*d){l=Nb({width:o,height:n*d},s)}if(s.width*l>o*d){l=Nb({width:o*d,height:n},s)}l*=t;const m={x:o*t/2,y:n*t/2};const h={x:l,y:l};return new bt(m,h,e)}};g([S],Sl.prototype,"updateTransform",1);g([S],Sl.prototype,"savePreviewTransform",1);g([w],Sl.prototype,"transform",1);g([w],Sl.prototype,"position",1);g([w],Sl.prototype,"scale",1);g([w],Sl.prototype,"rotation",1)});var ic,zw;var GM=p(()=>{B();ic=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(e){if(["sticker","text","textdesign","brush"].indexOf(e)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(e,t){const i=t.findIndex(o=>o===e);if(i!==-1){t.splice(i,1)}return void 0}static indexForOrder(e,t,i){const o=e[i];const n=t.findIndex(a=>a===i);if(n!==-1){return{index:n,order:t}}const{length:s}=t;if(s){let a;for(a=0;ao===e);if(i!==-1){this.spriteContainerOrder[i]=t}}bringToFront(e){const t=this.spriteContainerOrder.findIndex(i=>i===e);if(t!==-1){this.spriteContainerOrder.splice(t,1);this.spriteContainerOrder.push(e)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:e}=this.spriteContainerOrder;return this.spriteContainerOrder[e-1]}getSpriteIndex(e){const t=this.spriteContainerOrder.findIndex(i=>i===e);return t+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};zw=ic;zw.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3}});var VM;var jM=p(()=>{Ks();W();NM();HM();WM();GM();VM=class{constructor(e){this.orderHelper=new zw;this.init=()=>{const e=this.editor.configStore.config.engine;this.engine=new Zh({...e,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new UM(this.editor);this.output=new qM(this.editor);this.preview=new Sl(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=e}render(e){return this.engine.render(e)}previewSpaceToWorldSpace(e,t){const i=this.preview.previewTransformWithoutDpr;if(Wo(e)){const o=this.editor.engine.convertPointFromPreviewIntoWorldSpace(F.ZERO,i,t);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:e,y:0},i,t);return F.distance(new F(o),new F(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(e,i,t)}worldSpaceToPreviewSpace(e){const t=this.preview.previewTransformWithoutDpr;if(Wo(e)){const i=this.editor.engine.convertPointFromWorldIntoPreviewSpace(F.ZERO,t);const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:e,y:0},t);return F.distance(new F(i),new F(o))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(e,t)}outputSpaceToWorldSpace(e){if(Wo(e)){return ye.getScalarInWorldSpace(e,this.editor.engine.getOutputContainer())}return ye.getPointInWorldSpace(e,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(e){const t=this.preview.previewTransformWithoutDpr;if(Wo(e)){const i=this.editor.engine.convertPointFromPreviewIntoOutputSpace(F.ZERO,t);const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:e,y:0},t);return F.distance(new F(i),new F(o))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(e,t)}previewSpaceToFlippedPreviewSpace(e){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(e)}}});var of;var Epe=p(()=>{ze();of=class{constructor(){this.snapshots=[];this.observeIndex=ae.box(-1)}addSnapshot(e){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(e))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(e)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(e){if(e>0&&e0}get canRedo(){return this.snapshots.length-1>this.index}};g([w],of.prototype,"index",1);g([w],of.prototype,"canUndo",1);g([w],of.prototype,"canRedo",1)});var up;var Uw=p(()=>{ze();B();Epe();Ii();up=class{constructor(e){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const e=this.appHistoryManager.undo();await this.applyState(e);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const e=this.appHistoryManager.redo();await this.applyState(e);this.awaitHistoryChange=false}};this.editor=e;this.appHistoryManager=new of}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const e=ve(this.editor.adjustmentsToolStore.state);const t=ve(this.editor.filterToolStore.state);const i=this.editor.focusToolStore.getFocusStateForHistory();const o=ve(this.editor.overlayToolStore.state);const n=ve(this.editor.frameToolStore.state);const{strokes:s}=this.editor.brushToolStore;const a=this.editor.spriteStore.getSpriteHistoryState();const l=this.editor.transformToolStore.serializableState;return{["adjustment"]:e,["filter"]:t,["focus"]:i,["overlay"]:o,["frame"]:n,["brush"]:s,sprite:a,["transform"]:l}}addInitialSnapshot(){const e=this.getHistoryState();this.appHistoryManager.addSnapshot({state:e,type:"add",description:"Initial State"})}addSnapshot(e,t,i){let o;if(!e){o=this.getHistoryState()}else if(e.sprite||e.transform){o={...this.getHistoryState(),...e}}else{o=e}this.appHistoryManager.addSnapshot({state:o,type:t,description:i});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:e}){try{if(e){const t=Object.keys(e);for(const i of t){switch(i){case"filter":await this.editor.filterToolStore.updateStateFromHistory(e[i]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(e[i]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(e[i]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(e[i]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(e[i],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(e[i]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(e[i]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(e[i]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(t){console.error(t);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:t,handleConfirm:()=>{this.applyState({state:e})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var e,t;return(t=(e=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:e.state)==null?void 0:t.sprite}};g([S],up.prototype,"undo",2);g([S],up.prototype,"redo",2);g([w],up.prototype,"canUndo",1);g([w],up.prototype,"canRedo",1)});var xKe,kpe,CKe,$M;var Dpe=p(()=>{xKe=(r,e)=>new Promise((t,i)=>{const o=new XMLHttpRequest;o.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){t(n.result)}else{i(new Error(`The image could not be loaded from ${r}`))}};n.onerror=s=>{i(s)};n.readAsDataURL(o.response)};o.open("GET",r);o.responseType="blob";o.withCredentials=e==="use-credentials";o.send()});kpe=(r,e)=>{return new Promise((t,i)=>{const o=new Image;o.onload=()=>{t(o)};o.onerror=()=>{i(new Error(`Failed to load image with src:${r}`))};o.crossOrigin=e;o.src=r})};CKe=(r,e)=>new Promise((t,i)=>{xKe(r,e).then(o=>{const n=new Image;n.addEventListener("load",()=>{t(n)});n.src=o}).catch(()=>{kpe(r,e).then(o=>t(o)).catch(o=>{i(o)})})});$M=async({url:r,image:e,crossOrigin:t="anonymous"})=>{try{if(e&&e.src&&e.src.substr(0,5)==="data:"||e&&e.src&&e.src.includes(".svg")){return e}if(typeof r==="string"&&r.substr(0,5)==="data:"||typeof r==="string"&&r.includes(".svg")){return kpe(r,t)}return CKe(r||e.src,t)}catch(i){throw new Error(i)}}});var SKe,Xi;var Nw=p(()=>{ze();B();W();Dpe();SKe={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};Xi=class{constructor(e){this.setImage=async e=>{try{const{crossOrigin:t}=this.editor.configStore.config.engine;if(typeof e==="string"&&!e.trim()||e===void 0||e===null){this.state.image=null}else if(typeof e==="string"){this.state.image=await $M({url:_s(e)?e:this.editor.assetProvider.getPath(e),crossOrigin:t})}else if(e instanceof HTMLImageElement){this.state.image=await $M({image:e,crossOrigin:t})}if(this.isWebcam){this.state.isWebcam=false}}catch(t){throw new Error(t)}};this.setImageLoadedToEngine=e=>{this.state.imageLoadedToEngine=e};this.newImage=e=>{this.editor.init(e)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=e;this.state=ae(SKe)}selectTool(e){var i,o,n;const{licenseChecker:t}=this.editor.configStore;if(this.state.tool!==e&&(t==null?void 0:t.isToolAllowed(e))&&(this.image||e==="library"||e==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const s=(n=(o=(i=this.editor.configStore.state.config["customTool"])==null?void 0:i.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(e==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,e);this.state.tool=e;this.editor.configStore.events.onToolChanged(e);switch(e){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(e){this.state.isWebcam=e}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};g([S],Xi.prototype,"selectTool",1);g([S],Xi.prototype,"selectWebcam",1);g([S],Xi.prototype,"setImage",2);g([S],Xi.prototype,"setImageLoadedToEngine",2);g([S],Xi.prototype,"newImage",2);g([S],Xi.prototype,"dispose",2);g([w],Xi.prototype,"webcamLabel",1);g([w],Xi.prototype,"tool",1);g([w],Xi.prototype,"isWebcam",1);g([w],Xi.prototype,"image",1);g([w],Xi.prototype,"imageLoadedToEngine",1)});var wKe,KM,XM,ii;var qw=p(()=>{ze();B();W();wKe={height:150,width:150};KM={height:0,width:0};XM=class{constructor(e){this.canvasClickDisabled=ae.box(false);this.resizeCanvas=(e=null)=>{const t=this.editor.activeStore.tool;const i=e==="transform"||!e&&t==="transform";const{isLayoutAdvanced:o,measurements:n}=this.editor.configStore;const{storedSize:s}=this.editor.canvasStore;let a=0;if(!o&&i){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(e==="transform"&&t==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:s.width,height:s.height+a})};this.setCanvasSize=e=>{this.state.canvasSize=e};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=e;this.state=ae(XM.initialState)}setCanvasElement(e){this.canvas=e;this.editor.engineMediator.preview.createPreview(e);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:e,width:t,render:i}){const{imageLoadedToEngine:o}=this.editor.activeStore;if(e>KM.height&&t>KM.width){this.state.storedSize={width:t,height:e};if(this.state.canvasSize.height===0){this.state.canvasSize={width:t,height:e}}if(i&&o){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return F.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(e){const t=this.editor.engine.getContainersAtPreviewPoint(e,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(i=>i.getID()).filter(i=>i!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(t)}};ii=XM;ii.initialState={canvasSize:KM,storedSize:wKe};g([S],ii.prototype,"setCanvasElement",1);g([S],ii.prototype,"saveDimensions",1);g([S],ii.prototype,"resizeCanvas",2);g([S],ii.prototype,"disableCanvasClick",1);g([S],ii.prototype,"enableCanvasClick",1);g([S],ii.prototype,"setCanvasSize",2);g([S],ii.prototype,"dispose",2);g([w],ii.prototype,"isCanvasClickable",1);g([w],ii.prototype,"canvasSize",1);g([w],ii.prototype,"storedSize",1);g([w],ii.prototype,"sizeVector",1);g([w],ii.prototype,"sizeVectorMagnitude",1)});var TKe,Oo;var Hw=p(()=>{ze();B();TKe={type:null,identifier:null,isVisible:false,error:""};Oo=class{constructor(e){this.showActionModal=({type:e,identifier:t,error:i,handleConfirm:o,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=t;this.state.type=e;this.state.error=i||"";this.handleConfirm=o;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=e.configStore;this.state=ae(TKe)}showInfoModal(e){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=e;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:e}=this.state;const t=this.getModalLocale();if(t){const{bodyLabel:i,headerLabel:o,buttonYes:n,buttonNo:s}=t;return{headerLabel:o,bodyLabel:i,confirmLabel:n,dismissLabel:s,isVisible:e,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:e,measurements:{basicCanvasOffset:t,advancedUIToolControlBar:i,advancedUIToolbar:o},isOrderDefault:n}=this.configStore;const s=(i.width+o.width)*(!n?-1:1);const a=t;return e?{x:s/2,y:0}:{x:0,y:-a}}getModalLocale(){const{identifier:e,error:t,type:i}=this.state;const{locale:o}=this.configStore;if(!i||!e||i==="textEdit")return null;if(i&&e&&o[`${i}Modals`]&&o[`${i}Modals`][e]){const n=o[`${i}Modals`][e];let{body:s}=n;if(s&&typeof t==="object"){Object.keys(t).forEach(l=>{s=s.replace(`\${${l}}`,t[l])})}else if(s){s=s.replace("${error}",t)}let a=n.heading;if(i==="error"||i==="warning"){const l={error:o.common.error,warning:o.common.warning};const u=i==="error"?l.error:l.warning;a=`${u}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};g([S],Oo.prototype,"showActionModal",2);g([S],Oo.prototype,"showInfoModal",1);g([S],Oo.prototype,"showTextEditModal",1);g([S],Oo.prototype,"hideModal",2);g([S],Oo.prototype,"dispose",2);g([w],Oo.prototype,"modalProps",1);g([w],Oo.prototype,"isVisible",1);g([w],Oo.prototype,"type",1);g([w],Oo.prototype,"identifier",1);g([w],Oo.prototype,"positionOffset",1)});var vr;var Ww=p(()=>{ze();W();vr=class{constructor(e){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(e=>e/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:e,maxOffsetY:t}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=t}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=e}this.savePosition();this.scaleRender()}};this.setOffset=e=>{const{canDragX:t,canDragY:i}=this.checkOffset(e);if(t){this.offset.x=e.x}if(i){this.offset.y=e.y}this.scaleRender()};this.editor=e}setInitialTransform(e=0){const t=kn();const{scaleImageToFit:i}=this.editor.configStore.config;const{transform:o}=this.editor.engineMediator.preview;lr(()=>{const n=Math.abs(e||o.scale.x);this.setDefaultScale(i?n:Math.min(1*t,n));this.setPosition(o.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:e,height:t}=this.editor.canvasStore.canvas;this.setPosition({x:e/2,y:t/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(e){this.state.position.x=e.x;this.state.position.y=e.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(e){if(this.defaultScale!==1){const i=this.SCALE_LEVELS.findIndex(o=>o===this.defaultScale);if(i!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,i),...this.SCALE_LEVELS.slice(i+1)]}}const t=this.SCALE_LEVELS.findIndex(i=>i===e);if(t!==-1){this.state.scaleIndex=t}else{const i=this.SCALE_LEVELS.findIndex((o,n)=>{if(n===0){return e0;const f=c>0;const b=d-a;const _=m-l;return{canDragX:b<0,canDragY:_<0,maxOffsetX:h?-b:b,maxOffsetY:f?-_:_}}calculateScale(e=0,t=this.previewSize,i=this.defaultScale){const{width:o,height:n}=t;const s=new F({x:o,y:n});const a=new F(Math.abs(s.x*Math.cos(e))+Math.abs(s.y*Math.sin(e)),Math.abs(s.x*Math.sin(e))+Math.abs(s.y*Math.cos(e)));const l=s.subtract(a).divide(2).multiply(i).abs;if(l.y>l.x){return l.y*2/s.y+i}return l.x*2/s.x+i}get defaultIndex(){return this.SCALE_LEVELS.findIndex(e=>e===this.defaultScale)}getPositionWithOffset(e=this.offset){const{position:t}=this;return{x:t.x-e.x,y:t.y-e.y}}scaleRender(e=false){const t=this.editor.scale.getPositionWithOffset();const i=e?this.defaultScale:this.scale;const o={x:i,y:i};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(t);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:t,rotation:0});if(!e){this.editor.render()}}get scale(){const e=this.state.scaleIndex;return e!==-1?this.SCALE_LEVELS[e]:this.defaultScale}get zoomLevel(){const e=kn();return(this.scale/e*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const e=this.state.scaleIndex;const t=e!==-1?this.SCALE_LEVELS[e]:this.defaultScale;const{previewSize:i}=this;return{width:i.width*t/this.defaultScale,height:i.height*t/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};g([ae],vr.prototype,"state",2);g([S],vr.prototype,"in",2);g([S],vr.prototype,"out",2);g([S],vr.prototype,"setInitialTransform",1);g([S],vr.prototype,"resetScale",1);g([S],vr.prototype,"resetPosition",1);g([S],vr.prototype,"setPosition",1);g([S],vr.prototype,"savePosition",1);g([S],vr.prototype,"setDefaultScale",1);g([S],vr.prototype,"setScaleToDefault",1);g([w],vr.prototype,"scale",1);g([w],vr.prototype,"zoomLevel",1);g([w],vr.prototype,"canDrag",1);g([w],vr.prototype,"canZoomOut",1);g([w],vr.prototype,"canZoomIn",1);g([w],vr.prototype,"position",1);g([w],vr.prototype,"scaledSize",1)});var Ope,IKe,Qs,rr;var YM=p(()=>{ze();W();Ope=[[0,0],[0,1],[1,0],[1,1]];IKe=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];Qs=class{constructor(e,t,i="center",o=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=t;this.m=i==="center"?Qs.movePivotTo([.5,.5]):Ope;this.considerRotation=o;this.considerFlip=n;this.configStore=e.configStore}static getFlippedEdgeIndex(e,t,i){return IKe[(t?1:0)+(i?2:0)][e]}static movePivotTo(e){return Ope.map(t=>[t[0]-e[0],t[1]-e[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(e,t,i){const o=Qs.getFlippedEdgeIndex(e,t,i);const n=this.m[o][0]*this.size.width;const s=this.m[o][1]*this.size.height;return{width:n,height:s}}get leftTop(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(0,t,i);return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftBottom(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(1,t,i);return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightTop(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(2,t,i);return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightBottom(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(3,t,i);return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftBottomHandle(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(1,t,i);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get rightBottomHandle(){const{position:e,flipHorizontally:t,flipVertically:i}=this;const o=this.handleOrigin(3,t,i);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Qs.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,e)}get leftMid(){const e=new F(this.leftTop);const t=new F(this.leftBottom);return e.add(t).divide(2)}get rightMid(){const e=new F(this.rightTop);const t=new F(this.rightBottom);return e.add(t).divide(2)}};rr=Qs;rr.coordinatesWithRotation=({width:e,height:t},i,o,n,s,a)=>{let l=e*Math.cos(i)-t*Math.sin(i)+a.x;let u=e*Math.sin(i)+t*Math.cos(i)+a.y;if(o){l=s.x*2-l}if(n){u=s.y*2-u}return new F({x:l,y:u}).rounded};g([w],rr.prototype,"position",1);g([w],rr.prototype,"size",1);g([w],rr.prototype,"rotation",1);g([w],rr.prototype,"flipHorizontally",1);g([w],rr.prototype,"flipVertically",1);g([w],rr.prototype,"flipCenter",1);g([w],rr.prototype,"leftTop",1);g([w],rr.prototype,"leftBottom",1);g([w],rr.prototype,"rightTop",1);g([w],rr.prototype,"rightBottom",1);g([w],rr.prototype,"leftBottomHandle",1);g([w],rr.prototype,"rightBottomHandle",1);g([w],rr.prototype,"leftMid",1);g([w],rr.prototype,"rightMid",1)});var JM=p(()=>{Lw();Mb();Ub();Lb();jM();GM();NM();HM();WM();Uw();Nw();qw();Hw();Ww();YM()});var He;var Rpe=p(()=>{ze();W();DM();He=class{constructor(e,t){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:ae.map({})};this.configStore=e.configStore;this.id=Ge();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=t}changeIdentifier(e){this.state.identifier=e;const t=this.state.cropState.get(`${this.id}-${e}`);if(!t){this.state.cropState.set(`${this.id}-${e}`,{...Gn})}}changeRatio(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){this.state.cropState.set(`${this.id}-${this.identifier}`,{...t,ratio:e})}}changeSize(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e.width&&e.width>0){t.size.width=Math.round(e.width)}if(e.height&&e.height>0){t.size.height=Math.round(e.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}changeHeight(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e){t.size.height=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}}changeWidth(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){if(e){t.size.width=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}}changePositionX(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i&&e<=t-this.minCropSize&&e>=0){i.position.x=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}return false}changePositionY(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i&&e<=t-this.minCropSize&&e>=0){i.position.y=Math.round(e);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}return false}changePosition(e,t){const i=this.state.cropState.get(`${this.id}-${this.identifier}`);if(i){if(e.x<=t.width-this.minCropSize&&e.x>=0&&e.y<=t.height-this.minCropSize&&e.y>=0){i.position.x=Math.round(e.x);i.position.y=Math.round(e.y);this.state.cropState.set(`${this.id}-${this.identifier}`,i);return true}}return false}changeLockResolution(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){t.lockResolution=e!==void 0?e:!t.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}changeForceDimensions(e){const t=this.state.cropState.get(`${this.id}-${this.identifier}`);if(t){t.forceDimensions=e;this.state.cropState.set(`${this.id}-${this.identifier}`,t)}}clearState(){this.state.cropState.forEach((e,t)=>t.startsWith(this.id)&&this.state.cropState.delete(t))}setRotation(e){this.state.rotationInDegrees=e}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:e,flipVertically:t}){this.state.flipHorizontally=e;this.state.flipVertically=t}setOutputRotation(e){this.state.outputRotation=e}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:e,height:t}=this.defaults.maxCropMaskSize;return new F(e/2,t/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:Gn.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:Gn.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:Gn.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:Gn.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:Gn.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:Gn.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:Gn.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:Gn.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:Gn.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};g([ae],He.prototype,"state",2);g([S],He.prototype,"changeIdentifier",1);g([S],He.prototype,"changeRatio",1);g([S],He.prototype,"changeSize",1);g([S],He.prototype,"changeHeight",1);g([S],He.prototype,"changeWidth",1);g([S],He.prototype,"changePositionX",1);g([S],He.prototype,"changePositionY",1);g([S],He.prototype,"changePosition",1);g([S],He.prototype,"changeLockResolution",1);g([S],He.prototype,"changeForceDimensions",1);g([S],He.prototype,"clearState",1);g([S],He.prototype,"setRotation",1);g([S],He.prototype,"resetRotation",1);g([S],He.prototype,"resetOutputRotation",1);g([S],He.prototype,"resetFlip",1);g([S],He.prototype,"updateFlip",1);g([S],He.prototype,"setOutputRotation",1);g([S],He.prototype,"flipHorizontally",1);g([S],He.prototype,"flipVertically",1);g([S],He.prototype,"dispose",2);g([w],He.prototype,"flipCenter",1);g([w],He.prototype,"isFlippedHorizontal",1);g([w],He.prototype,"isFlippedVertical",1);g([w],He.prototype,"identifier",1);g([w],He.prototype,"height",1);g([w],He.prototype,"width",1);g([w],He.prototype,"position",1);g([w],He.prototype,"ratio",1);g([w],He.prototype,"size",1);g([w],He.prototype,"x",1);g([w],He.prototype,"y",1);g([w],He.prototype,"lockResolution",1);g([w],He.prototype,"forceDimensions",1);g([w],He.prototype,"selectedCrop",1);g([w],He.prototype,"rotationInDegrees",1);g([w],He.prototype,"outputRotation",1)});var ZM;var Ape=p(()=>{ze();W();Jh();ZM=class{constructor(e){this.transforms={output:JSON.stringify(bt.IDENTITY),preview:JSON.stringify(bt.IDENTITY)};this.setFrameOpacity=e=>{this.frameOpacity=e;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=e=>{this.overlayOpacity=e;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=e;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:e,flipVertically:t,rotation:i,outputRotation:o}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new F(this.transformToolStore.leftTopRespectFlip).add(new F(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new F(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const s=this.engineMediator.preview.container;const{outputContainer:a}=this.editor;a.setResolution(ve(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:t,flipHorizontally:e});const l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let u=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:f,defaultImageSize:b}=this.transformToolStore;const _=this.transformToolStore.maxCropMaskSize;const y={height:f.height*b.height/_.height,width:f.width*b.width/_.width};u=y.width/this.transformToolStore.localOutputImageSize.width}const c=Math.abs(l.x);const d=u/(c/this.transformToolStore.defaultScale);const m={x:d,y:d};const h=-(i-o);a.setTransform({scale:m,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(e){this.transforms=e}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const e=this.engineMediator.preview.container;const{outputContainer:t}=this.editor;const i=JSON.parse(this.transforms.preview);t.setResolution(ve(this.transformToolStore.defaultImageSize));e.setTransform(i);t.setTransform(JSON.parse(this.transforms.output));const o=i.scale;t.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(i);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(e,t=true){const{width:i,height:o}=this.editor.engineMediator.image.container.getBounds();const n=CJ(e)?{width:o,height:i}:{width:i,height:o};this.editor.outputContainer.rotate(e,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:s}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(s);lr(()=>{this.editor.scale.setInitialTransform();const a=this.getScaleWithFlip(s);this.engineMediator.preview.container.setScale(a);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(t){this.editor.render()}}applyPreviewTransform(){const{rotation:e,flipHorizontally:t,flipVertically:i}=this.transformToolStore.rotateFlipState;const o=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let s=e;if(t){s=Yh(s)}if(i){s=Yh(s)}const a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a)}getScaleWithFlip(e=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:t,flipVertically:i}=this.transformToolStore.rotateFlipState;const o=t?-1:1;const n=i?-1:1;const s=this.editor.scale.calculateScale(e);return{x:s*o,y:s*n}}saveTransforms(){const e=JSON.stringify(this.engineMediator.preview.container.getTransform());const t=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:e,output:t}}saveTransformsBasedOnFlip(){const e=this.engineMediator.preview.container.getTransform();const{scale:t}=e;const{flipVertically:i,flipHorizontally:o}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...e,scale:{x:o?-t.x:t.x,y:i?-t.y:t.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}}});var QM;var Fpe=p(()=>{W();QM=class{constructor(e){this.store=e;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,gr.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}}});var Ppe,cp,le;var e5=p(()=>{ze();B();W();JM();Ii();Ys();Rpe();Ape();Fpe();Ppe="identity";cp=class{constructor(e){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=ae.box(false);this.minCropSize=0;this.transformHistory=new QM(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=e=>{if(!e.trim())return false;let t=this.editor.configStore.config.assetBaseUrl;const{length:i}=t;if(t[i-1]!=="/"){t+="/"}if(`${t}transform`===e){return false}const o=new Image;try{o.src=e;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const e=this.editor.outputContainer.getRotation();if(e!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=e=>{this.localOutputSize.height=Math.round(e.height);this.localOutputSize.width=Math.round(e.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(e.width),height:Math.round(e.height)})};this.changeDefaultScale=e=>{this.defaults.scale=e};this.changeLocalOutputHeight=e=>{this.localOutputSize.height=Math.round(e)};this.changeLocalOutputWidth=e=>{this.localOutputSize.width=Math.round(e)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const e=this.editor.outputContainer.getRotation();const t=this.isFlippedVertical?pR:mR;this.rotateOutputContainer(t(e))};this.rotateAntiClockwise=()=>{const e=this.editor.outputContainer.getRotation();const t=this.isFlippedVertical?mR:pR;this.rotateOutputContainer(t(e))};this.flipHorizontally=(e=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(e);if(e){this.trackChanges()}};this.flipVertically=(e=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(e);if(e){this.trackChanges()}};this.applyDefaultCrop=(e=false)=>{if(this.identifier==="identity"){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,e)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:e,y:t})=>{const i=this.getRatio();const o=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,e),o.x-n.width);const l=Math.min(Math.max(0,t),o.y-n.height);const u=o.x-a;const c=o.y-l;const d={width:Math.max(this.minCropSize,Math.min(u,s.width-a)),height:Math.max(this.minCropSize,Math.min(c,s.height-l))};if(i==="*"){if(this.changePosition({x:a,y:l})){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);const h=new F(o).subtract({x:m.width,y:m.height});if(this.changePosition(h)){this.changeCropAndOutputSize(m,i)}}};this.onLeftBottom=({x:e,y:t})=>{const i=this.getRatio();const o=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,e),o.x-n.width);const l=Math.max(0,t,o.y+n.height);const u=o.x-a;const c=l-o.y;const d={width:Math.max(1,Math.min(u,s.width-a)),height:Math.max(1,Math.min(c,s.height-o.y))};if(i==="*"){if(this.changePositionX(a)){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);if(this.changePositionX(o.x-m.width)){this.changeCropAndOutputSize(m,i)}}};this.onRightTop=({x:e,y:t})=>{const i=this.getRatio();const o=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,e,o.x+n.width);const l=Math.min(Math.max(0,t),o.y-n.height);const u=a-o.x;const c=o.y-l;const d={width:Math.max(1,Math.min(u,s.width-o.x)),height:Math.max(1,Math.min(c,s.height-l))};if(i==="*"){if(this.changePositionY(l)){this.changeCropAndOutputSize(d)}}else{const m=this.proportionalSize(i,d);if(this.changePositionY(o.y-m.height)){this.changeCropAndOutputSize(m,i)}}};this.onRightBottom=({x:e,y:t})=>{const i=this.getRatio();const o=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,e,o.x+n.width);const l=Math.max(0,t,o.y+n.height);const u=a-o.x;const c=l-o.y;const d={width:Math.max(1,Math.min(u,s.width-o.x)),height:Math.max(1,Math.min(c,s.height-o.y))};if(i==="*"){this.changeCropAndOutputSize(d)}else{const m=this.proportionalSize(i,d);this.changeCropAndOutputSize(m,i)}};this.onPixelWidth=e=>{const t=JSON.stringify(ve(this.localOutputSize));const i=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(i&&i.ratio){let n=e;let s=this.localOutputSize.height;let{ratio:a}=i;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(e,o.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(s)})}else{const l=cp.placeCropMask(a,o);n=Math.max(Math.min(n,l.width),this.minCropSize);s=n/a;this.changeLocalOutputSize({height:s,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(t));return Math.round(n)}return e};this.onPixelHeight=e=>{const t=JSON.stringify(ve(this.localOutputSize));const i=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(i&&i.ratio){let n=e;let s=this.localOutputSize.width;let{ratio:a}=i;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(e,o.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(n)})}else{const l=cp.placeCropMask(a,o);n=Math.max(Math.min(n,l.height),this.minCropSize);s=n*a;this.changeLocalOutputSize({height:n,width:s})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(t));return Math.round(n)}return e};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=e=>{this.transformations.setFrameOpacity(e)};this.setOverlayOpacity=e=>{this.transformations.setOverlayOpacity(e)};this.closestRatioReducer=e=>(t,i)=>{if(i===null)return-1;return Math.abs(e-t.ratio)(t,i)=>{if(i===null)return-1;const o=Math.abs(t.dimensions.x/t.dimensions.y);const n=Math.abs(i.dimensions.x/i.dimensions.y);if(o===n){return t.dimensions.x*t.dimensions.y>i.dimensions.x*i.dimensions.y?-1:1}return Math.abs(e-o){const e=this.entityManager.items.findIndex(l=>l.identifier==="imgly_transform_common_custom");if(e!==-1)return this.entityManager.items[e];const t=this.entityManager.items.findIndex(l=>l.ratio==="*");if(t!==-1)return this.entityManager.items[t];const i=ve(this.editor.outputContainer.getResolution());const o=Math.abs(i.width/i.height);const[n]=this.entityManager.items.filter(l=>l.ratio&&typeof l.ratio==="number").sort(this.closestRatioReducer(o));const[s]=this.entityManager.items.filter(l=>l.dimensions&&!l.ratio).sort(this.closestDimensionsReducer(o));if(!n||!s||!n.ratio&&!s.dimensions){return this.entityManager.items[0]}if(!s||!s.dimensions)return n;if(!n||!n.ratio)return s;const a=Math.abs(s.dimensions.x/s.dimensions.y);if(a===n.ratio)return n;return Math.abs(o-n.ratio){let t=this.entityManager.items.find(i=>i.identifier===e);if(!t){t=this.getMatchingItem()}return t};this.editor=e;this.selectedCategory=Ppe;this.transformStore=new He(e,this.defaults);this.transformations=new ZM(e);const{enableRotation:t,enableFlip:i,...o}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new or(n,{...o,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new rr(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new rr(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(e){return e*Math.PI/180}static placeCropMask(e,t){if(t.height*e>t.width){const o=t.width/e;return{height:o,width:t.width,yChanged:true}}const i=t.height*e;return{height:t.height,width:i,yChanged:false}}changeIdentifier(e,t=false){this.transformStore.changeIdentifier(e);const i=this.getCropMask(e,this.defaults.imageSize);if(i){this.transformStore.changeRatio(i.ratio);this.changeLocalOutputSize(i);this.updatePreviewSizeWRTImageSize();if(i.yChanged!==void 0){this.updateInitialCropMaskPosition(i.yChanged)}if(i.dimensions){this.changeLocalOutputSize({width:i.dimensions.x,height:i.dimensions.y})}if(t){this.trackChanges()}}}setDragMode(e){this.dragMode.set(e)}getCropMask(e,t){const i=this.getTransform(e);if(i){const{ratio:o,forceDimensions:n,lockDimensions:s,dimensions:a=null}=i;if(n){this.transformStore.changeForceDimensions(n)}if(s){this.transformStore.changeLockResolution(s)}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return{...t,yChanged:void 0,ratio:"*",dimensions:a};default:return{...cp.placeCropMask(i.ratio,t),ratio:i.ratio,dimensions:a}}}else{const{x:l,y:u}=i.dimensions;return{...cp.placeCropMask(l/u,t),ratio:null,dimensions:a}}}return null}setCropDefaults(e=false){const t=this.editor.outputContainer.getResolution();this.setDefaultImageSize(t);const i=this.editor.getPreviewSize();const{position:o}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(i);this.setDefaultCropPosition({x:o.x-i.width/2,y:o.y-i.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!e){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(e){this.defaults.imageSize={...ve(e)};if(!this.lockResolution){this.localOutputSize={...ve(e)}}}setMaxCropSize(e){this.defaults.maxCropMaskSize.height=e.height;this.defaults.maxCropMaskSize.width=e.width}setDefaultCropPosition(e){this.defaults.cropMaskPosition.x=e.x;this.defaults.cropMaskPosition.y=e.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(e){this.selectedCategory=this.selectedCategory===e?Ppe:e}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=JSON.stringify(this.engineMediator.preview.container.getTransform());const t=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:e,output:t})}changePosition(e){return this.transformStore.changePosition(e,this.defaults.maxCropMaskSize)}changePositionX(e){return this.transformStore.changePositionX(e,this.defaults.maxCropMaskSize.width)}changePositionY(e){return this.transformStore.changePositionY(e,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:e,height:t},i,o=true){this.transformStore.changeWidth(e);this.transformStore.changeHeight(t);if(!this.lockResolution){const{height:n,width:s}=this.defaults.maxCropMaskSize;const{height:a,width:l}=this.defaults.imageSize;let u=a/n*t;const c=l/s*e;if(i){u=c/i}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(c),height:Math.round(u)})}if(t>=this.minCropSize){this.changeLocalOutputHeight(u)}if(e>=this.minCropSize){this.changeLocalOutputWidth(c)}}}transformRender(e=true){this.transformations.applyPreviewTransform();if(e){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:e,flipVertically:t}=this.rotateFlipState;const{identifier:i,rotationInDegrees:o}=this;const n=qc(o);const s=dR(j0(this.editor.engineMediator.output.container.getRotation())+o);const{start:a,end:l}=this.convertUIToOperationOptions(n,s);return{flipHorizontally:e,flipVertically:t,rotation:n,start:a,end:l,identifier:i,outputRotation:s}}getStartEndForOperation(e){const{leftTop:t,rightBottom:i,maxCropMaskSize:o}=this;const n=t.y;const s=t.x;const a=i.x;const l=i.y;switch(e){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}getStartEndForUI(e,t,i){const{maxCropMaskSize:o}=this;const n=t.y;const s=t.x;const a=i.x;const l=i.y;switch(e){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}convertOperationOptionsToUI({start:e,end:t,rotation:i,outputRotation:o}){const n=o===90||o===270;const s=n?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const a=Math.cos(i);const l=Math.sin(i);const u=this.calculateScale(i);const c=new F(Math.min(e.x,t.x),Math.min(e.y,t.y));const d=new F(Math.max(e.x,t.x),Math.max(e.y,t.y));const m=d.subtract(c).divide(2);const h=c.add(m).multiply(s);const f=h.subtract(s.multiply(.5));const b=new F(f.x*a-f.y*l,f.x*l+f.y*a).multiply(u);const _=s.multiply(.5).add(b);const y=_.divide(s);const I=y.subtract(m.multiply(u));const T=y.add(m.multiply(u));const D=n?F.fromSize(this.maxCropMaskSize).swapped:F.fromSize(this.maxCropMaskSize);const P=I.multiply(D);const k=T.multiply(D);const{leftTop:A,rightBottom:Q}=this.getStartEndForUI(o,P,k);return{start:new F(A),end:new F(Q)}}convertUIToOperationOptions(e,t){const i=t===90||t===270;const o=i?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const n=i?F.fromSize(this.maxCropMaskSize).swapped:F.fromSize(this.maxCropMaskSize);const s=Math.cos(-e);const a=Math.sin(-e);const l=this.calculateScale(e,i);const{leftTop:u,rightBottom:c}=this.getStartEndForOperation(t);const d=new F(u).divide(n);const m=new F(c).divide(n);const h=m.subtract(d).divide(2);const f=d.add(h).multiply(o);const b=f.subtract(o.multiply(.5));const _=new F(b.x*s-b.y*a,b.x*a+b.y*s).divide(l);const y=o.multiply(.5).add(_);const I=y.divide(o);const T=I.subtract(h.divide(l));const D=I.add(h.divide(l));return{start:T,end:D}}calculateScale(e,t=false){const i=t?F.fromSize(this.defaultImageSize).swapped:F.fromSize(this.defaultImageSize);const o=new F(Math.abs(i.x*Math.cos(e))+Math.abs(i.y*Math.sin(e)),Math.abs(i.x*Math.sin(e))+Math.abs(i.y*Math.cos(e)));const n=i.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/i.y+1:n.x*2/i.x+1}updateStateFromSerialization(e){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=Math.round(j0(e.rotation));this.transformStore.setRotation(t>180?t-360:t);this.transformations.rotateOutputContainer(qc(dR(e.outputRotation||0)));if(e.identifier){this.transformStore.changeIdentifier(e.identifier)}if(e.start&&e.end){if(e.end.x===0||e.end.y===0){e.end.x=1;e.end.y=1}const{start:i,end:o}=this.convertOperationOptionsToUI({start:new F(e.start),end:new F(e.end),rotation:e.rotation,outputRotation:e.outputRotation});this.changePositionX(i.x);this.changePositionY(i.y);const n=o.x-i.x;const s=o.y-i.y;this.transformStore.changeSize({width:n,height:s});const{maxCropMaskSize:a,imageSize:l}=this.defaults;const u={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(u)}if(e.flipHorizontally){this.flipHorizontally(false)}if(e.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(e){this.defaultAngle=e}updateCanvasControls(e){const t=ve(this.cropMaskPosition);const i=ve(this.cropMaskSize);const o=ve(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*i.height/e.height,width:o.width*i.width/e.width},void 0,false);this.changePosition({y:o.height*t.y/e.height,x:o.width*t.x/e.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(e){this.transformStore.setRotation(e);this.transformRender()}async rotateOutputContainer(e,t=true){this.setDragMode(true);this.transformations.rotateOutputContainer(e,t);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,false)}clickableCanvas(e){this.editor.clickableCanvas(e)}proportionalSize(e,t,i=this.defaults.maxCropMaskSize,o=this.minCropSize){let n=t.height*e;let{height:s}=t;if(n>i.width||n1){return{width:this.minCropSize*e,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*e}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const e=this.getTransform(this.identifier);if(e){if(Object.prototype.hasOwnProperty.call(e,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return e.ratio}const{x:t,y:i}=e.dimensions;return t/i}return"*"}};le=cp;g([ae],le.prototype,"selectedCategory",2);g([ae],le.prototype,"defaults",2);g([ae],le.prototype,"localOutputSize",2);g([S],le.prototype,"changeIdentifier",1);g([S],le.prototype,"setDragMode",1);g([S],le.prototype,"setCropDefaults",1);g([S],le.prototype,"setDefaultImageSize",1);g([S],le.prototype,"setMaxCropSize",1);g([S],le.prototype,"setDefaultCropPosition",1);g([S],le.prototype,"resetCrop",1);g([S],le.prototype,"toggleCategorySelection",1);g([S],le.prototype,"pureReset",1);g([S],le.prototype,"reset",2);g([S],le.prototype,"changePosition",1);g([S],le.prototype,"changePositionX",1);g([S],le.prototype,"changePositionY",1);g([S],le.prototype,"changeCropAndOutputSize",1);g([S],le.prototype,"onLeave",1);g([S],le.prototype,"onEnter",1);g([S],le.prototype,"changeLocalOutputSize",2);g([S],le.prototype,"changeDefaultScale",2);g([S],le.prototype,"changeLocalOutputHeight",2);g([S],le.prototype,"changeLocalOutputWidth",2);g([S],le.prototype,"changeLockResolution",2);g([S],le.prototype,"setRotation",1);g([S],le.prototype,"rotateClockwise",2);g([S],le.prototype,"rotateAntiClockwise",2);g([S],le.prototype,"rotateOutputContainer",1);g([S],le.prototype,"flipHorizontally",2);g([S],le.prototype,"flipVertically",2);g([S],le.prototype,"applyDefaultCrop",2);g([S],le.prototype,"applyInitialCrop",1);g([S],le.prototype,"updateCropMask",2);g([S],le.prototype,"clickableCanvas",1);g([S],le.prototype,"onLeftTop",2);g([S],le.prototype,"onLeftBottom",2);g([S],le.prototype,"onRightTop",2);g([S],le.prototype,"onRightBottom",2);g([S],le.prototype,"proportionalSize",1);g([S],le.prototype,"onPixelWidth",2);g([S],le.prototype,"onPixelHeight",2);g([S],le.prototype,"updateInitialCropMaskPosition",1);g([S],le.prototype,"updatePreviewSizeWRTImageSize",1);g([S],le.prototype,"dispose",2);g([w],le.prototype,"cropState",1);g([w],le.prototype,"identifier",1);g([w],le.prototype,"ratio",1);g([w],le.prototype,"height",1);g([w],le.prototype,"width",1);g([w],le.prototype,"localOutputImageSize",1);g([w],le.prototype,"localOutputHeight",1);g([w],le.prototype,"localOutputWidth",1);g([w],le.prototype,"lockResolution",1);g([w],le.prototype,"forceDimensions",1);g([w],le.prototype,"rotationInDegrees",1);g([w],le.prototype,"outputRotation",1);g([w],le.prototype,"isDragMode",1);g([w],le.prototype,"rotateFlipState",1);g([w],le.prototype,"selectedCategoryIdentifier",1);g([w],le.prototype,"categories",1);g([w],le.prototype,"items",1);g([w],le.prototype,"config",1);g([w],le.prototype,"locale",1);g([w],le.prototype,"isOptionSelected",1);g([w],le.prototype,"leftTop",1);g([w],le.prototype,"leftBottom",1);g([w],le.prototype,"rightTop",1);g([w],le.prototype,"rightBottom",1);g([w],le.prototype,"isFlippedHorizontal",1);g([w],le.prototype,"isFlippedVertical",1);g([w],le.prototype,"leftTopRespectFlip",1);g([w],le.prototype,"leftBottomRespectFlip",1);g([w],le.prototype,"rightTopRespectFlip",1);g([w],le.prototype,"rightBottomRespectFlip",1);g([w],le.prototype,"cropMaskPosition",1);g([w],le.prototype,"cropMaskSize",1);g([w],le.prototype,"state",1);g([w],le.prototype,"defaultImageSize",1);g([w],le.prototype,"maxCropMaskSize",1);g([w],le.prototype,"minCropMaskSize",1);g([w],le.prototype,"defaultCropMaskPosition",1);g([w],le.prototype,"defaultScale",1)});var Bpe=p(()=>{DM();e5()});var Mpe,EKe,t5,kKe,qb,fe;var r5=p(()=>{ze();Mpe=v(Pm());B();W();Ii();YM();Jh();gM();bM();xM();TM();EKe={};t5="none";kKe={position:{x:0,y:0},rotation:0};qb=class{constructor(e){this.state=ae.map(EKe);this.selectedId=ae.box(t5);this.editMode=ae.box(false);this.dragMode=ae.box(false);this.minLength=0;this.counter=0;this.addSticker=async(e,t=true)=>{await this.addStickerAsync(e,t)};this.addStickerAsync=async({spriteId:e,state:t,transform:i},o=true)=>{return new Promise((n,s)=>{i=this.getInitialTransform(i);const{identifier:a}=t;const l=this.editor.orderHelper.addSprite(a);this.editor.engine.addStickerFromAssets(a,this.editor.engineMediator.image.container,l).then(async u=>{if(e){u.setData({id:e})}const c=u.getID();this.container[c]=u;this.editor.orderHelper.renameSprite(a,c);const d=this.getSize(c);d.width*=u.getScale().x;d.height*=u.getScale().y;u.setPivot(.5,.5);let m;if(i.scale){m=i.scale}else if(i.size){m={x:i.size.width/d.width,y:i.size.height/d.height}}else{const _=this.editor.shortestOutputSide*.4;const y=qb.magnitude(_)/qb.sizeMagnitude(u.getSizeInWorldSpace());m={x:y,y}}const{flipHorizontally:h,flipVertically:f}=this.editor.outputContainer.getData();u.setFlipHorizontally(h);u.setFlipVertically(f);u.setTransform({position:i.position,scale:m,rotation:i.rotation});if(t.flipHorizontally!==void 0){u.setFlipHorizontally(t.flipHorizontally!==h)}if(t.flipVertically!==void 0){u.setFlipVertically(t.flipVertically!==f)}this.setContainerProperties(c,{...t});const b=u.getData();this.setInitialSpriteState(c,"sticker");this.stickerToolStore.setState(c,{...b,identifier:a});await this.editor.renderPromise();if(o){this.setId(c);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(u=>{console.error(u);s()})})};this.addText=async(e,t=true)=>{await this.addTextAsync(e,t)};this.addTextAsync=({spriteId:e,state:t,transform:i},o=true)=>{return new Promise((n,s)=>{i=this.getInitialTransform(i);const a=this.editor.orderHelper.addSprite(t.identifier);const l=this.editor.shortestOutputSide;const u={fontIdentifier:t.identifier,text:t.text,width:t.width||l*.6,fontSize:t.fontSize||l*.1,lineHeight:t.lineHeight,alignment:t.alignment,textColor:t.textColor,backgroundColor:t.backgroundColor};this.editor.engine.addTextWithFontLoading(u,this.editor.engineMediator.image.container,a).then(async c=>{if(e){c.setData({id:e})}const d=c.getID();this.container[d]=c;this.editor.orderHelper.renameSprite(t.identifier,d);const{flipHorizontally:m,flipVertically:h}=this.editor.outputContainer.getData();c.setFlipHorizontally(m);c.setFlipVertically(h);c.setPivot(.5,.5);c.setPosition(i.position);c.setRotation(i.rotation);this.setInitialSpriteState(d,"text");const f=c.getData();this.textToolStore.setState(d,{...f});await this.editor.renderPromise();if(o){this.setId(d);this.addSnapshot("add",this.textLocale.add)}n()}).catch(c=>{console.error(c);s()})})};this.addTextDesign=async(e,t=true,i=false)=>{try{await this.addTextDesignAsync(e,t,i)}catch(o){console.warn(o)}};this.addTextDesignAsync=({spriteId:e,state:t,transform:i},o=true,n=false)=>{return new Promise((s,a)=>{i=this.getInitialTransform(i);const l=this.editor.orderHelper.addSprite(t.identifier);const u=this.editor.shortestOutputSide;const c={width:t.width||u*.6,text:t.text,color:t.color,inverted:t.isInverted,seed:t.seed,padding:t.padding};this.editor.engine.addTextDesignAsync(t.identifier,c,this.editor.engineMediator.image.container,l).then(async d=>{if(e){if(n){this.pureRemoveSprite(e);this.textDesignToolStore.state.delete(e)}d.setData({id:e})}const m=d.getID();this.container[m]=d;this.editor.orderHelper.renameSprite(t.identifier,m);const{flipHorizontally:h,flipVertically:f}=this.editor.outputContainer.getData();d.setFlipHorizontally(h);d.setFlipVertically(f);d.setPivot(.5,.5);d.setPosition(i.position);d.setRotation(i.rotation);this.setInitialSpriteState(m,"textdesign");const b=d.getData();this.textDesignToolStore.setState(m,{...b,identifier:t.identifier});await this.editor.renderPromise();if(o){this.setId(m);this.addSnapshot("add",this.textDesignLocale.add)}s()}).catch(d=>{a(d)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=e=>{this.editor.clickableCanvas(e)};this.setContainerProperties=(e,t,i=false)=>{this.container[e].setData(t);if(i){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(e,t)=>{this.container[e].setPosition(t)};this.pureRemoveSprite=e=>{this.editor.engine.removeContainer(this.container[e]);const t=this.container[e].getIndexInParent();if(t===-1){delete this.container[e];this.state.delete(e);this.editor.orderHelper.removeSprite(e);return true}return false};this.deleteSprite=(e=this.id)=>{const t=this.state.get(e);if(t.tool==="sticker"){this.stickerToolStore.delete()}else if(t.tool==="text"){this.textToolStore.delete()}else if(t.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=e=>{const t=this.pureRemoveSprite(e);if(t){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(e,t)=>{this.editor.addSnapshot(void 0,e,t)};this.spriteSnapshot=e=>{this.addSnapshot("edit",this.historyLocale[e])};this.addNewText=async(e,t)=>{if(this.textToolStore.doesTextAssetExist(t.identifier)){await this.addTextAsync({...e,state:t},false)}else{throw new En(t.identifier)}};this.addNewTextDesign=async(e,t)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(t.identifier)){await this.addTextDesignAsync({...e,state:t},false)}else{throw new En(t.identifier)}};this.addNewSticker=async(e,t)=>{if(this.stickerToolStore.doesStickerAssetExist(t.identifier)){await this.addStickerAsync({...e,state:t},false)}else{throw new En(t.identifier)}};this.getSpriteHistoryState=()=>{const e=ve(this.textToolStore.state);const t=ve(this.textDesignToolStore.state);const i={common:ve(this.state),["sticker"]:ve(this.stickerToolStore.state),["text"]:e,["textdesign"]:t,spriteIdList:Object.keys(this.container)};Object.keys(i.common).forEach(o=>{i.common[o].size=this.container[o].getSizeInWorldSpace();i.common[o].position=this.container[o].getPosition();i.common[o].order=this.container[o].getIndexInParent()});return i};this.updateStateFromSerialization=async(e,t,i)=>{if(t&&t.length){try{const o=await Promise.all(t.map(async({svg:n,raster:s,name:a,identifier:l})=>{const u=(n==null?void 0:n.data)?"image/svg+xml":s.type;const c=`data:${u};base64,${(n==null?void 0:n.data)||s.data}`;const d=await Aw(c,150);return{stickerURI:c,thumbnailURI:d,name:a,type:u,identifier:l}}));await this.stickerToolStore.addCustomStickerAsset(o)}catch(o){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(e.text){await this.textToolStore.loadFonts()}if(e.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(e.spriteIdList,e,i)};this.updateStateFromHistory=async e=>{const t=Object.keys(this.container);const i=t.filter(o=>e.spriteIdList.indexOf(o)===-1);i.forEach(o=>{this.pureRemoveSprite(o)});await this.updateStateByHistoryState(e.spriteIdList,e,0)};this.serializableState=async()=>{const e=this.editor.spriteStore.getSpriteHistoryState();Object.keys(e.common).forEach(i=>{const{flipHorizontally:o,flipVertically:n}=this.editor.outputContainer.getData();const s=this.editor.outputContainer.getRotation();const a=n!==o?-e.common[i].rotation:e.common[i].rotation;e.common[i].rotation=n!==o?a+s:a-s});const t=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:i,type:o,stickerURI:n,name:s})=>{const a={identifier:i,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]}}if(o==="image/jpeg"||o==="image/png"||o==="image/gif"){[,a.raster.data]=n.split(",");a.raster.type=o}else{const l=await Aw(n);[,a.raster.data]=l.split(",");a.raster.type="image/png"}return a}));return{sprite:e,customStickers:t}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(e=>{this.updatePositionAndSize(e,true);const t=this.state.get(e);if(t){if(t.tool==="text"){const i=this.getContainerProperties(e);this.textToolStore.changeSize(e,i)}else if(t.tool==="textdesign"){const i=this.getContainerProperties(e);this.textToolStore.changeWidth(i.width)}}})};this.setEditMode=e=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(e){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(e)}}};this.setDragMode=e=>{this.dragMode.set(e)};this.setPosition=e=>{const t=this.currentSprite;const i=this.container[this.id];if(t&&i){i.setPosition(this.editor.previewToWorld(e));const{position:o}=this.getSizePositionFromContainer();t.position.x=o.x;t.position.y=o.y;this.state.set(this.id,t);this.editor.render()}};this.setSize=e=>{const t=this.currentSprite;if(t){t.size.width=e.width;t.size.height=e.height;this.state.set(this.id,t)}};this.setRotation=e=>{const t=this.currentSprite;if(t){const{flipHorizontally:i,flipVertically:o}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const s=Ab({rotation:e,outputRotation:n,flipHorizontally:i,flipVertically:o});this.container[this.id].setRotation(s);t.rotation=this.container[this.id].getRotation();this.state.set(this.id,t);this.editor.render()}};this.onCanvasClick=e=>{if(!this.isEditMode){this.selectHighestOrderSprite(e)}};this.select=e=>{const t=this.state.get(e);if(t){const i=this.editor.activeStore.tool;if(i!==t.tool){this.editor.activeStore.selectTool(t.tool)}this.setId(e)}};this.selectLast=()=>{const e=this.editor.orderHelper.getLastSpriteId();if(e){this.select(e)}};this.selectNext=()=>{if(this.currentSprite){const e=this.container[this.id];const t=e.getIndexInParent();if(t){const i=Object.keys(this.container).find(o=>this.container[o].getIndexInParent()===t-1);if(i){this.select(i)}}}};this.deselect=()=>{this.setId(t5)};this.bringToFront=async e=>{const t=this.editor.orderHelper.bringToFront(e);this.container[e].setIndexInParent(t);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=e=>{const t=this.state.get(e);const i=this.container[e];i.setFlipHorizontally(!i.getFlipHorizontally());t.flipHorizontally=i.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(e,t);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(e=>{this.pureRemoveSprite(e)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=e=>{const t=this.editor.brushToolStore.containerId();e=e.filter(n=>n!==t);if(e.length<1){this.deselect();return}let i="";let o=0;e.forEach(n=>{const s=this.container[n];const a=s&&s.getIndexInParent()||0;if(a>=o){o=a;i=n}});this.select(i)};this.onCornerDrag=({x:e,y:t})=>{if(this.currentSprite){const i=new F(this.currentSprite.position);const o=new F(e,t);const n=o.subtract(i).magnitude;const s=this.getSize();const a=n*2/qb.sizeMagnitude(s);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:s.width*a,height:s.height*a})}else{const l=this.rotationWRTOutputRotation;const u=o.subtract(i);const c=Math.cos(l);const d=Math.sin(l);const m=Math.max(Math.abs(u.x*c*2+u.y*d*2),this.minLength);const h=Math.max(Math.abs(u.x*-d*2+u.y*c*2),this.minLength);this.setStickerSize({width:m,height:h})}}else if(this.isSpriteText){this.setTextSize(s.width*a)}else if(this.isSpriteTextDesign){this.setTextDesignScale(a)}}this.editor.render()}};this.onWidthDrag=({x:e,y:t})=>{const i=new F(this.currentSprite.position);const o=new F(e,t);const n=o.subtract(i).magnitude;const s=this.editor.previewToWorld(2*n);if(s>this.minLength){this.setContainerProperties(this.id,{width:s},true);if(this.isSpriteText){const a=this.getContainerProperties(this.id);this.textToolStore.changeWidth(a.width)}}};this.onPaddingDrag=({x:e,y:t})=>{if(this.isSpriteTextDesign){let i=this.getContainerProperties(this.id);const o=new F(this.currentSprite.position);const n=new F(e,t);const s=n.subtract(o).magnitude;const a=Math.max(this.editor.previewToWorld(s)-i.width/2,0);this.setContainerProperties(this.id,{padding:a},true);if(this.isSpriteTextDesign){i=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(i.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:e,flipVertically:t}=this.editor.outputContainer.getData();Object.values(this.container).forEach(i=>{if(i.type==="text"||i.type==="text-design"){i.setFlipHorizontally(e);i.setFlipVertically(t)}})};this.reverseTextHorizontally=e=>{Object.values(this.container).forEach(t=>{if(t.type==="text"||t.type==="text-design"){t.setFlipHorizontally(e)}})};this.reverseTextVertically=e=>{Object.values(this.container).forEach(t=>{if(t.type==="text"||t.type==="text-design"){t.setFlipVertically(e)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=e=>{return this.container[e].getData()};this.getContainerTransform=e=>{return this.container[e].getTransform()};this.getDuplicateContainerTransform=e=>{const t=this.container[e].getTransform();const i=this.editor.shortestOutputSide*.1;const o=new F(t.position).add(new F(i,i));return{...t,position:o}};this.getDuplicateContainerFlip=e=>{const t=this.container[e].getFlipHorizontally();const i=this.container[e].getFlipVertically();return{flipHorizontally:t,flipVertically:i}};this.updatePositionAndSize=(e=this.id,t=false)=>{const{position:i,size:o}=this.getSizePositionFromContainer(e);const n=this.state.get(e);if(n){n.position.x=i.x;n.position.y=i.y;n.size.width=o.width;n.size.height=o.height;if(t){const s=this.container[e].getRotation();this.container[e].setRotation(s);n.rotation=this.container[e].getRotation()}this.state.set(e,n)}};this.getInitialTransform=e=>{const t=this.editor.outputToWorld(kKe.position);if(!e){const i=this.editor.outputContainer.getRotation();return{rotation:i,position:t}}return{position:t,...e}};this.setInitialSpriteState=(e,t)=>{const i=this.container[e];const{position:o,size:n}=this.getSizePositionFromContainer(e);const s=i.getRotation();const a=t!=="sticker"?false:i.getFlipHorizontally();const l=t!=="sticker"?false:i.getFlipVertically();this.state.set(e,{tool:t,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l})};this.setStickerSize=e=>{const t=this.container[this.id];t.setSizeInWorldSpace(this.editor.previewSizeToWorld(e));const i=this.currentSprite;if(i){i.size=this.editor.worldSizeToPreview(t.getSizeInWorldSpace());this.state.set(this.id,i)}};this.setTextSize=e=>{let t=this.getContainerProperties(this.id);const i={width:this.editor.previewToWorld(e)};const o=i.width/t.width;const n={fontSize:Math.round(t.fontSize*o)};const s=this.isSpriteText?{...i,...n}:i;if(i.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,s,true);t=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(t.fontSize,true);this.textToolStore.changeWidth(t.width)}};this.setTextDesignScale=e=>{let t=this.getContainerProperties(this.id);const i=t.width*e;if(i>this.minLength){this.setContainerProperties(this.id,{width:i},true);const{width:o}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(o);t=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(t.padding)}};this.getSizePositionFromContainer=(e=this.id)=>{const t=this.container[e];if(t){const i=this.editor.worldToPreview(t.getPosition());const o=this.editor.worldSizeToPreview(t.getSizeInWorldSpace());return{position:i,size:o}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(e=this.id)=>{const t=this.container[e];if(t){return this.editor.worldSizeToPreview(t.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=e;this.container={};this.stickerToolStore=new je(e);this.textToolStore=new Ee(e);this.textDesignToolStore=new $e(e);this.rect=new rr(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(e,t){return new F(e,t||e).magnitude}static sizeMagnitude(e){return Math.sqrt(e.width*e.width+e.height*e.height)}async updateStateByHistoryState(e,t,i){await(0,Mpe.default)(e,async o=>{const n=t.common[o];if(!n)return;if(this.state.get(o)){this.updateExistingItem(o,t)}else{await this.addNewItem(o,t)}});e.forEach(o=>{const n=t.common[o];const s=this.container[o];if(!n||!s)return;s.setIndexInParent(n.order+i)});this.counter+=1}async addNewItem(e,t){const i=t.common[e];const o=i.size?{width:this.editor.worldToPreview(i.size.width),height:this.editor.worldToPreview(i.size.height)}:void 0;const{flipHorizontally:n,flipVertically:s}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=s!==n?i.rotation-a:i.rotation+a;const u=s!==n?-l:l;const c={spriteId:e,transform:{size:o,position:new F(i.position),rotation:u}};if(t.text[e]){const d=t.text[e];const m=this.textToolStore.validFontWithConfig(d.identifier);d.identifier=m==null?void 0:m.identifier;await this.addNewText(c,d);return}if(t.textdesign[e]){await this.addNewTextDesign(c,t.textdesign[e]);return}if(t.sticker[e]){const d=this.stickerToolStore.items.find(m=>m.identifier===t.sticker[e].identifier);await this.addNewSticker(c,{...t.sticker[e],flipHorizontally:i.flipHorizontally,flipVertically:i.flipVertically,resizeMode:t.sticker[e].resizeMode||(d==null?void 0:d.resizeMode)||"keepAspect"})}}updateExistingItem(e,t){const i=t.common[e];const o=this.state.get(e);this.state.set(e,o);const n=this.container[e];n.setPosition(new F(i.position));n.setRotation(i.rotation);o.rotation=n.getRotation();if(i.flipHorizontally!==void 0){n.setFlipHorizontally(i.flipHorizontally)}if(i.flipVertically!==void 0){n.setFlipVertically(i.flipVertically)}if(t.text[e]){const s=t.text[e];this.textToolStore.updateStateFromHistory(e,{...s,fontIdentifier:s.identifier})}if(t.textdesign[e]){const s=t.textdesign[e];this.textDesignToolStore.updateStateFromHistory(e,{...s,inverted:s.isInverted})}if(t.sticker[e]){n.setSizeInWorldSpace(i.size);this.stickerToolStore.updateStateFromHistory(e,t.sticker[e])}this.updatePositionAndSize(e)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==t5}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:e,flipVertically:t}=this.editor.outputContainer.getData();const i=this.editor.outputContainer.getRotation();return Ab({rotation:this.currentSprite.rotation-i,flipHorizontally:e,flipVertically:t})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const e=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:e,y:t}=this.currentSprite.position;const{height:i,width:o}=this.currentSprite.size;return{x:Math.round(e-o/2),y:Math.round(t-i/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:e}=this.rect;return{x:e.x-this.editor.worldToPreview(this.padding),y:e.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:e}=this.rect;return{x:e.x+this.editor.worldToPreview(this.padding),y:e.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(e){this.selectedId.set(e)}};fe=qb;g([ae],fe.prototype,"counter",2);g([S],fe.prototype,"addSticker",2);g([S],fe.prototype,"addStickerAsync",2);g([S],fe.prototype,"addText",2);g([S],fe.prototype,"addTextAsync",2);g([S],fe.prototype,"addTextDesign",2);g([S],fe.prototype,"addTextDesignAsync",2);g([S],fe.prototype,"clickableCanvas",2);g([S],fe.prototype,"setContainerProperties",2);g([S],fe.prototype,"setContainerPosition",2);g([S],fe.prototype,"pureRemoveSprite",2);g([S],fe.prototype,"deleteSprite",2);g([S],fe.prototype,"removeSprite",2);g([S],fe.prototype,"addSnapshot",2);g([S],fe.prototype,"addNewText",2);g([S],fe.prototype,"addNewTextDesign",2);g([S],fe.prototype,"addNewSticker",2);g([S],fe.prototype,"updateStateFromSerialization",2);g([S],fe.prototype,"updateStateFromHistory",2);g([S],fe.prototype,"updateCanvasControls",2);g([S],fe.prototype,"setEditMode",2);g([S],fe.prototype,"setDragMode",2);g([S],fe.prototype,"setPosition",2);g([S],fe.prototype,"setSize",2);g([S],fe.prototype,"setRotation",2);g([S],fe.prototype,"onCanvasClick",2);g([S],fe.prototype,"select",2);g([S],fe.prototype,"selectLast",2);g([S],fe.prototype,"selectNext",2);g([S],fe.prototype,"deselect",2);g([S],fe.prototype,"bringToFront",2);g([S],fe.prototype,"flipHorizontally",2);g([S],fe.prototype,"pureReset",2);g([S],fe.prototype,"onCornerDrag",2);g([S],fe.prototype,"onWidthDrag",2);g([S],fe.prototype,"onPaddingDrag",2);g([S],fe.prototype,"correctTextFlip",2);g([S],fe.prototype,"reverseTextHorizontally",2);g([S],fe.prototype,"reverseTextVertically",2);g([S],fe.prototype,"dispose",2);g([w],fe.prototype,"currentSprite",1);g([w],fe.prototype,"padding",1);g([w],fe.prototype,"isEditMode",1);g([w],fe.prototype,"isDragMode",1);g([w],fe.prototype,"id",1);g([w],fe.prototype,"isSpriteSelected",1);g([w],fe.prototype,"position",1);g([w],fe.prototype,"tool",1);g([w],fe.prototype,"size",1);g([w],fe.prototype,"rotation",1);g([w],fe.prototype,"rotationWRTOutputRotation",1);g([w],fe.prototype,"flipHorizontal",1);g([w],fe.prototype,"isSpriteSticker",1);g([w],fe.prototype,"isSpriteText",1);g([w],fe.prototype,"isSpriteTextDesign",1);g([w],fe.prototype,"isOnTop",1);g([w],fe.prototype,"spritePosition",1);g([w],fe.prototype,"currentRect",1);g([w],fe.prototype,"leftTopPosition",1);g([w],fe.prototype,"leftBottomPosition",1);g([w],fe.prototype,"leftMidPosition",1);g([w],fe.prototype,"leftMidPadPosition",1);g([w],fe.prototype,"rightTopPosition",1);g([w],fe.prototype,"rightBottomPosition",1);g([w],fe.prototype,"rightMidPosition",1);g([w],fe.prototype,"rightMidPadPosition",1);g([w],fe.prototype,"leftBottomHandlePosition",1);g([w],fe.prototype,"rightBottomHandlePosition",1);g([w],fe.prototype,"historyLocale",1);g([w],fe.prototype,"stickerLocale",1);g([w],fe.prototype,"textLocale",1);g([w],fe.prototype,"textDesignLocale",1)});var Lpe=p(()=>{r5()});var DKe,Yi;var i5=p(()=>{ze();B();DKe={categories:[],query:""};Yi=class{constructor(e){this.initProvider=e=>{if(e){this.libraryProvider=new e}};this.fetchImages=async(e="")=>{if(this.libraryProvider){let t=null;try{const i=await this.libraryProvider.getCategories();const o=await this.libraryProvider.searchImages(e);t=i.map((n,s)=>{const a=o.filter(l=>l.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(l=>({name:l.title||`image${s}`,identifier:`${n.name}-${l.title}-${s}`,thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar}))}}).filter(n=>n.items.length)}catch(i){console.log(i)}lr(()=>{this.state.query=e;this.state.categories=t})}};this.toggleCategorySelection=e=>{this.selectedCategory=this.selectedCategory!==e?e:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=e=>{const t=this.items.findIndex(i=>i.identifier===e);if(t!==-1){return this.items[t].rawUrl}return e};this.configStore=e.configStore;this.state=ae(DKe);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(e=>e.items).reduce((e,t)=>[...e,...t],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};g([ae],Yi.prototype,"selectedCategory",2);g([S],Yi.prototype,"initProvider",2);g([S],Yi.prototype,"fetchImages",2);g([S],Yi.prototype,"toggleCategorySelection",2);g([S],Yi.prototype,"dispose",2);g([w],Yi.prototype,"selectedCategoryIdentifier",1);g([w],Yi.prototype,"categories",1);g([w],Yi.prototype,"items",1);g([w],Yi.prototype,"query",1);g([w],Yi.prototype,"config",1);g([w],Yi.prototype,"locale",1)});var zpe=p(()=>{i5()});var Upe,oi;var Npe=p(()=>{B();Ks();W();Upe=(r="image/png")=>`data:${r};base64,`;oi=class{constructor(e){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const t=ye.relativeToAbsolutePoint(e,this.cropSpace,false);return ye.pointFromSpaceToSpace(t,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,t=>t.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:oi.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const t={};if(e.image){t.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(Upe(),""):""};t.image.data=t.image.data?Upe()+t.image.data:""}return t}deserializeTransformation(e){const t={};const i=e.operations.find(s=>s.type==="orientation");const o=e.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;t.transform=oi.initializeEmptyTransform();if(i!=null){t.transform.outputRotation=i.options.rotation;t.transform.flipHorizontally=i.options.flipHorizontally||false;t.transform.flipVertically=i.options.flipVertically||false}if(o){t.transform.start=o.options.start;t.transform.end=o.options.end;t.transform.rotation=o.options.rotation||0;t.transform.identifier=o.options.meta?o.options.meta.identifier:""}return t}deserialize(e){var n,s;const t={};if(e.meta?!oi.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const i=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=i;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(a=>{switch(a.type){case"filter":t.filter=oi.deserializeFilter(a.options);break;case"adjustments":t.adjustment=oi.deserializeAdjustments(a.options);break;case"focus":t.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(u=>{switch(u.type){case"frame":t.frame=this.deserializeFrame(u.options);break;case"overlay":t.overlay=oi.deserializeOverlay(u.options);break;case"brush":if(!t.brush){t.brush=this.deserializeBrush(u.options)}else{t.brush.strokes.push(...this.deserializeBrush(u.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!t.sprite){t.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const c=Ge();t.sprite.spriteIdList.push(c);t.sprite.common[c]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(u.options.position),tool:"sticker",rotation:u.options.rotation||0,flipHorizontally:u.options.flipHorizontally,flipVertically:u.options.flipVertically};this.spriteOrder+=1;if(u.type==="sticker"){t.sprite.common[c].tool="sticker";t.sprite.common[c].size={width:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.y)};t.sprite.sticker[c]=oi.deserializeStickers(u.options)}else if(u.type==="text"){t.sprite.common[c].tool="text";t.sprite.text[c]=this.deserializeTexts(u.options)}else if(u.type==="textdesign"){t.sprite.common[c].tool="textdesign";t.sprite.textdesign[c]=this.deserializeTextDesign(u.options)}break;default:break}});break;default:break}});if(e.assetLibrary){t.customStickers=((s=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return t}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:oi.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:break}return void 0}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new F(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const t=new F(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new F(this.mapRelativeCropPointToImageSpace(e.start)).add(new F(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(t.y,t.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:ws(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:oi.deserialzeColor(e.color),backgroundColor:oi.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:oi.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(t=>{return{path:{controlPoints:t.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:oi.deserialzeColor(t.brush.color),size:t.brush.size,hardness:t.brush.hardness}}})}}}});var qpe,ni;var Hpe=p(()=>{B();Ks();W();qpe=(r="image/png")=>`data:${r};base64,`;ni=class{constructor(e){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=e=>{const t=ye.relativeToAbsolutePoint(e,this.cropSpace,false);return ye.pointFromSpaceToSpace(t,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=e=>{return e*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=e=>{return e*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=e}static deserializeFilter(e){return{intensity:e.intensity,identifier:e.identifier}}static deserializeAdjustments(e){return{...e}}static deserializeOverlay(e){return{identifier:e.identifier,opacity:e.intensity,blendMode:e.blendMode.replace(/([ _][a-z])/g,t=>t.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(e){if(e){if(e.rgba){return e.rgba}}return[0,0,0,0]}validateVersion(e){return this.version===e}static checkIfPlatformHTML(e){return e==="html5"}static deserializeStickers(e){return{identifier:e.identifier,opacity:e.alpha||0,tintMode:e.tintMode||"none",tintColor:ni.deserialzeColor(e.tintColor)}}checkIsSerialisationValid(e){if(typeof e!=="string"&&this.validateVersion(e.version))return true;if(typeof e==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(e){const t={};if(e.image){t.image={width:e.image.width,height:e.image.height,data:e.image.data?e.image.data.replace(qpe(),""):""};t.image.data=t.image.data?qpe()+t.image.data:""}return t}deserializeTransformation(e){const t={};const i=e.operations.find(s=>s.type==="orientation");const o=e.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;t.transform=ni.initializeEmptyTransform();if(i!=null){t.transform.outputRotation=i.options.rotation;t.transform.flipHorizontally=i.options.flipHorizontally||false;t.transform.flipVertically=i.options.flipVertically||false}if(o){t.transform.start=o.options.start;t.transform.end=o.options.end;t.transform.rotation=o.options.rotation||0;t.transform.identifier=o.options.meta?o.options.meta.identifier:""}return t}deserialize(e){var n,s;const t={};if(e.meta?!ni.checkIfPlatformHTML(e.meta.platform):false){console.warn("Read serialisation from another Platform")}const i=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=i;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();e.operations.forEach(a=>{switch(a.type){case"filter":t.filter=ni.deserializeFilter(a.options);break;case"adjustments":t.adjustment=ni.deserializeAdjustments(a.options);break;case"focus":t.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(u=>{switch(u.type){case"frame":t.frame=this.deserializeFrame(u.options);break;case"overlay":t.overlay=ni.deserializeOverlay(u.options);break;case"brush":if(!t.brush){t.brush=this.deserializeBrush(u.options)}else{t.brush.strokes.push(...this.deserializeBrush(u.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!t.sprite){t.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const c=Ge();t.sprite.spriteIdList.push(c);t.sprite.common[c]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(u.options.position),tool:"sticker",rotation:u.options.rotation||0,flipHorizontally:u.options.flipHorizontally,flipVertically:u.options.flipVertically};this.spriteOrder+=1;if(u.type==="sticker"){t.sprite.common[c].tool="sticker";t.sprite.common[c].size={width:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(u.options.dimensions.y)};t.sprite.sticker[c]=ni.deserializeStickers(u.options)}else if(u.type==="text"){t.sprite.common[c].tool="text";t.sprite.text[c]=this.deserializeTexts(u.options)}else if(u.type==="textdesign"){t.sprite.common[c].tool="textdesign";t.sprite.textdesign[c]=this.deserializeTextDesign(u.options)}break;default:break}});break;default:break}});if(e.assetLibrary){t.customStickers=((s=(n=e.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return t}deserializeFrame(e){return{identifier:e.identifier,opacity:e.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(e.size),color:ni.deserialzeColor(e.tintColor)}}deserializeFocus(e){switch(e.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(e.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(e.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(e.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(e.options)};default:return void 0}}deserializeRadialFocus(e){return{center:this.mapRelativeCropPointToImageSpace(e.start),radius:new F(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(e.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeLinearFocus(e){return{start:this.mapRelativeCropPointToImageSpace(e.start),end:this.mapRelativeCropPointToImageSpace(e.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeGaussianFocus(e){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeMirroredFocus(e){const t=new F(this.mapRelativeCropPointToImageSpace(e.start)).subtract(new F(this.mapRelativeCropPointToImageSpace(e.end)));return{origin:new F(this.mapRelativeCropPointToImageSpace(e.start)).add(new F(this.mapRelativeCropPointToImageSpace(e.end))).divide(2),rotation:Math.atan2(t.y,t.x),size:this.mapRelativeCropSizeToScaledImageSize(e.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(e.blurRadius)}}deserializeTexts(e){return{identifier:ws(e.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(e.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(e.maxWidth),alignment:e.alignment,textColor:ni.deserialzeColor(e.color),backgroundColor:ni.deserialzeColor(e.backgroundColor),lineHeight:e.lineHeight,text:e.text}}deserializeTextDesign(e){return{identifier:e.identifier,width:this.mapRelativeCropSizeToScaledImageSize(e.width),padding:this.mapRelativeCropSizeToScaledImageSize(e.padding),color:ni.deserialzeColor(e.color),seed:e.seed,text:e.text,isInverted:e.inverted}}deserializeBrush(e){return{strokes:e.paths.map(t=>{return{path:{controlPoints:t.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:ni.deserialzeColor(t.brush.color),size:t.brush.size,hardness:t.brush.hardness}}})}}}});var OKe,RKe,AKe,FKe,PKe,BKe,MKe,LKe,zKe,UKe,NKe,qKe,HKe,WKe,GKe,Gpe;var Wpe=p(()=>{OKe="@photoeditorsdk/root";RKe="5.19.3";AKe="The most comprehensive photo editor SDK for HTML5";FKe="http://github.com/imgly/pesdk-html5";PKe="PhotoEditorSDK (img.ly GmbH) ";BKe="SEE LICENSE IN LICENSE.md";MKe=true;LKe={};zKe={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};UKe={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};NKe={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};qKe={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};HKe={eslint:"7.10.0"};WKe=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];GKe={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};Gpe={name:OKe,version:RKe,description:AKe,repository:FKe,author:PKe,license:BKe,private:MKe,bin:LKe,scripts:zKe,devDependencies:UKe,dependencies:NKe,devEngines:qKe,resolutions:HKe,workspaces:WKe,husky:GKe}});var dp;var Vpe=p(()=>{B();Ks();Wpe();dp=class{constructor(e,t,i,o,n,s){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=e=>{const t=ye.pointFromSpaceToSpace(e,this.imageSpace,this.cropSpace,false);return ye.absoluteToRelativePoint(t,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=e=>{return e/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=e=>{return e/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(e,t=0,i=3)=>{const o=Math.tan(t);const n=Math.sqrt(o**2+1);return{x:e.x+i/n,y:e.y+i*o/n}};this.previewPosition=e;this.previewSize=t;this.outputSize=i;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale()}static serializeFilters(e){return{type:"filter",options:{intensity:e.intensity,identifier:e.identifier}}}static serializeAdjustments(e){return{type:"adjustments",options:e}}static serializeOverlay(e){return{type:"overlay",options:{identifier:e.identifier,intensity:e.opacity,blendMode:e.blendMode.replace(/[A-Z]/g,t=>` ${t.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:Gpe.version,createdAt:new Date().toISOString()}}serialise(e,t,i){const o=dp.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(t){n.type=i;n.data=t}const s=[];const a=[];const{adjustment:l}=e;if(Object.keys(l).map(b=>l[b]).filter(Boolean).length){s.push(dp.serializeAdjustments(l))}const{filter:u}=e;if(u.identifier!=="identity"){s.push(dp.serializeFilters(u))}const{overlay:c}=e;if(c.identifier!=="identity"){a.push(dp.serializeOverlay(c))}if(e.transform){const{transform:b,orientation:_}=this.serializeTransform(e.transform);const y=[b.options.start.x!==0,b.options.start.y!==0,b.options.end.x!==1,b.options.end.y!==1,b.options.rotation!==0];const I=[_.options.rotation!==0,_.options.flipVertically!==false,_.options.flipHorizontally!==false];if(y.some(T=>T)){s.push(b)}if(I.some(T=>T)){s.push(_)}}const{frame:d}=e;if(d.identifier!=="identity"){a.push(this.serialzeFrame(d))}const{focus:m}=e;if(m.identifier!=="identity"){s.push(this.serializeFocus(m))}if(e.sprite){e.sprite.spriteIdList.forEach(b=>{const _=e.sprite.common[b];switch(_.tool){case"sticker":const y=e.sprite.sticker[b];a.push(this.serializeSticker(y,_,e.transform));break;case"text":const I=e.sprite.text[b];a.push(this.serializeText(I,_));break;case"textdesign":const T=e.sprite.textdesign[b];a.push(this.serializeTextDesign(T,_));break;default:break}})}if(e.brush.strokes.length){a.push({type:"brush",options:{paths:e.brush.strokes.map(b=>{return{points:b.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:b.brush.color},size:b.brush.size,hardness:b.brush.hardness}}})}})}if(a.length){const b={type:"sprite",options:{sprites:a}};s.push(b)}const h=e.customStickers;const f={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:f}}serialzeFrame(e){return{type:"frame",options:{identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.color},size:this.mapSizeToRelativeUnscaledCropSize(e.width)}}}serializeFocus(e){const t=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(e.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(e.linear.start),end:this.mapImagePointToRelativeCropPoint(e.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(e.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(e.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(e.radial.center,0,e.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(e.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:i}=e;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(i.origin,i.rotation,t/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(i.origin,i.rotation,-t/2)),size:this.mapSizeToRelativeScaledCropSize(e.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(e.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(e.gaussian.blurRadius)}}}}}serializeSticker(e,t,i){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(t.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(t.size.width),y:this.mapSizeToRelativeScaledCropSize(t.size.height)},rotation:t.rotation,flipVertically:(t.flipVertically||false)!==(i.flipVertically||false),flipHorizontally:(t.flipHorizontally||false)!==(i.flipHorizontally||false),identifier:e.identifier,alpha:e.opacity,tintColor:{rgba:e.tintColor},tintMode:e.tintMode}}}serializeText(e,t){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(t.position),rotation:t.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:e.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(e.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(e.width),text:e.text,lineHeight:e.lineHeight,color:{rgba:e.textColor},backgroundColor:{rgba:e.backgroundColor},alignment:e.alignment}}}serializeTextDesign(e,t){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(t.position),rotation:t.rotation,flipVertically:false,flipHorizontally:false,identifier:e.identifier,inverted:e.isInverted,text:e.text,seed:e.seed,width:this.mapSizeToRelativeScaledCropSize(e.width),padding:this.mapSizeToRelativeScaledCropSize(e.padding),color:{rgba:e.color}}}}serializeTransform(e){const{start:t,end:i}=e;const o={type:"transform",options:{start:t,end:i,rotation:e.rotation,meta:{identifier:e.identifier}}};const n={type:"orientation",options:{rotation:e.outputRotation,flipHorizontally:e.flipHorizontally,flipVertically:e.flipVertically}};return{transform:o,orientation:n}}}});var o5={};wt(o5,{Deserializers:()=>VKe,Serializer:()=>dp});var VKe;var n5=p(()=>{Npe();Hpe();Vpe();VKe={"3.9.0":ni,"3.12.0":oi}});var jpe,jKe,$Ke,KKe,Hb;var $pe=p(()=>{ze();B();W();jpe=/^data:image\/(.+?);base64,/;jKe=r=>jpe.test(r);$Ke=r=>r.match(/^data:([^;]+)/)[1];KKe=r=>r.replace(jpe,"");Hb=class{constructor(e){this.applySerialization=async(e,t,i,o)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const s="Unexpected error occured";const a=t.deserializeImage(e);if(a.image&&a.image.data){const c=a.image.data;await this.editor.setImage(c);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(c);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const l=t.deserializeTransformation(e);if(!l){o(s);return}await this.applyStateOnUI(l);const u=t.deserialize(e);if(!u){o(s);return}await this.applyStateOnUI(u);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}i()};this.editor=e}serialize({image:e}={image:false}){const t=this.editor.activeStore.tool==="transform";const{displaySerializationModal:i}=this.editor.configStore.config;if(i){this.editor.modalStore.showInfoModal("saving")}return new Promise((o,n)=>{Promise.resolve().then(()=>(n5(),o5)).then(async({Serializer:s})=>{try{if(t){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:a}=this.editor.imageContainer.getData();const l=this.editor.engineMediator.output.container.getResolution();const u={width:a.width,height:a.height};const c=new s(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,l,u,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const d={["adjustment"]:ve(this.editor.adjustmentsToolStore.state),["filter"]:ve(this.editor.filterToolStore.state),["focus"]:ve(this.editor.focusToolStore.serializableState),["overlay"]:ve(this.editor.overlayToolStore.state),["frame"]:ve(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:m,customStickers:h}=await this.editor.spriteStore.serializableState();m.spriteIdList=m.spriteIdList.sort((_,y)=>{const I=m.common[_].order;const T=m.common[y].order;return I-T});d.sprite=m;d.customStickers=h;d.transform=this.editor.transformToolStore.serializableState;let f;let b;if(e){const _=Hb.getDataURL(a);b=$Ke(_);f=KKe(_)}if(i){this.editor.modalStore.hideModal()}o(c.serialise(d,f,b));if(t){this.editor.transformToolStore.onEnter()}}catch(a){if(i){this.editor.modalStore.hideModal()}n(a)}})})}deserialize(e){this.editor.modalStore.showInfoModal("loading");return new Promise((t,i)=>{try{Promise.resolve().then(()=>(n5(),o5)).then(({Deserializers:o})=>{const n=e.version.match(/[0-3].[0-8].[0-9]/i);let s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](this.editor)}else if(o[e.version]){s=new o[e.version](this.editor)}else{s=new o["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(e,s,t,i)})}else{this.applySerialization(e,s,t,i)}})}catch(o){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}i(o)}})}static getDataURL(e){if(e instanceof HTMLImageElement){const{src:n}=e;if(jKe(n)){return n}}if(e instanceof HTMLCanvasElement){return e.toDataURL("image/png")}const t=document.createElement("canvas");t.width=e.width;t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0);const o=t.toDataURL("image/png");st(t);return o}async applyStateOnUI(e){const t=this.editor.activeStore.tool==="transform";try{if(e.transform){if(!t){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(e.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!t){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(e.filter){await this.editor.filterToolStore.updateStateFromSerialization(e.filter)}if(e.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(e.adjustment)}if(e.focus){await this.editor.focusToolStore.updateStateFromSerialization(e.focus)}if(e.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(e.overlay)}if(e.sprite){let i=Object.keys(e).length-1;if(e.customStickers){i-=1}e.sprite.spriteIdList=e.sprite.spriteIdList.sort((o,n)=>{const s=e.sprite.common[o].order;const a=e.sprite.common[n].order;return s-a});await this.editor.spriteStore.updateStateFromSerialization(e.sprite,e.customStickers,Math.max(0,i))}if(e.brush){this.editor.brushToolStore.updateStateFromHistory(e.brush)}if(e.frame){await this.editor.frameToolStore.updateStateFromSerialization(e.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(i){if(i.name==="AssetNotFoundError"){console.error(i)}else{console.error(i);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:i.message,handleConfirm:()=>{this.applyStateOnUI(e)}})}}}}});var XKe,s5;var Kpe=p(()=>{XKe=r=>{const e=atob(r.split(",")[1]);const t=r.split(",")[0].split(":")[1].split(";")[0];const i=new ArrayBuffer(e.length);const o=new Uint8Array(i);for(let n=0;n{B();Xpe=r=>r.split(",")[0].split(":")[1].split(";")[0];Ype=r=>{if(typeof r==="string"){return Xpe(r)}if(r.src.includes(".svg")){return"image/svg+xml"}if(r.src){return Xpe(r.src)}return"image/jpeg"}});var Gw,Wb;var Zpe=p(()=>{Ob();Gw=v(Pm());B();Ks();Wb=class{static isImageElement(e){return e instanceof HTMLImageElement}constructor({license:e,assetProvider:t,crossOrigin:i,backgroundColor:o}){this.crossOrigin=i;this.engine=new Zh({license:e,crossOrigin:i,assetProvider:t,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:o})}getAllFilterPreviewThumbnails(e){return new Promise((t,i)=>{const o=[];const n=[];e.forEach(s=>{if(s.isDuotone)o.push(s.identifier);else n.push(s.identifier)});this.getAllDuotonePreview(o).then(s=>{this.getAllLutPreview(n).then(a=>{t(Object.assign(s,a))}).catch(a=>{i(a)})}).catch(s=>{i(s)})})}async getAllDuotonePreview(e){const t={};if(!e.length)return t;const i=await this.engine.addDuoToneFilterFromAssets(e[0],this.container);await(0,Gw.default)(e,async o=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(o);const s=i.filterOperation.getFilter();s.set({intensity:.5,lightColor:ge.Color.fromHex(n.lightColor),darkColor:ge.Color.fromHex(n.darkColor)});const a=await this.engine.export("data-url","image/jpeg",.8,false,true);t[o]=a},{concurrency:1});this.engine.removeEffect(i);return t}async loadLutAssets(e){const t={};await(0,Gw.default)(e,async i=>{t[i]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",i))});return t}async getAllLutPreview(e){const t={};if(!e.length)return t;const i=await this.loadLutAssets(e);const o=await this.engine.addLUTFilterFromAssets(e[0],this.container);await(0,Gw.default)(e,async n=>{const s=this.engine.assetProvider.getLUTFilterAsset(n);const a=o.filterOperation.getFilter();const l={horizontalTileCount:s.horizontalTileCount||5,verticalTileCount:s.verticalTileCount||5,image:i[n]};a.set({...l,intensity:s.defaultIntensity||1});o.setProperties({intensity:1});a._lutPrimitive.set(l);const u=await this.engine.export("data-url","image/jpeg",.8,false,true);t[n]=u},{concurrency:1});this.engine.removeEffect(o);return t}addImageToContainer(e){return new Promise((t,i)=>{let o;if(Wb.isImageElement(e)){o=e;this.setBackgroundImage(o);t()}else{this.getImageElement(e).then(n=>{o=n;this.setBackgroundImage(o);t()}).catch(n=>{i({identifier:"imageLoading",message:n.message})})}})}getImageElement(e){return new Promise((t,i)=>{const o=new Image;o.addEventListener("load",()=>{t(o)});o.addEventListener("error",n=>{i(n)});o.crossOrigin=this.crossOrigin;o.src=e})}setBackgroundImage(e){if(!this.container){this.container=this.engine.addImage({image:e,blendMode:"normal",opacity:1})}else{this.container.setData({image:e})}const{size:t}=this.container.getBounds();const i=this.engine.getOutputContainer();i.setResolution(t)}}});var YKe,Vn;var a5=p(()=>{ze();W();YKe={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};Vn=class{constructor(e){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(e,t)=>{const{height:i,width:o}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:s,snapToTop:a,snapToBottom:l}=this.configStore.config.snapping.position;const u=Math.min(i,o);let c=0;if(t==="bottom"){c=Math.round(i-u*l)}else if(t==="top"){c=Math.round(u*a)}else if(t==="right"){c=Math.round(o-u*s)}else if(t==="left"){c=Math.round(u*n)}else if(e==="vertical"&&t==="center"){c=Math.round(o/2)}else if(e==="horizontal"&&t==="center"){c=Math.round(i/2)}return c};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:e,snapToLeft:t,snapToRight:i}=this.configStore.config.snapping.position;const o=[];if(e){o.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(t){o.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(i){o.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return o};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:e,snapToTop:t,snapToBottom:i}=this.configStore.config.snapping.position;const o=[];if(e){o.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(t){o.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(i){o.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return o};this.getRotationGuidesFromConfig=()=>{const{angles:e}=this.configStore.config.snapping.rotation;const t=[];e.forEach(o=>{t.push(o);t.push(o+360);t.push(o-360)});const i=t.filter((o,n)=>t.indexOf(o)===n);return i.map(o=>({value:o*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:e,leftBottom:t,rightTop:i,rightBottom:o})=>{const n=Math.min(e.y,i.y,t.y,o.y);const s=Math.max(e.y,i.y,t.y,o.y);const a=Math.min(e.x,i.x,t.x,o.x);const l=Math.max(e.x,i.x,t.x,o.x);return{height:Math.round(s-n),width:Math.round(l-a)}};this.mapRange=({value:e,fromMin:t,fromLength:i,toMin:o,toLength:n})=>{return(e-t)*n/i+o};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(e,t,i,o)=>{if(t.length===0){return e}if(t[0]>e){return e-i}for(let n=0;n=a-d){return a+c+(o?i*2:0)}return this.mapRange({value:e,fromMin:s,fromLength:a-s,toMin:l,toLength:u-l})}}if(o){return e+(t.length-1)*i*2+i}return e};this.mapFromSnapSystem=(e,t,i,o)=>{if(t.length===0){return e}if(t[0]>e){if(e>=t[0]-i){return t[0]}return e+i}let n=e;for(let a=0;a{const i=t*.5;const{value:o,edge:n}=e;let s=o;if(n==="leading"){s+=i}else if(n==="trailing"){s-=i}return s};this.mapSnappingGuidesToCenter=(e,t)=>{const i=[];e.forEach(o=>{i.push(this.centerSnapValue(o,t))});return i};this.calcSnapThresholdInRadians=(e,t)=>{if(e===0){return 0}return t/e};this.calculatePreviewTopLeftPosition=()=>{const e=this.editor.engineMediator.preview.container.getPosition();const t=this.editor.getPreviewSize();const i=kn();this.previewTopLeftPosition={x:e.x/i-t.width/2,y:e.y/i-t.height/2}};this.snapToRotation=(e,t,i)=>{const{rotationGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.rotation;const{x:a,y:l}=this.previewTopLeftPosition;const{width:u}=this.editor.getPreviewSize();let c=(e+Math.PI*2)%(Math.PI*2);if(n){const d=new F(t).magnitude;const m=o.map(b=>b.value).sort((b,_)=>b-_);const h=this.calcSnapThresholdInRadians(d,s);if(!this.rotationOffset){const b=this.mapToSnapSystem(e,m,h,false);this.rotationOffset=b-c}c=this.mapFromSnapSystem(c+this.rotationOffset,m,h,false);const f={x:i.position.x-a-u,y:i.position.y-l};o.forEach(b=>{b.isVisible=b.value===c;b.position=f});return c}return e};this.snapToPosition=(e,t)=>{const{horizontalGuides:i,verticalGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.position;const a=new F(this.previewTopLeftPosition);const{height:l,width:u}=this.getSpriteDimensions(t);const{x:c,y:d}=new F(e).subtract(a);if(n){const m=this.mapSnappingGuidesToCenter(i,l).sort((_,y)=>_-y);const h=this.mapSnappingGuidesToCenter(o,u).sort((_,y)=>_-y);if(!this.positionOffset){const _=this.mapToSnapSystem(c,h,s,true);const y=this.mapToSnapSystem(d,m,s,true);this.positionOffset=new F(_,y).subtract(new F(c,d))}let f=this.mapFromSnapSystem(c+this.positionOffset.x,h,s,true);let b=this.mapFromSnapSystem(d+this.positionOffset.y,m,s,true);f=Math.round(f);b=Math.round(b);i.forEach(_=>{const y=Math.round(this.centerSnapValue(_,l));_.isVisible=y===b});o.forEach(_=>{const y=Math.round(this.centerSnapValue(_,u));_.isVisible=y===f});return new F(f,b).add(a)}return{x:c,y:d}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=e;this.configStore=e.configStore;this.state=ae(YKe);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(e=>({...e,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(e=>({...e,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(e=>({...e,isVisible:false}))}get positionGuides(){const{verticalGuides:e,horizontalGuides:t}=this.state;return[...e,...t]}get rotationGuides(){return this.state.rotationGuides}};g([ae],Vn.prototype,"state",2);g([S],Vn.prototype,"snapToRotation",2);g([S],Vn.prototype,"snapToPosition",2);g([S],Vn.prototype,"hidePositionGuides",1);g([S],Vn.prototype,"hideRotationGuides",1);g([S],Vn.prototype,"dispose",2);g([w],Vn.prototype,"positionGuides",1);g([w],Vn.prototype,"rotationGuides",1)});var oc;var Qpe=p(()=>{ze();B();Ks();W();Nw();qw();Lw();jM();Uw();Hw();Ww();$pe();lM();cM();dM();IM();i5();mM();Kpe();Jpe();Zpe();kM();a5();r5();e5();oc=class{constructor(e,t){this.initWithImage=async e=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(e);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const t=this.configStore.config.engine;this.previewThumbnails=new Wb({...t,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(t){this.configStore.events.onErrorImageLoading(t);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:t.identifier?t.identifier:"rendering",error:t,handleConfirm:()=>{this.initWithImage(e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:e,height:t})=>{const{maxMegaPixels:i}=this.configStore.config.engine.downscaleOptions;const o=Zg.isMobile()?i.mobile:i.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${o}`,width:`${e}`,height:`${t}`}})})};this.init=e=>{var o,n;if(!((o=this.activeStore)==null?void 0:o.image)){this.initWithImage(e);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const t=this.historyStore.isDirty();const{displayDiscardChangesWarning:i}=this.configStore.config;if(t&&i){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(e);this.resetToolStates()},handleDismiss:()=>{this.setImage(e,true)}});return}if(t&&!i){this.setImage(e,true);return}this.historyStore.reset();this.setImage(e,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:s,displayCanvasRendererWarning:a}=this.configStore.config;if(s.preferredRenderer==="canvas"&&a){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(e,t=false)=>{try{if(!this.activeStore.image){this.initWithImage(e)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(e);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:i,flipVertically:o,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:o,flipHorizontally:i});await this.transformToolStore.rotateOutputContainer(sy(n),false);if(t){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const s=this.activeStore.tool;if(!s){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(i){this.configStore.events.onErrorImageLoading(i);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:i.identifier?i.identifier:"rendering",error:i,handleConfirm:()=>{this.setImage(e,t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(i)}};this.onToolChange=(e,t=null,i=true)=>{var o,n;if(e===t){return}if((n=(o=this.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([e,t].indexOf("transform")!==-1){if(e==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(t==="transform"){this.transformToolStore.onEnter()}this.resize(t)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(i){this.render()}}};this.resize=(e=null)=>{if(!this.engineMediator)return;try{const t=this.activeStore.tool;const i=e==="transform"||!e&&t==="transform";this.canvasStore.resizeCanvas(e);this.transformToolStore.applyDefaultCrop();const o=ve(this.transformToolStore.maxCropMaskSize);if(!i){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const s=this.engineMediator.preview.updateTransform(n);if(s){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(o);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const a=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(a);if(!i){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(t){this.configStore.events.onErrorImageLoading(t);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:e,...t}={})=>{const i=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(i){this.transformToolStore.onLeave()}const{config:o}=this.configStore;const n={...o.export.image,...t};const{exportType:s,format:a,quality:l,enableDownload:u,transparent:c}=n;const d=await this.engineMediator.engine.export(s,a,l,c);if(i&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(u){this.triggerFileDownload(o.export.filename,a,s,d)}if(!e){this.configStore.events.onExport(d)}return d}catch(o){if(this.modalStore){this.modalStore.hideModal()}if(i&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(o)}};this.serialize=({image:e}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:e})}return Promise.resolve({})};this.deserialize=e=>{if(this.serializationMediator){return this.serializationMediator.deserialize(e)}return Promise.resolve()};this.close=()=>{var e,t,i,o,n,s;if((((e=this.historyStore)==null?void 0:e.isDirtySinceSave)||((i=(t=this.transformToolStore)==null?void 0:t.transformHistory)==null?void 0:i.hasChanges()))&&((n=(o=this.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var a;if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}}})}else if((s=this.configStore)==null?void 0:s.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:e,height:t}=this.engine.getOutputDimensions();return{width:e,height:t}}return{width:0,height:0}};this.wait=(e=0)=>new Promise(t=>setTimeout(t,e));this.clickableCanvas=async e=>{if(e){await new Promise(t=>setTimeout(t,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:e}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(e){const t=this.transformToolStore.localOutputImageSize;const i=t.width/t.height;const o=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(o.indexOf(parseFloat(i.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(e,t,i)=>{this.historyStore.addSnapshot(e,t,i)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=e=>this.assetProvider.getPathForCategory(e);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=e=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(e)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:e,height:t}=this.engine.getOutputDimensions();if(e&&t){return{width:Math.round(this.worldToPreview(this.outputToWorld(e))),height:Math.round(this.worldToPreview(this.outputToWorld(t)))}}return{height:t,width:e}};this.getImageMimeType=()=>{return Ype(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var e,t,i;(i=(t=(e=this.engineMediator)==null?void 0:e.image)==null?void 0:t.container)==null?void 0:i.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(e,t,i,o)=>{const n=t==="image/jpeg"&&i!=="ms-blob"?".jpeg":".png";const s=e+n;const a=this.blobFromExportData(o);this.triggerBlobDownload(s,a)};this.triggerBlobDownload=(e,t)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(t,e)}else{const i=document.createElement("a");const o=URL.createObjectURL(t);i.href=o;i.download=e;document.body.appendChild(i);i.click();document.body.removeChild(i);if(!wK()){URL.revokeObjectURL(o)}}};this.blobFromExportData=e=>{if(typeof e==="string"){return s5(e)}if(e instanceof HTMLImageElement){return s5(e.src)}return e};this.configStore=new Ei;if(t){Object.entries(t).forEach(([o,n])=>{this.configStore.events.on(o,n)})}const i=this.configStore.saveConfig(e);this.engineMediator=new VM(this);this.serializationMediator=new Hb(this);this.spriteStore=new fe(this);this.scale=new vr(this);this.filterToolStore=new nr(this);this.adjustmentsToolStore=new pt(this);this.focusToolStore=new Ve(this);this.overlayToolStore=new br(this);this.frameToolStore=new Yt(this);this.brushToolStore=new Ht(this);this.transformToolStore=new le(this);this.libraryStore=new Yi(this);this.modalStore=new Oo(this);this.snappingStore=new Vn(this);this.activeStore=new Xi(this);this.canvasStore=new ii(this);this.historyStore=new up(this);this.libraryStore.initProvider(i);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const e=this.outputContainer.getBounds();return Math.min(e.width,e.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(e,t){if(!this.engineMediator)return{x:0,y:0};if(Wo(e)){return this.engineMediator.previewSpaceToWorldSpace(e,t)}return this.engineMediator.previewSpaceToWorldSpace(e,t)}worldToPreview(e){if(!this.engineMediator)return{x:0,y:0};if(Wo(e)){return this.engineMediator.worldSpaceToPreviewSpace(e)}return this.engineMediator.worldSpaceToPreviewSpace(e)}worldSizeToPreview(e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(e.width),height:this.engineMediator.worldSpaceToPreviewSpace(e.height)}}previewSizeToWorld(e,t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(e.width,t),height:this.engineMediator.previewSpaceToWorldSpace(e.height,t)}}outputToWorld(e){if(!this.engineMediator)return{x:0,y:0};if(Wo(e)){return this.engineMediator.outputSpaceToWorldSpace(e)}return this.engineMediator.outputSpaceToWorldSpace(e)}previewToOutput(e){if(!this.engineMediator)return{x:0,y:0};if(Wo(e)){return this.engineMediator.previewSpaceToOutputSpace(e)}return this.engineMediator.previewSpaceToOutputSpace(e)}get outputContainer(){return this.engineMediator.output.container}};g([S],oc.prototype,"resize",2);g([S],oc.prototype,"export",2);g([S],oc.prototype,"clickableCanvas",2)});var lt=p(()=>{W();Ki();Iw();qde();lM();cM();dM();mM();rpe();spe();ape();IM();dpe();Bpe();Lpe();zpe();Ww();Uw();Qpe();PM();Lw();Nw();qw();Hw();a5();Mb();Ub();Lb();rc();Ys();Jh()});var Gb,Vb,eme,tme,JKe,ZKe,rme;var ime=p(()=>{Gb=v(x("react"));L();Vb=v(x("styled-components"));B();lt();W();cr();eme=we.Button.TextSecondary;tme=Vb.default.span` font-size: 14px; padding: 3px 1px 2px; color: ${r=>r.theme.canvasActionBar.foreground}; diff --git a/umd/no-polyfills.js b/umd/no-polyfills.js index e7932e1..e29cb2e 100644 --- a/umd/no-polyfills.js +++ b/umd/no-polyfills.js @@ -1551,7 +1551,7 @@ ${t}`}_compile(){const t=this._renderer.getContext();const e=this._compileShader 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.20)`,inactiveOpacity:g},textInput:{foreground:r,hoverBorderColor:r,background:"transparent",borderColor:a,inactiveOpacity:g},slider:{trackColor:s,activeTrackColor:i,thumbBackground:c,thumbBorderColor:i,inactiveOpacity:g,hoverOpacity:"0.7"},selectColor:{activeBorderColor:i,inactiveOpacity:g},toolbar:{foreground:r,background:a,activeBackground:"transparent",activeForeground:i,borderColor:"transparent"},tooltip:{background:s,foreground:r},toolControlBar:{background:"rgba(238, 238, 238, 0.9)",borderColor:c,shadow:"none",separatorColor:a,titleForeground:o,inputLabelForeground:o,inputLabelInactiveOpacity:g},mainCanvasActionBar:{background:"transparent",foreground:r,borderColor:"none"},canvasActionBar:{background:s,foreground:r,separatorColor:n},canvas:{background:u,controlsOutline:"rgba(255, 255, 255, 0.6)",controlsColor:"#ffffff",cropBackdrop:"rgba(255, 255, 255, 0.3)"},colorPicker:{listBackground:a,listShadow:`0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), - 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};Lk=$lt});var Zh,uv,Hr;var Qh=d(()=>{Jh();MH();LH();Zh=cv();uv=lv();Hr={...Zh,measurements:uv}});var Xlt,zH;var UH=d(()=>{vl();Qh();Xlt=i=>{if(i==="light"){return Lk}return cv};zH=(i,t)=>{const e=Xlt(i);if(t&&t[i]){const{primary:r,background:o,foreground:n}=t[i];const s={primary:r,background:o,foreground:n};const a=Object.keys(s).reduce((l,c)=>{if(s[c]){return{...l,[c]:s[c]}}return l},{});return Fi([e(a),t[i]])}return e()||Zh}});var qlt,NH;var HH=d(()=>{vl();Jh();qlt=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];NH=i=>{const t=lv();if(i){const e={};Object.keys(i).forEach(r=>{if(qlt.indexOf(r)!==-1){e[r]=i[r]}});return Fi([t,e])}return t}});var WH=d(()=>{PH();UH();HH()});var Ylt,Qi;var dv=d(()=>{Tt();R();zn();U();vl();Ak();FH();sk();Yh();WH();Qh();Ylt={config:_l,locale:uu,theme:Zh,measurements:uv,initialMeasurements:uv};Qi=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(t,e)=>{return e.indexOf(t)!==-1};this.state=Q(Ylt);this.events=new Rk;this.licenseChecker=null}saveConfig(t){if(t.mainCanvasActions&&t.mainCanvasActions.length!==4){t.mainCanvasActions.length=4}const e=t.layout&&t.layout==="basic"?Bk:_l;const r=Fi([e,t],{clone:true});this.licenseChecker=new Zx(r.license);if(!this.licenseChecker.areCustomAssetsAllowed()){r.sticker.enableCustomUpload=false}const o=BH(r.language,r.custom.languages);const n=zH(r.theme,r.custom.themes);const s=NH(r.custom.measurements);const{provider:a}=r.library;const l=[];r.adjustment.categories=r.adjustment.categories.reduce((m,p)=>{m.push({...p,items:p.items.filter(h=>{if(!xC[h.identifier]){l.push(h.identifier);return false}return true})});return m},[]);if(l.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${l.join(", ")}`)}delete r.language;delete r.custom.languages;delete r.custom.themes;delete r.library.provider;let c=r.tools.reduce((m,p)=>{if(typeof p==="object"){return[...m,...p]}return[...m,p]},[]);if(!c.length){console.error(`Empty list input for tools`);c=Qx.reduce((m,p)=>{if(typeof p==="object"){return[...m,...p]}return[...m,p]},[])}c=c.filter(m=>this.licenseChecker.isToolAllowed(m));if(r.defaultTool){const m=this.checkDefaultToolAvailability(r.defaultTool,c);if(!m){[r.defaultTool]=c}}r.tools=c;this.state.config=r;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;const u=this.buildCustomAssetsConfig();this.assetProvider=new _p(u,this.licenseChecker.areCustomAssetsAllowed(),r.assetResolver);this.loadThemeFont();return a}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((t,e)=>{if(typeof e==="string"){return[...t,e]}return[...t,"",...e]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:t}=this.theme;if(!t.skipLoading){this.assetProvider.getFontManager().injectFonts([t])}}buildCustomAssetsConfig(){const t=this.tools;const e=ct(this.state.config);const r=this.state.config.assetBaseUrl;const{theme:o}=this.state;const n=t.indexOf("filter")!==-1?e["filter"]:void 0;const s=t.indexOf("focus")!==-1?e["focus"]:void 0;const a=t.indexOf("adjustment")!==-1?e["adjustment"]:void 0;const l=t.indexOf("sticker")!==-1?e["sticker"]:void 0;const c=t.indexOf("frame")!==-1?e["frame"]:void 0;const u=t.indexOf("overlay")!==-1?e["overlay"]:void 0;const m=t.indexOf("transform")!==-1?e["transform"]:void 0;const p=t.indexOf("text")!==-1?e["text"]:void 0;const h=t.indexOf("textdesign")!==-1?e["textdesign"]:void 0;return{basePath:r,theme:o,filter:n,focus:s,sticker:l,frame:c,overlay:u,transform:m,text:p,adjustment:a,textdesign:h}}};f([C],Qi.prototype,"saveConfig",1);f([C],Qi.prototype,"dispose",2);f([S],Qi.prototype,"config",1);f([S],Qi.prototype,"locale",1);f([S],Qi.prototype,"theme",1);f([S],Qi.prototype,"measurements",1);f([S],Qi.prototype,"initialMeasurements",1);f([S],Qi.prototype,"tools",1);f([S],Qi.prototype,"defaultTool",1);f([S],Qi.prototype,"isOrderDefault",1);f([S],Qi.prototype,"isLayoutAdvanced",1);f([S],Qi.prototype,"displayCloseButton",1)});var zk;var Uk=d(()=>{R();yC();zk=class{constructor(t){this.editor=t}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,originalImage:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t,originalImage:t})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((t,e)=>{const{image:r}=this.editor.activeStore;if(jF(r)){this.setBackgroundImage(r);t()}else{const o=this.editor.libraryStore.getRawUrl(r);this.getImageElement(o).then(n=>{this.setBackgroundImage(n);t()}).catch(n=>{e({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,r)=>{const o=new Image;o.addEventListener("load",()=>{e(o)});o.addEventListener("error",n=>{r(n)});o.crossOrigin=this.editor.configStore.config.engine.crossOrigin;o.src=t})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}}});var Nk;var Hk=d(()=>{U();Nk=class{constructor(t){this.applyNewImageTransform=()=>{const{size:t,width:e,height:r}=this.editor.engineMediator.image.container.getBounds();const o=this.container;o.setTransform(re.IDENTITY);o.setResolution(t);o.setPivot(.5,.5);o.setPosition({x:e/2,y:r/2})};this.editor=t}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}}});function tf(i,t){const e=i.width/i.height;const r=t.width/t.height;if(e>r){return i.height/t.height}return i.width/t.width}var GH=d(()=>{});var Jlt,ta;var Wk=d(()=>{Tt();U();GH();Jlt={transform:re.IDENTITY};ta=class{constructor(t){this.initialTransform=re.IDENTITY;this.editor=t;this.state=Q(Jlt)}createPreview(t){this.container=this.editor.engine.createPreview(t)}updateTransform(t=0,e=true){const r=this.calculateTransform(t);if(r.scale.x){if(e){this.saveInitialTransform(r)}else{this.savePreviewTransform(r)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(t){this.initialTransform=t;this.savePreviewTransform(t)}savePreviewTransform(t){Ve(()=>{this.state.transform.position=t.position;this.state.transform.scale=t.scale;this.state.transform.rotation=t.rotation;const e=Eo();const r=new O(t.scale).divide(e);this.previewTransformWithoutDpr={position:new O(t.position).divide(e),scale:r,rotation:t.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(t=0){const e=Eo();const{scaleImageToFit:r}=this.editor.configStore.config;const{width:o,height:n}=this.editor.canvasStore.canvasSize;const s=this.editor.engine.getOutputDimensions();const a=tf({width:o,height:n},s);let l=r?a:Math.min(1,a);const c=n-s.height*l;const u=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(cn*m){l=tf({width:o,height:n*m},s)}if(s.width*l>o*m){l=tf({width:o*m,height:n},s)}l*=e;const p={x:o*e/2,y:n*e/2};const h={x:l,y:l};return new re(p,h,t)}};f([C],ta.prototype,"updateTransform",1);f([C],ta.prototype,"savePreviewTransform",1);f([S],ta.prototype,"transform",1);f([S],ta.prototype,"position",1);f([S],ta.prototype,"scale",1);f([S],ta.prototype,"rotation",1)});var Cl,mv;var Gk=d(()=>{R();Cl=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(t){if(["sticker","text","textdesign","brush"].indexOf(t)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(t,e){const r=e.findIndex(o=>o===t);if(r!==-1){e.splice(r,1)}return void 0}static indexForOrder(t,e,r){const o=t[r];const n=e.findIndex(a=>a===r);if(n!==-1){return{index:n,order:e}}const{length:s}=e;if(s){let a;for(a=0;ao===t);if(r!==-1){this.spriteContainerOrder[r]=e}}bringToFront(t){const e=this.spriteContainerOrder.findIndex(r=>r===t);if(e!==-1){this.spriteContainerOrder.splice(e,1);this.spriteContainerOrder.push(t)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:t}=this.spriteContainerOrder;return this.spriteContainerOrder[t-1]}getSpriteIndex(t){const e=this.spriteContainerOrder.findIndex(r=>r===t);return e+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};mv=Cl;mv.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3}});var Vk;var jk=d(()=>{zn();U();Uk();Hk();Wk();Gk();Vk=class{constructor(t){this.orderHelper=new mv;this.init=()=>{const t=this.editor.configStore.config.engine;this.engine=new fm({...t,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new zk(this.editor);this.output=new Nk(this.editor);this.preview=new ta(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=t}render(t){return this.engine.render(t)}previewSpaceToWorldSpace(t,e){const r=this.preview.previewTransformWithoutDpr;if(Yr(t)){const o=this.editor.engine.convertPointFromPreviewIntoWorldSpace(O.ZERO,r,e);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:t,y:0},r,e);return O.distance(new O(o),new O(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(t,r,e)}worldSpaceToPreviewSpace(t){const e=this.preview.previewTransformWithoutDpr;if(Yr(t)){const r=this.editor.engine.convertPointFromWorldIntoPreviewSpace(O.ZERO,e);const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:t,y:0},e);return O.distance(new O(r),new O(o))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(t,e)}outputSpaceToWorldSpace(t){if(Yr(t)){return at.getScalarInWorldSpace(t,this.editor.engine.getOutputContainer())}return at.getPointInWorldSpace(t,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(t){const e=this.preview.previewTransformWithoutDpr;if(Yr(t)){const r=this.editor.engine.convertPointFromPreviewIntoOutputSpace(O.ZERO,e);const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:t,y:0},e);return O.distance(new O(r),new O(o))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(t,e)}previewSpaceToFlippedPreviewSpace(t){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(t)}}});var xm;var VH=d(()=>{Tt();xm=class{constructor(){this.snapshots=[];this.observeIndex=Q.box(-1)}addSnapshot(t){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(t))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(t)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(t){if(t>0&&t0}get canRedo(){return this.snapshots.length-1>this.index}};f([S],xm.prototype,"index",1);f([S],xm.prototype,"canUndo",1);f([S],xm.prototype,"canRedo",1)});var du;var pv=d(()=>{Tt();R();VH();Zi();du=class{constructor(t){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const t=this.appHistoryManager.undo();await this.applyState(t);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const t=this.appHistoryManager.redo();await this.applyState(t);this.awaitHistoryChange=false}};this.editor=t;this.appHistoryManager=new xm}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const t=ct(this.editor.adjustmentsToolStore.state);const e=ct(this.editor.filterToolStore.state);const r=this.editor.focusToolStore.getFocusStateForHistory();const o=ct(this.editor.overlayToolStore.state);const n=ct(this.editor.frameToolStore.state);const{strokes:s}=this.editor.brushToolStore;const a=this.editor.spriteStore.getSpriteHistoryState();const l=this.editor.transformToolStore.serializableState;return{["adjustment"]:t,["filter"]:e,["focus"]:r,["overlay"]:o,["frame"]:n,["brush"]:s,sprite:a,["transform"]:l}}addInitialSnapshot(){const t=this.getHistoryState();this.appHistoryManager.addSnapshot({state:t,type:"add",description:"Initial State"})}addSnapshot(t,e,r){let o;if(!t){o=this.getHistoryState()}else if(t.sprite||t.transform){o={...this.getHistoryState(),...t}}else{o=t}this.appHistoryManager.addSnapshot({state:o,type:e,description:r});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:t}){try{if(t){const e=Object.keys(t);for(const r of e){switch(r){case"filter":await this.editor.filterToolStore.updateStateFromHistory(t[r]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(t[r]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(t[r]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(t[r]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(t[r],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(t[r]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(t[r]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(t[r]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(e){console.error(e);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:e,handleConfirm:()=>{this.applyState({state:t})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var t,e;return(e=(t=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:t.state)==null?void 0:e.sprite}};f([C],du.prototype,"undo",2);f([C],du.prototype,"redo",2);f([S],du.prototype,"canUndo",1);f([S],du.prototype,"canRedo",1)});var Zlt,jH,Qlt,$k;var $H=d(()=>{Zlt=(i,t)=>new Promise((e,r)=>{const o=new XMLHttpRequest;o.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){e(n.result)}else{r(new Error(`The image could not be loaded from ${i}`))}};n.onerror=s=>{r(s)};n.readAsDataURL(o.response)};o.open("GET",i);o.responseType="blob";o.withCredentials=t==="use-credentials";o.send()});jH=(i,t)=>{return new Promise((e,r)=>{const o=new Image;o.onload=()=>{e(o)};o.onerror=()=>{r(new Error(`Failed to load image with src:${i}`))};o.crossOrigin=t;o.src=i})};Qlt=(i,t)=>new Promise((e,r)=>{Zlt(i,t).then(o=>{const n=new Image;n.addEventListener("load",()=>{e(n)});n.src=o}).catch(()=>{jH(i,t).then(o=>e(o)).catch(o=>{r(o)})})});$k=async({url:i,image:t,crossOrigin:e="anonymous"})=>{try{if(t&&t.src&&t.src.substr(0,5)==="data:"||t&&t.src&&t.src.includes(".svg")){return t}if(typeof i==="string"&&i.substr(0,5)==="data:"||typeof i==="string"&&i.includes(".svg")){return jH(i,e)}return Qlt(i||t.src,e)}catch(r){throw new Error(r)}}});var tct,hr;var hv=d(()=>{Tt();R();U();$H();tct={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};hr=class{constructor(t){this.setImage=async t=>{try{const{crossOrigin:e}=this.editor.configStore.config.engine;if(typeof t==="string"&&!t.trim()||t===void 0||t===null){this.state.image=null}else if(typeof t==="string"){this.state.image=await $k({url:cn(t)?t:this.editor.assetProvider.getPath(t),crossOrigin:e})}else if(t instanceof HTMLImageElement){this.state.image=await $k({image:t,crossOrigin:e})}if(this.isWebcam){this.state.isWebcam=false}}catch(e){throw new Error(e)}};this.setImageLoadedToEngine=t=>{this.state.imageLoadedToEngine=t};this.newImage=t=>{this.editor.init(t)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=t;this.state=Q(tct)}selectTool(t){var r,o,n;const{licenseChecker:e}=this.editor.configStore;if(this.state.tool!==t&&(e==null?void 0:e.isToolAllowed(t))&&(this.image||t==="library"||t==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const s=(n=(o=(r=this.editor.configStore.state.config["customTool"])==null?void 0:r.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(t==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,t);this.state.tool=t;this.editor.configStore.events.onToolChanged(t);switch(t){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(t){this.state.isWebcam=t}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};f([C],hr.prototype,"selectTool",1);f([C],hr.prototype,"selectWebcam",1);f([C],hr.prototype,"setImage",2);f([C],hr.prototype,"setImageLoadedToEngine",2);f([C],hr.prototype,"newImage",2);f([C],hr.prototype,"dispose",2);f([S],hr.prototype,"webcamLabel",1);f([S],hr.prototype,"tool",1);f([S],hr.prototype,"isWebcam",1);f([S],hr.prototype,"image",1);f([S],hr.prototype,"imageLoadedToEngine",1)});var ect,Kk,Xk,Oi;var fv=d(()=>{Tt();R();U();ect={height:150,width:150};Kk={height:0,width:0};Xk=class{constructor(t){this.canvasClickDisabled=Q.box(false);this.resizeCanvas=(t=null)=>{const e=this.editor.activeStore.tool;const r=t==="transform"||!t&&e==="transform";const{isLayoutAdvanced:o,measurements:n}=this.editor.configStore;const{storedSize:s}=this.editor.canvasStore;let a=0;if(!o&&r){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(t==="transform"&&e==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:s.width,height:s.height+a})};this.setCanvasSize=t=>{this.state.canvasSize=t};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=t;this.state=Q(Xk.initialState)}setCanvasElement(t){this.canvas=t;this.editor.engineMediator.preview.createPreview(t);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:t,width:e,render:r}){const{imageLoadedToEngine:o}=this.editor.activeStore;if(t>Kk.height&&e>Kk.width){this.state.storedSize={width:e,height:t};if(this.state.canvasSize.height===0){this.state.canvasSize={width:e,height:t}}if(r&&o){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return O.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(t){const e=this.editor.engine.getContainersAtPreviewPoint(t,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(r=>r.getID()).filter(r=>r!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(e)}};Oi=Xk;Oi.initialState={canvasSize:Kk,storedSize:ect};f([C],Oi.prototype,"setCanvasElement",1);f([C],Oi.prototype,"saveDimensions",1);f([C],Oi.prototype,"resizeCanvas",2);f([C],Oi.prototype,"disableCanvasClick",1);f([C],Oi.prototype,"enableCanvasClick",1);f([C],Oi.prototype,"setCanvasSize",2);f([C],Oi.prototype,"dispose",2);f([S],Oi.prototype,"isCanvasClickable",1);f([S],Oi.prototype,"canvasSize",1);f([S],Oi.prototype,"storedSize",1);f([S],Oi.prototype,"sizeVector",1);f([S],Oi.prototype,"sizeVectorMagnitude",1)});var ict,Wr;var gv=d(()=>{Tt();R();ict={type:null,identifier:null,isVisible:false,error:""};Wr=class{constructor(t){this.showActionModal=({type:t,identifier:e,error:r,handleConfirm:o,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=e;this.state.type=t;this.state.error=r||"";this.handleConfirm=o;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=t.configStore;this.state=Q(ict)}showInfoModal(t){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=t;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:t}=this.state;const e=this.getModalLocale();if(e){const{bodyLabel:r,headerLabel:o,buttonYes:n,buttonNo:s}=e;return{headerLabel:o,bodyLabel:r,confirmLabel:n,dismissLabel:s,isVisible:t,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:t,measurements:{basicCanvasOffset:e,advancedUIToolControlBar:r,advancedUIToolbar:o},isOrderDefault:n}=this.configStore;const s=(r.width+o.width)*(!n?-1:1);const a=e;return t?{x:s/2,y:0}:{x:0,y:-a}}getModalLocale(){const{identifier:t,error:e,type:r}=this.state;const{locale:o}=this.configStore;if(!r||!t||r==="textEdit")return null;if(r&&t&&o[`${r}Modals`]&&o[`${r}Modals`][t]){const n=o[`${r}Modals`][t];let{body:s}=n;if(s&&typeof e==="object"){Object.keys(e).forEach(l=>{s=s.replace(`\${${l}}`,e[l])})}else if(s){s=s.replace("${error}",e)}let a=n.heading;if(r==="error"||r==="warning"){const l={error:o.common.error,warning:o.common.warning};const c=r==="error"?l.error:l.warning;a=`${c}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};f([C],Wr.prototype,"showActionModal",2);f([C],Wr.prototype,"showInfoModal",1);f([C],Wr.prototype,"showTextEditModal",1);f([C],Wr.prototype,"hideModal",2);f([C],Wr.prototype,"dispose",2);f([S],Wr.prototype,"modalProps",1);f([S],Wr.prototype,"isVisible",1);f([S],Wr.prototype,"type",1);f([S],Wr.prototype,"identifier",1);f([S],Wr.prototype,"positionOffset",1)});var ti;var bv=d(()=>{Tt();U();ti=class{constructor(t){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(t=>t/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:t,maxOffsetY:e}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=e}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=t}this.savePosition();this.scaleRender()}};this.setOffset=t=>{const{canDragX:e,canDragY:r}=this.checkOffset(t);if(e){this.offset.x=t.x}if(r){this.offset.y=t.y}this.scaleRender()};this.editor=t}setInitialTransform(t=0){const e=Eo();const{scaleImageToFit:r}=this.editor.configStore.config;const{transform:o}=this.editor.engineMediator.preview;Ve(()=>{const n=Math.abs(t||o.scale.x);this.setDefaultScale(r?n:Math.min(1*e,n));this.setPosition(o.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:t,height:e}=this.editor.canvasStore.canvas;this.setPosition({x:t/2,y:e/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(t){this.state.position.x=t.x;this.state.position.y=t.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(t){if(this.defaultScale!==1){const r=this.SCALE_LEVELS.findIndex(o=>o===this.defaultScale);if(r!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,r),...this.SCALE_LEVELS.slice(r+1)]}}const e=this.SCALE_LEVELS.findIndex(r=>r===t);if(e!==-1){this.state.scaleIndex=e}else{const r=this.SCALE_LEVELS.findIndex((o,n)=>{if(n===0){return t0;const g=u>0;const x=m-a;const v=p-l;return{canDragX:x<0,canDragY:v<0,maxOffsetX:h?-x:x,maxOffsetY:g?-v:v}}calculateScale(t=0,e=this.previewSize,r=this.defaultScale){const{width:o,height:n}=e;const s=new O({x:o,y:n});const a=new O(Math.abs(s.x*Math.cos(t))+Math.abs(s.y*Math.sin(t)),Math.abs(s.x*Math.sin(t))+Math.abs(s.y*Math.cos(t)));const l=s.subtract(a).divide(2).multiply(r).abs;if(l.y>l.x){return l.y*2/s.y+r}return l.x*2/s.x+r}get defaultIndex(){return this.SCALE_LEVELS.findIndex(t=>t===this.defaultScale)}getPositionWithOffset(t=this.offset){const{position:e}=this;return{x:e.x-t.x,y:e.y-t.y}}scaleRender(t=false){const e=this.editor.scale.getPositionWithOffset();const r=t?this.defaultScale:this.scale;const o={x:r,y:r};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(e);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:e,rotation:0});if(!t){this.editor.render()}}get scale(){const t=this.state.scaleIndex;return t!==-1?this.SCALE_LEVELS[t]:this.defaultScale}get zoomLevel(){const t=Eo();return(this.scale/t*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const t=this.state.scaleIndex;const e=t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;const{previewSize:r}=this;return{width:r.width*e/this.defaultScale,height:r.height*e/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};f([Q],ti.prototype,"state",2);f([C],ti.prototype,"in",2);f([C],ti.prototype,"out",2);f([C],ti.prototype,"setInitialTransform",1);f([C],ti.prototype,"resetScale",1);f([C],ti.prototype,"resetPosition",1);f([C],ti.prototype,"setPosition",1);f([C],ti.prototype,"savePosition",1);f([C],ti.prototype,"setDefaultScale",1);f([C],ti.prototype,"setScaleToDefault",1);f([S],ti.prototype,"scale",1);f([S],ti.prototype,"zoomLevel",1);f([S],ti.prototype,"canDrag",1);f([S],ti.prototype,"canZoomOut",1);f([S],ti.prototype,"canZoomIn",1);f([S],ti.prototype,"position",1);f([S],ti.prototype,"scaledSize",1)});var KH,rct,Gn,ze;var qk=d(()=>{Tt();U();KH=[[0,0],[0,1],[1,0],[1,1]];rct=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];Gn=class{constructor(t,e,r="center",o=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=e;this.m=r==="center"?Gn.movePivotTo([.5,.5]):KH;this.considerRotation=o;this.considerFlip=n;this.configStore=t.configStore}static getFlippedEdgeIndex(t,e,r){return rct[(e?1:0)+(r?2:0)][t]}static movePivotTo(t){return KH.map(e=>[e[0]-t[0],e[1]-t[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(t,e,r){const o=Gn.getFlippedEdgeIndex(t,e,r);const n=this.m[o][0]*this.size.width;const s=this.m[o][1]*this.size.height;return{width:n,height:s}}get leftTop(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(0,e,r);return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottom(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(1,e,r);return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightTop(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(2,e,r);return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottom(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(3,e,r);return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(1,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(3,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftMid(){const t=new O(this.leftTop);const e=new O(this.leftBottom);return t.add(e).divide(2)}get rightMid(){const t=new O(this.rightTop);const e=new O(this.rightBottom);return t.add(e).divide(2)}};ze=Gn;ze.coordinatesWithRotation=({width:t,height:e},r,o,n,s,a)=>{let l=t*Math.cos(r)-e*Math.sin(r)+a.x;let c=t*Math.sin(r)+e*Math.cos(r)+a.y;if(o){l=s.x*2-l}if(n){c=s.y*2-c}return new O({x:l,y:c}).rounded};f([S],ze.prototype,"position",1);f([S],ze.prototype,"size",1);f([S],ze.prototype,"rotation",1);f([S],ze.prototype,"flipHorizontally",1);f([S],ze.prototype,"flipVertically",1);f([S],ze.prototype,"flipCenter",1);f([S],ze.prototype,"leftTop",1);f([S],ze.prototype,"leftBottom",1);f([S],ze.prototype,"rightTop",1);f([S],ze.prototype,"rightBottom",1);f([S],ze.prototype,"leftBottomHandle",1);f([S],ze.prototype,"rightBottomHandle",1);f([S],ze.prototype,"leftMid",1);f([S],ze.prototype,"rightMid",1)});var Yk=d(()=>{dv();Yh();Qh();Jh();jk();Gk();Uk();Hk();Wk();pv();hv();fv();gv();bv();qk()});var Ft;var XH=d(()=>{Tt();U();Dk();Ft=class{constructor(t,e){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:Q.map({})};this.configStore=t.configStore;this.id=At();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=e}changeIdentifier(t){this.state.identifier=t;const e=this.state.cropState.get(`${this.id}-${t}`);if(!e){this.state.cropState.set(`${this.id}-${t}`,{...jo})}}changeRatio(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){this.state.cropState.set(`${this.id}-${this.identifier}`,{...e,ratio:t})}}changeSize(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t.width&&t.width>0){e.size.width=Math.round(t.width)}if(t.height&&t.height>0){e.size.height=Math.round(t.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeHeight(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.height=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changeWidth(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.width=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changePositionX(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r&&t<=e-this.minCropSize&&t>=0){r.position.x=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}return false}changePositionY(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r&&t<=e-this.minCropSize&&t>=0){r.position.y=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}return false}changePosition(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r){if(t.x<=e.width-this.minCropSize&&t.x>=0&&t.y<=e.height-this.minCropSize&&t.y>=0){r.position.x=Math.round(t.x);r.position.y=Math.round(t.y);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}}return false}changeLockResolution(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.lockResolution=t!==void 0?t:!e.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeForceDimensions(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.forceDimensions=t;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}clearState(){this.state.cropState.forEach((t,e)=>e.startsWith(this.id)&&this.state.cropState.delete(e))}setRotation(t){this.state.rotationInDegrees=t}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:t,flipVertically:e}){this.state.flipHorizontally=t;this.state.flipVertically=e}setOutputRotation(t){this.state.outputRotation=t}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:t,height:e}=this.defaults.maxCropMaskSize;return new O(t/2,e/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:jo.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:jo.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:jo.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:jo.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:jo.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:jo.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:jo.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:jo.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:jo.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};f([Q],Ft.prototype,"state",2);f([C],Ft.prototype,"changeIdentifier",1);f([C],Ft.prototype,"changeRatio",1);f([C],Ft.prototype,"changeSize",1);f([C],Ft.prototype,"changeHeight",1);f([C],Ft.prototype,"changeWidth",1);f([C],Ft.prototype,"changePositionX",1);f([C],Ft.prototype,"changePositionY",1);f([C],Ft.prototype,"changePosition",1);f([C],Ft.prototype,"changeLockResolution",1);f([C],Ft.prototype,"changeForceDimensions",1);f([C],Ft.prototype,"clearState",1);f([C],Ft.prototype,"setRotation",1);f([C],Ft.prototype,"resetRotation",1);f([C],Ft.prototype,"resetOutputRotation",1);f([C],Ft.prototype,"resetFlip",1);f([C],Ft.prototype,"updateFlip",1);f([C],Ft.prototype,"setOutputRotation",1);f([C],Ft.prototype,"flipHorizontally",1);f([C],Ft.prototype,"flipVertically",1);f([C],Ft.prototype,"dispose",2);f([S],Ft.prototype,"flipCenter",1);f([S],Ft.prototype,"isFlippedHorizontal",1);f([S],Ft.prototype,"isFlippedVertical",1);f([S],Ft.prototype,"identifier",1);f([S],Ft.prototype,"height",1);f([S],Ft.prototype,"width",1);f([S],Ft.prototype,"position",1);f([S],Ft.prototype,"ratio",1);f([S],Ft.prototype,"size",1);f([S],Ft.prototype,"x",1);f([S],Ft.prototype,"y",1);f([S],Ft.prototype,"lockResolution",1);f([S],Ft.prototype,"forceDimensions",1);f([S],Ft.prototype,"selectedCrop",1);f([S],Ft.prototype,"rotationInDegrees",1);f([S],Ft.prototype,"outputRotation",1)});var Jk;var qH=d(()=>{Tt();U();hm();Jk=class{constructor(t){this.transforms={output:JSON.stringify(re.IDENTITY),preview:JSON.stringify(re.IDENTITY)};this.setFrameOpacity=t=>{this.frameOpacity=t;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=t=>{this.overlayOpacity=t;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=t;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:t,flipVertically:e,rotation:r,outputRotation:o}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new O(this.transformToolStore.leftTopRespectFlip).add(new O(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new O(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const s=this.engineMediator.preview.container;const{outputContainer:a}=this.editor;a.setResolution(ct(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:e,flipHorizontally:t});const l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let c=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:g,defaultImageSize:x}=this.transformToolStore;const v=this.transformToolStore.maxCropMaskSize;const b={height:g.height*x.height/v.height,width:g.width*x.width/v.width};c=b.width/this.transformToolStore.localOutputImageSize.width}const u=Math.abs(l.x);const m=c/(u/this.transformToolStore.defaultScale);const p={x:m,y:m};const h=-(r-o);a.setTransform({scale:p,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(t){this.transforms=t}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const t=this.engineMediator.preview.container;const{outputContainer:e}=this.editor;const r=JSON.parse(this.transforms.preview);e.setResolution(ct(this.transformToolStore.defaultImageSize));t.setTransform(r);e.setTransform(JSON.parse(this.transforms.output));const o=r.scale;e.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(r);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(t,e=true){const{width:r,height:o}=this.editor.engineMediator.image.container.getBounds();const n=UA(t)?{width:o,height:r}:{width:r,height:o};this.editor.outputContainer.rotate(t,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:s}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(s);Ve(()=>{this.editor.scale.setInitialTransform();const a=this.getScaleWithFlip(s);this.engineMediator.preview.container.setScale(a);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(e){this.editor.render()}}applyPreviewTransform(){const{rotation:t,flipHorizontally:e,flipVertically:r}=this.transformToolStore.rotateFlipState;const o=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let s=t;if(e){s=pm(s)}if(r){s=pm(s)}const a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a)}getScaleWithFlip(t=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:e,flipVertically:r}=this.transformToolStore.rotateFlipState;const o=e?-1:1;const n=r?-1:1;const s=this.editor.scale.calculateScale(t);return{x:s*o,y:s*n}}saveTransforms(){const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:t,output:e}}saveTransformsBasedOnFlip(){const t=this.engineMediator.preview.container.getTransform();const{scale:e}=t;const{flipVertically:r,flipHorizontally:o}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...t,scale:{x:o?-e.x:e.x,y:r?-e.y:e.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}}});var Zk;var YH=d(()=>{U();Zk=class{constructor(t){this.store=t;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,Ye.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}}});var JH,mu,tt;var Qk=d(()=>{Tt();R();U();Yk();Zi();Nn();XH();qH();YH();JH="identity";mu=class{constructor(t){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=Q.box(false);this.minCropSize=0;this.transformHistory=new Zk(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=t=>{if(!t.trim())return false;let e=this.editor.configStore.config.assetBaseUrl;const{length:r}=e;if(e[r-1]!=="/"){e+="/"}if(`${e}transform`===t){return false}const o=new Image;try{o.src=t;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const t=this.editor.outputContainer.getRotation();if(t!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=t=>{this.localOutputSize.height=Math.round(t.height);this.localOutputSize.width=Math.round(t.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(t.width),height:Math.round(t.height)})};this.changeDefaultScale=t=>{this.defaults.scale=t};this.changeLocalOutputHeight=t=>{this.localOutputSize.height=Math.round(t)};this.changeLocalOutputWidth=t=>{this.localOutputSize.width=Math.round(t)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?dS:mS;this.rotateOutputContainer(e(t))};this.rotateAntiClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?mS:dS;this.rotateOutputContainer(e(t))};this.flipHorizontally=(t=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(t);if(t){this.trackChanges()}};this.flipVertically=(t=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(t);if(t){this.trackChanges()}};this.applyDefaultCrop=(t=false)=>{if(this.identifier==="identity"){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,t)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:t,y:e})=>{const r=this.getRatio();const o=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,t),o.x-n.width);const l=Math.min(Math.max(0,e),o.y-n.height);const c=o.x-a;const u=o.y-l;const m={width:Math.max(this.minCropSize,Math.min(c,s.width-a)),height:Math.max(this.minCropSize,Math.min(u,s.height-l))};if(r==="*"){if(this.changePosition({x:a,y:l})){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);const h=new O(o).subtract({x:p.width,y:p.height});if(this.changePosition(h)){this.changeCropAndOutputSize(p,r)}}};this.onLeftBottom=({x:t,y:e})=>{const r=this.getRatio();const o=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,t),o.x-n.width);const l=Math.max(0,e,o.y+n.height);const c=o.x-a;const u=l-o.y;const m={width:Math.max(1,Math.min(c,s.width-a)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){if(this.changePositionX(a)){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);if(this.changePositionX(o.x-p.width)){this.changeCropAndOutputSize(p,r)}}};this.onRightTop=({x:t,y:e})=>{const r=this.getRatio();const o=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,t,o.x+n.width);const l=Math.min(Math.max(0,e),o.y-n.height);const c=a-o.x;const u=o.y-l;const m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-l))};if(r==="*"){if(this.changePositionY(l)){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);if(this.changePositionY(o.y-p.height)){this.changeCropAndOutputSize(p,r)}}};this.onRightBottom=({x:t,y:e})=>{const r=this.getRatio();const o=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,t,o.x+n.width);const l=Math.max(0,e,o.y+n.height);const c=a-o.x;const u=l-o.y;const m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){this.changeCropAndOutputSize(m)}else{const p=this.proportionalSize(r,m);this.changeCropAndOutputSize(p,r)}};this.onPixelWidth=t=>{const e=JSON.stringify(ct(this.localOutputSize));const r=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(r&&r.ratio){let n=t;let s=this.localOutputSize.height;let{ratio:a}=r;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(t,o.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(s)})}else{const l=mu.placeCropMask(a,o);n=Math.max(Math.min(n,l.width),this.minCropSize);s=n/a;this.changeLocalOutputSize({height:s,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.onPixelHeight=t=>{const e=JSON.stringify(ct(this.localOutputSize));const r=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(r&&r.ratio){let n=t;let s=this.localOutputSize.width;let{ratio:a}=r;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(t,o.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(n)})}else{const l=mu.placeCropMask(a,o);n=Math.max(Math.min(n,l.height),this.minCropSize);s=n*a;this.changeLocalOutputSize({height:n,width:s})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=t=>{this.transformations.setFrameOpacity(t)};this.setOverlayOpacity=t=>{this.transformations.setOverlayOpacity(t)};this.closestRatioReducer=t=>(e,r)=>{if(r===null)return-1;return Math.abs(t-e.ratio)(e,r)=>{if(r===null)return-1;const o=Math.abs(e.dimensions.x/e.dimensions.y);const n=Math.abs(r.dimensions.x/r.dimensions.y);if(o===n){return e.dimensions.x*e.dimensions.y>r.dimensions.x*r.dimensions.y?-1:1}return Math.abs(t-o){const t=this.entityManager.items.findIndex(l=>l.identifier==="imgly_transform_common_custom");if(t!==-1)return this.entityManager.items[t];const e=this.entityManager.items.findIndex(l=>l.ratio==="*");if(e!==-1)return this.entityManager.items[e];const r=ct(this.editor.outputContainer.getResolution());const o=Math.abs(r.width/r.height);const[n]=this.entityManager.items.filter(l=>l.ratio&&typeof l.ratio==="number").sort(this.closestRatioReducer(o));const[s]=this.entityManager.items.filter(l=>l.dimensions&&!l.ratio).sort(this.closestDimensionsReducer(o));if(!n||!s||!n.ratio&&!s.dimensions){return this.entityManager.items[0]}if(!s||!s.dimensions)return n;if(!n||!n.ratio)return s;const a=Math.abs(s.dimensions.x/s.dimensions.y);if(a===n.ratio)return n;return Math.abs(o-n.ratio){let e=this.entityManager.items.find(r=>r.identifier===t);if(!e){e=this.getMatchingItem()}return e};this.editor=t;this.selectedCategory=JH;this.transformStore=new Ft(t,this.defaults);this.transformations=new Jk(t);const{enableRotation:e,enableFlip:r,...o}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new Ne(n,{...o,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new ze(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new ze(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(t){return t*Math.PI/180}static placeCropMask(t,e){if(e.height*t>e.width){const o=e.width/t;return{height:o,width:e.width,yChanged:true}}const r=e.height*t;return{height:e.height,width:r,yChanged:false}}changeIdentifier(t,e=false){this.transformStore.changeIdentifier(t);const r=this.getCropMask(t,this.defaults.imageSize);if(r){this.transformStore.changeRatio(r.ratio);this.changeLocalOutputSize(r);this.updatePreviewSizeWRTImageSize();if(r.yChanged!==void 0){this.updateInitialCropMaskPosition(r.yChanged)}if(r.dimensions){this.changeLocalOutputSize({width:r.dimensions.x,height:r.dimensions.y})}if(e){this.trackChanges()}}}setDragMode(t){this.dragMode.set(t)}getCropMask(t,e){const r=this.getTransform(t);if(r){const{ratio:o,forceDimensions:n,lockDimensions:s,dimensions:a=null}=r;if(n){this.transformStore.changeForceDimensions(n)}if(s){this.transformStore.changeLockResolution(s)}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return{...e,yChanged:void 0,ratio:"*",dimensions:a};default:return{...mu.placeCropMask(r.ratio,e),ratio:r.ratio,dimensions:a}}}else{const{x:l,y:c}=r.dimensions;return{...mu.placeCropMask(l/c,e),ratio:null,dimensions:a}}}return null}setCropDefaults(t=false){const e=this.editor.outputContainer.getResolution();this.setDefaultImageSize(e);const r=this.editor.getPreviewSize();const{position:o}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(r);this.setDefaultCropPosition({x:o.x-r.width/2,y:o.y-r.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!t){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(t){this.defaults.imageSize={...ct(t)};if(!this.lockResolution){this.localOutputSize={...ct(t)}}}setMaxCropSize(t){this.defaults.maxCropMaskSize.height=t.height;this.defaults.maxCropMaskSize.width=t.width}setDefaultCropPosition(t){this.defaults.cropMaskPosition.x=t.x;this.defaults.cropMaskPosition.y=t.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(t){this.selectedCategory=this.selectedCategory===t?JH:t}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:t,output:e})}changePosition(t){return this.transformStore.changePosition(t,this.defaults.maxCropMaskSize)}changePositionX(t){return this.transformStore.changePositionX(t,this.defaults.maxCropMaskSize.width)}changePositionY(t){return this.transformStore.changePositionY(t,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:t,height:e},r,o=true){this.transformStore.changeWidth(t);this.transformStore.changeHeight(e);if(!this.lockResolution){const{height:n,width:s}=this.defaults.maxCropMaskSize;const{height:a,width:l}=this.defaults.imageSize;let c=a/n*e;const u=l/s*t;if(r){c=u/r}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(u),height:Math.round(c)})}if(e>=this.minCropSize){this.changeLocalOutputHeight(c)}if(t>=this.minCropSize){this.changeLocalOutputWidth(u)}}}transformRender(t=true){this.transformations.applyPreviewTransform();if(t){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:t,flipVertically:e}=this.rotateFlipState;const{identifier:r,rotationInDegrees:o}=this;const n=Gl(o);const s=uS(xb(this.editor.engineMediator.output.container.getRotation())+o);const{start:a,end:l}=this.convertUIToOperationOptions(n,s);return{flipHorizontally:t,flipVertically:e,rotation:n,start:a,end:l,identifier:r,outputRotation:s}}getStartEndForOperation(t){const{leftTop:e,rightBottom:r,maxCropMaskSize:o}=this;const n=e.y;const s=e.x;const a=r.x;const l=r.y;switch(t){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}getStartEndForUI(t,e,r){const{maxCropMaskSize:o}=this;const n=e.y;const s=e.x;const a=r.x;const l=r.y;switch(t){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}convertOperationOptionsToUI({start:t,end:e,rotation:r,outputRotation:o}){const n=o===90||o===270;const s=n?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);const a=Math.cos(r);const l=Math.sin(r);const c=this.calculateScale(r);const u=new O(Math.min(t.x,e.x),Math.min(t.y,e.y));const m=new O(Math.max(t.x,e.x),Math.max(t.y,e.y));const p=m.subtract(u).divide(2);const h=u.add(p).multiply(s);const g=h.subtract(s.multiply(.5));const x=new O(g.x*a-g.y*l,g.x*l+g.y*a).multiply(c);const v=s.multiply(.5).add(x);const b=v.divide(s);const T=b.subtract(p.multiply(c));const k=b.add(p.multiply(c));const E=n?O.fromSize(this.maxCropMaskSize).swapped:O.fromSize(this.maxCropMaskSize);const A=T.multiply(E);const I=k.multiply(E);const{leftTop:F,rightBottom:Z}=this.getStartEndForUI(o,A,I);return{start:new O(F),end:new O(Z)}}convertUIToOperationOptions(t,e){const r=e===90||e===270;const o=r?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);const n=r?O.fromSize(this.maxCropMaskSize).swapped:O.fromSize(this.maxCropMaskSize);const s=Math.cos(-t);const a=Math.sin(-t);const l=this.calculateScale(t,r);const{leftTop:c,rightBottom:u}=this.getStartEndForOperation(e);const m=new O(c).divide(n);const p=new O(u).divide(n);const h=p.subtract(m).divide(2);const g=m.add(h).multiply(o);const x=g.subtract(o.multiply(.5));const v=new O(x.x*s-x.y*a,x.x*a+x.y*s).divide(l);const b=o.multiply(.5).add(v);const T=b.divide(o);const k=T.subtract(h.divide(l));const E=T.add(h.divide(l));return{start:k,end:E}}calculateScale(t,e=false){const r=e?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);const o=new O(Math.abs(r.x*Math.cos(t))+Math.abs(r.y*Math.sin(t)),Math.abs(r.x*Math.sin(t))+Math.abs(r.y*Math.cos(t)));const n=r.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/r.y+1:n.x*2/r.x+1}updateStateFromSerialization(t){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=Math.round(xb(t.rotation));this.transformStore.setRotation(e>180?e-360:e);this.transformations.rotateOutputContainer(Gl(uS(t.outputRotation||0)));if(t.identifier){this.transformStore.changeIdentifier(t.identifier)}if(t.start&&t.end){if(t.end.x===0||t.end.y===0){t.end.x=1;t.end.y=1}const{start:r,end:o}=this.convertOperationOptionsToUI({start:new O(t.start),end:new O(t.end),rotation:t.rotation,outputRotation:t.outputRotation});this.changePositionX(r.x);this.changePositionY(r.y);const n=o.x-r.x;const s=o.y-r.y;this.transformStore.changeSize({width:n,height:s});const{maxCropMaskSize:a,imageSize:l}=this.defaults;const c={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(c)}if(t.flipHorizontally){this.flipHorizontally(false)}if(t.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(t){this.defaultAngle=t}updateCanvasControls(t){const e=ct(this.cropMaskPosition);const r=ct(this.cropMaskSize);const o=ct(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*r.height/t.height,width:o.width*r.width/t.width},void 0,false);this.changePosition({y:o.height*e.y/t.height,x:o.width*e.x/t.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(t){this.transformStore.setRotation(t);this.transformRender()}async rotateOutputContainer(t,e=true){this.setDragMode(true);this.transformations.rotateOutputContainer(t,e);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,false)}clickableCanvas(t){this.editor.clickableCanvas(t)}proportionalSize(t,e,r=this.defaults.maxCropMaskSize,o=this.minCropSize){let n=e.height*t;let{height:s}=e;if(n>r.width||n1){return{width:this.minCropSize*t,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*t}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const t=this.getTransform(this.identifier);if(t){if(Object.prototype.hasOwnProperty.call(t,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return t.ratio}const{x:e,y:r}=t.dimensions;return e/r}return"*"}};tt=mu;f([Q],tt.prototype,"selectedCategory",2);f([Q],tt.prototype,"defaults",2);f([Q],tt.prototype,"localOutputSize",2);f([C],tt.prototype,"changeIdentifier",1);f([C],tt.prototype,"setDragMode",1);f([C],tt.prototype,"setCropDefaults",1);f([C],tt.prototype,"setDefaultImageSize",1);f([C],tt.prototype,"setMaxCropSize",1);f([C],tt.prototype,"setDefaultCropPosition",1);f([C],tt.prototype,"resetCrop",1);f([C],tt.prototype,"toggleCategorySelection",1);f([C],tt.prototype,"pureReset",1);f([C],tt.prototype,"reset",2);f([C],tt.prototype,"changePosition",1);f([C],tt.prototype,"changePositionX",1);f([C],tt.prototype,"changePositionY",1);f([C],tt.prototype,"changeCropAndOutputSize",1);f([C],tt.prototype,"onLeave",1);f([C],tt.prototype,"onEnter",1);f([C],tt.prototype,"changeLocalOutputSize",2);f([C],tt.prototype,"changeDefaultScale",2);f([C],tt.prototype,"changeLocalOutputHeight",2);f([C],tt.prototype,"changeLocalOutputWidth",2);f([C],tt.prototype,"changeLockResolution",2);f([C],tt.prototype,"setRotation",1);f([C],tt.prototype,"rotateClockwise",2);f([C],tt.prototype,"rotateAntiClockwise",2);f([C],tt.prototype,"rotateOutputContainer",1);f([C],tt.prototype,"flipHorizontally",2);f([C],tt.prototype,"flipVertically",2);f([C],tt.prototype,"applyDefaultCrop",2);f([C],tt.prototype,"applyInitialCrop",1);f([C],tt.prototype,"updateCropMask",2);f([C],tt.prototype,"clickableCanvas",1);f([C],tt.prototype,"onLeftTop",2);f([C],tt.prototype,"onLeftBottom",2);f([C],tt.prototype,"onRightTop",2);f([C],tt.prototype,"onRightBottom",2);f([C],tt.prototype,"proportionalSize",1);f([C],tt.prototype,"onPixelWidth",2);f([C],tt.prototype,"onPixelHeight",2);f([C],tt.prototype,"updateInitialCropMaskPosition",1);f([C],tt.prototype,"updatePreviewSizeWRTImageSize",1);f([C],tt.prototype,"dispose",2);f([S],tt.prototype,"cropState",1);f([S],tt.prototype,"identifier",1);f([S],tt.prototype,"ratio",1);f([S],tt.prototype,"height",1);f([S],tt.prototype,"width",1);f([S],tt.prototype,"localOutputImageSize",1);f([S],tt.prototype,"localOutputHeight",1);f([S],tt.prototype,"localOutputWidth",1);f([S],tt.prototype,"lockResolution",1);f([S],tt.prototype,"forceDimensions",1);f([S],tt.prototype,"rotationInDegrees",1);f([S],tt.prototype,"outputRotation",1);f([S],tt.prototype,"isDragMode",1);f([S],tt.prototype,"rotateFlipState",1);f([S],tt.prototype,"selectedCategoryIdentifier",1);f([S],tt.prototype,"categories",1);f([S],tt.prototype,"items",1);f([S],tt.prototype,"config",1);f([S],tt.prototype,"locale",1);f([S],tt.prototype,"isOptionSelected",1);f([S],tt.prototype,"leftTop",1);f([S],tt.prototype,"leftBottom",1);f([S],tt.prototype,"rightTop",1);f([S],tt.prototype,"rightBottom",1);f([S],tt.prototype,"isFlippedHorizontal",1);f([S],tt.prototype,"isFlippedVertical",1);f([S],tt.prototype,"leftTopRespectFlip",1);f([S],tt.prototype,"leftBottomRespectFlip",1);f([S],tt.prototype,"rightTopRespectFlip",1);f([S],tt.prototype,"rightBottomRespectFlip",1);f([S],tt.prototype,"cropMaskPosition",1);f([S],tt.prototype,"cropMaskSize",1);f([S],tt.prototype,"state",1);f([S],tt.prototype,"defaultImageSize",1);f([S],tt.prototype,"maxCropMaskSize",1);f([S],tt.prototype,"minCropMaskSize",1);f([S],tt.prototype,"defaultCropMaskPosition",1);f([S],tt.prototype,"defaultScale",1)});var ZH=d(()=>{Dk();Qk()});var QH,oct,tI,nct,ef,nt;var eI=d(()=>{Tt();QH=y(Ju());R();U();Zi();qk();hm();fk();bk();xk();wk();oct={};tI="none";nct={position:{x:0,y:0},rotation:0};ef=class{constructor(t){this.state=Q.map(oct);this.selectedId=Q.box(tI);this.editMode=Q.box(false);this.dragMode=Q.box(false);this.minLength=0;this.counter=0;this.addSticker=async(t,e=true)=>{await this.addStickerAsync(t,e)};this.addStickerAsync=async({spriteId:t,state:e,transform:r},o=true)=>{return new Promise((n,s)=>{r=this.getInitialTransform(r);const{identifier:a}=e;const l=this.editor.orderHelper.addSprite(a);this.editor.engine.addStickerFromAssets(a,this.editor.engineMediator.image.container,l).then(async c=>{if(t){c.setData({id:t})}const u=c.getID();this.container[u]=c;this.editor.orderHelper.renameSprite(a,u);const m=this.getSize(u);m.width*=c.getScale().x;m.height*=c.getScale().y;c.setPivot(.5,.5);let p;if(r.scale){p=r.scale}else if(r.size){p={x:r.size.width/m.width,y:r.size.height/m.height}}else{const v=this.editor.shortestOutputSide*.4;const b=ef.magnitude(v)/ef.sizeMagnitude(c.getSizeInWorldSpace());p={x:b,y:b}}const{flipHorizontally:h,flipVertically:g}=this.editor.outputContainer.getData();c.setFlipHorizontally(h);c.setFlipVertically(g);c.setTransform({position:r.position,scale:p,rotation:r.rotation});if(e.flipHorizontally!==void 0){c.setFlipHorizontally(e.flipHorizontally!==h)}if(e.flipVertically!==void 0){c.setFlipVertically(e.flipVertically!==g)}this.setContainerProperties(u,{...e});const x=c.getData();this.setInitialSpriteState(u,"sticker");this.stickerToolStore.setState(u,{...x,identifier:a});await this.editor.renderPromise();if(o){this.setId(u);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(c=>{console.error(c);s()})})};this.addText=async(t,e=true)=>{await this.addTextAsync(t,e)};this.addTextAsync=({spriteId:t,state:e,transform:r},o=true)=>{return new Promise((n,s)=>{r=this.getInitialTransform(r);const a=this.editor.orderHelper.addSprite(e.identifier);const l=this.editor.shortestOutputSide;const c={fontIdentifier:e.identifier,text:e.text,width:e.width||l*.6,fontSize:e.fontSize||l*.1,lineHeight:e.lineHeight,alignment:e.alignment,textColor:e.textColor,backgroundColor:e.backgroundColor};this.editor.engine.addTextWithFontLoading(c,this.editor.engineMediator.image.container,a).then(async u=>{if(t){u.setData({id:t})}const m=u.getID();this.container[m]=u;this.editor.orderHelper.renameSprite(e.identifier,m);const{flipHorizontally:p,flipVertically:h}=this.editor.outputContainer.getData();u.setFlipHorizontally(p);u.setFlipVertically(h);u.setPivot(.5,.5);u.setPosition(r.position);u.setRotation(r.rotation);this.setInitialSpriteState(m,"text");const g=u.getData();this.textToolStore.setState(m,{...g});await this.editor.renderPromise();if(o){this.setId(m);this.addSnapshot("add",this.textLocale.add)}n()}).catch(u=>{console.error(u);s()})})};this.addTextDesign=async(t,e=true,r=false)=>{try{await this.addTextDesignAsync(t,e,r)}catch(o){console.warn(o)}};this.addTextDesignAsync=({spriteId:t,state:e,transform:r},o=true,n=false)=>{return new Promise((s,a)=>{r=this.getInitialTransform(r);const l=this.editor.orderHelper.addSprite(e.identifier);const c=this.editor.shortestOutputSide;const u={width:e.width||c*.6,text:e.text,color:e.color,inverted:e.isInverted,seed:e.seed,padding:e.padding};this.editor.engine.addTextDesignAsync(e.identifier,u,this.editor.engineMediator.image.container,l).then(async m=>{if(t){if(n){this.pureRemoveSprite(t);this.textDesignToolStore.state.delete(t)}m.setData({id:t})}const p=m.getID();this.container[p]=m;this.editor.orderHelper.renameSprite(e.identifier,p);const{flipHorizontally:h,flipVertically:g}=this.editor.outputContainer.getData();m.setFlipHorizontally(h);m.setFlipVertically(g);m.setPivot(.5,.5);m.setPosition(r.position);m.setRotation(r.rotation);this.setInitialSpriteState(p,"textdesign");const x=m.getData();this.textDesignToolStore.setState(p,{...x,identifier:e.identifier});await this.editor.renderPromise();if(o){this.setId(p);this.addSnapshot("add",this.textDesignLocale.add)}s()}).catch(m=>{a(m)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=t=>{this.editor.clickableCanvas(t)};this.setContainerProperties=(t,e,r=false)=>{this.container[t].setData(e);if(r){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(t,e)=>{this.container[t].setPosition(e)};this.pureRemoveSprite=t=>{this.editor.engine.removeContainer(this.container[t]);const e=this.container[t].getIndexInParent();if(e===-1){delete this.container[t];this.state.delete(t);this.editor.orderHelper.removeSprite(t);return true}return false};this.deleteSprite=(t=this.id)=>{const e=this.state.get(t);if(e.tool==="sticker"){this.stickerToolStore.delete()}else if(e.tool==="text"){this.textToolStore.delete()}else if(e.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=t=>{const e=this.pureRemoveSprite(t);if(e){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(t,e)=>{this.editor.addSnapshot(void 0,t,e)};this.spriteSnapshot=t=>{this.addSnapshot("edit",this.historyLocale[t])};this.addNewText=async(t,e)=>{if(this.textToolStore.doesTextAssetExist(e.identifier)){await this.addTextAsync({...t,state:e},false)}else{throw new Do(e.identifier)}};this.addNewTextDesign=async(t,e)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(e.identifier)){await this.addTextDesignAsync({...t,state:e},false)}else{throw new Do(e.identifier)}};this.addNewSticker=async(t,e)=>{if(this.stickerToolStore.doesStickerAssetExist(e.identifier)){await this.addStickerAsync({...t,state:e},false)}else{throw new Do(e.identifier)}};this.getSpriteHistoryState=()=>{const t=ct(this.textToolStore.state);const e=ct(this.textDesignToolStore.state);const r={common:ct(this.state),["sticker"]:ct(this.stickerToolStore.state),["text"]:t,["textdesign"]:e,spriteIdList:Object.keys(this.container)};Object.keys(r.common).forEach(o=>{r.common[o].size=this.container[o].getSizeInWorldSpace();r.common[o].position=this.container[o].getPosition();r.common[o].order=this.container[o].getIndexInParent()});return r};this.updateStateFromSerialization=async(t,e,r)=>{if(e&&e.length){try{const o=await Promise.all(e.map(async({svg:n,raster:s,name:a,identifier:l})=>{const c=(n==null?void 0:n.data)?"image/svg+xml":s.type;const u=`data:${c};base64,${(n==null?void 0:n.data)||s.data}`;const m=await sv(u,150);return{stickerURI:u,thumbnailURI:m,name:a,type:c,identifier:l}}));await this.stickerToolStore.addCustomStickerAsset(o)}catch(o){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(t.text){await this.textToolStore.loadFonts()}if(t.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(t.spriteIdList,t,r)};this.updateStateFromHistory=async t=>{const e=Object.keys(this.container);const r=e.filter(o=>t.spriteIdList.indexOf(o)===-1);r.forEach(o=>{this.pureRemoveSprite(o)});await this.updateStateByHistoryState(t.spriteIdList,t,0)};this.serializableState=async()=>{const t=this.editor.spriteStore.getSpriteHistoryState();Object.keys(t.common).forEach(r=>{const{flipHorizontally:o,flipVertically:n}=this.editor.outputContainer.getData();const s=this.editor.outputContainer.getRotation();const a=n!==o?-t.common[r].rotation:t.common[r].rotation;t.common[r].rotation=n!==o?a+s:a-s});const e=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:r,type:o,stickerURI:n,name:s})=>{const a={identifier:r,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]}}if(o==="image/jpeg"||o==="image/png"||o==="image/gif"){[,a.raster.data]=n.split(",");a.raster.type=o}else{const l=await sv(n);[,a.raster.data]=l.split(",");a.raster.type="image/png"}return a}));return{sprite:t,customStickers:e}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(t=>{this.updatePositionAndSize(t,true);const e=this.state.get(t);if(e){if(e.tool==="text"){const r=this.getContainerProperties(t);this.textToolStore.changeSize(t,r)}else if(e.tool==="textdesign"){const r=this.getContainerProperties(t);this.textToolStore.changeWidth(r.width)}}})};this.setEditMode=t=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(t){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(t)}}};this.setDragMode=t=>{this.dragMode.set(t)};this.setPosition=t=>{const e=this.currentSprite;const r=this.container[this.id];if(e&&r){r.setPosition(this.editor.previewToWorld(t));const{position:o}=this.getSizePositionFromContainer();e.position.x=o.x;e.position.y=o.y;this.state.set(this.id,e);this.editor.render()}};this.setSize=t=>{const e=this.currentSprite;if(e){e.size.width=t.width;e.size.height=t.height;this.state.set(this.id,e)}};this.setRotation=t=>{const e=this.currentSprite;if(e){const{flipHorizontally:r,flipVertically:o}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const s=$h({rotation:t,outputRotation:n,flipHorizontally:r,flipVertically:o});this.container[this.id].setRotation(s);e.rotation=this.container[this.id].getRotation();this.state.set(this.id,e);this.editor.render()}};this.onCanvasClick=t=>{if(!this.isEditMode){this.selectHighestOrderSprite(t)}};this.select=t=>{const e=this.state.get(t);if(e){const r=this.editor.activeStore.tool;if(r!==e.tool){this.editor.activeStore.selectTool(e.tool)}this.setId(t)}};this.selectLast=()=>{const t=this.editor.orderHelper.getLastSpriteId();if(t){this.select(t)}};this.selectNext=()=>{if(this.currentSprite){const t=this.container[this.id];const e=t.getIndexInParent();if(e){const r=Object.keys(this.container).find(o=>this.container[o].getIndexInParent()===e-1);if(r){this.select(r)}}}};this.deselect=()=>{this.setId(tI)};this.bringToFront=async t=>{const e=this.editor.orderHelper.bringToFront(t);this.container[t].setIndexInParent(e);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=t=>{const e=this.state.get(t);const r=this.container[t];r.setFlipHorizontally(!r.getFlipHorizontally());e.flipHorizontally=r.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(t,e);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(t=>{this.pureRemoveSprite(t)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=t=>{const e=this.editor.brushToolStore.containerId();t=t.filter(n=>n!==e);if(t.length<1){this.deselect();return}let r="";let o=0;t.forEach(n=>{const s=this.container[n];const a=s&&s.getIndexInParent()||0;if(a>=o){o=a;r=n}});this.select(r)};this.onCornerDrag=({x:t,y:e})=>{if(this.currentSprite){const r=new O(this.currentSprite.position);const o=new O(t,e);const n=o.subtract(r).magnitude;const s=this.getSize();const a=n*2/ef.sizeMagnitude(s);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:s.width*a,height:s.height*a})}else{const l=this.rotationWRTOutputRotation;const c=o.subtract(r);const u=Math.cos(l);const m=Math.sin(l);const p=Math.max(Math.abs(c.x*u*2+c.y*m*2),this.minLength);const h=Math.max(Math.abs(c.x*-m*2+c.y*u*2),this.minLength);this.setStickerSize({width:p,height:h})}}else if(this.isSpriteText){this.setTextSize(s.width*a)}else if(this.isSpriteTextDesign){this.setTextDesignScale(a)}}this.editor.render()}};this.onWidthDrag=({x:t,y:e})=>{const r=new O(this.currentSprite.position);const o=new O(t,e);const n=o.subtract(r).magnitude;const s=this.editor.previewToWorld(2*n);if(s>this.minLength){this.setContainerProperties(this.id,{width:s},true);if(this.isSpriteText){const a=this.getContainerProperties(this.id);this.textToolStore.changeWidth(a.width)}}};this.onPaddingDrag=({x:t,y:e})=>{if(this.isSpriteTextDesign){let r=this.getContainerProperties(this.id);const o=new O(this.currentSprite.position);const n=new O(t,e);const s=n.subtract(o).magnitude;const a=Math.max(this.editor.previewToWorld(s)-r.width/2,0);this.setContainerProperties(this.id,{padding:a},true);if(this.isSpriteTextDesign){r=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(r.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();Object.values(this.container).forEach(r=>{if(r.type==="text"||r.type==="text-design"){r.setFlipHorizontally(t);r.setFlipVertically(e)}})};this.reverseTextHorizontally=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipHorizontally(t)}})};this.reverseTextVertically=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipVertically(t)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=t=>{return this.container[t].getData()};this.getContainerTransform=t=>{return this.container[t].getTransform()};this.getDuplicateContainerTransform=t=>{const e=this.container[t].getTransform();const r=this.editor.shortestOutputSide*.1;const o=new O(e.position).add(new O(r,r));return{...e,position:o}};this.getDuplicateContainerFlip=t=>{const e=this.container[t].getFlipHorizontally();const r=this.container[t].getFlipVertically();return{flipHorizontally:e,flipVertically:r}};this.updatePositionAndSize=(t=this.id,e=false)=>{const{position:r,size:o}=this.getSizePositionFromContainer(t);const n=this.state.get(t);if(n){n.position.x=r.x;n.position.y=r.y;n.size.width=o.width;n.size.height=o.height;if(e){const s=this.container[t].getRotation();this.container[t].setRotation(s);n.rotation=this.container[t].getRotation()}this.state.set(t,n)}};this.getInitialTransform=t=>{const e=this.editor.outputToWorld(nct.position);if(!t){const r=this.editor.outputContainer.getRotation();return{rotation:r,position:e}}return{position:e,...t}};this.setInitialSpriteState=(t,e)=>{const r=this.container[t];const{position:o,size:n}=this.getSizePositionFromContainer(t);const s=r.getRotation();const a=e!=="sticker"?false:r.getFlipHorizontally();const l=e!=="sticker"?false:r.getFlipVertically();this.state.set(t,{tool:e,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l})};this.setStickerSize=t=>{const e=this.container[this.id];e.setSizeInWorldSpace(this.editor.previewSizeToWorld(t));const r=this.currentSprite;if(r){r.size=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());this.state.set(this.id,r)}};this.setTextSize=t=>{let e=this.getContainerProperties(this.id);const r={width:this.editor.previewToWorld(t)};const o=r.width/e.width;const n={fontSize:Math.round(e.fontSize*o)};const s=this.isSpriteText?{...r,...n}:r;if(r.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,s,true);e=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(e.fontSize,true);this.textToolStore.changeWidth(e.width)}};this.setTextDesignScale=t=>{let e=this.getContainerProperties(this.id);const r=e.width*t;if(r>this.minLength){this.setContainerProperties(this.id,{width:r},true);const{width:o}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(o);e=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(e.padding)}};this.getSizePositionFromContainer=(t=this.id)=>{const e=this.container[t];if(e){const r=this.editor.worldToPreview(e.getPosition());const o=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());return{position:r,size:o}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(t=this.id)=>{const e=this.container[t];if(e){return this.editor.worldSizeToPreview(e.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=t;this.container={};this.stickerToolStore=new Pt(t);this.textToolStore=new gt(t);this.textDesignToolStore=new Mt(t);this.rect=new ze(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(t,e){return new O(t,e||t).magnitude}static sizeMagnitude(t){return Math.sqrt(t.width*t.width+t.height*t.height)}async updateStateByHistoryState(t,e,r){await(0,QH.default)(t,async o=>{const n=e.common[o];if(!n)return;if(this.state.get(o)){this.updateExistingItem(o,e)}else{await this.addNewItem(o,e)}});t.forEach(o=>{const n=e.common[o];const s=this.container[o];if(!n||!s)return;s.setIndexInParent(n.order+r)});this.counter+=1}async addNewItem(t,e){const r=e.common[t];const o=r.size?{width:this.editor.worldToPreview(r.size.width),height:this.editor.worldToPreview(r.size.height)}:void 0;const{flipHorizontally:n,flipVertically:s}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=s!==n?r.rotation-a:r.rotation+a;const c=s!==n?-l:l;const u={spriteId:t,transform:{size:o,position:new O(r.position),rotation:c}};if(e.text[t]){const m=e.text[t];const p=this.textToolStore.validFontWithConfig(m.identifier);m.identifier=p==null?void 0:p.identifier;await this.addNewText(u,m);return}if(e.textdesign[t]){await this.addNewTextDesign(u,e.textdesign[t]);return}if(e.sticker[t]){const m=this.stickerToolStore.items.find(p=>p.identifier===e.sticker[t].identifier);await this.addNewSticker(u,{...e.sticker[t],flipHorizontally:r.flipHorizontally,flipVertically:r.flipVertically,resizeMode:e.sticker[t].resizeMode||(m==null?void 0:m.resizeMode)||"keepAspect"})}}updateExistingItem(t,e){const r=e.common[t];const o=this.state.get(t);this.state.set(t,o);const n=this.container[t];n.setPosition(new O(r.position));n.setRotation(r.rotation);o.rotation=n.getRotation();if(r.flipHorizontally!==void 0){n.setFlipHorizontally(r.flipHorizontally)}if(r.flipVertically!==void 0){n.setFlipVertically(r.flipVertically)}if(e.text[t]){const s=e.text[t];this.textToolStore.updateStateFromHistory(t,{...s,fontIdentifier:s.identifier})}if(e.textdesign[t]){const s=e.textdesign[t];this.textDesignToolStore.updateStateFromHistory(t,{...s,inverted:s.isInverted})}if(e.sticker[t]){n.setSizeInWorldSpace(r.size);this.stickerToolStore.updateStateFromHistory(t,e.sticker[t])}this.updatePositionAndSize(t)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==tI}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();const r=this.editor.outputContainer.getRotation();return $h({rotation:this.currentSprite.rotation-r,flipHorizontally:t,flipVertically:e})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const t=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:t,y:e}=this.currentSprite.position;const{height:r,width:o}=this.currentSprite.size;return{x:Math.round(t-o/2),y:Math.round(e-r/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:t}=this.rect;return{x:t.x-this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:t}=this.rect;return{x:t.x+this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(t){this.selectedId.set(t)}};nt=ef;f([Q],nt.prototype,"counter",2);f([C],nt.prototype,"addSticker",2);f([C],nt.prototype,"addStickerAsync",2);f([C],nt.prototype,"addText",2);f([C],nt.prototype,"addTextAsync",2);f([C],nt.prototype,"addTextDesign",2);f([C],nt.prototype,"addTextDesignAsync",2);f([C],nt.prototype,"clickableCanvas",2);f([C],nt.prototype,"setContainerProperties",2);f([C],nt.prototype,"setContainerPosition",2);f([C],nt.prototype,"pureRemoveSprite",2);f([C],nt.prototype,"deleteSprite",2);f([C],nt.prototype,"removeSprite",2);f([C],nt.prototype,"addSnapshot",2);f([C],nt.prototype,"addNewText",2);f([C],nt.prototype,"addNewTextDesign",2);f([C],nt.prototype,"addNewSticker",2);f([C],nt.prototype,"updateStateFromSerialization",2);f([C],nt.prototype,"updateStateFromHistory",2);f([C],nt.prototype,"updateCanvasControls",2);f([C],nt.prototype,"setEditMode",2);f([C],nt.prototype,"setDragMode",2);f([C],nt.prototype,"setPosition",2);f([C],nt.prototype,"setSize",2);f([C],nt.prototype,"setRotation",2);f([C],nt.prototype,"onCanvasClick",2);f([C],nt.prototype,"select",2);f([C],nt.prototype,"selectLast",2);f([C],nt.prototype,"selectNext",2);f([C],nt.prototype,"deselect",2);f([C],nt.prototype,"bringToFront",2);f([C],nt.prototype,"flipHorizontally",2);f([C],nt.prototype,"pureReset",2);f([C],nt.prototype,"onCornerDrag",2);f([C],nt.prototype,"onWidthDrag",2);f([C],nt.prototype,"onPaddingDrag",2);f([C],nt.prototype,"correctTextFlip",2);f([C],nt.prototype,"reverseTextHorizontally",2);f([C],nt.prototype,"reverseTextVertically",2);f([C],nt.prototype,"dispose",2);f([S],nt.prototype,"currentSprite",1);f([S],nt.prototype,"padding",1);f([S],nt.prototype,"isEditMode",1);f([S],nt.prototype,"isDragMode",1);f([S],nt.prototype,"id",1);f([S],nt.prototype,"isSpriteSelected",1);f([S],nt.prototype,"position",1);f([S],nt.prototype,"tool",1);f([S],nt.prototype,"size",1);f([S],nt.prototype,"rotation",1);f([S],nt.prototype,"rotationWRTOutputRotation",1);f([S],nt.prototype,"flipHorizontal",1);f([S],nt.prototype,"isSpriteSticker",1);f([S],nt.prototype,"isSpriteText",1);f([S],nt.prototype,"isSpriteTextDesign",1);f([S],nt.prototype,"isOnTop",1);f([S],nt.prototype,"spritePosition",1);f([S],nt.prototype,"currentRect",1);f([S],nt.prototype,"leftTopPosition",1);f([S],nt.prototype,"leftBottomPosition",1);f([S],nt.prototype,"leftMidPosition",1);f([S],nt.prototype,"leftMidPadPosition",1);f([S],nt.prototype,"rightTopPosition",1);f([S],nt.prototype,"rightBottomPosition",1);f([S],nt.prototype,"rightMidPosition",1);f([S],nt.prototype,"rightMidPadPosition",1);f([S],nt.prototype,"leftBottomHandlePosition",1);f([S],nt.prototype,"rightBottomHandlePosition",1);f([S],nt.prototype,"historyLocale",1);f([S],nt.prototype,"stickerLocale",1);f([S],nt.prototype,"textLocale",1);f([S],nt.prototype,"textDesignLocale",1)});var tW=d(()=>{eI()});var sct,fr;var iI=d(()=>{Tt();R();sct={categories:[],query:""};fr=class{constructor(t){this.initProvider=t=>{if(t){this.libraryProvider=new t}};this.fetchImages=async(t="")=>{if(this.libraryProvider){let e=null;try{const r=await this.libraryProvider.getCategories();const o=await this.libraryProvider.searchImages(t);e=r.map((n,s)=>{const a=o.filter(l=>l.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(l=>({name:l.title||`image${s}`,identifier:`${n.name}-${l.title}-${s}`,thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar}))}}).filter(n=>n.items.length)}catch(r){console.log(r)}Ve(()=>{this.state.query=t;this.state.categories=e})}};this.toggleCategorySelection=t=>{this.selectedCategory=this.selectedCategory!==t?t:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=t=>{const e=this.items.findIndex(r=>r.identifier===t);if(e!==-1){return this.items[e].rawUrl}return t};this.configStore=t.configStore;this.state=Q(sct);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(t=>t.items).reduce((t,e)=>[...t,...e],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};f([Q],fr.prototype,"selectedCategory",2);f([C],fr.prototype,"initProvider",2);f([C],fr.prototype,"fetchImages",2);f([C],fr.prototype,"toggleCategorySelection",2);f([C],fr.prototype,"dispose",2);f([S],fr.prototype,"selectedCategoryIdentifier",1);f([S],fr.prototype,"categories",1);f([S],fr.prototype,"items",1);f([S],fr.prototype,"query",1);f([S],fr.prototype,"config",1);f([S],fr.prototype,"locale",1)});var eW=d(()=>{iI()});var iW,Ri;var rW=d(()=>{R();zn();U();iW=(i="image/png")=>`data:${i};base64,`;Ri=class{constructor(t){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=t=>{const e=at.relativeToAbsolutePoint(t,this.cropSpace,false);return at.pointFromSpaceToSpace(e,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=t=>{return t*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=t=>{return t*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=t}static deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier}}static deserializeAdjustments(t){return{...t}}static deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,e=>e.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(t){if(t){if(t.rgba){return t.rgba}}return[0,0,0,0]}validateVersion(t){return this.version===t}static checkIfPlatformHTML(t){return t==="html5"}static deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:Ri.deserialzeColor(t.tintColor)}}checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(t){const e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(iW(),""):""};e.image.data=e.image.data?iW()+e.image.data:""}return e}deserializeTransformation(t){const e={};const r=t.operations.find(s=>s.type==="orientation");const o=t.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=Ri.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:""}return e}deserialize(t){var n,s;const e={};if(t.meta?!Ri.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform")}const r=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(a=>{switch(a.type){case"filter":e.filter=Ri.deserializeFilter(a.options);break;case"adjustments":e.adjustment=Ri.deserializeAdjustments(a.options);break;case"focus":e.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(c=>{switch(c.type){case"frame":e.frame=this.deserializeFrame(c.options);break;case"overlay":e.overlay=Ri.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=this.deserializeBrush(c.options)}else{e.brush.strokes.push(...this.deserializeBrush(c.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const u=At();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};this.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=Ri.deserializeStickers(c.options)}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=this.deserializeTexts(c.options)}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=this.deserializeTextDesign(c.options)}break;default:break}});break;default:break}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return e}deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:Ri.deserialzeColor(t.tintColor)}}deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:break}return void 0}deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeMirroredFocus(t){const e=new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new O(this.mapRelativeCropPointToImageSpace(t.start)).add(new O(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeTexts(t){return{identifier:hn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:Ri.deserialzeColor(t.color),backgroundColor:Ri.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text}}deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:Ri.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted}}deserializeBrush(t){return{strokes:t.paths.map(e=>{return{path:{controlPoints:e.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:Ri.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}}})}}}});var oW,Ai;var nW=d(()=>{R();zn();U();oW=(i="image/png")=>`data:${i};base64,`;Ai=class{constructor(t){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=t=>{const e=at.relativeToAbsolutePoint(t,this.cropSpace,false);return at.pointFromSpaceToSpace(e,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=t=>{return t*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=t=>{return t*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=t}static deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier}}static deserializeAdjustments(t){return{...t}}static deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,e=>e.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(t){if(t){if(t.rgba){return t.rgba}}return[0,0,0,0]}validateVersion(t){return this.version===t}static checkIfPlatformHTML(t){return t==="html5"}static deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:Ai.deserialzeColor(t.tintColor)}}checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(t){const e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(oW(),""):""};e.image.data=e.image.data?oW()+e.image.data:""}return e}deserializeTransformation(t){const e={};const r=t.operations.find(s=>s.type==="orientation");const o=t.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=Ai.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:""}return e}deserialize(t){var n,s;const e={};if(t.meta?!Ai.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform")}const r=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(a=>{switch(a.type){case"filter":e.filter=Ai.deserializeFilter(a.options);break;case"adjustments":e.adjustment=Ai.deserializeAdjustments(a.options);break;case"focus":e.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(c=>{switch(c.type){case"frame":e.frame=this.deserializeFrame(c.options);break;case"overlay":e.overlay=Ai.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=this.deserializeBrush(c.options)}else{e.brush.strokes.push(...this.deserializeBrush(c.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const u=At();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};this.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=Ai.deserializeStickers(c.options)}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=this.deserializeTexts(c.options)}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=this.deserializeTextDesign(c.options)}break;default:break}});break;default:break}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return e}deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:Ai.deserialzeColor(t.tintColor)}}deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:return void 0}}deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeMirroredFocus(t){const e=new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new O(this.mapRelativeCropPointToImageSpace(t.start)).add(new O(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeTexts(t){return{identifier:hn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:Ai.deserialzeColor(t.color),backgroundColor:Ai.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text}}deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:Ai.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted}}deserializeBrush(t){return{strokes:t.paths.map(e=>{return{path:{controlPoints:e.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:Ai.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}}})}}}});var act,lct,cct,uct,dct,mct,pct,hct,fct,gct,bct,yct,_ct,xct,vct,aW;var sW=d(()=>{act="@photoeditorsdk/root";lct="5.19.2";cct="The most comprehensive photo editor SDK for HTML5";uct="http://github.com/imgly/pesdk-html5";dct="PhotoEditorSDK (img.ly GmbH) ";mct="SEE LICENSE IN LICENSE.md";pct=true;hct={};fct={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};gct={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};bct={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};yct={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};_ct={eslint:"7.10.0"};xct=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];vct={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};aW={name:act,version:lct,description:cct,repository:uct,author:dct,license:mct,private:pct,bin:hct,scripts:fct,devDependencies:gct,dependencies:bct,devEngines:yct,resolutions:_ct,workspaces:xct,husky:vct}});var pu;var lW=d(()=>{R();zn();sW();pu=class{constructor(t,e,r,o,n,s){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=t=>{const e=at.pointFromSpaceToSpace(t,this.imageSpace,this.cropSpace,false);return at.absoluteToRelativePoint(e,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=t=>{return t/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=t=>{return t/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(t,e=0,r=3)=>{const o=Math.tan(e);const n=Math.sqrt(o**2+1);return{x:t.x+r/n,y:t.y+r*o/n}};this.previewPosition=t;this.previewSize=e;this.outputSize=r;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale()}static serializeFilters(t){return{type:"filter",options:{intensity:t.intensity,identifier:t.identifier}}}static serializeAdjustments(t){return{type:"adjustments",options:t}}static serializeOverlay(t){return{type:"overlay",options:{identifier:t.identifier,intensity:t.opacity,blendMode:t.blendMode.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:aW.version,createdAt:new Date().toISOString()}}serialise(t,e,r){const o=pu.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(e){n.type=r;n.data=e}const s=[];const a=[];const{adjustment:l}=t;if(Object.keys(l).map(x=>l[x]).filter(Boolean).length){s.push(pu.serializeAdjustments(l))}const{filter:c}=t;if(c.identifier!=="identity"){s.push(pu.serializeFilters(c))}const{overlay:u}=t;if(u.identifier!=="identity"){a.push(pu.serializeOverlay(u))}if(t.transform){const{transform:x,orientation:v}=this.serializeTransform(t.transform);const b=[x.options.start.x!==0,x.options.start.y!==0,x.options.end.x!==1,x.options.end.y!==1,x.options.rotation!==0];const T=[v.options.rotation!==0,v.options.flipVertically!==false,v.options.flipHorizontally!==false];if(b.some(k=>k)){s.push(x)}if(T.some(k=>k)){s.push(v)}}const{frame:m}=t;if(m.identifier!=="identity"){a.push(this.serialzeFrame(m))}const{focus:p}=t;if(p.identifier!=="identity"){s.push(this.serializeFocus(p))}if(t.sprite){t.sprite.spriteIdList.forEach(x=>{const v=t.sprite.common[x];switch(v.tool){case"sticker":const b=t.sprite.sticker[x];a.push(this.serializeSticker(b,v,t.transform));break;case"text":const T=t.sprite.text[x];a.push(this.serializeText(T,v));break;case"textdesign":const k=t.sprite.textdesign[x];a.push(this.serializeTextDesign(k,v));break;default:break}})}if(t.brush.strokes.length){a.push({type:"brush",options:{paths:t.brush.strokes.map(x=>{return{points:x.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:x.brush.color},size:x.brush.size,hardness:x.brush.hardness}}})}})}if(a.length){const x={type:"sprite",options:{sprites:a}};s.push(x)}const h=t.customStickers;const g={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:g}}serialzeFrame(t){return{type:"frame",options:{identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.color},size:this.mapSizeToRelativeUnscaledCropSize(t.width)}}}serializeFocus(t){const e=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(t.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(t.linear.start),end:this.mapImagePointToRelativeCropPoint(t.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(t.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(t.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(t.radial.center,0,t.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(t.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:r}=t;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,e/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,-e/2)),size:this.mapSizeToRelativeScaledCropSize(t.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(t.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(t.gaussian.blurRadius)}}}}}serializeSticker(t,e,r){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(e.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(e.size.width),y:this.mapSizeToRelativeScaledCropSize(e.size.height)},rotation:e.rotation,flipVertically:(e.flipVertically||false)!==(r.flipVertically||false),flipHorizontally:(e.flipHorizontally||false)!==(r.flipHorizontally||false),identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.tintColor},tintMode:t.tintMode}}}serializeText(t,e){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:t.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(t.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(t.width),text:t.text,lineHeight:t.lineHeight,color:{rgba:t.textColor},backgroundColor:{rgba:t.backgroundColor},alignment:t.alignment}}}serializeTextDesign(t,e){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,identifier:t.identifier,inverted:t.isInverted,text:t.text,seed:t.seed,width:this.mapSizeToRelativeScaledCropSize(t.width),padding:this.mapSizeToRelativeScaledCropSize(t.padding),color:{rgba:t.color}}}}serializeTransform(t){const{start:e,end:r}=t;const o={type:"transform",options:{start:e,end:r,rotation:t.rotation,meta:{identifier:t.identifier}}};const n={type:"orientation",options:{rotation:t.outputRotation,flipHorizontally:t.flipHorizontally,flipVertically:t.flipVertically}};return{transform:o,orientation:n}}}});var rI={};de(rI,{Deserializers:()=>Cct,Serializer:()=>pu});var Cct;var oI=d(()=>{rW();nW();lW();Cct={"3.9.0":Ai,"3.12.0":Ri}});var cW,Sct,wct,Tct,rf;var uW=d(()=>{Tt();R();U();cW=/^data:image\/(.+?);base64,/;Sct=i=>cW.test(i);wct=i=>i.match(/^data:([^;]+)/)[1];Tct=i=>i.replace(cW,"");rf=class{constructor(t){this.applySerialization=async(t,e,r,o)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const s="Unexpected error occured";const a=e.deserializeImage(t);if(a.image&&a.image.data){const u=a.image.data;await this.editor.setImage(u);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(u);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const l=e.deserializeTransformation(t);if(!l){o(s);return}await this.applyStateOnUI(l);const c=e.deserialize(t);if(!c){o(s);return}await this.applyStateOnUI(c);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}r()};this.editor=t}serialize({image:t}={image:false}){const e=this.editor.activeStore.tool==="transform";const{displaySerializationModal:r}=this.editor.configStore.config;if(r){this.editor.modalStore.showInfoModal("saving")}return new Promise((o,n)=>{Promise.resolve().then(()=>(oI(),rI)).then(async({Serializer:s})=>{try{if(e){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:a}=this.editor.imageContainer.getData();const l=this.editor.engineMediator.output.container.getResolution();const c={width:a.width,height:a.height};const u=new s(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,l,c,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const m={["adjustment"]:ct(this.editor.adjustmentsToolStore.state),["filter"]:ct(this.editor.filterToolStore.state),["focus"]:ct(this.editor.focusToolStore.serializableState),["overlay"]:ct(this.editor.overlayToolStore.state),["frame"]:ct(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:p,customStickers:h}=await this.editor.spriteStore.serializableState();p.spriteIdList=p.spriteIdList.sort((v,b)=>{const T=p.common[v].order;const k=p.common[b].order;return T-k});m.sprite=p;m.customStickers=h;m.transform=this.editor.transformToolStore.serializableState;let g;let x;if(t){const v=rf.getDataURL(a);x=wct(v);g=Tct(v)}if(r){this.editor.modalStore.hideModal()}o(u.serialise(m,g,x));if(e){this.editor.transformToolStore.onEnter()}}catch(a){if(r){this.editor.modalStore.hideModal()}n(a)}})})}deserialize(t){this.editor.modalStore.showInfoModal("loading");return new Promise((e,r)=>{try{Promise.resolve().then(()=>(oI(),rI)).then(({Deserializers:o})=>{const n=t.version.match(/[0-3].[0-8].[0-9]/i);let s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](this.editor)}else if(o[t.version]){s=new o[t.version](this.editor)}else{s=new o["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(t,s,e,r)})}else{this.applySerialization(t,s,e,r)}})}catch(o){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}r(o)}})}static getDataURL(t){if(t instanceof HTMLImageElement){const{src:n}=t;if(Sct(n)){return n}}if(t instanceof HTMLCanvasElement){return t.toDataURL("image/png")}const e=document.createElement("canvas");e.width=t.width;e.height=t.height;const r=e.getContext("2d");r.drawImage(t,0,0);const o=e.toDataURL("image/png");$t(e);return o}async applyStateOnUI(t){const e=this.editor.activeStore.tool==="transform";try{if(t.transform){if(!e){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(t.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!e){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(t.filter){await this.editor.filterToolStore.updateStateFromSerialization(t.filter)}if(t.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(t.adjustment)}if(t.focus){await this.editor.focusToolStore.updateStateFromSerialization(t.focus)}if(t.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(t.overlay)}if(t.sprite){let r=Object.keys(t).length-1;if(t.customStickers){r-=1}t.sprite.spriteIdList=t.sprite.spriteIdList.sort((o,n)=>{const s=t.sprite.common[o].order;const a=t.sprite.common[n].order;return s-a});await this.editor.spriteStore.updateStateFromSerialization(t.sprite,t.customStickers,Math.max(0,r))}if(t.brush){this.editor.brushToolStore.updateStateFromHistory(t.brush)}if(t.frame){await this.editor.frameToolStore.updateStateFromSerialization(t.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(r){if(r.name==="AssetNotFoundError"){console.error(r)}else{console.error(r);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:r.message,handleConfirm:()=>{this.applyStateOnUI(t)}})}}}}});var kct,nI;var dW=d(()=>{kct=i=>{const t=atob(i.split(",")[1]);const e=i.split(",")[0].split(":")[1].split(";")[0];const r=new ArrayBuffer(t.length);const o=new Uint8Array(r);for(let n=0;n{R();mW=i=>i.split(",")[0].split(":")[1].split(";")[0];pW=i=>{if(typeof i==="string"){return mW(i)}if(i.src.includes(".svg")){return"image/svg+xml"}if(i.src){return mW(i.src)}return"image/jpeg"}});var yv,of;var fW=d(()=>{Vh();yv=y(Ju());R();zn();of=class{static isImageElement(t){return t instanceof HTMLImageElement}constructor({license:t,assetProvider:e,crossOrigin:r,backgroundColor:o}){this.crossOrigin=r;this.engine=new fm({license:t,crossOrigin:r,assetProvider:e,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:o})}getAllFilterPreviewThumbnails(t){return new Promise((e,r)=>{const o=[];const n=[];t.forEach(s=>{if(s.isDuotone)o.push(s.identifier);else n.push(s.identifier)});this.getAllDuotonePreview(o).then(s=>{this.getAllLutPreview(n).then(a=>{e(Object.assign(s,a))}).catch(a=>{r(a)})}).catch(s=>{r(s)})})}async getAllDuotonePreview(t){const e={};if(!t.length)return e;const r=await this.engine.addDuoToneFilterFromAssets(t[0],this.container);await(0,yv.default)(t,async o=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(o);const s=r.filterOperation.getFilter();s.set({intensity:.5,lightColor:st.Color.fromHex(n.lightColor),darkColor:st.Color.fromHex(n.darkColor)});const a=await this.engine.export("data-url","image/jpeg",.8,false,true);e[o]=a},{concurrency:1});this.engine.removeEffect(r);return e}async loadLutAssets(t){const e={};await(0,yv.default)(t,async r=>{e[r]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",r))});return e}async getAllLutPreview(t){const e={};if(!t.length)return e;const r=await this.loadLutAssets(t);const o=await this.engine.addLUTFilterFromAssets(t[0],this.container);await(0,yv.default)(t,async n=>{const s=this.engine.assetProvider.getLUTFilterAsset(n);const a=o.filterOperation.getFilter();const l={horizontalTileCount:s.horizontalTileCount||5,verticalTileCount:s.verticalTileCount||5,image:r[n]};a.set({...l,intensity:s.defaultIntensity||1});o.setProperties({intensity:1});a._lutPrimitive.set(l);const c=await this.engine.export("data-url","image/jpeg",.8,false,true);e[n]=c},{concurrency:1});this.engine.removeEffect(o);return e}addImageToContainer(t){return new Promise((e,r)=>{let o;if(of.isImageElement(t)){o=t;this.setBackgroundImage(o);e()}else{this.getImageElement(t).then(n=>{o=n;this.setBackgroundImage(o);e()}).catch(n=>{r({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,r)=>{const o=new Image;o.addEventListener("load",()=>{e(o)});o.addEventListener("error",n=>{r(n)});o.crossOrigin=this.crossOrigin;o.src=t})}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t})}const{size:e}=this.container.getBounds();const r=this.engine.getOutputContainer();r.setResolution(e)}}});var Ict,$o;var sI=d(()=>{Tt();U();Ict={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};$o=class{constructor(t){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(t,e)=>{const{height:r,width:o}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:s,snapToTop:a,snapToBottom:l}=this.configStore.config.snapping.position;const c=Math.min(r,o);let u=0;if(e==="bottom"){u=Math.round(r-c*l)}else if(e==="top"){u=Math.round(c*a)}else if(e==="right"){u=Math.round(o-c*s)}else if(e==="left"){u=Math.round(c*n)}else if(t==="vertical"&&e==="center"){u=Math.round(o/2)}else if(t==="horizontal"&&e==="center"){u=Math.round(r/2)}return u};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:t,snapToLeft:e,snapToRight:r}=this.configStore.config.snapping.position;const o=[];if(t){o.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(e){o.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(r){o.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return o};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:t,snapToTop:e,snapToBottom:r}=this.configStore.config.snapping.position;const o=[];if(t){o.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(e){o.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(r){o.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return o};this.getRotationGuidesFromConfig=()=>{const{angles:t}=this.configStore.config.snapping.rotation;const e=[];t.forEach(o=>{e.push(o);e.push(o+360);e.push(o-360)});const r=e.filter((o,n)=>e.indexOf(o)===n);return r.map(o=>({value:o*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:t,leftBottom:e,rightTop:r,rightBottom:o})=>{const n=Math.min(t.y,r.y,e.y,o.y);const s=Math.max(t.y,r.y,e.y,o.y);const a=Math.min(t.x,r.x,e.x,o.x);const l=Math.max(t.x,r.x,e.x,o.x);return{height:Math.round(s-n),width:Math.round(l-a)}};this.mapRange=({value:t,fromMin:e,fromLength:r,toMin:o,toLength:n})=>{return(t-e)*n/r+o};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(t,e,r,o)=>{if(e.length===0){return t}if(e[0]>t){return t-r}for(let n=0;n=a-m){return a+u+(o?r*2:0)}return this.mapRange({value:t,fromMin:s,fromLength:a-s,toMin:l,toLength:c-l})}}if(o){return t+(e.length-1)*r*2+r}return t};this.mapFromSnapSystem=(t,e,r,o)=>{if(e.length===0){return t}if(e[0]>t){if(t>=e[0]-r){return e[0]}return t+r}let n=t;for(let a=0;a{const r=e*.5;const{value:o,edge:n}=t;let s=o;if(n==="leading"){s+=r}else if(n==="trailing"){s-=r}return s};this.mapSnappingGuidesToCenter=(t,e)=>{const r=[];t.forEach(o=>{r.push(this.centerSnapValue(o,e))});return r};this.calcSnapThresholdInRadians=(t,e)=>{if(t===0){return 0}return e/t};this.calculatePreviewTopLeftPosition=()=>{const t=this.editor.engineMediator.preview.container.getPosition();const e=this.editor.getPreviewSize();const r=Eo();this.previewTopLeftPosition={x:t.x/r-e.width/2,y:t.y/r-e.height/2}};this.snapToRotation=(t,e,r)=>{const{rotationGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.rotation;const{x:a,y:l}=this.previewTopLeftPosition;const{width:c}=this.editor.getPreviewSize();let u=(t+Math.PI*2)%(Math.PI*2);if(n){const m=new O(e).magnitude;const p=o.map(x=>x.value).sort((x,v)=>x-v);const h=this.calcSnapThresholdInRadians(m,s);if(!this.rotationOffset){const x=this.mapToSnapSystem(t,p,h,false);this.rotationOffset=x-u}u=this.mapFromSnapSystem(u+this.rotationOffset,p,h,false);const g={x:r.position.x-a-c,y:r.position.y-l};o.forEach(x=>{x.isVisible=x.value===u;x.position=g});return u}return t};this.snapToPosition=(t,e)=>{const{horizontalGuides:r,verticalGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.position;const a=new O(this.previewTopLeftPosition);const{height:l,width:c}=this.getSpriteDimensions(e);const{x:u,y:m}=new O(t).subtract(a);if(n){const p=this.mapSnappingGuidesToCenter(r,l).sort((v,b)=>v-b);const h=this.mapSnappingGuidesToCenter(o,c).sort((v,b)=>v-b);if(!this.positionOffset){const v=this.mapToSnapSystem(u,h,s,true);const b=this.mapToSnapSystem(m,p,s,true);this.positionOffset=new O(v,b).subtract(new O(u,m))}let g=this.mapFromSnapSystem(u+this.positionOffset.x,h,s,true);let x=this.mapFromSnapSystem(m+this.positionOffset.y,p,s,true);g=Math.round(g);x=Math.round(x);r.forEach(v=>{const b=Math.round(this.centerSnapValue(v,l));v.isVisible=b===x});o.forEach(v=>{const b=Math.round(this.centerSnapValue(v,c));v.isVisible=b===g});return new O(g,x).add(a)}return{x:u,y:m}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=t;this.configStore=t.configStore;this.state=Q(Ict);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(t=>({...t,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(t=>({...t,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(t=>({...t,isVisible:false}))}get positionGuides(){const{verticalGuides:t,horizontalGuides:e}=this.state;return[...t,...e]}get rotationGuides(){return this.state.rotationGuides}};f([Q],$o.prototype,"state",2);f([C],$o.prototype,"snapToRotation",2);f([C],$o.prototype,"snapToPosition",2);f([C],$o.prototype,"hidePositionGuides",1);f([C],$o.prototype,"hideRotationGuides",1);f([C],$o.prototype,"dispose",2);f([S],$o.prototype,"positionGuides",1);f([S],$o.prototype,"rotationGuides",1)});var Sl;var gW=d(()=>{Tt();R();zn();U();hv();fv();dv();jk();pv();gv();bv();uW();ak();ck();uk();Tk();iI();mk();dW();hW();fW();Ik();sI();eI();Qk();Sl=class{constructor(t,e){this.initWithImage=async t=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(t);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const e=this.configStore.config.engine;this.previewThumbnails=new of({...e,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:e.identifier?e.identifier:"rendering",error:e,handleConfirm:()=>{this.initWithImage(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:t,height:e})=>{const{maxMegaPixels:r}=this.configStore.config.engine.downscaleOptions;const o=mp.isMobile()?r.mobile:r.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${o}`,width:`${t}`,height:`${e}`}})})};this.init=t=>{var o,n;if(!((o=this.activeStore)==null?void 0:o.image)){this.initWithImage(t);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const e=this.historyStore.isDirty();const{displayDiscardChangesWarning:r}=this.configStore.config;if(e&&r){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(t);this.resetToolStates()},handleDismiss:()=>{this.setImage(t,true)}});return}if(e&&!r){this.setImage(t,true);return}this.historyStore.reset();this.setImage(t,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:s,displayCanvasRendererWarning:a}=this.configStore.config;if(s.preferredRenderer==="canvas"&&a){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(t,e=false)=>{try{if(!this.activeStore.image){this.initWithImage(t)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(t);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:r,flipVertically:o,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:o,flipHorizontally:r});await this.transformToolStore.rotateOutputContainer(xp(n),false);if(e){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const s=this.activeStore.tool;if(!s){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(r){this.configStore.events.onErrorImageLoading(r);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:r.identifier?r.identifier:"rendering",error:r,handleConfirm:()=>{this.setImage(t,e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(r)}};this.onToolChange=(t,e=null,r=true)=>{var o,n;if(t===e){return}if((n=(o=this.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([t,e].indexOf("transform")!==-1){if(t==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(e==="transform"){this.transformToolStore.onEnter()}this.resize(e)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(r){this.render()}}};this.resize=(t=null)=>{if(!this.engineMediator)return;try{const e=this.activeStore.tool;const r=t==="transform"||!t&&e==="transform";this.canvasStore.resizeCanvas(t);this.transformToolStore.applyDefaultCrop();const o=ct(this.transformToolStore.maxCropMaskSize);if(!r){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const s=this.engineMediator.preview.updateTransform(n);if(s){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(o);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const a=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(a);if(!r){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:t,...e}={})=>{const r=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(r){this.transformToolStore.onLeave()}const{config:o}=this.configStore;const n={...o.export.image,...e};const{exportType:s,format:a,quality:l,enableDownload:c,transparent:u}=n;const m=await this.engineMediator.engine.export(s,a,l,u);if(r&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(c){this.triggerFileDownload(o.export.filename,a,s,m)}if(!t){this.configStore.events.onExport(m)}return m}catch(o){if(this.modalStore){this.modalStore.hideModal()}if(r&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(o)}};this.serialize=({image:t}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:t})}return Promise.resolve({})};this.deserialize=t=>{if(this.serializationMediator){return this.serializationMediator.deserialize(t)}return Promise.resolve()};this.close=()=>{var t,e,r,o,n,s;if((((t=this.historyStore)==null?void 0:t.isDirtySinceSave)||((r=(e=this.transformToolStore)==null?void 0:e.transformHistory)==null?void 0:r.hasChanges()))&&((n=(o=this.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var a;if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}}})}else if((s=this.configStore)==null?void 0:s.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:t,height:e}=this.engine.getOutputDimensions();return{width:t,height:e}}return{width:0,height:0}};this.wait=(t=0)=>new Promise(e=>setTimeout(e,t));this.clickableCanvas=async t=>{if(t){await new Promise(e=>setTimeout(e,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:t}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(t){const e=this.transformToolStore.localOutputImageSize;const r=e.width/e.height;const o=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(o.indexOf(parseFloat(r.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(t,e,r)=>{this.historyStore.addSnapshot(t,e,r)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=t=>this.assetProvider.getPathForCategory(t);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=t=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(t)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:t,height:e}=this.engine.getOutputDimensions();if(t&&e){return{width:Math.round(this.worldToPreview(this.outputToWorld(t))),height:Math.round(this.worldToPreview(this.outputToWorld(e)))}}return{height:e,width:t}};this.getImageMimeType=()=>{return pW(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var t,e,r;(r=(e=(t=this.engineMediator)==null?void 0:t.image)==null?void 0:e.container)==null?void 0:r.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(t,e,r,o)=>{const n=e==="image/jpeg"&&r!=="ms-blob"?".jpeg":".png";const s=t+n;const a=this.blobFromExportData(o);this.triggerBlobDownload(s,a)};this.triggerBlobDownload=(t,e)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(e,t)}else{const r=document.createElement("a");const o=URL.createObjectURL(e);r.href=o;r.download=t;document.body.appendChild(r);r.click();document.body.removeChild(r);if(!HF()){URL.revokeObjectURL(o)}}};this.blobFromExportData=t=>{if(typeof t==="string"){return nI(t)}if(t instanceof HTMLImageElement){return nI(t.src)}return t};this.configStore=new Qi;if(e){Object.entries(e).forEach(([o,n])=>{this.configStore.events.on(o,n)})}const r=this.configStore.saveConfig(t);this.engineMediator=new Vk(this);this.serializationMediator=new rf(this);this.spriteStore=new nt(this);this.scale=new ti(this);this.filterToolStore=new He(this);this.adjustmentsToolStore=new Zt(this);this.focusToolStore=new Bt(this);this.overlayToolStore=new Ze(this);this.frameToolStore=new Be(this);this.brushToolStore=new Ie(this);this.transformToolStore=new tt(this);this.libraryStore=new fr(this);this.modalStore=new Wr(this);this.snappingStore=new $o(this);this.activeStore=new hr(this);this.canvasStore=new Oi(this);this.historyStore=new du(this);this.libraryStore.initProvider(r);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const t=this.outputContainer.getBounds();return Math.min(t.width,t.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(t,e){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.previewSpaceToWorldSpace(t,e)}return this.engineMediator.previewSpaceToWorldSpace(t,e)}worldToPreview(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.worldSpaceToPreviewSpace(t)}return this.engineMediator.worldSpaceToPreviewSpace(t)}worldSizeToPreview(t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(t.width),height:this.engineMediator.worldSpaceToPreviewSpace(t.height)}}previewSizeToWorld(t,e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(t.width,e),height:this.engineMediator.previewSpaceToWorldSpace(t.height,e)}}outputToWorld(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.outputSpaceToWorldSpace(t)}return this.engineMediator.outputSpaceToWorldSpace(t)}previewToOutput(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.previewSpaceToOutputSpace(t)}return this.engineMediator.previewSpaceToOutputSpace(t)}get outputContainer(){return this.engineMediator.output.container}};f([C],Sl.prototype,"resize",2);f([C],Sl.prototype,"export",2);f([C],Sl.prototype,"clickableCanvas",2)});var Xt=d(()=>{U();pr();tv();oH();ak();ck();uk();mk();_H();SH();wH();Tk();DH();ZH();tW();eW();bv();pv();gW();Ak();dv();hv();fv();gv();sI();Yh();Qh();Jh();vl();Nn();hm()});var nf,sf,bW,yW,Dct,Ect,_W;var xW=d(()=>{nf=y(_("react"));B();sf=y(_("styled-components"));R();Xt();U();$e();bW=mt.Button.TextSecondary;yW=sf.default.span` + 0 5px 5px -3px rgba(0,0,0,0.20)`,controlsColor:"#ffffff",inputBorderColor:s},colorItem:{borderRadius:"2px",margin:"1px"},webcam:{backdrop:"rgba(0, 0, 0, 0.3)",floatButton:e,background:u},snapping:{positionGuideColor:"#f0f",rotationGuideColor:"#0ff"},transform:{crops:{main:"#B8B8B8",highlight:"#E6E6E6",shadow:"#D4D4D4"}}}};Lk=$lt});var Zh,uv,Hr;var Qh=d(()=>{Jh();MH();LH();Zh=cv();uv=lv();Hr={...Zh,measurements:uv}});var Xlt,zH;var UH=d(()=>{vl();Qh();Xlt=i=>{if(i==="light"){return Lk}return cv};zH=(i,t)=>{const e=Xlt(i);if(t&&t[i]){const{primary:r,background:o,foreground:n}=t[i];const s={primary:r,background:o,foreground:n};const a=Object.keys(s).reduce((l,c)=>{if(s[c]){return{...l,[c]:s[c]}}return l},{});return Fi([e(a),t[i]])}return e()||Zh}});var qlt,NH;var HH=d(()=>{vl();Jh();qlt=["canvas","advancedUIToolbar","advancedUIToolControlBar","advancedUICard","advancedUISpacer","basicUIToolbar","basicUIToolControlBar","mainCanvasActionBar","inputs","colorItem","fontSystem"];NH=i=>{const t=lv();if(i){const e={};Object.keys(i).forEach(r=>{if(qlt.indexOf(r)!==-1){e[r]=i[r]}});return Fi([t,e])}return t}});var WH=d(()=>{PH();UH();HH()});var Ylt,Qi;var dv=d(()=>{Tt();R();zn();U();vl();Ak();FH();sk();Yh();WH();Qh();Ylt={config:_l,locale:uu,theme:Zh,measurements:uv,initialMeasurements:uv};Qi=class{constructor(){this.dispose=()=>{this.state=null;this.events=null;this.assetProvider=null};this.checkDefaultToolAvailability=(t,e)=>{return e.indexOf(t)!==-1};this.state=Q(Ylt);this.events=new Rk;this.licenseChecker=null}saveConfig(t){if(t.mainCanvasActions&&t.mainCanvasActions.length!==4){t.mainCanvasActions.length=4}const e=t.layout&&t.layout==="basic"?Bk:_l;const r=Fi([e,t],{clone:true});this.licenseChecker=new Zx(r.license);if(!this.licenseChecker.areCustomAssetsAllowed()){r.sticker.enableCustomUpload=false}const o=BH(r.language,r.custom.languages);const n=zH(r.theme,r.custom.themes);const s=NH(r.custom.measurements);const{provider:a}=r.library;const l=[];r.adjustment.categories=r.adjustment.categories.reduce((m,p)=>{m.push({...p,items:p.items.filter(h=>{if(!xC[h.identifier]){l.push(h.identifier);return false}return true})});return m},[]);if(l.length!==0){console.error(`The following identifier are incorrect for the adjustment tool: ${l.join(", ")}`)}delete r.language;delete r.custom.languages;delete r.custom.themes;delete r.library.provider;let c=r.tools.reduce((m,p)=>{if(typeof p==="object"){return[...m,...p]}return[...m,p]},[]);if(!c.length){console.error(`Empty list input for tools`);c=Qx.reduce((m,p)=>{if(typeof p==="object"){return[...m,...p]}return[...m,p]},[])}c=c.filter(m=>this.licenseChecker.isToolAllowed(m));if(r.defaultTool){const m=this.checkDefaultToolAvailability(r.defaultTool,c);if(!m){[r.defaultTool]=c}}r.tools=c;this.state.config=r;this.state.locale=o;this.state.theme=n;this.state.measurements=s;this.state.initialMeasurements=s;const u=this.buildCustomAssetsConfig();this.assetProvider=new _p(u,this.licenseChecker.areCustomAssetsAllowed(),r.assetResolver);this.loadThemeFont();return a}get config(){return this.state.config}get locale(){return this.state.locale}get theme(){return this.state.theme}get measurements(){return this.state.measurements}get initialMeasurements(){return this.state.initialMeasurements}get tools(){return this.config.tools.reduce((t,e)=>{if(typeof e==="string"){return[...t,e]}return[...t,"",...e]},[])}get defaultTool(){return this.config.defaultTool}get isOrderDefault(){return this.config.order==="default"}get isLayoutAdvanced(){return this.config.layout==="advanced"}get displayCloseButton(){return this.config.mainCanvasActions.indexOf("close")!==-1}loadThemeFont(){const{typography:t}=this.theme;if(!t.skipLoading){this.assetProvider.getFontManager().injectFonts([t])}}buildCustomAssetsConfig(){const t=this.tools;const e=ct(this.state.config);const r=this.state.config.assetBaseUrl;const{theme:o}=this.state;const n=t.indexOf("filter")!==-1?e["filter"]:void 0;const s=t.indexOf("focus")!==-1?e["focus"]:void 0;const a=t.indexOf("adjustment")!==-1?e["adjustment"]:void 0;const l=t.indexOf("sticker")!==-1?e["sticker"]:void 0;const c=t.indexOf("frame")!==-1?e["frame"]:void 0;const u=t.indexOf("overlay")!==-1?e["overlay"]:void 0;const m=t.indexOf("transform")!==-1?e["transform"]:void 0;const p=t.indexOf("text")!==-1?e["text"]:void 0;const h=t.indexOf("textdesign")!==-1?e["textdesign"]:void 0;return{basePath:r,theme:o,filter:n,focus:s,sticker:l,frame:c,overlay:u,transform:m,text:p,adjustment:a,textdesign:h}}};f([C],Qi.prototype,"saveConfig",1);f([C],Qi.prototype,"dispose",2);f([S],Qi.prototype,"config",1);f([S],Qi.prototype,"locale",1);f([S],Qi.prototype,"theme",1);f([S],Qi.prototype,"measurements",1);f([S],Qi.prototype,"initialMeasurements",1);f([S],Qi.prototype,"tools",1);f([S],Qi.prototype,"defaultTool",1);f([S],Qi.prototype,"isOrderDefault",1);f([S],Qi.prototype,"isLayoutAdvanced",1);f([S],Qi.prototype,"displayCloseButton",1)});var zk;var Uk=d(()=>{R();yC();zk=class{constructor(t){this.editor=t}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,originalImage:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t,originalImage:t})}}getchildren(){return this.container.getChildren()}addImageToContainer(){return new Promise((t,e)=>{const{image:r}=this.editor.activeStore;if(jF(r)){this.setBackgroundImage(r);t()}else{const o=this.editor.libraryStore.getRawUrl(r);this.getImageElement(o).then(n=>{this.setBackgroundImage(n);t()}).catch(n=>{e({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,r)=>{const o=new Image;o.addEventListener("load",()=>{e(o)});o.addEventListener("error",n=>{r(n)});o.crossOrigin=this.editor.configStore.config.engine.crossOrigin;o.src=t})}getImgageContainerId(){return this.container?this.container.getID():""}get engine(){return this.editor.engine}}});var Nk;var Hk=d(()=>{U();Nk=class{constructor(t){this.applyNewImageTransform=()=>{const{size:t,width:e,height:r}=this.editor.engineMediator.image.container.getBounds();const o=this.container;o.setTransform(re.IDENTITY);o.setResolution(t);o.setPivot(.5,.5);o.setPosition({x:e/2,y:r/2})};this.editor=t}get engine(){return this.editor.engine}get container(){return this.engine.getOutputContainer()}}});function tf(i,t){const e=i.width/i.height;const r=t.width/t.height;if(e>r){return i.height/t.height}return i.width/t.width}var GH=d(()=>{});var Jlt,ta;var Wk=d(()=>{Tt();U();GH();Jlt={transform:re.IDENTITY};ta=class{constructor(t){this.initialTransform=re.IDENTITY;this.editor=t;this.state=Q(Jlt)}createPreview(t){this.container=this.editor.engine.createPreview(t)}updateTransform(t=0,e=true){const r=this.calculateTransform(t);if(r.scale.x){if(e){this.saveInitialTransform(r)}else{this.savePreviewTransform(r)}this.container.setTransform(this.state.transform);return true}return false}saveInitialTransform(t){this.initialTransform=t;this.savePreviewTransform(t)}savePreviewTransform(t){Ve(()=>{this.state.transform.position=t.position;this.state.transform.scale=t.scale;this.state.transform.rotation=t.rotation;const e=Eo();const r=new O(t.scale).divide(e);this.previewTransformWithoutDpr={position:new O(t.position).divide(e),scale:r,rotation:t.rotation}})}get transform(){return this.state.transform}get position(){return this.state.transform.position}get scale(){return this.state.transform.scale}get rotation(){return this.state.transform.rotation}calculateTransform(t=0){const e=Eo();const{scaleImageToFit:r}=this.editor.configStore.config;const{width:o,height:n}=this.editor.canvasStore.canvasSize;const s=this.editor.engine.getOutputDimensions();const a=tf({width:o,height:n},s);let l=r?a:Math.min(1,a);const c=n-s.height*l;const u=this.editor.configStore.measurements.mainCanvasActionBar.height*2;if(cn*m){l=tf({width:o,height:n*m},s)}if(s.width*l>o*m){l=tf({width:o*m,height:n},s)}l*=e;const p={x:o*e/2,y:n*e/2};const h={x:l,y:l};return new re(p,h,t)}};f([C],ta.prototype,"updateTransform",1);f([C],ta.prototype,"savePreviewTransform",1);f([S],ta.prototype,"transform",1);f([S],ta.prototype,"position",1);f([S],ta.prototype,"scale",1);f([S],ta.prototype,"rotation",1)});var Cl,mv;var Gk=d(()=>{R();Cl=class{constructor(){this.imageContainerOrder=[];this.spriteContainerOrder=[]}static checkTool(t){if(["sticker","text","textdesign","brush"].indexOf(t)!==-1){throw new Error("addIndex is used for non sprites, for sprites use addSprite")}}static remove(t,e){const r=e.findIndex(o=>o===t);if(r!==-1){e.splice(r,1)}return void 0}static indexForOrder(t,e,r){const o=t[r];const n=e.findIndex(a=>a===r);if(n!==-1){return{index:n,order:e}}const{length:s}=e;if(s){let a;for(a=0;ao===t);if(r!==-1){this.spriteContainerOrder[r]=e}}bringToFront(t){const e=this.spriteContainerOrder.findIndex(r=>r===t);if(e!==-1){this.spriteContainerOrder.splice(e,1);this.spriteContainerOrder.push(t)}return this.getLastSpriteIndex()}getLastSpriteId(){const{length:t}=this.spriteContainerOrder;return this.spriteContainerOrder[t-1]}getSpriteIndex(t){const e=this.spriteContainerOrder.findIndex(r=>r===t);return e+this.imageContainerOrder.length-1}getLastSpriteIndex(){return this.imageContainerOrder.length+this.spriteContainerOrder.length-1}};mv=Cl;mv.IMAGE_CONTAINER_INDEX={["filter"]:0,["adjustment"]:1,["focus"]:2,["overlay"]:3}});var Vk;var jk=d(()=>{zn();U();Uk();Hk();Wk();Gk();Vk=class{constructor(t){this.orderHelper=new mv;this.init=()=>{const t=this.editor.configStore.config.engine;this.engine=new fm({...t,license:this.editor.configStore.config.license,assetProvider:this.editor.configStore.assetProvider,watermark:this.editor.configStore.config.watermark});this.image=new zk(this.editor);this.output=new Nk(this.editor);this.preview=new ta(this.editor)};this.dispose=()=>{if(this.engine){this.engine.dispose();this.engine=null}this.image=null;this.output=null;this.preview=null};this.editor=t}render(t){return this.engine.render(t)}previewSpaceToWorldSpace(t,e){const r=this.preview.previewTransformWithoutDpr;if(Yr(t)){const o=this.editor.engine.convertPointFromPreviewIntoWorldSpace(O.ZERO,r,e);const n=this.editor.engine.convertPointFromPreviewIntoWorldSpace({x:t,y:0},r,e);return O.distance(new O(o),new O(n))}return this.editor.engine.convertPointFromPreviewIntoWorldSpace(t,r,e)}worldSpaceToPreviewSpace(t){const e=this.preview.previewTransformWithoutDpr;if(Yr(t)){const r=this.editor.engine.convertPointFromWorldIntoPreviewSpace(O.ZERO,e);const o=this.editor.engine.convertPointFromWorldIntoPreviewSpace({x:t,y:0},e);return O.distance(new O(r),new O(o))}return this.editor.engine.convertPointFromWorldIntoPreviewSpace(t,e)}outputSpaceToWorldSpace(t){if(Yr(t)){return at.getScalarInWorldSpace(t,this.editor.engine.getOutputContainer())}return at.getPointInWorldSpace(t,this.editor.engine.getOutputContainer())}previewSpaceToOutputSpace(t){const e=this.preview.previewTransformWithoutDpr;if(Yr(t)){const r=this.editor.engine.convertPointFromPreviewIntoOutputSpace(O.ZERO,e);const o=this.editor.engine.convertPointFromPreviewIntoOutputSpace({x:t,y:0},e);return O.distance(new O(r),new O(o))}return this.editor.engine.convertPointFromPreviewIntoOutputSpace(t,e)}previewSpaceToFlippedPreviewSpace(t){return this.editor.engine.convertPointFromPreviewIntoFlippedPreviewSpace(t)}}});var xm;var VH=d(()=>{Tt();xm=class{constructor(){this.snapshots=[];this.observeIndex=Q.box(-1)}addSnapshot(t){if(this.index===this.snapshots.length-1){this.snapshots=this.snapshots.concat(JSON.stringify(t))}else{this.snapshots=[...this.snapshots.slice(0,this.index+1),JSON.stringify(t)]}this.observeIndex.set(this.snapshots.length-1)}getCurrentState(){return this.snapshots[this.index]}reset(){this.snapshots=[];this.observeIndex.set(-1)}undo(){if(this.canUndo){this.observeIndex.set(this.index-1);return JSON.parse(this.getCurrentState())}return null}redo(){if(this.canRedo){this.observeIndex.set(this.index+1);return JSON.parse(this.getCurrentState())}return null}discardSnapshotsfromIndex(t){if(t>0&&t0}get canRedo(){return this.snapshots.length-1>this.index}};f([S],xm.prototype,"index",1);f([S],xm.prototype,"canUndo",1);f([S],xm.prototype,"canRedo",1)});var du;var pv=d(()=>{Tt();R();VH();Zi();du=class{constructor(t){this.awaitHistoryChange=false;this.isDirtySinceSave=false;this.undo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onUndo();this.awaitHistoryChange=true;const t=this.appHistoryManager.undo();await this.applyState(t);this.awaitHistoryChange=false;if(!this.canUndo){this.isDirtySinceSave=false}}};this.redo=async()=>{if(!this.awaitHistoryChange){this.editor.configStore.events.onRedo();this.awaitHistoryChange=true;const t=this.appHistoryManager.redo();await this.applyState(t);this.awaitHistoryChange=false}};this.editor=t;this.appHistoryManager=new xm}get canUndo(){return this.appHistoryManager.canUndo}get canRedo(){return this.appHistoryManager.canRedo}getHistoryState(){const t=ct(this.editor.adjustmentsToolStore.state);const e=ct(this.editor.filterToolStore.state);const r=this.editor.focusToolStore.getFocusStateForHistory();const o=ct(this.editor.overlayToolStore.state);const n=ct(this.editor.frameToolStore.state);const{strokes:s}=this.editor.brushToolStore;const a=this.editor.spriteStore.getSpriteHistoryState();const l=this.editor.transformToolStore.serializableState;return{["adjustment"]:t,["filter"]:e,["focus"]:r,["overlay"]:o,["frame"]:n,["brush"]:s,sprite:a,["transform"]:l}}addInitialSnapshot(){const t=this.getHistoryState();this.appHistoryManager.addSnapshot({state:t,type:"add",description:"Initial State"})}addSnapshot(t,e,r){let o;if(!t){o=this.getHistoryState()}else if(t.sprite||t.transform){o={...this.getHistoryState(),...t}}else{o=t}this.appHistoryManager.addSnapshot({state:o,type:e,description:r});this.editor.configStore.events.onHistoryChange();if(!this.isDirtySinceSave){this.isDirtySinceSave=true}}async applyState({state:t}){try{if(t){const e=Object.keys(t);for(const r of e){switch(r){case"filter":await this.editor.filterToolStore.updateStateFromHistory(t[r]);break;case"adjustment":await this.editor.adjustmentsToolStore.updateStateFromHistory(t[r]);break;case"overlay":await this.editor.overlayToolStore.updateStateFromHistory(t[r]);break;case"frame":await this.editor.frameToolStore.updateStateFromHistory(t[r]);break;case"focus":await this.editor.focusToolStore.updateStateFromHistory(t[r],this.editor.canvasStore.sizeVector);break;case"brush":await this.editor.brushToolStore.updateStateFromHistory(t[r]);break;case"sprite":await this.editor.spriteStore.updateStateFromHistory(t[r]);break;case"transform":this.editor.outputContainer.pauseChildrenUpdates();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.updateStateFromSerialization(t[r]);this.editor.transformToolStore.onLeave();this.editor.transformToolStore.onEnter();this.editor.transformToolStore.onLeave();this.editor.outputContainer.resumeChildrenUpdates();await this.editor.wait();break;default:break}}await this.editor.renderPromise()}}catch(e){console.error(e);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:e,handleConfirm:()=>{this.applyState({state:t})}})}}isDirty(){return this.appHistoryManager.snapshots.length>1}reset(){this.appHistoryManager.reset();this.isDirtySinceSave=false}getCurrentSpritesState(){var t,e;return(e=(t=JSON.parse(this.appHistoryManager.getCurrentState()))==null?void 0:t.state)==null?void 0:e.sprite}};f([C],du.prototype,"undo",2);f([C],du.prototype,"redo",2);f([S],du.prototype,"canUndo",1);f([S],du.prototype,"canRedo",1)});var Zlt,jH,Qlt,$k;var $H=d(()=>{Zlt=(i,t)=>new Promise((e,r)=>{const o=new XMLHttpRequest;o.onload=()=>{const n=new FileReader;n.onloadend=()=>{if(typeof n.result==="string"&&n.result.substr(0,10)==="data:image"){e(n.result)}else{r(new Error(`The image could not be loaded from ${i}`))}};n.onerror=s=>{r(s)};n.readAsDataURL(o.response)};o.open("GET",i);o.responseType="blob";o.withCredentials=t==="use-credentials";o.send()});jH=(i,t)=>{return new Promise((e,r)=>{const o=new Image;o.onload=()=>{e(o)};o.onerror=()=>{r(new Error(`Failed to load image with src:${i}`))};o.crossOrigin=t;o.src=i})};Qlt=(i,t)=>new Promise((e,r)=>{Zlt(i,t).then(o=>{const n=new Image;n.addEventListener("load",()=>{e(n)});n.src=o}).catch(()=>{jH(i,t).then(o=>e(o)).catch(o=>{r(o)})})});$k=async({url:i,image:t,crossOrigin:e="anonymous"})=>{try{if(t&&t.src&&t.src.substr(0,5)==="data:"||t&&t.src&&t.src.includes(".svg")){return t}if(typeof i==="string"&&i.substr(0,5)==="data:"||typeof i==="string"&&i.includes(".svg")){return jH(i,e)}return Qlt(i||t.src,e)}catch(r){throw new Error(r)}}});var tct,hr;var hv=d(()=>{Tt();R();U();$H();tct={tool:null,isWebcam:false,image:"",imageLoadedToEngine:false};hr=class{constructor(t){this.setImage=async t=>{try{const{crossOrigin:e}=this.editor.configStore.config.engine;if(typeof t==="string"&&!t.trim()||t===void 0||t===null){this.state.image=null}else if(typeof t==="string"){this.state.image=await $k({url:cn(t)?t:this.editor.assetProvider.getPath(t),crossOrigin:e})}else if(t instanceof HTMLImageElement){this.state.image=await $k({image:t,crossOrigin:e})}if(this.isWebcam){this.state.isWebcam=false}}catch(e){throw new Error(e)}};this.setImageLoadedToEngine=t=>{this.state.imageLoadedToEngine=t};this.newImage=t=>{this.editor.init(t)};this.dispose=()=>{this.state=null;this.editor=null};this.editor=t;this.state=Q(tct)}selectTool(t){var r,o,n;const{licenseChecker:e}=this.editor.configStore;if(this.state.tool!==t&&(e==null?void 0:e.isToolAllowed(t))&&(this.image||t==="library"||t==="customTool")){if(this.editor.configStore.isLayoutAdvanced){const s=(n=(o=(r=this.editor.configStore.state.config["customTool"])==null?void 0:r.measurements)==null?void 0:o.advancedUIToolControlBar)==null?void 0:n.width;if(s){if(t==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=s}else if(this.state.tool==="customTool"){this.editor.configStore.measurements.advancedUIToolControlBar.width=this.editor.configStore.initialMeasurements.advancedUIToolControlBar.width}}}this.editor.onToolChange(this.state.tool,t);this.state.tool=t;this.editor.configStore.events.onToolChanged(t);switch(t){case"text":if(this.editor.configStore.config.text.addDefaultTextOnEnter){this.editor.spriteStore.textToolStore.addOrselect()}else{this.editor.spriteStore.textToolStore.loadFonts()}break;case"textdesign":if(this.editor.configStore.config.textdesign.addDefaultTextOnEnter){this.editor.spriteStore.textDesignToolStore.addOrselect()}break;case"brush":{this.editor.brushToolStore.initSize();break}case"transform":this.editor.transformToolStore.applyDefaultCrop();break;default:break}}}selectWebcam(t){this.state.isWebcam=t}get webcamLabel(){return this.editor.libraryStore.locale.controls.buttonWebcamClose}get tool(){return this.state.tool}get isWebcam(){return this.state.isWebcam}get image(){return this.state.image}get imageLoadedToEngine(){return this.state.imageLoadedToEngine}};f([C],hr.prototype,"selectTool",1);f([C],hr.prototype,"selectWebcam",1);f([C],hr.prototype,"setImage",2);f([C],hr.prototype,"setImageLoadedToEngine",2);f([C],hr.prototype,"newImage",2);f([C],hr.prototype,"dispose",2);f([S],hr.prototype,"webcamLabel",1);f([S],hr.prototype,"tool",1);f([S],hr.prototype,"isWebcam",1);f([S],hr.prototype,"image",1);f([S],hr.prototype,"imageLoadedToEngine",1)});var ect,Kk,Xk,Oi;var fv=d(()=>{Tt();R();U();ect={height:150,width:150};Kk={height:0,width:0};Xk=class{constructor(t){this.canvasClickDisabled=Q.box(false);this.resizeCanvas=(t=null)=>{const e=this.editor.activeStore.tool;const r=t==="transform"||!t&&e==="transform";const{isLayoutAdvanced:o,measurements:n}=this.editor.configStore;const{storedSize:s}=this.editor.canvasStore;let a=0;if(!o&&r){a=n.basicUIToolControlBar.controlsBarHeight*-1;if(t==="transform"&&e==="brush"){a-=n.basicUIToolControlBar.itemsBarHeight+4}}this.setCanvasSize({width:s.width,height:s.height+a})};this.setCanvasSize=t=>{this.state.canvasSize=t};this.dispose=()=>{this.state=null;this.canvas=null;this.canvasClickDisabled=null;this.editor=null};this.editor=t;this.state=Q(Xk.initialState)}setCanvasElement(t){this.canvas=t;this.editor.engineMediator.preview.createPreview(t);if(this.editor.activeStore.image){this.editor.init(this.editor.activeStore.image)}}saveDimensions({height:t,width:e,render:r}){const{imageLoadedToEngine:o}=this.editor.activeStore;if(t>Kk.height&&e>Kk.width){this.state.storedSize={width:e,height:t};if(this.state.canvasSize.height===0){this.state.canvasSize={width:e,height:t}}if(r&&o){this.editor.resize()}}}disableCanvasClick(){this.canvasClickDisabled.set(true)}enableCanvasClick(){this.canvasClickDisabled.set(false)}get isCanvasClickable(){return!this.canvasClickDisabled.get()}get canvasSize(){return this.state.canvasSize}get storedSize(){return this.state.storedSize}get sizeVector(){return O.fromSize(this.state.canvasSize)}get sizeVectorMagnitude(){return this.sizeVector.magnitude}getContainersAtPreviewPoint(t){const e=this.editor.engine.getContainersAtPreviewPoint(t,this.editor.engineMediator.preview.previewTransformWithoutDpr).map(r=>r.getID()).filter(r=>r!==this.editor.engineMediator.image.getImgageContainerId());this.editor.spriteStore.onCanvasClick(e)}};Oi=Xk;Oi.initialState={canvasSize:Kk,storedSize:ect};f([C],Oi.prototype,"setCanvasElement",1);f([C],Oi.prototype,"saveDimensions",1);f([C],Oi.prototype,"resizeCanvas",2);f([C],Oi.prototype,"disableCanvasClick",1);f([C],Oi.prototype,"enableCanvasClick",1);f([C],Oi.prototype,"setCanvasSize",2);f([C],Oi.prototype,"dispose",2);f([S],Oi.prototype,"isCanvasClickable",1);f([S],Oi.prototype,"canvasSize",1);f([S],Oi.prototype,"storedSize",1);f([S],Oi.prototype,"sizeVector",1);f([S],Oi.prototype,"sizeVectorMagnitude",1)});var ict,Wr;var gv=d(()=>{Tt();R();ict={type:null,identifier:null,isVisible:false,error:""};Wr=class{constructor(t){this.showActionModal=({type:t,identifier:e,error:r,handleConfirm:o,handleDismiss:n})=>{this.resetHandlers();this.state.isVisible=true;this.state.identifier=e;this.state.type=t;this.state.error=r||"";this.handleConfirm=o;this.handleDismiss=n};this.hideModal=()=>{this.state.isVisible=false;this.state.type=null;this.state.error="";this.state.identifier=null;this.resetHandlers()};this.dispose=()=>{this.state=null;this.configStore=null};this.resetHandlers=()=>{this.handleConfirm=null;this.handleDismiss=null};this.configStore=t.configStore;this.state=Q(ict)}showInfoModal(t){this.resetHandlers();this.state.isVisible=true;this.state.type="info";this.state.identifier=t;this.state.error=""}showTextEditModal(){this.resetHandlers();this.state.isVisible=true;this.state.type="textEdit";this.state.identifier="inputText";this.state.error=""}get modalProps(){const{isVisible:t}=this.state;const e=this.getModalLocale();if(e){const{bodyLabel:r,headerLabel:o,buttonYes:n,buttonNo:s}=e;return{headerLabel:o,bodyLabel:r,confirmLabel:n,dismissLabel:s,isVisible:t,handleClose:this.hideModal,handleConfirm:this.handleConfirm,handleDismiss:this.handleDismiss}}return{isVisible:false}}get isVisible(){return this.state.isVisible}get type(){return this.state.type}get identifier(){return this.state.identifier}get positionOffset(){const{isLayoutAdvanced:t,measurements:{basicCanvasOffset:e,advancedUIToolControlBar:r,advancedUIToolbar:o},isOrderDefault:n}=this.configStore;const s=(r.width+o.width)*(!n?-1:1);const a=e;return t?{x:s/2,y:0}:{x:0,y:-a}}getModalLocale(){const{identifier:t,error:e,type:r}=this.state;const{locale:o}=this.configStore;if(!r||!t||r==="textEdit")return null;if(r&&t&&o[`${r}Modals`]&&o[`${r}Modals`][t]){const n=o[`${r}Modals`][t];let{body:s}=n;if(s&&typeof e==="object"){Object.keys(e).forEach(l=>{s=s.replace(`\${${l}}`,e[l])})}else if(s){s=s.replace("${error}",e)}let a=n.heading;if(r==="error"||r==="warning"){const l={error:o.common.error,warning:o.common.warning};const c=r==="error"?l.error:l.warning;a=`${c}${n.headingDelimiter||""} ${n.header||""}`}return{bodyLabel:s,headerLabel:a,buttonYes:n.buttonYes,buttonNo:n.buttonNo}}return null}};f([C],Wr.prototype,"showActionModal",2);f([C],Wr.prototype,"showInfoModal",1);f([C],Wr.prototype,"showTextEditModal",1);f([C],Wr.prototype,"hideModal",2);f([C],Wr.prototype,"dispose",2);f([S],Wr.prototype,"modalProps",1);f([S],Wr.prototype,"isVisible",1);f([S],Wr.prototype,"type",1);f([S],Wr.prototype,"identifier",1);f([S],Wr.prototype,"positionOffset",1)});var ti;var bv=d(()=>{Tt();U();ti=class{constructor(t){this.defaultScale=1;this.SCALE_LEVELS=[8.33,12.5,16.66,25,33.33,50,66.66,100,125,150,200,300,400,500,600].map(t=>t/100);this.state={position:{x:0,y:0},scaleIndex:-1};this.offset={x:0,y:0};this.in=()=>{if(this.canZoomIn){this.state.scaleIndex+=1;this.scaleRender()}};this.out=()=>{if(this.canZoomOut){this.state.scaleIndex-=1;const{maxOffsetX:t,maxOffsetY:e}=this.checkOffset({x:0,y:0});if(this.state.scaleIndex===this.defaultIndex){this.offset.y=e}if(this.state.scaleIndex===this.defaultIndex){this.offset.x=t}this.savePosition();this.scaleRender()}};this.setOffset=t=>{const{canDragX:e,canDragY:r}=this.checkOffset(t);if(e){this.offset.x=t.x}if(r){this.offset.y=t.y}this.scaleRender()};this.editor=t}setInitialTransform(t=0){const e=Eo();const{scaleImageToFit:r}=this.editor.configStore.config;const{transform:o}=this.editor.engineMediator.preview;Ve(()=>{const n=Math.abs(t||o.scale.x);this.setDefaultScale(r?n:Math.min(1*e,n));this.setPosition(o.position)})}resetScale(){this.state.scaleIndex=-1}resetPosition(){const{width:t,height:e}=this.editor.canvasStore.canvas;this.setPosition({x:t/2,y:e/2})}resetOffset(){this.offset={x:0,y:0}}setPosition(t){this.state.position.x=t.x;this.state.position.y=t.y}savePosition(){this.setPosition(this.getPositionWithOffset());this.offset={x:0,y:0}}setDefaultScale(t){if(this.defaultScale!==1){const r=this.SCALE_LEVELS.findIndex(o=>o===this.defaultScale);if(r!==-1){this.SCALE_LEVELS=[...this.SCALE_LEVELS.slice(0,r),...this.SCALE_LEVELS.slice(r+1)]}}const e=this.SCALE_LEVELS.findIndex(r=>r===t);if(e!==-1){this.state.scaleIndex=e}else{const r=this.SCALE_LEVELS.findIndex((o,n)=>{if(n===0){return t0;const g=u>0;const x=m-a;const v=p-l;return{canDragX:x<0,canDragY:v<0,maxOffsetX:h?-x:x,maxOffsetY:g?-v:v}}calculateScale(t=0,e=this.previewSize,r=this.defaultScale){const{width:o,height:n}=e;const s=new O({x:o,y:n});const a=new O(Math.abs(s.x*Math.cos(t))+Math.abs(s.y*Math.sin(t)),Math.abs(s.x*Math.sin(t))+Math.abs(s.y*Math.cos(t)));const l=s.subtract(a).divide(2).multiply(r).abs;if(l.y>l.x){return l.y*2/s.y+r}return l.x*2/s.x+r}get defaultIndex(){return this.SCALE_LEVELS.findIndex(t=>t===this.defaultScale)}getPositionWithOffset(t=this.offset){const{position:e}=this;return{x:e.x-t.x,y:e.y-t.y}}scaleRender(t=false){const e=this.editor.scale.getPositionWithOffset();const r=t?this.defaultScale:this.scale;const o={x:r,y:r};this.editor.engineMediator.preview.container.setScale(o);this.editor.engineMediator.preview.container.setPosition(e);this.editor.engineMediator.preview.savePreviewTransform({scale:o,position:e,rotation:0});if(!t){this.editor.render()}}get scale(){const t=this.state.scaleIndex;return t!==-1?this.SCALE_LEVELS[t]:this.defaultScale}get zoomLevel(){const t=Eo();return(this.scale/t*100).toFixed(1)}get canDrag(){return this.defaultScalethis.defaultIndex}return this.state.scaleIndex!==0}get canZoomIn(){return this.SCALE_LEVELS.length-1>this.state.scaleIndex}get position(){return this.state.position}get scaledSize(){const t=this.state.scaleIndex;const e=t!==-1?this.SCALE_LEVELS[t]:this.defaultScale;const{previewSize:r}=this;return{width:r.width*e/this.defaultScale,height:r.height*e/this.defaultScale}}get previewSize(){return this.editor.getPreviewSize()}};f([Q],ti.prototype,"state",2);f([C],ti.prototype,"in",2);f([C],ti.prototype,"out",2);f([C],ti.prototype,"setInitialTransform",1);f([C],ti.prototype,"resetScale",1);f([C],ti.prototype,"resetPosition",1);f([C],ti.prototype,"setPosition",1);f([C],ti.prototype,"savePosition",1);f([C],ti.prototype,"setDefaultScale",1);f([C],ti.prototype,"setScaleToDefault",1);f([S],ti.prototype,"scale",1);f([S],ti.prototype,"zoomLevel",1);f([S],ti.prototype,"canDrag",1);f([S],ti.prototype,"canZoomOut",1);f([S],ti.prototype,"canZoomIn",1);f([S],ti.prototype,"position",1);f([S],ti.prototype,"scaledSize",1)});var KH,rct,Gn,ze;var qk=d(()=>{Tt();U();KH=[[0,0],[0,1],[1,0],[1,1]];rct=[[0,1,2,3],[2,3,0,1],[1,0,3,2],[3,2,1,0]];Gn=class{constructor(t,e,r="center",o=true,n=false){this.considerRotation=true;this.considerFlip=true;this.store=e;this.m=r==="center"?Gn.movePivotTo([.5,.5]):KH;this.considerRotation=o;this.considerFlip=n;this.configStore=t.configStore}static getFlippedEdgeIndex(t,e,r){return rct[(e?1:0)+(r?2:0)][t]}static movePivotTo(t){return KH.map(e=>[e[0]-t[0],e[1]-t[1]])}get position(){return this.store.position}get size(){return this.store.size}get rotation(){return this.considerRotation?this.store.rotationWRTOutputRotation:0}get flipHorizontally(){return this.considerFlip?this.store.isFlippedHorizontal:false}get flipVertically(){return this.considerFlip?this.store.isFlippedVertical:false}get flipCenter(){return this.considerFlip?this.store.flipCenter:null}handleOrigin(t,e,r){const o=Gn.getFlippedEdgeIndex(t,e,r);const n=this.m[o][0]*this.size.width;const s=this.m[o][1]*this.size.height;return{width:n,height:s}}get leftTop(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(0,e,r);return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottom(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(1,e,r);return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightTop(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(2,e,r);return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottom(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(3,e,r);return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(1,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get rightBottomHandle(){const{position:t,flipHorizontally:e,flipVertically:r}=this;const o=this.handleOrigin(3,e,r);o.height+=this.configStore.measurements.canvasControls.sprite.rotateHandle.height;return Gn.coordinatesWithRotation(o,this.rotation,this.flipHorizontally,this.flipVertically,this.flipCenter,t)}get leftMid(){const t=new O(this.leftTop);const e=new O(this.leftBottom);return t.add(e).divide(2)}get rightMid(){const t=new O(this.rightTop);const e=new O(this.rightBottom);return t.add(e).divide(2)}};ze=Gn;ze.coordinatesWithRotation=({width:t,height:e},r,o,n,s,a)=>{let l=t*Math.cos(r)-e*Math.sin(r)+a.x;let c=t*Math.sin(r)+e*Math.cos(r)+a.y;if(o){l=s.x*2-l}if(n){c=s.y*2-c}return new O({x:l,y:c}).rounded};f([S],ze.prototype,"position",1);f([S],ze.prototype,"size",1);f([S],ze.prototype,"rotation",1);f([S],ze.prototype,"flipHorizontally",1);f([S],ze.prototype,"flipVertically",1);f([S],ze.prototype,"flipCenter",1);f([S],ze.prototype,"leftTop",1);f([S],ze.prototype,"leftBottom",1);f([S],ze.prototype,"rightTop",1);f([S],ze.prototype,"rightBottom",1);f([S],ze.prototype,"leftBottomHandle",1);f([S],ze.prototype,"rightBottomHandle",1);f([S],ze.prototype,"leftMid",1);f([S],ze.prototype,"rightMid",1)});var Yk=d(()=>{dv();Yh();Qh();Jh();jk();Gk();Uk();Hk();Wk();pv();hv();fv();gv();bv();qk()});var Ft;var XH=d(()=>{Tt();U();Dk();Ft=class{constructor(t,e){this.minCropSize=0;this.id="";this.dispose=()=>{this.state=null;this.defaults=null;this.configStore=null};this.state={identifier:"identity",outputRotation:0,rotationInDegrees:0,flipHorizontally:false,flipVertically:false,cropState:Q.map({})};this.configStore=t.configStore;this.id=At();this.minCropSize=this.configStore.measurements.crop.minSize;this.defaults=e}changeIdentifier(t){this.state.identifier=t;const e=this.state.cropState.get(`${this.id}-${t}`);if(!e){this.state.cropState.set(`${this.id}-${t}`,{...jo})}}changeRatio(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){this.state.cropState.set(`${this.id}-${this.identifier}`,{...e,ratio:t})}}changeSize(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t.width&&t.width>0){e.size.width=Math.round(t.width)}if(t.height&&t.height>0){e.size.height=Math.round(t.height)}this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeHeight(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.height=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changeWidth(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){if(t){e.size.width=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}}changePositionX(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r&&t<=e-this.minCropSize&&t>=0){r.position.x=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}return false}changePositionY(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r&&t<=e-this.minCropSize&&t>=0){r.position.y=Math.round(t);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}return false}changePosition(t,e){const r=this.state.cropState.get(`${this.id}-${this.identifier}`);if(r){if(t.x<=e.width-this.minCropSize&&t.x>=0&&t.y<=e.height-this.minCropSize&&t.y>=0){r.position.x=Math.round(t.x);r.position.y=Math.round(t.y);this.state.cropState.set(`${this.id}-${this.identifier}`,r);return true}}return false}changeLockResolution(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.lockResolution=t!==void 0?t:!e.lockResolution;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}changeForceDimensions(t){const e=this.state.cropState.get(`${this.id}-${this.identifier}`);if(e){e.forceDimensions=t;this.state.cropState.set(`${this.id}-${this.identifier}`,e)}}clearState(){this.state.cropState.forEach((t,e)=>e.startsWith(this.id)&&this.state.cropState.delete(e))}setRotation(t){this.state.rotationInDegrees=t}resetRotation(){this.state.rotationInDegrees=0}resetOutputRotation(){this.state.outputRotation=0}resetFlip(){this.state.flipHorizontally=false;this.state.flipVertically=false}updateFlip({flipHorizontally:t,flipVertically:e}){this.state.flipHorizontally=t;this.state.flipVertically=e}setOutputRotation(t){this.state.outputRotation=t}flipHorizontally(){this.state.flipHorizontally=!this.state.flipHorizontally}flipVertically(){this.state.flipVertically=!this.state.flipVertically}get flipCenter(){const{width:t,height:e}=this.defaults.maxCropMaskSize;return new O(t/2,e/2)}get isFlippedHorizontal(){return this.state.flipHorizontally}get isFlippedVertical(){return this.state.flipVertically}get identifier(){return this.state.identifier}get height(){return this.selectedCrop?this.selectedCrop.size.height:jo.size.height}get width(){return this.selectedCrop?this.selectedCrop.size.width:jo.size.width}get position(){return this.selectedCrop?this.selectedCrop.position:jo.position}get ratio(){return this.selectedCrop?this.selectedCrop.ratio:jo.ratio}get size(){return this.selectedCrop?this.selectedCrop.size:jo.size}get x(){return this.selectedCrop?this.selectedCrop.position.x:jo.position.x}get y(){return this.selectedCrop?this.selectedCrop.position.y:jo.position.y}get lockResolution(){return this.selectedCrop?this.selectedCrop.lockResolution:jo.lockResolution}get forceDimensions(){return this.selectedCrop?this.selectedCrop.forceDimensions:jo.forceDimensions}get selectedCrop(){return this.state.cropState.get(`${this.id}-${this.identifier}`)}get rotationInDegrees(){return this.state.rotationInDegrees}get outputRotation(){return this.state.outputRotation}};f([Q],Ft.prototype,"state",2);f([C],Ft.prototype,"changeIdentifier",1);f([C],Ft.prototype,"changeRatio",1);f([C],Ft.prototype,"changeSize",1);f([C],Ft.prototype,"changeHeight",1);f([C],Ft.prototype,"changeWidth",1);f([C],Ft.prototype,"changePositionX",1);f([C],Ft.prototype,"changePositionY",1);f([C],Ft.prototype,"changePosition",1);f([C],Ft.prototype,"changeLockResolution",1);f([C],Ft.prototype,"changeForceDimensions",1);f([C],Ft.prototype,"clearState",1);f([C],Ft.prototype,"setRotation",1);f([C],Ft.prototype,"resetRotation",1);f([C],Ft.prototype,"resetOutputRotation",1);f([C],Ft.prototype,"resetFlip",1);f([C],Ft.prototype,"updateFlip",1);f([C],Ft.prototype,"setOutputRotation",1);f([C],Ft.prototype,"flipHorizontally",1);f([C],Ft.prototype,"flipVertically",1);f([C],Ft.prototype,"dispose",2);f([S],Ft.prototype,"flipCenter",1);f([S],Ft.prototype,"isFlippedHorizontal",1);f([S],Ft.prototype,"isFlippedVertical",1);f([S],Ft.prototype,"identifier",1);f([S],Ft.prototype,"height",1);f([S],Ft.prototype,"width",1);f([S],Ft.prototype,"position",1);f([S],Ft.prototype,"ratio",1);f([S],Ft.prototype,"size",1);f([S],Ft.prototype,"x",1);f([S],Ft.prototype,"y",1);f([S],Ft.prototype,"lockResolution",1);f([S],Ft.prototype,"forceDimensions",1);f([S],Ft.prototype,"selectedCrop",1);f([S],Ft.prototype,"rotationInDegrees",1);f([S],Ft.prototype,"outputRotation",1)});var Jk;var qH=d(()=>{Tt();U();hm();Jk=class{constructor(t){this.transforms={output:JSON.stringify(re.IDENTITY),preview:JSON.stringify(re.IDENTITY)};this.setFrameOpacity=t=>{this.frameOpacity=t;if(this.entered&&this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(0)}};this.setOverlayOpacity=t=>{this.overlayOpacity=t;if(this.entered&&this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(0)}};this.editor=t;this.overlayOpacity=0;this.frameOpacity=0;this.entered=false}onLeave(){const{flipHorizontally:t,flipVertically:e,rotation:r,outputRotation:o}=this.transformToolStore.rotateFlipState;this.entered=false;if(this.editor.overlayToolStore.identifier!=="identity"){this.editor.overlayToolStore.changeOpacity(this.overlayOpacity)}if(this.editor.frameToolStore.identifier!=="identity"){this.editor.frameToolStore.changeOpacity(this.frameOpacity)}this.editor.engine.setWatermarkOpacity(1);const n=this.editor.previewToWorld(new O(this.transformToolStore.leftTopRespectFlip).add(new O(this.transformToolStore.rightBottomRespectFlip)).divide(2).add(new O(this.transformToolStore.unRotatedDefaults.cropMaskPosition)),true);const s=this.engineMediator.preview.container;const{outputContainer:a}=this.editor;a.setResolution(ct(this.transformToolStore.localOutputImageSize));a.setData({flipVertically:e,flipHorizontally:t});const l=s.getScale();this.editor.overlayToolStore.correctOverlayFlip();this.saveTransforms();let c=1;if(this.transformToolStore.lockResolution){const{cropMaskSize:g,defaultImageSize:x}=this.transformToolStore;const v=this.transformToolStore.maxCropMaskSize;const b={height:g.height*x.height/v.height,width:g.width*x.width/v.width};c=b.width/this.transformToolStore.localOutputImageSize.width}const u=Math.abs(l.x);const m=c/(u/this.transformToolStore.defaultScale);const p={x:m,y:m};const h=-(r-o);a.setTransform({scale:p,position:n,rotation:h});this.editor.engineMediator.preview.updateTransform(0,false);this.editor.scale.setInitialTransform();this.editor.spriteStore.updateCanvasControls();this.editor.focusToolStore.updateCanvasControls()}resetTransforms(t){this.transforms=t}onEnter(){this.entered=true;if(this.editor.overlayToolStore.identifier!=="identity"){this.overlayOpacity=this.editor.overlayToolStore.opacity;this.editor.overlayToolStore.changeOpacity(0)}if(this.editor.frameToolStore.identifier!=="identity"){this.frameOpacity=this.editor.frameToolStore.opacity;this.editor.frameToolStore.changeOpacity(0)}this.editor.engine.setWatermarkOpacity(0);this.editor.scale.setScaleToDefault();const t=this.engineMediator.preview.container;const{outputContainer:e}=this.editor;const r=JSON.parse(this.transforms.preview);e.setResolution(ct(this.transformToolStore.defaultImageSize));t.setTransform(r);e.setTransform(JSON.parse(this.transforms.output));const o=r.scale;e.setData({flipVertically:false,flipHorizontally:false});this.transformToolStore.transformStore.updateFlip({flipVertically:o.y<0,flipHorizontally:o.x<0});this.engineMediator.preview.savePreviewTransform(r);const{scale:n}=this.engineMediator.preview.calculateTransform();this.editor.scale.setInitialTransform(n.x)}rotateOutputContainer(t,e=true){const{width:r,height:o}=this.editor.engineMediator.image.container.getBounds();const n=UA(t)?{width:o,height:r}:{width:r,height:o};this.editor.outputContainer.rotate(t,n);this.transformToolStore.transformStore.setOutputRotation(this.editor.outputContainer.getRotation());const{rotation:s}=this.transformToolStore.rotateFlipState;this.engineMediator.preview.updateTransform(s);Ve(()=>{this.editor.scale.setInitialTransform();const a=this.getScaleWithFlip(s);this.engineMediator.preview.container.setScale(a);this.transformToolStore.setCropDefaults(true);this.transformToolStore.updateCropMask()});if(e){this.editor.render()}}applyPreviewTransform(){const{rotation:t,flipHorizontally:e,flipVertically:r}=this.transformToolStore.rotateFlipState;const o=this.editor.scale.getPositionWithOffset();const n=this.getScaleWithFlip();let s=t;if(e){s=pm(s)}if(r){s=pm(s)}const a={position:o,rotation:s,scale:n};this.engineMediator.preview.savePreviewTransform(a);this.engineMediator.preview.container.setTransform(a)}getScaleWithFlip(t=this.transformToolStore.rotateFlipState.rotation){const{flipHorizontally:e,flipVertically:r}=this.transformToolStore.rotateFlipState;const o=e?-1:1;const n=r?-1:1;const s=this.editor.scale.calculateScale(t);return{x:s*o,y:s*n}}saveTransforms(){const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:t,output:e}}saveTransformsBasedOnFlip(){const t=this.engineMediator.preview.container.getTransform();const{scale:e}=t;const{flipVertically:r,flipHorizontally:o}=this.editor.outputContainer.getData();const n=JSON.stringify(this.editor.outputContainer.getTransform());this.transforms={preview:JSON.stringify({...t,scale:{x:o?-e.x:e.x,y:r?-e.y:e.y}}),output:n}}get engineMediator(){return this.editor.engineMediator}get transformToolStore(){return this.editor.transformToolStore}}});var Zk;var YH=d(()=>{U();Zk=class{constructor(t){this.store=t;this.initialState={};this.state={};this.dispose=()=>{this.initialState=null;this.state=null}}init(){this.initialState=this.store.serializableState;this.state={...this.initialState}}trackChanges(){this.state=this.store.serializableState}isEqual(){return(0,Ye.default)(this.state,this.initialState)}hasChanges(){return!this.isEqual()}}});var JH,mu,tt;var Qk=d(()=>{Tt();R();U();Yk();Zi();Nn();XH();qH();YH();JH="identity";mu=class{constructor(t){this.unRotatedDefaults={cropMaskPosition:{x:0,y:0},scale:1};this.defaultAngle=0;this.dragMode=Q.box(false);this.minCropSize=0;this.transformHistory=new Zk(this);this.defaults={cropMaskPosition:{x:0,y:0},maxCropMaskSize:{width:0,height:0},imageSize:{width:0,height:0},scale:1};this.localOutputSize={width:0,height:0};this.checkIfTransformThumbnailExits=t=>{if(!t.trim())return false;let e=this.editor.configStore.config.assetBaseUrl;const{length:r}=e;if(e[r-1]!=="/"){e+="/"}if(`${e}transform`===t){return false}const o=new Image;try{o.src=t;return true}catch(n){return false}};this.reset=()=>{this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.resetCrop();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);const t=this.editor.outputContainer.getRotation();if(t!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();this.editor.render();this.trackChanges()};this.changeLocalOutputSize=t=>{this.localOutputSize.height=Math.round(t.height);this.localOutputSize.width=Math.round(t.width);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(t.width),height:Math.round(t.height)})};this.changeDefaultScale=t=>{this.defaults.scale=t};this.changeLocalOutputHeight=t=>{this.localOutputSize.height=Math.round(t)};this.changeLocalOutputWidth=t=>{this.localOutputSize.width=Math.round(t)};this.changeLockResolution=()=>{this.transformStore.changeLockResolution();this.trackChanges()};this.rotateClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?dS:mS;this.rotateOutputContainer(e(t))};this.rotateAntiClockwise=()=>{const t=this.editor.outputContainer.getRotation();const e=this.isFlippedVertical?mS:dS;this.rotateOutputContainer(e(t))};this.flipHorizontally=(t=true)=>{this.transformStore.flipHorizontally();this.editor.spriteStore.reverseTextHorizontally(this.transformStore.isFlippedHorizontal);this.transformRender(t);if(t){this.trackChanges()}};this.flipVertically=(t=true)=>{this.transformStore.flipVertically();this.editor.spriteStore.reverseTextVertically(this.transformStore.isFlippedVertical);this.transformRender(t);if(t){this.trackChanges()}};this.applyDefaultCrop=(t=false)=>{if(this.identifier==="identity"){const{identifier:e}=this.getMatchingItem();this.changeIdentifier(e,t)}};this.updateCropMask=()=>{this.changeIdentifier(this.identifier,true)};this.onLeftTop=({x:t,y:e})=>{const r=this.getRatio();const o=this.rightBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,t),o.x-n.width);const l=Math.min(Math.max(0,e),o.y-n.height);const c=o.x-a;const u=o.y-l;const m={width:Math.max(this.minCropSize,Math.min(c,s.width-a)),height:Math.max(this.minCropSize,Math.min(u,s.height-l))};if(r==="*"){if(this.changePosition({x:a,y:l})){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);const h=new O(o).subtract({x:p.width,y:p.height});if(this.changePosition(h)){this.changeCropAndOutputSize(p,r)}}};this.onLeftBottom=({x:t,y:e})=>{const r=this.getRatio();const o=this.rightTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.min(Math.max(0,t),o.x-n.width);const l=Math.max(0,e,o.y+n.height);const c=o.x-a;const u=l-o.y;const m={width:Math.max(1,Math.min(c,s.width-a)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){if(this.changePositionX(a)){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);if(this.changePositionX(o.x-p.width)){this.changeCropAndOutputSize(p,r)}}};this.onRightTop=({x:t,y:e})=>{const r=this.getRatio();const o=this.leftBottom;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,t,o.x+n.width);const l=Math.min(Math.max(0,e),o.y-n.height);const c=a-o.x;const u=o.y-l;const m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-l))};if(r==="*"){if(this.changePositionY(l)){this.changeCropAndOutputSize(m)}}else{const p=this.proportionalSize(r,m);if(this.changePositionY(o.y-p.height)){this.changeCropAndOutputSize(p,r)}}};this.onRightBottom=({x:t,y:e})=>{const r=this.getRatio();const o=this.leftTop;const{minCropMaskSize:n,maxCropMaskSize:s}=this;const a=Math.max(0,t,o.x+n.width);const l=Math.max(0,e,o.y+n.height);const c=a-o.x;const u=l-o.y;const m={width:Math.max(1,Math.min(c,s.width-o.x)),height:Math.max(1,Math.min(u,s.height-o.y))};if(r==="*"){this.changeCropAndOutputSize(m)}else{const p=this.proportionalSize(r,m);this.changeCropAndOutputSize(p,r)}};this.onPixelWidth=t=>{const e=JSON.stringify(ct(this.localOutputSize));const r=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(r&&r.ratio){let n=t;let s=this.localOutputSize.height;let{ratio:a}=r;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(t,o.width),this.minCropSize);this.changeLocalOutputWidth(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(n),height:Math.round(s)})}else{const l=mu.placeCropMask(a,o);n=Math.max(Math.min(n,l.width),this.minCropSize);s=n/a;this.changeLocalOutputSize({height:s,width:n})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.onPixelHeight=t=>{const e=JSON.stringify(ct(this.localOutputSize));const r=this.entityManager.items.find(n=>n.identifier===this.identifier);const o=this.defaults.imageSize;if(r&&r.ratio){let n=t;let s=this.localOutputSize.width;let{ratio:a}=r;if(a==="*"&&this.lockResolution){a=this.localOutputSize.width/this.localOutputSize.height}if(a==="*"&&!this.lockResolution){n=Math.max(Math.min(t,o.height),this.minCropSize);this.changeLocalOutputHeight(n);this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(s),height:Math.round(n)})}else{const l=mu.placeCropMask(a,o);n=Math.max(Math.min(n,l.height),this.minCropSize);s=n*a;this.changeLocalOutputSize({height:n,width:s})}if(!this.lockResolution){this.updatePreviewSizeWRTImageSize()}this.checkAndAddSnapshot(JSON.parse(e));return Math.round(n)}return t};this.dispose=()=>{if(this.transformStore){this.transformStore.dispose();this.transformStore=null}if(this.transformHistory){this.transformHistory.dispose();this.transformHistory=null}this.editor=null;this.dragMode=null;this.selectedCategory=null;this.defaults=null;this.localOutputSize=null;this.rect=null;this.transformations=null;this.entityManager=null};this.setFrameOpacity=t=>{this.transformations.setFrameOpacity(t)};this.setOverlayOpacity=t=>{this.transformations.setOverlayOpacity(t)};this.closestRatioReducer=t=>(e,r)=>{if(r===null)return-1;return Math.abs(t-e.ratio)(e,r)=>{if(r===null)return-1;const o=Math.abs(e.dimensions.x/e.dimensions.y);const n=Math.abs(r.dimensions.x/r.dimensions.y);if(o===n){return e.dimensions.x*e.dimensions.y>r.dimensions.x*r.dimensions.y?-1:1}return Math.abs(t-o){const t=this.entityManager.items.findIndex(l=>l.identifier==="imgly_transform_common_custom");if(t!==-1)return this.entityManager.items[t];const e=this.entityManager.items.findIndex(l=>l.ratio==="*");if(e!==-1)return this.entityManager.items[e];const r=ct(this.editor.outputContainer.getResolution());const o=Math.abs(r.width/r.height);const[n]=this.entityManager.items.filter(l=>l.ratio&&typeof l.ratio==="number").sort(this.closestRatioReducer(o));const[s]=this.entityManager.items.filter(l=>l.dimensions&&!l.ratio).sort(this.closestDimensionsReducer(o));if(!n||!s||!n.ratio&&!s.dimensions){return this.entityManager.items[0]}if(!s||!s.dimensions)return n;if(!n||!n.ratio)return s;const a=Math.abs(s.dimensions.x/s.dimensions.y);if(a===n.ratio)return n;return Math.abs(o-n.ratio){let e=this.entityManager.items.find(r=>r.identifier===t);if(!e){e=this.getMatchingItem()}return e};this.editor=t;this.selectedCategory=JH;this.transformStore=new Ft(t,this.defaults);this.transformations=new Jk(t);const{enableRotation:e,enableFlip:r,...o}=this.config;const n=this.editor.assetProvider.getAssets("transform");this.entityManager=new Ne(n,{...o,locale:{...this.locale.items,...this.locale.categories},getAssetPath:this.editor.getAssetPath("transform")});this.rect=new ze(this.editor,this.transformStore,"topLeft",false,false);this.rectForUi=new ze(this.editor,this.transformStore,"topLeft",false,true);this.minCropSize=this.editor.configStore.measurements.crop.minSize}static inRadians(t){return t*Math.PI/180}static placeCropMask(t,e){if(e.height*t>e.width){const o=e.width/t;return{height:o,width:e.width,yChanged:true}}const r=e.height*t;return{height:e.height,width:r,yChanged:false}}changeIdentifier(t,e=false){this.transformStore.changeIdentifier(t);const r=this.getCropMask(t,this.defaults.imageSize);if(r){this.transformStore.changeRatio(r.ratio);this.changeLocalOutputSize(r);this.updatePreviewSizeWRTImageSize();if(r.yChanged!==void 0){this.updateInitialCropMaskPosition(r.yChanged)}if(r.dimensions){this.changeLocalOutputSize({width:r.dimensions.x,height:r.dimensions.y})}if(e){this.trackChanges()}}}setDragMode(t){this.dragMode.set(t)}getCropMask(t,e){const r=this.getTransform(t);if(r){const{ratio:o,forceDimensions:n,lockDimensions:s,dimensions:a=null}=r;if(n){this.transformStore.changeForceDimensions(n)}if(s){this.transformStore.changeLockResolution(s)}if(o){switch(o){case"*":this.changePosition({x:0,y:0});return{...e,yChanged:void 0,ratio:"*",dimensions:a};default:return{...mu.placeCropMask(r.ratio,e),ratio:r.ratio,dimensions:a}}}else{const{x:l,y:c}=r.dimensions;return{...mu.placeCropMask(l/c,e),ratio:null,dimensions:a}}}return null}setCropDefaults(t=false){const e=this.editor.outputContainer.getResolution();this.setDefaultImageSize(e);const r=this.editor.getPreviewSize();const{position:o}=this.editor.engineMediator.preview.previewTransformWithoutDpr;this.setMaxCropSize(r);this.setDefaultCropPosition({x:o.x-r.width/2,y:o.y-r.height/2});this.changeDefaultScale(this.editor.scale.defaultScale);if(!t){this.unRotatedDefaults.cropMaskPosition=this.defaultCropMaskPosition;this.unRotatedDefaults.scale=this.defaultScale}}setDefaultImageSize(t){this.defaults.imageSize={...ct(t)};if(!this.lockResolution){this.localOutputSize={...ct(t)}}}setMaxCropSize(t){this.defaults.maxCropMaskSize.height=t.height;this.defaults.maxCropMaskSize.width=t.width}setDefaultCropPosition(t){this.defaults.cropMaskPosition.x=t.x;this.defaults.cropMaskPosition.y=t.y}resetCrop(){this.transformStore.clearState();this.transformStore.changeIdentifier("identity")}toggleCategorySelection(t){this.selectedCategory=this.selectedCategory===t?JH:t}pureReset(){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.editor.spriteStore.correctTextFlip();this.editor.overlayToolStore.correctOverlayFlip();this.setDefaultAngle(0);this.engineMediator.output.applyNewImageTransform();this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const t=JSON.stringify(this.engineMediator.preview.container.getTransform());const e=JSON.stringify(this.editor.outputContainer.getTransform());this.transformations.resetTransforms({preview:t,output:e})}changePosition(t){return this.transformStore.changePosition(t,this.defaults.maxCropMaskSize)}changePositionX(t){return this.transformStore.changePositionX(t,this.defaults.maxCropMaskSize.width)}changePositionY(t){return this.transformStore.changePositionY(t,this.defaults.maxCropMaskSize.height)}changeCropAndOutputSize({width:t,height:e},r,o=true){this.transformStore.changeWidth(t);this.transformStore.changeHeight(e);if(!this.lockResolution){const{height:n,width:s}=this.defaults.maxCropMaskSize;const{height:a,width:l}=this.defaults.imageSize;let c=a/n*e;const u=l/s*t;if(r){c=u/r}if(o){this.editor.configStore.events.onCropDimensionsChanged({width:Math.round(u),height:Math.round(c)})}if(e>=this.minCropSize){this.changeLocalOutputHeight(c)}if(t>=this.minCropSize){this.changeLocalOutputWidth(u)}}}transformRender(t=true){this.transformations.applyPreviewTransform();if(t){this.editor.render()}}addSnapshot(){if(this.transformHistory.isEqual())return;this.editor.addSnapshot({["transform"]:this.serializableState},"edit","Transform edit")}trackChanges(){this.transformHistory.trackChanges()}get serializableState(){const{flipHorizontally:t,flipVertically:e}=this.rotateFlipState;const{identifier:r,rotationInDegrees:o}=this;const n=Gl(o);const s=uS(xb(this.editor.engineMediator.output.container.getRotation())+o);const{start:a,end:l}=this.convertUIToOperationOptions(n,s);return{flipHorizontally:t,flipVertically:e,rotation:n,start:a,end:l,identifier:r,outputRotation:s}}getStartEndForOperation(t){const{leftTop:e,rightBottom:r,maxCropMaskSize:o}=this;const n=e.y;const s=e.x;const a=r.x;const l=r.y;switch(t){case 270:return{leftTop:{x:o.height-l,y:s},rightBottom:{x:o.height-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 90:return{leftTop:{x:n,y:o.width-a},rightBottom:{x:l,y:o.width-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}getStartEndForUI(t,e,r){const{maxCropMaskSize:o}=this;const n=e.y;const s=e.x;const a=r.x;const l=r.y;switch(t){case 90:return{leftTop:{x:o.width-l,y:s},rightBottom:{x:o.width-n,y:a}};case 180:return{leftTop:{x:o.width-a,y:o.height-l},rightBottom:{x:o.width-s,y:o.height-n}};case 270:return{leftTop:{x:n,y:o.height-a},rightBottom:{x:l,y:o.height-s}};default:return{leftTop:{x:s,y:n},rightBottom:{x:a,y:l}}}}convertOperationOptionsToUI({start:t,end:e,rotation:r,outputRotation:o}){const n=o===90||o===270;const s=n?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);const a=Math.cos(r);const l=Math.sin(r);const c=this.calculateScale(r);const u=new O(Math.min(t.x,e.x),Math.min(t.y,e.y));const m=new O(Math.max(t.x,e.x),Math.max(t.y,e.y));const p=m.subtract(u).divide(2);const h=u.add(p).multiply(s);const g=h.subtract(s.multiply(.5));const x=new O(g.x*a-g.y*l,g.x*l+g.y*a).multiply(c);const v=s.multiply(.5).add(x);const b=v.divide(s);const T=b.subtract(p.multiply(c));const k=b.add(p.multiply(c));const E=n?O.fromSize(this.maxCropMaskSize).swapped:O.fromSize(this.maxCropMaskSize);const A=T.multiply(E);const I=k.multiply(E);const{leftTop:F,rightBottom:Z}=this.getStartEndForUI(o,A,I);return{start:new O(F),end:new O(Z)}}convertUIToOperationOptions(t,e){const r=e===90||e===270;const o=r?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);const n=r?O.fromSize(this.maxCropMaskSize).swapped:O.fromSize(this.maxCropMaskSize);const s=Math.cos(-t);const a=Math.sin(-t);const l=this.calculateScale(t,r);const{leftTop:c,rightBottom:u}=this.getStartEndForOperation(e);const m=new O(c).divide(n);const p=new O(u).divide(n);const h=p.subtract(m).divide(2);const g=m.add(h).multiply(o);const x=g.subtract(o.multiply(.5));const v=new O(x.x*s-x.y*a,x.x*a+x.y*s).divide(l);const b=o.multiply(.5).add(v);const T=b.divide(o);const k=T.subtract(h.divide(l));const E=T.add(h.divide(l));return{start:k,end:E}}calculateScale(t,e=false){const r=e?O.fromSize(this.defaultImageSize).swapped:O.fromSize(this.defaultImageSize);const o=new O(Math.abs(r.x*Math.cos(t))+Math.abs(r.y*Math.sin(t)),Math.abs(r.x*Math.sin(t))+Math.abs(r.y*Math.cos(t)));const n=r.subtract(o.clone()).divide(2).abs;return n.y>n.x?n.y*2/r.y+1:n.x*2/r.x+1}updateStateFromSerialization(t){this.transformStore.resetRotation();this.transformStore.resetOutputRotation();this.transformStore.resetFlip();this.setDefaultAngle(0);if(this.editor.outputContainer.getRotation()!==0){this.engineMediator.output.applyNewImageTransform()}this.engineMediator.output.container.setData({flipHorizontally:false,flipVertically:false});this.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.setCropDefaults();this.applyInitialCrop();const e=Math.round(xb(t.rotation));this.transformStore.setRotation(e>180?e-360:e);this.transformations.rotateOutputContainer(Gl(uS(t.outputRotation||0)));if(t.identifier){this.transformStore.changeIdentifier(t.identifier)}if(t.start&&t.end){if(t.end.x===0||t.end.y===0){t.end.x=1;t.end.y=1}const{start:r,end:o}=this.convertOperationOptionsToUI({start:new O(t.start),end:new O(t.end),rotation:t.rotation,outputRotation:t.outputRotation});this.changePositionX(r.x);this.changePositionY(r.y);const n=o.x-r.x;const s=o.y-r.y;this.transformStore.changeSize({width:n,height:s});const{maxCropMaskSize:a,imageSize:l}=this.defaults;const c={height:s*l.height/a.height,width:n*l.width/a.width};this.changeLocalOutputSize(c)}if(t.flipHorizontally){this.flipHorizontally(false)}if(t.flipVertically){this.flipVertically(false)}this.editor.overlayToolStore.correctOverlayFlip()}setDefaultAngle(t){this.defaultAngle=t}updateCanvasControls(t){const e=ct(this.cropMaskPosition);const r=ct(this.cropMaskSize);const o=ct(this.defaults.maxCropMaskSize);this.changeCropAndOutputSize({height:o.height*r.height/t.height,width:o.width*r.width/t.width},void 0,false);this.changePosition({y:o.height*e.y/t.height,x:o.width*e.x/t.width})}onLeave(){this.transformations.onLeave()}onEnter(){this.transformations.onEnter();this.transformHistory.init()}saveTransforms(){this.transformations.saveTransforms()}saveTransformsBasedOnFlip(){this.transformations.saveTransformsBasedOnFlip()}setRotation(t){this.transformStore.setRotation(t);this.transformRender()}async rotateOutputContainer(t,e=true){this.setDragMode(true);this.transformations.rotateOutputContainer(t,e);await this.editor.wait();this.setDragMode(false)}applyInitialCrop(){const{identifier:t}=this.getMatchingItem();this.changeIdentifier(t,false)}clickableCanvas(t){this.editor.clickableCanvas(t)}proportionalSize(t,e,r=this.defaults.maxCropMaskSize,o=this.minCropSize){let n=e.height*t;let{height:s}=e;if(n>r.width||n1){return{width:this.minCropSize*t,height:this.minCropSize}}return{width:this.minCropSize,height:this.minCropSize*t}}get defaultCropMaskPosition(){return this.defaults.cropMaskPosition}get defaultScale(){return this.defaults.scale}get engineMediator(){return this.editor.engineMediator}getRatio(){const t=this.getTransform(this.identifier);if(t){if(Object.prototype.hasOwnProperty.call(t,"ratio")){if(this.lockResolution){return this.localOutputWidth/this.localOutputHeight}return t.ratio}const{x:e,y:r}=t.dimensions;return e/r}return"*"}};tt=mu;f([Q],tt.prototype,"selectedCategory",2);f([Q],tt.prototype,"defaults",2);f([Q],tt.prototype,"localOutputSize",2);f([C],tt.prototype,"changeIdentifier",1);f([C],tt.prototype,"setDragMode",1);f([C],tt.prototype,"setCropDefaults",1);f([C],tt.prototype,"setDefaultImageSize",1);f([C],tt.prototype,"setMaxCropSize",1);f([C],tt.prototype,"setDefaultCropPosition",1);f([C],tt.prototype,"resetCrop",1);f([C],tt.prototype,"toggleCategorySelection",1);f([C],tt.prototype,"pureReset",1);f([C],tt.prototype,"reset",2);f([C],tt.prototype,"changePosition",1);f([C],tt.prototype,"changePositionX",1);f([C],tt.prototype,"changePositionY",1);f([C],tt.prototype,"changeCropAndOutputSize",1);f([C],tt.prototype,"onLeave",1);f([C],tt.prototype,"onEnter",1);f([C],tt.prototype,"changeLocalOutputSize",2);f([C],tt.prototype,"changeDefaultScale",2);f([C],tt.prototype,"changeLocalOutputHeight",2);f([C],tt.prototype,"changeLocalOutputWidth",2);f([C],tt.prototype,"changeLockResolution",2);f([C],tt.prototype,"setRotation",1);f([C],tt.prototype,"rotateClockwise",2);f([C],tt.prototype,"rotateAntiClockwise",2);f([C],tt.prototype,"rotateOutputContainer",1);f([C],tt.prototype,"flipHorizontally",2);f([C],tt.prototype,"flipVertically",2);f([C],tt.prototype,"applyDefaultCrop",2);f([C],tt.prototype,"applyInitialCrop",1);f([C],tt.prototype,"updateCropMask",2);f([C],tt.prototype,"clickableCanvas",1);f([C],tt.prototype,"onLeftTop",2);f([C],tt.prototype,"onLeftBottom",2);f([C],tt.prototype,"onRightTop",2);f([C],tt.prototype,"onRightBottom",2);f([C],tt.prototype,"proportionalSize",1);f([C],tt.prototype,"onPixelWidth",2);f([C],tt.prototype,"onPixelHeight",2);f([C],tt.prototype,"updateInitialCropMaskPosition",1);f([C],tt.prototype,"updatePreviewSizeWRTImageSize",1);f([C],tt.prototype,"dispose",2);f([S],tt.prototype,"cropState",1);f([S],tt.prototype,"identifier",1);f([S],tt.prototype,"ratio",1);f([S],tt.prototype,"height",1);f([S],tt.prototype,"width",1);f([S],tt.prototype,"localOutputImageSize",1);f([S],tt.prototype,"localOutputHeight",1);f([S],tt.prototype,"localOutputWidth",1);f([S],tt.prototype,"lockResolution",1);f([S],tt.prototype,"forceDimensions",1);f([S],tt.prototype,"rotationInDegrees",1);f([S],tt.prototype,"outputRotation",1);f([S],tt.prototype,"isDragMode",1);f([S],tt.prototype,"rotateFlipState",1);f([S],tt.prototype,"selectedCategoryIdentifier",1);f([S],tt.prototype,"categories",1);f([S],tt.prototype,"items",1);f([S],tt.prototype,"config",1);f([S],tt.prototype,"locale",1);f([S],tt.prototype,"isOptionSelected",1);f([S],tt.prototype,"leftTop",1);f([S],tt.prototype,"leftBottom",1);f([S],tt.prototype,"rightTop",1);f([S],tt.prototype,"rightBottom",1);f([S],tt.prototype,"isFlippedHorizontal",1);f([S],tt.prototype,"isFlippedVertical",1);f([S],tt.prototype,"leftTopRespectFlip",1);f([S],tt.prototype,"leftBottomRespectFlip",1);f([S],tt.prototype,"rightTopRespectFlip",1);f([S],tt.prototype,"rightBottomRespectFlip",1);f([S],tt.prototype,"cropMaskPosition",1);f([S],tt.prototype,"cropMaskSize",1);f([S],tt.prototype,"state",1);f([S],tt.prototype,"defaultImageSize",1);f([S],tt.prototype,"maxCropMaskSize",1);f([S],tt.prototype,"minCropMaskSize",1);f([S],tt.prototype,"defaultCropMaskPosition",1);f([S],tt.prototype,"defaultScale",1)});var ZH=d(()=>{Dk();Qk()});var QH,oct,tI,nct,ef,nt;var eI=d(()=>{Tt();QH=y(Ju());R();U();Zi();qk();hm();fk();bk();xk();wk();oct={};tI="none";nct={position:{x:0,y:0},rotation:0};ef=class{constructor(t){this.state=Q.map(oct);this.selectedId=Q.box(tI);this.editMode=Q.box(false);this.dragMode=Q.box(false);this.minLength=0;this.counter=0;this.addSticker=async(t,e=true)=>{await this.addStickerAsync(t,e)};this.addStickerAsync=async({spriteId:t,state:e,transform:r},o=true)=>{return new Promise((n,s)=>{r=this.getInitialTransform(r);const{identifier:a}=e;const l=this.editor.orderHelper.addSprite(a);this.editor.engine.addStickerFromAssets(a,this.editor.engineMediator.image.container,l).then(async c=>{if(t){c.setData({id:t})}const u=c.getID();this.container[u]=c;this.editor.orderHelper.renameSprite(a,u);const m=this.getSize(u);m.width*=c.getScale().x;m.height*=c.getScale().y;c.setPivot(.5,.5);let p;if(r.scale){p=r.scale}else if(r.size){p={x:r.size.width/m.width,y:r.size.height/m.height}}else{const v=this.editor.shortestOutputSide*.4;const b=ef.magnitude(v)/ef.sizeMagnitude(c.getSizeInWorldSpace());p={x:b,y:b}}const{flipHorizontally:h,flipVertically:g}=this.editor.outputContainer.getData();c.setFlipHorizontally(h);c.setFlipVertically(g);c.setTransform({position:r.position,scale:p,rotation:r.rotation});if(e.flipHorizontally!==void 0){c.setFlipHorizontally(e.flipHorizontally!==h)}if(e.flipVertically!==void 0){c.setFlipVertically(e.flipVertically!==g)}this.setContainerProperties(u,{...e});const x=c.getData();this.setInitialSpriteState(u,"sticker");this.stickerToolStore.setState(u,{...x,identifier:a});await this.editor.renderPromise();if(o){this.setId(u);this.addSnapshot("add",this.stickerLocale.add)}n()}).catch(c=>{console.error(c);s()})})};this.addText=async(t,e=true)=>{await this.addTextAsync(t,e)};this.addTextAsync=({spriteId:t,state:e,transform:r},o=true)=>{return new Promise((n,s)=>{r=this.getInitialTransform(r);const a=this.editor.orderHelper.addSprite(e.identifier);const l=this.editor.shortestOutputSide;const c={fontIdentifier:e.identifier,text:e.text,width:e.width||l*.6,fontSize:e.fontSize||l*.1,lineHeight:e.lineHeight,alignment:e.alignment,textColor:e.textColor,backgroundColor:e.backgroundColor};this.editor.engine.addTextWithFontLoading(c,this.editor.engineMediator.image.container,a).then(async u=>{if(t){u.setData({id:t})}const m=u.getID();this.container[m]=u;this.editor.orderHelper.renameSprite(e.identifier,m);const{flipHorizontally:p,flipVertically:h}=this.editor.outputContainer.getData();u.setFlipHorizontally(p);u.setFlipVertically(h);u.setPivot(.5,.5);u.setPosition(r.position);u.setRotation(r.rotation);this.setInitialSpriteState(m,"text");const g=u.getData();this.textToolStore.setState(m,{...g});await this.editor.renderPromise();if(o){this.setId(m);this.addSnapshot("add",this.textLocale.add)}n()}).catch(u=>{console.error(u);s()})})};this.addTextDesign=async(t,e=true,r=false)=>{try{await this.addTextDesignAsync(t,e,r)}catch(o){console.warn(o)}};this.addTextDesignAsync=({spriteId:t,state:e,transform:r},o=true,n=false)=>{return new Promise((s,a)=>{r=this.getInitialTransform(r);const l=this.editor.orderHelper.addSprite(e.identifier);const c=this.editor.shortestOutputSide;const u={width:e.width||c*.6,text:e.text,color:e.color,inverted:e.isInverted,seed:e.seed,padding:e.padding};this.editor.engine.addTextDesignAsync(e.identifier,u,this.editor.engineMediator.image.container,l).then(async m=>{if(t){if(n){this.pureRemoveSprite(t);this.textDesignToolStore.state.delete(t)}m.setData({id:t})}const p=m.getID();this.container[p]=m;this.editor.orderHelper.renameSprite(e.identifier,p);const{flipHorizontally:h,flipVertically:g}=this.editor.outputContainer.getData();m.setFlipHorizontally(h);m.setFlipVertically(g);m.setPivot(.5,.5);m.setPosition(r.position);m.setRotation(r.rotation);this.setInitialSpriteState(p,"textdesign");const x=m.getData();this.textDesignToolStore.setState(p,{...x,identifier:e.identifier});await this.editor.renderPromise();if(o){this.setId(p);this.addSnapshot("add",this.textDesignLocale.add)}s()}).catch(m=>{a(m)})})};this.spriteLocalTransform=()=>{return{position:this.editor.previewToOutput(this.position),size:this.size,rotation:this.rotation}};this.clickableCanvas=t=>{this.editor.clickableCanvas(t)};this.setContainerProperties=(t,e,r=false)=>{this.container[t].setData(e);if(r){this.updatePositionAndSize()}this.editor.render()};this.setContainerPosition=(t,e)=>{this.container[t].setPosition(e)};this.pureRemoveSprite=t=>{this.editor.engine.removeContainer(this.container[t]);const e=this.container[t].getIndexInParent();if(e===-1){delete this.container[t];this.state.delete(t);this.editor.orderHelper.removeSprite(t);return true}return false};this.deleteSprite=(t=this.id)=>{const e=this.state.get(t);if(e.tool==="sticker"){this.stickerToolStore.delete()}else if(e.tool==="text"){this.textToolStore.delete()}else if(e.tool==="textdesign"){this.textDesignToolStore.delete()}};this.removeSprite=t=>{const e=this.pureRemoveSprite(t);if(e){this.selectLast();this.spriteSnapshot("delete");this.editor.render()}};this.addSnapshot=(t,e)=>{this.editor.addSnapshot(void 0,t,e)};this.spriteSnapshot=t=>{this.addSnapshot("edit",this.historyLocale[t])};this.addNewText=async(t,e)=>{if(this.textToolStore.doesTextAssetExist(e.identifier)){await this.addTextAsync({...t,state:e},false)}else{throw new Do(e.identifier)}};this.addNewTextDesign=async(t,e)=>{if(this.textDesignToolStore.doesTextDesignAssetExist(e.identifier)){await this.addTextDesignAsync({...t,state:e},false)}else{throw new Do(e.identifier)}};this.addNewSticker=async(t,e)=>{if(this.stickerToolStore.doesStickerAssetExist(e.identifier)){await this.addStickerAsync({...t,state:e},false)}else{throw new Do(e.identifier)}};this.getSpriteHistoryState=()=>{const t=ct(this.textToolStore.state);const e=ct(this.textDesignToolStore.state);const r={common:ct(this.state),["sticker"]:ct(this.stickerToolStore.state),["text"]:t,["textdesign"]:e,spriteIdList:Object.keys(this.container)};Object.keys(r.common).forEach(o=>{r.common[o].size=this.container[o].getSizeInWorldSpace();r.common[o].position=this.container[o].getPosition();r.common[o].order=this.container[o].getIndexInParent()});return r};this.updateStateFromSerialization=async(t,e,r)=>{if(e&&e.length){try{const o=await Promise.all(e.map(async({svg:n,raster:s,name:a,identifier:l})=>{const c=(n==null?void 0:n.data)?"image/svg+xml":s.type;const u=`data:${c};base64,${(n==null?void 0:n.data)||s.data}`;const m=await sv(u,150);return{stickerURI:u,thumbnailURI:m,name:a,type:c,identifier:l}}));await this.stickerToolStore.addCustomStickerAsset(o)}catch(o){this.editor.modalStore.hideModal();this.editor.modalStore.showInfoModal("stickerLoading")}}if(t.text){await this.textToolStore.loadFonts()}if(t.textdesign){await this.textDesignToolStore.loadFonts()}await this.updateStateByHistoryState(t.spriteIdList,t,r)};this.updateStateFromHistory=async t=>{const e=Object.keys(this.container);const r=e.filter(o=>t.spriteIdList.indexOf(o)===-1);r.forEach(o=>{this.pureRemoveSprite(o)});await this.updateStateByHistoryState(t.spriteIdList,t,0)};this.serializableState=async()=>{const t=this.editor.spriteStore.getSpriteHistoryState();Object.keys(t.common).forEach(r=>{const{flipHorizontally:o,flipVertically:n}=this.editor.outputContainer.getData();const s=this.editor.outputContainer.getRotation();const a=n!==o?-t.common[r].rotation:t.common[r].rotation;t.common[r].rotation=n!==o?a+s:a-s});const e=await Promise.all(this.editor.spriteStore.stickerToolStore.customStickers.map(async({identifier:r,type:o,stickerURI:n,name:s})=>{const a={identifier:r,name:s,raster:{data:"",type:"image/jpeg"}};if(o==="image/svg+xml"){a.svg={data:n.split(",")[1]}}if(o==="image/jpeg"||o==="image/png"||o==="image/gif"){[,a.raster.data]=n.split(",");a.raster.type=o}else{const l=await sv(n);[,a.raster.data]=l.split(",");a.raster.type="image/png"}return a}));return{sprite:t,customStickers:e}};this.updateCanvasControls=()=>{Object.keys(this.container).forEach(t=>{this.updatePositionAndSize(t,true);const e=this.state.get(t);if(e){if(e.tool==="text"){const r=this.getContainerProperties(t);this.textToolStore.changeSize(t,r)}else if(e.tool==="textdesign"){const r=this.getContainerProperties(t);this.textToolStore.changeWidth(r.width)}}})};this.setEditMode=t=>{if(this.currentSprite){if(["text","textdesign"].indexOf(this.tool)!==-1){if(t){this.editor.modalStore.showTextEditModal()}else{this.editor.modalStore.hideModal()}this.editMode.set(t)}}};this.setDragMode=t=>{this.dragMode.set(t)};this.setPosition=t=>{const e=this.currentSprite;const r=this.container[this.id];if(e&&r){r.setPosition(this.editor.previewToWorld(t));const{position:o}=this.getSizePositionFromContainer();e.position.x=o.x;e.position.y=o.y;this.state.set(this.id,e);this.editor.render()}};this.setSize=t=>{const e=this.currentSprite;if(e){e.size.width=t.width;e.size.height=t.height;this.state.set(this.id,e)}};this.setRotation=t=>{const e=this.currentSprite;if(e){const{flipHorizontally:r,flipVertically:o}=this.editor.outputContainer.getData();const n=this.editor.outputContainer.getRotation();const s=$h({rotation:t,outputRotation:n,flipHorizontally:r,flipVertically:o});this.container[this.id].setRotation(s);e.rotation=this.container[this.id].getRotation();this.state.set(this.id,e);this.editor.render()}};this.onCanvasClick=t=>{if(!this.isEditMode){this.selectHighestOrderSprite(t)}};this.select=t=>{const e=this.state.get(t);if(e){const r=this.editor.activeStore.tool;if(r!==e.tool){this.editor.activeStore.selectTool(e.tool)}this.setId(t)}};this.selectLast=()=>{const t=this.editor.orderHelper.getLastSpriteId();if(t){this.select(t)}};this.selectNext=()=>{if(this.currentSprite){const t=this.container[this.id];const e=t.getIndexInParent();if(e){const r=Object.keys(this.container).find(o=>this.container[o].getIndexInParent()===e-1);if(r){this.select(r)}}}};this.deselect=()=>{this.setId(tI)};this.bringToFront=async t=>{const e=this.editor.orderHelper.bringToFront(t);this.container[t].setIndexInParent(e);this.spriteSnapshot("order");await this.editor.render();this.counter+=1};this.flipHorizontally=t=>{const e=this.state.get(t);const r=this.container[t];r.setFlipHorizontally(!r.getFlipHorizontally());e.flipHorizontally=r.getFlipHorizontally();this.spriteSnapshot("flip");this.state.set(t,e);this.editor.render()};this.pureReset=()=>{this.deselect();Array.from(this.state.keys()).forEach(t=>{this.pureRemoveSprite(t)});this.stickerToolStore.pureReset();this.textToolStore.pureReset();this.textDesignToolStore.pureReset()};this.selectHighestOrderSprite=t=>{const e=this.editor.brushToolStore.containerId();t=t.filter(n=>n!==e);if(t.length<1){this.deselect();return}let r="";let o=0;t.forEach(n=>{const s=this.container[n];const a=s&&s.getIndexInParent()||0;if(a>=o){o=a;r=n}});this.select(r)};this.onCornerDrag=({x:t,y:e})=>{if(this.currentSprite){const r=new O(this.currentSprite.position);const o=new O(t,e);const n=o.subtract(r).magnitude;const s=this.getSize();const a=n*2/ef.sizeMagnitude(s);if(n>this.minLength){if(this.isSpriteSticker){if(this.stickerToolStore.resizeMode!=="unrestricted"){this.setStickerSize({width:s.width*a,height:s.height*a})}else{const l=this.rotationWRTOutputRotation;const c=o.subtract(r);const u=Math.cos(l);const m=Math.sin(l);const p=Math.max(Math.abs(c.x*u*2+c.y*m*2),this.minLength);const h=Math.max(Math.abs(c.x*-m*2+c.y*u*2),this.minLength);this.setStickerSize({width:p,height:h})}}else if(this.isSpriteText){this.setTextSize(s.width*a)}else if(this.isSpriteTextDesign){this.setTextDesignScale(a)}}this.editor.render()}};this.onWidthDrag=({x:t,y:e})=>{const r=new O(this.currentSprite.position);const o=new O(t,e);const n=o.subtract(r).magnitude;const s=this.editor.previewToWorld(2*n);if(s>this.minLength){this.setContainerProperties(this.id,{width:s},true);if(this.isSpriteText){const a=this.getContainerProperties(this.id);this.textToolStore.changeWidth(a.width)}}};this.onPaddingDrag=({x:t,y:e})=>{if(this.isSpriteTextDesign){let r=this.getContainerProperties(this.id);const o=new O(this.currentSprite.position);const n=new O(t,e);const s=n.subtract(o).magnitude;const a=Math.max(this.editor.previewToWorld(s)-r.width/2,0);this.setContainerProperties(this.id,{padding:a},true);if(this.isSpriteTextDesign){r=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(r.padding)}}};this.correctTextFlip=()=>{const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();Object.values(this.container).forEach(r=>{if(r.type==="text"||r.type==="text-design"){r.setFlipHorizontally(t);r.setFlipVertically(e)}})};this.reverseTextHorizontally=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipHorizontally(t)}})};this.reverseTextVertically=t=>{Object.values(this.container).forEach(e=>{if(e.type==="text"||e.type==="text-design"){e.setFlipVertically(t)}})};this.dispose=()=>{this.state=null;if(this.stickerToolStore){this.stickerToolStore.dispose();this.stickerToolStore=null}if(this.textToolStore){this.textToolStore.dispose();this.textToolStore=null}if(this.textDesignToolStore){this.textDesignToolStore.dispose();this.textDesignToolStore=null}this.selectedId=null;this.editMode=null;this.dragMode=null;this.editor=null;this.rect=null};this.getOutputProperties=()=>{return this.editor.outputContainer.getData()};this.getContainerProperties=t=>{return this.container[t].getData()};this.getContainerTransform=t=>{return this.container[t].getTransform()};this.getDuplicateContainerTransform=t=>{const e=this.container[t].getTransform();const r=this.editor.shortestOutputSide*.1;const o=new O(e.position).add(new O(r,r));return{...e,position:o}};this.getDuplicateContainerFlip=t=>{const e=this.container[t].getFlipHorizontally();const r=this.container[t].getFlipVertically();return{flipHorizontally:e,flipVertically:r}};this.updatePositionAndSize=(t=this.id,e=false)=>{const{position:r,size:o}=this.getSizePositionFromContainer(t);const n=this.state.get(t);if(n){n.position.x=r.x;n.position.y=r.y;n.size.width=o.width;n.size.height=o.height;if(e){const s=this.container[t].getRotation();this.container[t].setRotation(s);n.rotation=this.container[t].getRotation()}this.state.set(t,n)}};this.getInitialTransform=t=>{const e=this.editor.outputToWorld(nct.position);if(!t){const r=this.editor.outputContainer.getRotation();return{rotation:r,position:e}}return{position:e,...t}};this.setInitialSpriteState=(t,e)=>{const r=this.container[t];const{position:o,size:n}=this.getSizePositionFromContainer(t);const s=r.getRotation();const a=e!=="sticker"?false:r.getFlipHorizontally();const l=e!=="sticker"?false:r.getFlipVertically();this.state.set(t,{tool:e,position:o,rotation:s,size:n,flipHorizontally:a,flipVertically:l})};this.setStickerSize=t=>{const e=this.container[this.id];e.setSizeInWorldSpace(this.editor.previewSizeToWorld(t));const r=this.currentSprite;if(r){r.size=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());this.state.set(this.id,r)}};this.setTextSize=t=>{let e=this.getContainerProperties(this.id);const r={width:this.editor.previewToWorld(t)};const o=r.width/e.width;const n={fontSize:Math.round(e.fontSize*o)};const s=this.isSpriteText?{...r,...n}:r;if(r.width>this.minLength&&n.fontSize){this.setContainerProperties(this.id,s,true);e=this.getContainerProperties(this.id);this.textToolStore.changeFontSize(e.fontSize,true);this.textToolStore.changeWidth(e.width)}};this.setTextDesignScale=t=>{let e=this.getContainerProperties(this.id);const r=e.width*t;if(r>this.minLength){this.setContainerProperties(this.id,{width:r},true);const{width:o}=this.getContainerProperties(this.id);this.textDesignToolStore.changeWidth(o);e=this.getContainerProperties(this.id);this.textDesignToolStore.changePadding(e.padding)}};this.getSizePositionFromContainer=(t=this.id)=>{const e=this.container[t];if(e){const r=this.editor.worldToPreview(e.getPosition());const o=this.editor.worldSizeToPreview(e.getSizeInWorldSpace());return{position:r,size:o}}return{position:{x:0,y:0},size:{height:1,width:1}}};this.getSize=(t=this.id)=>{const e=this.container[t];if(e){return this.editor.worldSizeToPreview(e.getSizeInWorldSpace())}return{width:0,height:0}};this.editor=t;this.container={};this.stickerToolStore=new Pt(t);this.textToolStore=new gt(t);this.textDesignToolStore=new Mt(t);this.rect=new ze(this.editor,this);this.minLength=this.editor.configStore.measurements.canvasControls.sprite.minSize/Math.sqrt(2)}static magnitude(t,e){return new O(t,e||t).magnitude}static sizeMagnitude(t){return Math.sqrt(t.width*t.width+t.height*t.height)}async updateStateByHistoryState(t,e,r){await(0,QH.default)(t,async o=>{const n=e.common[o];if(!n)return;if(this.state.get(o)){this.updateExistingItem(o,e)}else{await this.addNewItem(o,e)}});t.forEach(o=>{const n=e.common[o];const s=this.container[o];if(!n||!s)return;s.setIndexInParent(n.order+r)});this.counter+=1}async addNewItem(t,e){const r=e.common[t];const o=r.size?{width:this.editor.worldToPreview(r.size.width),height:this.editor.worldToPreview(r.size.height)}:void 0;const{flipHorizontally:n,flipVertically:s}=this.editor.outputContainer.getData();const a=this.editor.outputContainer.getRotation();const l=s!==n?r.rotation-a:r.rotation+a;const c=s!==n?-l:l;const u={spriteId:t,transform:{size:o,position:new O(r.position),rotation:c}};if(e.text[t]){const m=e.text[t];const p=this.textToolStore.validFontWithConfig(m.identifier);m.identifier=p==null?void 0:p.identifier;await this.addNewText(u,m);return}if(e.textdesign[t]){await this.addNewTextDesign(u,e.textdesign[t]);return}if(e.sticker[t]){const m=this.stickerToolStore.items.find(p=>p.identifier===e.sticker[t].identifier);await this.addNewSticker(u,{...e.sticker[t],flipHorizontally:r.flipHorizontally,flipVertically:r.flipVertically,resizeMode:e.sticker[t].resizeMode||(m==null?void 0:m.resizeMode)||"keepAspect"})}}updateExistingItem(t,e){const r=e.common[t];const o=this.state.get(t);this.state.set(t,o);const n=this.container[t];n.setPosition(new O(r.position));n.setRotation(r.rotation);o.rotation=n.getRotation();if(r.flipHorizontally!==void 0){n.setFlipHorizontally(r.flipHorizontally)}if(r.flipVertically!==void 0){n.setFlipVertically(r.flipVertically)}if(e.text[t]){const s=e.text[t];this.textToolStore.updateStateFromHistory(t,{...s,fontIdentifier:s.identifier})}if(e.textdesign[t]){const s=e.textdesign[t];this.textDesignToolStore.updateStateFromHistory(t,{...s,inverted:s.isInverted})}if(e.sticker[t]){n.setSizeInWorldSpace(r.size);this.stickerToolStore.updateStateFromHistory(t,e.sticker[t])}this.updatePositionAndSize(t)}get currentSprite(){if(this.isSpriteSelected){return this.state.get(this.id)}return void 0}get padding(){return this.textDesignToolStore.padding}get isEditMode(){return this.editMode.get()}get isDragMode(){return this.dragMode.get()}get id(){return this.selectedId.get()}get isSpriteSelected(){return this.id!==tI}get position(){if(this.currentSprite){return this.currentSprite.position}return void 0}get tool(){if(this.currentSprite){return this.currentSprite.tool}return void 0}get size(){if(this.currentSprite){return this.currentSprite.size}return void 0}get rotation(){if(this.currentSprite){return this.currentSprite.rotation}return void 0}get rotationWRTOutputRotation(){if(this.currentSprite){const{flipHorizontally:t,flipVertically:e}=this.editor.outputContainer.getData();const r=this.editor.outputContainer.getRotation();return $h({rotation:this.currentSprite.rotation-r,flipHorizontally:t,flipVertically:e})}return void 0}get flipHorizontal(){if(this.currentSprite){return this.currentSprite.flipHorizontally}return void 0}get isSpriteSticker(){return this.tool==="sticker"}get isSpriteText(){return this.tool==="text"}get isSpriteTextDesign(){return this.tool==="textdesign"}get isOnTop(){const t=this.counter;return this.editor.engine.isSpriteTop(this.id)}get spritePosition(){if(this.currentSprite){const{x:t,y:e}=this.currentSprite.position;const{height:r,width:o}=this.currentSprite.size;return{x:Math.round(t-o/2),y:Math.round(e-r/2)}}return void 0}get currentRect(){if(this.currentSprite){return this.rect}return void 0}get leftTopPosition(){if(this.currentSprite){return this.rect.leftTop}return void 0}get leftBottomPosition(){if(this.currentSprite){return this.rect.leftBottom}return void 0}get leftMidPosition(){if(this.currentSprite){return this.rect.leftMid}return void 0}get leftMidPadPosition(){if(this.currentSprite){const{leftMid:t}=this.rect;return{x:t.x-this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get rightTopPosition(){if(this.currentSprite){return this.rect.rightTop}return void 0}get rightBottomPosition(){if(this.currentSprite){return this.rect.rightBottom}return void 0}get rightMidPosition(){if(this.currentSprite){return this.rect.rightMid}return void 0}get rightMidPadPosition(){if(this.currentSprite){const{rightMid:t}=this.rect;return{x:t.x+this.editor.worldToPreview(this.padding),y:t.y}}return void 0}get leftBottomHandlePosition(){if(this.currentSprite){return this.rect.leftBottomHandle}return void 0}get rightBottomHandlePosition(){if(this.currentSprite){return this.rect.rightBottomHandle}return void 0}get historyLocale(){if(this.isSpriteSticker){return this.stickerLocale}if(this.isSpriteText){return this.textDesignLocale}return this.textLocale}get stickerLocale(){return this.editor.configStore.locale["sticker"].history}get textLocale(){return this.editor.configStore.locale["text"].history}get textDesignLocale(){return this.editor.configStore.locale["textdesign"].history}setId(t){this.selectedId.set(t)}};nt=ef;f([Q],nt.prototype,"counter",2);f([C],nt.prototype,"addSticker",2);f([C],nt.prototype,"addStickerAsync",2);f([C],nt.prototype,"addText",2);f([C],nt.prototype,"addTextAsync",2);f([C],nt.prototype,"addTextDesign",2);f([C],nt.prototype,"addTextDesignAsync",2);f([C],nt.prototype,"clickableCanvas",2);f([C],nt.prototype,"setContainerProperties",2);f([C],nt.prototype,"setContainerPosition",2);f([C],nt.prototype,"pureRemoveSprite",2);f([C],nt.prototype,"deleteSprite",2);f([C],nt.prototype,"removeSprite",2);f([C],nt.prototype,"addSnapshot",2);f([C],nt.prototype,"addNewText",2);f([C],nt.prototype,"addNewTextDesign",2);f([C],nt.prototype,"addNewSticker",2);f([C],nt.prototype,"updateStateFromSerialization",2);f([C],nt.prototype,"updateStateFromHistory",2);f([C],nt.prototype,"updateCanvasControls",2);f([C],nt.prototype,"setEditMode",2);f([C],nt.prototype,"setDragMode",2);f([C],nt.prototype,"setPosition",2);f([C],nt.prototype,"setSize",2);f([C],nt.prototype,"setRotation",2);f([C],nt.prototype,"onCanvasClick",2);f([C],nt.prototype,"select",2);f([C],nt.prototype,"selectLast",2);f([C],nt.prototype,"selectNext",2);f([C],nt.prototype,"deselect",2);f([C],nt.prototype,"bringToFront",2);f([C],nt.prototype,"flipHorizontally",2);f([C],nt.prototype,"pureReset",2);f([C],nt.prototype,"onCornerDrag",2);f([C],nt.prototype,"onWidthDrag",2);f([C],nt.prototype,"onPaddingDrag",2);f([C],nt.prototype,"correctTextFlip",2);f([C],nt.prototype,"reverseTextHorizontally",2);f([C],nt.prototype,"reverseTextVertically",2);f([C],nt.prototype,"dispose",2);f([S],nt.prototype,"currentSprite",1);f([S],nt.prototype,"padding",1);f([S],nt.prototype,"isEditMode",1);f([S],nt.prototype,"isDragMode",1);f([S],nt.prototype,"id",1);f([S],nt.prototype,"isSpriteSelected",1);f([S],nt.prototype,"position",1);f([S],nt.prototype,"tool",1);f([S],nt.prototype,"size",1);f([S],nt.prototype,"rotation",1);f([S],nt.prototype,"rotationWRTOutputRotation",1);f([S],nt.prototype,"flipHorizontal",1);f([S],nt.prototype,"isSpriteSticker",1);f([S],nt.prototype,"isSpriteText",1);f([S],nt.prototype,"isSpriteTextDesign",1);f([S],nt.prototype,"isOnTop",1);f([S],nt.prototype,"spritePosition",1);f([S],nt.prototype,"currentRect",1);f([S],nt.prototype,"leftTopPosition",1);f([S],nt.prototype,"leftBottomPosition",1);f([S],nt.prototype,"leftMidPosition",1);f([S],nt.prototype,"leftMidPadPosition",1);f([S],nt.prototype,"rightTopPosition",1);f([S],nt.prototype,"rightBottomPosition",1);f([S],nt.prototype,"rightMidPosition",1);f([S],nt.prototype,"rightMidPadPosition",1);f([S],nt.prototype,"leftBottomHandlePosition",1);f([S],nt.prototype,"rightBottomHandlePosition",1);f([S],nt.prototype,"historyLocale",1);f([S],nt.prototype,"stickerLocale",1);f([S],nt.prototype,"textLocale",1);f([S],nt.prototype,"textDesignLocale",1)});var tW=d(()=>{eI()});var sct,fr;var iI=d(()=>{Tt();R();sct={categories:[],query:""};fr=class{constructor(t){this.initProvider=t=>{if(t){this.libraryProvider=new t}};this.fetchImages=async(t="")=>{if(this.libraryProvider){let e=null;try{const r=await this.libraryProvider.getCategories();const o=await this.libraryProvider.searchImages(t);e=r.map((n,s)=>{const a=o.filter(l=>l.category===n.name);return{identifier:n.name,name:n.name,thumbnailURI:n.coverImageUrl,items:a.map(l=>({name:l.title||`image${s}`,identifier:`${n.name}-${l.title}-${s}`,thumbnailURI:l.thumbUrl,rawUrl:l.rawUrl,authorName:l.authorName,authorAvatar:l.authorAvatar}))}}).filter(n=>n.items.length)}catch(r){console.log(r)}Ve(()=>{this.state.query=t;this.state.categories=e})}};this.toggleCategorySelection=t=>{this.selectedCategory=this.selectedCategory!==t?t:""};this.dispose=()=>{this.state=null;this.configStore=null;this.libraryProvider=null;this.selectedCategory=null};this.getRawUrl=t=>{const e=this.items.findIndex(r=>r.identifier===t);if(e!==-1){return this.items[e].rawUrl}return t};this.configStore=t.configStore;this.state=Q(sct);this.selectedCategory=""}get selectedCategoryIdentifier(){return this.selectedCategory}get categories(){return this.state.categories}get items(){return this.state.categories.map(t=>t.items).reduce((t,e)=>[...t,...e],[])}get query(){return this.state.query}get config(){return this.configStore.config["library"]}get locale(){return this.configStore.locale["library"]}};f([Q],fr.prototype,"selectedCategory",2);f([C],fr.prototype,"initProvider",2);f([C],fr.prototype,"fetchImages",2);f([C],fr.prototype,"toggleCategorySelection",2);f([C],fr.prototype,"dispose",2);f([S],fr.prototype,"selectedCategoryIdentifier",1);f([S],fr.prototype,"categories",1);f([S],fr.prototype,"items",1);f([S],fr.prototype,"query",1);f([S],fr.prototype,"config",1);f([S],fr.prototype,"locale",1)});var eW=d(()=>{iI()});var iW,Ri;var rW=d(()=>{R();zn();U();iW=(i="image/png")=>`data:${i};base64,`;Ri=class{constructor(t){this.version="3.12.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=t=>{const e=at.relativeToAbsolutePoint(t,this.cropSpace,false);return at.pointFromSpaceToSpace(e,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=t=>{return t*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=t=>{return t*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=t}static deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier}}static deserializeAdjustments(t){return{...t}}static deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,e=>e.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(t){if(t){if(t.rgba){return t.rgba}}return[0,0,0,0]}validateVersion(t){return this.version===t}static checkIfPlatformHTML(t){return t==="html5"}static deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:Ri.deserialzeColor(t.tintColor)}}checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(t){const e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(iW(),""):""};e.image.data=e.image.data?iW()+e.image.data:""}return e}deserializeTransformation(t){const e={};const r=t.operations.find(s=>s.type==="orientation");const o=t.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=Ri.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:""}return e}deserialize(t){var n,s;const e={};if(t.meta?!Ri.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform")}const r=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(a=>{switch(a.type){case"filter":e.filter=Ri.deserializeFilter(a.options);break;case"adjustments":e.adjustment=Ri.deserializeAdjustments(a.options);break;case"focus":e.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(c=>{switch(c.type){case"frame":e.frame=this.deserializeFrame(c.options);break;case"overlay":e.overlay=Ri.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=this.deserializeBrush(c.options)}else{e.brush.strokes.push(...this.deserializeBrush(c.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const u=At();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};this.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=Ri.deserializeStickers(c.options)}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=this.deserializeTexts(c.options)}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=this.deserializeTextDesign(c.options)}break;default:break}});break;default:break}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return e}deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:Ri.deserialzeColor(t.tintColor)}}deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:break}return void 0}deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeMirroredFocus(t){const e=new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new O(this.mapRelativeCropPointToImageSpace(t.start)).add(new O(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeTexts(t){return{identifier:hn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:Ri.deserialzeColor(t.color),backgroundColor:Ri.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text}}deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:Ri.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted}}deserializeBrush(t){return{strokes:t.paths.map(e=>{return{path:{controlPoints:e.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:Ri.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}}})}}}});var oW,Ai;var nW=d(()=>{R();zn();U();oW=(i="image/png")=>`data:${i};base64,`;Ai=class{constructor(t){this.version="3.9.0";this.spriteOrder=0;this.mapRelativeCropPointToImageSpace=t=>{const e=at.relativeToAbsolutePoint(t,this.cropSpace,false);return at.pointFromSpaceToSpace(e,this.cropSpace,this.imageSpace,false)};this.mapRelativeCropSizeToScaledImageSize=t=>{return t*Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.mapRelativeCropSizeToUnscaledImageSize=t=>{return t*Math.min(this.outputSize.height,this.outputSize.width)};this.editor=t}static deserializeFilter(t){return{intensity:t.intensity,identifier:t.identifier}}static deserializeAdjustments(t){return{...t}}static deserializeOverlay(t){return{identifier:t.identifier,opacity:t.intensity,blendMode:t.blendMode.replace(/([ _][a-z])/g,e=>e.toUpperCase().replace(" ","").replace("_",""))}}static initializeEmptyTransform(){return{outputRotation:0,flipHorizontally:false,flipVertically:false,start:{x:0,y:0},end:{x:1,y:1},rotation:0}}static deserialzeColor(t){if(t){if(t.rgba){return t.rgba}}return[0,0,0,0]}validateVersion(t){return this.version===t}static checkIfPlatformHTML(t){return t==="html5"}static deserializeStickers(t){return{identifier:t.identifier,opacity:t.alpha||0,tintMode:t.tintMode||"none",tintColor:Ai.deserialzeColor(t.tintColor)}}checkIsSerialisationValid(t){if(typeof t!=="string"&&this.validateVersion(t.version))return true;if(typeof t==="string"){throw new Error("Invalid input of type string, please provide an object")}return false}deserializeImage(t){const e={};if(t.image){e.image={width:t.image.width,height:t.image.height,data:t.image.data?t.image.data.replace(oW(),""):""};e.image.data=e.image.data?oW()+e.image.data:""}return e}deserializeTransformation(t){const e={};const r=t.operations.find(s=>s.type==="orientation");const o=t.operations.find(s=>s.type==="transform");const[n]=this.editor.engine.getRootContainers();this.previewPosition=this.editor.transformToolStore.defaultCropMaskPosition;this.previewSize=this.editor.transformToolStore.maxCropMaskSize;this.imageSpace=n;e.transform=Ai.initializeEmptyTransform();if(r!=null){e.transform.outputRotation=r.options.rotation;e.transform.flipHorizontally=r.options.flipHorizontally||false;e.transform.flipVertically=r.options.flipVertically||false}if(o){e.transform.start=o.options.start;e.transform.end=o.options.end;e.transform.rotation=o.options.rotation||0;e.transform.identifier=o.options.meta?o.options.meta.identifier:""}return e}deserialize(t){var n,s;const e={};if(t.meta?!Ai.checkIfPlatformHTML(t.meta.platform):false){console.warn("Read serialisation from another Platform")}const r=this.editor.engineMediator.output.container.getResolution();const{size:o}=this.editor.engineMediator.image.container.getBounds();this.outputSize=r;this.imageSize=o;this.cropSpace=this.editor.engine.getOutputContainer();this.outputScale=this.cropSpace.getScale();t.operations.forEach(a=>{switch(a.type){case"filter":e.filter=Ai.deserializeFilter(a.options);break;case"adjustments":e.adjustment=Ai.deserializeAdjustments(a.options);break;case"focus":e.focus=this.deserializeFocus(a.options);break;case"sprite":const{sprites:l}=a.options;l.forEach(c=>{switch(c.type){case"frame":e.frame=this.deserializeFrame(c.options);break;case"overlay":e.overlay=Ai.deserializeOverlay(c.options);break;case"brush":if(!e.brush){e.brush=this.deserializeBrush(c.options)}else{e.brush.strokes.push(...this.deserializeBrush(c.options).strokes)}break;case"sticker":case"text":case"textdesign":if(!e.sprite){e.sprite={spriteIdList:[],sticker:{},text:{},textdesign:{},common:{}}}const u=At();e.sprite.spriteIdList.push(u);e.sprite.common[u]={order:this.spriteOrder,position:this.mapRelativeCropPointToImageSpace(c.options.position),tool:"sticker",rotation:c.options.rotation||0,flipHorizontally:c.options.flipHorizontally,flipVertically:c.options.flipVertically};this.spriteOrder+=1;if(c.type==="sticker"){e.sprite.common[u].tool="sticker";e.sprite.common[u].size={width:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.x),height:this.mapRelativeCropSizeToScaledImageSize(c.options.dimensions.y)};e.sprite.sticker[u]=Ai.deserializeStickers(c.options)}else if(c.type==="text"){e.sprite.common[u].tool="text";e.sprite.text[u]=this.deserializeTexts(c.options)}else if(c.type==="textdesign"){e.sprite.common[u].tool="textdesign";e.sprite.textdesign[u]=this.deserializeTextDesign(c.options)}break;default:break}});break;default:break}});if(t.assetLibrary){e.customStickers=((s=(n=t.assetLibrary)==null?void 0:n.assets)==null?void 0:s.stickers)||[]}return e}deserializeFrame(t){return{identifier:t.identifier,opacity:t.alpha,width:this.mapRelativeCropSizeToUnscaledImageSize(t.size),color:Ai.deserialzeColor(t.tintColor)}}deserializeFocus(t){switch(t.type){case"linear":return{identifier:"linear",linear:this.deserializeLinearFocus(t.options)};case"gaussian":return{identifier:"gaussian",gaussian:this.deserializeGaussianFocus(t.options)};case"radial":return{identifier:"radial",radial:this.deserializeRadialFocus(t.options)};case"mirrored":return{identifier:"mirrored",mirrored:this.deserializeMirroredFocus(t.options)};default:return void 0}}deserializeRadialFocus(t){return{center:this.mapRelativeCropPointToImageSpace(t.start),radius:new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end))).magnitude,blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeLinearFocus(t){return{start:this.mapRelativeCropPointToImageSpace(t.start),end:this.mapRelativeCropPointToImageSpace(t.end),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeGaussianFocus(t){return{blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeMirroredFocus(t){const e=new O(this.mapRelativeCropPointToImageSpace(t.start)).subtract(new O(this.mapRelativeCropPointToImageSpace(t.end)));return{origin:new O(this.mapRelativeCropPointToImageSpace(t.start)).add(new O(this.mapRelativeCropPointToImageSpace(t.end))).divide(2),rotation:Math.atan2(e.y,e.x),size:this.mapRelativeCropSizeToScaledImageSize(t.size),blurRadius:this.mapRelativeCropSizeToScaledImageSize(t.blurRadius)}}deserializeTexts(t){return{identifier:hn(t.fontIdentifier),fontSize:this.mapRelativeCropSizeToScaledImageSize(t.fontSize),width:this.mapRelativeCropSizeToScaledImageSize(t.maxWidth),alignment:t.alignment,textColor:Ai.deserialzeColor(t.color),backgroundColor:Ai.deserialzeColor(t.backgroundColor),lineHeight:t.lineHeight,text:t.text}}deserializeTextDesign(t){return{identifier:t.identifier,width:this.mapRelativeCropSizeToScaledImageSize(t.width),padding:this.mapRelativeCropSizeToScaledImageSize(t.padding),color:Ai.deserialzeColor(t.color),seed:t.seed,text:t.text,isInverted:t.inverted}}deserializeBrush(t){return{strokes:t.paths.map(e=>{return{path:{controlPoints:e.points.map(this.mapRelativeCropPointToImageSpace)},brush:{id:"imgly_brush_radial",color:Ai.deserialzeColor(e.brush.color),size:e.brush.size,hardness:e.brush.hardness}}})}}}});var act,lct,cct,uct,dct,mct,pct,hct,fct,gct,bct,yct,_ct,xct,vct,aW;var sW=d(()=>{act="@photoeditorsdk/root";lct="5.19.3";cct="The most comprehensive photo editor SDK for HTML5";uct="http://github.com/imgly/pesdk-html5";dct="PhotoEditorSDK (img.ly GmbH) ";mct="SEE LICENSE IN LICENSE.md";pct=true;hct={};fct={start:"yarn workspace @example/react start",build:"yarn sdk-script build","build:rollup":"yarn sdk-script build rollup","package:release":"cd dist/photoeditorsdk && npm publish","package:pre-release":"cd dist/photoeditorsdk && npm publish --tag next","lint:css":"stylelint './packages/**/*.tsx'","lint:ts":"eslint ./packages/**/*.{ts,tsx}","lint:ts-engine":"eslint ./engine/**/*.ts","lint:types":"tsc --noEmit -p tsconfig.json --skipLibCheck","lint:types-engine":"tsc --noEmit -p engine/tsconfig.json --skipLibCheck",lint:"run-p lint:*",test:"$(npm bin)/jest",e2e:"cypress open","e2e:server":"sdk-script ui -P 3000 -D build","e2e:ci":"CYPRESS_RETRIES=2 cypress run --browser chrome --headed",deploy:"yarn workspace examp run deploy:pages",docs:"rm -rf ./docs && typedoc",postinstall:"yarn sdk-script server:build"};gct={"@elv1n/cypress-plugin-snapshots":"1.4.4","@types/jest":"^24.0.11","@types/pixelmatch":"^5.2.2","@types/pngjs":"^3.4.2","@types/react":"^16.8.13","@types/react-dom":"^16.8.4","@types/styled-components":"4.4.0","@typescript-eslint/eslint-plugin":"4.6.0","@typescript-eslint/parser":"4.6.0",autoprefixer:"^9.7.4","cross-env":"^7.0.2",cypress:"6.6.0",eslint:"7.10.0","eslint-config-airbnb":"18.2.0","eslint-config-prettier":"6.12.0","eslint-import-resolver-typescript":"^2.3.0","eslint-plugin-cypress":"^2.11.2","eslint-plugin-import":"2.22.1","eslint-plugin-jsx-a11y":"6.3.1","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-prettier":"3.1.4","eslint-plugin-react":"7.21.3",husky:"4.3.0",jest:"24.9.0",jsdoc:"^3.6.3","lint-staged":"10.4.0","lodash.defaults":"^4.2.0","mobx-react-devtools":"^6.1.1","native-url":"0.3.4","npm-run-all":"^4.1.5",prettier:"^2.0.5",react:"16.8.6","react-dom":"16.8.6","start-server-and-test":"1.11.5","styled-components":"4.4.1",stylelint:"^13.7.2","stylelint-config-recommended":"^3.0.0","stylelint-config-standard":"^20.0.0","stylelint-config-styled-components":"^0.1.1","stylelint-processor-styled-components":"^1.10.0","ts-jest":"24.3.0",typedoc:"^0.17.8",typescript:"3.8.3","utility-types":"^3.10.0"};bct={"@juggle/resize-observer":"3.2.0","@reach/portal":"^0.13.0","can-use-dom":"0.1.0","lodash.debounce":"4.0.8","lodash.memoize":"4.1.2","lodash.throttle":"4.1.1",mobx:"4.15.7","mobx-react":"6.3.1",photoeditorsdk:"1.0.0","react-app-polyfill":"1.0.6","react-transition-group":"^4.4.1"};yct={node:"10.x || 11.x || 12.x || 13.x || 14.x || 15.x"};_ct={eslint:"7.10.0"};xct=["examples/server","examples/material-ui","examples/ssr","examples/react","packages/*","!packages/ui","packages/ui/*","!packages/ui/components","packages/ui/components/*","engine/*","test/*","scripts"];vct={hooks:{"pre-commit":"lint-staged","pre-push":"true"}};aW={name:act,version:lct,description:cct,repository:uct,author:dct,license:mct,private:pct,bin:hct,scripts:fct,devDependencies:gct,dependencies:bct,devEngines:yct,resolutions:_ct,workspaces:xct,husky:vct}});var pu;var lW=d(()=>{R();zn();sW();pu=class{constructor(t,e,r,o,n,s){this.version="3.12.0";this.mapImagePointToRelativeCropPoint=t=>{const e=at.pointFromSpaceToSpace(t,this.imageSpace,this.cropSpace,false);return at.absoluteToRelativePoint(e,this.cropSpace,false)};this.mapSizeToRelativeUnscaledCropSize=t=>{return t/Math.min(this.outputSize.height,this.outputSize.width)};this.mapSizeToRelativeScaledCropSize=t=>{return t/Math.min(this.outputSize.height*this.outputScale.x,this.outputSize.width*this.outputScale.y)};this.getPointInDirection=(t,e=0,r=3)=>{const o=Math.tan(e);const n=Math.sqrt(o**2+1);return{x:t.x+r/n,y:t.y+r*o/n}};this.previewPosition=t;this.previewSize=e;this.outputSize=r;this.imageSize=o;this.imageSpace=n;this.cropSpace=s;this.outputScale=s.getScale()}static serializeFilters(t){return{type:"filter",options:{intensity:t.intensity,identifier:t.identifier}}}static serializeAdjustments(t){return{type:"adjustments",options:t}}static serializeOverlay(t){return{type:"overlay",options:{identifier:t.identifier,intensity:t.opacity,blendMode:t.blendMode.replace(/[A-Z]/g,e=>` ${e.toLowerCase()}`)}}}static serializeMetaData(){return{platform:"html5",version:aW.version,createdAt:new Date().toISOString()}}serialise(t,e,r){const o=pu.serializeMetaData();const n={width:this.imageSize.width,height:this.imageSize.height};if(e){n.type=r;n.data=e}const s=[];const a=[];const{adjustment:l}=t;if(Object.keys(l).map(x=>l[x]).filter(Boolean).length){s.push(pu.serializeAdjustments(l))}const{filter:c}=t;if(c.identifier!=="identity"){s.push(pu.serializeFilters(c))}const{overlay:u}=t;if(u.identifier!=="identity"){a.push(pu.serializeOverlay(u))}if(t.transform){const{transform:x,orientation:v}=this.serializeTransform(t.transform);const b=[x.options.start.x!==0,x.options.start.y!==0,x.options.end.x!==1,x.options.end.y!==1,x.options.rotation!==0];const T=[v.options.rotation!==0,v.options.flipVertically!==false,v.options.flipHorizontally!==false];if(b.some(k=>k)){s.push(x)}if(T.some(k=>k)){s.push(v)}}const{frame:m}=t;if(m.identifier!=="identity"){a.push(this.serialzeFrame(m))}const{focus:p}=t;if(p.identifier!=="identity"){s.push(this.serializeFocus(p))}if(t.sprite){t.sprite.spriteIdList.forEach(x=>{const v=t.sprite.common[x];switch(v.tool){case"sticker":const b=t.sprite.sticker[x];a.push(this.serializeSticker(b,v,t.transform));break;case"text":const T=t.sprite.text[x];a.push(this.serializeText(T,v));break;case"textdesign":const k=t.sprite.textdesign[x];a.push(this.serializeTextDesign(k,v));break;default:break}})}if(t.brush.strokes.length){a.push({type:"brush",options:{paths:t.brush.strokes.map(x=>{return{points:x.path.controlPoints.map(this.mapImagePointToRelativeCropPoint),brush:{color:{rgba:x.brush.color},size:x.brush.size,hardness:x.brush.hardness}}})}})}if(a.length){const x={type:"sprite",options:{sprites:a}};s.push(x)}const h=t.customStickers;const g={assets:{stickers:h}};return{version:this.version,meta:o,image:n,operations:s,assetLibrary:g}}serialzeFrame(t){return{type:"frame",options:{identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.color},size:this.mapSizeToRelativeUnscaledCropSize(t.width)}}}serializeFocus(t){const e=Math.sqrt(this.previewSize.width**2+this.previewSize.height**2);switch(t.identifier){case"linear":return{type:"focus",options:{type:"linear",options:{start:this.mapImagePointToRelativeCropPoint(t.linear.start),end:this.mapImagePointToRelativeCropPoint(t.linear.end),blurRadius:this.mapSizeToRelativeScaledCropSize(t.linear.blurRadius)}}};case"radial":return{type:"focus",options:{type:"radial",options:{start:this.mapImagePointToRelativeCropPoint(t.radial.center),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(t.radial.center,0,t.radial.radius)),blurRadius:this.mapSizeToRelativeScaledCropSize(t.radial.blurRadius),gradientRadius:.1}}};case"mirrored":const{mirrored:r}=t;return{type:"focus",options:{type:"mirrored",options:{start:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,e/2)),end:this.mapImagePointToRelativeCropPoint(this.getPointInDirection(r.origin,r.rotation,-e/2)),size:this.mapSizeToRelativeScaledCropSize(t.mirrored.size),blurRadius:this.mapSizeToRelativeScaledCropSize(t.mirrored.blurRadius),gradientSize:.1}}};default:return{type:"focus",options:{type:"gaussian",options:{blurRadius:this.mapSizeToRelativeScaledCropSize(t.gaussian.blurRadius)}}}}}serializeSticker(t,e,r){return{type:"sticker",options:{position:this.mapImagePointToRelativeCropPoint(e.position),dimensions:{x:this.mapSizeToRelativeScaledCropSize(e.size.width),y:this.mapSizeToRelativeScaledCropSize(e.size.height)},rotation:e.rotation,flipVertically:(e.flipVertically||false)!==(r.flipVertically||false),flipHorizontally:(e.flipHorizontally||false)!==(r.flipHorizontally||false),identifier:t.identifier,alpha:t.opacity,tintColor:{rgba:t.tintColor},tintMode:t.tintMode}}}serializeText(t,e){return{type:"text",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,fontIdentifier:t.identifier,fontSize:this.mapSizeToRelativeScaledCropSize(t.fontSize),maxWidth:this.mapSizeToRelativeScaledCropSize(t.width),text:t.text,lineHeight:t.lineHeight,color:{rgba:t.textColor},backgroundColor:{rgba:t.backgroundColor},alignment:t.alignment}}}serializeTextDesign(t,e){return{type:"textdesign",options:{position:this.mapImagePointToRelativeCropPoint(e.position),rotation:e.rotation,flipVertically:false,flipHorizontally:false,identifier:t.identifier,inverted:t.isInverted,text:t.text,seed:t.seed,width:this.mapSizeToRelativeScaledCropSize(t.width),padding:this.mapSizeToRelativeScaledCropSize(t.padding),color:{rgba:t.color}}}}serializeTransform(t){const{start:e,end:r}=t;const o={type:"transform",options:{start:e,end:r,rotation:t.rotation,meta:{identifier:t.identifier}}};const n={type:"orientation",options:{rotation:t.outputRotation,flipHorizontally:t.flipHorizontally,flipVertically:t.flipVertically}};return{transform:o,orientation:n}}}});var rI={};de(rI,{Deserializers:()=>Cct,Serializer:()=>pu});var Cct;var oI=d(()=>{rW();nW();lW();Cct={"3.9.0":Ai,"3.12.0":Ri}});var cW,Sct,wct,Tct,rf;var uW=d(()=>{Tt();R();U();cW=/^data:image\/(.+?);base64,/;Sct=i=>cW.test(i);wct=i=>i.match(/^data:([^;]+)/)[1];Tct=i=>i.replace(cW,"");rf=class{constructor(t){this.applySerialization=async(t,e,r,o)=>{this.editor.resetToolStates();const n=this.editor.activeStore.tool==="transform";if(!n){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.reset();if(!n){this.editor.transformToolStore.onLeave()}const s="Unexpected error occured";const a=e.deserializeImage(t);if(a.image&&a.image.data){const u=a.image.data;await this.editor.setImage(u);this.editor.scale.defaultScale=1;this.editor.scale.resetOffset();this.editor.transformToolStore.reset();this.editor.activeStore.setImage(u);await this.editor.engineMediator.image.addImageToContainer();this.editor.engineMediator.output.applyNewImageTransform();this.editor.engineMediator.preview.updateTransform();this.editor.scale.setInitialTransform();this.editor.transformToolStore.setCropDefaults();this.editor.historyStore.addInitialSnapshot();this.editor.transformToolStore.saveTransforms()}const l=e.deserializeTransformation(t);if(!l){o(s);return}await this.applyStateOnUI(l);const c=e.deserialize(t);if(!c){o(s);return}await this.applyStateOnUI(c);this.editor.historyStore.addInitialSnapshot();if(n){this.editor.transformToolStore.onEnter()}await this.editor.render();if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}r()};this.editor=t}serialize({image:t}={image:false}){const e=this.editor.activeStore.tool==="transform";const{displaySerializationModal:r}=this.editor.configStore.config;if(r){this.editor.modalStore.showInfoModal("saving")}return new Promise((o,n)=>{Promise.resolve().then(()=>(oI(),rI)).then(async({Serializer:s})=>{try{if(e){this.editor.transformToolStore.onLeave()}await this.editor.wait();this.editor.transformToolStore.applyDefaultCrop(false);const{originalImage:a}=this.editor.imageContainer.getData();const l=this.editor.engineMediator.output.container.getResolution();const c={width:a.width,height:a.height};const u=new s(this.editor.transformToolStore.defaultCropMaskPosition,this.editor.transformToolStore.maxCropMaskSize,l,c,this.editor.engine.getRootContainers()[0],this.editor.engine.getOutputContainer());const m={["adjustment"]:ct(this.editor.adjustmentsToolStore.state),["filter"]:ct(this.editor.filterToolStore.state),["focus"]:ct(this.editor.focusToolStore.serializableState),["overlay"]:ct(this.editor.overlayToolStore.state),["frame"]:ct(this.editor.frameToolStore.state),["brush"]:this.editor.brushToolStore.strokes||{strokes:[]}};const{sprite:p,customStickers:h}=await this.editor.spriteStore.serializableState();p.spriteIdList=p.spriteIdList.sort((v,b)=>{const T=p.common[v].order;const k=p.common[b].order;return T-k});m.sprite=p;m.customStickers=h;m.transform=this.editor.transformToolStore.serializableState;let g;let x;if(t){const v=rf.getDataURL(a);x=wct(v);g=Tct(v)}if(r){this.editor.modalStore.hideModal()}o(u.serialise(m,g,x));if(e){this.editor.transformToolStore.onEnter()}}catch(a){if(r){this.editor.modalStore.hideModal()}n(a)}})})}deserialize(t){this.editor.modalStore.showInfoModal("loading");return new Promise((e,r)=>{try{Promise.resolve().then(()=>(oI(),rI)).then(({Deserializers:o})=>{const n=t.version.match(/[0-3].[0-8].[0-9]/i);let s=null;if(n&&o["3.9.0"]){s=new o["3.9.0"](this.editor)}else if(o[t.version]){s=new o[t.version](this.editor)}else{s=new o["3.12.0"](this.editor)}if(n){this.editor.modalStore.hideModal();this.editor.modalStore.showActionModal({type:"warning",identifier:"unsupportedSerializationVersion",handleConfirm:()=>this.applySerialization(t,s,e,r)})}else{this.applySerialization(t,s,e,r)}})}catch(o){if(this.editor.modalStore.identifier==="loading"){this.editor.modalStore.hideModal()}r(o)}})}static getDataURL(t){if(t instanceof HTMLImageElement){const{src:n}=t;if(Sct(n)){return n}}if(t instanceof HTMLCanvasElement){return t.toDataURL("image/png")}const e=document.createElement("canvas");e.width=t.width;e.height=t.height;const r=e.getContext("2d");r.drawImage(t,0,0);const o=e.toDataURL("image/png");$t(e);return o}async applyStateOnUI(t){const e=this.editor.activeStore.tool==="transform";try{if(t.transform){if(!e){this.editor.transformToolStore.onEnter()}this.editor.transformToolStore.updateStateFromSerialization(t.transform);await this.editor.wait();this.editor.transformToolStore.onLeave();if(!e){this.editor.transformToolStore.onEnter();await this.editor.wait();this.editor.transformToolStore.onLeave()}}if(t.filter){await this.editor.filterToolStore.updateStateFromSerialization(t.filter)}if(t.adjustment){this.editor.adjustmentsToolStore.updateStateFromSerialization(t.adjustment)}if(t.focus){await this.editor.focusToolStore.updateStateFromSerialization(t.focus)}if(t.overlay){await this.editor.overlayToolStore.updateStateFromSerialization(t.overlay)}if(t.sprite){let r=Object.keys(t).length-1;if(t.customStickers){r-=1}t.sprite.spriteIdList=t.sprite.spriteIdList.sort((o,n)=>{const s=t.sprite.common[o].order;const a=t.sprite.common[n].order;return s-a});await this.editor.spriteStore.updateStateFromSerialization(t.sprite,t.customStickers,Math.max(0,r))}if(t.brush){this.editor.brushToolStore.updateStateFromHistory(t.brush)}if(t.frame){await this.editor.frameToolStore.updateStateFromSerialization(t.frame)}this.editor.outputContainer.updateChildrenContainers()}catch(r){if(r.name==="AssetNotFoundError"){console.error(r)}else{console.error(r);this.editor.modalStore.showActionModal({type:"error",identifier:"unexpectedError",error:r.message,handleConfirm:()=>{this.applyStateOnUI(t)}})}}}}});var kct,nI;var dW=d(()=>{kct=i=>{const t=atob(i.split(",")[1]);const e=i.split(",")[0].split(":")[1].split(";")[0];const r=new ArrayBuffer(t.length);const o=new Uint8Array(r);for(let n=0;n{R();mW=i=>i.split(",")[0].split(":")[1].split(";")[0];pW=i=>{if(typeof i==="string"){return mW(i)}if(i.src.includes(".svg")){return"image/svg+xml"}if(i.src){return mW(i.src)}return"image/jpeg"}});var yv,of;var fW=d(()=>{Vh();yv=y(Ju());R();zn();of=class{static isImageElement(t){return t instanceof HTMLImageElement}constructor({license:t,assetProvider:e,crossOrigin:r,backgroundColor:o}){this.crossOrigin=r;this.engine=new fm({license:t,crossOrigin:r,assetProvider:e,downscaleOptions:{maxDimensions:{width:174,height:174}},backgroundColor:o})}getAllFilterPreviewThumbnails(t){return new Promise((e,r)=>{const o=[];const n=[];t.forEach(s=>{if(s.isDuotone)o.push(s.identifier);else n.push(s.identifier)});this.getAllDuotonePreview(o).then(s=>{this.getAllLutPreview(n).then(a=>{e(Object.assign(s,a))}).catch(a=>{r(a)})}).catch(s=>{r(s)})})}async getAllDuotonePreview(t){const e={};if(!t.length)return e;const r=await this.engine.addDuoToneFilterFromAssets(t[0],this.container);await(0,yv.default)(t,async o=>{const n=this.engine.assetProvider.getDuotoneFilterAsset(o);const s=r.filterOperation.getFilter();s.set({intensity:.5,lightColor:st.Color.fromHex(n.lightColor),darkColor:st.Color.fromHex(n.darkColor)});const a=await this.engine.export("data-url","image/jpeg",.8,false,true);e[o]=a},{concurrency:1});this.engine.removeEffect(r);return e}async loadLutAssets(t){const e={};await(0,yv.default)(t,async r=>{e[r]=await this.getImageElement(this.engine.assetProvider.getAssetSource("filter",r))});return e}async getAllLutPreview(t){const e={};if(!t.length)return e;const r=await this.loadLutAssets(t);const o=await this.engine.addLUTFilterFromAssets(t[0],this.container);await(0,yv.default)(t,async n=>{const s=this.engine.assetProvider.getLUTFilterAsset(n);const a=o.filterOperation.getFilter();const l={horizontalTileCount:s.horizontalTileCount||5,verticalTileCount:s.verticalTileCount||5,image:r[n]};a.set({...l,intensity:s.defaultIntensity||1});o.setProperties({intensity:1});a._lutPrimitive.set(l);const c=await this.engine.export("data-url","image/jpeg",.8,false,true);e[n]=c},{concurrency:1});this.engine.removeEffect(o);return e}addImageToContainer(t){return new Promise((e,r)=>{let o;if(of.isImageElement(t)){o=t;this.setBackgroundImage(o);e()}else{this.getImageElement(t).then(n=>{o=n;this.setBackgroundImage(o);e()}).catch(n=>{r({identifier:"imageLoading",message:n.message})})}})}getImageElement(t){return new Promise((e,r)=>{const o=new Image;o.addEventListener("load",()=>{e(o)});o.addEventListener("error",n=>{r(n)});o.crossOrigin=this.crossOrigin;o.src=t})}setBackgroundImage(t){if(!this.container){this.container=this.engine.addImage({image:t,blendMode:"normal",opacity:1})}else{this.container.setData({image:t})}const{size:e}=this.container.getBounds();const r=this.engine.getOutputContainer();r.setResolution(e)}}});var Ict,$o;var sI=d(()=>{Tt();U();Ict={horizontalGuides:[],verticalGuides:[],rotationGuides:[]};$o=class{constructor(t){this.previewTopLeftPosition={x:0,y:0};this.init=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig();this.state.rotationGuides=this.getRotationGuidesFromConfig()};this.getGuideValue=(t,e)=>{const{height:r,width:o}=this.editor.getPreviewSize();const{snapToLeft:n,snapToRight:s,snapToTop:a,snapToBottom:l}=this.configStore.config.snapping.position;const c=Math.min(r,o);let u=0;if(e==="bottom"){u=Math.round(r-c*l)}else if(e==="top"){u=Math.round(c*a)}else if(e==="right"){u=Math.round(o-c*s)}else if(e==="left"){u=Math.round(c*n)}else if(t==="vertical"&&e==="center"){u=Math.round(o/2)}else if(t==="horizontal"&&e==="center"){u=Math.round(r/2)}return u};this.getVerticalGuidesFromConfig=()=>{const{snapToVerticalCenter:t,snapToLeft:e,snapToRight:r}=this.configStore.config.snapping.position;const o=[];if(t){o.push({value:this.getGuideValue("vertical","center"),edge:"center",isVisible:false,direction:"vertical"})}if(e){o.push({value:this.getGuideValue("vertical","left"),edge:"leading",isVisible:false,direction:"vertical"})}if(r){o.push({value:this.getGuideValue("vertical","right"),edge:"trailing",isVisible:false,direction:"vertical"})}return o};this.getHorizontalGuidesFromConfig=()=>{const{snapToHorizontalCenter:t,snapToTop:e,snapToBottom:r}=this.configStore.config.snapping.position;const o=[];if(t){o.push({value:this.getGuideValue("horizontal","center"),edge:"center",isVisible:false,direction:"horizontal"})}if(e){o.push({value:this.getGuideValue("horizontal","top"),edge:"leading",isVisible:false,direction:"horizontal"})}if(r){o.push({value:this.getGuideValue("horizontal","bottom"),edge:"trailing",isVisible:false,direction:"horizontal"})}return o};this.getRotationGuidesFromConfig=()=>{const{angles:t}=this.configStore.config.snapping.rotation;const e=[];t.forEach(o=>{e.push(o);e.push(o+360);e.push(o-360)});const r=e.filter((o,n)=>e.indexOf(o)===n);return r.map(o=>({value:o*Math.PI/180,edge:"center",isVisible:false,position:{x:0,y:0}}))};this.getSpriteDimensions=({leftTop:t,leftBottom:e,rightTop:r,rightBottom:o})=>{const n=Math.min(t.y,r.y,e.y,o.y);const s=Math.max(t.y,r.y,e.y,o.y);const a=Math.min(t.x,r.x,e.x,o.x);const l=Math.max(t.x,r.x,e.x,o.x);return{height:Math.round(s-n),width:Math.round(l-a)}};this.mapRange=({value:t,fromMin:e,fromLength:r,toMin:o,toLength:n})=>{return(t-e)*n/r+o};this.updateGuides=()=>{this.state.horizontalGuides=this.getHorizontalGuidesFromConfig();this.state.verticalGuides=this.getVerticalGuidesFromConfig()};this.mapToSnapSystem=(t,e,r,o)=>{if(e.length===0){return t}if(e[0]>t){return t-r}for(let n=0;n=a-m){return a+u+(o?r*2:0)}return this.mapRange({value:t,fromMin:s,fromLength:a-s,toMin:l,toLength:c-l})}}if(o){return t+(e.length-1)*r*2+r}return t};this.mapFromSnapSystem=(t,e,r,o)=>{if(e.length===0){return t}if(e[0]>t){if(t>=e[0]-r){return e[0]}return t+r}let n=t;for(let a=0;a{const r=e*.5;const{value:o,edge:n}=t;let s=o;if(n==="leading"){s+=r}else if(n==="trailing"){s-=r}return s};this.mapSnappingGuidesToCenter=(t,e)=>{const r=[];t.forEach(o=>{r.push(this.centerSnapValue(o,e))});return r};this.calcSnapThresholdInRadians=(t,e)=>{if(t===0){return 0}return e/t};this.calculatePreviewTopLeftPosition=()=>{const t=this.editor.engineMediator.preview.container.getPosition();const e=this.editor.getPreviewSize();const r=Eo();this.previewTopLeftPosition={x:t.x/r-e.width/2,y:t.y/r-e.height/2}};this.snapToRotation=(t,e,r)=>{const{rotationGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.rotation;const{x:a,y:l}=this.previewTopLeftPosition;const{width:c}=this.editor.getPreviewSize();let u=(t+Math.PI*2)%(Math.PI*2);if(n){const m=new O(e).magnitude;const p=o.map(x=>x.value).sort((x,v)=>x-v);const h=this.calcSnapThresholdInRadians(m,s);if(!this.rotationOffset){const x=this.mapToSnapSystem(t,p,h,false);this.rotationOffset=x-u}u=this.mapFromSnapSystem(u+this.rotationOffset,p,h,false);const g={x:r.position.x-a-c,y:r.position.y-l};o.forEach(x=>{x.isVisible=x.value===u;x.position=g});return u}return t};this.snapToPosition=(t,e)=>{const{horizontalGuides:r,verticalGuides:o}=this.state;const{enabled:n,threshold:s}=this.configStore.config.snapping.position;const a=new O(this.previewTopLeftPosition);const{height:l,width:c}=this.getSpriteDimensions(e);const{x:u,y:m}=new O(t).subtract(a);if(n){const p=this.mapSnappingGuidesToCenter(r,l).sort((v,b)=>v-b);const h=this.mapSnappingGuidesToCenter(o,c).sort((v,b)=>v-b);if(!this.positionOffset){const v=this.mapToSnapSystem(u,h,s,true);const b=this.mapToSnapSystem(m,p,s,true);this.positionOffset=new O(v,b).subtract(new O(u,m))}let g=this.mapFromSnapSystem(u+this.positionOffset.x,h,s,true);let x=this.mapFromSnapSystem(m+this.positionOffset.y,p,s,true);g=Math.round(g);x=Math.round(x);r.forEach(v=>{const b=Math.round(this.centerSnapValue(v,l));v.isVisible=b===x});o.forEach(v=>{const b=Math.round(this.centerSnapValue(v,c));v.isVisible=b===g});return new O(g,x).add(a)}return{x:u,y:m}};this.dispose=()=>{this.state=null;this.editor=null;this.configStore=null};this.editor=t;this.configStore=t.configStore;this.state=Q(Ict);this.rotationOffset=null;this.positionOffset=null}hidePositionGuides(){this.positionOffset=null;this.state.verticalGuides=this.state.verticalGuides.map(t=>({...t,isVisible:false}));this.state.horizontalGuides=this.state.horizontalGuides.map(t=>({...t,isVisible:false}))}hideRotationGuides(){this.rotationOffset=null;this.state.rotationGuides=this.state.rotationGuides.map(t=>({...t,isVisible:false}))}get positionGuides(){const{verticalGuides:t,horizontalGuides:e}=this.state;return[...t,...e]}get rotationGuides(){return this.state.rotationGuides}};f([Q],$o.prototype,"state",2);f([C],$o.prototype,"snapToRotation",2);f([C],$o.prototype,"snapToPosition",2);f([C],$o.prototype,"hidePositionGuides",1);f([C],$o.prototype,"hideRotationGuides",1);f([C],$o.prototype,"dispose",2);f([S],$o.prototype,"positionGuides",1);f([S],$o.prototype,"rotationGuides",1)});var Sl;var gW=d(()=>{Tt();R();zn();U();hv();fv();dv();jk();pv();gv();bv();uW();ak();ck();uk();Tk();iI();mk();dW();hW();fW();Ik();sI();eI();Qk();Sl=class{constructor(t,e){this.initWithImage=async t=>{try{this.modalStore.showInfoModal("loading");this.engineMediator.init();this.snappingStore.init();await this.activeStore.setImage(t);if(this.configStore.config.displayResizeWarning){this.checkImageResize()}if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){const e=this.configStore.config.engine;this.previewThumbnails=new of({...e,license:this.configStore.config.license,assetProvider:this.configStore.assetProvider})}if(this.engine){this.engine.pesdk.on("context-lost",()=>{this.configStore.events.onErrorWebGLContextLost()})}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:e.identifier?e.identifier:"rendering",error:e,handleConfirm:()=>{this.initWithImage(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.checkImageResize=()=>{this.engine.on("beganImageDownscaling",()=>{this.modalStore.showInfoModal("resizing")});this.engine.on("imageDownscaled",({width:t,height:e})=>{const{maxMegaPixels:r}=this.configStore.config.engine.downscaleOptions;const o=mp.isMobile()?r.mobile:r.desktop;this.modalStore.hideModal();this.modalStore.showActionModal({type:"warning",identifier:"imageResized",handleConfirm:()=>{this.modalStore.hideModal()},error:{megapixels:`${o}`,width:`${t}`,height:`${e}`}})})};this.init=t=>{var o,n;if(!((o=this.activeStore)==null?void 0:o.image)){this.initWithImage(t);return}if(!this.historyStore||!((n=this.configStore)==null?void 0:n.config)){return}const e=this.historyStore.isDirty();const{displayDiscardChangesWarning:r}=this.configStore.config;if(e&&r){this.modalStore.showActionModal({type:"warning",identifier:"discardChanges",handleConfirm:()=>{this.setImage(t);this.resetToolStates()},handleDismiss:()=>{this.setImage(t,true)}});return}if(e&&!r){this.setImage(t,true);return}this.historyStore.reset();this.setImage(t,true).then(()=>{if(this.modalStore.identifier!=="imageResized"){this.modalStore.hideModal()}const{engine:s,displayCanvasRendererWarning:a}=this.configStore.config;if(s.preferredRenderer==="canvas"&&a){this.modalStore.showActionModal({type:"warning",identifier:"unsupportedWebGLRenderer",handleConfirm:()=>{this.modalStore.hideModal()}})}}).catch(()=>{return null})};this.setImage=async(t,e=false)=>{try{if(!this.activeStore.image){this.initWithImage(t)}else{this.activeStore.setImageLoadedToEngine(false);this.modalStore.showInfoModal(this.configStore.config.displayResizeWarning?"resizing":"loading");this.scale.defaultScale=1;this.scale.resetOffset();await this.activeStore.setImage(t);await this.engineMediator.image.addImageToContainer();this.canvasStore.resizeCanvas();this.engineMediator.output.applyNewImageTransform();this.engineMediator.preview.updateTransform();this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();const{flipHorizontally:r,flipVertically:o,outputRotation:n}=this.transformToolStore.rotateFlipState;this.outputContainer.setData({flipVertically:o,flipHorizontally:r});await this.transformToolStore.rotateOutputContainer(xp(n),false);if(e){this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();this.transformToolStore.resetCrop();this.transformToolStore.applyDefaultCrop();this.transformToolStore.saveTransforms();this.transformToolStore.onEnter();this.transformToolStore.setRotation(this.transformToolStore.rotationInDegrees);this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}else{this.transformToolStore.saveTransforms()}this.snappingStore.calculatePreviewTopLeftPosition();this.historyStore.addInitialSnapshot();await this.renderPromise();if(this.configStore.config.filter.enablePreviewThumbnails&&this.configStore.config.engine.preferredRenderer==="webgl"){this.filterToolStore.setImageAndGetPreviews()}const s=this.activeStore.tool;if(!s){this.onReady()}else{this.configStore.events.onImageLoaded()}if(!(this.modalStore.identifier==="imageResized")){this.modalStore.hideModal()}this.activeStore.setImageLoadedToEngine(true);this.resize()}}catch(r){this.configStore.events.onErrorImageLoading(r);this.modalStore.hideModal();this.modalStore.showActionModal({type:"error",identifier:r.identifier?r.identifier:"rendering",error:r,handleConfirm:()=>{this.setImage(t,e)},handleDismiss:()=>{this.activeStore.setImage(void 0)}});throw new Error(r)}};this.onToolChange=(t,e=null,r=true)=>{var o,n;if(t===e){return}if((n=(o=this.engineMediator)==null?void 0:o.preview)==null?void 0:n.container){if([t,e].indexOf("transform")!==-1){if(t==="transform"){this.transformToolStore.onLeave();this.transformToolStore.addSnapshot();this.snappingStore.calculatePreviewTopLeftPosition()}else if(e==="transform"){this.transformToolStore.onEnter()}this.resize(e)}else{this.scale.resetOffset();this.scale.resetPosition();this.scale.setScaleToDefault();this.scale.scaleRender(true)}if(r){this.render()}}};this.resize=(t=null)=>{if(!this.engineMediator)return;try{const e=this.activeStore.tool;const r=t==="transform"||!t&&e==="transform";this.canvasStore.resizeCanvas(t);this.transformToolStore.applyDefaultCrop();const o=ct(this.transformToolStore.maxCropMaskSize);if(!r){this.transformToolStore.onEnter()}const n=this.engineMediator.preview.container.getRotation();const s=this.engineMediator.preview.updateTransform(n);if(s){this.scale.setInitialTransform();this.transformToolStore.setCropDefaults();this.transformToolStore.updateCanvasControls(o);this.focusToolStore.updateCanvasControls();this.spriteStore.updateCanvasControls();const a=this.transformToolStore.getScaleWithFlip(n);this.engineMediator.preview.container.setScale(a);if(!r){this.transformToolStore.onLeave();this.transformToolStore.onEnter();this.transformToolStore.onLeave()}this.snappingStore.calculatePreviewTopLeftPosition();this.render()}}catch(e){this.configStore.events.onErrorImageLoading(e);this.modalStore.showActionModal({type:"error",identifier:"rendering",handleConfirm:()=>{this.resize(t)},handleDismiss:()=>{this.activeStore.setImage(void 0)}})}};this.export=async({preventExportEvent:t,...e}={})=>{const r=this.activeStore.tool==="transform";try{this.modalStore.showInfoModal("exporting");if(r){this.transformToolStore.onLeave()}const{config:o}=this.configStore;const n={...o.export.image,...e};const{exportType:s,format:a,quality:l,enableDownload:c,transparent:u}=n;const m=await this.engineMediator.engine.export(s,a,l,u);if(r&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}if(this.historyStore){this.historyStore.isDirtySinceSave=false}if(this.modalStore){this.modalStore.hideModal()}if(c){this.triggerFileDownload(o.export.filename,a,s,m)}if(!t){this.configStore.events.onExport(m)}return m}catch(o){if(this.modalStore){this.modalStore.hideModal()}if(r&&this.transformToolStore){this.transformToolStore.onEnter();await this.render()}throw new Error(o)}};this.serialize=({image:t}={image:true})=>{if(this.serializationMediator){return this.serializationMediator.serialize({image:t})}return Promise.resolve({})};this.deserialize=t=>{if(this.serializationMediator){return this.serializationMediator.deserialize(t)}return Promise.resolve()};this.close=()=>{var t,e,r,o,n,s;if((((t=this.historyStore)==null?void 0:t.isDirtySinceSave)||((r=(e=this.transformToolStore)==null?void 0:e.transformHistory)==null?void 0:r.hasChanges()))&&((n=(o=this.configStore)==null?void 0:o.config)==null?void 0:n.displayCloseWarning)&&this.modalStore){this.modalStore.showActionModal({type:"warning",identifier:"unsavedChanges",handleConfirm:()=>{var a;if((a=this.configStore)==null?void 0:a.events){this.configStore.events.onClose()}}})}else if((s=this.configStore)==null?void 0:s.events){this.configStore.events.onClose()}};this.hasChanges=()=>{if(this.historyStore){return this.historyStore.isDirtySinceSave}return false};this.getImageDimensions=()=>{if(this.engine){const{width:t,height:e}=this.engine.getOutputDimensions();return{width:t,height:e}}return{width:0,height:0}};this.wait=(t=0)=>new Promise(e=>setTimeout(e,t));this.clickableCanvas=async t=>{if(t){await new Promise(e=>setTimeout(e,0));this.canvasStore.enableCanvasClick()}else{this.canvasStore.disableCanvasClick()}};this.onReady=async()=>{const{forceCrop:t}=this.configStore.config;this.activeStore.selectTool(this.configStore.defaultTool);if(t){const e=this.transformToolStore.localOutputImageSize;const r=e.width/e.height;const o=this.transformToolStore.entityManager.items.map(n=>{if(n.ratio){return n.ratio}return n.dimensions.x/n.dimensions.y});if(o.indexOf("*")!==-1){console.error('ForceCrop will not work if "*" is one of the ratios')}else if(o.indexOf(parseFloat(r.toFixed(2)))===-1){this.activeStore.selectTool("transform")}}this.configStore.events.onEditorReady()};this.addSnapshot=(t,e,r)=>{this.historyStore.addSnapshot(t,e,r)};this.resetToolStates=()=>{this.transformToolStore.pureReset();this.filterToolStore.pureReset();this.focusToolStore.pureReset();this.adjustmentsToolStore.pureReset();this.overlayToolStore.pureReset();this.frameToolStore.pureReset();this.brushToolStore.pureReset();this.spriteStore.pureReset();this.historyStore.reset();this.render()};this.getAssetPath=t=>this.assetProvider.getPathForCategory(t);this.render=async()=>{await this.renderPromise()};this.applyFlipToPreview=t=>{if(!this.engineMediator)return{x:0,y:0};return this.engineMediator.previewSpaceToFlippedPreviewSpace(t)};this.getPreviewSize=()=>{if(!this.engine)return{width:0,height:0};const{width:t,height:e}=this.engine.getOutputDimensions();if(t&&e){return{width:Math.round(this.worldToPreview(this.outputToWorld(t))),height:Math.round(this.worldToPreview(this.outputToWorld(e)))}}return{height:e,width:t}};this.getImageMimeType=()=>{return pW(this.activeStore.image)};this.cleanUpCanvasMemory=()=>{var t,e,r;(r=(e=(t=this.engineMediator)==null?void 0:t.image)==null?void 0:e.container)==null?void 0:r.dispose()};this.dispose=()=>{if(this.engineMediator){this.engineMediator.dispose();this.engineMediator=null}this.serializationMediator=null;if(this.spriteStore){this.spriteStore.dispose();this.spriteStore=null}this.scale=null;this.filterToolStore=null;this.adjustmentsToolStore=null;this.focusToolStore=null;this.overlayToolStore=null;this.frameToolStore=null;this.brushToolStore=null;if(this.transformToolStore){this.transformToolStore.dispose();this.transformToolStore=null}if(this.libraryStore){this.libraryStore.dispose();this.libraryStore=null}if(this.modalStore){this.modalStore.dispose();this.modalStore=null}if(this.snappingStore){this.snappingStore.dispose();this.snappingStore=null}if(this.activeStore){this.activeStore.dispose();this.activeStore=null}if(this.canvasStore){this.canvasStore.dispose();this.canvasStore=null}this.historyStore=null;if(this.configStore){this.configStore.dispose();this.configStore=null}};this.triggerFileDownload=(t,e,r,o)=>{const n=e==="image/jpeg"&&r!=="ms-blob"?".jpeg":".png";const s=t+n;const a=this.blobFromExportData(o);this.triggerBlobDownload(s,a)};this.triggerBlobDownload=(t,e)=>{if(navigator.msSaveBlob){navigator.msSaveBlob(e,t)}else{const r=document.createElement("a");const o=URL.createObjectURL(e);r.href=o;r.download=t;document.body.appendChild(r);r.click();document.body.removeChild(r);if(!HF()){URL.revokeObjectURL(o)}}};this.blobFromExportData=t=>{if(typeof t==="string"){return nI(t)}if(t instanceof HTMLImageElement){return nI(t.src)}return t};this.configStore=new Qi;if(e){Object.entries(e).forEach(([o,n])=>{this.configStore.events.on(o,n)})}const r=this.configStore.saveConfig(t);this.engineMediator=new Vk(this);this.serializationMediator=new rf(this);this.spriteStore=new nt(this);this.scale=new ti(this);this.filterToolStore=new He(this);this.adjustmentsToolStore=new Zt(this);this.focusToolStore=new Bt(this);this.overlayToolStore=new Ze(this);this.frameToolStore=new Be(this);this.brushToolStore=new Ie(this);this.transformToolStore=new tt(this);this.libraryStore=new fr(this);this.modalStore=new Wr(this);this.snappingStore=new $o(this);this.activeStore=new hr(this);this.canvasStore=new Oi(this);this.historyStore=new du(this);this.libraryStore.initProvider(r);this.libraryStore.fetchImages();if(this.configStore.config.image){this.initWithImage(this.configStore.config.image)}else{this.configStore.events.onEditorReady();if(this.configStore.defaultTool==="library"||this.configStore.defaultTool==="customTool"){this.activeStore.selectTool(this.configStore.defaultTool)}}}get shortestOutputSide(){const t=this.outputContainer.getBounds();return Math.min(t.width,t.height)}get assetProvider(){return this.configStore.assetProvider}get engine(){if(!this.engineMediator)return null;return this.engineMediator.engine}get imageContainer(){if(!this.engineMediator)return null;return this.engineMediator.image.container}get orderHelper(){if(!this.engineMediator)return null;return this.engineMediator.orderHelper}renderPromise(){if(!this.engineMediator)return null;return this.engineMediator.render(this.engineMediator.preview.container)}previewToWorld(t,e){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.previewSpaceToWorldSpace(t,e)}return this.engineMediator.previewSpaceToWorldSpace(t,e)}worldToPreview(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.worldSpaceToPreviewSpace(t)}return this.engineMediator.worldSpaceToPreviewSpace(t)}worldSizeToPreview(t){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.worldSpaceToPreviewSpace(t.width),height:this.engineMediator.worldSpaceToPreviewSpace(t.height)}}previewSizeToWorld(t,e){if(!this.engineMediator)return{width:0,height:0};return{width:this.engineMediator.previewSpaceToWorldSpace(t.width,e),height:this.engineMediator.previewSpaceToWorldSpace(t.height,e)}}outputToWorld(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.outputSpaceToWorldSpace(t)}return this.engineMediator.outputSpaceToWorldSpace(t)}previewToOutput(t){if(!this.engineMediator)return{x:0,y:0};if(Yr(t)){return this.engineMediator.previewSpaceToOutputSpace(t)}return this.engineMediator.previewSpaceToOutputSpace(t)}get outputContainer(){return this.engineMediator.output.container}};f([C],Sl.prototype,"resize",2);f([C],Sl.prototype,"export",2);f([C],Sl.prototype,"clickableCanvas",2)});var Xt=d(()=>{U();pr();tv();oH();ak();ck();uk();mk();_H();SH();wH();Tk();DH();ZH();tW();eW();bv();pv();gW();Ak();dv();hv();fv();gv();sI();Yh();Qh();Jh();vl();Nn();hm()});var nf,sf,bW,yW,Dct,Ect,_W;var xW=d(()=>{nf=y(_("react"));B();sf=y(_("styled-components"));R();Xt();U();$e();bW=mt.Button.TextSecondary;yW=sf.default.span` font-size: 14px; padding: 3px 1px 2px; color: ${i=>i.theme.canvasActionBar.foreground};