UNPKG

photoeditorsdk

Version:

The most comprehensive photo editor SDK for HTML5

8 lines 807 kB
var Zw=Object.create;var Os=Object.defineProperty;var _p=Object.getOwnPropertyDescriptor;var Qw=Object.getOwnPropertyNames;var eC=Object.getPrototypeOf;var tC=Object.prototype.hasOwnProperty;var iC=(s,e,t)=>e in s?Os(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t;var yp=s=>Os(s,"__esModule",{value:true});var g=(s,e)=>()=>(s&&(e=s(s=0)),e);var xe=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Be=(s,e)=>{for(var t in e)Os(s,t,{get:e[t],enumerable:true})};var bp=(s,e,t,i)=>{if(e&&typeof e==="object"||typeof e==="function"){for(let r of Qw(e))if(!tC.call(s,r)&&(t||r!=="default"))Os(s,r,{get:()=>e[r],enumerable:!(i=_p(e,r))||i.enumerable})}return s};var Cr=(s,e)=>{return bp(yp(Os(s!=null?Zw(eC(s)):{},"default",!e&&s&&s.__esModule?{get:()=>s.default,enumerable:true}:{value:s,enumerable:true})),s)};var pt=(s=>{return(e,t)=>{return s&&s.get(e)||(t=bp(yp({}),e,1),s&&s.set(e,t),t)}})(typeof WeakMap!=="undefined"?new WeakMap:0);var bF=(s,e,t,i)=>{var r=i>1?void 0:i?_p(e,t):e;for(var o=s.length-1,n;o>=0;o--)if(n=s[o])r=(i?n(e,t,r):n(r))||r;if(i&&r)Os(e,t,r);return r};var O=(s,e,t)=>{iC(s,typeof e!=="symbol"?e+"":e,t);return t};var Ce;var qt=g(()=>{Ce=s=>{if(s){s.width=1;s.height=1;const e=s.getContext("2d");if(e){e.clearRect(0,0,1,1)}}}});var Ci,Gs;var Ac=g(()=>{Ci={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)"};Gs=(s,e=false)=>{if(Ci[s]){if(e){console.warn(`Font ${s} was deprecated. Please use ${Ci[s]} instead.`)}return Ci[s]}return s}});var Cf=xe((cA,wf)=>{var pT=typeof Element!=="undefined";var fT=typeof Map==="function";var gT=typeof Set==="function";var _T=typeof ArrayBuffer==="function"&&!!ArrayBuffer.isView;function wa(s,e){if(s===e)return true;if(s&&e&&typeof s=="object"&&typeof e=="object"){if(s.constructor!==e.constructor)return false;var t,i,r;if(Array.isArray(s)){t=s.length;if(t!=e.length)return false;for(i=t;i--!==0;)if(!wa(s[i],e[i]))return false;return true}var o;if(fT&&s instanceof Map&&e instanceof Map){if(s.size!==e.size)return false;o=s.entries();while(!(i=o.next()).done)if(!e.has(i.value[0]))return false;o=s.entries();while(!(i=o.next()).done)if(!wa(i.value[1],e.get(i.value[0])))return false;return true}if(gT&&s instanceof Set&&e instanceof Set){if(s.size!==e.size)return false;o=s.entries();while(!(i=o.next()).done)if(!e.has(i.value[0]))return false;return true}if(_T&&ArrayBuffer.isView(s)&&ArrayBuffer.isView(e)){t=s.length;if(t!=e.length)return false;for(i=t;i--!==0;)if(s[i]!==e[i])return false;return true}if(s.constructor===RegExp)return s.source===e.source&&s.flags===e.flags;if(s.valueOf!==Object.prototype.valueOf)return s.valueOf()===e.valueOf();if(s.toString!==Object.prototype.toString)return s.toString()===e.toString();r=Object.keys(s);t=r.length;if(t!==Object.keys(e).length)return false;for(i=t;i--!==0;)if(!Object.prototype.hasOwnProperty.call(e,r[i]))return false;if(pT&&s instanceof Element)return false;for(i=t;i--!==0;){if((r[i]==="_owner"||r[i]==="__v"||r[i]==="__o")&&s.$$typeof){continue}if(!wa(s[r[i]],e[r[i]]))return false}return true}return s!==s&&e!==e}wf.exports=function s(e,t){try{return wa(e,t)}catch(i){if((i.message||"").match(/stack|recursion/i)){console.warn("react-fast-compare cannot handle circular refs");return false}throw i}}});var Of=xe((aB,Sf)=>{"use strict";Sf.exports=(s,e=1,t)=>{t={indent:" ",includeEmptyLines:false,...t};if(typeof s!=="string"){throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof s}\``)}if(typeof e!=="number"){throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``)}if(typeof t.indent!=="string"){throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof t.indent}\``)}if(e===0){return s}const i=t.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return s.replace(i,t.indent.repeat(e))}});var If=xe(()=>{});var Mf=xe((cB,Pf)=>{"use strict";var Af=If();var Bf=/\s+at.*(?:\(|\s)(.*)\)?/;var OT=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/;var IT=typeof Af.homedir==="undefined"?"":Af.homedir();Pf.exports=(s,e)=>{e=Object.assign({pretty:false},e);return s.replace(/\\/g,"/").split("\n").filter(t=>{const i=t.match(Bf);if(i===null||!i[1]){return true}const r=i[1];if(r.includes(".app/Contents/Resources/electron.asar")||r.includes(".app/Contents/Resources/default_app.asar")){return false}return!OT.test(r)}).filter(t=>t.trim()!=="").map(t=>{if(e.pretty){return t.replace(Bf,(i,r)=>i.replace(r,r.replace(IT,"~")))}return t}).join("\n")}});var Uf=xe((hB,zf)=>{"use strict";var AT=Of();var BT=Mf();var PT=s=>s.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"");var Lf=class extends Error{constructor(e){if(!Array.isArray(e)){throw new TypeError(`Expected input to be an Array, got ${typeof e}`)}e=[...e].map(i=>{if(i instanceof Error){return i}if(i!==null&&typeof i==="object"){return Object.assign(new Error(i.message),i)}return new Error(i)});let t=e.map(i=>{return typeof i.stack==="string"?PT(BT(i.stack)):String(i)}).join("\n");t="\n"+AT(t,4);super(t);this.name="AggregateError";Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(const e of this._errors){yield e}}};zf.exports=Lf});var Sa=xe((dB,Nf)=>{"use strict";var MT=Uf();Nf.exports=async(s,e,{concurrency:t=Infinity,stopOnError:i=true}={})=>{return new Promise((r,o)=>{if(typeof e!=="function"){throw new TypeError("Mapper function is required")}if(!((Number.isSafeInteger(t)||t===Infinity)&&t>=1)){throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${t}\` (${typeof t})`)}const n=[];const a=[];const l=s[Symbol.iterator]();let u=false;let c=false;let m=0;let d=0;const h=()=>{if(u){return}const p=l.next();const y=d;d++;if(p.done){c=true;if(m===0){if(!i&&a.length!==0){o(new MT(a))}else{r(n)}}return}m++;(async()=>{try{const _=await p.value;n[y]=await e(_,y);m--;h()}catch(_){if(i){u=true;o(_)}else{a.push(_);m--;h()}}})()};for(let p=0;p<t;p++){h();if(c){break}}})}});var ft={};Be(ft,{FragmentPrecision:()=>Pa,ImageFormat:()=>Er,OptionType:()=>F,RenderType:()=>Tt,RendererType:()=>Ne,UniformType:()=>ge});var Tt,Er,F,ge,Ne,Pa;var Rt=g(()=>{Tt={IMAGE:"image",DATAURL:"data-url",BUFFER:"buffer",BLOB:"blob",MSBLOB:"ms-blob"};Er={PNG:"image/png",JPEG:"image/jpeg",RAW:"raw"};F=(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})(F||{});ge=(y=>{y["SAMPLER2D"]="sampler2d";y["INT"]="i";y["INT1"]="1i";y["INT2"]="2i";y["INT3"]="3i";y["INT4"]="4i";y["FLOAT"]="f";y["FLOAT1"]="1f";y["FLOAT2"]="2f";y["FLOAT_VECTOR2"]="2fv";y["FLOAT3"]="3f";y["FLOAT4"]="4f";y["MAT3"]="mat3";y["MAT3FV"]="mat3fv";y["MAT4"]="mat4";return y})(ge||{});Ne=(t=>{t["WEBGL"]="webgl";t["CANVAS"]="canvas";return t})(Ne||{});Pa=(i=>{i["High"]="highp";i["Medium"]="mediump";i["Low"]="lowp";return i})(Pa||{})});var nn,Qf;var eg=g(()=>{nn=()=>document.createElement("canvas");Qf=(s,e)=>{const t=e||nn();t.width=s.width;t.height=s.height;const i=t.getContext("2d");if(!i){throw new Error("Cannot render context")}i.clearRect(0,0,t.width,t.height);i.drawImage(s,0,0,s.width,s.height);return t}});var Vs;var Yc=g(()=>{Vs=class{constructor(e,t,i){this.width=e;this.height=t;this.data=i}}});var tg={};Be(tg,{glGet:()=>Ma,webUtils:()=>ZT});var Ma,YT,JT,$T,ZT;var ig=g(()=>{eg();qt();Yc();Ma=s=>{const e={preserveDrawingBuffer:true};return s.getContext("webgl",e)||s.getContext("experimental-webgl",e)};YT=()=>{const s=nn();const e=Ma(s);const t=e.getParameter(e.MAX_TEXTURE_SIZE);const i=e.getExtension("WEBGL_lose_context");if(i){i.loseContext()}Ce(s);return t};JT=(s,e)=>{if(e instanceof Vs){s.texImage2D(s.TEXTURE_2D,0,s.RGBA,e.width,e.height,0,s.RGBA,s.UNSIGNED_BYTE,e.data)}else{const t=Qf(e);s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t);Ce(t)}};$T=s=>Boolean(s.tagName&&s.tagName.toUpperCase()==="IMG");ZT={isSupported:()=>Boolean(Ma(nn())),isCanvas:s=>s.constructor.name==="Canvas"||Boolean(s.tagName&&s.tagName.toUpperCase()==="CANVAS"),isImage:$T,Image:typeof window!=="undefined"?window.Image:void 0,glMaxTexture:YT,glGet:Ma,createCanvas:nn,glResize(s,e){return s},glTexImage:JT}});var rg,qe,js,Jc,sg;var ii=g(()=>{Rt();if(true){rg=(ig(),pt(tg)).webUtils}if(false){rg=null.serverUtils}qe=rg;js=s=>s._type==="webgl";Jc=s=>Boolean(s&&"tagName"in s&&s.tagName&&s.tagName.toUpperCase()==="CANVAS");sg=s=>Boolean("tagName"in s&&s.tagName.toUpperCase()==="IMG")});var La,og;var ng=g(()=>{La=class{static head(e){return e[0]}static tail(e){return e.slice(1)}static last(e){return e[e.length-1]}static init(e){return e.slice(0,e.length-1)}static remove(e,t){return e.filter((i,r,o)=>!t(i,r,o))}static findIndex(e,t){for(let i=0;i<e.length;i++){if(t(e[i])){return i}}return-1}static find(e,t){for(let i=0;i<e.length;i++){if(t(e[i])){return e[i]}}return void 0}static flatten(e){return e.reduce(function(t,i){return t.concat(Array.isArray(i)?La.flatten(i):i)},[])}static range(e,t){const i=[];if(t>e){for(let r=e;r<t;r++){i.push(r)}}return i}static repeat(e,t){const i=[];for(let r=0;r<t;r++){i[r]=e}return i}static zip(e,t){const i=Math.min(e.length,t.length);const r=[];for(let o=0;o<i;o++){r[o]=[e[o],t[o]]}return r}};og=La});var Qi,QT,It;var Hs=g(()=>{Qi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";QT={encode(s){let e="";let t;let i;let r;let o;let n;let a;let l;let u=0;do{t=s[u++];i=s[u++];r=s[u++];o=t>>2;n=(t&3)<<4|i>>4;a=(i&15)<<2|r>>6;l=r&63;if(isNaN(i)){a=l=64}else if(isNaN(r)){l=64}e=e+Qi.charAt(o)+Qi.charAt(n)+Qi.charAt(a)+Qi.charAt(l);t=i=r="";o=n=a=l=""}while(u<s.length);return e},decode(s){let e;let t;let i;let r;let o;let n;let a;let l=0;const u=[];const c=/[^A-Za-z0-9+/=]/g;if(c.exec(s)){throw new Error("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding.")}s=s.replace(/[^A-Za-z0-9+/=]/g,"");do{r=Qi.indexOf(s.charAt(l++));o=Qi.indexOf(s.charAt(l++));n=Qi.indexOf(s.charAt(l++));a=Qi.indexOf(s.charAt(l++));e=r<<2|o>>4;t=(o&15)<<4|n>>2;i=(n&3)<<6|a;u.push(e);if(n!==64){u.push(t)}if(a!==64){u.push(i)}e=t=i="";r=o=n=a=""}while(l<s.length);return u}};It=QT});var kr,$c,T;var ri=g(()=>{ii();ng();Hs();kr=class{static mapRange(e,t,i){return(e-t.getMin())*i.getLength()/t.getLength()+i.getMin()}static isPlainObject(e){if(typeof e!=="object"||!e){return false}if(typeof Object.getPrototypeOf==="function"){const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}return Object.prototype.toString.call(e)==="[object Object]"}static isMobile(){if(typeof navigator==="undefined")return false;const e=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(e)||/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(e.substr(0,4))}static isBrowser(){return typeof window!=="undefined"}static values(e){const t=[];for(const i in e){t.push(e[i])}return t}static generateUUID(){let e=new Date().getTime();if(true){if(typeof window.performance!=="undefined"&&typeof window.performance.now==="function"){e+=window.performance.now()}}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const i=(e+Math.random()*16)%16|0;e=Math.floor(e/16);return(t==="x"?i:i&3|8).toString(16)})}static resizeVectorToFit(e,t){const i=Math.min(t.x/e.x,t.y/e.y);const r=e.clone().multiply(i);return r}static resizeVectorToFill(e,t){const i=e.x/e.y;const r=t.x/t.y;if(i>r){return t.clone().set(t.y*i,t.y)}return t.clone().set(t.x,t.x/i)}static isExtendable(e){return typeof e!=="undefined"&&e!==null&&(typeof e==="object"||typeof e==="function")}static defaults(e,...t){const i={};for(const r in e){i[r]=e[r]}for(let r=0;r<t.length;r++){const o=t[r];for(const n in o){if(typeof i[n]==="undefined"){i[n]=o[n]}}}return i}static deepMerge(e,...t){const i=(r,o)=>{if(o===void 0){return i(null,r)}if(Array.isArray(o)){return[...o]}if(!kr.isPlainObject(o)){return o}if(!kr.isPlainObject(r)){return{...o}}const n={...r};Object.keys(o).forEach(a=>{const l=o[a];if(l===void 0){return}n[a]=i(r[a],l)});return n};return t.reduce(i,e)}static deepDefaults(e,...t){const i=[...t].reverse();return kr.deepMerge(...i,e)}static deepClone(e){const t={};for(const i in e){if(kr.isExtendable(e[i])){t[i]=kr.deepClone(e[i])}else{t[i]=e[i]}}return t}static extend(e,...t){const i={};for(const r in e){i[r]=e[r]}for(let r=0;r<t.length;r++){const o=t[r];for(const n in o){i[n]=o[n]}}return i}static clone(e){return this.extend({},e)}static getUUID(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;const i=e==="x"?t:t&3|8;return i.toString(16)})}static createCanvas(){return qe.createCanvas()}static isPowerOfTwo(e){return(e.x&e.x-1)===0&&(e.y&e.y-1)===0}static nextLowestPOT(e){for(let t=1;t<32;t<<=1){e|=e>>t}return e-(e>>1)}static nextHighestPOT(e){e--;for(let t=1;t<32;t<<=1){e|=e>>t}return e+1}static moveArrayItem(e,t,i){if(i>=e.length){let r=i-e.length;while(r--+1){e.push(void 0)}}e.splice(i,0,e.splice(t,1)[0])}static ensureCanvasDimensions(e,t){if(e.width!==t.x||e.height!==t.y){e.width=t.x;e.height=t.y;return true}return false}static byteArrayToString(e){return e.map(t=>String.fromCharCode(t)).join("")}static clamp(e,t,i){return Math.max(t,Math.min(e,i))}static wildCardMatch(e,t){return new RegExp(`^${t.split("*").join(".*")}$`).test(e)}static flipObject(e){const t={};for(const i in e){t[e[i]]=i}return t}static ISODateString(e){function t(i){return i<10?`0${i}`:i}return`${e.getUTCFullYear()}-${t(e.getUTCMonth()+1)}-${t(e.getUTCDate())}T${t(e.getUTCHours())}:${t(e.getUTCMinutes())}:${t(e.getUTCSeconds())}Z`}static getCrossOriginValue(e){if(!e){return"anonymous"}if(e==="none"){return void 0}return e}static invariant(e,t){if(!e){const i=new Error(t);throw i}}static executePromises(e){const t=e.length;let i=0;const r=[];const o=[];return new Promise((n,a)=>{const l=()=>{i++;if(i>=t){if(o.length<=0){n(r)}else{a(o)}}};const u=m=>{r.push(m);l()};const c=m=>{o.push(m);l()};e.forEach(m=>{m.then(u).catch(c)})})}};$c=kr;O($c,"Array",og);T=$c});var eR,ag,tR,iR,lg,Zc,I;var Kt=g(()=>{ri();eR=[{name:"trace",type:"trace",background:"#EEEEEE",color:"#AAAAAA"},{name:"info",type:"log",background:"#BDE5F8",color:"#00529B"},{name:"warn",type:"warn",background:"#FEEFB3",color:"#9F6000"},{name:"error",type:"error",background:"#FFBABA",color:"#D8000C"},{name:"log",type:"log",background:"#EEEEEE",color:"#1f4f6b"}];ag=()=>console&&console.group&&console.groupCollapsed&&console.groupEnd;tR=()=>typeof navigator!=="undefined"&&navigator.userAgent.match(/Gecko|WebKit/i)&&!navigator.userAgent.match(/Trident/);iR=(s,e)=>{if(true){return["background: #2D7BFF; line-height: 20px; padding: 4px 0","background: #2B2B2B; color: white; line-height: 20px; padding: 4px 0","background: #2D7BFF; line-height: 20px; padding: 4px 0",`background: ${s}; color: ${e}; line-height: 20px; padding: 4px 0; font-weight: bold`,"background: #2B2B2B; color: white; line-height: 20px; padding: 4px 0","background: #2D7BFF; line-height: 20px; padding: 4px 0"]}if(false){const t=null;return[t.bgHex("#2D7BFF"),t.bgHex("#2B2B2B").white,t.bgHex("#2D7BFF"),t.bgHex(s).hex(e).bold,t.bgHex("#2B2B2B").white,t.bgHex("#2D7BFF")]}};lg=class{constructor(e="warn",t=eR){this._levels=[...t];this._maxLevel=this.getLevelIndexByName(e);this._consoleFuncs={trace:(...i)=>{if(ag()){console.groupCollapsed(...i);console.trace();console.groupEnd()}else{console.trace(...i)}}};this._levels.forEach(({name:i})=>{this[i]=(r,...o)=>{this._log(i,r,...o)}})}getLevelIndexByName(e){return T.Array.findIndex(this._levels,t=>t.name===e)}getLevelObjectByName(e){return T.Array.find(this._levels,t=>t.name===e)}canLog(e){const t=this.getLevelIndexByName(e);if(t<0){return false}return t>=this._maxLevel}setLevel(e){const t=this.getLevelIndexByName(e);if(t<0){return}this._maxLevel=t}_log(e,t,...i){const r=this.getLevelObjectByName(e);if(!r||!this.canLog(e)){return}const{name:o,type:n,background:a,color:l}=r;const u=i.filter(h=>h!==void 0).map(h=>{if(h.toObject){return JSON.parse(JSON.stringify(h.toObject()))}return h});const c=this._consoleFuncs[n]||console[n]?(...h)=>console[n](...h):(...h)=>console.log(...h);const m=u.length;const d=iR(a,l);if(true){if(!tR()){const h=u.length;if(h<=0){c(`PhotoEditorSDK | ${t} `);return}if(h===1&&typeof u[0]==="string"){c(`PhotoEditorSDK | ${t} | ${u[0]}`);return}c(`PhotoEditorSDK | ${t} | `,...u);return}if(m<=0){c(`%c %c PhotoEditorSDK %c %c ${t} %c %c `,...d);return}if(m===1&&typeof u[0]==="string"){c(`%c %c PhotoEditorSDK %c %c ${t} %c ${u[0]} %c `,...d);return}if(ag()){console.groupCollapsed(`%c %c PhotoEditorSDK %c %c ${t} %c`,...T.Array.init(d));c(...u);console.groupEnd()}else{c(`%c %c PhotoEditorSDK %c %c ${t} %c`,...T.Array.init(d),...u)}}if(false){const h=`${d[0](" ")} ${d[1]("PhotoEditorSDK")} ${d[2](" ")} ${d[3](t)}`;const p=`${d[5](" ")} `;if(m<=0){c(`${h} ${p}`);return}if(m===1&&typeof u[0]==="string"){c(`${h} ${d[4](u[0])} ${p}`);return}if(ag()){console.groupCollapsed(`${h} ${p}`);c(...u);console.groupEnd()}else{c(`${h} ${p}`,...u)}}}image(e="",t){if(true){let i=new window.Image;const r=()=>{const{width:o}=i;const{height:n}=i;if(e){console.log(e)}console.log(`%c+`,` font-size: 1px; padding: 0px ${Math.floor(o/2)}px; line-height: ${n}px; background: url(${i.src}); color: transparent; background-repeat: no-repeat; background-size: ${o}px ${n}px;`)};i.onload=r;if(t instanceof window.HTMLCanvasElement){i.src=t.toDataURL()}else if(t instanceof window.Image){i=t;r()}else if(typeof t==="string"){i.src=t}else{this.log(e,t)}return i}}texture(e="",t){if(true){if(!t){this.log(e,"texture: null or undefined");return}const i=t.getBaseTexture();const r=i.getRenderers();const o=T.Array.find(r,l=>l&&l.constructor.type==="webgl");const{width:n,height:a}=i.getFrame();if(o){const l=o.getContext();const u=i.getGLTextureForRenderer(o);this.logGlTexture(l,u,n,a,e)}else{Zc.image(e,i.getSource())}}}logGlTexture(e,t,i=150,r=150,o){if(true){e.bindTexture(e.TEXTURE_2D,t);const n=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,n);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0);const a=new Uint8Array(i*r*4);e.readPixels(0,0,i,r,e.RGBA,e.UNSIGNED_BYTE,a);e.deleteFramebuffer(n);const l=document.createElement("canvas");l.width=i;l.height=r;const u=l.getContext("2d");const c=u.createImageData(i,r);c.data.set(a);u.putImageData(c,0,0);return Zc.image(o,l)}}};Zc=new lg("warn");I=Zc});var st;var qs=g(()=>{st={load(s,e={cors:true,value:"anonymous"}){const t=()=>{if(true){return Promise.resolve([s,s])}if(false){if(s.substr(0,5)==="data:"){return Promise.resolve([s,s])}if(!s.match(/^(https?|ftp|file):\/\//)){return readFileAsync(s)}return loadRemoteFile(s)}};return t().then(([i,r])=>{return this._createAndLoadImage(i,r,e)})},loadImage(s,e={cors:true,value:"anonymous"}){if(true){return this._loadWithoutExif(s,e)}return this.load(s,e)},_loadWithoutExif(s,e={cors:true,value:"anonymous"}){return new Promise((t,i)=>{const r=new window.Image;r.addEventListener("load",()=>{t(r)});r.addEventListener("error",()=>{i(new Error(`Failed to load image at ${s}`))});if(e.cors){r.crossOrigin=e.value}r.src=s})},_createAndLoadImage(s,e,t={cors:true,value:"anonymous"}){return new Promise((i,r)=>{if(true){const o=this._loadWithoutExif(e,t).then(a=>i(a));const n=new Promise((a,l)=>{this._loadAsDataURL(e,t).then(u=>{const c=new window.Image;c.addEventListener("load",()=>{a(c)});c.src=u;c.rawSource=u}).catch(u=>{o.then(c=>a(c))})});if(this._stringEndsWith(e,".svg")){return o.then(a=>i(a))}return n.then(a=>i(a))}if(false){const o=null;const n=new o.Image;n.src=e;n.rawSource=e;n.filePath=s;i(n)}})},_stringEndsWith(s,e,t=s.length){if(t===void 0||t>s.length){t=s.length}return s.substring(t-e.length,t)===e},_loadAsDataURL(s,e={cors:true,value:"anonymous"}){if(true){return new Promise((t,i)=>{const r=new XMLHttpRequest;r.onload=function(){const o=new FileReader;o.onloadend=function(){if(o.error){i(o.error)}t(o.result)};o.readAsDataURL(r.response)};r.open("GET",s);r.responseType="blob";r.withCredentials=e.cors&&e.value==="use-credentials";r.send()})}return Promise.reject(new Error(`Loading images as data urls is only supported in browser environments.`))},loadXHR(s,e){return new Promise((t,i)=>{let r;if(window.XDomainRequest){r=new window.XDomainRequest;if(e)r.overrideMimeType(e);r.onload=function(){t(r)};r.onerror=function(o){i(o)}}else if(window.XMLHttpRequest){r=new window.XMLHttpRequest;if(e)r.overrideMimeType(e);r.onreadystatechange=function(o){if(r.readyState===4){if(r.status===200){t(r)}else{i(new Error(`HTTP Status ${r.status}`))}}}}r.open("GET",s,true);r.send()})}}});var cg=xe((iM,ug)=>{"use strict";function rR(s,e){return Object.prototype.hasOwnProperty.call(s,e)}ug.exports=function(s,e,t,i){e=e||"&";t=t||"=";var r={};if(typeof s!=="string"||s.length===0){return r}var o=/\+/g;s=s.split(e);var n=1e3;if(i&&typeof i.maxKeys==="number"){n=i.maxKeys}var a=s.length;if(n>0&&a>n){a=n}for(var l=0;l<a;++l){var u=s[l].replace(o,"%20"),c=u.indexOf(t),m,d,h,p;if(c>=0){m=u.substr(0,c);d=u.substr(c+1)}else{m=u;d=""}h=decodeURIComponent(m);p=decodeURIComponent(d);if(!rR(r,h)){r[h]=p}else if(Array.isArray(r[h])){r[h].push(p)}else{r[h]=[r[h],p]}}return r}});var dg=xe((rM,hg)=>{"use strict";var an=function(s){switch(typeof s){case"string":return s;case"boolean":return s?"true":"false";case"number":return isFinite(s)?s:"";default:return""}};hg.exports=function(s,e,t,i){e=e||"&";t=t||"=";if(s===null){s=void 0}if(typeof s==="object"){return Object.keys(s).map(function(r){var o=encodeURIComponent(an(r))+t;if(Array.isArray(s[r])){return s[r].map(function(n){return o+encodeURIComponent(an(n))}).join(e)}else{return o+encodeURIComponent(an(s[r]))}}).join(e)}if(!i)return"";return encodeURIComponent(an(i))+t+encodeURIComponent(an(s))}});var mg=xe(ln=>{"use strict";ln.decode=ln.parse=cg();ln.encode=ln.stringify=dg()});function un(s){typeof s=="string"&&(s=Xs(s));var e=function(t,i,r){var o=t.auth,n=t.hostname,a=t.protocol||"",l=t.pathname||"",u=t.hash||"",c=t.query||"",m=false;o=o?encodeURIComponent(o).replace(/%3A/i,":")+"@":"",t.host?m=o+t.host:n&&(m=o+(~n.indexOf(":")?"["+n+"]":n),t.port&&(m+=":"+t.port)),c&&typeof c=="object"&&(c=i.encode(c));var d=t.search||c&&"?"+c||"";return a&&a.substr(-1)!==":"&&(a+=":"),t.slashes||(!a||r.test(a))&&m!==false?(m="//"+(m||""),l&&l[0]!=="/"&&(l="/"+l)):m||(m=""),u&&u[0]!=="#"&&(u="#"+u),d&&d[0]!=="?"&&(d="?"+d),{protocol:a,host:m,pathname:l=l.replace(/[?#]/g,encodeURIComponent),search:d=d.replace("#","%23"),hash:u}}(s,rh.default,sR);return""+e.protocol+e.host+e.pathname+e.search+e.hash}function pg(s,e){var t=typeof s=="string"?Xs(s):s;s=typeof s=="object"?un(s):s;var i=Xs(e),r="";t.protocol&&!t.slashes&&(r=t.protocol,s=s.replace(t.protocol,""),r+=e[0]==="/"||s[0]==="/"?"/":""),r&&i.protocol&&(r="",i.slashes||(r=i.protocol,e=e.replace(i.protocol,"")));var o=s.match(oR);o&&!i.protocol&&(s=s.substr((r=o[1]+(o[2]||"")).length),/^\/\/[^/]/.test(e)&&(r=r.slice(0,-1)));var n=new URL(s,ih+"/"),a=new URL(e,n).toString().replace(ih,""),l=i.protocol||t.protocol;return l+=t.slashes||i.slashes?"//":"",!r&&l?a=a.replace(eh,l):r&&(a=a.replace(eh,"")),nR.test(a)||~e.indexOf(".")||s.slice(-1)==="/"||e.slice(-1)==="/"||a.slice(-1)!=="/"||(a=a.slice(0,-1)),r&&(a=r+(a[0]==="/"?a.substr(1):a)),a}function Ks(){}function Xs(s,e,t){if(e===void 0&&(e=false),t===void 0&&(t=false),s&&typeof s=="object"&&s instanceof Ks)return s;var i=(s=s.trim()).match(aR);s=i?i[1].replace(/\\/g,"/")+i[2]:s.replace(/\\/g,"/"),cR.test(s)&&s.slice(-1)!=="/"&&(s+="/");var r=!/(^javascript)/.test(s)&&s.match(lR),o=uR.test(s),n="";r&&(Qc.test(r[1])||(n=r[1].toLowerCase(),s=""+r[2]+r[3]),r[2]||(o=false,Qc.test(r[1])?(n=r[1],s=""+r[3]):s="//"+r[3]),r[2].length!==3&&r[2].length!==1||(n=r[1],s="/"+r[3]));var a,l=(i?i[1]:s).match(/^https?:\/\/[^/]+(:[0-9]+)(?=\/|$)/),u=l&&l[1],c=new Ks,m="",d="";try{a=new URL(s)}catch(y){m=y,n||t||!/^\/\//.test(s)||/^\/\/.+[@.]/.test(s)||(d="/",s=s.substr(1));try{a=new URL(s,ih)}catch(_){return c.protocol=n,c.href=n,c}}c.slashes=o&&!d,c.host=a.host===th?"":a.host,c.hostname=a.hostname===th?"":a.hostname.replace(/(\[|\])/g,""),c.protocol=m?n||null:a.protocol,c.search=a.search.replace(/\\/g,"%5C"),c.hash=a.hash.replace(/\\/g,"%5C");var h=s.split("#");!c.search&&~h[0].indexOf("?")&&(c.search="?"),c.hash||h[1]!==""||(c.hash="#"),c.query=e?rh.default.decode(a.search.substr(1)):c.search.substr(1),c.pathname=d+(r?function(y){return y.replace(/['^|`]/g,function(_){return"%"+_.charCodeAt().toString(16).toUpperCase()}).replace(/((?:%[0-9A-F]{2})+)/g,function(_,f){try{return decodeURIComponent(f).split("").map(function(v){var b=v.charCodeAt();return b>256||/^[a-z0-9]$/i.test(v)?v:"%"+b.toString(16).toUpperCase()}).join("")}catch(v){return f}})}(a.pathname):a.pathname),c.protocol==="about:"&&c.pathname==="blank"&&(c.protocol="",c.pathname=""),m&&s[0]!=="/"&&(c.pathname=c.pathname.substr(1)),n&&!Qc.test(n)&&s.slice(-1)!=="/"&&c.pathname==="/"&&(c.pathname=""),c.path=c.pathname+c.search,c.auth=[a.username,a.password].map(decodeURIComponent).filter(Boolean).join(":"),c.port=a.port,u&&!c.host.endsWith(u)&&(c.host+=u,c.port=u.slice(1)),c.href=d?""+c.pathname+c.search+c.hash:un(c);var p=/^(file)/.test(c.href)?["host","hostname"]:[];return Object.keys(c).forEach(function(y){~p.indexOf(y)||(c[y]=c[y]||null)}),c}var rh,sR,eh,th,ih,oR,nR,Qc,aR,lR,uR,cR;var fg=g(()=>{rh=Cr(mg(),1);sR=/https?|ftp|gopher|file/;eh="http://";th="w.w";ih=eh+th;oR=/^([a-z0-9.+-]*:\/\/\/)([a-z0-9.+-]:\/*)?/i;nR=/https?|ftp|gopher|file/;Ks.prototype.parse=Xs,Ks.prototype.format=un,Ks.prototype.resolve=pg,Ks.prototype.resolveObject=pg;Qc=/^https?|ftp|gopher|file/;aR=/^(.*?)([#?].*)/;lR=/^([a-z0-9.+-]*:)(\/{0,3})(.*)/i;uR=/^([a-z0-9.+-]*:)?\/\/\/*/i;cR=/^([a-z0-9.+-]*:)(\/{0,2})\[(.*)\]$/i});var hR,cn,At;var Ys=g(()=>{fg();hR=5e3;cn=typeof window!=="undefined"?window:global;At=class{constructor(e){this._url=e;this._parsedUrl=Xs(this._url,true)}_isJSONPRequest(){const{query:e}=this._parsedUrl;for(const t in e){const i=e[t];if(i==="?"){return true}}return false}load(){if(this._isJSONPRequest()){return this._loadJSONP()}return this._loadJSON()}_loadJSON(){return new Promise((e,t)=>{let i;if(cn.XDomainRequest){i=new cn.XDomainRequest;i.onload=function(){const r=JSON.parse(i.responseText);e(r)};i.onerror=function(r){t(r)};i.open("GET",this._url,true);i.send()}else if(cn.XMLHttpRequest){i=new XMLHttpRequest;i.onreadystatechange=function(r){if(i.readyState===4){if(i.status===200){const o=JSON.parse(i.responseText);e(o)}else{t(new Error(`HTTP Status ${i.status}`))}}};i.open("GET",this._url,true);i.send()}})}_loadJSONP(){let e=false;let t=false;const i=`pesdk${Math.round(Math.random()*99999999999999)}`;return new Promise((r,o)=>{const n=this._createJSONPNode(i);cn[i]=a=>{this._removeJSONPNode(n);if(!e){t=true;r(a)}};cn.setTimeout(()=>{if(!t){this._removeJSONPNode(n);e=true;o(new Error("Timeout of 5 seconds exceeded."))}},hR)})}_createJSONPNode(e){const t=this._buildJSONPUrl(e);const i=document.querySelector("head");const r=document.createElement("script");r.src=t;i.appendChild(r);return r}_removeJSONPNode(e){e.parentNode.removeChild(e)}_buildJSONPUrl(e){const{query:t}=this._parsedUrl;let i=null;for(const r in t){if(t[r]==="?"){i=r;break}}delete this._parsedUrl.search;t[i]=e;return un(this._parsedUrl)}}});var sh={};Be(sh,{ImageLoader:()=>st,JSONLoader:()=>At});var gg=g(()=>{qs();Ys()});var ot,R;var Fr=g(()=>{ot=class{constructor(e,t,i,r=1){this.r=e;this.g=t;this.b=i;this.a=r}toRGBA(){const e=[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255),this.a.toFixed(2)];return`rgba(${e.join(",")})`}set(e,t,i,r=this.a){this.r=e;this.g=t;this.b=i;this.a=r;return this}toRGB(){return[Math.round(this.r*255),Math.round(this.g*255),Math.round(this.b*255)]}toHex(){const e=[this._componentToHex(Math.round(this.r*255)),this._componentToHex(Math.round(this.g*255)),this._componentToHex(Math.round(this.b*255))];return`#${e.join("")}`}toGLColor(){return[this.r,this.g,this.b,this.a]}toArray(){return this.toGLColor()}toRGBGLColor(){return[this.r,this.g,this.b]}toHSV(){const e=Math.max(this.r,this.g,this.b);const t=Math.min(this.r,this.g,this.b);let i;let r;const o=e;const n=e-t;r=e===0?0:n/e;if(e===t){i=0}else{switch(e){case this.r:i=(this.g-this.b)/n;if(this.g<this.b){i+=6}break;case this.g:i=(this.b-this.r)/n+2;break;case this.b:i=(this.r-this.g)/n+4;break}i/=6}return[i,r,o]}fromHSV(e,t,i){this.copy(ot.fromHSV(e,t,i));return this}static fromHSV(e,t,i,r=1){let[o,n,a]=[];const l=Math.floor(e*6);const u=e*6-l;const c=i*(1-t);const m=i*(1-u*t);const d=i*(1-(1-u)*t);switch(l%6){case 0:o=i;n=d;a=c;break;case 1:o=m;n=i;a=c;break;case 2:o=c;n=i;a=d;break;case 3:o=c;n=m;a=i;break;case 4:o=d;n=c;a=i;break;case 5:o=i;n=c;a=m;break}return new ot(o,n,a,r)}static fromArray(e){return new ot(e[0],e[1],e[2],e[3])}static fromHex(e){const[t,i,r]=e.match(/[0-9A-fa-f]{1,2}/g);return new ot(parseInt(t,16)/255,parseInt(i,16)/255,parseInt(r,16)/255,1)}clone(){return new ot(this.r,this.g,this.b,this.a)}cloneRGB(){return new ot(this.r,this.g,this.b,1)}add(e){this.r+=e.r;this.g+=e.g;this.b+=e.b;this.a+=e.a;return this}minus(e){this.r-=e.r;this.g-=e.g;this.b-=e.b;this.a-=e.a;return this}multiplyScalar(e){this.r*=e;this.g*=e;this.b*=e;this.a*=e;return this}divideScalar(e){this.r/=e;this.g/=e;this.b/=e;this.a/=e;return this}clamp(e,t){this.r=Math.min(Math.max(this.r,e),t);this.g=Math.min(Math.max(this.g,e),t);this.b=Math.min(Math.max(this.b,e),t);this.a=Math.min(Math.max(this.a,e),t);return this}mix(e,t){this.r=(1-t)*this.r+t*e.r;this.g=(1-t)*this.g+t*e.g;this.b=(1-t)*this.b+t*e.b;this.a=(1-t)*this.a+t*e.a;return this}copy(e){this.r=e.r;this.g=e.g;this.b=e.b;this.a=e.a;return this}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}_componentToHex(e){const t=e.toString(16);return t.length===1?`0${t}`:t}toString(){return`Color(${this.r}, ${this.g}, ${this.b}, ${this.a})`}static get TRANSPARENT(){return new ot(0,0,0,0)}static get WHITE(){return new ot(1,1,1,1)}static get BLACK(){return new ot(0,0,0,1)}static get RED(){return new ot(1,0,0,1)}static get BLUE(){return new ot(0,0,1,1)}static get GREEN(){return new ot(0,1,0,1)}};R=ot});var dR,_g,nt;var Js=g(()=>{Kt();dR=12;_g=class{constructor(){this._maxListeners=dR;this._events={};this._pipeDestinations=[]}pipeEvents(e){this._pipeDestinations.push(e)}unpipeEvents(e){const t=this._pipeDestinations.indexOf(e);if(t===-1){return}this._pipeDestinations.splice(t,1)}on(e,t){if(typeof e==="undefined"){throw new Error(`Invalid event type: \`${e}\``)}if(typeof t!=="function"){throw new TypeError}const i=this._events[e]||(this._events[e]=[]);if(i.indexOf(t)!==-1){return this}i.push(t);if(this._maxListeners&&i.length>this._maxListeners){I.warn("EventEmitter",`Possible memory leak detected, added ${i.length} \`${e}\` listeners (current limit is ${this._maxListeners})`);if(typeof console!=="undefined"){console.trace()}}return this}once(e,t){if(typeof e==="undefined"){throw new Error(`Invalid event type: \`${e}\``)}const i=this;function r(){i.off(e,r);t.apply(null,arguments)}return this.on(e,r)}off(e,...t){if(typeof e==="undefined"){throw new Error(`Invalid event type: \`${e}\``)}if(t.length===0){this._events[e]=null;return this}const i=t[0];if(typeof i!=="function"){throw new TypeError}const r=this._events[e];if(!r||!r.length){return this}const o=r.indexOf(i);if(o===-1){return this}r.splice(o,1);return this}emit(e,...t){if(typeof e==="undefined"){throw new Error(`Invalid event type: \`${e}\``)}this._pipeDestinations.forEach(r=>{r.emit(e,...t)});const i=this._events[e];if(!i||!i.length){return false}i.slice(0).forEach(r=>r.apply(null,t));return true}setMaxListeners(e){if(parseInt(e,10)!==e){throw new TypeError}this._maxListeners=e}};nt=_g});var Sr;var oh=g(()=>{Kt();qt();Sr={checkFramebufferStatus(s,e){const t=e.checkFramebufferStatus(e.FRAMEBUFFER);const i={[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT]:"Incomplete attachment",[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT]:"Missing attachment",[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS]:"Incomplete dimensions",[e.FRAMEBUFFER_UNSUPPORTED]:"Framebuffer unsupported"};if(t!==e.FRAMEBUFFER_COMPLETE){I.warn(s,`Framebuffer incomplete: ${i[t]}`)}},determineGPUName(s){let e=null;let t=null;if(!s){t=document.createElement("canvas");s=t.getContext("experimental-webgl")||t.getContext("webgl")}const i=s&&s.getExtension("WEBGL_debug_renderer_info");if(i){e=s.getParameter(i.UNMASKED_RENDERER_WEBGL);t&&t.remove()}Ce(t);return e},isGPUBlacklisted(s,e=null){return false}}});var za;var yg=g(()=>{za=s=>typeof s==="number"});var mR,Or,Ua,P;var Ti=g(()=>{yg();mR=s=>s instanceof P;Or=(s,e)=>{if(mR(s)){return{x:s.x,y:s.y}}return{x:s,y:za(e)?e:s}};Ua=(s,e)=>(t,i)=>{const{x:r,y:o}=Or(t,i);s.x=e(s.x,r);s.y=e(s.y,o);return s};P=class{constructor(e=0,t=0){this.add=Ua(this,(e,t)=>e+t);this.subtract=Ua(this,(e,t)=>e-t);this.divide=Ua(this,(e,t)=>e/t);this.multiply=Ua(this,(e,t)=>e*t);this.x=e;this.y=t}set(e,t){const{x:i,y:r}=Or(e,t);this.x=i;this.y=r;return this}clone(){return new P(this.x,this.y)}copy(e){this.x=e.x;this.y=e.y;return this}clamp(e,t){if(za(e)){e=new P(e,e)}if(za(t)){t=new P(t,t)}if(e){this.x=Math.max(e.x,this.x);this.y=Math.max(e.y,this.y)}if(t){this.x=Math.min(t.x,this.x);this.y=Math.min(t.y,this.y)}return this}dot(e,t){const{x:i,y:r}=Or(e,t);return this.x*i+this.y*r}equals(e,t){const{x:i,y:r}=Or(e,t);return i===this.x&&r===this.y}flip(){const e=this.x;this.x=this.y;this.y=e;return this}round(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this}ceil(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this}floor(){this.x|=0;this.y|=0;return this}abs(){this.x=Math.abs(this.x);this.y=Math.abs(this.y);return this}len(){return Math.sqrt(this.x*this.x+this.y*this.y)}min(){return Math.min(this.x,this.y)}max(){return Math.max(this.x,this.y)}toObject(){return{x:this.x,y:this.y}}toString(){return`Vector2({ x: ${this.x}, y: ${this.y} })`}roundDecimal(e){this.x=parseFloat(this.x.toFixed(e));this.y=parseFloat(this.y.toFixed(e));return this}asArray(e=false){if(e){return[this.y,this.x]}return[this.x,this.y]}static fromObject(e){return new P(e.x,e.y)}static get NULL(){return new P(0,0)}}});var gt;var nh=g(()=>{Ti();gt=class{constructor(){this.a=1;this.b=0;this.c=0;this.d=1;this.tx=0;this.ty=0;this.reset()}multiply(e){let t;let i;let r;let o;let n;let a;t=this.a*e.a+this.b*e.c;i=this.a*e.b+this.b*e.d;r=this.c*e.a+this.d*e.c;o=this.c*e.b+this.d*e.d;n=this.tx*e.a+this.ty*e.c+e.tx;a=this.tx*e.b+this.ty*e.d+e.ty;this.a=t;this.b=i;this.c=r;this.d=o;this.tx=n;this.ty=a;return this}applyToVector(e){const{x:t,y:i}=e;e=e.clone();e.x=this.a*t+this.c*i+this.tx;e.y=this.b*t+this.d*i+this.tx;return e}applyInverseToVector(e){const t=1/(this.a*this.d+this.c*-this.b);const{x:i,y:r}=e;e=e.clone();e.x=this.d*t*i+-this.c*t*r+(this.ty*this.c-this.tx*this.d)*t;e.y=this.a*t*r+-this.b*t*i+(-this.ty*this.a+this.tx*this.b)*t;return e}rectangleToCoordinates(e,t=new P(0,0)){const i=e.width*(1-t.x);const r=e.width*-t.x;const o=e.height*(1-t.y);const n=e.height*-t.y;const a=[];a.push(new P(this.a*r+this.c*n+this.tx,this.d*n+this.b*r+this.ty));a.push(new P(this.a*i+this.c*n+this.tx,this.d*n+this.b*i+this.ty));a.push(new P(this.a*i+this.c*o+this.tx,this.d*o+this.b*i+this.ty));a.push(new P(this.a*r+this.c*o+this.tx,this.d*o+this.b*r+this.ty));return a}reset(){this.a=1;this.b=0;this.c=0;this.d=1;this.tx=0;this.ty=0}toArray(){const e=[this.a,this.b,0,this.c,this.d,0,this.tx,this.ty,1];if(typeof Float32Array==="undefined"){return e}return new Float32Array(e)}toString(){return`Matrix({ a: ${this.a}, b: ${this.b}, c: ${this.c}, d: ${this.d}, tx: ${this.tx}, ty: ${this.ty} })`}static get IDENTITY(){return new gt}}});var _e;var ah=g(()=>{Ti();_e=class{constructor(e=0,t=0,i=0,r=0){this.x=0;this.y=0;this.width=0;this.height=0;this.x=e;this.y=t;this.width=i;this.height=r}set(e,t,i,r){this.x=e;this.y=t;this.width=i;this.height=r;return this}clone(){return new _e(this.x,this.y,this.width,this.height)}copy(e){this.x=e.x;this.y=e.y;this.width=e.width;this.height=e.height;return this}equals(e,t,i,r){if(e instanceof _e){return e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}return e===this.x&&t===this.y&&i===this.width&&r===this.height}translate(e,t){const{x:i,y:r}=Or(e,t);this.x+=i;this.y+=r;return this}scale(e,t){const{x:i,y:r}=Or(e,t);this.width*=i;this.height*=r;return this}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}getPosition(){return new P(this.x,this.y)}getSize(){return new P(this.width,this.height)}insetBy(e,t){this.x+=e;this.y+=t;this.width-=2*e;this.height-=2*t;return this}intersects(e){const t=new P(this.x,this.y);const i=new P(this.x+this.width,this.y+this.height);const r=new P(e.x,e.y);const o=new P(e.x+e.width,e.y+e.height);if(r.x>i.x||t.x>o.x||o.y<t.y||i.y<r.y){return false}return true}toString(){return`Rectangle({ x: ${this.x}, y: ${this.y}, width: ${this.width}, height: ${this.height} })`}static FromDiagonalPoints(e,t){let i=false;if(t.x-e.x<0){i=true}const r=i?t:e;const o=i?e:t;const n=o.x-r.x;const a=o.y-r.y;return new _e(r.x,r.y,n,a)}}});var $s,pR,er;var Le=g(()=>{Kt();Rt();Fr();Js();oh();nh();ah();Ti();ri();$s=2e3;pR=5;er=pR*4});var Ir;var Na=g(()=>{Le();Ir=class{constructor(){this._position=new P(0,0);this._scale=new P(1,1);this._pivot=new P(0,0);this._rotation=0;this._lastRotation=null;this._alpha=1;this._visible=true;this._worldTransform=new gt;this._parent=null;this._shaders=[];this._boundsNeedUpdate=true;this._bounds=new _e(0,0,1,1);this._localBoundsNeedUpdate=true;this._localBounds=new _e(0,0,1,1);this._filterRectangle=new _e(0,0,0,0)}renderWebGL(e){I.warn(this.constructor.name,"`renderWebGL` is abstract and not implemented in inherited class")}renderCanvas(e){I.warn(this.constructor.name,"`renderCanvas` is abstract and not implemented in inherited class")}updateTransform(){const e=this._parent?this._parent.getWorldTransform():gt.IDENTITY;const t=this._worldTransform;const i=Math.sin(this._rotation);const r=Math.cos(this._rotation);t.a=r*this._scale.x;t.b=i*this._scale.x;t.c=-i*this._scale.y;t.d=r*this._scale.y;t.tx=this._position.x;t.ty=this._position.y;if(this._pivot.x||this._pivot.y){t.tx-=this._pivot.x*t.a+this._pivot.y*t.c;t.ty-=this._pivot.x*t.b+this._pivot.y*t.d}t.multiply(e);this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true}addShader(e){this._shaders.push(e)}removeShader(e){const t=this._shaders.indexOf(e);if(t!==-1){this._shaders.splice(t,1);return true}return false}removeShaderAt(e){if(!this._shaders[e]){return false}this._shaders.splice(e,1);return true}getBounds(){return this._bounds.clone()}getPosition(){return this._position}setPosition(e,t){this._position.set(e,t);this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true}getScale(){return this._scale}setScale(e,t){this._scale.set(e,t);this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true}getPivot(){return this._pivot}setPivot(e,t){this._pivot.set(e,t);this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true}getRotation(){return this._rotation}setRotation(e){this._rotation=e;this._boundsNeedUpdate=true;this._localBoundsNeedUpdate=true}getAlpha(){return this._alpha}setAlpha(e){this._alpha=e}getWorldAlpha(){if(this._parent){return this._parent.getAlpha()*this._alpha}return this._alpha}getWorldTransform(){return this._worldTransform}getParent(){return this._parent}setParent(e){this._parent=e}getFilterRectangle(){return this._filterRectangle}setFilterRectangle(e){this._filterRectangle.copy(e)}isVisible(){return this._visible}setVisible(e){this._visible=e}}});var si;var Ga=g(()=>{Le();Na();si=class extends Ir{constructor(){super();this._children=[];this._filters=[]}addFilter(e){this._filters.push(e)}removeFilter(e){const t=this._filters.indexOf(e);if(t!==-1){this._filters.splice(t,1);return true}return false}setFilters(e){this._filters=e}addChild(e){const t=e.getParent();if(t instanceof si){t.removeChild(e)}e.setParent(this);this._children.push(e)}prependChild(e){const t=e.getParent();if(t instanceof si){t.removeChild(e)}e.setParent(this);this._children.unshift(e)}hasChild(e){const t=this._children.indexOf(e);return t!==-1}removeChild(e){const t=this._children.indexOf(e);if(t!==-1){this._children.splice(t,1);e.setParent(null)}else{I.info(this.constructor.name,"Tried to remove a child that does not exist")}}clearChildren(){this._children=[]}renderWebGL(e){if(!this._visible){return}const t=e.getFilterManager();if(this._filters&&this._filters.length){t.pushFilters(this,this._filters)}e.getCurrentObjectRenderer().start();this._renderWebGL(e);this._children.forEach(i=>{i.renderWebGL(e)});e.getCurrentObjectRenderer().flush();if(this._filters&&this._filters.length){t.popFilters()}e.getCurrentObjectRenderer().start()}_renderWebGL(e){}renderCanvas(e){if(!this._visible){return}const t=e.getFilterManager();if(this._filters&&this._filters.length){t.pushFilters(this,this._filters)}this._renderCanvas(e);this._children.forEach(i=>{i.renderCanvas(e)});if(this._filters&&this._filters.length){t.popFilters()}}_renderCanvas(e){}updateTransform(){super.updateTransform();this._children.forEach(e=>{e.updateTransform()})}getLocalBounds(){if(this._localBoundsNeedUpdate){this._localBoundsNeedUpdate=false}return this._localBounds.clone()}getBounds(){if(this._boundsNeedUpdate){this._boundsNeedUpdate=false}return this._bounds.clone()}getChildren(){return this._children}getFilters(){return this._filters}dispose(){}}});function vg(s,e,t,i,r,o){if(isNaN(o)||o<1){return}o|=0;var n=s.data;var a,l,u,c,m,d,h,p,y,_,f,v,b,w,B,x,C,W,N,K,Z,J,j,fe;var rt=o+o+1;var Xe=i-1;var Zt=r-1;var Q=o+1;var Ae=Q*(Q+1)/2;var ve=new xg;var be;var re=ve;for(u=1;u<rt;u++){re=re.next=new xg;if(u==Q)be=re}re.next=ve;var Fe=null;var Qe=null;h=d=0;var Wi=fR[o];var Vi=gR[o];for(l=0;l<r;l++){x=C=W=N=p=y=_=f=0;v=Q*(K=n[d]);b=Q*(Z=n[d+1]);w=Q*(J=n[d+2]);B=Q*(j=n[d+3]);p+=Ae*K;y+=Ae*Z;_+=Ae*J;f+=Ae*j;re=ve;for(u=0;u<Q;u++){re.r=K;re.g=Z;re.b=J;re.a=j;re=re.next}for(u=1;u<Q;u++){c=d+((Xe<u?Xe:u)<<2);p+=(re.r=K=n[c])*(fe=Q-u);y+=(re.g=Z=n[c+1])*fe;_+=(re.b=J=n[c+2])*fe;f+=(re.a=j=n[c+3])*fe;x+=K;C+=Z;W+=J;N+=j;re=re.next}Fe=ve;Qe=be;for(a=0;a<i;a++){n[d+3]=j=f*Wi>>Vi;if(j!==0){j=255/j;n[d]=(p*Wi>>Vi)*j;n[d+1]=(y*Wi>>Vi)*j;n[d+2]=(_*Wi>>Vi)*j}else{n[d]=n[d+1]=n[d+2]=0}p-=v;y-=b;_-=w;f-=B;v-=Fe.r;b-=Fe.g;w-=Fe.b;B-=Fe.a;c=h+((c=a+o+1)<Xe?c:Xe)<<2;x+=Fe.r=n[c];C+=Fe.g=n[c+1];W+=Fe.b=n[c+2];N+=Fe.a=n[c+3];p+=x;y+=C;_+=W;f+=N;Fe=Fe.next;v+=K=Qe.r;b+=Z=Qe.g;w+=J=Qe.b;B+=j=Qe.a;x-=K;C-=Z;W-=J;N-=j;Qe=Qe.next;d+=4}h+=i}for(a=0;a<i;a++){C=W=N=x=y=_=f=p=0;d=a<<2;v=Q*(K=n[d]);b=Q*(Z=n[d+1]);w=Q*(J=n[d+2]);B=Q*(j=n[d+3]);p+=Ae*K;y+=Ae*Z;_+=Ae*J;f+=Ae*j;re=ve;for(u=0;u<Q;u++){re.r=K;re.g=Z;re.b=J;re.a=j;re=re.next}m=i;for(u=1;u<=o;u++){d=m+a<<2;p+=(re.r=K=n[d])*(fe=Q-u);y+=(re.g=Z=n[d+1])*fe;_+=(re.b=J=n[d+2])*fe;f+=(re.a=j=n[d+3])*fe;x+=K;C+=Z;W+=J;N+=j;re=re.next;if(u<Zt){m+=i}}d=a;Fe=ve;Qe=be;for(l=0;l<r;l++){c=d<<2;n[c+3]=j=f*Wi>>Vi;if(j>0){j=255/j;n[c]=p*Wi>>Vi;n[c+1]=y*Wi>>Vi;n[c+2]=_*Wi>>Vi}else{n[c]=n[c+1]=n[c+2]=0}p-=v;y-=b;_-=w;f-=B;v-=Fe.r;b-=Fe.g;w-=Fe.b;B-=Fe.a;c=a+((c=l+Q)<Zt?c:Zt)*i<<2;p+=x+=Fe.r=n[c];y+=C+=Fe.g=n[c+1];_+=W+=Fe.b=n[c+2];f+=N+=Fe.a=n[c+3];Fe=Fe.next;v+=K=Qe.r;b+=Z=Qe.g;w+=J=Qe.b;B+=j=Qe.a;x-=K;C-=Z;W-=J;N-=j;Qe=Qe.next;d+=i}}}function xg(){this.r=0;this.g=0;this.b=0;this.a=0;this.next=null}var fR,gR;var wg=g(()=>{"use strict";fR=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259];gR=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24]});var oi,hn;var lh=g(()=>{Fr();oi=class{constructor(e=1,t=0,i=0,r=0,o=0,n=0,a=1,l=0,u=0,c=0,m=0,d=0,h=1,p=0,y=0,_=0,f=0,v=0,b=1,w=0){this.set(e,t,i,r,o,n,a,l,u,c,m,d,h,p,y,_,f,v,b,w)}set(e,t,i,r,o,n,a,l,u,c,m,d,h,p,y,_,f,v,b,w){this.a=e;this.b=t;this.c=i;this.d=r;this.e=o;this.f=n;this.g=a;this.h=l;this.i=u;this.j=c;this.k=m;this.l=d;this.m=h;this.n=p;this.o=y;this.p=_;this.q=f;this.r=v;this.s=b;this.t=w}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}apply(e){const t=this.a*e.r+this.b*e.g+this.c*e.b+this.d*e.a+this.e;const i=this.f*e.r+this.g*e.g+this.h*e.b+this.i*e.a+this.j;const r=this.k*e.r+this.l*e.g+this.m*e.b+this.n*e.a+this.o;const o=this.p*e.r+this.q*e.g+this.r*e.b+this.s*e.a+this.t;return new R(t,i,r,o)}multiply(e){let t;let i;let r;let o;let n;let a;let l;let u;let c;let m;let d;let h;let p;let y;let _;let f;let v;let b;let w;let B;const x=e;const C=this;t=x.a*C.a+x.b*C.f+x.c*C.k+x.d*C.p;i=x.a*C.b+x.b*C.g+x.c*C.l+x.d*C.q;r=x.a*C.c+x.b*C.h+x.c*C.m+x.d*C.r;o=x.a*C.d+x.b*C.i+x.c*C.n+x.d*C.s;a=x.f*C.a+x.g*C.f+x.h*C.k+x.i*C.p;l=x.f*C.b+x.g*C.g+x.h*C.l+x.i*C.q;u=x.f*C.c+x.g*C.h+x.h*C.m+x.i*C.r;c=x.f*C.d+x.g*C.i+x.h*C.n+x.i*C.s;d=x.k*C.a+x.l*C.f+x.m*C.k+x.n*C.p;h=x.k*C.b+x.l*C.g+x.m*C.l+x.n*C.q;p=x.k*C.c+x.l*C.h+x.m*C.m+x.n*C.r;y=x.k*C.d+x.l*C.i+x.m*C.n+x.n*C.s;f=x.p*C.a+x.q*C.f+x.r*C.k+x.s*C.p;v=x.p*C.b+x.q*C.g+x.r*C.l+x.s*C.q;b=x.p*C.c+x.q*C.h+x.r*C.m+x.s*C.r;w=x.p*C.d+x.q*C.i+x.r*C.n+x.s*C.s;n=x.a*C.e+x.b*C.j+x.c*C.o+x.d*C.t+x.e;m=x.f*C.e+x.g*C.j+x.h*C.o+x.i*C.t+x.j;_=x.k*C.e+x.l*C.j+x.m*C.o+x.n*C.t+x.o;B=x.p*C.e+x.q*C.j+x.r*C.o+x.s*C.t+x.t;this.a=t;this.b=i;this.c=r;this.d=o;this.e=n;this.f=a;this.g=l;this.h=u;this.i=c;this.j=m;this.k=d;this.l=h;this.m=p;this.n=y;this.o=_;this.p=f;this