@cesdk/engine 1.23.0-rc.1 → 1.23.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,a=(e,t)=>function(){return t||(0,e[n(e)[0]])((t={exports:{}}).exports,t),t.exports},s=(a,s,u)=>(u=null!=a?e(o(a)):{},((e,o,a,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let u of n(o))i.call(e,u)||u===a||t(e,u,{get:()=>o[u],enumerable:!(s=r(o,u))||s.enumerable});return e})(!s&&a&&a.__esModule?u:t(u,"default",{value:a,enumerable:!0}),a)),u=(e,n,o,i)=>{for(var a,s=i>1?void 0:i?r(n,o):n,u=e.length-1;u>=0;u--)(a=e[u])&&(s=(i?a(n,o,s):a(s))||s);return i&&s&&t(n,o,s),s},c=(e,r,n)=>(((e,r,n)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n})(e,"symbol"!=typeof r?r+"":r,n),n),l=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},d=(e,t,r)=>(l(e,t,"read from private field"),r?r.call(e):t.get(e)),p=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},h=(e,t,r,n)=>(l(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),f=(e,t,r)=>(l(e,t,"access private method"),r),m=a({"../../../node_modules/lodash/isObject.js"(e,t){t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}}),g=a({"../../../node_modules/lodash/_freeGlobal.js"(e,t){var r="object"==typeof global&&global&&global.Object===Object&&global;t.exports=r}}),y=a({"../../../node_modules/lodash/_root.js"(e,t){var r=g(),n="object"==typeof self&&self&&self.Object===Object&&self,o=r||n||Function("return this")();t.exports=o}}),b=a({"../../../node_modules/lodash/now.js"(e,t){var r=y();t.exports=function(){return r.Date.now()}}}),v=a({"../../../node_modules/lodash/_trimmedEndIndex.js"(e,t){var r=/\s/;t.exports=function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}}}),w=a({"../../../node_modules/lodash/_baseTrim.js"(e,t){var r=v(),n=/^\s+/;t.exports=function(e){return e?e.slice(0,r(e)+1).replace(n,""):e}}}),_=a({"../../../node_modules/lodash/_Symbol.js"(e,t){var r=y().Symbol;t.exports=r}}),E=a({"../../../node_modules/lodash/_getRawTag.js"(e,t){var r=_(),n=Object.prototype,o=n.hasOwnProperty,i=n.toString,a=r?r.toStringTag:void 0;t.exports=function(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var s=i.call(e);return n&&(t?e[a]=r:delete e[a]),s}}}),S=a({"../../../node_modules/lodash/_objectToString.js"(e,t){var r=Object.prototype.toString;t.exports=function(e){return r.call(e)}}}),C=a({"../../../node_modules/lodash/_baseGetTag.js"(e,t){var r=_(),n=E(),o=S(),i=r?r.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?n(e):o(e)}}}),x=a({"../../../node_modules/lodash/isObjectLike.js"(e,t){t.exports=function(e){return null!=e&&"object"==typeof e}}}),k=a({"../../../node_modules/lodash/isSymbol.js"(e,t){var r=C(),n=x();t.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==r(e)}}}),T=a({"../../../node_modules/lodash/toNumber.js"(e,t){var r=w(),n=m(),o=k(),i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var c=a.test(e);return c||s.test(e)?u(e.slice(2),c?2:8):i.test(e)?NaN:+e}}}),A=a({"../../../node_modules/lodash/debounce.js"(e,t){var r=m(),n=b(),o=T(),i=Math.max,a=Math.min;t.exports=function(e,t,s){var u,c,l,d,p,h,f=0,m=!1,g=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var r=u,n=c;return u=c=void 0,f=t,d=e.apply(n,r)}function v(e){var r=e-h;return void 0===h||r>=t||r<0||g&&e-f>=l}function w(){var e=n();if(v(e))return _(e);p=setTimeout(w,function(e){var r=t-(e-h);return g?a(r,l-(e-f)):r}(e))}function _(e){return p=void 0,y&&u?b(e):(u=c=void 0,d)}function E(){var e=n(),r=v(e);if(u=arguments,c=this,h=e,r){if(void 0===p)return function(e){return f=e,p=setTimeout(w,t),m?b(e):d}(h);if(g)return clearTimeout(p),p=setTimeout(w,t),b(h)}return void 0===p&&(p=setTimeout(w,t)),d}return t=o(t)||0,r(s)&&(m=!!s.leading,l=(g="maxWait"in s)?i(o(s.maxWait)||0,t):l,y="trailing"in s?!!s.trailing:y),E.cancel=function(){void 0!==p&&clearTimeout(p),f=0,u=h=c=p=void 0},E.flush=function(){return void 0===p?d:_(n())},E}}}),P=a({"../../../node_modules/lodash/_listCacheClear.js"(e,t){t.exports=function(){this.__data__=[],this.size=0}}}),q=a({"../../../node_modules/lodash/eq.js"(e,t){t.exports=function(e,t){return e===t||e!=e&&t!=t}}}),F=a({"../../../node_modules/lodash/_assocIndexOf.js"(e,t){var r=q();t.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}}}),L=a({"../../../node_modules/lodash/_listCacheDelete.js"(e,t){var r=F(),n=Array.prototype.splice;t.exports=function(e){var t=this.__data__,o=r(t,e);return!(o<0)&&(o==t.length-1?t.pop():n.call(t,o,1),--this.size,!0)}}}),D=a({"../../../node_modules/lodash/_listCacheGet.js"(e,t){var r=F();t.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}}}),B=a({"../../../node_modules/lodash/_listCacheHas.js"(e,t){var r=F();t.exports=function(e){return r(this.__data__,e)>-1}}}),R=a({"../../../node_modules/lodash/_listCacheSet.js"(e,t){var r=F();t.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}}}),M=a({"../../../node_modules/lodash/_ListCache.js"(e,t){var r=P(),n=L(),o=D(),i=B(),a=R();function s(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}s.prototype.clear=r,s.prototype.delete=n,s.prototype.get=o,s.prototype.has=i,s.prototype.set=a,t.exports=s}}),I=a({"../../../node_modules/lodash/_stackClear.js"(e,t){var r=M();t.exports=function(){this.__data__=new r,this.size=0}}}),O=a({"../../../node_modules/lodash/_stackDelete.js"(e,t){t.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}}}),j=a({"../../../node_modules/lodash/_stackGet.js"(e,t){t.exports=function(e){return this.__data__.get(e)}}}),U=a({"../../../node_modules/lodash/_stackHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),$=a({"../../../node_modules/lodash/isFunction.js"(e,t){var r=C(),n=m();t.exports=function(e){if(!n(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}}}),N=a({"../../../node_modules/lodash/_coreJsData.js"(e,t){var r=y()["__core-js_shared__"];t.exports=r}}),H=a({"../../../node_modules/lodash/_isMasked.js"(e,t){var r,n=N(),o=(r=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(e){return!!o&&o in e}}}),V=a({"../../../node_modules/lodash/_toSource.js"(e,t){var r=Function.prototype.toString;t.exports=function(e){if(null!=e){try{return r.call(e)}catch(e){}try{return e+""}catch(e){}}return""}}}),W=a({"../../../node_modules/lodash/_baseIsNative.js"(e,t){var r=$(),n=H(),o=m(),i=V(),a=/^\[object .+?Constructor\]$/,s=Function.prototype,u=Object.prototype,c=s.toString,l=u.hasOwnProperty,d=RegExp("^"+c.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(e){return!(!o(e)||n(e))&&(r(e)?d:a).test(i(e))}}}),z=a({"../../../node_modules/lodash/_getValue.js"(e,t){t.exports=function(e,t){return null==e?void 0:e[t]}}}),G=a({"../../../node_modules/lodash/_getNative.js"(e,t){var r=W(),n=z();t.exports=function(e,t){var o=n(e,t);return r(o)?o:void 0}}}),Y=a({"../../../node_modules/lodash/_Map.js"(e,t){var r=G()(y(),"Map");t.exports=r}}),X=a({"../../../node_modules/lodash/_nativeCreate.js"(e,t){var r=G()(Object,"create");t.exports=r}}),Z=a({"../../../node_modules/lodash/_hashClear.js"(e,t){var r=X();t.exports=function(){this.__data__=r?r(null):{},this.size=0}}}),K=a({"../../../node_modules/lodash/_hashDelete.js"(e,t){t.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}}}),Q=a({"../../../node_modules/lodash/_hashGet.js"(e,t){var r=X(),n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(r){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(t,e)?t[e]:void 0}}}),J=a({"../../../node_modules/lodash/_hashHas.js"(e,t){var r=X(),n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:n.call(t,e)}}}),ee=a({"../../../node_modules/lodash/_hashSet.js"(e,t){var r=X();t.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}}}),te=a({"../../../node_modules/lodash/_Hash.js"(e,t){var r=Z(),n=K(),o=Q(),i=J(),a=ee();function s(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}s.prototype.clear=r,s.prototype.delete=n,s.prototype.get=o,s.prototype.has=i,s.prototype.set=a,t.exports=s}}),re=a({"../../../node_modules/lodash/_mapCacheClear.js"(e,t){var r=te(),n=M(),o=Y();t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||n),string:new r}}}}),ne=a({"../../../node_modules/lodash/_isKeyable.js"(e,t){t.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}}),oe=a({"../../../node_modules/lodash/_getMapData.js"(e,t){var r=ne();t.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}}}),ie=a({"../../../node_modules/lodash/_mapCacheDelete.js"(e,t){var r=oe();t.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}}}),ae=a({"../../../node_modules/lodash/_mapCacheGet.js"(e,t){var r=oe();t.exports=function(e){return r(this,e).get(e)}}}),se=a({"../../../node_modules/lodash/_mapCacheHas.js"(e,t){var r=oe();t.exports=function(e){return r(this,e).has(e)}}}),ue=a({"../../../node_modules/lodash/_mapCacheSet.js"(e,t){var r=oe();t.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}}}),ce=a({"../../../node_modules/lodash/_MapCache.js"(e,t){var r=re(),n=ie(),o=ae(),i=se(),a=ue();function s(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}s.prototype.clear=r,s.prototype.delete=n,s.prototype.get=o,s.prototype.has=i,s.prototype.set=a,t.exports=s}}),le=a({"../../../node_modules/lodash/_stackSet.js"(e,t){var r=M(),n=Y(),o=ce();t.exports=function(e,t){var i=this.__data__;if(i instanceof r){var a=i.__data__;if(!n||a.length<199)return a.push([e,t]),this.size=++i.size,this;i=this.__data__=new o(a)}return i.set(e,t),this.size=i.size,this}}}),de=a({"../../../node_modules/lodash/_Stack.js"(e,t){var r=M(),n=I(),o=O(),i=j(),a=U(),s=le();function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u}}),pe=a({"../../../node_modules/lodash/_setCacheAdd.js"(e,t){t.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}}}),he=a({"../../../node_modules/lodash/_setCacheHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),fe=a({"../../../node_modules/lodash/_SetCache.js"(e,t){var r=ce(),n=pe(),o=he();function i(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}i.prototype.add=i.prototype.push=n,i.prototype.has=o,t.exports=i}}),me=a({"../../../node_modules/lodash/_arraySome.js"(e,t){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}}}),ge=a({"../../../node_modules/lodash/_cacheHas.js"(e,t){t.exports=function(e,t){return e.has(t)}}}),ye=a({"../../../node_modules/lodash/_equalArrays.js"(e,t){var r=fe(),n=me(),o=ge();t.exports=function(e,t,i,a,s,u){var c=1&i,l=e.length,d=t.length;if(l!=d&&!(c&&d>l))return!1;var p=u.get(e),h=u.get(t);if(p&&h)return p==t&&h==e;var f=-1,m=!0,g=2&i?new r:void 0;for(u.set(e,t),u.set(t,e);++f<l;){var y=e[f],b=t[f];if(a)var v=c?a(b,y,f,t,e,u):a(y,b,f,e,t,u);if(void 0!==v){if(v)continue;m=!1;break}if(g){if(!n(t,(function(e,t){if(!o(g,t)&&(y===e||s(y,e,i,a,u)))return g.push(t)}))){m=!1;break}}else if(y!==b&&!s(y,b,i,a,u)){m=!1;break}}return u.delete(e),u.delete(t),m}}}),be=a({"../../../node_modules/lodash/_Uint8Array.js"(e,t){var r=y().Uint8Array;t.exports=r}}),ve=a({"../../../node_modules/lodash/_mapToArray.js"(e,t){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}}}),we=a({"../../../node_modules/lodash/_setToArray.js"(e,t){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}}}),_e=a({"../../../node_modules/lodash/_equalByTag.js"(e,t){var r=_(),n=be(),o=q(),i=ye(),a=ve(),s=we(),u=r?r.prototype:void 0,c=u?u.valueOf:void 0;t.exports=function(e,t,r,u,l,d,p){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new n(e),new n(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=a;case"[object Set]":var f=1&u;if(h||(h=s),e.size!=t.size&&!f)return!1;var m=p.get(e);if(m)return m==t;u|=2,p.set(e,t);var g=i(h(e),h(t),u,l,d,p);return p.delete(e),g;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}}}),Ee=a({"../../../node_modules/lodash/_arrayPush.js"(e,t){t.exports=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}}}),Se=a({"../../../node_modules/lodash/isArray.js"(e,t){var r=Array.isArray;t.exports=r}}),Ce=a({"../../../node_modules/lodash/_baseGetAllKeys.js"(e,t){var r=Ee(),n=Se();t.exports=function(e,t,o){var i=t(e);return n(e)?i:r(i,o(e))}}}),xe=a({"../../../node_modules/lodash/_arrayFilter.js"(e,t){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var a=e[r];t(a,r,e)&&(i[o++]=a)}return i}}}),ke=a({"../../../node_modules/lodash/stubArray.js"(e,t){t.exports=function(){return[]}}}),Te=a({"../../../node_modules/lodash/_getSymbols.js"(e,t){var r=xe(),n=ke(),o=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(e){return null==e?[]:(e=Object(e),r(i(e),(function(t){return o.call(e,t)})))}:n;t.exports=a}}),Ae=a({"../../../node_modules/lodash/_baseTimes.js"(e,t){t.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}}}),Pe=a({"../../../node_modules/lodash/_baseIsArguments.js"(e,t){var r=C(),n=x();t.exports=function(e){return n(e)&&"[object Arguments]"==r(e)}}}),qe=a({"../../../node_modules/lodash/isArguments.js"(e,t){var r=Pe(),n=x(),o=Object.prototype,i=o.hasOwnProperty,a=o.propertyIsEnumerable,s=r(function(){return arguments}())?r:function(e){return n(e)&&i.call(e,"callee")&&!a.call(e,"callee")};t.exports=s}}),Fe=a({"../../../node_modules/lodash/stubFalse.js"(e,t){t.exports=function(){return!1}}}),Le=a({"../../../node_modules/lodash/isBuffer.js"(e,t){var r=y(),n=Fe(),o="object"==typeof e&&e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o?r.Buffer:void 0,s=(a?a.isBuffer:void 0)||n;t.exports=s}}),De=a({"../../../node_modules/lodash/_isIndex.js"(e,t){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&r.test(e))&&e>-1&&e%1==0&&e<t}}}),Be=a({"../../../node_modules/lodash/isLength.js"(e,t){t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}}),Re=a({"../../../node_modules/lodash/_baseIsTypedArray.js"(e,t){var r=C(),n=Be(),o=x(),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,t.exports=function(e){return o(e)&&n(e.length)&&!!i[r(e)]}}}),Me=a({"../../../node_modules/lodash/_baseUnary.js"(e,t){t.exports=function(e){return function(t){return e(t)}}}}),Ie=a({"../../../node_modules/lodash/_nodeUtil.js"(e,t){var r=g(),n="object"==typeof e&&e&&!e.nodeType&&e,o=n&&"object"==typeof t&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,a=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();t.exports=a}}),Oe=a({"../../../node_modules/lodash/isTypedArray.js"(e,t){var r=Re(),n=Me(),o=Ie(),i=o&&o.isTypedArray,a=i?n(i):r;t.exports=a}}),je=a({"../../../node_modules/lodash/_arrayLikeKeys.js"(e,t){var r=Ae(),n=qe(),o=Se(),i=Le(),a=De(),s=Oe(),u=Object.prototype.hasOwnProperty;t.exports=function(e,t){var c=o(e),l=!c&&n(e),d=!c&&!l&&i(e),p=!c&&!l&&!d&&s(e),h=c||l||d||p,f=h?r(e.length,String):[],m=f.length;for(var g in e)!t&&!u.call(e,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,m))||f.push(g);return f}}}),Ue=a({"../../../node_modules/lodash/_isPrototype.js"(e,t){var r=Object.prototype;t.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}}}),$e=a({"../../../node_modules/lodash/_overArg.js"(e,t){t.exports=function(e,t){return function(r){return e(t(r))}}}}),Ne=a({"../../../node_modules/lodash/_nativeKeys.js"(e,t){var r=$e()(Object.keys,Object);t.exports=r}}),He=a({"../../../node_modules/lodash/_baseKeys.js"(e,t){var r=Ue(),n=Ne(),o=Object.prototype.hasOwnProperty;t.exports=function(e){if(!r(e))return n(e);var t=[];for(var i in Object(e))o.call(e,i)&&"constructor"!=i&&t.push(i);return t}}}),Ve=a({"../../../node_modules/lodash/isArrayLike.js"(e,t){var r=$(),n=Be();t.exports=function(e){return null!=e&&n(e.length)&&!r(e)}}}),We=a({"../../../node_modules/lodash/keys.js"(e,t){var r=je(),n=He(),o=Ve();t.exports=function(e){return o(e)?r(e):n(e)}}}),ze=a({"../../../node_modules/lodash/_getAllKeys.js"(e,t){var r=Ce(),n=Te(),o=We();t.exports=function(e){return r(e,o,n)}}}),Ge=a({"../../../node_modules/lodash/_equalObjects.js"(e,t){var r=ze(),n=Object.prototype.hasOwnProperty;t.exports=function(e,t,o,i,a,s){var u=1&o,c=r(e),l=c.length;if(l!=r(t).length&&!u)return!1;for(var d=l;d--;){var p=c[d];if(!(u?p in t:n.call(t,p)))return!1}var h=s.get(e),f=s.get(t);if(h&&f)return h==t&&f==e;var m=!0;s.set(e,t),s.set(t,e);for(var g=u;++d<l;){var y=e[p=c[d]],b=t[p];if(i)var v=u?i(b,y,p,t,e,s):i(y,b,p,e,t,s);if(!(void 0===v?y===b||a(y,b,o,i,s):v)){m=!1;break}g||(g="constructor"==p)}if(m&&!g){var w=e.constructor,_=t.constructor;w==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof _&&_ instanceof _||(m=!1)}return s.delete(e),s.delete(t),m}}}),Ye=a({"../../../node_modules/lodash/_DataView.js"(e,t){var r=G()(y(),"DataView");t.exports=r}}),Xe=a({"../../../node_modules/lodash/_Promise.js"(e,t){var r=G()(y(),"Promise");t.exports=r}}),Ze=a({"../../../node_modules/lodash/_Set.js"(e,t){var r=G()(y(),"Set");t.exports=r}}),Ke=a({"../../../node_modules/lodash/_WeakMap.js"(e,t){var r=G()(y(),"WeakMap");t.exports=r}}),Qe=a({"../../../node_modules/lodash/_getTag.js"(e,t){var r=Ye(),n=Y(),o=Xe(),i=Ze(),a=Ke(),s=C(),u=V(),c="[object Map]",l="[object Promise]",d="[object Set]",p="[object WeakMap]",h="[object DataView]",f=u(r),m=u(n),g=u(o),y=u(i),b=u(a),v=s;(r&&v(new r(new ArrayBuffer(1)))!=h||n&&v(new n)!=c||o&&v(o.resolve())!=l||i&&v(new i)!=d||a&&v(new a)!=p)&&(v=function(e){var t=s(e),r="[object Object]"==t?e.constructor:void 0,n=r?u(r):"";if(n)switch(n){case f:return h;case m:return c;case g:return l;case y:return d;case b:return p}return t}),t.exports=v}}),Je=a({"../../../node_modules/lodash/_baseIsEqualDeep.js"(e,t){var r=de(),n=ye(),o=_e(),i=Ge(),a=Qe(),s=Se(),u=Le(),c=Oe(),l="[object Arguments]",d="[object Array]",p="[object Object]",h=Object.prototype.hasOwnProperty;t.exports=function(e,t,f,m,g,y){var b=s(e),v=s(t),w=b?d:a(e),_=v?d:a(t),E=(w=w==l?p:w)==p,S=(_=_==l?p:_)==p,C=w==_;if(C&&u(e)){if(!u(t))return!1;b=!0,E=!1}if(C&&!E)return y||(y=new r),b||c(e)?n(e,t,f,m,g,y):o(e,t,w,f,m,g,y);if(!(1&f)){var x=E&&h.call(e,"__wrapped__"),k=S&&h.call(t,"__wrapped__");if(x||k){var T=x?e.value():e,A=k?t.value():t;return y||(y=new r),g(T,A,f,m,y)}}return!!C&&(y||(y=new r),i(e,t,f,m,g,y))}}}),et=a({"../../../node_modules/lodash/_baseIsEqual.js"(e,t){var r=Je(),n=x();t.exports=function e(t,o,i,a,s){return t===o||(null==t||null==o||!n(t)&&!n(o)?t!=t&&o!=o:r(t,o,i,a,e,s))}}}),tt=a({"../../../node_modules/lodash/isEqual.js"(e,t){var r=et();t.exports=function(e,t){return r(e,t)}}}),rt=a({"../../../node_modules/base64-js/index.js"(e){e.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},e.toByteArray=function(e){var t,r,i=a(e),s=i[0],u=i[1],c=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,u)),l=0,d=u>0?s-4:s;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t);1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},e.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=16383,u=0,c=n-o;u<c;u+=a)i.push(s(e,u,u+a>c?c:u+a));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};var t,r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(t=0,64;t<64;++t)r[t]=i[t],n[i.charCodeAt(t)]=t;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function s(e,t,n){for(var o,i,a=[],s=t;s<n;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}}),nt=a({"../../../node_modules/ieee754/index.js"(e){e.read=function(e,t,r,n,o){var i,a,s=8*o-n-1,u=(1<<s)-1,c=u>>1,l=-7,d=r?o-1:0,p=r?-1:1,h=e[t+d];for(d+=p,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=p,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+e[t+d],d+=p,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),i-=c}return(h?-1:1)*a*Math.pow(2,i-n)},e.write=function(e,t,r,n,o,i){var a,s,u,c=8*i-o-1,l=(1<<c)-1,d=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?p/u:p*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*u-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[r+h]=255&s,h+=f,s/=256,o-=8);for(a=a<<o|s,c+=o;c>0;e[r+h]=255&a,h+=f,a/=256,c-=8);e[r+h-f]|=128*m}}}),ot=a({"../../../node_modules/buffer/index.js"(e){var t=rt(),r=nt(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function i(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|h(e,t),n=i(r),o=n.write(e,t);o!==r&&(n=n.slice(0,o));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(j(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(j(e,SharedArrayBuffer)||e&&j(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);var o=function(e){if(a.isBuffer(e)){var t=0|p(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||U(e.length)?i(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),i(e<0?0:0|p(e))}function l(e){for(var t=e.length<0?0:0|p(e.length),r=i(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,a.prototype),n}function p(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function h(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return I(e).length;default:if(o)return n?-1:M(e).length;t=(""+t).toLowerCase(),o=!0}}function f(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),U(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,o){var i,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=r;i<s;i++)if(c(e,i)===c(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*a}else-1!==l&&(i-=i-l),l=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){for(var d=!0,p=0;p<u;p++)if(c(e,i+p)!==c(t,p)){d=!1;break}if(d)return i}return-1}function b(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(U(s))return a;e[r+a]=s}return a}function v(e,t,r,n){return O(M(t,e.length-r),e,r,n)}function w(e,t,r,n){return O(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function _(e,t,r,n){return O(I(t),e,r,n)}function E(e,t,r,n){return O(function(e,t){for(var r,n,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function S(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function C(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,a,s,u,c=e[o],l=null,d=c>239?4:c>223?3:c>191?2:1;if(o+d<=r)switch(d){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,d=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=d}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=x));return r}(n)}e.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return s(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(j(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),j(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=a.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(j(i,Uint8Array))o+i.length>n.length?a.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},a.byteLength=h,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):f.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,o){if(j(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),u=Math.min(i,s),c=this.slice(n,o),l=e.slice(t,r),d=0;d<u;++d)if(c[d]!==l[d]){i=c[d],s=l[d];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function k(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function T(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function A(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=$[e[i]];return o}function P(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function q(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,r,n,o,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function L(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,n,o,i){return t=+t,n>>>=0,i||L(e,0,n,4),r.write(e,t,n,o,23,4),n+4}function B(e,t,n,o,i){return t=+t,n>>>=0,i||L(e,0,n,8),r.write(e,t,n,o,52,8),n+8}a.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||q(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||q(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||q(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||q(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||q(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||q(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||q(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||q(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return e>>>=0,t||q(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||q(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||q(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||q(e,4,this.length),r.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||q(e,4,this.length),r.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||q(e,8,this.length),r.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||q(e,8,this.length),r.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||F(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||F(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,e,t,r,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,e,t,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=a.isBuffer(e)?e:a.from(e,n),u=s.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%u]}return this};var R=/[^+/0-9A-Za-z-_]/g;function M(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function I(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function O(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function j(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function U(e){return e!=e}var $=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()}}),it=a({"../../../node_modules/lodash/toFinite.js"(e,t){var r=T(),n=1/0;t.exports=function(e){return e?(e=r(e))===n||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}}}),at=a({"../../../node_modules/lodash/toInteger.js"(e,t){var r=it();t.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}}}),st=a({"../../../node_modules/lodash/before.js"(e,t){var r=at();t.exports=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=r(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}}}),ut=a({"../../../node_modules/lodash/once.js"(e,t){var r=st();t.exports=function(e){return r(2,e)}}}),ct=a({"../../../esbuild/polyfill.noop.js"(){}}),lt=a({"../../../_builds/cesdk/wasm32-unknown-emscripten/Release/cesdk.js"(e,t){var r,n=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(r||=__filename),function(e={}){var t,n,o,i,a,s,u=e;if(void 0===globalThis.BigInt64Array){let e=function(e,t){return BigInt(e)|BigInt(t+2*(2147483648&t))<<32n},t=function(e,t){return BigInt(e)|BigInt(t)<<32n},r=function(e){return[0|Number(BigInt(e)&BigInt(4294967295)),0|Number(BigInt(e)>>32n)]},n=function(e){return function t(n){var o;"number"==typeof n&&(n=new Uint32Array(2*n)),ArrayBuffer.isView(n)||(n.constructor&&"ArrayBuffer"===n.constructor.name?n=new Uint32Array(n):(o=n,n=new Uint32Array(2*n.length)));var i=new Proxy({slice:(e,r)=>(r??=n.length,t(n.slice(2*e,2*r))),subarray:(e,r)=>t(n.subarray(2*e,2*r)),[Symbol.iterator]:function*(){for(var t=0;t<n.length/2;t++)yield e(n[2*t],n[2*t+1])},BYTES_PER_ELEMENT:2*n.BYTES_PER_ELEMENT,buffer:n.buffer,byteLength:n.byteLength,byteOffset:n.byteOffset,length:n.length/2,copyWithin:function(e,t,r){return n.copyWithin(2*e,2*t,2*r),i},set(e,t){if(t??=0,2*(e.length+t)>n.length)throw new RangeError("offset is out of bounds");for(var o=0;o<e.length;o++){var i=e[o],a=r(i);n.set(a,2*(t+o))}}},{get(t,r,o){if("string"!=typeof r||!/^\d+$/.test(r))return Reflect.get(t,r,o);var i=n[2*r],a=n[2*r+1];return e(i,a)},set(e,t,o,i){if("string"!=typeof t||!/^\d+$/.test(t))return Reflect.set(e,t,o,i);if("bigint"!=typeof o)throw new TypeError(`Cannot convert ${o} to a BigInt`);var a=r(o);return n.set(a,2*t),!0}});return o&&i.set(o),i}};globalThis.BigUint64Array=n(t),globalThis.BigInt64Array=n(e)}u.ready=new Promise(((e,r)=>{t=e,n=r})),u.expectedDataFileDownloads||(u.expectedDataFileDownloads=0),u.expectedDataFileDownloads++,u.ENVIRONMENT_IS_PTHREAD||u.$ww||function(e){"object"==typeof window?window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/"):"undefined"==typeof process&&"undefined"!=typeof location&&encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/");var t="cesdk.data";"function"!=typeof u.locateFilePackage||u.locateFile||(u.locateFile=u.locateFilePackage,x("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var r=u.locateFile?u.locateFile(t,""):t,n=e.remote_package_size,o=null,i=u.getPreloadedPackage?u.getPreloadedPackage(r,n):null;function a(){function t(e,t){if(!e)throw t+(new Error).stack}function r(e,t,r){this.start=e,this.end=t,this.audio=r}u.FS_createPath("/","ly.img.cesdk",!0,!0),u.FS_createPath("/ly.img.cesdk","fonts",!0,!0),u.FS_createPath("/ly.img.cesdk","icons",!0,!0),u.FS_createPath("/ly.img.cesdk","icu",!0,!0),u.FS_createPath("/ly.img.cesdk","presets",!0,!0),u.FS_createPath("/ly.img.cesdk","shaders",!0,!0),u.FS_createPath("/ly.img.cesdk/shaders","common",!0,!0),r.prototype={requests:{},open:function(e,t){this.name=t,this.requests[t]=this,u.addRunDependency(`fp ${this.name}`)},send:function(){},onload:function(){var e=this.byteArray.subarray(this.start,this.end);this.finish(e)},finish:function(e){u.FS_createDataFile(this.name,null,e,!0,!0,!0),u.removeRunDependency(`fp ${this.name}`),this.requests[this.name]=null}};for(var n=e.files,a=0;a<n.length;++a)new r(n[a].start,n[a].end,n[a].audio||0).open("GET",n[a].filename);function s(n){t(n,"Loading data file failed."),t(n.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var o=new Uint8Array(n);r.prototype.byteArray=o;for(var i=e.files,a=0;a<i.length;++a)r.prototype.requests[i[a].filename].onload();u.removeRunDependency("datafile_cesdk.data")}u.addRunDependency("datafile_cesdk.data"),u.preloadResults||(u.preloadResults={}),u.preloadResults["cesdk.data"]={fromCache:!1},i?(s(i),i=null):o=s}i||function(e,t,r,n){if("object"!=typeof process||"object"!=typeof process.versions||"string"!=typeof process.versions.node){var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onprogress=function(r){var n=e,i=t;if(r.total&&(i=r.total),r.loaded){o.addedTotal?u.dataFileDownloads[n].loaded=r.loaded:(o.addedTotal=!0,u.dataFileDownloads||(u.dataFileDownloads={}),u.dataFileDownloads[n]={loaded:r.loaded,total:i});var a=0,s=0,c=0;for(var l in u.dataFileDownloads){var d=u.dataFileDownloads[l];a+=d.total,s+=d.loaded,c++}a=Math.ceil(a*u.expectedDataFileDownloads/c),u.setStatus&&u.setStatus(`Downloading data... (${s}/${a})`)}else u.dataFileDownloads||u.setStatus&&u.setStatus("Downloading data...")},o.onerror=function(t){throw new Error("NetworkError for: "+e)},o.onload=function(e){if(!(200==o.status||304==o.status||206==o.status||0==o.status&&o.response))throw new Error(o.statusText+" : "+o.responseURL);var t=o.response;r(t)},o.send(null)}else ct().readFile(e,(function(e,t){e?n(e):r(t.buffer)}))}(r,n,(function(e){o?(o(e),o=null):i=e}),(function(e){console.error("package error:",e)})),u.calledRun?a():(u.preRun||(u.preRun=[]),u.preRun.push(a))}({files:[{filename:"/ly.img.cesdk/fonts/imgly_font_inter_semibold.otf",start:0,end:270760},{filename:"/ly.img.cesdk/icons/ErrorAudio.svg",start:270760,end:271672},{filename:"/ly.img.cesdk/icons/ErrorConnection.svg",start:271672,end:272620},{filename:"/ly.img.cesdk/icons/ErrorVideo.svg",start:272620,end:273473},{filename:"/ly.img.cesdk/icons/Move.svg",start:273473,end:274748},{filename:"/ly.img.cesdk/icons/RotateIndicator.svg",start:274748,end:275745},{filename:"/ly.img.cesdk/icu/icudt74l.dat",start:275745,end:810849},{filename:"/ly.img.cesdk/presets/.keep",start:810849,end:810849},{filename:"/ly.img.cesdk/shaders/adjustments.sksl",start:810849,end:814738},{filename:"/ly.img.cesdk/shaders/black_and_white_color_mixer.sksl",start:814738,end:821055},{filename:"/ly.img.cesdk/shaders/common/ubq_adjustments.sksl",start:821055,end:825646},{filename:"/ly.img.cesdk/shaders/common/ubq_color_conversions.sksl",start:825646,end:835631},{filename:"/ly.img.cesdk/shaders/common/ubq_constants.sksl",start:835631,end:836121},{filename:"/ly.img.cesdk/shaders/common/ubq_hue_constants.sksl",start:836121,end:839288},{filename:"/ly.img.cesdk/shaders/common/ubq_noise.sksl",start:839288,end:841926},{filename:"/ly.img.cesdk/shaders/cross_cut.sksl",start:841926,end:842873},{filename:"/ly.img.cesdk/shaders/dot_pattern.sksl",start:842873,end:843388},{filename:"/ly.img.cesdk/shaders/duotone_filter.sksl",start:843388,end:844352},{filename:"/ly.img.cesdk/shaders/extrude_blur.sksl",start:844352,end:846469},{filename:"/ly.img.cesdk/shaders/glow.sksl",start:846469,end:847436},{filename:"/ly.img.cesdk/shaders/half_tone.sksl",start:847436,end:847930},{filename:"/ly.img.cesdk/shaders/hsp_selective_adjustments.sksl",start:847930,end:861530},{filename:"/ly.img.cesdk/shaders/linocut.sksl",start:861530,end:862315},{filename:"/ly.img.cesdk/shaders/liquid.sksl",start:862315,end:862797},{filename:"/ly.img.cesdk/shaders/lut_filter.sksl",start:862797,end:865660},{filename:"/ly.img.cesdk/shaders/mask_color.sksl",start:865660,end:866165},{filename:"/ly.img.cesdk/shaders/mirror.sksl",start:866165,end:866619},{filename:"/ly.img.cesdk/shaders/outliner.sksl",start:866619,end:868256},{filename:"/ly.img.cesdk/shaders/pixelize.sksl",start:868256,end:868556},{filename:"/ly.img.cesdk/shaders/placeholder_overlay_lines.sksl",start:868556,end:869244},{filename:"/ly.img.cesdk/shaders/posterize.sksl",start:869244,end:869456},{filename:"/ly.img.cesdk/shaders/radial_pixel.sksl",start:869456,end:870019},{filename:"/ly.img.cesdk/shaders/recolor.sksl",start:870019,end:872220},{filename:"/ly.img.cesdk/shaders/sharpie.sksl",start:872220,end:874525},{filename:"/ly.img.cesdk/shaders/shifter.sksl",start:874525,end:875209},{filename:"/ly.img.cesdk/shaders/tiltshift.sksl",start:875209,end:875791},{filename:"/ly.img.cesdk/shaders/tv_glitch.sksl",start:875791,end:876509},{filename:"/ly.img.cesdk/shaders/vignette.sksl",start:876509,end:876881}],remote_package_size:876881}),"object"==typeof window&&"object"==typeof window.performance?u.performance=performance:"object"==typeof global&&"object"==typeof global.perf_hooks&&"object"==typeof global.perf_hooks.performance?u.performance=global.perf_hooks.performance:u.performance={mark:function(){},measure:function(){}},(i=o||(o={}))[i.PENDING=0]="PENDING",i[i.FINISHED=1]="FINISHED",i[i.ALLOCATED=2]="ALLOCATED",i[i.ERROR=3]="ERROR",(s=a||(a={}))[s.GET=0]="GET",s[s.POST=1]="POST";class FetchProcess{constructor(e,t){this.state=o.PENDING,this.totalBytes=0,this.receivedLength=0,this.handle=e,this.uri=t,this.abortController=new AbortController,this.abortSignal=this.abortController.signal}async readChunks(e){let t=0;const r=[],n=e=>{r.push(e),t+=e.length,this.receivedLength=t};if(null==e);else if("getReader"in e){const t=e.getReader();for(;;){const{done:e,value:r}=await t.read();if(e)break;if(this.abortSignal.aborted)throw await t.cancel(),t.releaseLock(),new Error(this.abortSignal.reason);n(r)}t.releaseLock()}else{const t=()=>e.destroy(new Error(this.abortSignal.reason));this.abortSignal.addEventListener("abort",t,{once:!0});try{await new Promise(((t,r)=>{e.on("data",n),e.on("end",(()=>t())),e.on("error",(e=>r(e)))}))}finally{this.abortSignal.removeEventListener("abort",t)}}const o=new Uint8Array(t);let i=0;for(const e of r)o.set(e,i),i+=e.length;return this.finish(o)}abort(){this.isPending()&&this.abortController.abort("Fetch aborted")}isPending(){return this.state===o.PENDING}isError(){return this.state===o.ERROR}isFinished(){return this.state===o.FINISHED}isAllocated(){return this.state===o.ALLOCATED}allocate(){if(this.isAllocated())return this;if(this.isFinished()){const e=this.result.length,t=u._malloc(e);u.HEAPU8.set(this.result,t);const r=Object.assign(Object.assign({},this),{state:o.ALLOCATED,resultAddress:t,resultLength:e});return Object.assign(this,r),r}return null}finish(e){const t=Object.assign(Object.assign({},this),{state:o.FINISHED,result:e,totalBytes:e.length});return Object.assign(this,t)}fail(e){const t=Object.assign(Object.assign({},this),{state:o.ERROR,error:e});return Object.assign(this,t)}}u.emscripten_ubq_asyncFetchManager=new class AsyncFetchManager{constructor(){this._nextHandle=0,this._nextHeaderHandle=0,this._processes=new Map,this._headers=new Map,this._fetchImpl=null}_fetch(e,t){return this._fetchImpl?this._fetchImpl(e,t):fetch(e,t)}setFetch(e){this._fetchImpl=e}getProcess(e){return this._processes.get(e)}deleteProcess(e){const t=this._processes.get(e);return(null==t?void 0:t.isPending())&&t.abort(),this._processes.delete(e)}clear(){for(const e of this._processes.values())e.isPending()&&e.abort();this._processes.clear(),this._headers.clear()}fetch(e,t,r,n,o,i,a,s,c){const l=u.UTF8ToString(t,r),d=this._nextHandle++,p=new FetchProcess(d,l);return this._processes.set(d,p),l.match(/^file:/)?this._fetchFile(p).catch((e=>{p.fail(e)})):this._fetchRemote(p,e,n,o,i,a,s,c).catch((e=>{p.fail(e)})),p}async _fetchFile(e){if("undefined"!=typeof window)throw new Error("File URLs supported only in Node.JS");const t=ct(),{fileURLToPath:r}=ct(),n=t.createReadStream(r(e.uri));return e.readChunks(n)}async _fetchRemote(e,t,r,n,o,i,s,c){const l=u.UTF8ToString(s,c),d=this.getHeaders(r,n),p=t===a.POST?new Uint8Array(u.HEAPU8.buffer,o,i):void 0,h=await this._fetch(e.uri,{method:a[t],headers:d,body:p,mode:"cors",credentials:l,signal:e.abortSignal});if(h.status>=200&&h.status<=209){let t=0;return h.headers.has("Content-Length")&&(t=+h.headers.get("Content-Length")),e.totalBytes=t,e.readChunks(h.body)}return e.fail(h.statusText)}getHeaders(e,t){const r={};for(let n=0;n<t;n++){const t=u.getValue(e+4*n,"i32"),o=this._headers.get(t);r[o.key]=o.value}return r}createHeader(e,t,r,n){const o=u.UTF8ToString(e,t),i=u.UTF8ToString(r,n),a=this._nextHeaderHandle++;return this._headers.set(a,{key:o,value:i}),a}deleteHeader(e){return this._headers.delete(e)}},u.emscripten_ubq_codec_videoDecoders=new Map,u.emscripten_ubq_codec_audioDecoders=new Map,u.emscripten_ubq_codec_videoEncoders=new Map,u.emscripten_ubq_codec_audioEncoders=new Map,u.emscripten_ubq_codec_videoDecoderNextHandle=1,u.emscripten_ubq_codec_audioDecoderNextHandle=1,u.emscripten_ubq_codec_videoEncoderNextHandle=1,u.emscripten_ubq_codec_audioEncoderNextHandle=1,u.emscripten_ubq_codec_createNativeResult=function(e){const t=u._malloc(8),r=u.HEAPU32.subarray(t/4,t/4+2);if(r[0]=e.handle?e.handle:e.code?e.code:0,e.error){const t=(new TextEncoder).encode(e.error),n=u._malloc(t.length+1),o=u.HEAPU8.subarray(n,n+t.length+1);for(let e=0;e<t.length;e++)o[e]=t[e];o[t.length]=0,r[1]=n}else r[1]=0;return t},u.emscripten_ubq_codec_createVideoDecoder=function(e,t){const r=new VideoDecoder({output:n=>{const o=r.textures;let i=!1;if((r.shouldDropFrames||r.decodedFrames<r.requestedFrame||r.decodeQueueSize>=o.length)&&(i=!0),!i){var a=u.ctx;const e=r.decodedFrames%o.length,t=a.getParameter(a.TEXTURE_BINDING_2D);a.bindTexture(a.TEXTURE_2D,o[e]),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,n),a.bindTexture(a.TEXTURE_2D,t)}n.close(),r.decodedFrames++,u.emscripten_ubq_codec_onOutputDecodedVideoFrame(e,r.decodedFrames,i,t)},error:e=>{r.unexpectedError=e,console.error(e)}});return r.decodedFrames=0,r.requestedFrame=0,r.shouldDropFrames=!1,r},u.emscripten_ubq_codec_createAudioDecoder=function(e,t,r){const n=new AudioDecoder({output:o=>{if(n.flushing)return void o.close();const i=u.HEAPF32.subarray(e/4,e/4+r),a=u.HEAPF32.subarray(t/4,t/4+r),s=1===o.numberOfChannels?0:1;if("f32-planar"===o.format){let e=n.writtenFrames%r;if(e+o.numberOfFrames<=r)o.copyTo(i.subarray(e),{planeIndex:0,frameCount:o.numberOfFrames}),o.copyTo(a.subarray(e),{planeIndex:s,frameCount:o.numberOfFrames});else{const t=r-e;o.copyTo(i.subarray(e),{planeIndex:0,frameCount:t}),o.copyTo(a.subarray(e),{planeIndex:s,frameCount:t}),o.copyTo(i,{planeIndex:0,frameOffset:t}),o.copyTo(a,{planeIndex:s,frameOffset:t})}n.writtenFrames+=o.numberOfFrames}else if("s16-planar"===o.format)if(1===o.numberOfChannels){const e=new Int16Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0});for(let t=0;t<o.numberOfFrames;t++){const o=e[t]/32768;let s=n.writtenFrames%r;i[s]=o,a[s]=o,n.writtenFrames++}}else{const e=new Int16Array(o.numberOfFrames),t=new Int16Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0}),o.copyTo(t,{planeIndex:1});for(let s=0;s<o.numberOfFrames;s++){let o=n.writtenFrames%r;i[o]=e[s]/32768,a[o]=t[s]/32768,n.writtenFrames++}}else if("s16"===o.format){const e=new Int16Array(o.numberOfFrames*o.numberOfChannels);if(o.copyTo(e,{planeIndex:0}),1===o.numberOfChannels)for(let t=0;t<o.numberOfFrames;t++){const o=e[t]/32768;let s=n.writtenFrames%r;i[s]=o,a[s]=o,n.writtenFrames++}else for(let t=0;t<o.numberOfFrames;t++){let s=n.writtenFrames%r;i[s]=e[t*o.numberOfChannels+0]/32768,a[s]=e[t*o.numberOfChannels+1]/32768,n.writtenFrames++}}else console.error("Unsupported audio format:",o.format);o.close()},error:e=>{n.unexpectedError=e,console.error(e)}});return n.writtenFrames=0,n},u.emscripten_ubq_settings_forceWebGL1=!1;var c,l,d,p=Object.assign({},u),h=[],f="./this.program",m=(e,t)=>{throw t},g="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,v="";if(b){var w=ct(),_=ct();v=y?_.dirname(v)+"/":__dirname+"/",c=(e,t)=>(e=ee(e)?new URL(e):_.normalize(e),w.readFileSync(e,t?void 0:"utf8")),d=e=>{var t=c(e,!0);return t.buffer||(t=new Uint8Array(t)),t},l=(e,t,r,n=!0)=>{e=ee(e)?new URL(e):_.normalize(e),w.readFile(e,n?void 0:"utf8",((e,o)=>{e?r(e):t(n?o.buffer:o)}))},!u.thisProgram&&process.argv.length>1&&(f=process.argv[1].replace(/\\/g,"/")),h=process.argv.slice(2),m=(e,t)=>{throw process.exitCode=e,t}}else(g||y)&&(y?v=self.location.href:"undefined"!=typeof document&&document.currentScript&&(v=document.currentScript.src),r&&(v=r),v=v.startsWith("blob:")?"":v.substr(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1),c=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},y&&(d=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),l=(e,t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var E,S,C=u.print||console.log.bind(console),x=u.printErr||console.error.bind(console);Object.assign(u,p),p=null,u.arguments&&(h=u.arguments),u.thisProgram&&(f=u.thisProgram),u.quit&&(m=u.quit),u.wasmBinary&&(E=u.wasmBinary),"object"!=typeof WebAssembly&&Z("no native wasm support detected");var k,T,A,P,q,F,L,D,B,R,M,I=!1;function O(e,t){e||Z(t)}function j(){var e=S.buffer;u.HEAP8=T=new Int8Array(e),u.HEAP16=P=new Int16Array(e),u.HEAPU8=A=new Uint8Array(e),u.HEAPU16=q=new Uint16Array(e),u.HEAP32=F=new Int32Array(e),u.HEAPU32=L=new Uint32Array(e),u.HEAPF32=D=new Float32Array(e),u.HEAPF64=M=new Float64Array(e),u.HEAP64=B=new BigInt64Array(e),u.HEAPU64=R=new BigUint64Array(e)}var U=u.INITIAL_MEMORY||16777216;S=u.wasmMemory?u.wasmMemory:new WebAssembly.Memory({initial:U/65536,maximum:32768}),j(),U=S.buffer.byteLength;var $=[],N=[],H=[],V=[],W=0,z=null,G=null;function Y(e){W++,u.monitorRunDependencies?.(W)}function X(e){if(W--,u.monitorRunDependencies?.(W),0==W&&(null!==z&&(clearInterval(z),z=null),G)){var t=G;G=null,t()}}function Z(e){u.onAbort?.(e),x(e="Aborted("+e+")"),I=!0,k=1,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}var K,Q,J=e=>e.startsWith("data:application/octet-stream;base64,"),ee=e=>e.startsWith("file://");function te(e){if(e==K&&E)return new Uint8Array(E);if(d)return d(e);throw"both async and sync fetching of the wasm failed"}function re(e,t,r){return function(e){return E||!g&&!y||"function"!=typeof fetch?Promise.resolve().then((()=>te(e))):fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw`failed to load wasm binary file at '${e}'`;return t.arrayBuffer()})).catch((()=>te(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{x(`failed to asynchronously prepare wasm: ${e}`),Z(e)}))}J(K="cesdk.wasm")||(Q=K,K=u.locateFile?u.locateFile(Q,v):v+Q);var ne={2400928:(e,t,r,n,o)=>"undefined"==typeof window||void 0===(window.AudioContext||window.webkitAudioContext)?0:(void 0===window.miniaudio&&(window.miniaudio={referenceCount:0},window.miniaudio.device_type={},window.miniaudio.device_type.playback=e,window.miniaudio.device_type.capture=t,window.miniaudio.device_type.duplex=r,window.miniaudio.device_state={},window.miniaudio.device_state.stopped=n,window.miniaudio.device_state.started=o,miniaudio.devices=[],miniaudio.track_device=function(e){for(var t=0;t<miniaudio.devices.length;++t)if(null==miniaudio.devices[t])return miniaudio.devices[t]=e,t;return miniaudio.devices.push(e),miniaudio.devices.length-1},miniaudio.untrack_device_by_index=function(e){for(miniaudio.devices[e]=null;miniaudio.devices.length>0&&null==miniaudio.devices[miniaudio.devices.length-1];)miniaudio.devices.pop()},miniaudio.untrack_device=function(e){for(var t=0;t<miniaudio.devices.length;++t)if(miniaudio.devices[t]==e)return miniaudio.untrack_device_by_index(t)},miniaudio.get_device_by_index=function(e){return miniaudio.devices[e]},miniaudio.unlock_event_types=function(){return["touchstart","touchend","click"]}(),miniaudio.unlock=function(){for(var e=0;e<miniaudio.devices.length;++e){var t=miniaudio.devices[e];null!=t&&null!=t.webaudio&&2===t.state&&t.webaudio.resume()}miniaudio.unlock_event_types.map((function(e){document.removeEventListener(e,miniaudio.unlock,!0)}))},miniaudio.unlock_event_types.map((function(e){document.addEventListener(e,miniaudio.unlock,!0)}))),window.miniaudio.referenceCount+=1,1),2402918:()=>{void 0!==window.miniaudio&&(window.miniaudio.referenceCount-=1,0===window.miniaudio.referenceCount&&delete window.miniaudio)},2403082:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,2403186:()=>{try{var e=new(window.AudioContext||window.webkitAudioContext),t=e.sampleRate;return e.close(),t}catch(e){return 0}},2403357:(e,t,r,n,o,i)=>{var a=e,s=t,c=r,l=n,d=o,p=i;if(void 0===window.miniaudio)return-1;var h={},f={};a==window.miniaudio.device_type.playback&&(f.sampleRate=c),h.webaudio=new(window.AudioContext||window.webkitAudioContext)(f),h.webaudio.suspend(),h.state=window.miniaudio.device_state.stopped;var m=0,g=s;return a!=window.miniaudio.device_type.playback&&(m=s),h.scriptNode=h.webaudio.createScriptProcessor(l,m,g),h.scriptNode.onaudioprocess=function(e){if(null!=h.intermediaryBufferView&&0!=h.intermediaryBufferView.length||(h.intermediaryBufferView=new Float32Array(u.HEAPF32.buffer,d,l*s)),a==miniaudio.device_type.capture||a==miniaudio.device_type.duplex){for(var t=0;t<s;t+=1)for(var r=e.inputBuffer.getChannelData(t),n=h.intermediaryBufferView,o=0;o<l;o+=1)n[o*s+t]=r[o];Du(p,l,d)}if(a==miniaudio.device_type.playback||a==miniaudio.device_type.duplex)for(Bu(p,l,d),t=0;t<e.outputBuffer.numberOfChannels;++t){var i=e.outputBuffer.getChannelData(t);for(n=h.intermediaryBufferView,o=0;o<l;o+=1)i[o]=n[o*s+t]}else for(t=0;t<e.outputBuffer.numberOfChannels;++t)e.outputBuffer.getChannelData(t).fill(0)},a!=miniaudio.device_type.capture&&a!=miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){h.streamNode=h.webaudio.createMediaStreamSource(e),h.streamNode.connect(h.scriptNode),h.scriptNode.connect(h.webaudio.destination)})).catch((function(e){console.log("Failed to get user media: "+e)})),a==miniaudio.device_type.playback&&h.scriptNode.connect(h.webaudio.destination),miniaudio.track_device(h)},2406140:e=>miniaudio.get_device_by_index(e).webaudio.sampleRate,2406206:e=>{var t=miniaudio.get_device_by_index(e);void 0!==t.scriptNode&&(t.scriptNode.onaudioprocess=function(e){},t.scriptNode.disconnect(),t.scriptNode=void 0),void 0!==t.streamNode&&(t.streamNode.disconnect(),t.streamNode=void 0),t.webaudio.close(),t.webaudio=void 0},2406571:e=>{miniaudio.untrack_device_by_index(e)},2406614:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.resume(),t.state=miniaudio.device_state.started},2406739:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.suspend(),t.state=miniaudio.device_state.stopped},2406865:()=>!!globalThis.ubq_browserTabHidden,2406911:()=>T.length};function oe(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var ie=e=>{for(;e.length>0;)e.shift()(u)},ae=u.noExitRuntime||!0,se=[],ue=0;class ExceptionInfo{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){L[this.ptr+4>>2]=e}get_type(){return L[this.ptr+4>>2]}set_destructor(e){L[this.ptr+8>>2]=e}get_destructor(){return L[this.ptr+8>>2]}set_caught(e){e=e?1:0,T[this.ptr+12>>0]=e}get_caught(){return 0!=T[this.ptr+12>>0]}set_rethrown(e){e=e?1:0,T[this.ptr+13>>0]=e}get_rethrown(){return 0!=T[this.ptr+13>>0]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){L[this.ptr+16>>2]=e}get_adjusted_ptr(){return L[this.ptr+16>>2]}get_exception_ptr(){if(Wu(this.get_type()))return L[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var ce=e=>{var t=ue;if(!t)return Ru(0),0;var r=new ExceptionInfo(t);r.set_adjusted_ptr(t);var n=r.get_type();if(!n)return Ru(0),t;for(var o in e){var i=e[o];if(0===i||i===n)break;var a=r.ptr+16;if(Vu(i,n,a))return Ru(i),t}return Ru(n),t},le={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=le.isAbs(e),r="/"===e.substr(-1);return(e=le.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=le.splitPath(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=le.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return le.normalize(e.join("/"))},join2:(e,t)=>le.normalize(e+"/"+t)},de=e=>(de=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(b)try{var e=ct();if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}Z("initRandomDevice")})())(e),pe={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:Ce.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,t=le.isAbs(n)}return(t?"/":"")+(e=le.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=pe.resolve(e).substr(1),t=pe.resolve(t).substr(1);for(var n=r(e.split("/")),o=r(t.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s<i;s++)if(n[s]!==o[s]){a=s;break}var u=[];for(s=a;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(a))).join("/")}},he="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,fe=(e,t,r)=>{for(var n=t+r,o=t;e[o]&&!(o>=n);)++o;if(o-t>16&&e.buffer&&he)return he.decode(e.subarray(t,o));for(var i="";t<o;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var u=63&e[t++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(a);else{var c=a-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i},me=[],ge=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},ye=(e,t,r,n)=>{if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(r>=i)break;t[r++]=s}else if(s<=2047){if(r+1>=i)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=i)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-o};function be(e,t,r){var n=r>0?r:ge(e)+1,o=new Array(n),i=ye(e,o,0,o.length);return t&&(o.length=i),o}var ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Ce.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Ce.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,n,o){if(!e.tty||!e.tty.ops.get_char)throw new Ce.ErrnoError(60);for(var i=0,a=0;a<n;a++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new Ce.ErrnoError(29)}if(void 0===s&&0===i)throw new Ce.ErrnoError(6);if(null==s)break;i++,t[r+a]=s}return i&&(e.node.timestamp=Date.now()),i},write(e,t,r,n,o){if(!e.tty||!e.tty.ops.put_char)throw new Ce.ErrnoError(60);try{for(var i=0;i<n;i++)e.tty.ops.put_char(e.tty,t[r+i])}catch(e){throw new Ce.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:e=>(()=>{if(!me.length){var e=null;if(b){var t=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=w.readSync(n,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;me=be(e,!0)}return me.shift()})(),put_char(e,t){null===t||10===t?(C(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(C(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(x(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(x(fe(e.output,0)),e.output=[])}}},we=e=>{e=((e,t)=>Math.ceil(e/t)*t)(e,65536);var t=Iu(65536,e);return t?((e,t)=>(A.fill(0,e,e+t),e))(t,e):0},_e={ops_table:null,mount:e=>_e.createNode(null,"/",16895,0),createNode(e,t,r,n){if(Ce.isBlkdev(r)||Ce.isFIFO(r))throw new Ce.ErrnoError(63);_e.ops_table||={dir:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr,lookup:_e.node_ops.lookup,mknod:_e.node_ops.mknod,rename:_e.node_ops.rename,unlink:_e.node_ops.unlink,rmdir:_e.node_ops.rmdir,readdir:_e.node_ops.readdir,symlink:_e.node_ops.symlink},stream:{llseek:_e.stream_ops.llseek}},file:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr},stream:{llseek:_e.stream_ops.llseek,read:_e.stream_ops.read,write:_e.stream_ops.write,allocate:_e.stream_ops.allocate,mmap:_e.stream_ops.mmap,msync:_e.stream_ops.msync}},link:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr,readlink:_e.node_ops.readlink},stream:{}},chrdev:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr},stream:Ce.chrdev_stream_ops}};var o=Ce.createNode(e,t,r,n);return Ce.isDir(o.mode)?(o.node_ops=_e.ops_table.dir.node,o.stream_ops=_e.ops_table.dir.stream,o.contents={}):Ce.isFile(o.mode)?(o.node_ops=_e.ops_table.file.node,o.stream_ops=_e.ops_table.file.stream,o.usedBytes=0,o.contents=null):Ce.isLink(o.mode)?(o.node_ops=_e.ops_table.link.node,o.stream_ops=_e.ops_table.link.stream):Ce.isChrdev(o.mode)&&(o.node_ops=_e.ops_table.chrdev.node,o.stream_ops=_e.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[t]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var n=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Ce.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Ce.isDir(e.mode)?t.size=4096:Ce.isFile(e.mode)?t.size=e.usedBytes:Ce.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&_e.resizeFileStorage(e,t.size)},lookup(e,t){throw Ce.genericErrors[44]},mknod:(e,t,r,n)=>_e.createNode(e,t,r,n),rename(e,t,r){if(Ce.isDir(e.mode)){var n;try{n=Ce.lookupNode(t,r)}catch(e){}if(n)for(var o in n.contents)throw new Ce.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Ce.lookupNode(e,t);for(var n in r.contents)throw new Ce.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r of Object.keys(e.contents))t.push(r);return t},symlink(e,t,r){var n=_e.createNode(e,t,41471,0);return n.link=r,n},readlink(e){if(!Ce.isLink(e.mode))throw new Ce.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(a>8&&i.subarray)t.set(i.subarray(o,o+a),r);else for(var s=0;s<a;s++)t[r+s]=i[o+s];return a},write(e,t,r,n,o,i){if(t.buffer===T.buffer&&(i=!1),!n)return 0;var a=e.node;if(a.timestamp=Date.now(),t.subarray&&(!a.contents||a.contents.subarray)){if(i)return a.contents=t.subarray(r,r+n),a.usedBytes=n,n;if(0===a.usedBytes&&0===o)return a.contents=t.slice(r,r+n),a.usedBytes=n,n;if(o+n<=a.usedBytes)return a.contents.set(t.subarray(r,r+n),o),n}if(_e.expandFileStorage(a,o+n),a.contents.subarray&&t.subarray)a.contents.set(t.subarray(r,r+n),o);else for(var s=0;s<n;s++)a.contents[o+s]=t[r+s];return a.usedBytes=Math.max(a.usedBytes,o+n),n},llseek(e,t,r){var n=t;if(1===r?n+=e.position:2===r&&Ce.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new Ce.ErrnoError(28);return n},allocate(e,t,r){_e.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap(e,t,r,n,o){if(!Ce.isFile(e.node.mode))throw new Ce.ErrnoError(43);var i,a,s=e.node.contents;if(2&o||s.buffer!==T.buffer){if((r>0||r+t<s.length)&&(s=s.subarray?s.subarray(r,r+t):Array.prototype.slice.call(s,r,r+t)),a=!0,!(i=we(t)))throw new Ce.ErrnoError(48);T.set(s,i)}else a=!1,i=s.byteOffset;return{ptr:i,allocated:a}},msync:(e,t,r,n,o)=>(_e.stream_ops.write(e,t,0,n,r,!1),0)}},Ee=u.preloadPlugins||[],Se=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Ce={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e,t={}){if(!(e=pe.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new Ce.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),n=Ce.root,o="/",i=0;i<r.length;i++){var a=i===r.length-1;if(a&&t.parent)break;if(n=Ce.lookupNode(n,r[i]),o=le.join2(o,r[i]),Ce.isMountpoint(n)&&(!a||a&&t.follow_mount)&&(n=n.mounted.root),!a||t.follow)for(var s=0;Ce.isLink(n.mode);){var u=Ce.readlink(o);if(o=pe.resolve(le.dirname(o),u),n=Ce.lookupPath(o,{recurse_count:t.recurse_count+1}).node,s++>40)throw new Ce.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var t;;){if(Ce.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%Ce.nameTable.length},hashAddNode(e){var t=Ce.hashName(e.parent.id,e.name);e.name_next=Ce.nameTable[t],Ce.nameTable[t]=e},hashRemoveNode(e){var t=Ce.hashName(e.parent.id,e.name);if(Ce.nameTable[t]===e)Ce.nameTable[t]=e.name_next;else for(var r=Ce.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Ce.mayLookup(e);if(r)throw new Ce.ErrnoError(r);for(var n=Ce.hashName(e.id,t),o=Ce.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===t)return o}return Ce.lookup(e,t)},createNode(e,t,r,n){var o=new Ce.FSNode(e,t,r,n);return Ce.hashAddNode(o),o},destroyNode(e){Ce.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Ce.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){if(!Ce.isDir(e.mode))return 54;var t=Ce.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return Ce.lookupNode(e,t),20}catch(e){}return Ce.nodePermissions(e,"wx")},mayDelete(e,t,r){var n;try{n=Ce.lookupNode(e,t)}catch(e){return e.errno}var o=Ce.nodePermissions(e,"wx");if(o)return o;if(r){if(!Ce.isDir(n.mode))return 54;if(Ce.isRoot(n)||Ce.getPath(n)===Ce.cwd())return 10}else if(Ce.isDir(n.mode))return 31;return 0},mayOpen:(e,t)=>e?Ce.isLink(e.mode)?32:Ce.isDir(e.mode)&&("r"!==Ce.flagsToPermissionString(t)||512&t)?31:Ce.nodePermissions(e,Ce.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Ce.MAX_OPEN_FDS;e++)if(!Ce.streams[e])return e;throw new Ce.ErrnoError(33)},getStreamChecked(e){var t=Ce.getStream(e);if(!t)throw new Ce.ErrnoError(8);return t},getStream:e=>Ce.streams[e],createStream:(e,t=-1)=>(Ce.FSStream||(Ce.FSStream=function(){this.shared={}},Ce.FSStream.prototype={},Object.defineProperties(Ce.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Ce.FSStream,e),-1==t&&(t=Ce.nextfd()),e.fd=t,Ce.streams[t]=e,e),closeStream(e){Ce.streams[e]=null},chrdev_stream_ops:{open(e){var t=Ce.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Ce.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Ce.devices[e]={stream_ops:t}},getDevice:e=>Ce.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push.apply(r,n.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Ce.syncFSRequests++,Ce.syncFSRequests>1&&x(`warning: ${Ce.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Ce.getMounts(Ce.root.mount),n=0;function o(e){return Ce.syncFSRequests--,t(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++n>=r.length&&o(null)}r.forEach((t=>{if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)}))},mount(e,t,r){var n,o="/"===r,i=!r;if(o&&Ce.root)throw new Ce.ErrnoError(10);if(!o&&!i){var a=Ce.lookupPath(r,{follow_mount:!1});if(r=a.path,n=a.node,Ce.isMountpoint(n))throw new Ce.ErrnoError(10);if(!Ce.isDir(n.mode))throw new Ce.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?Ce.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var t=Ce.lookupPath(e,{follow_mount:!1});if(!Ce.isMountpoint(t.node))throw new Ce.ErrnoError(28);var r=t.node,n=r.mounted,o=Ce.getMounts(n);Object.keys(Ce.nameTable).forEach((e=>{for(var t=Ce.nameTable[e];t;){var r=t.name_next;o.includes(t.mount)&&Ce.destroyNode(t),t=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var n=Ce.lookupPath(e,{parent:!0}).node,o=le.basename(e);if(!o||"."===o||".."===o)throw new Ce.ErrnoError(28);var i=Ce.mayCreate(n,o);if(i)throw new Ce.ErrnoError(i);if(!n.node_ops.mknod)throw new Ce.ErrnoError(63);return n.node_ops.mknod(n,o,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Ce.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Ce.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),n="",o=0;o<r.length;++o)if(r[o]){n+="/"+r[o];try{Ce.mkdir(n,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>(void 0===r&&(r=t,t=438),t|=8192,Ce.mknod(e,t,r)),symlink(e,t){if(!pe.resolve(e))throw new Ce.ErrnoError(44);var r=Ce.lookupPath(t,{parent:!0}).node;if(!r)throw new Ce.ErrnoError(44);var n=le.basename(t),o=Ce.mayCreate(r,n);if(o)throw new Ce.ErrnoError(o);if(!r.node_ops.symlink)throw new Ce.ErrnoError(63);return r.node_ops.symlink(r,n,e)},rename(e,t){var r,n,o=le.dirname(e),i=le.dirname(t),a=le.basename(e),s=le.basename(t);if(r=Ce.lookupPath(e,{parent:!0}).node,n=Ce.lookupPath(t,{parent:!0}).node,!r||!n)throw new Ce.ErrnoError(44);if(r.mount!==n.mount)throw new Ce.ErrnoError(75);var u,c=Ce.lookupNode(r,a),l=pe.relative(e,i);if("."!==l.charAt(0))throw new Ce.ErrnoError(28);if("."!==(l=pe.relative(t,o)).charAt(0))throw new Ce.ErrnoError(55);try{u=Ce.lookupNode(n,s)}catch(e){}if(c!==u){var d=Ce.isDir(c.mode),p=Ce.mayDelete(r,a,d);if(p)throw new Ce.ErrnoError(p);if(p=u?Ce.mayDelete(n,s,d):Ce.mayCreate(n,s))throw new Ce.ErrnoError(p);if(!r.node_ops.rename)throw new Ce.ErrnoError(63);if(Ce.isMountpoint(c)||u&&Ce.isMountpoint(u))throw new Ce.ErrnoError(10);if(n!==r&&(p=Ce.nodePermissions(r,"w")))throw new Ce.ErrnoError(p);Ce.hashRemoveNode(c);try{r.node_ops.rename(c,n,s)}catch(e){throw e}finally{Ce.hashAddNode(c)}}},rmdir(e){var t=Ce.lookupPath(e,{parent:!0}).node,r=le.basename(e),n=Ce.lookupNode(t,r),o=Ce.mayDelete(t,r,!0);if(o)throw new Ce.ErrnoError(o);if(!t.node_ops.rmdir)throw new Ce.ErrnoError(63);if(Ce.isMountpoint(n))throw new Ce.ErrnoError(10);t.node_ops.rmdir(t,r),Ce.destroyNode(n)},readdir(e){var t=Ce.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Ce.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Ce.lookupPath(e,{parent:!0}).node;if(!t)throw new Ce.ErrnoError(44);var r=le.basename(e),n=Ce.lookupNode(t,r),o=Ce.mayDelete(t,r,!1);if(o)throw new Ce.ErrnoError(o);if(!t.node_ops.unlink)throw new Ce.ErrnoError(63);if(Ce.isMountpoint(n))throw new Ce.ErrnoError(10);t.node_ops.unlink(t,r),Ce.destroyNode(n)},readlink(e){var t=Ce.lookupPath(e).node;if(!t)throw new Ce.ErrnoError(44);if(!t.node_ops.readlink)throw new Ce.ErrnoError(28);return pe.resolve(Ce.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Ce.lookupPath(e,{follow:!t}).node;if(!r)throw new Ce.ErrnoError(44);if(!r.node_ops.getattr)throw new Ce.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Ce.stat(e,!0),chmod(e,t,r){var n;if(!(n="string"==typeof e?Ce.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Ce.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&t|-4096&n.mode,timestamp:Date.now()})},lchmod(e,t){Ce.chmod(e,t,!0)},fchmod(e,t){var r=Ce.getStreamChecked(e);Ce.chmod(r.node,t)},chown(e,t,r,n){var o;if(!(o="string"==typeof e?Ce.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new Ce.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,t,r){Ce.chown(e,t,r,!0)},fchown(e,t,r){var n=Ce.getStreamChecked(e);Ce.chown(n.node,t,r)},truncate(e,t){if(t<0)throw new Ce.ErrnoError(28);var r;if(!(r="string"==typeof e?Ce.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Ce.ErrnoError(63);if(Ce.isDir(r.mode))throw new Ce.ErrnoError(31);if(!Ce.isFile(r.mode))throw new Ce.ErrnoError(28);var n=Ce.nodePermissions(r,"w");if(n)throw new Ce.ErrnoError(n);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Ce.getStreamChecked(e);if(0==(2097155&r.flags))throw new Ce.ErrnoError(28);Ce.truncate(r.node,t)},utime(e,t,r){var n=Ce.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Ce.ErrnoError(44);var n;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t})(t):t)?4095&r|32768:0,"object"==typeof e)n=e;else{e=le.normalize(e);try{n=Ce.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var o=!1;if(64&t)if(n){if(128&t)throw new Ce.ErrnoError(20)}else n=Ce.mknod(e,r,0),o=!0;if(!n)throw new Ce.ErrnoError(44);if(Ce.isChrdev(n.mode)&&(t&=-513),65536&t&&!Ce.isDir(n.mode))throw new Ce.ErrnoError(54);if(!o){var i=Ce.mayOpen(n,t);if(i)throw new Ce.ErrnoError(i)}512&t&&!o&&Ce.truncate(n,0),t&=-131713;var a=Ce.createStream({node:n,path:Ce.getPath(n),flags:t,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!u.logReadFiles||1&t||(Ce.readFiles||(Ce.readFiles={}),e in Ce.readFiles||(Ce.readFiles[e]=1)),a},close(e){if(Ce.isClosed(e))throw new Ce.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Ce.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Ce.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Ce.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,n,o){if(n<0||o<0)throw new Ce.ErrnoError(28);if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(1==(2097155&e.flags))throw new Ce.ErrnoError(8);if(Ce.isDir(e.node.mode))throw new Ce.ErrnoError(31);if(!e.stream_ops.read)throw new Ce.ErrnoError(28);var i=void 0!==o;if(i){if(!e.seekable)throw new Ce.ErrnoError(70)}else o=e.position;var a=e.stream_ops.read(e,t,r,n,o);return i||(e.position+=a),a},write(e,t,r,n,o,i){if(n<0||o<0)throw new Ce.ErrnoError(28);if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(0==(2097155&e.flags))throw new Ce.ErrnoError(8);if(Ce.isDir(e.node.mode))throw new Ce.ErrnoError(31);if(!e.stream_ops.write)throw new Ce.ErrnoError(28);e.seekable&&1024&e.flags&&Ce.llseek(e,0,2);var a=void 0!==o;if(a){if(!e.seekable)throw new Ce.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,t,r,n,o,i);return a||(e.position+=s),s},allocate(e,t,r){if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(t<0||r<=0)throw new Ce.ErrnoError(28);if(0==(2097155&e.flags))throw new Ce.ErrnoError(8);if(!Ce.isFile(e.node.mode)&&!Ce.isDir(e.node.mode))throw new Ce.ErrnoError(43);if(!e.stream_ops.allocate)throw new Ce.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&e.flags))throw new Ce.ErrnoError(2);if(1==(2097155&e.flags))throw new Ce.ErrnoError(2);if(!e.stream_ops.mmap)throw new Ce.ErrnoError(43);return e.stream_ops.mmap(e,t,r,n,o)},msync:(e,t,r,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,n,o):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Ce.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,n=Ce.open(e,t.flags),o=Ce.stat(e).size,i=new Uint8Array(o);return Ce.read(n,i,0,o,0),"utf8"===t.encoding?r=fe(i,0):"binary"===t.encoding&&(r=i),Ce.close(n),r},writeFile(e,t,r={}){r.flags=r.flags||577;var n=Ce.open(e,r.flags,r.mode);if("string"==typeof t){var o=new Uint8Array(ge(t)+1),i=ye(t,o,0,o.length);Ce.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Ce.write(n,t,0,t.byteLength,void 0,r.canOwn)}Ce.close(n)},cwd:()=>Ce.currentPath,chdir(e){var t=Ce.lookupPath(e,{follow:!0});if(null===t.node)throw new Ce.ErrnoError(44);if(!Ce.isDir(t.node.mode))throw new Ce.ErrnoError(54);var r=Ce.nodePermissions(t.node,"x");if(r)throw new Ce.ErrnoError(r);Ce.currentPath=t.path},createDefaultDirectories(){Ce.mkdir("/tmp"),Ce.mkdir("/home"),Ce.mkdir("/home/web_user")},createDefaultDevices(){Ce.mkdir("/dev"),Ce.registerDevice(Ce.makedev(1,3),{read:()=>0,write:(e,t,r,n,o)=>n}),Ce.mkdev("/dev/null",Ce.makedev(1,3)),ve.register(Ce.makedev(5,0),ve.default_tty_ops),ve.register(Ce.makedev(6,0),ve.default_tty1_ops),Ce.mkdev("/dev/tty",Ce.makedev(5,0)),Ce.mkdev("/dev/tty1",Ce.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=de(e).byteLength),e[--t]);Ce.createDevice("/dev","random",r),Ce.createDevice("/dev","urandom",r),Ce.mkdir("/dev/shm"),Ce.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Ce.mkdir("/proc");var e=Ce.mkdir("/proc/self");Ce.mkdir("/proc/self/fd"),Ce.mount({mount(){var t=Ce.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,n=Ce.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},t}},{},"/proc/self/fd")},createStandardStreams(){u.stdin?Ce.createDevice("/dev","stdin",u.stdin):Ce.symlink("/dev/tty","/dev/stdin"),u.stdout?Ce.createDevice("/dev","stdout",null,u.stdout):Ce.symlink("/dev/tty","/dev/stdout"),u.stderr?Ce.createDevice("/dev","stderr",null,u.stderr):Ce.symlink("/dev/tty1","/dev/stderr"),Ce.open("/dev/stdin",0),Ce.open("/dev/stdout",1),Ce.open("/dev/stderr",1)},staticInit(){[44].forEach((e=>{Ce.genericErrors[e]=new Ce.ErrnoError(e),Ce.genericErrors[e].stack="<generic error, no stack>"})),Ce.nameTable=new Array(4096),Ce.mount(_e,{},"/"),Ce.createDefaultDirectories(),Ce.createDefaultDevices(),Ce.createSpecialDirectories(),Ce.filesystems={MEMFS:_e}},init(e,t,r){Ce.init.initialized=!0,u.stdin=e||u.stdin,u.stdout=t||u.stdout,u.stderr=r||u.stderr,Ce.createStandardStreams()},quit(){Ce.init.initialized=!1;for(var e=0;e<Ce.streams.length;e++){var t=Ce.streams[e];t&&Ce.close(t)}},findObject(e,t){var r=Ce.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(n=Ce.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Ce.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=le.basename(e),n=Ce.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,n){e="string"==typeof e?e:Ce.getPath(e);for(var o=t.split("/").reverse();o.length;){var i=o.pop();if(i){var a=le.join2(e,i);try{Ce.mkdir(a)}catch(e){}e=a}}return a},createFile(e,t,r,n,o){var i=le.join2("string"==typeof e?e:Ce.getPath(e),t),a=Se(n,o);return Ce.create(i,a)},createDataFile(e,t,r,n,o,i){var a=t;e&&(e="string"==typeof e?e:Ce.getPath(e),a=t?le.join2(e,t):e);var s=Se(n,o),u=Ce.create(a,s);if(r){if("string"==typeof r){for(var c=new Array(r.length),l=0,d=r.length;l<d;++l)c[l]=r.charCodeAt(l);r=c}Ce.chmod(u,146|s);var p=Ce.open(u,577);Ce.write(p,r,0,r.length,0,i),Ce.close(p),Ce.chmod(u,s)}},createDevice(e,t,r,n){var o=le.join2("string"==typeof e?e:Ce.getPath(e),t),i=Se(!!r,!!n);Ce.createDevice.major||(Ce.createDevice.major=64);var a=Ce.makedev(Ce.createDevice.major++,0);return Ce.registerDevice(a,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,t,n,o,i){for(var a=0,s=0;s<o;s++){var u;try{u=r()}catch(e){throw new Ce.ErrnoError(29)}if(void 0===u&&0===a)throw new Ce.ErrnoError(6);if(null==u)break;a++,t[n+s]=u}return a&&(e.node.timestamp=Date.now()),a},write(e,t,r,o,i){for(var a=0;a<o;a++)try{n(t[r+a])}catch(e){throw new Ce.ErrnoError(29)}return o&&(e.node.timestamp=Date.now()),a}}),Ce.mkdev(o,i,a)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!c)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=be(c(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new Ce.ErrnoError(29)}},createLazyFile(e,t,r,n,o){function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},i.prototype.setDataGetter=function(e){this.getter=e},i.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,n=Number(e.getResponseHeader("Content-length")),o=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,i=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;o||(a=n);var s=this;s.setDataGetter((e=>{var t=e*a,o=(e+1)*a-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==a&&o.setRequestHeader("Range","bytes="+e+"-"+t),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):be(o.responseText||"",!0)})(t,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!i&&n||(a=n=1,n=this.getter(0).length,a=n,C("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!y)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new i;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:r};var u=Ce.createFile(e,t,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var c={};function l(e,t,r,n,o){var i=e.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s<a;s++)t[r+s]=i[o+s];else for(s=0;s<a;s++)t[r+s]=i.get(o+s);return a}return Object.keys(u.stream_ops).forEach((e=>{var t=u.stream_ops[e];c[e]=function(){return Ce.forceLoadFile(u),t.apply(null,arguments)}})),c.read=(e,t,r,n,o)=>(Ce.forceLoadFile(u),l(e,t,r,n,o)),c.mmap=(e,t,r,n,o)=>{Ce.forceLoadFile(u);var i=we(t);if(!i)throw new Ce.ErrnoError(48);return l(e,T,i,t,r),{ptr:i,allocated:!0}},u.stream_ops=c,u}},xe=(e,t)=>e?fe(A,e,t):"",ke={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(le.isAbs(t))return t;var n;if(n=-100===e?Ce.cwd():ke.getStreamFromFD(e).path,0==t.length){if(!r)throw new Ce.ErrnoError(44);return n}return le.join2(n,t)},doStat(e,t,r){var n=e(t);F[r>>2]=n.dev,F[r+4>>2]=n.mode,L[r+8>>2]=n.nlink,F[r+12>>2]=n.uid,F[r+16>>2]=n.gid,F[r+20>>2]=n.rdev,B[r+24>>3]=BigInt(n.size),F[r+32>>2]=4096,F[r+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),a=n.ctime.getTime();return B[r+40>>3]=BigInt(Math.floor(o/1e3)),L[r+48>>2]=o%1e3*1e3,B[r+56>>3]=BigInt(Math.floor(i/1e3)),L[r+64>>2]=i%1e3*1e3,B[r+72>>3]=BigInt(Math.floor(a/1e3)),L[r+80>>2]=a%1e3*1e3,B[r+88>>3]=BigInt(n.ino),0},doMsync(e,t,r,n,o){if(!Ce.isFile(t.node.mode))throw new Ce.ErrnoError(43);if(2&n)return 0;var i=A.slice(e,e+r);Ce.msync(t,i,o,r,n)},varargs:void 0,get(){var e=F[+ke.varargs>>2];return ke.varargs+=4,e},getp:()=>ke.get(),getStr:e=>xe(e),getStreamFromFD:e=>Ce.getStreamChecked(e)},Te={},Ae=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Pe(e){return this.fromWireType(F[e>>2])}var qe,Fe,Le,De={},Be={},Re={},Me=e=>{throw new qe(e)},Ie=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&Me("Mismatched type converter count");for(var o=0;o<e.length;++o)Ne(e[o],n[o])}e.forEach((function(e){Re[e]=t}));var o=new Array(t.length),i=[],a=0;t.forEach(((e,t)=>{Be.hasOwnProperty(e)?o[t]=Be[e]:(i.push(e),De.hasOwnProperty(e)||(De[e]=[]),De[e].push((()=>{o[t]=Be[e],++a===i.length&&n(o)})))})),0===i.length&&n(o)},Oe={},je=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Ue=e=>{for(var t="",r=e;A[r];)t+=Fe[A[r++]];return t},$e=e=>{throw new Le(e)};function Ne(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||$e(`type "${n}" must have a positive integer typeid pointer`),Be.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;$e(`Cannot register type '${n}' twice`)}if(Be[e]=t,delete Re[e],De.hasOwnProperty(e)){var o=De[e];delete De[e],o.forEach((e=>e()))}}(e,t,r)}var He,Ve=(e,t,r)=>{switch(t){case 1:return r?e=>T[e>>0]:e=>A[e>>0];case 2:return r?e=>P[e>>1]:e=>q[e>>1];case 4:return r?e=>F[e>>2]:e=>L[e>>2];case 8:return r?e=>B[e>>3]:e=>R[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},We=8,ze=e=>{$e(e.$$.ptrType.registeredClass.name+" instance already deleted")},Ge=!1,Ye=e=>{},Xe=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},Ze=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=Ze(e,t,r.baseClass);return null===n?null:r.downcast(n)},Ke={},Qe=()=>Object.keys(nt).length,Je=()=>{var e=[];for(var t in nt)nt.hasOwnProperty(t)&&e.push(nt[t]);return e},et=[],tt=()=>{for(;et.length;){var e=et.pop();e.$$.deleteScheduled=!1,e.delete()}},rt=e=>{He=e,et.length&&He&&He(tt)},nt={},ot=(e,t)=>(t=((e,t)=>{for(void 0===t&&$e("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),nt[t]),it=(e,t)=>(t.ptrType&&t.ptr||Me("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Me("Both smartPtrType and smartPtr must be specified"),t.count={value:1},st(Object.create(e,{$$:{value:t,writable:!0}})));function at(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ot(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?it(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):it(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,a=this.registeredClass.getActualType(t),s=Ke[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=Ze(t,this.registeredClass,i.registeredClass);return null===u?o.call(this):this.isSmartPointer?it(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:e}):it(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})}var st=e=>"undefined"==typeof FinalizationRegistry?(st=e=>e,e):(Ge=new FinalizationRegistry((e=>{Xe(e.$$)})),Ye=e=>Ge.unregister(e),(st=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Ge.register(e,r,e)}return e})(e));function ut(){}var lt=(e,t)=>Object.defineProperty(t,"name",{value:e}),dt=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||$e(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},pt=(e,t,r)=>{u.hasOwnProperty(e)?((void 0===r||void 0!==u[e].overloadTable&&void 0!==u[e].overloadTable[r])&&$e(`Cannot register public name '${e}' twice`),dt(u,e,e),u.hasOwnProperty(r)&&$e(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),u[e].overloadTable[r]=t):(u[e]=t,void 0!==r&&(u[e].numArguments=r))};function ht(e,t,r,n,o,i,a,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}var ft=(e,t,r)=>{for(;t!==r;)t.upcast||$e(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function mt(e,t){if(null===t)return this.isReference&&$e(`null is not a valid ${this.name}`),0;t.$$||$e(`Cannot pass "${je(t)}" as a ${this.name}`),t.$$.ptr||$e(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ft(t.$$.ptr,r,this.registeredClass)}function gt(e,t){var r;if(null===t)return this.isReference&&$e(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||$e(`Cannot pass "${je(t)}" as a ${this.name}`),t.$$.ptr||$e(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&$e(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=ft(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&$e("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:$e(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var o=t.clone();r=this.rawShare(r,It.toHandle((()=>o.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:$e("Unsupporting sharing policy")}return r}function yt(e,t){if(null===t)return this.isReference&&$e(`null is not a valid ${this.name}`),0;t.$$||$e(`Cannot pass "${je(t)}" as a ${this.name}`),t.$$.ptr||$e(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&$e(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ft(t.$$.ptr,r,this.registeredClass)}function bt(e){return this.fromWireType(L[e>>2])}function vt(e,t,r,n,o,i,a,s,u,c,l){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,o||void 0!==t.baseClass?this.toWireType=gt:n?(this.toWireType=mt,this.destructorFunction=null):(this.toWireType=yt,this.destructorFunction=null)}var wt,_t,Et=(e,t,r)=>{u.hasOwnProperty(e)||Me("Replacing nonexistant public symbol"),void 0!==u[e].overloadTable&&void 0!==r?u[e].overloadTable[r]=t:(u[e]=t,u[e].argCount=r)},St=[],Ct=e=>{var t=St[e];return t||(e>=St.length&&(St.length=e+1),St[e]=t=wt.get(e)),t},xt=(e,t)=>{e=Ue(e);var r=Ct(t);return"function"!=typeof r&&$e(`unknown function pointer with signature ${e}: ${t}`),r},kt=e=>{var t=Mu(e),r=Ue(t);return Lu(t),r},Tt=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||Be[t]||(Re[t]?Re[t].forEach(e):(r.push(t),n[t]=!0))})),new _t(`${e}: `+r.map(kt).join([", "]))},At=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(L[t+4*n>>2]);return r};function Pt(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}function qt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=lt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,o=e.apply(n,t);return o instanceof Object?o:n}function Ft(e,t,r,n,o,i){var a=t.length;a<2&&$e("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,u=Pt(t),c="void"!==t[0].name,l=[e,$e,n,o,Ae,t[0],t[1]],d=0;d<a-2;++d)l.push(t[d+2]);if(!u)for(d=s?1:2;d<t.length;++d)null!==t[d].destructorFunction&&l.push(t[d].destructorFunction);let[p,h]=function(e,t,r,n){for(var o=Pt(e),i=e.length,a="",s="",u=0;u<i-2;++u)a+=(0!==u?", ":"")+"arg"+u,s+=(0!==u?", ":"")+"arg"+u+"Wired";var c=`\n return function (${a}) {\n if (arguments.length !== ${i-2}) {\n throwBindingError('function ' + humanName + ' called with ' + arguments.length + ' arguments, expected ${i-2}');\n }`;o&&(c+="var destructors = [];\n");var l=o?"destructors":"null",d=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];for(t&&(c+="var thisWired = classParam['toWireType']("+l+", this);\n"),u=0;u<i-2;++u)c+="var arg"+u+"Wired = argType"+u+"['toWireType']("+l+", arg"+u+");\n",d.push("argType"+u);if(t&&(s="thisWired"+(s.length>0?", ":"")+s),c+=(r||n?"var rv = ":"")+"invoker(fn"+(s.length>0?", ":"")+s+");\n",o)c+="runDestructors(destructors);\n";else for(u=t?1:2;u<e.length;++u){var p=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(c+=p+"_dtor("+p+");\n",d.push(p+"_dtor"))}return r&&(c+="var ret = retType['fromWireType'](rv);\nreturn ret;\n"),[d,c+="}\n"]}(t,s,c,i);p.push(h);var f=qt(Function,p).apply(null,l);return lt(e,f)}var Lt,Dt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Bt=new class HandleAllocator{constructor(){this.allocated=[void 0],this.freelist=[]}get(e){return this.allocated[e]}has(e){return void 0!==this.allocated[e]}allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t}free(e){this.allocated[e]=void 0,this.freelist.push(e)}},Rt=e=>{e>=Bt.reserved&&0==--Bt.get(e).refcount&&Bt.free(e)},Mt=()=>{for(var e=0,t=Bt.reserved;t<Bt.allocated.length;++t)void 0!==Bt.allocated[t]&&++e;return e},It={toValue:e=>(e||$e("Cannot use deleted val. handle = "+e),Bt.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Bt.allocate({refcount:1,value:e})}}},Ot={name:"emscripten::val",fromWireType:e=>{var t=It.toValue(e);return Rt(e),t},toWireType:(e,t)=>It.toHandle(t),argPackAdvance:We,readValueFromPointer:Pe,destructorFunction:null},jt=(e,t,r)=>{switch(t){case 1:return r?function(e){return this.fromWireType(T[e>>0])}:function(e){return this.fromWireType(A[e>>0])};case 2:return r?function(e){return this.fromWireType(P[e>>1])}:function(e){return this.fromWireType(q[e>>1])};case 4:return r?function(e){return this.fromWireType(F[e>>2])}:function(e){return this.fromWireType(L[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Ut=(e,t)=>{var r=Be[e];return void 0===r&&$e(t+" has unknown type "+kt(e)),r},$t=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(D[e>>2])};case 8:return function(e){return this.fromWireType(M[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Nt=(e,t,r)=>ye(e,A,t,r),Ht="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Vt=(e,t)=>{for(var r=e,n=r>>1,o=n+t/2;!(n>=o)&&q[n];)++n;if((r=n<<1)-e>32&&Ht)return Ht.decode(A.subarray(e,r));for(var i="",a=0;!(a>=t/2);++a){var s=P[e+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i},Wt=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,o=(r-=2)<2*e.length?r/2:e.length,i=0;i<o;++i){var a=e.charCodeAt(i);P[t>>1]=a,t+=2}return P[t>>1]=0,t-n},zt=e=>2*e.length,Gt=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var o=F[e+4*r>>2];if(0==o)break;if(++r,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n},Yt=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,o=n+r-4,i=0;i<e.length;++i){var a=e.charCodeAt(i);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++i)),F[t>>2]=a,(t+=4)+4>o)break}return F[t>>2]=0,t-n},Xt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},Zt=(e,t,r)=>{var n=[],o=e.toWireType(n,r);return n.length&&(L[t>>2]=It.toHandle(n)),o},Kt=[],Qt={},Jt=e=>{var t=Qt[e];return void 0===t?Ue(e):t},er=()=>"object"==typeof globalThis?globalThis:function(){return Function}()("return this")(),tr=(Reflect.construct,e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e)),rr=e=>e%4==0&&(e%100!=0||e%400==0),nr=[0,31,60,91,121,152,182,213,244,274,305,335],or=[0,31,59,90,120,151,181,212,243,273,304,334],ir=e=>(rr(e.getFullYear())?nr:or)[e.getMonth()]+e.getDate()-1,ar=e=>{var t=ge(e)+1,r=qu(t);return r&&Nt(e,r,t),r},sr=(e,t)=>{if(fr.mainLoop.timingMode=e,fr.mainLoop.timingValue=t,!fr.mainLoop.func)return 1;if(fr.mainLoop.running||(fr.mainLoop.running=!0),0==e)fr.mainLoop.scheduler=function(){var e=0|Math.max(0,fr.mainLoop.tickStartTime+t-Lt());setTimeout(fr.mainLoop.runner,e)},fr.mainLoop.method="timeout";else if(1==e)fr.mainLoop.scheduler=function(){fr.requestAnimationFrame(fr.mainLoop.runner)},fr.mainLoop.method="rAF";else if(2==e){if(void 0===fr.setImmediate)if("undefined"==typeof setImmediate){var r=[],n="setimmediate";addEventListener("message",(e=>{e.data!==n&&e.data.target!==n||(e.stopPropagation(),r.shift()())}),!0),fr.setImmediate=function(e){r.push(e),y?(void 0===u.setImmediates&&(u.setImmediates=[]),u.setImmediates.push(e),postMessage({target:n})):postMessage(n,"*")}}else fr.setImmediate=setImmediate;fr.mainLoop.scheduler=function(){fr.setImmediate(fr.mainLoop.runner)},fr.mainLoop.method="immediate"}return 0};Lt=()=>performance.now();var ur=e=>{if(e instanceof oe||"unwind"==e)return k;m(1,e)},cr=()=>ae||!1,lr=(e,t)=>{var r;k=e,k=r=e,cr()||(u.onExit?.(r),I=!0),m(r,new oe(r))},dr=lr,pr=e=>{if(!I)try{e(),(()=>{if(!cr())try{dr(k)}catch(e){ur(e)}})()}catch(e){ur(e)}},hr=(e,t)=>setTimeout((()=>{pr(e)}),t),fr={mainLoop:{running:!1,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause(){fr.mainLoop.scheduler=null,fr.mainLoop.currentlyRunningMainloop++},resume(){fr.mainLoop.currentlyRunningMainloop++;var e=fr.mainLoop.timingMode,t=fr.mainLoop.timingValue,r=fr.mainLoop.func;fr.mainLoop.func=null,((e,t,r,n,o)=>{O(!fr.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),fr.mainLoop.func=e,fr.mainLoop.arg=n;var i=fr.mainLoop.currentlyRunningMainloop;function a(){return!(i<fr.mainLoop.currentlyRunningMainloop)}if(fr.mainLoop.running=!1,fr.mainLoop.runner=function(){if(!I)if(fr.mainLoop.queue.length>0){Date.now();var t=fr.mainLoop.queue.shift();if(t.func(t.arg),fr.mainLoop.remainingBlockers){var r=fr.mainLoop.remainingBlockers,n=r%1==0?r-1:Math.floor(r);t.counted?fr.mainLoop.remainingBlockers=n:(n+=.5,fr.mainLoop.remainingBlockers=(8*r+n)/9)}if(fr.mainLoop.updateStatus(),!a())return;setTimeout(fr.mainLoop.runner,0)}else a()&&(fr.mainLoop.currentFrameNumber=fr.mainLoop.currentFrameNumber+1|0,1==fr.mainLoop.timingMode&&fr.mainLoop.timingValue>1&&fr.mainLoop.currentFrameNumber%fr.mainLoop.timingValue!=0?fr.mainLoop.scheduler():(0==fr.mainLoop.timingMode&&(fr.mainLoop.tickStartTime=Lt()),fr.mainLoop.runIter(e),a()&&("object"==typeof SDL&&SDL.audio?.queueNewAudioData?.(),fr.mainLoop.scheduler())))},o||(t&&t>0?sr(0,1e3/t):sr(1,1),fr.mainLoop.scheduler()),r)throw"unwind"})(r,0,!1,fr.mainLoop.arg,!0),sr(e,t),fr.mainLoop.scheduler()},updateStatus(){if(u.setStatus){var e=u.statusMessage||"Please wait...",t=fr.mainLoop.remainingBlockers,r=fr.mainLoop.expectedBlockers;t?t<r?u.setStatus(e+" ("+(r-t)+"/"+r+")"):u.setStatus(e):u.setStatus("")}},runIter(e){if(!I){if(u.preMainLoop&&!1===u.preMainLoop())return;pr(e),u.postMainLoop?.()}}},isFullscreen:!1,pointerLock:!1,moduleContextCreatedCallbacks:[],workers:[],init(){if(!fr.initted){fr.initted=!0;var e={canHandle:function(e){return!u.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(e)},handle:function(e,t,r,n){var o=new Blob([e],{type:fr.getMimetype(t)});o.size!==e.length&&(o=new Blob([new Uint8Array(e).buffer],{type:fr.getMimetype(t)}));var i=URL.createObjectURL(o),a=new Image;a.onload=()=>{O(a.complete,`Image ${t} could not be decoded`);var n=document.createElement("canvas");n.width=a.width,n.height=a.height,n.getContext("2d").drawImage(a,0,0),Eu[t]=n,URL.revokeObjectURL(i),r?.(e)},a.onerror=e=>{x(`Image ${i} could not be decoded`),n?.()},a.src=i}};Ee.push(e);var t={canHandle:function(e){return!u.noAudioDecoding&&e.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},handle:function(e,t,r,n){var o=!1;function i(n){o||(o=!0,Su[t]=n,r?.(e))}var a=new Blob([e],{type:fr.getMimetype(t)}),s=URL.createObjectURL(a),u=new Audio;u.addEventListener("canplaythrough",(()=>i(u)),!1),u.onerror=function(r){o||(x(`warning: browser could not fully decode audio ${t}, trying slower base64 approach`),u.src="data:audio/x-"+t.substr(-3)+";base64,"+function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="",n=0,o=0,i=0;i<e.length;i++)for(n=n<<8|e[i],o+=8;o>=6;){var a=n>>o-6&63;o-=6,r+=t[a]}return 2==o?(r+=t[(3&n)<<4],r+="=="):4==o&&(r+=t[(15&n)<<2],r+="="),r}(e),i(u))},u.src=s,hr((()=>{i(u)}),1e4)}};Ee.push(t);var r=u.canvas;r&&(r.requestPointerLock=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||(()=>{}),r.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||(()=>{}),r.exitPointerLock=r.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",n,!1),document.addEventListener("mozpointerlockchange",n,!1),document.addEventListener("webkitpointerlockchange",n,!1),document.addEventListener("mspointerlockchange",n,!1),u.elementPointerLock&&r.addEventListener("click",(e=>{!fr.pointerLock&&u.canvas.requestPointerLock&&(u.canvas.requestPointerLock(),e.preventDefault())}),!1))}function n(){fr.pointerLock=document.pointerLockElement===u.canvas||document.mozPointerLockElement===u.canvas||document.webkitPointerLockElement===u.canvas||document.msPointerLockElement===u.canvas}},createContext(e,t,r,n){if(t&&u.ctx&&e==u.canvas)return u.ctx;var o,i;if(t){var a={antialias:!1,alpha:!1,majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1};if(n)for(var s in n)a[s]=n[s];void 0!==gr&&(i=gr.createContext(e,a))&&(o=gr.getContext(i).GLctx)}else o=e.getContext("2d");return o?(r&&(t||O(void 0===_u,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),u.ctx=o,t&&gr.makeContextCurrent(i),u.useWebGL=t,fr.moduleContextCreatedCallbacks.forEach((e=>e())),fr.init()),o):null},destroyContext(e,t,r){},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen(e,t){fr.lockPointer=e,fr.resizeCanvas=t,void 0===fr.lockPointer&&(fr.lockPointer=!0),void 0===fr.resizeCanvas&&(fr.resizeCanvas=!1);var r=u.canvas;function n(){fr.isFullscreen=!1;var e=r.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e?(r.exitFullscreen=fr.exitFullscreen,fr.lockPointer&&r.requestPointerLock(),fr.isFullscreen=!0,fr.resizeCanvas?fr.setFullscreenCanvasSize():fr.updateCanvasDimensions(r)):(e.parentNode.insertBefore(r,e),e.parentNode.removeChild(e),fr.resizeCanvas?fr.setWindowedCanvasSize():fr.updateCanvasDimensions(r)),u.onFullScreen?.(fr.isFullscreen),u.onFullscreen?.(fr.isFullscreen)}fr.fullscreenHandlersInstalled||(fr.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1));var o=document.createElement("div");r.parentNode.insertBefore(o,r),o.appendChild(r),o.requestFullscreen=o.requestFullscreen||o.mozRequestFullScreen||o.msRequestFullscreen||(o.webkitRequestFullscreen?()=>o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):null)||(o.webkitRequestFullScreen?()=>o.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):null),o.requestFullscreen()},exitFullscreen:()=>!!fr.isFullscreen&&((document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||(()=>{})).apply(document,[]),!0),nextRAF:0,fakeRequestAnimationFrame(e){var t=Date.now();if(0===fr.nextRAF)fr.nextRAF=t+1e3/60;else for(;t+2>=fr.nextRAF;)fr.nextRAF+=1e3/60;var r=Math.max(fr.nextRAF-t,0);setTimeout(e,r)},requestAnimationFrame(e){"function"!=typeof requestAnimationFrame?(0,fr.fakeRequestAnimationFrame)(e):requestAnimationFrame(e)},safeSetTimeout:(e,t)=>hr(e,t),safeRequestAnimationFrame:e=>fr.requestAnimationFrame((()=>{pr(e)})),getMimetype:e=>({jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]),getUserMedia(e){window.getUserMedia||=navigator.getUserMedia||navigator.mozGetUserMedia,window.getUserMedia(e)},getMovementX:e=>e.movementX||e.mozMovementX||e.webkitMovementX||0,getMovementY:e=>e.movementY||e.mozMovementY||e.webkitMovementY||0,getMouseWheelDelta(e){var t=0;switch(e.type){case"DOMMouseScroll":t=e.detail/3;break;case"mousewheel":t=e.wheelDelta/120;break;case"wheel":switch(t=e.deltaY,e.deltaMode){case 0:t/=100;break;case 1:t/=3;break;case 2:t*=80;break;default:throw"unrecognized mouse wheel delta mode: "+e.deltaMode}break;default:throw"unrecognized mouse wheel event: "+e.type}return t},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseCoords(e,t){var r=u.canvas.getBoundingClientRect(),n=u.canvas.width,o=u.canvas.height,i=void 0!==window.scrollX?window.scrollX:window.pageXOffset,a=void 0!==window.scrollY?window.scrollY:window.pageYOffset,s=e-(i+r.left),c=t-(a+r.top);return{x:s*=n/r.width,y:c*=o/r.height}},setMouseCoords(e,t){const{x:r,y:n}=fr.calculateMouseCoords(e,t);fr.mouseMovementX=r-fr.mouseX,fr.mouseMovementY=n-fr.mouseY,fr.mouseX=r,fr.mouseY=n},calculateMouseEvent(e){if(fr.pointerLock)"mousemove"!=e.type&&"mozMovementX"in e?fr.mouseMovementX=fr.mouseMovementY=0:(fr.mouseMovementX=fr.getMovementX(e),fr.mouseMovementY=fr.getMovementY(e)),"undefined"!=typeof SDL?(fr.mouseX=SDL.mouseX+fr.mouseMovementX,fr.mouseY=SDL.mouseY+fr.mouseMovementY):(fr.mouseX+=fr.mouseMovementX,fr.mouseY+=fr.mouseMovementY);else{if("touchstart"===e.type||"touchend"===e.type||"touchmove"===e.type){var t=e.touch;if(void 0===t)return;var r=fr.calculateMouseCoords(t.pageX,t.pageY);if("touchstart"===e.type)fr.lastTouches[t.identifier]=r,fr.touches[t.identifier]=r;else if("touchend"===e.type||"touchmove"===e.type){var n=fr.touches[t.identifier];n||=r,fr.lastTouches[t.identifier]=n,fr.touches[t.identifier]=r}return}fr.setMouseCoords(e.pageX,e.pageY)}},resizeListeners:[],updateResizeListeners(){var e=u.canvas;fr.resizeListeners.forEach((t=>t(e.width,e.height)))},setCanvasSize(e,t,r){var n=u.canvas;fr.updateCanvasDimensions(n,e,t),r||fr.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize(){if("undefined"!=typeof SDL){var e=L[SDL.screen>>2];e|=8388608,F[SDL.screen>>2]=e}fr.updateCanvasDimensions(u.canvas),fr.updateResizeListeners()},setWindowedCanvasSize(){if("undefined"!=typeof SDL){var e=L[SDL.screen>>2];e&=-8388609,F[SDL.screen>>2]=e}fr.updateCanvasDimensions(u.canvas),fr.updateResizeListeners()},updateCanvasDimensions(e,t,r){t&&r?(e.widthNative=t,e.heightNative=r):(t=e.widthNative,r=e.heightNative);var n=t,o=r;if(u.forcedAspectRatio&&u.forcedAspectRatio>0&&(n/o<u.forcedAspectRatio?n=Math.round(o*u.forcedAspectRatio):o=Math.round(n/u.forcedAspectRatio)),(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e.parentNode&&"undefined"!=typeof screen){var i=Math.min(screen.width/n,screen.height/o);n=Math.round(n*i),o=Math.round(o*i)}fr.resizeCanvas?(e.width!=n&&(e.width=n),e.height!=o&&(e.height=o),void 0!==e.style&&(e.style.removeProperty("width"),e.style.removeProperty("height"))):(e.width!=t&&(e.width=t),e.height!=r&&(e.height=r),void 0!==e.style&&(n!=t||o!=r?(e.style.setProperty("width",n+"px","important"),e.style.setProperty("height",o+"px","important")):(e.style.removeProperty("width"),e.style.removeProperty("height"))))}},mr={errorCode:12288,defaultDisplayInitialized:!1,currentContext:0,currentReadSurface:0,currentDrawSurface:0,contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1},stringCache:{},setErrorCode(e){mr.errorCode=e},chooseConfig(e,t,r,n,o){if(62e3!=e)return mr.setErrorCode(12296),0;if(t)for(;;){var i=F[t>>2];if(12321==i){var a=F[t+4>>2];mr.contextAttributes.alpha=a>0}else if(12325==i){var s=F[t+4>>2];mr.contextAttributes.depth=s>0}else if(12326==i){var u=F[t+4>>2];mr.contextAttributes.stencil=u>0}else if(12337==i){var c=F[t+4>>2];mr.contextAttributes.antialias=c>0}else if(12338==i)c=F[t+4>>2],mr.contextAttributes.antialias=1==c;else if(12544==i){var l=F[t+4>>2];mr.contextAttributes.lowLatency=12547!=l}else if(12344==i)break;t+=8}return r&&n||o?(o&&(F[o>>2]=1),r&&n>0&&(L[r>>2]=62002),mr.setErrorCode(12288),1):(mr.setErrorCode(12300),0)}},gr={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function(e){gr.lastError||(gr.lastError=e)},getNewId:e=>{for(var t=gr.counter++,r=e.length;r<t;r++)e[r]=null;return t},getSource:(e,t,r,n)=>{for(var o="",i=0;i<t;++i){var a=n?L[n+4*i>>2]:void 0;o+=xe(L[r+4*i>>2],a)}return o},createContext:(e,t)=>{if(!e.getContextSafariWebGL2Fixed){let t=function(t,r){var n=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==n instanceof WebGLRenderingContext?n:null};e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=t}var r=t.majorVersion>1?e.getContext("webgl2",t):e.getContext("webgl",t);return r?gr.registerContext(r,t):0},registerContext:(e,t)=>{var r=gr.getNewId(gr.contexts),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=n),gr.contexts[r]=n,r},makeContextCurrent:e=>(gr.currentContext=gr.contexts[e],u.ctx=_u=gr.currentContext?.GLctx,!(e&&!_u)),getContext:e=>gr.contexts[e],deleteContext:e=>{gr.currentContext===gr.contexts[e]&&(gr.currentContext=null),"object"==typeof iu&&iu.removeAllHandlersOnTarget(gr.contexts[e].GLctx.canvas),gr.contexts[e]&&gr.contexts[e].GLctx.canvas&&(gr.contexts[e].GLctx.canvas.GLctxObject=void 0),gr.contexts[e]=null}},yr=[],br=(e,t,r)=>{var n=((e,t)=>{var r;for(yr.length=0;r=A[e++];){var n=105!=r;t+=(n&=112!=r)&&t%8?4:0,yr.push(112==r?L[t>>2]:106==r?B[t>>3]:105==r?F[t>>2]:M[t>>3]),t+=n?8:4}return yr})(t,r);return ne[e].apply(null,n)},vr=function(e){_u.activeTexture(e)},wr=(e,t)=>{_u.attachShader(gr.programs[e],gr.shaders[t])},_r=(e,t)=>{_u.beginQuery(e,gr.queries[t])},Er=(e,t)=>{_u.disjointTimerQueryExt.beginQueryEXT(e,gr.queries[t])},Sr=function(e){_u.beginTransformFeedback(e)},Cr=(e,t,r)=>{_u.bindAttribLocation(gr.programs[e],t,xe(r))},xr=(e,t)=>{35051==e?_u.currentPixelPackBufferBinding=t:35052==e&&(_u.currentPixelUnpackBufferBinding=t),_u.bindBuffer(e,gr.buffers[t])},kr=(e,t,r)=>{_u.bindBufferBase(e,t,gr.buffers[r])},Tr=(e,t,r,n,o)=>{_u.bindBufferRange(e,t,gr.buffers[r],n,o)},Ar=(e,t)=>{_u.bindFramebuffer(e,gr.framebuffers[t])},Pr=(e,t)=>{_u.bindRenderbuffer(e,gr.renderbuffers[t])},qr=(e,t)=>{_u.bindSampler(e,gr.samplers[t])},Fr=(e,t)=>{_u.bindTexture(e,gr.textures[t])},Lr=(e,t)=>{_u.bindTransformFeedback(e,gr.transformFeedbacks[t])},Dr=e=>{_u.bindVertexArray(gr.vaos[e])},Br=Dr,Rr=Dr,Mr=function(e,t,r,n){_u.blendColor(e,t,r,n)},Ir=function(e){_u.blendEquation(e)},Or=function(e,t){_u.blendEquationSeparate(e,t)},jr=function(e,t){_u.blendFunc(e,t)},Ur=function(e,t,r,n){_u.blendFuncSeparate(e,t,r,n)},$r=function(e,t,r,n,o,i,a,s,u,c){_u.blitFramebuffer(e,t,r,n,o,i,a,s,u,c)},Nr=(e,t,r,n)=>{gr.currentContext.version>=2?r&&t?_u.bufferData(e,A,n,r,t):_u.bufferData(e,t,n):_u.bufferData(e,r?A.subarray(r,r+t):t,n)},Hr=(e,t,r,n)=>{gr.currentContext.version>=2?r&&_u.bufferSubData(e,t,A,n,r):_u.bufferSubData(e,t,A.subarray(n,n+r))},Vr=function(e){return _u.checkFramebufferStatus(e)},Wr=function(e){_u.clear(e)},zr=function(e,t,r,n){_u.clearBufferfi(e,t,r,n)},Gr=(e,t,r)=>{_u.clearBufferfv(e,t,D,r>>2)},Yr=(e,t,r)=>{_u.clearBufferiv(e,t,F,r>>2)},Xr=(e,t,r)=>{_u.clearBufferuiv(e,t,L,r>>2)},Zr=function(e,t,r,n){_u.clearColor(e,t,r,n)},Kr=function(e){_u.clearDepth(e)},Qr=function(e){_u.clearStencil(e)},Jr=(e,t,r)=>(r=Number(r),_u.clientWaitSync(gr.syncs[e],t,r)),en=(e,t,r,n)=>{_u.colorMask(!!e,!!t,!!r,!!n)},tn=e=>{_u.compileShader(gr.shaders[e])},rn=(e,t,r,n,o,i,a,s)=>{gr.currentContext.version>=2?_u.currentPixelUnpackBufferBinding||!a?_u.compressedTexImage2D(e,t,r,n,o,i,a,s):_u.compressedTexImage2D(e,t,r,n,o,i,A,s,a):_u.compressedTexImage2D(e,t,r,n,o,i,s?A.subarray(s,s+a):null)},nn=(e,t,r,n,o,i,a,s,u)=>{_u.currentPixelUnpackBufferBinding?_u.compressedTexImage3D(e,t,r,n,o,i,a,s,u):_u.compressedTexImage3D(e,t,r,n,o,i,a,A,u,s)},on=(e,t,r,n,o,i,a,s,u)=>{gr.currentContext.version>=2?_u.currentPixelUnpackBufferBinding||!s?_u.compressedTexSubImage2D(e,t,r,n,o,i,a,s,u):_u.compressedTexSubImage2D(e,t,r,n,o,i,a,A,u,s):_u.compressedTexSubImage2D(e,t,r,n,o,i,a,u?A.subarray(u,u+s):null)},an=(e,t,r,n,o,i,a,s,u,c,l)=>{_u.currentPixelUnpackBufferBinding?_u.compressedTexSubImage3D(e,t,r,n,o,i,a,s,u,c,l):_u.compressedTexSubImage3D(e,t,r,n,o,i,a,s,u,A,l,c)},sn=function(e,t,r,n,o){_u.copyBufferSubData(e,t,r,n,o)},un=function(e,t,r,n,o,i,a,s){_u.copyTexImage2D(e,t,r,n,o,i,a,s)},cn=function(e,t,r,n,o,i,a,s){_u.copyTexSubImage2D(e,t,r,n,o,i,a,s)},ln=function(e,t,r,n,o,i,a,s,u){_u.copyTexSubImage3D(e,t,r,n,o,i,a,s,u)},dn=()=>{var e=gr.getNewId(gr.programs),t=_u.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,gr.programs[e]=t,e},pn=e=>{var t=gr.getNewId(gr.shaders);return gr.shaders[t]=_u.createShader(e),t},hn=function(e){_u.cullFace(e)},fn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.buffers[n];o&&(_u.deleteBuffer(o),o.name=0,gr.buffers[n]=null,n==_u.currentPixelPackBufferBinding&&(_u.currentPixelPackBufferBinding=0),n==_u.currentPixelUnpackBufferBinding&&(_u.currentPixelUnpackBufferBinding=0))}},mn=(e,t)=>{for(var r=0;r<e;++r){var n=F[t+4*r>>2],o=gr.framebuffers[n];o&&(_u.deleteFramebuffer(o),o.name=0,gr.framebuffers[n]=null)}},gn=e=>{if(e){var t=gr.programs[e];t?(_u.deleteProgram(t),t.name=0,gr.programs[e]=null):gr.recordError(1281)}},yn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.queries[n];o&&(_u.deleteQuery(o),gr.queries[n]=null)}},bn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.queries[n];o&&(_u.disjointTimerQueryExt.deleteQueryEXT(o),gr.queries[n]=null)}},vn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.renderbuffers[n];o&&(_u.deleteRenderbuffer(o),o.name=0,gr.renderbuffers[n]=null)}},wn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.samplers[n];o&&(_u.deleteSampler(o),o.name=0,gr.samplers[n]=null)}},_n=e=>{if(e){var t=gr.shaders[e];t?(_u.deleteShader(t),gr.shaders[e]=null):gr.recordError(1281)}},En=e=>{if(e){var t=gr.syncs[e];t?(_u.deleteSync(t),t.name=0,gr.syncs[e]=null):gr.recordError(1281)}},Sn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.textures[n];o&&(_u.deleteTexture(o),o.name=0,gr.textures[n]=null)}},Cn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.transformFeedbacks[n];o&&(_u.deleteTransformFeedback(o),o.name=0,gr.transformFeedbacks[n]=null)}},xn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2];_u.deleteVertexArray(gr.vaos[n]),gr.vaos[n]=null}},kn=xn,Tn=xn,An=function(e){_u.depthFunc(e)},Pn=e=>{_u.depthMask(!!e)},qn=function(e,t){_u.depthRange(e,t)},Fn=(e,t)=>{_u.detachShader(gr.programs[e],gr.shaders[t])},Ln=function(e){_u.disable(e)},Dn=e=>{_u.disableVertexAttribArray(e)},Bn=(e,t,r)=>{_u.drawArrays(e,t,r)},Rn=(e,t,r,n)=>{_u.drawArraysInstanced(e,t,r,n)},Mn=Rn,In=Rn,On=Rn,jn=(e,t,r,n,o)=>{_u.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,n,o)},Un=Rn,$n=Rn,Nn=[],Hn=(e,t)=>{for(var r=Nn[e],n=0;n<e;n++)r[n]=F[t+4*n>>2];_u.drawBuffers(r)},Vn=Hn,Wn=Hn,zn=Hn,Gn=(e,t,r,n)=>{_u.drawElements(e,t,r,n)},Yn=Gn,Xn=(e,t,r,n,o)=>{_u.drawElementsInstanced(e,t,r,n,o)},Zn=Xn,Kn=Xn,Qn=Xn,Jn=(e,t,r,n,o,i,a)=>{_u.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,n,o,i,a)},eo=Xn,to=Xn,ro=(e,t,r,n,o,i)=>{Gn(e,n,o,i)},no=function(e){_u.enable(e)},oo=e=>{_u.enableVertexAttribArray(e)},io=function(e){_u.endQuery(e)},ao=e=>{_u.disjointTimerQueryExt.endQueryEXT(e)},so=function(){_u.endTransformFeedback()},uo=(e,t)=>{var r=_u.fenceSync(e,t);if(r){var n=gr.getNewId(gr.syncs);return r.name=n,gr.syncs[n]=r,n}return 0},co=function(){_u.finish()},lo=function(){_u.flush()},po=(e,t,r,n)=>{_u.framebufferRenderbuffer(e,t,r,gr.renderbuffers[n])},ho=(e,t,r,n,o)=>{_u.framebufferTexture2D(e,t,r,gr.textures[n],o)},fo=(e,t,r,n,o)=>{_u.framebufferTextureLayer(e,t,gr.textures[r],n,o)},mo=function(e){_u.frontFace(e)},go=(e,t,r,n)=>{for(var o=0;o<e;o++){var i=_u[r](),a=i&&gr.getNewId(n);i?(i.name=a,n[a]=i):gr.recordError(1282),F[t+4*o>>2]=a}},yo=(e,t)=>{go(e,t,"createBuffer",gr.buffers)},bo=(e,t)=>{go(e,t,"createFramebuffer",gr.framebuffers)},vo=(e,t)=>{go(e,t,"createQuery",gr.queries)},wo=(e,t)=>{for(var r=0;r<e;r++){var n=_u.disjointTimerQueryExt.createQueryEXT();if(!n){for(gr.recordError(1282);r<e;)F[t+4*r++>>2]=0;return}var o=gr.getNewId(gr.queries);n.name=o,gr.queries[o]=n,F[t+4*r>>2]=o}},_o=(e,t)=>{go(e,t,"createRenderbuffer",gr.renderbuffers)},Eo=(e,t)=>{go(e,t,"createSampler",gr.samplers)},So=(e,t)=>{go(e,t,"createTexture",gr.textures)},Co=(e,t)=>{go(e,t,"createTransformFeedback",gr.transformFeedbacks)};function xo(e,t){go(e,t,"createVertexArray",gr.vaos)}var ko,To,Ao,Po=xo,qo=xo,Fo=function(e){_u.generateMipmap(e)},Lo=(e,t,r,n,o,i,a,s)=>{t=gr.programs[t];var u=_u[e](t,r);if(u){var c=s&&Nt(u.name,s,n);o&&(F[o>>2]=c),i&&(F[i>>2]=u.size),a&&(F[a>>2]=u.type)}},Do=(e,t,r,n,o,i,a)=>{Lo("getActiveAttrib",e,t,r,n,o,i,a)},Bo=(e,t,r,n,o,i,a)=>{Lo("getActiveUniform",e,t,r,n,o,i,a)},Ro=(e,t,r,n,o)=>{e=gr.programs[e];var i=_u.getActiveUniformBlockName(e,t);if(i)if(o&&r>0){var a=Nt(i,o,r);n&&(F[n>>2]=a)}else n&&(F[n>>2]=0)},Mo=(e,t,r,n)=>{if(n)if(e=gr.programs[e],35393!=r){var o=_u.getActiveUniformBlockParameter(e,t,r);if(null!==o)if(35395==r)for(var i=0;i<o.length;i++)F[n+4*i>>2]=o[i];else F[n>>2]=o}else{var a=_u.getActiveUniformBlockName(e,t);F[n>>2]=a.length+1}else gr.recordError(1281)},Io=(e,t,r,n,o)=>{if(o)if(t>0&&0==r)gr.recordError(1281);else{e=gr.programs[e];for(var i=[],a=0;a<t;a++)i.push(F[r+4*a>>2]);var s=_u.getActiveUniforms(e,i,n);if(s){var u=s.length;for(a=0;a<u;a++)F[o+4*a>>2]=s[a]}}else gr.recordError(1281)},Oo=(e,t,r,n)=>{var o=_u.getAttachedShaders(gr.programs[e]),i=o.length;i>t&&(i=t),F[r>>2]=i;for(var a=0;a<i;++a){var s=gr.shaders.indexOf(o[a]);F[n+4*a>>2]=s}},jo=(e,t)=>_u.getAttribLocation(gr.programs[e],xe(t)),Uo=(e,t)=>{L[e>>2]=t;var r=L[e>>2];L[e+4>>2]=(t-r)/4294967296},$o=function(){var e,t=(e=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_disjoint_timer_query","EXT_frag_depth","EXT_shader_texture_lod","EXT_sRGB","OES_element_index_uint","OES_fbo_render_mipmap","OES_standard_derivatives","OES_texture_float","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_depth_texture","WEBGL_draw_buffers","EXT_color_buffer_float","EXT_disjoint_timer_query_webgl2","EXT_texture_norm16","WEBGL_clip_cull_distance","EXT_color_buffer_half_float","EXT_float_blend","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw"],(_u.getSupportedExtensions()||[]).filter((t=>e.includes(t))));return t=t.concat(t.map((e=>"GL_"+e)))},No=(e,t,r)=>{if(t){var n=void 0;switch(e){case 36346:n=1;break;case 36344:return void(0!=r&&1!=r&&gr.recordError(1280));case 34814:case 36345:n=0;break;case 34466:var o=_u.getParameter(34467);n=o?o.length:0;break;case 33309:if(gr.currentContext.version<2)return void gr.recordError(1282);n=$o().length;break;case 33307:case 33308:if(gr.currentContext.version<2)return void gr.recordError(1280);n=33307==e?3:0}if(void 0===n){var i=_u.getParameter(e);switch(typeof i){case"number":n=i;break;case"boolean":n=i?1:0;break;case"string":return void gr.recordError(1280);case"object":if(null===i)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:n=0;break;default:return void gr.recordError(1280)}else{if(i instanceof Float32Array||i instanceof Uint32Array||i instanceof Int32Array||i instanceof Array){for(var a=0;a<i.length;++a)switch(r){case 0:F[t+4*a>>2]=i[a];break;case 2:D[t+4*a>>2]=i[a];break;case 4:T[t+a>>0]=i[a]?1:0}return}try{n=0|i.name}catch(t){return gr.recordError(1280),void x(`GL_INVALID_ENUM in glGet${r}v: Unknown object returned from WebGL getParameter(${e})! (error: ${t})`)}}break;default:return gr.recordError(1280),void x(`GL_INVALID_ENUM in glGet${r}v: Native code calling glGet${r}v(${e}) and it returns ${i} of type ${typeof i}!`)}}switch(r){case 1:Uo(t,n);break;case 0:F[t>>2]=n;break;case 2:D[t>>2]=n;break;case 4:T[t>>0]=n?1:0}}else gr.recordError(1281)},Ho=(e,t)=>No(e,t,4),Vo=(e,t,r)=>{r?Uo(r,_u.getBufferParameter(e,t)):gr.recordError(1281)},Wo=(e,t,r)=>{r?F[r>>2]=_u.getBufferParameter(e,t):gr.recordError(1281)},zo=()=>{var e=_u.getError()||gr.lastError;return gr.lastError=0,e},Go=(e,t)=>No(e,t,2),Yo=(e,t)=>_u.getFragDataLocation(gr.programs[e],xe(t)),Xo=(e,t,r,n)=>{var o=_u.getFramebufferAttachmentParameter(e,t,r);(o instanceof WebGLRenderbuffer||o instanceof WebGLTexture)&&(o=0|o.name),F[n>>2]=o},Zo=(e,t,r,n)=>{if(r){var o,i=_u.getIndexedParameter(e,t);switch(typeof i){case"boolean":o=i?1:0;break;case"number":o=i;break;case"object":if(null===i)switch(e){case 35983:case 35368:o=0;break;default:return void gr.recordError(1280)}else{if(!(i instanceof WebGLBuffer))return void gr.recordError(1280);o=0|i.name}break;default:return void gr.recordError(1280)}switch(n){case 1:Uo(r,o);break;case 0:F[r>>2]=o;break;case 2:D[r>>2]=o;break;case 4:T[r>>0]=o?1:0;break;default:throw"internal emscriptenWebGLGetIndexed() error, bad type: "+n}}else gr.recordError(1281)},Ko=(e,t,r)=>Zo(e,t,r,1),Qo=(e,t)=>{No(e,t,1)},Jo=(e,t,r)=>Zo(e,t,r,0),ei=(e,t)=>No(e,t,0),ti=(e,t,r,n,o)=>{if(n<0)gr.recordError(1281);else if(o){var i=_u.getInternalformatParameter(e,t,r);if(null!==i)for(var a=0;a<i.length&&a<n;++a)F[o+4*a>>2]=i[a]}else gr.recordError(1281)},ri=(e,t,r,n,o)=>{gr.recordError(1282)},ni=(e,t,r,n)=>{var o=_u.getProgramInfoLog(gr.programs[e]);null===o&&(o="(unknown error)");var i=t>0&&n?Nt(o,n,t):0;r&&(F[r>>2]=i)},oi=(e,t,r)=>{if(r)if(e>=gr.counter)gr.recordError(1281);else if(e=gr.programs[e],35716==t){var n=_u.getProgramInfoLog(e);null===n&&(n="(unknown error)"),F[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var o=0;o<_u.getProgramParameter(e,35718);++o)e.maxUniformLength=Math.max(e.maxUniformLength,_u.getActiveUniform(e,o).name.length+1);F[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength)for(o=0;o<_u.getProgramParameter(e,35721);++o)e.maxAttributeLength=Math.max(e.maxAttributeLength,_u.getActiveAttrib(e,o).name.length+1);F[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength)for(o=0;o<_u.getProgramParameter(e,35382);++o)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,_u.getActiveUniformBlockName(e,o).length+1);F[r>>2]=e.maxUniformBlockNameLength}else F[r>>2]=_u.getProgramParameter(e,t);else gr.recordError(1281)},ii=(e,t,r)=>{if(r){var n,o=gr.queries[e];n=gr.currentContext.version<2?_u.disjointTimerQueryExt.getQueryObjectEXT(o,t):_u.getQueryParameter(o,t),Uo(r,"boolean"==typeof n?n?1:0:n)}else gr.recordError(1281)},ai=ii,si=(e,t,r)=>{if(r){var n,o=gr.queries[e],i=_u.disjointTimerQueryExt.getQueryObjectEXT(o,t);n="boolean"==typeof i?i?1:0:i,F[r>>2]=n}else gr.recordError(1281)},ui=si,ci=ii,li=(e,t,r)=>{if(r){var n,o=gr.queries[e],i=_u.getQueryParameter(o,t);n="boolean"==typeof i?i?1:0:i,F[r>>2]=n}else gr.recordError(1281)},di=si,pi=(e,t,r)=>{r?F[r>>2]=_u.getQuery(e,t):gr.recordError(1281)},hi=(e,t,r)=>{r?F[r>>2]=_u.disjointTimerQueryExt.getQueryEXT(e,t):gr.recordError(1281)},fi=(e,t,r)=>{r?F[r>>2]=_u.getRenderbufferParameter(e,t):gr.recordError(1281)},mi=(e,t,r)=>{r?D[r>>2]=_u.getSamplerParameter(gr.samplers[e],t):gr.recordError(1281)},gi=(e,t,r)=>{r?F[r>>2]=_u.getSamplerParameter(gr.samplers[e],t):gr.recordError(1281)},yi=(e,t,r,n)=>{var o=_u.getShaderInfoLog(gr.shaders[e]);null===o&&(o="(unknown error)");var i=t>0&&n?Nt(o,n,t):0;r&&(F[r>>2]=i)},bi=(e,t,r,n)=>{var o=_u.getShaderPrecisionFormat(e,t);F[r>>2]=o.rangeMin,F[r+4>>2]=o.rangeMax,F[n>>2]=o.precision},vi=(e,t,r,n)=>{var o=_u.getShaderSource(gr.shaders[e]);if(o){var i=t>0&&n?Nt(o,n,t):0;r&&(F[r>>2]=i)}},wi=(e,t,r)=>{if(r)if(35716==t){var n=_u.getShaderInfoLog(gr.shaders[e]);null===n&&(n="(unknown error)");var o=n?n.length+1:0;F[r>>2]=o}else if(35720==t){var i=_u.getShaderSource(gr.shaders[e]),a=i?i.length+1:0;F[r>>2]=a}else F[r>>2]=_u.getShaderParameter(gr.shaders[e],t);else gr.recordError(1281)},_i=e=>{var t=gr.stringCache[e];if(!t){switch(e){case 7939:t=ar($o().join(" "));break;case 7936:case 7937:case 37445:case 37446:var r=_u.getParameter(e);r||gr.recordError(1280),t=r?ar(r):0;break;case 7938:var n=_u.getParameter(7938);n=gr.currentContext.version>=2?`OpenGL ES 3.0 (${n})`:`OpenGL ES 2.0 (${n})`,t=ar(n);break;case 35724:var o=_u.getParameter(35724),i=o.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==i&&(3==i[1].length&&(i[1]=i[1]+"0"),o=`OpenGL ES GLSL ES ${i[1]} (${o})`),t=ar(o);break;default:gr.recordError(1280)}gr.stringCache[e]=t}return t},Ei=(e,t)=>{if(gr.currentContext.version<2)return gr.recordError(1282),0;var r=gr.stringiCache[e];if(r)return t<0||t>=r.length?(gr.recordError(1281),0):r[t];if(7939===e){var n=$o().map(ar);return r=gr.stringiCache[e]=n,t<0||t>=r.length?(gr.recordError(1281),0):r[t]}return gr.recordError(1280),0},Si=(e,t,r,n,o)=>{if(r<0)gr.recordError(1281);else if(o){var i=_u.getSyncParameter(gr.syncs[e],t);null!==i&&(F[o>>2]=i,n&&(F[n>>2]=1))}else gr.recordError(1281)},Ci=(e,t,r)=>{r?D[r>>2]=_u.getTexParameter(e,t):gr.recordError(1281)},xi=(e,t,r)=>{r?F[r>>2]=_u.getTexParameter(e,t):gr.recordError(1281)},ki=(e,t,r,n,o,i,a)=>{e=gr.programs[e];var s=_u.getTransformFeedbackVarying(e,t);if(s){if(a&&r>0){var u=Nt(s.name,a,r);n&&(F[n>>2]=u)}else n&&(F[n>>2]=0);o&&(F[o>>2]=s.size),i&&(F[i>>2]=s.type)}},Ti=(e,t)=>_u.getUniformBlockIndex(gr.programs[e],xe(t)),Ai=(e,t,r,n)=>{if(n)if(t>0&&(0==r||0==n))gr.recordError(1281);else{e=gr.programs[e];for(var o=[],i=0;i<t;i++)o.push(xe(F[r+4*i>>2]));var a=_u.getUniformIndices(e,o);if(a){var s=a.length;for(i=0;i<s;i++)F[n+4*i>>2]=a[i]}}else gr.recordError(1281)},Pi=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),qi=e=>{var t,r,n=e.uniformLocsById,o=e.uniformSizeAndIdsByName;if(!n)for(e.uniformLocsById=n={},e.uniformArrayNamesById={},t=0;t<_u.getProgramParameter(e,35718);++t){var i=_u.getActiveUniform(e,t),a=i.name,s=i.size,u=Pi(a),c=u>0?a.slice(0,u):a,l=e.uniformIdCounter;for(e.uniformIdCounter+=s,o[c]=[s,l],r=0;r<s;++r)n[l]=r,e.uniformArrayNamesById[l++]=c}},Fi=(e,t)=>{if(t=xe(t),e=gr.programs[e]){qi(e);var r=e.uniformLocsById,n=0,o=t,i=Pi(t);i>0&&(s=t.slice(i+1),n=parseInt(s)>>>0,o=t.slice(0,i));var a=e.uniformSizeAndIdsByName[o];if(a&&n<a[0]&&(r[n+=a[1]]=r[n]||_u.getUniformLocation(e,t)))return n}else gr.recordError(1281);var s;return-1},Li=e=>{var t=_u.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=_u.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?`[${r}]`:""))),r}gr.recordError(1282)},Di=(e,t,r,n)=>{if(r){e=gr.programs[e],qi(e);var o=_u.getUniform(e,Li(t));if("number"==typeof o||"boolean"==typeof o)switch(n){case 0:F[r>>2]=o;break;case 2:D[r>>2]=o}else for(var i=0;i<o.length;i++)switch(n){case 0:F[r+4*i>>2]=o[i];break;case 2:D[r+4*i>>2]=o[i]}}else gr.recordError(1281)},Bi=(e,t,r)=>{Di(e,t,r,2)},Ri=(e,t,r)=>{Di(e,t,r,0)},Mi=(e,t,r)=>Di(e,t,r,0),Ii=(e,t,r,n)=>{if(r){var o=_u.getVertexAttrib(e,t);if(34975==t)F[r>>2]=o&&o.name;else if("number"==typeof o||"boolean"==typeof o)switch(n){case 0:F[r>>2]=o;break;case 2:D[r>>2]=o;break;case 5:F[r>>2]=Math.fround(o)}else for(var i=0;i<o.length;i++)switch(n){case 0:F[r+4*i>>2]=o[i];break;case 2:D[r+4*i>>2]=o[i];break;case 5:F[r+4*i>>2]=Math.fround(o[i])}}else gr.recordError(1281)},Oi=(e,t,r)=>{Ii(e,t,r,0)},ji=Oi,Ui=Oi,$i=(e,t,r)=>{r?F[r>>2]=_u.getVertexAttribOffset(e,t):gr.recordError(1281)},Ni=(e,t,r)=>{Ii(e,t,r,2)},Hi=(e,t,r)=>{Ii(e,t,r,5)},Vi=function(e,t){_u.hint(e,t)},Wi=(e,t,r)=>{for(var n=Nn[t],o=0;o<t;o++)n[o]=F[r+4*o>>2];_u.invalidateFramebuffer(e,n)},zi=(e,t,r,n,o,i,a)=>{for(var s=Nn[t],u=0;u<t;u++)s[u]=F[r+4*u>>2];_u.invalidateSubFramebuffer(e,s,n,o,i,a)},Gi=e=>{var t=gr.buffers[e];return t?_u.isBuffer(t):0},Yi=function(e){return _u.isEnabled(e)},Xi=e=>{var t=gr.framebuffers[e];return t?_u.isFramebuffer(t):0},Zi=e=>(e=gr.programs[e])?_u.isProgram(e):0,Ki=e=>{var t=gr.queries[e];return t?_u.isQuery(t):0},Qi=e=>{var t=gr.queries[e];return t?_u.disjointTimerQueryExt.isQueryEXT(t):0},Ji=e=>{var t=gr.renderbuffers[e];return t?_u.isRenderbuffer(t):0},ea=e=>{var t=gr.samplers[e];return t?_u.isSampler(t):0},ta=e=>{var t=gr.shaders[e];return t?_u.isShader(t):0},ra=e=>_u.isSync(gr.syncs[e]),na=e=>{var t=gr.textures[e];return t?_u.isTexture(t):0},oa=e=>_u.isTransformFeedback(gr.transformFeedbacks[e]),ia=e=>{var t=gr.vaos[e];return t?_u.isVertexArray(t):0},aa=ia,sa=ia,ua=function(e){_u.lineWidth(e)},ca=e=>{e=gr.programs[e],_u.linkProgram(e),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}},la=(e,t,r,n,o,i)=>{_u.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,F,t>>2,F,r>>2,F,n>>2,L,o>>2,i)},da=(e,t,r,n,o,i,a,s)=>{_u.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,F,t>>2,r,F,n>>2,F,o>>2,F,i>>2,L,a>>2,s)},pa=function(){_u.pauseTransformFeedback()},ha=(e,t)=>{3317==e&&(gr.unpackAlignment=t),_u.pixelStorei(e,t)},fa=function(e,t){_u.polygonOffset(e,t)},ma=(e,t,r,n)=>{gr.recordError(1280)},ga=(e,t,r)=>{gr.recordError(1280)},ya=(e,t)=>{_u.disjointTimerQueryExt.queryCounterEXT(gr.queries[e],t)},ba=function(e){_u.readBuffer(e)},va=e=>0==(e-=5120)?T:1==e?A:2==e?P:4==e?F:6==e?D:5==e||28922==e||28520==e||30779==e||30782==e?L:q,wa=e=>31-Math.clz32(e.BYTES_PER_ELEMENT),_a=(e,t,r,n,o,i)=>{var a=va(e),s=wa(a),u=1<<s,c=(e=>({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1))(t)*u,l=((e,t,r,n)=>{var o;return t*(e*r+(o=n)-1&-o)})(r,n,c,gr.unpackAlignment);return a.subarray(o>>s,o+l>>s)},Ea=(e,t,r,n,o,i,a)=>{if(gr.currentContext.version>=2)if(_u.currentPixelPackBufferBinding)_u.readPixels(e,t,r,n,o,i,a);else{var s=va(i);_u.readPixels(e,t,r,n,o,i,s,a>>wa(s))}else{var u=_a(i,o,r,n,a);u?_u.readPixels(e,t,r,n,o,i,u):gr.recordError(1280)}},Sa=()=>{},Ca=function(e,t,r,n){_u.renderbufferStorage(e,t,r,n)},xa=function(e,t,r,n,o){_u.renderbufferStorageMultisample(e,t,r,n,o)},ka=function(){_u.resumeTransformFeedback()},Ta=(e,t)=>{_u.sampleCoverage(e,!!t)},Aa=(e,t,r)=>{_u.samplerParameterf(gr.samplers[e],t,r)},Pa=(e,t,r)=>{var n=D[r>>2];_u.samplerParameterf(gr.samplers[e],t,n)},qa=(e,t,r)=>{_u.samplerParameteri(gr.samplers[e],t,r)},Fa=(e,t,r)=>{var n=F[r>>2];_u.samplerParameteri(gr.samplers[e],t,n)},La=function(e,t,r,n){_u.scissor(e,t,r,n)},Da=(e,t,r,n,o)=>{gr.recordError(1280)},Ba=(e,t,r,n)=>{var o=gr.getSource(e,t,r,n);if(gr.currentContext.version>=2&&o.includes("#version 100")){var i="";(o=(o=o.replace(/#extension GL_OES_standard_derivatives : enable/g,"")).replace(/#extension GL_EXT_shader_texture_lod : enable/g,"")).includes("gl_FragColor")&&(i+="out mediump vec4 GL_FragColor;\n",o=o.replace(/gl_FragColor/g,"GL_FragColor")),o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=o.includes("attribute")?(o=o.replace(/attribute/g,"in")).replace(/varying/g,"out"):o.replace(/varying/g,"in")).replace(/textureCubeLodEXT/g,"textureCubeLod")).replace(/texture2DLodEXT/g,"texture2DLod")).replace(/texture2DProjLodEXT/g,"texture2DProjLod")).replace(/texture2DGradEXT/g,"texture2DGrad")).replace(/texture2DProjGradEXT/g,"texture2DProjGrad")).replace(/textureCubeGradEXT/g,"textureCubeGrad")).replace(/textureCube/g,"texture")).replace(/texture1D/g,"texture")).replace(/texture2D/g,"texture")).replace(/texture3D/g,"texture")).replace(/#version 100/g,"#version 300 es\n"+i)}_u.shaderSource(gr.shaders[e],o)},Ra=function(e,t,r){_u.stencilFunc(e,t,r)},Ma=function(e,t,r,n){_u.stencilFuncSeparate(e,t,r,n)},Ia=function(e){_u.stencilMask(e)},Oa=function(e,t){_u.stencilMaskSeparate(e,t)},ja=function(e,t,r){_u.stencilOp(e,t,r)},Ua=function(e,t,r,n){_u.stencilOpSeparate(e,t,r,n)},$a=(e,t,r,n,o,i,a,s,u)=>{if(gr.currentContext.version>=2&&(6402==a&&6402==r&&5125==s&&(r=33190),36193==s&&(s=5131,6408==a&&6408==r&&(r=34842)),34041==r&&(r=35056)),gr.currentContext.version>=2)if(_u.currentPixelUnpackBufferBinding)_u.texImage2D(e,t,r,n,o,i,a,s,u);else if(u){var c=va(s);_u.texImage2D(e,t,r,n,o,i,a,s,c,u>>wa(c))}else _u.texImage2D(e,t,r,n,o,i,a,s,null);else _u.texImage2D(e,t,r,n,o,i,a,s,u?_a(s,a,n,o,u):null)},Na=(e,t,r,n,o,i,a,s,u,c)=>{if(_u.currentPixelUnpackBufferBinding)_u.texImage3D(e,t,r,n,o,i,a,s,u,c);else if(c){var l=va(u);_u.texImage3D(e,t,r,n,o,i,a,s,u,l,c>>wa(l))}else _u.texImage3D(e,t,r,n,o,i,a,s,u,null)},Ha=function(e,t,r){_u.texParameterf(e,t,r)},Va=(e,t,r)=>{var n=D[r>>2];_u.texParameterf(e,t,n)},Wa=function(e,t,r){_u.texParameteri(e,t,r)},za=(e,t,r)=>{var n=F[r>>2];_u.texParameteri(e,t,n)},Ga=function(e,t,r,n,o){_u.texStorage2D(e,t,r,n,o)},Ya=function(e,t,r,n,o,i){_u.texStorage3D(e,t,r,n,o,i)},Xa=(e,t,r,n,o,i,a,s,u)=>{if(gr.currentContext.version>=2&&36193==s&&(s=5131),gr.currentContext.version>=2)if(_u.currentPixelUnpackBufferBinding)_u.texSubImage2D(e,t,r,n,o,i,a,s,u);else if(u){var c=va(s);_u.texSubImage2D(e,t,r,n,o,i,a,s,c,u>>wa(c))}else _u.texSubImage2D(e,t,r,n,o,i,a,s,null);else{var l=null;u&&(l=_a(s,a,o,i,u)),_u.texSubImage2D(e,t,r,n,o,i,a,s,l)}},Za=(e,t,r,n,o,i,a,s,u,c,l)=>{if(_u.currentPixelUnpackBufferBinding)_u.texSubImage3D(e,t,r,n,o,i,a,s,u,c,l);else if(l){var d=va(c);_u.texSubImage3D(e,t,r,n,o,i,a,s,u,c,d,l>>wa(d))}else _u.texSubImage3D(e,t,r,n,o,i,a,s,u,c,null)},Ka=(e,t,r,n)=>{e=gr.programs[e];for(var o=[],i=0;i<t;i++)o.push(xe(F[r+4*i>>2]));_u.transformFeedbackVaryings(e,o,n)},Qa=(e,t)=>{_u.uniform1f(Li(e),t)},Ja=[],es=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform1fv(Li(e),D,r>>2,t);else{if(t<=288)for(var n=Ja[t-1],o=0;o<t;++o)n[o]=D[r+4*o>>2];else n=D.subarray(r>>2,r+4*t>>2);_u.uniform1fv(Li(e),n)}},ts=(e,t)=>{_u.uniform1i(Li(e),t)},rs=[],ns=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform1iv(Li(e),F,r>>2,t);else{if(t<=288)for(var n=rs[t-1],o=0;o<t;++o)n[o]=F[r+4*o>>2];else n=F.subarray(r>>2,r+4*t>>2);_u.uniform1iv(Li(e),n)}},os=(e,t)=>{_u.uniform1ui(Li(e),t)},is=(e,t,r)=>{t&&_u.uniform1uiv(Li(e),L,r>>2,t)},as=(e,t,r)=>{_u.uniform2f(Li(e),t,r)},ss=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform2fv(Li(e),D,r>>2,2*t);else{if(t<=144)for(var n=Ja[2*t-1],o=0;o<2*t;o+=2)n[o]=D[r+4*o>>2],n[o+1]=D[r+(4*o+4)>>2];else n=D.subarray(r>>2,r+8*t>>2);_u.uniform2fv(Li(e),n)}},us=(e,t,r)=>{_u.uniform2i(Li(e),t,r)},cs=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform2iv(Li(e),F,r>>2,2*t);else{if(t<=144)for(var n=rs[2*t-1],o=0;o<2*t;o+=2)n[o]=F[r+4*o>>2],n[o+1]=F[r+(4*o+4)>>2];else n=F.subarray(r>>2,r+8*t>>2);_u.uniform2iv(Li(e),n)}},ls=(e,t,r)=>{_u.uniform2ui(Li(e),t,r)},ds=(e,t,r)=>{t&&_u.uniform2uiv(Li(e),L,r>>2,2*t)},ps=(e,t,r,n)=>{_u.uniform3f(Li(e),t,r,n)},hs=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform3fv(Li(e),D,r>>2,3*t);else{if(t<=96)for(var n=Ja[3*t-1],o=0;o<3*t;o+=3)n[o]=D[r+4*o>>2],n[o+1]=D[r+(4*o+4)>>2],n[o+2]=D[r+(4*o+8)>>2];else n=D.subarray(r>>2,r+12*t>>2);_u.uniform3fv(Li(e),n)}},fs=(e,t,r,n)=>{_u.uniform3i(Li(e),t,r,n)},ms=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform3iv(Li(e),F,r>>2,3*t);else{if(t<=96)for(var n=rs[3*t-1],o=0;o<3*t;o+=3)n[o]=F[r+4*o>>2],n[o+1]=F[r+(4*o+4)>>2],n[o+2]=F[r+(4*o+8)>>2];else n=F.subarray(r>>2,r+12*t>>2);_u.uniform3iv(Li(e),n)}},gs=(e,t,r,n)=>{_u.uniform3ui(Li(e),t,r,n)},ys=(e,t,r)=>{t&&_u.uniform3uiv(Li(e),L,r>>2,3*t)},bs=(e,t,r,n,o)=>{_u.uniform4f(Li(e),t,r,n,o)},vs=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform4fv(Li(e),D,r>>2,4*t);else{if(t<=72){var n=Ja[4*t-1],o=D;r>>=2;for(var i=0;i<4*t;i+=4){var a=r+i;n[i]=o[a],n[i+1]=o[a+1],n[i+2]=o[a+2],n[i+3]=o[a+3]}}else n=D.subarray(r>>2,r+16*t>>2);_u.uniform4fv(Li(e),n)}},ws=(e,t,r,n,o)=>{_u.uniform4i(Li(e),t,r,n,o)},_s=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform4iv(Li(e),F,r>>2,4*t);else{if(t<=72)for(var n=rs[4*t-1],o=0;o<4*t;o+=4)n[o]=F[r+4*o>>2],n[o+1]=F[r+(4*o+4)>>2],n[o+2]=F[r+(4*o+8)>>2],n[o+3]=F[r+(4*o+12)>>2];else n=F.subarray(r>>2,r+16*t>>2);_u.uniform4iv(Li(e),n)}},Es=(e,t,r,n,o)=>{_u.uniform4ui(Li(e),t,r,n,o)},Ss=(e,t,r)=>{t&&_u.uniform4uiv(Li(e),L,r>>2,4*t)},Cs=(e,t,r)=>{e=gr.programs[e],_u.uniformBlockBinding(e,t,r)},xs=(e,t,r,n)=>{if(gr.currentContext.version>=2)t&&_u.uniformMatrix2fv(Li(e),!!r,D,n>>2,4*t);else{if(t<=72)for(var o=Ja[4*t-1],i=0;i<4*t;i+=4)o[i]=D[n+4*i>>2],o[i+1]=D[n+(4*i+4)>>2],o[i+2]=D[n+(4*i+8)>>2],o[i+3]=D[n+(4*i+12)>>2];else o=D.subarray(n>>2,n+16*t>>2);_u.uniformMatrix2fv(Li(e),!!r,o)}},ks=(e,t,r,n)=>{t&&_u.uniformMatrix2x3fv(Li(e),!!r,D,n>>2,6*t)},Ts=(e,t,r,n)=>{t&&_u.uniformMatrix2x4fv(Li(e),!!r,D,n>>2,8*t)},As=(e,t,r,n)=>{if(gr.currentContext.version>=2)t&&_u.uniformMatrix3fv(Li(e),!!r,D,n>>2,9*t);else{if(t<=32)for(var o=Ja[9*t-1],i=0;i<9*t;i+=9)o[i]=D[n+4*i>>2],o[i+1]=D[n+(4*i+4)>>2],o[i+2]=D[n+(4*i+8)>>2],o[i+3]=D[n+(4*i+12)>>2],o[i+4]=D[n+(4*i+16)>>2],o[i+5]=D[n+(4*i+20)>>2],o[i+6]=D[n+(4*i+24)>>2],o[i+7]=D[n+(4*i+28)>>2],o[i+8]=D[n+(4*i+32)>>2];else o=D.subarray(n>>2,n+36*t>>2);_u.uniformMatrix3fv(Li(e),!!r,o)}},Ps=(e,t,r,n)=>{t&&_u.uniformMatrix3x2fv(Li(e),!!r,D,n>>2,6*t)},qs=(e,t,r,n)=>{t&&_u.uniformMatrix3x4fv(Li(e),!!r,D,n>>2,12*t)},Fs=(e,t,r,n)=>{if(gr.currentContext.version>=2)t&&_u.uniformMatrix4fv(Li(e),!!r,D,n>>2,16*t);else{if(t<=18){var o=Ja[16*t-1],i=D;n>>=2;for(var a=0;a<16*t;a+=16){var s=n+a;o[a]=i[s],o[a+1]=i[s+1],o[a+2]=i[s+2],o[a+3]=i[s+3],o[a+4]=i[s+4],o[a+5]=i[s+5],o[a+6]=i[s+6],o[a+7]=i[s+7],o[a+8]=i[s+8],o[a+9]=i[s+9],o[a+10]=i[s+10],o[a+11]=i[s+11],o[a+12]=i[s+12],o[a+13]=i[s+13],o[a+14]=i[s+14],o[a+15]=i[s+15]}}else o=D.subarray(n>>2,n+64*t>>2);_u.uniformMatrix4fv(Li(e),!!r,o)}},Ls=(e,t,r,n)=>{t&&_u.uniformMatrix4x2fv(Li(e),!!r,D,n>>2,8*t)},Ds=(e,t,r,n)=>{t&&_u.uniformMatrix4x3fv(Li(e),!!r,D,n>>2,12*t)},Bs=e=>{e=gr.programs[e],_u.useProgram(e),_u.currentProgram=e},Rs=e=>{_u.validateProgram(gr.programs[e])},Ms=function(e,t){_u.vertexAttrib1f(e,t)},Is=(e,t)=>{_u.vertexAttrib1f(e,D[t>>2])},Os=function(e,t,r){_u.vertexAttrib2f(e,t,r)},js=(e,t)=>{_u.vertexAttrib2f(e,D[t>>2],D[t+4>>2])},Us=function(e,t,r,n){_u.vertexAttrib3f(e,t,r,n)},$s=(e,t)=>{_u.vertexAttrib3f(e,D[t>>2],D[t+4>>2],D[t+8>>2])},Ns=function(e,t,r,n,o){_u.vertexAttrib4f(e,t,r,n,o)},Hs=(e,t)=>{_u.vertexAttrib4f(e,D[t>>2],D[t+4>>2],D[t+8>>2],D[t+12>>2])},Vs=(e,t)=>{_u.vertexAttribDivisor(e,t)},Ws=Vs,zs=Vs,Gs=Vs,Ys=Vs,Xs=Vs,Zs=function(e,t,r,n,o){_u.vertexAttribI4i(e,t,r,n,o)},Ks=(e,t)=>{_u.vertexAttribI4i(e,F[t>>2],F[t+4>>2],F[t+8>>2],F[t+12>>2])},Qs=function(e,t,r,n,o){_u.vertexAttribI4ui(e,t,r,n,o)},Js=(e,t)=>{_u.vertexAttribI4ui(e,L[t>>2],L[t+4>>2],L[t+8>>2],L[t+12>>2])},eu=(e,t,r,n,o)=>{_u.vertexAttribIPointer(e,t,r,n,o)},tu=(e,t,r,n,o,i)=>{_u.vertexAttribPointer(e,t,r,!!n,o,i)},ru=function(e,t,r,n){_u.viewport(e,t,r,n)},nu=(e,t,r)=>{r=Number(r),_u.waitSync(gr.syncs[e],t,r)},ou=e=>{var t=(e-S.buffer.byteLength+65535)/65536;try{return S.grow(t),j(),1}catch(e){}},iu={removeAllEventListeners(){for(;iu.eventHandlers.length;)iu._removeHandler(iu.eventHandlers.length-1);iu.deferredCalls=[]},inEventHandler:0,deferredCalls:[],deferCall(e,t,r){function n(e,t){if(e.length!=t.length)return!1;for(var r in e)if(e[r]!=t[r])return!1;return!0}for(var o in iu.deferredCalls){var i=iu.deferredCalls[o];if(i.targetFunction==e&&n(i.argsList,r))return}iu.deferredCalls.push({targetFunction:e,precedence:t,argsList:r}),iu.deferredCalls.sort(((e,t)=>e.precedence<t.precedence))},removeDeferredCalls(e){for(var t=0;t<iu.deferredCalls.length;++t)iu.deferredCalls[t].targetFunction==e&&(iu.deferredCalls.splice(t,1),--t)},canPerformEventHandlerRequests:()=>navigator.userActivation?navigator.userActivation.isActive:iu.inEventHandler&&iu.currentEventHandler.allowsDeferredCalls,runDeferredCalls(){if(iu.canPerformEventHandlerRequests())for(var e=0;e<iu.deferredCalls.length;++e){var t=iu.deferredCalls[e];iu.deferredCalls.splice(e,1),--e,t.targetFunction.apply(null,t.argsList)}},eventHandlers:[],removeAllHandlersOnTarget:(e,t)=>{for(var r=0;r<iu.eventHandlers.length;++r)iu.eventHandlers[r].target!=e||t&&t!=iu.eventHandlers[r].eventTypeString||iu._removeHandler(r--)},_removeHandler(e){var t=iu.eventHandlers[e];t.target.removeEventListener(t.eventTypeString,t.eventListenerFunc,t.useCapture),iu.eventHandlers.splice(e,1)},registerOrRemoveHandler(e){if(!e.target)return-4;if(e.callbackfunc)e.eventListenerFunc=function(t){++iu.inEventHandler,iu.currentEventHandler=e,iu.runDeferredCalls(),e.handlerFunc(t),iu.runDeferredCalls(),--iu.inEventHandler},e.target.addEventListener(e.eventTypeString,e.eventListenerFunc,e.useCapture),iu.eventHandlers.push(e);else for(var t=0;t<iu.eventHandlers.length;++t)iu.eventHandlers[t].target==e.target&&iu.eventHandlers[t].eventTypeString==e.eventTypeString&&iu._removeHandler(t--);return 0},getNodeNameForTarget:e=>e?e==window?"#window":e==screen?"#screen":e?.nodeName||"":"",fullscreenEnabled:()=>document.fullscreenEnabled||document.webkitFullscreenEnabled},au=["default","low-power","high-performance"],su=[0,"undefined"!=typeof document?document:0,"undefined"!=typeof window?window:0],uu=e=>{var t;return e=(t=e)>2?xe(t):t,su[e]||("undefined"!=typeof document?document.querySelector(e):void 0)},cu=(e,t)=>{var r=t>>2,n=F[r+6],o={alpha:!!F[r+0],depth:!!F[r+1],stencil:!!F[r+2],antialias:!!F[r+3],premultipliedAlpha:!!F[r+4],preserveDrawingBuffer:!!F[r+5],powerPreference:au[n],failIfMajorPerformanceCaveat:!!F[r+7],majorVersion:F[r+8],minorVersion:F[r+9],enableExtensionsByDefault:F[r+10],explicitSwapControl:F[r+11],proxyContextToMainThread:F[r+12],renderViaOffscreenBackBuffer:F[r+13]},i=uu(e);return i?o.explicitSwapControl?0:gr.createContext(i,o):0},lu={},du=()=>{if(!du.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:f||"./this.program"};for(var t in lu)void 0===lu[t]?delete e[t]:e[t]=lu[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);du.strings=r}return du.strings},pu=(e,t,r,n)=>{for(var o=0,i=0;i<r;i++){var a=L[t>>2],s=L[t+4>>2];t+=8;var u=Ce.read(e,T,a,s,n);if(u<0)return-1;if(o+=u,u<s)break;void 0!==n&&(n+=u)}return o},hu=[31,29,31,30,31,30,31,31,30,31,30,31],fu=[31,28,31,30,31,30,31,31,30,31,30,31],mu=(e,t)=>{T.set(e,t)},gu=(e,t,r,n)=>{var o=L[n+40>>2],i={tm_sec:F[n>>2],tm_min:F[n+4>>2],tm_hour:F[n+8>>2],tm_mday:F[n+12>>2],tm_mon:F[n+16>>2],tm_year:F[n+20>>2],tm_wday:F[n+24>>2],tm_yday:F[n+28>>2],tm_isdst:F[n+32>>2],tm_gmtoff:F[n+36>>2],tm_zone:o?xe(o):""},a=xe(r),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in s)a=a.replace(new RegExp(u,"g"),s[u]);var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,t,r){for(var n="number"==typeof e?e.toString():e||"";n.length<t;)n=r[0]+n;return n}function p(e,t){return d(e,t,"0")}function h(e,t){function r(e){return e<0?-1:e>0?1:0}var n;return 0===(n=r(e.getFullYear()-t.getFullYear()))&&0===(n=r(e.getMonth()-t.getMonth()))&&(n=r(e.getDate()-t.getDate())),n}function f(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function m(e){var t=((e,t)=>{for(var r=new Date(e.getTime());t>0;){var n=rr(r.getFullYear()),o=r.getMonth(),i=(n?hu:fu)[o];if(!(t>i-r.getDate()))return r.setDate(r.getDate()+t),r;t-=i-r.getDate()+1,r.setDate(1),o<11?r.setMonth(o+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r})(new Date(e.tm_year+1900,0,1),e.tm_yday),r=new Date(t.getFullYear(),0,4),n=new Date(t.getFullYear()+1,0,4),o=f(r),i=f(n);return h(o,t)<=0?h(i,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var g={"%a":e=>c[e.tm_wday].substring(0,3),"%A":e=>c[e.tm_wday],"%b":e=>l[e.tm_mon].substring(0,3),"%B":e=>l[e.tm_mon],"%C":e=>p((e.tm_year+1900)/100|0,2),"%d":e=>p(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>m(e).toString().substring(2),"%G":m,"%H":e=>p(e.tm_hour,2),"%I":e=>{var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),p(t,2)},"%j":e=>p(e.tm_mday+((e,t)=>{for(var r=0,n=0;n<=t;r+=e[n++]);return r})(rr(e.tm_year+1900)?hu:fu,e.tm_mon-1),3),"%m":e=>p(e.tm_mon+1,2),"%M":e=>p(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>p(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var t=e.tm_yday+7-e.tm_wday;return p(Math.floor(t/7),2)},"%V":e=>{var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var r=(e.tm_wday+371-e.tm_yday)%7;4==r||3==r&&rr(e.tm_year)||(t=1)}}else{t=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&rr(e.tm_year%400-1))&&t++}return p(t,2)},"%w":e=>e.tm_wday,"%W":e=>{var t=e.tm_yday+7-(e.tm_wday+6)%7;return p(Math.floor(t/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var t=e.tm_gmtoff,r=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(r?"+":"-")+String("0000"+t).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in a=a.replace(/%%/g,"\0\0"),g)a.includes(u)&&(a=a.replace(new RegExp(u,"g"),g[u](i)));var y=be(a=a.replace(/\0\0/g,"%"),!1);return y.length>t?0:(mu(y,e),y.length-1)},yu=e=>{var t=ge(e)+1,r=$u(t);return Nt(e,r,t),r},bu=function(e,t,r,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Ce.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},vu=365,wu=146;Object.defineProperties(bu.prototype,{read:{get:function(){return(this.mode&vu)===vu},set:function(e){e?this.mode|=vu:this.mode&=-366}},write:{get:function(){return(this.mode&wu)===wu},set:function(e){e?this.mode|=wu:this.mode&=-147}},isFolder:{get:function(){return Ce.isDir(this.mode)}},isDevice:{get:function(){return Ce.isChrdev(this.mode)}}}),Ce.FSNode=bu,Ce.createPreloadedFile=(e,t,r,n,o,i,a,s,u,c)=>{var d=t?pe.resolve(le.join2(e,t)):e;function p(r){function l(r){c?.(),s||((e,t,r,n,o,i)=>{Ce.createDataFile(e,t,r,n,o,i)})(e,t,r,n,o,u),i?.(),X()}((e,t,r,n)=>{void 0!==fr&&fr.init();var o=!1;return Ee.forEach((i=>{o||i.canHandle(t)&&(i.handle(e,t,r,n),o=!0)})),o})(r,d,l,(()=>{a?.(),X()}))||l(r)}Y(),"string"==typeof r?((e,t,r,n)=>{var o=n?"":`al ${e}`;l(e,(e=>{t(new Uint8Array(e)),o&&X()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),o&&Y()})(r,p,a):p(r)},Ce.staticInit(),u.FS_createPath=Ce.createPath,u.FS_createDataFile=Ce.createDataFile,u.FS_createPreloadedFile=Ce.createPreloadedFile,u.FS_unlink=Ce.unlink,u.FS_createLazyFile=Ce.createLazyFile,u.FS_createDevice=Ce.createDevice,qe=u.InternalError=class InternalError extends Error{constructor(e){super(e),this.name="InternalError"}},(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Fe=e})(),Le=u.BindingError=class BindingError extends Error{constructor(e){super(e),this.name="BindingError"}},Object.assign(ut.prototype,{isAliasOf(e){if(!(this instanceof ut))return!1;if(!(e instanceof ut))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return t===n&&r===o},clone(){if(this.$$.ptr||ze(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=st(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$e("Object already scheduled for deletion"),Ye(this),Xe(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$e("Object already scheduled for deletion"),et.push(this),1===et.length&&He&&He(tt),this.$$.deleteScheduled=!0,this}}),u.getInheritedInstanceCount=Qe,u.getLiveInheritedInstances=Je,u.flushPendingDeletes=tt,u.setDelayFunction=rt,Object.assign(vt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:We,readValueFromPointer:bt,fromWireType:at}),_t=u.UnboundTypeError=(ko=Error,(Ao=lt(To="UnboundTypeError",(function(e){this.name=To,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(ko.prototype),Ao.prototype.constructor=Ao,Ao.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},Ao),Bt.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Object.assign(Bt,{reserved:Bt.allocated.length}),u.count_emval_handles=Mt,u.requestFullscreen=fr.requestFullscreen,u.requestAnimationFrame=fr.requestAnimationFrame,u.setCanvasSize=fr.setCanvasSize,u.pauseMainLoop=fr.mainLoop.pause,u.resumeMainLoop=fr.mainLoop.resume,u.getUserMedia=fr.getUserMedia,u.createContext=fr.createContext;for(var _u,Eu={},Su={},Cu=0;Cu<32;++Cu)Nn.push(new Array(Cu));var xu=new Float32Array(288);for(Cu=0;Cu<288;++Cu)Ja[Cu]=xu.subarray(0,Cu+1);var ku=new Int32Array(288);for(Cu=0;Cu<288;++Cu)rs[Cu]=ku.subarray(0,Cu+1);var Tu,Au={Oa:e=>{var t=new ExceptionInfo(e);return t.get_caught()||t.set_caught(!0),t.set_rethrown(!1),se.push(t),Hu(t.excPtr),t.get_exception_ptr()},Na:()=>{Ou(0,0);var e=se.pop();Nu(e.excPtr),ue=0},o:()=>ce([]),ba:e=>ce([e]),k:(e,t,r)=>{throw new ExceptionInfo(e).init(t,r),ue=e},Q:e=>{throw ue||(ue=e),ue},fa:function(e,t,r){ke.varargs=r;try{var n=ke.getStreamFromFD(e);switch(t){case 0:if((o=ke.get())<0)return-28;for(;Ce.streams[o];)o++;return Ce.createStream(n,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return n.flags;case 4:var o=ke.get();return n.flags|=o,0;case 12:return o=ke.getp(),P[o+0>>1]=2,0}return-28}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},Ab:function(e,t){try{var r=ke.getStreamFromFD(e);return ke.doStat(Ce.stat,r.path,t)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},Fb:function(e,t,r){ke.varargs=r;try{var n=ke.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),i=ke.getp();F[i>>2]=o.c_iflag||0,F[i+4>>2]=o.c_oflag||0,F[i+8>>2]=o.c_cflag||0,F[i+12>>2]=o.c_lflag||0;for(var a=0;a<32;a++)T[i+a+17>>0]=o.c_cc[a]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){i=ke.getp();var s=F[i>>2],u=F[i+4>>2],c=F[i+8>>2],l=F[i+12>>2],d=[];for(a=0;a<32;a++)d.push(T[i+a+17>>0]);return n.tty.ops.ioctl_tcsets(n.tty,t,{c_iflag:s,c_oflag:u,c_cflag:c,c_lflag:l,c_cc:d})}return 0;case 21519:return n.tty?(i=ke.getp(),F[i>>2]=0,0):-59;case 21520:return n.tty?-28:-59;case 21531:return i=ke.getp(),Ce.ioctl(n,t,i);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var p=n.tty.ops.ioctl_tiocgwinsz(n.tty);i=ke.getp(),P[i>>1]=p[0],P[i+2>>1]=p[1]}return 0;default:return-28}}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},yb:function(e,t){try{return e=ke.getStr(e),ke.doStat(Ce.lstat,e,t)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},xb:function(e,t,r,n){try{t=ke.getStr(t);var o=256&n,i=4096&n;return n&=-6401,t=ke.calculateAt(e,t,i),ke.doStat(o?Ce.lstat:Ce.stat,t,r)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},xa:function(e,t,r,n){ke.varargs=n;try{t=ke.getStr(t),t=ke.calculateAt(e,t);var o=n?ke.get():0;return Ce.open(t,r,o).fd}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},zb:function(e,t){try{return e=ke.getStr(e),ke.doStat(Ce.stat,e,t)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},Ca:e=>{var t=Te[e];delete Te[e];var r=t.elements,n=r.length,o=r.map((e=>e.getterReturnType)).concat(r.map((e=>e.setterArgumentType))),i=t.rawConstructor,a=t.rawDestructor;Ie([e],o,(function(e){return r.forEach(((t,r)=>{var o=e[r],i=t.getter,a=t.getterContext,s=e[r+n],u=t.setter,c=t.setterContext;t.read=e=>o.fromWireType(i(a,e)),t.write=(e,t)=>{var r=[];u(c,e,s.toWireType(r,t)),Ae(r)}})),[{name:t.name,fromWireType:e=>{for(var t=new Array(n),o=0;o<n;++o)t[o]=r[o].read(e);return a(e),t},toWireType:(e,o)=>{if(n!==o.length)throw new TypeError(`Incorrect number of tuple elements for ${t.name}: expected=${n}, actual=${o.length}`);for(var s=i(),u=0;u<n;++u)r[u].write(s,o[u]);return null!==e&&e.push(a,s),s},argPackAdvance:We,readValueFromPointer:Pe,destructorFunction:a}]}))},z:e=>{var t=Oe[e];delete Oe[e];var r=t.rawConstructor,n=t.rawDestructor,o=t.fields,i=o.map((e=>e.getterReturnType)).concat(o.map((e=>e.setterArgumentType)));Ie([e],i,(e=>{var i={};return o.forEach(((t,r)=>{var n=t.fieldName,a=e[r],s=t.getter,u=t.getterContext,c=e[r+o.length],l=t.setter,d=t.setterContext;i[n]={read:e=>a.fromWireType(s(u,e)),write:(e,t)=>{var r=[];l(d,e,c.toWireType(r,t)),Ae(r)}}})),[{name:t.name,fromWireType:e=>{var t={};for(var r in i)t[r]=i[r].read(e);return n(e),t},toWireType:(e,t)=>{for(var o in i)if(!(o in t))throw new TypeError(`Missing field: "${o}"`);var a=r();for(o in i)i[o].write(a,t[o]);return null!==e&&e.push(n,a),a},argPackAdvance:We,readValueFromPointer:Pe,destructorFunction:n}]}))},Fa:(e,t,r,n,o)=>{var i=-1!=(t=Ue(t)).indexOf("u");Ne(e,{name:t,fromWireType:e=>e,toWireType:function(e,t){if("bigint"!=typeof t&&"number"!=typeof t)throw new TypeError(`Cannot convert "${je(t)}" to ${this.name}`);return"number"==typeof t&&(t=BigInt(t)),t},argPackAdvance:We,readValueFromPointer:Ve(t,r,!i),destructorFunction:null})},me:(e,t,r,n)=>{Ne(e,{name:t=Ue(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:We,readValueFromPointer:function(e){return this.fromWireType(A[e])},destructorFunction:null})},v:(e,t,r,n,o,i,a,s,u,c,l,d,p)=>{l=Ue(l),i=xt(o,i),s&&=xt(a,s),c&&=xt(u,c),p=xt(d,p);var h=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(l);pt(h,(function(){Tt(`Cannot construct ${l} due to unbound types`,[n])})),Ie([e,t,r],n?[n]:[],(function(t){var r,o;t=t[0],o=n?(r=t.registeredClass).instancePrototype:ut.prototype;var a=lt(l,(function(){if(Object.getPrototypeOf(this)!==u)throw new Le("Use 'new' to construct "+l);if(void 0===d.constructor_body)throw new Le(l+" has no accessible constructor");var e=d.constructor_body[arguments.length];if(void 0===e)throw new Le(`Tried to invoke ctor of ${l} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),u=Object.create(o,{constructor:{value:a}});a.prototype=u;var d=new ht(l,a,u,p,r,i,s,c);d.baseClass&&(d.baseClass.__derivedClasses??=[],d.baseClass.__derivedClasses.push(d));var f=new vt(l,d,!0,!1,!1),m=new vt(l+"*",d,!1,!1,!1),g=new vt(l+" const*",d,!1,!0,!1);return Ke[e]={pointerType:m,constPointerType:g},Et(h,a),[f,m,g]}))},x:(e,t,r,n,o,i)=>{var a=At(t,r);o=xt(n,o),Ie([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Le(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Tt(`Cannot construct ${e.name} due to unbound types`,a)},Ie([],a,(n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ft(r,n,null,o,i),[]))),[]}))},d:(e,t,r,n,o,i,a,s,u)=>{var c=At(r,n);t=Ue(t),t=Dt(t),i=xt(o,i),Ie([],[e],(function(e){var n=`${(e=e[0]).name}.${t}`;function o(){Tt(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,d=l[t];return void 0===d||void 0===d.overloadTable&&d.className!==e.name&&d.argCount===r-2?(o.argCount=r-2,o.className=e.name,l[t]=o):(dt(l,t,n),l[t].overloadTable[r-2]=o),Ie([],c,(function(o){var s=Ft(n,o,e,i,a,u);return void 0===l[t].overloadTable?(s.argCount=r-2,l[t]=s):l[t].overloadTable[r-2]=s,[]})),[]}))},le:e=>Ne(e,Ot),W:(e,t,r,n)=>{function o(){}t=Ue(t),o.values={},Ne(e,{name:t,constructor:o,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:We,readValueFromPointer:jt(t,r,n),destructorFunction:null}),pt(t,o)},H:(e,t,r)=>{var n=Ut(e,"enum");t=Ue(t);var o=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:lt(`${n.name}_${t}`,(function(){}))}});o.values[r]=i,o[t]=i},Ea:(e,t,r)=>{Ne(e,{name:t=Ue(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:We,readValueFromPointer:$t(t,r),destructorFunction:null})},J:(e,t,r,n,o,i,a)=>{var s=At(t,r);e=Ue(e),e=Dt(e),o=xt(n,o),pt(e,(function(){Tt(`Cannot call ${e} due to unbound types`,s)}),t-1),Ie([],s,(function(r){var n=[r[0],null].concat(r.slice(1));return Et(e,Ft(e,n,null,o,i,a),t-1),[]}))},O:(e,t,r,n,o)=>{t=Ue(t),-1===o&&(o=4294967295);var i=e=>e;if(0===n){var a=32-8*r;i=e=>e<<a>>>a}var s=t.includes("unsigned");Ne(e,{name:t,fromWireType:i,toWireType:s?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:We,readValueFromPointer:Ve(t,r,0!==n),destructorFunction:null})},E:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function o(e){var t=L[e>>2],r=L[e+4>>2];return new n(T.buffer,r,t)}Ne(e,{name:r=Ue(r),fromWireType:o,argPackAdvance:We,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},cf:(e,t,r,n,o,i,a,s,u,c,l,d)=>{r=Ue(r),i=xt(o,i),s=xt(a,s),c=xt(u,c),d=xt(l,d),Ie([e],[t],(function(e){return e=e[0],[new vt(r,e.registeredClass,!1,!1,!0,e,n,i,s,c,d)]}))},Ga:(e,t)=>{var r="std::string"===(t=Ue(t));Ne(e,{name:t,fromWireType(e){var t,n=L[e>>2],o=e+4;if(r)for(var i=o,a=0;a<=n;++a){var s=o+a;if(a==n||0==A[s]){var u=xe(i,s-i);void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),i=s+1}}else{var c=new Array(n);for(a=0;a<n;++a)c[a]=String.fromCharCode(A[o+a]);t=c.join("")}return Lu(e),t},toWireType(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var o="string"==typeof t;o||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||$e("Cannot pass non-string to std::string"),n=r&&o?ge(t):t.length;var i=qu(4+n+1),a=i+4;if(L[i>>2]=n,r&&o)Nt(t,a,n+1);else if(o)for(var s=0;s<n;++s){var u=t.charCodeAt(s);u>255&&(Lu(a),$e("String has UTF-16 code units that do not fit in 8 bits")),A[a+s]=u}else for(s=0;s<n;++s)A[a+s]=t[s];return null!==e&&e.push(Lu,i),i},argPackAdvance:We,readValueFromPointer:bt,destructorFunction(e){Lu(e)}})},ga:(e,t,r)=>{var n,o,i,a,s;r=Ue(r),2===t?(n=Vt,o=Wt,a=zt,i=()=>q,s=1):4===t&&(n=Gt,o=Yt,a=Xt,i=()=>L,s=2),Ne(e,{name:r,fromWireType:e=>{for(var r,o=L[e>>2],a=i(),u=e+4,c=0;c<=o;++c){var l=e+4+c*t;if(c==o||0==a[l>>s]){var d=n(u,l-u);void 0===r?r=d:(r+=String.fromCharCode(0),r+=d),u=l+t}}return Lu(e),r},toWireType:(e,n)=>{"string"!=typeof n&&$e(`Cannot pass non-string to C++ string type ${r}`);var i=a(n),u=qu(4+i+t);return L[u>>2]=i>>s,o(n,u+4,i+t),null!==e&&e.push(Lu,u),u},argPackAdvance:We,readValueFromPointer:Pe,destructorFunction(e){Lu(e)}})},Da:(e,t,r,n,o,i)=>{Te[e]={name:Ue(t),rawConstructor:xt(r,n),rawDestructor:xt(o,i),elements:[]}},N:(e,t,r,n,o,i,a,s,u)=>{Te[e].elements.push({getterReturnType:t,getter:xt(r,n),getterContext:o,setterArgumentType:i,setter:xt(a,s),setterContext:u})},A:(e,t,r,n,o,i)=>{Oe[e]={name:Ue(t),rawConstructor:xt(r,n),rawDestructor:xt(o,i),fields:[]}},m:(e,t,r,n,o,i,a,s,u,c)=>{Oe[e].fields.push({fieldName:Ue(t),getterReturnType:r,getter:xt(n,o),getterContext:i,setterArgumentType:a,setter:xt(s,u),setterContext:c})},ne:(e,t)=>{Ne(e,{isVoid:!0,name:t=Ue(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Cb:()=>1,jb:()=>{throw 1/0},j:(e,t,r)=>(e=It.toValue(e),t=Ut(t,"emval::as"),Zt(t,r,e)),w:(e,t,r,n)=>(e=Kt[e])(null,t=It.toValue(t),r,n),R:(e,t,r,n,o)=>(e=Kt[e])(t=It.toValue(t),t[r=Jt(r)],n,o),c:Rt,ke:(e,t)=>(e=It.toValue(e))==(t=It.toValue(t)),M:e=>0===e?It.toHandle(er()):(e=Jt(e),It.toHandle(er()[e])),s:(e,t,r)=>{var n=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=Ut(L[t+4*n>>2],"parameter "+n);return r})(e,t),o=n.shift();e--;var i="return function (obj, func, destructorsRef, args) {\n",a=0,s=[];0===r&&s.push("obj");for(var u=["retType"],c=[o],l=0;l<e;++l)s.push("arg"+l),u.push("argType"+l),c.push(n[l]),i+=` var arg${l} = argType${l}.readValueFromPointer(args${a?"+"+a:""});\n`,a+=n[l].argPackAdvance;i+=` var rv = ${1===r?"new func":"func.call"}(${s.join(", ")});\n`,o.isVoid||(u.push("emval_returnValue"),c.push(Zt),i+=" return emval_returnValue(retType, destructorsRef, rv);\n"),i+="};\n",u.push(i);var d,p,h=qt(Function,u).apply(null,c),f=`methodCaller<(${n.map((e=>e.name)).join(", ")}) => ${o.name}>`;return d=lt(f,h),p=Kt.length,Kt.push(d),p},h:(e,t)=>(e=It.toValue(e),t=It.toValue(t),It.toHandle(e[t])),e:e=>{e>4&&(Bt.get(e).refcount+=1)},$:(e,t)=>(e=It.toValue(e))instanceof(t=It.toValue(t)),ia:e=>"number"==typeof(e=It.toValue(e)),K:e=>"string"==typeof(e=It.toValue(e)),Je:()=>It.toHandle([]),g:e=>It.toHandle(Jt(e)),C:()=>It.toHandle({}),i:e=>{var t=It.toValue(e);Ae(t),Rt(e)},n:(e,t,r)=>{e=It.toValue(e),t=It.toValue(t),r=It.toValue(r),e[t]=r},f:(e,t)=>{var r=(e=Ut(e,"_emval_take_value")).readValueFromPointer(t);return It.toHandle(r)},of:e=>{throw e=It.toValue(e)},od:e=>(e=It.toValue(e),It.toHandle(typeof e)),rb:function(e,t){e=tr(e);var r=new Date(1e3*e);F[t>>2]=r.getUTCSeconds(),F[t+4>>2]=r.getUTCMinutes(),F[t+8>>2]=r.getUTCHours(),F[t+12>>2]=r.getUTCDate(),F[t+16>>2]=r.getUTCMonth(),F[t+20>>2]=r.getUTCFullYear()-1900,F[t+24>>2]=r.getUTCDay();var n=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),o=(r.getTime()-n)/864e5|0;F[t+28>>2]=o},sb:function(e,t){e=tr(e);var r=new Date(1e3*e);F[t>>2]=r.getSeconds(),F[t+4>>2]=r.getMinutes(),F[t+8>>2]=r.getHours(),F[t+12>>2]=r.getDate(),F[t+16>>2]=r.getMonth(),F[t+20>>2]=r.getFullYear()-1900,F[t+24>>2]=r.getDay();var n=0|ir(r);F[t+28>>2]=n,F[t+36>>2]=-60*r.getTimezoneOffset();var o=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),s=0|(i!=a&&r.getTimezoneOffset()==Math.min(a,i));F[t+32>>2]=s},tb:function(e){var t=(()=>{var t=new Date(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),r=F[e+32>>2],n=t.getTimezoneOffset(),o=new Date(t.getFullYear(),0,1),i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),s=Math.min(a,i);if(r<0)F[e+32>>2]=Number(i!=a&&s==n);else if(r>0!=(s==n)){var u=Math.max(a,i),c=r>0?s:u;t.setTime(t.getTime()+6e4*(c-n))}F[e+24>>2]=t.getDay();var l=0|ir(t);F[e+28>>2]=l,F[e>>2]=t.getSeconds(),F[e+4>>2]=t.getMinutes(),F[e+8>>2]=t.getHours(),F[e+12>>2]=t.getDate(),F[e+16>>2]=t.getMonth(),F[e+20>>2]=t.getYear();var d=t.getTime();return isNaN(d)?-1:d/1e3})();return BigInt(t)},pb:function(e,t,r,n,o,i,a){o=tr(o);try{if(isNaN(o))return 61;var s=ke.getStreamFromFD(n),u=Ce.mmap(s,e,o,t,r),c=u.ptr;return F[i>>2]=u.allocated,L[a>>2]=c,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},qb:function(e,t,r,n,o,i){i=tr(i);try{if(isNaN(i))return 61;var a=ke.getStreamFromFD(o);2&r&&ke.doMsync(e,a,t,n,i),Ce.munmap(a)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},kb:(e,t,r)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),i=new Date(n,6,1),a=o.getTimezoneOffset(),s=i.getTimezoneOffset(),u=Math.max(a,s);function c(e){var t=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return t?t[1]:"GMT"}L[e>>2]=60*u,F[t>>2]=Number(a!=s);var l=c(o),d=c(i),p=ar(l),h=ar(d);s<a?(L[r>>2]=p,L[r+4>>2]=h):(L[r>>2]=h,L[r+4>>2]=p)},b:()=>{Z("")},qe:function(e){var t=xe(e);localStorage.removeItem(t)},va:(e,t,r,n,o)=>mr.chooseConfig(e,t,r,n,o),wa:(e,t,r,n)=>{if(62e3!=e)return mr.setErrorCode(12296),0;for(var o=1;;){var i=F[n>>2];if(12440!=i){if(12344==i)break;return mr.setErrorCode(12292),0}o=F[n+4>>2],n+=8}return o<2||o>3?(mr.setErrorCode(12293),0):(mr.contextAttributes.majorVersion=o-1,mr.contextAttributes.minorVersion=0,mr.context=gr.createContext(u.canvas,mr.contextAttributes),0!=mr.context?(mr.setErrorCode(12288),gr.makeContextCurrent(mr.context),u.useWebGL=!0,fr.moduleContextCreatedCallbacks.forEach((function(e){e()})),gr.makeContextCurrent(null),62004):(mr.setErrorCode(12297),0))},cb:(e,t,r,n)=>62e3!=e?(mr.setErrorCode(12296),0):62002!=t?(mr.setErrorCode(12293),0):(mr.setErrorCode(12288),62006),Lc:(e,t)=>62e3!=e?(mr.setErrorCode(12296),0):62004!=t?(mr.setErrorCode(12294),0):(gr.deleteContext(mr.context),mr.setErrorCode(12288),mr.currentContext==t&&(mr.currentContext=0),1),Ac:(e,t)=>62e3!=e?(mr.setErrorCode(12296),0):62006!=t?(mr.setErrorCode(12301),1):(mr.currentReadSurface==t&&(mr.currentReadSurface=0),mr.currentDrawSurface==t&&(mr.currentDrawSurface=0),mr.setErrorCode(12288),1),S:(e,t,r,n)=>{if(62e3!=e)return mr.setErrorCode(12296),0;if(62002!=t)return mr.setErrorCode(12293),0;if(!n)return mr.setErrorCode(12300),0;switch(mr.setErrorCode(12288),r){case 12320:return F[n>>2]=mr.contextAttributes.alpha?32:24,1;case 12321:return F[n>>2]=mr.contextAttributes.alpha?8:0,1;case 12322:case 12323:case 12324:return F[n>>2]=8,1;case 12325:return F[n>>2]=mr.contextAttributes.depth?24:0,1;case 12326:return F[n>>2]=mr.contextAttributes.stencil?8:0,1;case 12327:case 12335:case 12340:return F[n>>2]=12344,1;case 12328:return F[n>>2]=62002,1;case 12329:case 12333:case 12334:case 12345:case 12346:case 12347:case 12349:case 12350:case 12354:return F[n>>2]=0,1;case 12330:case 12332:return F[n>>2]=4096,1;case 12331:return F[n>>2]=16777216,1;case 12337:return F[n>>2]=mr.contextAttributes.antialias?4:0,1;case 12338:return F[n>>2]=mr.contextAttributes.antialias?1:0,1;case 12339:case 12352:return F[n>>2]=4,1;case 12341:case 12342:case 12343:return F[n>>2]=-1,1;case 12348:return F[n>>2]=1,1;case 12351:return F[n>>2]=12430,1;default:return mr.setErrorCode(12292),0}},Lb:e=>(mr.setErrorCode(12288),0!=e&&1!=e?0:62e3),Aa:()=>mr.errorCode,Eb:(e,t,r)=>62e3!=e?(mr.setErrorCode(12296),0):(t&&(F[t>>2]=1),r&&(F[r>>2]=4),mr.defaultDisplayInitialized=!0,mr.setErrorCode(12288),1),Wb:(e,t,r,n)=>62e3!=e?(mr.setErrorCode(12296),0):0!=n&&62004!=n?(mr.setErrorCode(12294),0):0!=r&&62006!=r||0!=t&&62006!=t?(mr.setErrorCode(12301),0):(gr.makeContextCurrent(n?mr.context:null),mr.currentContext=n,mr.currentDrawSurface=t,mr.currentReadSurface=r,mr.setErrorCode(12288),1),Ba:(e,t)=>{if(mr.defaultDisplayInitialized)if(u.ctx){if(!u.ctx.isContextLost())return mr.setErrorCode(12288),1;mr.setErrorCode(12302)}else mr.setErrorCode(12290);else mr.setErrorCode(12289);return 0},pc:e=>62e3!=e?(mr.setErrorCode(12296),0):(mr.currentContext=0,mr.currentReadSurface=0,mr.currentDrawSurface=0,mr.defaultDisplayInitialized=!1,mr.setErrorCode(12288),1),I:(e,t,r)=>br(e,t,r),ze:e=>{console.error(xe(e))},Ae:e=>{console.log(xe(e))},ma:e=>{console.warn(xe(e))},da:()=>Date.now(),pe:function(){},mb:()=>2147483648,Bb:Lt,_f:vr,$f:wr,Wc:_r,ge:Er,Ic:Sr,ag:Cr,bg:xr,Fc:kr,Gc:Tr,_e:Ar,$e:Pr,Ke:qr,cg:Fr,Tb:Lr,xf:Br,zf:Rr,dg:Mr,eg:Ir,Vd:Or,fg:jr,Ud:Ur,Ue:$r,gg:Nr,hg:Hr,af:Vr,ig:Wr,hc:zr,ic:Gr,kc:Yr,jc:Xr,jg:Zr,Td:Kr,kg:Qr,La:Jr,lg:en,mg:tn,ng:rn,$c:nn,og:on,_c:an,Se:sn,Sd:un,pg:cn,ad:ln,qg:dn,rg:pn,sg:hn,tg:fn,bf:mn,ug:gn,Yc:yn,ie:bn,df:vn,Le:wn,vg:_n,Te:En,wg:Sn,Sb:Cn,yf:kn,Af:Tn,Rd:An,xg:Pn,Qd:qn,Pd:Fn,yg:Ln,zg:Dn,Ag:Bn,vf:Mn,Yd:In,hd:On,sf:jn,id:Un,Gb:$n,qf:Vn,dd:Wn,Zd:zn,Bg:Yn,wf:Zn,Xd:Kn,ed:Qn,tf:Jn,fd:eo,gd:to,jf:ro,Cg:no,Dg:oo,Vc:io,fe:ao,Hc:so,Qe:uo,Eg:co,Fg:lo,ef:po,ff:ho,Mc:fo,Gg:mo,Hg:yo,gf:bo,Zc:vo,je:wo,hf:_o,Me:Eo,Ig:So,Rb:Co,uf:Po,Bf:qo,We:Fo,Od:Do,Nd:Bo,cc:Ro,dc:Mo,fc:Io,Md:Oo,Ld:jo,Kd:Ho,Zb:Vo,Jg:Wo,Kg:zo,Lg:Go,uc:Yo,Xe:Xo,_b:Ko,ac:Qo,Jc:Jo,kh:ei,Ib:ti,Nb:ri,Mg:ni,Ng:oi,ae:ai,ce:ui,$d:ci,Tc:li,be:di,Uc:pi,de:hi,Ye:fi,Ub:mi,Vb:gi,Og:yi,Ge:bi,Jd:vi,Pg:wi,Ka:_i,lh:Ei,$b:Si,Id:Ci,Hd:xi,Dc:ki,ec:Ti,gc:Ai,Qg:Fi,Gd:Bi,Fd:Ri,vc:Mi,Cc:ji,Bc:Ui,Cd:$i,Ed:Ni,Dd:Hi,Bd:Vi,He:Wi,Ie:zi,Ad:Gi,zd:Yi,yd:Xi,xd:Zi,Xc:Ki,he:Qi,wd:Ji,Yb:ea,vd:ta,Re:ra,Rg:na,Qb:oa,Kc:aa,_d:sa,Sg:ua,Tg:ca,nf:la,pf:da,Pb:pa,Ug:ha,ud:fa,Mb:ma,Kb:ga,ee:ya,rf:ba,Vg:Ea,td:Sa,Ze:Ca,Ve:xa,Ob:ka,sd:Ta,Ne:Aa,Xb:Pa,Oe:qa,Pe:Fa,Wg:La,rd:Da,Xg:Ba,Yg:Ra,Zg:Ma,_g:Ia,$g:Oa,ah:ja,bh:Ua,ch:$a,cd:Na,dh:Ha,eh:Va,fh:Wa,gh:za,kf:Ga,Jb:Ya,hh:Xa,bd:Za,Ec:Ka,ih:Qa,jh:es,Wf:ts,Xf:ns,tc:os,oc:is,Yf:as,Zf:ss,Vf:us,Uf:cs,sc:ls,nc:ds,Tf:ps,Sf:hs,Rf:fs,Qf:ms,rc:gs,mc:ys,Pf:bs,Of:vs,Cf:ws,Df:_s,qc:Es,lc:Ss,bc:Cs,Ef:xs,Sc:ks,Qc:Ts,Ff:As,Rc:Ps,Oc:qs,Gf:Fs,Pc:Ls,Nc:Ds,Hf:Bs,qd:Rs,If:Ms,pd:Is,nd:Os,Jf:js,md:Us,Kf:$s,ld:Ns,Lf:Hs,lf:Ws,Wd:zs,jd:Gs,kd:Ys,Hb:Xs,zc:Zs,xc:Ks,yc:Qs,wc:Js,mf:eu,Mf:tu,Nf:ru,Ma:nu,Db:(e,t,r)=>A.copyWithin(e,t,t+r),nb:e=>{var t=A.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n,o,i=1;i<=4;i*=2){var a=t*(1+.2/i);a=Math.min(a,e+100663296);var s=Math.min(r,(n=Math.max(e,a))+((o=65536)-n%o)%o);if(ou(s))return!0}return!1},_a:function(e,t,r,n,o,i,a,s,c){const l=u.UTF8ToString(e,e+t),d=u.HEAPU8.subarray(o,o+i),p=u.emscripten_ubq_codec_audioDecoderNextHandle++,h={codec:l,sampleRate:r,numberOfChannels:n,description:d};try{const e=u.emscripten_ubq_codec_createAudioDecoder(a,s,c);AudioDecoder.isConfigSupported(h).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(h),u.emscripten_ubq_codec_audioDecoders.set(p,{audioDecoder:e,decoderConfig:h,leftBufferPtr:a,rightBufferPtr:s,bufferLength:c})}catch(e){return u.emscripten_ubq_codec_createNativeResult({error:e})}return u.emscripten_ubq_codec_createNativeResult({handle:p})},Ua:function(e,t,r,n,o,i){const a=u.UTF8ToString(e,e+t),s=u.emscripten_ubq_codec_audioEncoderNextHandle++,c={codec:a,sampleRate:r,numberOfChannels:n,bitrate:o};try{const e=new AudioEncoder({output:e=>{const t=u._malloc(e.byteLength),r=u.HEAPU8.subarray(t,t+e.byteLength);e.copyTo(r),u.emscripten_ubq_codec_onOutputEncodedAudioChunk(s,t,e.byteLength,i),u._free(t)},error:e=>console.error(e)});e.configure(c),u.emscripten_ubq_codec_audioEncoders.set(s,{audioEncoder:e,audioEncoderConfig:c,frameIndex:0})}catch(e){return e+=' Requested codec: "'+a+'"',e+="; sample rate: "+r,e+="; channels: "+n,e+="; bit rate: "+o,u.emscripten_ubq_codec_createNativeResult({error:e})}return u.emscripten_ubq_codec_createNativeResult({handle:s})},bb:function(e,t,r,n,o,i,a){const s=u.UTF8ToString(e,e+t),c=u.HEAPU8.subarray(o,o+i),l=u.emscripten_ubq_codec_videoDecoderNextHandle++,d={codec:s,codedWidth:r,codedHeight:n,description:c,optimizeForLatency:!0};try{const e=u.emscripten_ubq_codec_createVideoDecoder(l,a);VideoDecoder.isConfigSupported(d).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(d),u.emscripten_ubq_codec_videoDecoders.set(l,{videoDecoder:e,decoderConfig:d,codecServicePtr:a})}catch(e){return u.emscripten_ubq_codec_createNativeResult({error:e})}return u.emscripten_ubq_codec_createNativeResult({handle:l})},Xa:function(e,t,r,n,o,i){const a=u.UTF8ToString(e,e+t),s=u.emscripten_ubq_codec_videoEncoderNextHandle++,c=u.specialHTMLTargets["!canvas"];c.width=r,c.height=n;const l={codec:a,width:r,height:n,avc:{format:"annexb"},framerate:o};try{const e=new VideoEncoder({output:e=>{const t=u._malloc(e.byteLength),r=u.HEAPU8.subarray(t,t+e.byteLength);e.copyTo(r),u.emscripten_ubq_codec_onOutputEncodedVideoChunk(s,t,e.byteLength,i),u._free(t)},error:e=>console.error(e)});VideoEncoder.isConfigSupported(l).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(l),u.emscripten_ubq_codec_videoEncoders.set(s,{videoEncoder:e,encoderConfig:l,groupOfPictures:150,frameIndex:0})}catch(e){return e+=' Requested codec: "'+a+'"',e+="; resolution: "+r+"x"+n,u.emscripten_ubq_codec_createNativeResult({error:e})}return u.emscripten_ubq_codec_createNativeResult({handle:s})},Pa:function(e,t,r,n,o,i){const a=u.emscripten_ubq_codec_audioDecoders.get(e);if(a.audioDecoder.unexpectedError)return u.emscripten_ubq_codec_createNativeResult({code:2,error:a.audioDecoder.unexpectedError});"closed"===a.audioDecoder.state&&(a.audioDecoder=u.emscripten_ubq_codec_createAudioDecoder(a.leftBufferPtr,a.rightBufferPtr,a.bufferLength),a.audioDecoder.configure(a.decoderConfig));const s=a.audioDecoder,c=u.HEAPU8.subarray(o,o+i),l=new EncodedAudioChunk({type:t?"key":"delta",timestamp:r,duration:n,data:c});try{s.decode(l)}catch(e){return s.configUnsupported?u.emscripten_ubq_codec_createNativeResult({code:2,error:e}):u.emscripten_ubq_codec_createNativeResult({code:1,error:e})}return u.emscripten_ubq_codec_createNativeResult({code:0})},Qa:function(e,t,r,n,o,i){const a=u.emscripten_ubq_codec_videoDecoders.get(e);if(a.videoDecoder.unexpectedError)return u.emscripten_ubq_codec_createNativeResult({code:2,error:a.videoDecoder.unexpectedError});if("closed"===a.videoDecoder.state){const t=a.videoDecoder.textures;return a.videoDecoder=u.emscripten_ubq_codec_createVideoDecoder(e,a.codecServicePtr),a.videoDecoder.textures=t,a.videoDecoder.configure(a.decoderConfig),u.emscripten_ubq_codec_createNativeResult({code:1,error:"VideoDecoder was closed"})}const s=a.videoDecoder,c=u.HEAPU8.subarray(o,o+i),l=new EncodedVideoChunk({type:t?"key":"delta",timestamp:r,duration:n,data:c});try{s.decode(l)}catch(e){return s.configUnsupported?u.emscripten_ubq_codec_createNativeResult({code:2,error:e}):u.emscripten_ubq_codec_createNativeResult({code:1,error:e})}return u.emscripten_ubq_codec_createNativeResult({code:0})},V:function(e){if(u.emscripten_ubq_codec_audioDecoders.has(e)){const t=u.emscripten_ubq_codec_audioDecoders.get(e);"closed"!==t.audioDecoder.state&&t.audioDecoder.close(),u.emscripten_ubq_codec_audioDecoders.delete(e)}},qa:function(e){const t=u.emscripten_ubq_codec_audioEncoders.get(e);"closed"!==t.audioEncoder.state&&t.audioEncoder.close(),u.emscripten_ubq_codec_audioEncoders.delete(e)},ta:function(e){if(u.emscripten_ubq_codec_videoDecoders.has(e)){const t=u.emscripten_ubq_codec_videoDecoders.get(e);"closed"!==t.videoDecoder.state&&t.videoDecoder.close(),u.emscripten_ubq_codec_videoDecoders.delete(e)}},ra:function(e){const t=u.emscripten_ubq_codec_videoEncoders.get(e);"closed"!==t.videoEncoder.state&&t.videoEncoder.close(),u.emscripten_ubq_codec_videoEncoders.delete(e)},Ta:function(e,t,r){const n=1e6,o=u.emscripten_ubq_codec_audioEncoders.get(e),i=o.audioEncoderConfig.sampleRate,a=o.audioEncoderConfig.numberOfChannels,s=r/a,c=Math.round(n*(o.frameIndex*s/i)),l=Math.round(n*(s/i)),d=u.HEAPF32.subarray(t/4,t/4+r),p=new AudioData({format:"f32",sampleRate:i,numberOfFrames:s,numberOfChannels:a,duration:l,timestamp:c,data:d});o.audioEncoder.encode(p),o.frameIndex++,p.close()},Wa:function(e,t,r){const n=1e6,o=u.emscripten_ubq_codec_videoEncoders.get(e),i=Math.round(n*(o.frameIndex/o.encoderConfig.framerate)),a=o.frameIndex%o.groupOfPictures==0,s=Math.round(n/o.encoderConfig.framerate),c=u.specialHTMLTargets["!canvas"],l=new VideoFrame(c,{timestamp:i,duration:s});o.videoEncoder.encode(l,{keyFrame:a}),l.close(),o.frameIndex++},Sa:async function(e,t){const r=u.emscripten_ubq_codec_audioEncoders.get(e);await r.audioEncoder.flush(),u.emscripten_ubq_codec_onFinalizedAudioEncoding(e,t)},Va:async function(e,t){const r=u.emscripten_ubq_codec_videoEncoders.get(e);await r.videoEncoder.flush(),u.emscripten_ubq_codec_onFinalizedVideoEncoding(e,t)},Za:async function(e,t){const r=u.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder;r.flushing=!0;try{await r.flush()}catch{}r.flushing=!1,r.writtenFrames=t},Y:async function(e,t,r){const n=u.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder;n.shouldDropFrames=r,n.flushing=!0;try{await n.flush()}catch{}n.flushing=!1,n.shouldDropFrames=!1,n.decodedFrames=t},pa:function(e){return u.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.decodeQueueSize},sa:function(e){return u.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.decodedFrames},X:function(e){return u.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.writtenFrames},Ya:function(e){return u.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.flushing},ab:function(e){return u.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.flushing},Z:function(){return"undefined"!=typeof VideoFrame&&"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoEncoder&&"undefined"!=typeof AudioDecoder&&"undefined"!=typeof AudioEncoder},$a:function(e,t){u.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.requestedFrame=t},Ra:function(e,t,r){const n=u.emscripten_ubq_codec_videoDecoders.get(e),o=u.HEAPU32.subarray(t/4,t/4+r);n.videoDecoder.textures=[];for(let e=0;e<r;e++)n.videoDecoder.textures[e]=gr.textures[o[e]]},ue:function(e){const t=u.emscripten_ubq_asyncFetchManager.getProcess(e);return!!(null==t?void 0:t.allocate())},la:function(){u.emscripten_ubq_asyncFetchManager.clear()},ka:function(e,t,r,n){return u.emscripten_ubq_asyncFetchManager.createHeader(e,t,r,n)},xe:function(e){u.emscripten_ubq_asyncFetchManager.deleteHeader(e)},ye:function(e,t,r,n,o,i,a,s,c){return u.emscripten_ubq_asyncFetchManager.fetch(e,t,r,n,o,i,a,s,c).handle},aa:function(e){return u.emscripten_ubq_asyncFetchManager.deleteProcess(e)},we:function(e){var t,r;return null!==(r=null===(t=u.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.receivedLength)&&void 0!==r?r:0},te:function(e){const t=u.emscripten_ubq_asyncFetchManager.getProcess(e);return(null==t?void 0:t.isAllocated())?t.resultAddress:-1},se:function(e){const t=u.emscripten_ubq_asyncFetchManager.getProcess(e);return(null==t?void 0:t.isAllocated())?t.resultLength:-1},ja:function(e){var t,r;return null!==(r=null===(t=u.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.state)&&void 0!==r?r:-1},ve:function(e){var t,r;return null!==(r=null===(t=u.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.totalBytes)&&void 0!==r?r:0},db:function(){return!!u.emscripten_ubq_settings_forceWebGL1},ua:cu,_:e=>{gr.currentContext==e&&(gr.currentContext=0),gr.deleteContext(e)},gb:e=>(e=>{var t=e.getExtension("OES_vertex_array_object");if(t)return e.createVertexArray=()=>t.createVertexArrayOES(),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.isVertexArray=e=>t.isVertexArrayOES(e),1})(gr.contexts[e].GLctx),fb:e=>(e=>{var t=e.getExtension("WEBGL_draw_buffers");if(t)return e.drawBuffers=(e,r)=>t.drawBuffersWEBGL(e,r),1})(gr.contexts[e].GLctx),eb:e=>(e=>!!(e.multiDrawWebgl=e.getExtension("WEBGL_multi_draw")))(gr.contexts[e].GLctx),ca:(e,t)=>{var r=gr.getContext(e),n=xe(t);return n.startsWith("GL_")&&(n=n.substr(3)),!!r.GLctx.getExtension(n)},lb:e=>gr.makeContextCurrent(e)?0:-5,vb:(e,t)=>{var r=0;return du().forEach(((n,o)=>{var i=t+r;L[e+4*o>>2]=i,((e,t)=>{for(var r=0;r<e.length;++r)T[t++>>0]=e.charCodeAt(r);T[t>>0]=0})(n,i),r+=n.length+1})),0},wb:(e,t)=>{var r=du();L[e>>2]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),L[t>>2]=n,0},Be:dr,ea:function(e){try{var t=ke.getStreamFromFD(e);return Ce.close(t),0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},ob:function(e,t,r,n,o){n=tr(n);try{if(isNaN(n))return 61;var i=ke.getStreamFromFD(e),a=pu(i,t,r,n);return L[o>>2]=a,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},za:function(e,t,r,n){try{var o=ke.getStreamFromFD(e),i=pu(o,t,r);return L[n>>2]=i,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},ub:function(e,t,r,n){t=tr(t);try{if(isNaN(t))return 61;var o=ke.getStreamFromFD(e);return Ce.llseek(o,t,r),B[n>>3]=BigInt(o.position),o.getdents&&0===t&&0===r&&(o.getdents=null),0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},ya:function(e,t,r,n){try{var o=((e,t,r,n)=>{for(var o=0,i=0;i<r;i++){var a=L[t>>2],s=L[t+4>>2];t+=8;var u=Ce.write(e,T,a,s,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(ke.getStreamFromFD(e),t,r);return L[n>>2]=o,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},re:function(e){var t=xe(e),r=localStorage.getItem(t);return null==r?null:ar(r)},oe:function(){return"undefined"!=typeof window?ar(window.location.hostname):ar("")},hb:(e,t)=>(de(A.subarray(e,e+t)),0),y:function(e,t,r){var n=ju();try{return Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Ou(1,0)}},L:function(e,t){var r=ju();try{return Ct(e)(t)}catch(e){if(Uu(r),e!==e+0)throw e;Ou(1,0)}},G:function(e,t,r){var n=ju();try{return Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Ou(1,0)}},l:function(e,t,r,n){var o=ju();try{return Ct(e)(t,r,n)}catch(e){if(Uu(o),e!==e+0)throw e;Ou(1,0)}},nh:function(e){var t=ju();try{return Ct(e)()}catch(e){if(Uu(t),e!==e+0)throw e;Ou(1,0)}},na:function(e,t,r){var n=ju();try{return Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Ou(1,0)}},q:function(e,t){var r=ju();try{return Ct(e)(t)}catch(e){if(Uu(r),e!==e+0)throw e;Ou(1,0)}},U:function(e,t,r,n,o,i,a,s,u,c,l,d,p,h,f,m){var g=ju();try{return Ct(e)(t,r,n,o,i,a,s,u,c,l,d,p,h,f,m)}catch(e){if(Uu(g),e!==e+0)throw e;Ou(1,0)}},r:function(e,t,r){var n=ju();try{return Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Ou(1,0)}},t:function(e,t,r,n){var o=ju();try{return Ct(e)(t,r,n)}catch(e){if(Uu(o),e!==e+0)throw e;Ou(1,0)}},T:function(e,t,r,n,o){var i=ju();try{return Ct(e)(t,r,n,o)}catch(e){if(Uu(i),e!==e+0)throw e;Ou(1,0)}},Fe:function(e,t,r,n,o,i){var a=ju();try{return Ct(e)(t,r,n,o,i)}catch(e){if(Uu(a),e!==e+0)throw e;Ou(1,0)}},Ja:function(e,t,r,n,o,i,a){var s=ju();try{return Ct(e)(t,r,n,o,i,a)}catch(e){if(Uu(s),e!==e+0)throw e;Ou(1,0)}},Ia:function(e,t,r,n,o,i,a,s,u,c){var l=ju();try{return Ct(e)(t,r,n,o,i,a,s,u,c)}catch(e){if(Uu(l),e!==e+0)throw e;Ou(1,0)}},P:function(e){var t=ju();try{Ct(e)()}catch(e){if(Uu(t),e!==e+0)throw e;Ou(1,0)}},u:function(e,t){var r=ju();try{Ct(e)(t)}catch(e){if(Uu(r),e!==e+0)throw e;Ou(1,0)}},B:function(e,t,r,n){var o=ju();try{Ct(e)(t,r,n)}catch(e){if(Uu(o),e!==e+0)throw e;Ou(1,0)}},F:function(e,t,r){var n=ju();try{Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Ou(1,0)}},p:function(e,t,r,n){var o=ju();try{Ct(e)(t,r,n)}catch(e){if(Uu(o),e!==e+0)throw e;Ou(1,0)}},D:function(e,t,r,n,o){var i=ju();try{Ct(e)(t,r,n,o)}catch(e){if(Uu(i),e!==e+0)throw e;Ou(1,0)}},Ee:function(e,t,r,n,o,i){var a=ju();try{Ct(e)(t,r,n,o,i)}catch(e){if(Uu(a),e!==e+0)throw e;Ou(1,0)}},Ce:function(e,t,r,n,o,i,a){var s=ju();try{Ct(e)(t,r,n,o,i,a)}catch(e){if(Uu(s),e!==e+0)throw e;Ou(1,0)}},mh:function(e,t,r,n,o,i,a,s){var u=ju();try{Ct(e)(t,r,n,o,i,a,s)}catch(e){if(Uu(u),e!==e+0)throw e;Ou(1,0)}},De:function(e,t,r,n,o,i,a,s,u,c){var l=ju();try{Ct(e)(t,r,n,o,i,a,s,u,c)}catch(e){if(Uu(l),e!==e+0)throw e;Ou(1,0)}},ha:function(){return"undefined"!=typeof localStorage},oa:function(e,t){const r=It.toValue(t),n=u.ctx;n.bindTexture(n.TEXTURE_2D,gr.textures[e]),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r)},a:S,Ha:function(e,t){var r=xe(e),n=xe(t);localStorage.setItem(r,n)},ib:(e,t,r,n,o)=>gu(e,t,r,n)},Pu=function(){var e,t,r,o,i={a:Au};function a(e,t){var r;return Pu=e.exports,wt=Pu.sh,r=Pu.oh,N.unshift(r),X(),Pu}if(Y(),u.instantiateWasm)try{return u.instantiateWasm(i,a)}catch(e){x(`Module.instantiateWasm callback failed with error: ${e}`),n(e)}return(e=E,t=K,r=i,o=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||J(t)||b||"function"!=typeof fetch?re(t,r,o):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(o,(function(e){return x(`wasm streaming compile failed: ${e}`),x("falling back to ArrayBuffer instantiation"),re(t,r,o)}))))).catch(n),{}}(),qu=u._malloc=e=>(qu=u._malloc=Pu.ph)(e),Fu=u._main=(e,t)=>(Fu=u._main=Pu.qh)(e,t),Lu=u._free=e=>(Lu=u._free=Pu.rh)(e),Du=(u._ma_malloc_emscripten=(e,t)=>(u._ma_malloc_emscripten=Pu.th)(e,t),u._ma_free_emscripten=(e,t)=>(u._ma_free_emscripten=Pu.uh)(e,t),u._ma_device_process_pcm_frames_capture__webaudio=(e,t,r)=>(Du=u._ma_device_process_pcm_frames_capture__webaudio=Pu.vh)(e,t,r)),Bu=u._ma_device_process_pcm_frames_playback__webaudio=(e,t,r)=>(Bu=u._ma_device_process_pcm_frames_playback__webaudio=Pu.wh)(e,t,r),Ru=e=>(Ru=Pu.xh)(e),Mu=e=>(Mu=Pu.yh)(e),Iu=(e,t)=>(Iu=Pu.zh)(e,t),Ou=(e,t)=>(Ou=Pu.Ah)(e,t),ju=()=>(ju=Pu.Bh)(),Uu=e=>(Uu=Pu.Ch)(e),$u=e=>($u=Pu.Dh)(e),Nu=e=>(Nu=Pu.Eh)(e),Hu=e=>(Hu=Pu.Fh)(e),Vu=(e,t,r)=>(Vu=Pu.Gh)(e,t,r),Wu=e=>(Wu=Pu.Hh)(e);function zu(e=h){function r(){Tu||(Tu=!0,u.calledRun=!0,I||(u.noFSInit||Ce.init.initialized||Ce.init(),Ce.ignorePermissions=!1,ve.init(),ie(N),ie(H),t(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),Gu&&function(e=[]){var t=Fu;e.unshift(f);var r=e.length,n=$u(4*(r+1)),o=n;e.forEach((e=>{L[o>>2]=yu(e),o+=4})),L[o>>2]=0;try{var i=t(r,n);return lr(i,!0),i}catch(e){return ur(e)}}(e),function(){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;)e=u.postRun.shift(),V.unshift(e);var e;ie(V)}()))}W>0||(function(){if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)e=u.preRun.shift(),$.unshift(e);var e;ie($)}(),W>0||(u.setStatus?(u.setStatus("Running..."),setTimeout((function(){setTimeout((function(){u.setStatus("")}),1),r()}),1)):r()))}if(u.___start_em_js=2406931,u.___stop_em_js=2407766,u.addRunDependency=Y,u.removeRunDependency=X,u.FS_createPath=Ce.createPath,u.FS_createLazyFile=Ce.createLazyFile,u.FS_createDevice=Ce.createDevice,u.ccall=(e,t,r,n,o)=>{var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=yu(e)),t},array:e=>{var t=$u(e.length);return mu(e,t),t}},a=(e=>u["_"+e])(e),s=[],c=0;if(n)for(var l=0;l<n.length;l++){var d=i[r[l]];d?(0===c&&(c=ju()),s[l]=d(n[l])):s[l]=n[l]}var p,h=a.apply(null,s);return p=h,0!==c&&Uu(c),h=function(e){return"string"===t?xe(e):"boolean"===t?Boolean(e):e}(p),h},u.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return T[e>>0];case"i16":return P[e>>1];case"i32":return F[e>>2];case"i64":return B[e>>3];case"float":return D[e>>2];case"double":return M[e>>3];case"*":return L[e>>2];default:Z(`invalid type for getValue: ${t}`)}},u.UTF8ToString=xe,u.specialHTMLTargets=su,u.FS_createPreloadedFile=Ce.createPreloadedFile,u.FS_createDataFile=Ce.createDataFile,u.FS_unlink=Ce.unlink,G=function e(){Tu||zu(),Tu||(G=e)},u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();var Gu=!0;return u.noInitialRun&&(Gu=!1),zu(),e.ready});"object"==typeof e&&"object"==typeof t?t.exports=n:"function"==typeof define&&define.amd&&define([],(()=>n))}}),dt=s(A()),pt=s(tt()),ht=Symbol("PROXY");Symbol("RESTORE");function ft(e,t){Object.defineProperty(e[t],ht,{value:{type:"getter"},writable:!1})}function mt(e,t){Object.defineProperty(e[t],ht,{value:{type:"setter"},writable:!1})}var gt,yt={};(e=>{let t;var r;(r=t=e.ColorSpace||(e.ColorSpace={}))[r.sRGB=0]="sRGB",r[r.CMYK=1]="CMYK",r[r.SpotColor=2]="SpotColor",e.toColor=function(e){switch(e.colorSpace){case 0:return{r:e.components.x,g:e.components.y,b:e.components.z,a:e.components.w};case 2:return{name:e.spotColorName,tint:e.tint,externalReference:e.externalReference};case 1:return{c:e.components.x,m:e.components.y,y:e.components.z,k:e.components.w,tint:e.tint};default:throw new Error("Unknown color space!")}},e.fromColor=function(e){if(function(e){return"r"in e&&"a"in e&&void 0!==e.r&&void 0!==e.a}(e))return{colorSpace:0,components:{x:e.r,y:e.g,z:e.b,w:e.a},spotColorName:"",tint:1,externalReference:""};if(function(e){return"c"in e&&"m"in e&&"y"in e&&"k"in e&&void 0!==e.c&&void 0!==e.m&&void 0!==e.y&&void 0!==e.k}(e))return{colorSpace:1,components:{x:e.c,y:e.m,z:e.y,w:e.k},spotColorName:"",tint:e.tint,externalReference:""};if(function(e){return"name"in e&&void 0!==e.name}(e))return{colorSpace:2,components:{x:0,y:0,z:0,w:0},spotColorName:e.name,tint:e.tint,externalReference:e.externalReference};throw new Error("Unknown color space!")}})(gt||(gt={}));var bt=class{ubq;constructor(e){this.ubq=e}useInternalAPI(e){const t=this.ubq.getInternalAPI();try{return e(t)}finally{t.delete()}}setValue(e,t,r,n){return this.useInternalAPI((o=>vt(o.setValue(e,t,r,n))))}getValue(e,t,r){return this.useInternalAPI((n=>vt(n.getValue(e,t,r))))}async execute(e,t){return new Promise(((r,n)=>{this.useInternalAPI((o=>o.ubqExecute(e,t,(e=>{try{const t=vt(e);r(t)}catch(e){n(e)}})))).delete()}))}};function vt(e){if(e.isValid()){const t=e.value();return e.delete(),t}{const t=e.error(),r=t.publicMessage();throw t.delete(),e.delete(),new Error(r)}}function wt(e){return new Promise(((t,r)=>{e((e=>{try{const r=vt(e);t(r)}catch(e){r(e)}}))}))}u([mt],bt.prototype,"setValue",1),u([ft],bt.prototype,"getValue",1);var _t,Et,St,Ct,xt,kt,Tt,At=(e,t=!0)=>{const r=[];for(let t=0;t<e.size();t+=1)r.push(e.get(t));return t&&e.delete(),r},Pt=new WeakMap,qt={assets:[],total:0,currentPage:0,nextPage:void 0},AssetAPI=class{constructor(e){p(this,Et),p(this,Ct),p(this,kt),p(this,_t,void 0),c(this,"onAssetSourceAdded",(e=>{const t=d(this,_t).subscribeToAssetSourceAdded(e);return()=>{d(this,_t).isDeleted()||vt(d(this,_t).unsubscribe(t))}})),c(this,"onAssetSourceRemoved",(e=>{const t=d(this,_t).subscribeToAssetSourceRemoved(e);return()=>{d(this,_t).isDeleted()||vt(d(this,_t).unsubscribe(t))}})),h(this,_t,e)}addSource(e){const t=e.getSupportedMimeTypes?.bind(e),r=e.getGroups?.bind(e),n=e.applyAsset?.bind(e),o=e.applyAssetToBlock?.bind(e),i=e.addAsset?.bind(e),a=e.removeAsset?.bind(e),s=e.credits,u=e.license;vt(d(this,_t).addAssetSource(e.id,(async(t,r)=>{try{const n={...t,tags:At(t.tags),groups:At(t.groups),excludeGroups:At(t.excludeGroups)},o=await e.findAssets(n);if(o){const t={...o,assets:o.assets.map((t=>Ft(t,e.id)))};r.invoke(t)}else r.invoke(qt)}catch(e){r.invoke(e.message??"Unknown error in user-defined `findAssets`")}}),r?async e=>{try{const t=await r();e.invoke(t)}catch(t){e.invoke(t.message??"Unknown error in user-defined `getGroups`")}}:null,s?()=>({name:s.name,url:s.url??""}):null,u?()=>({name:u.name,url:u.url??""}):null,t?()=>t()??[]:null,n?async(e,t)=>{try{const r=await n(f(this,Et,St).call(this,e));t.invoke(r)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,o?async(e,t,r)=>{try{await o(f(this,Et,St).call(this,e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetToBlock`")}}:null,i?async e=>{i(e)}:null,a?async e=>{a(e)}:null)),f(this,Ct,xt).call(this,e.id,e)}addLocalSource(e,t,r,n){vt(d(this,_t).addLocalAssetSource(e,t??[],r?async(e,t)=>{try{const n=await r(f(this,Et,St).call(this,e));t.invoke(n)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,n?async(e,t,r)=>{try{await n(f(this,Et,St).call(this,e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetToBlock`")}}:null))}removeSource(e){vt(d(this,_t).removeAssetSource(e)),f(this,kt,Tt).call(this,e)}findAllSources(){return At(d(this,_t).findAllAssetSources())}findAssets(e,t){return new Promise(((r,n)=>{let o=t?.tags??[];Array.isArray(o)||(o=[o]);const i={perPage:t?.perPage??0,page:t?.page??0,query:t?.query??"",tags:o,groups:t?.groups??[],excludeGroups:t?.excludeGroups??[],locale:t?.locale??""};d(this,_t).findAssetSourceAssets(e,i,(e=>{try{const t=vt(e);r({...t,nextPage:-1===t.nextPage?void 0:t.nextPage})}catch(e){n(e)}}))}))}async getGroups(e){return wt((t=>d(this,_t).getAssetSourceGroups(e,t))).then((e=>At(e)))}getSupportedMimeTypes(e){return At(vt(d(this,_t).getAssetSourceSupportedMimeTypes(e)))}getCredits(e){const t=vt(d(this,_t).getAssetSourceCredits(e));if(t.name||t.url)return t.url?t:{name:t.name,url:void 0}}getLicense(e){const t=vt(d(this,_t).getAssetSourceLicense(e));if(t.name||t.url)return t.url?t:{name:t.name,url:void 0}}canManageAssets(e){return!!Pt.get(d(this,_t))?.get(e)?.canManageAssets}addAssetToSource(e,t){vt(d(this,_t).addAssetToSource(e,t))}removeAssetFromSource(e,t){vt(d(this,_t).removeAssetFromSource(e,t))}async apply(e,t){return new Promise(((r,n)=>{d(this,_t).applyAssetSourceAsset(e,Ft(t,e),(e=>{try{const t=vt(e);d(this,_t).isValid(t)?r(t):r(void 0)}catch(e){n(e)}}))}))}async applyToBlock(e,t,r){return wt((n=>d(this,_t).applyAssetSourceAssetToBlock(e,Ft(t,e),r,n)))}async defaultApplyAsset(e){return new Promise(((t,r)=>{d(this,_t).defaultApplyAsset(Ft(e,""),(e=>{try{const r=vt(e);d(this,_t).isValid(r)?t(r):t(void 0)}catch(e){r(e)}}))}))}async defaultApplyAssetToBlock(e,t){return wt((r=>d(this,_t).defaultApplyAssetToBlock(Ft(e,""),t,r)))}dispose(){Pt.delete(d(this,_t))}};function Ft(e,t){return"context"in e&&e.context.sourceId===t?e:{...e,context:{sourceId:t}}}_t=new WeakMap,Et=new WeakSet,St=function(e){const t={...e};return 0===t.groups?.length&&delete t.groups,t.locale||delete t.locale,t.label||delete t.label,0===t.tags?.length&&delete t.tags,t.credits?.name||t.credits?.url?t.credits.url||delete t.credits.url:delete t.credits,t.license?.name||t.license?.url?t.license.url||delete t.license.url:delete t.license,t.utm?.source||t.utm?.medium?(t.utm.source||delete t.utm.source,t.utm.medium||delete t.utm.medium):delete t.utm,t},Ct=new WeakSet,xt=function(e,t){Pt.has(d(this,_t))||Pt.set(d(this,_t),new Map),t.canManageAssets&&console.warn(`\nDEPRECATION WARNING:\n\n'canManageAssets' flag was found for asset source with the id '${e}'.\n\nThis flag is deprecated and will be removed in the next version. If you have used it to control if an upload buttons is rendered in the asset library, use the 'canAdd' options on an asset library entry. See documentation here: https://img.ly/docs/cesdk/ui/guides/customize-asset-library/`),Pt.get(d(this,_t)).set(e,{canManageAssets:t.canManageAssets})},kt=new WeakSet,Tt=function(e){Pt.get(d(this,_t))?.delete(e)};var Lt=class extends TypeError{constructor(e,t){let r;const{message:n,...o}=e,{path:i}=e;super(0===i.length?n:"At path: "+i.join(".")+" -- "+n),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var n;return null!=(n=r)?n:r=[e,...t()]}}};function Dt(e){return"object"==typeof e&&null!=e}function Bt(e){return"string"==typeof e?JSON.stringify(e):""+e}function Rt(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=r,{refinement:s,message:u="Expected a value of type `"+a+"`"+(s?" with refinement `"+s+"`":"")+", but received: `"+Bt(n)+"`"}=e;return{value:n,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:u}}function*Mt(e,t,r,n){var o;Dt(o=e)&&"function"==typeof o[Symbol.iterator]||(e=[e]);for(const o of e){const e=Rt(o,t,r,n);e&&(yield e)}}function*It(e,t,r={}){const{path:n=[],branch:o=[e],coerce:i=!1,mask:a=!1}=r,s={path:n,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&Dt(t.schema)&&Dt(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let u=!0;for(const r of t.validator(e,s))u=!1,yield[r,void 0];for(let[r,c,l]of t.entries(e,s)){const t=It(c,l,{path:void 0===r?n:[...n,r],branch:void 0===r?o:[...o,c],coerce:i,mask:a});for(const n of t)n[0]?(u=!1,yield[n[0],void 0]):i&&(c=n[1],void 0===r?e=c:e instanceof Map?e.set(r,c):e instanceof Set?e.add(c):Dt(e)&&(e[r]=c))}if(u)for(const r of t.refiner(e,s))u=!1,yield[r,void 0];u&&(yield[void 0,e])}var Ot=class{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:r,validator:n,refiner:o,coercer:i=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=r,this.entries=a,this.coercer=i,this.validator=n?(e,t)=>Mt(n(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>Mt(o(e,t),t,this,e):()=>[]}assert(e){return function(e,t){const r=jt(e,t);if(r[0])throw r[0]}(e,this)}create(e){return function(e,t){const r=jt(e,t,{coerce:!0});if(r[0])throw r[0];return r[1]}(e,this)}is(e){return function(e,t){const r=jt(e,t);return!r[0]}(e,this)}mask(e){return function(e,t){const r=jt(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}(e,this)}validate(e,t={}){return jt(e,this,t)}};function jt(e,t,r={}){const n=It(e,t,r),o=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(o[0]){return[new Lt(o[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function Ut(e,t){return new Ot({type:e,schema:null,validator:t})}function $t(e){return new Ot({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+Bt(e)})}function Nt(){return Ut("boolean",(e=>"boolean"==typeof e))}function Ht(){return Ut("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||"Expected an integer, but received: "+Bt(e)))}function Vt(){return Ut("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+Bt(e)))}function Wt(e){const t=e?Object.keys(e):[],r=Ut("never",(()=>!1));return new Ot({type:"object",schema:e||null,*entries(n){if(e&&Dt(n)){const o=new Set(Object.keys(n));for(const r of t)o.delete(r),yield[r,n[r],e[r]];for(const e of o)yield[e,n[e],r]}},validator:e=>Dt(e)||"Expected an object, but received: "+Bt(e),coercer:e=>Dt(e)?{...e}:e})}function zt(){return Ut("string",(e=>"string"==typeof e||"Expected a string, but received: "+Bt(e)))}function Gt(e,t,r={}){const{exclusive:n}=r;return Zt(e,"max",(r=>n?r<t:r<=t||"Expected a "+e.type+" less than "+(n?"":"or equal to ")+t+" but received `"+r+"`"))}function Yt(e,t,r={}){const{exclusive:n}=r;return Zt(e,"min",(r=>n?r>t:r>=t||"Expected a "+e.type+" greater than "+(n?"":"or equal to ")+t+" but received `"+r+"`"))}function Xt(e){return Zt(e,"nonempty",(t=>{const r=function(e){return e instanceof Map||e instanceof Set?e.size:e.length}(t);return r>0||"Expected a nonempty "+e.type+" but received an empty one"}))}function Zt(e,t,r){return new Ot({...e,*refiner(n,o){yield*e.refiner(n,o);const i=Mt(r(n,o),o,e,n);for(const e of i)yield{...e,refinement:t}}})}function Kt(e,t,r){const[n]=jt(t,r);if(n)throw n.message=`Error in argument '${e}': ${n.message}`,n}function Qt(){const e=/image\/(png|jpeg|webp|x-tga)|video\/(mp4|quicktime)|application\/octet-stream|application\/pdf/;return Ut("MimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected one of "image/png", "image/jpeg", "image/webp", "image/x-tga", "video/mp4", "video/quicktime", "application/pdf" or "application/octet-stream", but got "${t}"`}))}function Jt(){const e=["Free","VerticalStack","HorizontalStack","DepthStack"];return Ut("SceneLayout",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}var er=(e=>(e.Png="image/png",e.Jpeg="image/jpeg",e.WebP="image/webp",e.Tga="image/x-tga",e.Mp4="video/mp4",e.QuickTime="video/quicktime",e.Binary="application/octet-stream",e.Pdf="application/pdf",e.Zip="application/zip",e))(er||{}),tr=er,rr="undefined"!=typeof Blob?Blob:(()=>{try{return ot().Blob}catch(e){return function(){throw new Error("Could not find Blob constructor and failed to require('buffer').Blob")}}})(),BlockAPI=class{#e;constructor(e){this.#e=e}async export(e,t=tr.Png,r={}){Kt("handle",e,Vt()),Kt("mimeType",t,Qt()),Kt("options",r,Wt());const n=null!=r.targetWidth&&null!=r.targetHeight,o=r.jpegQuality??.9,i=r.webpQuality??1,a=r.pngCompressionLevel??5;return Kt("jpegQuality",o,Yt(Gt(Vt(),1),0,{exclusive:!0})),Kt("webpQuality",i,Yt(Gt(Vt(),1),0,{exclusive:!0})),Kt("pngCompressionLevel",a,Yt(Gt(Ht(),9),0)),null==r.targetWidth&&null==r.targetHeight||(Kt("targetWidth",r.targetWidth,Vt()),Kt("targetHeight",r.targetHeight,Vt())),new Promise(((s,u)=>{this.#e.exportToBuffer(e,t,(e=>{"error"in e?u(e.error):s(new rr([e],{type:t}))}),{pngCompressionLevel:a,jpegQuality:o,webpQuality:i,useTargetSize:n,targetWidth:r.targetWidth??0,targetHeight:r.targetHeight??0,exportPdfWithHighCompatibility:r.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:r.exportPdfWithUnderlayer??!1,underlayerSpotColorName:r.underlayerSpotColorName??"",underlayerOffset:r.underlayerOffset??0})}))}async exportWithColorMask(e,t=tr.Png,r,n,o,i={}){Kt("handle",e,Vt()),Kt("mimeType",t,Qt()),Kt("options",i,Wt());const a=null!=i.targetWidth&&null!=i.targetHeight,s=i.jpegQuality??.9,u=i.webpQuality??1,c=i.pngCompressionLevel??5;return Kt("jpegQuality",s,Yt(Gt(Vt(),1),0,{exclusive:!0})),Kt("webpQuality",u,Yt(Gt(Vt(),1),0,{exclusive:!0})),Kt("pngCompressionLevel",c,Yt(Gt(Ht(),9),0)),null==i.targetWidth&&null==i.targetHeight||(Kt("targetWidth",i.targetWidth,Vt()),Kt("targetHeight",i.targetHeight,Vt())),new Promise(((l,d)=>{this.#e.exportWithColorMaskToBuffer(e,t,r,n,o,((e,r)=>{if("error"in e)d(e.error);else if("error"in r)d(r.error);else{const n=new rr([e],{type:t}),o=new rr([r],{type:t});l([n,o])}}),{pngCompressionLevel:c,jpegQuality:s,webpQuality:u,useTargetSize:a,targetWidth:i.targetWidth??0,targetHeight:i.targetHeight??0,exportPdfWithHighCompatibility:i.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:i.exportPdfWithUnderlayer??!1,underlayerSpotColorName:i.underlayerSpotColorName??"",underlayerOffset:i.underlayerOffset??0})}))}async exportVideo(e,t=tr.Mp4,r,n){throw new Error("Method not implemented. An implementation is available on the BlockAPI at engine.block or cesdk.engine.block")}async loadFromString(e){return Kt("content",e,zt()),wt((t=>this.#e.loadBlocksFromString(e,t))).then((e=>At(e)))}async saveToString(e){return Kt("blocks",e,$t(Vt())),wt((t=>this.#e.saveBlocksToString(e,t)))}create(e){return Kt("type",e,zt()),vt(this.#e.create(e))}createFill(e){return Kt("type",e,zt()),vt(this.#e.createFill(e))}getType(e){return Kt("id",e,Ht()),vt(this.#e.getType(e))}getKind(e){return Kt("id",e,Ht()),vt(this.#e.getKind(e))}setKind(e,t){Kt("id",e,Ht()),vt(this.#e.setKind(e,t))}select(e){return Kt("id",e,Ht()),vt(this.#e.select(e))}setSelected(e,t){return Kt("id",e,Ht()),Kt("selected",t,Nt()),vt(this.#e.setSelected(e,t))}isSelected(e){return Kt("id",e,Ht()),vt(this.#e.isSelected(e))}findAllSelected(){return At(this.#e.findAllSelected())}onSelectionChanged=e=>{const t=this.#e.subscribeToSelectionChange(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};onClicked=e=>{const t=this.#e.subscribeToBlockClicked(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};isGroupable(e){return Kt("ids",e,$t(Vt())),vt(this.#e.isGroupable(e))}group(e){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.group(e))}ungroup(e){return Kt("id",e,Vt()),vt(this.#e.ungroup(e))}enterGroup(e){return Kt("id",e,Vt()),vt(this.#e.enterGroup(e))}exitGroup(e){return Kt("id",e,Vt()),vt(this.#e.exitGroup(e))}isCombinable(e){return Kt("ids",e,$t(Vt())),vt(this.#e.isCombinable(e))}combine(e,t){return Kt("ids",e,$t(Vt())),Kt("op",t,zt()),vt(this.#e.combine(e,t))}setName(e,t){return Kt("id",e,Ht()),Kt("name",t,zt()),vt(this.#e.setName(e,t))}getName(e){return Kt("id",e,Ht()),vt(this.#e.getName(e))}getUUID(e){return Kt("id",e,Ht()),vt(this.#e.getUUID(e))}findByName(e){Kt("name",e,zt());const t=this.#e.findByName(e);return At(t)}findByType(e){Kt("type",e,zt());const t=vt(this.#e.findByType(e));return At(t)}findByKind(e){Kt("kind",e,zt());const t=vt(this.#e.findByKind(e));return At(t)}findAll(){return At(this.#e.findAll())}findAllPlaceholders(){return At(this.#e.findAllPlaceholders())}createShape(e){return Kt("type",e,zt()),vt(this.#e.createShape(e))}hasShape(e){return Kt("id",e,Ht()),vt(this.#e.hasShape(e))}getShape(e){return Kt("id",e,Ht()),vt(this.#e.getShape(e))}setShape(e,t){return Kt("id",e,Ht()),Kt("shape",t,Ht()),vt(this.#e.setShape(e,t))}isVisible(e){return Kt("id",e,Ht()),vt(this.#e.isVisible(e))}setVisible(e,t){return Kt("id",e,Ht()),Kt("visible",t,Nt()),vt(this.#e.setVisible(e,t))}isClipped(e){return Kt("id",e,Ht()),vt(this.#e.isClipped(e))}setClipped(e,t){return Kt("id",e,Ht()),Kt("clipped",t,Nt()),vt(this.#e.setClipped(e,t))}isTransformLocked(e){return Kt("id",e,Ht()),vt(this.#e.isTransformLocked(e))}setTransformLocked(e,t){return Kt("id",e,Ht()),Kt("locked",t,Nt()),vt(this.#e.setTransformLocked(e,t))}getPositionX(e){return Kt("id",e,Ht()),vt(this.#e.getPositionX(e))}getPositionXMode(e){return Kt("id",e,Ht()),vt(this.#e.getPositionXMode(e))}getPositionY(e){return Kt("id",e,Ht()),vt(this.#e.getPositionY(e))}getPositionYMode(e){return Kt("id",e,Ht()),vt(this.#e.getPositionYMode(e))}setPositionX(e,t){return Kt("id",e,Ht()),Kt("value",t,Vt()),vt(this.#e.setPositionX(e,t))}setPositionXMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setPositionXMode(e,t))}setPositionY(e,t){return Kt("id",e,Ht()),Kt("value",t,Vt()),vt(this.#e.setPositionY(e,t))}setPositionYMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setPositionYMode(e,t))}setAlwaysOnTop(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setAlwaysOnTop(e,t))}setAlwaysOnBottom(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setAlwaysOnBottom(e,t))}isAlwaysOnTop(e){return Kt("id",e,Ht()),vt(this.#e.isAlwaysOnTop(e))}isAlwaysOnBottom(e){return Kt("id",e,Ht()),vt(this.#e.isAlwaysOnBottom(e))}bringToFront(e){return Kt("id",e,Vt()),vt(this.#e.bringToFront(e))}sendToBack(e){return Kt("id",e,Vt()),vt(this.#e.sendToBack(e))}bringForward(e){return Kt("id",e,Vt()),vt(this.#e.bringForward(e))}sendBackward(e){return Kt("id",e,Vt()),vt(this.#e.sendBackward(e))}getRotation(e){return Kt("id",e,Ht()),vt(this.#e.getRotation(e))}setRotation(e,t){return Kt("id",e,Ht()),Kt("radians",t,Vt()),vt(this.#e.setRotation(e,t))}getFlipHorizontal(e){return Kt("id",e,Ht()),vt(this.#e.getFlip(e)).horizontal}getFlipVertical(e){return Kt("id",e,Ht()),vt(this.#e.getFlip(e)).vertical}setFlipHorizontal(e,t){return Kt("id",e,Ht()),Kt("flip",t,Nt()),vt(this.#e.setFlipHorizontal(e,t))}setFlipVertical(e,t){return Kt("id",e,Ht()),Kt("flip",t,Nt()),vt(this.#e.setFlipVertical(e,t))}hasContentFillMode(e){return Kt("id",e,Ht()),vt(this.#e.hasContentFillMode(e))}getWidth(e){return Kt("id",e,Ht()),vt(this.#e.getWidth(e))}getWidthMode(e){return Kt("id",e,Ht()),vt(this.#e.getWidthMode(e))}getHeight(e){return Kt("id",e,Ht()),vt(this.#e.getHeight(e))}getHeightMode(e){return Kt("id",e,Ht()),vt(this.#e.getHeightMode(e))}setWidth(e,t){return Kt("id",e,Ht()),Kt("value",t,Vt()),vt(this.#e.setWidth(e,t))}setWidthMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setWidthMode(e,t))}setHeight(e,t){return Kt("id",e,Ht()),Kt("value",t,Vt()),vt(this.#e.setHeight(e,t))}setHeightMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setHeightMode(e,t))}getFrameX(e){return Kt("id",e,Ht()),vt(this.#e.getLastFrameX(e))}getFrameY(e){return Kt("id",e,Ht()),vt(this.#e.getLastFrameY(e))}getFrameWidth(e){return Kt("id",e,Ht()),vt(this.#e.getLastFrameWidth(e))}getFrameHeight(e){return Kt("id",e,Ht()),vt(this.#e.getLastFrameHeight(e))}setContentFillMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setContentFillMode(e,t))}getContentFillMode(e){return Kt("id",e,Ht()),vt(this.#e.getContentFillMode(e))}duplicate(e){return Kt("id",e,Ht()),vt(this.#e.duplicate(e))}destroy(e){return Kt("id",e,Ht()),vt(this.#e.destroy(e))}isValid(e){return Kt("id",e,Ht()),this.#e.isValid(e)}getParent(e){return Kt("id",e,Ht()),vt(this.#e.hasParent(e))?vt(this.#e.getParent(e)):null}getChildren(e){Kt("id",e,Ht());const t=vt(this.#e.getChildren(e));return At(t)}insertChild(e,t,r){return Kt("parent",e,Vt()),Kt("child",t,Vt()),Kt("index",r,Yt(Vt(),0)),vt(this.#e.insertChild(e,t,r))}appendChild(e,t){return Kt("parent",e,Vt()),Kt("child",t,Vt()),vt(this.#e.appendChild(e,t))}referencesAnyVariables(e){return Kt("id",e,Ht()),vt(this.#e.referencesAnyVariables(e))}getGlobalBoundingBoxX(e){return Kt("id",e,Ht()),vt(this.#e.getGlobalBoundingBoxX(e))}getGlobalBoundingBoxY(e){return Kt("id",e,Ht()),vt(this.#e.getGlobalBoundingBoxY(e))}getGlobalBoundingBoxWidth(e){return Kt("id",e,Ht()),vt(this.#e.getGlobalBoundingBoxWidth(e))}getGlobalBoundingBoxHeight(e){return Kt("id",e,Ht()),vt(this.#e.getGlobalBoundingBoxHeight(e))}getScreenSpaceBoundingBoxXYWH(e){return Kt("ids",e,$t(Vt())),vt(this.#e.getScreenSpaceBoundingBoxXYWH(e))}alignHorizontally(e,t){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.alignHorizontally(e,t))}alignVertically(e,t){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.alignVertically(e,t))}isAlignable(e){return Kt("ids",e,$t(Vt())),vt(this.#e.isAlignable(e))}distributeHorizontally(e){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.distributeHorizontally(e))}distributeVertically(e){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.distributeVertically(e))}isDistributable(e){return Kt("ids",e,$t(Vt())),vt(this.#e.isDistributable(e))}fillParent(e){return Kt("id",e,Ht()),vt(this.#e.fillParent(e))}resizeContentAware(e,t,r){return Kt("ids",e,$t(Vt())),Kt("width",t,Vt()),Kt("height",r,Vt()),vt(this.#e.resizeContentAware(e,t,r))}scale(e,t,r=0,n=0){return Kt("id",e,Ht()),vt(this.#e.scale(e,t,r,n))}findAllProperties(e){return Kt("id",e,Ht()),At(vt(this.#e.findAllProperties(e)))}isPropertyReadable(e){return Kt("property",e,zt()),this.#e.isPropertyReadable(e)}isPropertyWritable(e){return Kt("property",e,zt()),this.#e.isPropertyWritable(e)}getPropertyType(e){Kt("property",e,zt());return vt(this.#e.getPropertyType(e))}getEnumValues(e){return Kt("enumProperty",e,zt()),At(vt(this.#e.getEnumValues(e)))}setBool(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,Nt()),vt(this.#e.setBool(e,t,r))}getBool(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getBool(e,t))}setInt(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,Ht()),vt(this.#e.setInt(e,t,r))}getInt(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getInt(e,t))}setFloat(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,Vt()),vt(this.#e.setFloat(e,t,r))}getFloat(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getFloat(e,t))}setDouble(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,Vt()),vt(this.#e.setDouble(e,t,r))}getDouble(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getDouble(e,t))}setString(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,zt()),vt(this.#e.setString(e,t,r))}getString(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getString(e,t))}setColor(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.setColor(e,t,gt.fromColor(r)))}getColor(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),gt.toColor(vt(this.#e.getColor(e,t)))}setColorRGBA(e,t,r,n,o,i=1){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("r",r,Vt()),Kt("g",n,Vt()),Kt("b",o,Vt()),Kt("a",i,Vt()),vt(this.#e.setColorRGBA(e,t,r,n,o,i))}getColorRGBA(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getColorRGBA(e,t))}setColorSpot(e,t,r,n=1){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("name",r,zt()),Kt("tint",n,Vt()),vt(this.#e.setColorSpot(e,t,r,n))}getColorSpotName(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getColorSpotName(e,t))}getColorSpotTint(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getColorSpotTint(e,t))}setGradientColorStops(e,t,r){Kt("id",e,Ht()),Kt("property",t,zt());const n=r.map((e=>({color:gt.fromColor(e.color),stop:e.stop})));return vt(this.#e.setGradientColorStops(e,t,n))}getGradientColorStops(e,t){Kt("id",e,Ht()),Kt("property",t,zt());const r=vt(this.#e.getGradientColorStops(e,t));return At(r).map((e=>({color:gt.toColor(e.color),stop:e.stop})))}getSourceSet(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),At(vt(this.#e.getSourceSet(e,t)))}setSourceSet(e,t,r){Kt("id",e,Ht()),Kt("property",t,zt()),Kt("sourceSet",r,$t(Wt({uri:zt(),width:Vt(),height:Vt()}))),vt(this.#e.setSourceSet(e,t,r))}setEnum(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,zt()),vt(this.#e.setEnum(e,t,r))}getEnum(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getEnum(e,t))}hasCrop(e){return Kt("id",e,Ht()),vt(this.#e.hasCrop(e))}setCropScaleX(e,t){return Kt("id",e,Ht()),Kt("scaleX",t,Vt()),vt(this.#e.setCropScaleX(e,t))}setCropScaleY(e,t){return Kt("id",e,Ht()),Kt("scaleY",t,Vt()),vt(this.#e.setCropScaleY(e,t))}setCropRotation(e,t){return Kt("id",e,Ht()),Kt("rotation",t,Vt()),vt(this.#e.setCropRotation(e,t))}setCropScaleRatio(e,t){return Kt("id",e,Ht()),Kt("scaleRatio",t,Vt()),vt(this.#e.setCropScaleRatio(e,t))}setCropTranslationX(e,t){return Kt("id",e,Ht()),Kt("translationX",t,Vt()),vt(this.#e.setCropTranslationX(e,t))}setCropTranslationY(e,t){return Kt("id",e,Ht()),Kt("translationY",t,Vt()),vt(this.#e.setCropTranslationY(e,t))}resetCrop(e){return Kt("id",e,Ht()),vt(this.#e.resetCrop(e))}getCropScaleX(e){return Kt("id",e,Ht()),vt(this.#e.getCropScaleX(e))}getCropScaleY(e){return Kt("id",e,Ht()),vt(this.#e.getCropScaleY(e))}getCropRotation(e){return Kt("id",e,Ht()),vt(this.#e.getCropRotation(e))}getCropScaleRatio(e){return Kt("id",e,Ht()),vt(this.#e.getCropScaleRatio(e))}getCropTranslationX(e){return Kt("id",e,Ht()),vt(this.#e.getCropTranslationX(e))}getCropTranslationY(e){return Kt("id",e,Ht()),vt(this.#e.getCropTranslationY(e))}adjustCropToFillFrame(e,t){return Kt("id",e,Ht()),Kt("minScaleRatio",t,Vt()),vt(this.#e.adjustCropToFillFrame(e,t))}flipCropHorizontal(e){return Kt("id",e,Ht()),vt(this.#e.flipCropHorizontal(e))}flipCropVertical(e){return Kt("id",e,Ht()),vt(this.#e.flipCropVertical(e))}hasOpacity(e){return Kt("id",e,Ht()),vt(this.#e.hasOpacity(e))}setOpacity(e,t){return Kt("id",e,Ht()),Kt("opacity",t,Vt()),vt(this.#e.setOpacity(e,t))}getOpacity(e){return Kt("id",e,Ht()),vt(this.#e.getOpacity(e))}hasBlendMode(e){return Kt("id",e,Ht()),vt(this.#e.hasBlendMode(e))}setBlendMode(e,t){return Kt("id",e,Ht()),Kt("blendMode",t,zt()),vt(this.#e.setBlendMode(e,t))}getBlendMode(e){return Kt("id",e,Ht()),vt(this.#e.getBlendMode(e))}hasFillColor(e){return Kt("id",e,Ht()),vt(this.#e.hasFillColor(e))}isIncludedInExport(e){return Kt("id",e,Ht()),vt(this.#e.isIncludedInExport(e))}setIncludedInExport(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setIncludedInExport(e,t))}setFillColorRGBA(e,t,r,n,o=1){return Kt("id",e,Ht()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setFillColorRGBA(e,t,r,n,o))}getFillColorRGBA(e){return Kt("id",e,Ht()),vt(this.#e.getFillColorRGBA(e))}setFillColorEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setFillColorEnabled(e,t))}isFillColorEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isFillColorEnabled(e))}createEffect(e){return Kt("type",e,zt()),vt(this.#e.createEffect(e))}hasEffects(e){return Kt("id",e,Ht()),vt(this.#e.hasEffects(e))}getEffects(e){Kt("id",e,Ht());const t=vt(this.#e.getEffects(e));return At(t)}insertEffect(e,t,r){Kt("id",e,Ht()),Kt("effectId",t,Ht()),Kt("index",r,Yt(Ht(),0)),vt(this.#e.insertEffect(e,t,r))}appendEffect(e,t){Kt("id",e,Ht()),Kt("effectId",t,Ht()),vt(this.#e.appendEffect(e,t))}removeEffect(e,t){Kt("id",e,Ht()),Kt("index",t,Yt(Ht(),0)),vt(this.#e.removeEffect(e,t))}hasEffectEnabled(e){return Kt("effectId",e,Ht()),vt(this.#e.hasEffectEnabled(e))}setEffectEnabled(e,t){Kt("effectId",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setEffectEnabled(e,t))}isEffectEnabled(e){return Kt("effectId",e,Ht()),vt(this.#e.isEffectEnabled(e))}createBlur(e){return Kt("type",e,zt()),vt(this.#e.createBlur(e))}hasBlur(e){return Kt("id",e,Ht()),vt(this.#e.hasBlur(e))}setBlur(e,t){Kt("id",e,Ht()),Kt("blurId",t,Ht()),vt(this.#e.setBlur(e,t))}getBlur(e){return Kt("id",e,Ht()),vt(this.#e.getBlur(e))}setBlurEnabled(e,t){Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setBlurEnabled(e,t))}isBlurEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isBlurEnabled(e))}hasBackgroundColor(e){return Kt("id",e,Ht()),vt(this.#e.hasBackgroundColor(e))}setBackgroundColorRGBA(e,t,r,n,o=1){return Kt("id",e,Ht()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setBackgroundColorRGBA(e,t,r,n,o))}getBackgroundColorRGBA(e){return Kt("id",e,Ht()),vt(this.#e.getBackgroundColorRGBA(e))}setBackgroundColorEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setBackgroundColorEnabled(e,t))}isBackgroundColorEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isBackgroundColorEnabled(e))}hasStroke(e){return Kt("id",e,Ht()),vt(this.#e.hasStroke(e))}setStrokeEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setStrokeEnabled(e,t))}isStrokeEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isStrokeEnabled(e))}setStrokeColorRGBA(e,t,r,n,o=1){return Kt("id",e,Ht()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setStrokeColorRGBA(e,t,r,n,o))}setStrokeColor(e,t){return Kt("id",e,Ht()),vt(this.#e.setStrokeColor(e,gt.fromColor(t)))}getStrokeColorRGBA(e){return Kt("id",e,Ht()),vt(this.#e.getStrokeColorRGBA(e))}getStrokeColor(e){return Kt("id",e,Ht()),gt.toColor(vt(this.#e.getStrokeColor(e)))}setStrokeWidth(e,t){return Kt("id",e,Ht()),Kt("width",t,Vt()),vt(this.#e.setStrokeWidth(e,t))}getStrokeWidth(e){return Kt("id",e,Ht()),vt(this.#e.getStrokeWidth(e))}setStrokeStyle(e,t){return Kt("id",e,Ht()),vt(this.#e.setStrokeStyle(e,t))}getStrokeStyle(e){Kt("id",e,Ht());return vt(this.#e.getStrokeStyle(e))}setStrokePosition(e,t){return Kt("id",e,Ht()),vt(this.#e.setStrokePosition(e,t))}getStrokePosition(e){Kt("id",e,Ht());return vt(this.#e.getStrokePosition(e))}setStrokeCornerGeometry(e,t){return Kt("id",e,Ht()),vt(this.#e.setStrokeCornerGeometry(e,t))}getStrokeCornerGeometry(e){Kt("id",e,Ht());return vt(this.#e.getStrokeCornerGeometry(e))}hasDropShadow(e){return Kt("id",e,Ht()),vt(this.#e.hasDropShadow(e))}setDropShadowEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setDropShadowEnabled(e,t))}isDropShadowEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isDropShadowEnabled(e))}setDropShadowColorRGBA(e,t,r,n,o=1){return Kt("id",e,Ht()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setDropShadowColorRGBA(e,t,r,n,o))}setDropShadowColor(e,t){return Kt("id",e,Ht()),vt(this.#e.setDropShadowColor(e,gt.fromColor(t)))}getDropShadowColorRGBA(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowColorRGBA(e))}getDropShadowColor(e){return Kt("id",e,Ht()),gt.toColor(vt(this.#e.getDropShadowColor(e)))}setDropShadowOffsetX(e,t){return Kt("id",e,Ht()),Kt("offsetX",t,Vt()),vt(this.#e.setDropShadowOffsetX(e,t))}getDropShadowOffsetX(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowOffsetX(e))}setDropShadowOffsetY(e,t){return Kt("id",e,Ht()),Kt("offsetY",t,Vt()),vt(this.#e.setDropShadowOffsetY(e,t))}getDropShadowOffsetY(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowOffsetY(e))}setDropShadowBlurRadiusX(e,t){return Kt("id",e,Ht()),Kt("blurRadiusX",t,Vt()),vt(this.#e.setDropShadowBlurRadiusX(e,t))}getDropShadowBlurRadiusX(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowBlurRadiusX(e))}setDropShadowBlurRadiusY(e,t){return Kt("id",e,Ht()),Kt("blurRadiusY",t,Vt()),vt(this.#e.setDropShadowBlurRadiusY(e,t))}getDropShadowBlurRadiusY(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowBlurRadiusY(e))}setDropShadowClip(e,t){return Kt("id",e,Ht()),vt(this.#e.setDropShadowClip(e,t))}getDropShadowClip(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowClip(e))}createCutoutFromBlocks(e,t=2,r=4){return Kt("ids",e,$t(Ht())),Kt("vectorizeDistanceThreshold",t,Vt()),Kt("maxSmoothingDistance",r,Vt()),vt(this.#e.createCutoutFromBlocks(e,t,r))}createCutoutFromPath(e){return Kt("path",e,zt()),vt(this.#e.createCutoutFromPath(e))}createCutoutFromOperation(e,t){return Kt("ids",e,$t(Ht())),Kt("op",t,function(){const e=["Difference","Intersection","Union","XOR"];return Ut("CutoutOperation",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}()),vt(this.#e.createCutoutFromOperation(e,t))}replaceText(e,t,r=-1,n=-1){Kt("id",e,Ht()),Kt("text",t,zt()),Kt("from",r,Ht()),Kt("to",n,Ht()),vt(this.#e.replaceText(e,t,r,n))}removeText(e,t=-1,r=-1){Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht()),vt(this.#e.removeText(e,t,r))}setTextColor(e,t,r=-1,n=-1){Kt("id",e,Ht()),Kt("from",r,Ht()),Kt("to",n,Ht()),vt(this.#e.setTextColor(e,gt.fromColor(t),r,n))}getTextColors(e,t=-1,r=-1){Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht());const n=this.#e.getTextColors(e,t,r);return At(vt(n)).map((e=>gt.toColor(e)))}getTextFontWeights(e,t=-1,r=-1){return Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht()),At(vt(this.#e.getTextFontWeights(e,t,r)))}getTextFontStyles(e,t=-1,r=-1){return Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht()),At(vt(this.#e.getTextFontStyles(e,t,r)))}getTextCases(e,t=-1,r=-1){return Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht()),At(vt(this.#e.getTextCases(e,t,r)))}setTextCase(e,t,r=-1,n=-1){Kt("id",e,Ht()),Kt("textCase",t,zt()),Kt("from",r,Ht()),Kt("to",n,Ht()),vt(this.#e.setTextCase(e,t,r,n))}getTextCursorRange(){return vt(this.#e.getTextCursorRange())}hasFill(e){return Kt("id",e,Ht()),vt(this.#e.hasFill(e))}isFillEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isFillEnabled(e))}setFillEnabled(e,t){return Kt("id",e,Ht()),vt(this.#e.setFillEnabled(e,t))}getFill(e){return Kt("id",e,Ht()),vt(this.#e.getFill(e))}setFill(e,t){return Kt("id",e,Ht()),Kt("fill",t,Ht()),vt(this.#e.setFill(e,t))}setFillSolidColor(e,t,r,n,o=1){Kt("id",e,Ht()),vt(this.#e.setFillSolidColor(e,t,r,n,o))}getFillSolidColor(e){return Kt("id",e,Ht()),vt(this.#e.getFillSolidColor(e))}setPlaceholderEnabled(e,t){Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setPlaceholderEnabled(e,t))}isPlaceholderEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isPlaceholderEnabled(e))}hasPlaceholderBehavior(e){return Kt("id",e,Ht()),vt(this.#e.hasPlaceholderBehavior(e))}setPlaceholderBehaviorEnabled(e,t){Kt("id",e,Ht()),vt(this.#e.setPlaceholderBehaviorEnabled(e,t))}isPlaceholderBehaviorEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isPlaceholderBehaviorEnabled(e))}hasPlaceholderControls(e){return Kt("id",e,Ht()),vt(this.#e.hasPlaceholderControls(e))}setPlaceholderControlsOverlayEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setPlaceholderControlsOverlayEnabled(e,t))}isPlaceholderControlsOverlayEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isPlaceholderControlsOverlayEnabled(e))}setPlaceholderControlsButtonEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setPlaceholderControlsButtonEnabled(e,t))}isPlaceholderControlsButtonEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isPlaceholderControlsButtonEnabled(e))}setMetadata(e,t,r){Kt("id",e,Ht()),Kt("key",t,zt()),Kt("value",r,zt()),vt(this.#e.setMetadata(e,t,r))}getMetadata(e,t){return Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.getMetadata(e,t))}hasMetadata(e,t){return Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.hasMetadata(e,t))}findAllMetadata(e){return Kt("id",e,Ht()),At(vt(this.#e.findAllMetadata(e)))}removeMetadata(e,t){Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.removeMetadata(e,t))}setScopeEnabled(e,t,r){Kt("id",e,Ht()),Kt("key",t,zt()),Kt("enabled",r,Nt()),vt(this.#e.setScopeEnabled(e,t,r))}isScopeEnabled(e,t){return Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.isScopeEnabled(e,t))}isAllowedByScope(e,t){return Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.isAllowedByScope(e,t))}hasDuration(e){return Kt("id",e,Ht()),vt(this.#e.hasDuration(e))}setDuration(e,t){return Kt("id",e,Ht()),Kt("duration",t,Vt()),vt(this.#e.setDuration(e,t))}getDuration(e){return Kt("id",e,Ht()),vt(this.#e.getDuration(e))}hasTimeOffset(e){return Kt("id",e,Ht()),vt(this.#e.hasTimeOffset(e))}setTimeOffset(e,t){return Kt("id",e,Ht()),Kt("offset",t,Vt()),vt(this.#e.setTimeOffset(e,t))}getTimeOffset(e){return Kt("id",e,Ht()),vt(this.#e.getTimeOffset(e))}hasTrim(e){return Kt("id",e,Ht()),vt(this.#e.hasTrim(e))}setTrimOffset(e,t){return Kt("id",e,Ht()),Kt("offset",t,Vt()),vt(this.#e.setTrimOffset(e,t))}getTrimOffset(e){return Kt("id",e,Ht()),vt(this.#e.getTrimOffset(e))}setTrimLength(e,t){return Kt("id",e,Ht()),Kt("length",t,Vt()),vt(this.#e.setTrimLength(e,t))}getTrimLength(e){return Kt("id",e,Ht()),vt(this.#e.getTrimLength(e))}getTotalSceneDuration(e){return Kt("scene",e,Ht()),vt(this.#e.getTotalSceneDuration(e))}setPlaying(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setPlaying(e,t))}isPlaying(e){return Kt("id",e,Ht()),vt(this.#e.isPlaying(e))}hasPlaybackTime(e){return Kt("id",e,Ht()),vt(this.#e.hasPlaybackTime(e))}setPlaybackTime(e,t){return Kt("id",e,Ht()),Kt("time",t,Vt()),vt(this.#e.setPlaybackTime(e,t))}getPlaybackTime(e){return Kt("id",e,Ht()),vt(this.#e.getPlaybackTime(e))}isVisibleAtCurrentPlaybackTime(e){return Kt("id",e,Ht()),vt(this.#e.isVisibleAtCurrentPlaybackTime(e))}setSoloPlaybackEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setSoloPlaybackEnabled(e,t))}isSoloPlaybackEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isSoloPlaybackEnabled(e))}hasPlaybackControl(e){return Kt("id",e,Ht()),vt(this.#e.hasPlaybackControl(e))}setLooping(e,t){Kt("id",e,Ht()),Kt("looping",t,Nt()),vt(this.#e.setLooping(e,t))}isLooping(e){return Kt("id",e,Ht()),vt(this.#e.isLooping(e))}setMuted(e,t){Kt("id",e,Ht()),Kt("muted",t,Nt()),vt(this.#e.setMuted(e,t))}isMuted(e){return Kt("id",e,Ht()),vt(this.#e.isMuted(e))}setVolume(e,t){Kt("id",e,Ht()),Kt("volume",t,Vt()),vt(this.#e.setVolume(e,t))}getVolume(e){return Kt("id",e,Ht()),vt(this.#e.getVolume(e))}async forceLoadAVResource(e){return Kt("id",e,Ht()),wt((t=>this.#e.forceLoadAVResource(e,t)))}unstable_isAVResourceLoaded(e){return Kt("id",e,Ht()),vt(this.#e.unstable_isAVResourceLoaded(e))}getAVResourceTotalDuration(e){return Kt("id",e,Ht()),vt(this.#e.getAVResourceTotalDuration(e))}getVideoWidth(e){return Kt("id",e,Ht()),vt(this.#e.getVideoWidth(e))}getVideoHeight(e){return Kt("id",e,Ht()),vt(this.#e.getVideoHeight(e))}generateVideoThumbnailSequence(e,t,r,n,o,i){return Kt("id",e,Ht()),Kt("thumbnailHeight",t,Ht()),Kt("timeBegin",r,Vt()),Kt("timeEnd",n,Vt()),Kt("numberOfFrames",o,Ht()),this.#e.generateVideoThumbnailSequence(e,t,r,n,o,(e=>{"error"in e?i(0,new Error(e.error)):i(e.frameIndex,new ImageData(new Uint8ClampedArray(e.imageData),e.width,e.height))})),()=>{this.#e.cancelVideoThumbnailSequenceGeneration(e)}}generateAudioThumbnailSequence(e,t,r,n,o,i,a){return Kt("id",e,Ht()),Kt("samplesPerChunk",t,Ht()),Kt("timeBegin",r,Vt()),Kt("timeEnd",n,Vt()),Kt("numberOfSamples",o,Ht()),Kt("numberOfChannels",i,Ht()),this.#e.generateAudioThumbnailSequence(e,t,r,n,o,i,(e=>{"error"in e?a(0,new Error(e.error)):a(e.chunkIndex,e.sampleData)})),()=>{this.#e.cancelAudioThumbnailSequenceGeneration(e)}}async getVideoFillThumbnail(e,t){return Kt("id",e,Ht()),Kt("thumbnailHeight",t,Ht()),new Promise(((r,n)=>{this.#e.getVideoFillThumbnail(e,t,(e=>{"error"in e?n(e.error):r(new rr([e],{type:"image/jpeg"}))}))}))}async getVideoFillThumbnailAtlas(e,t,r,n){return Kt("id",e,Ht()),Kt("numberOfColumns",t,Ht()),Kt("numberOfRows",r,Ht()),Kt("thumbnailHeight",n,Ht()),new Promise(((o,i)=>{this.#e.getVideoFillThumbnailAtlas(e,t,r,n,(e=>{"error"in e?i(e.error):o(new rr([e],{type:"image/jpeg"}))}))}))}async getPageThumbnailAtlas(e,t,r,n){return Kt("id",e,Ht()),Kt("numberOfColumns",t,Ht()),Kt("numberOfRows",r,Ht()),new Promise(((o,i)=>{this.#e.getPageThumbnailAtlas(e,t,r,n,(e=>{"error"in e?i(e.error):o(new rr([e],{type:"image/jpeg"}))}))}))}setNativePixelBuffer(e,t){t instanceof HTMLVideoElement&&(t.width=t.videoWidth,t.height=t.videoHeight),vt(this.#e.setNativePixelBuffer(e,t))}};u([mt],BlockAPI.prototype,"loadFromString",1),u([mt],BlockAPI.prototype,"create",1),u([mt],BlockAPI.prototype,"createFill",1),u([ft],BlockAPI.prototype,"getType",1),u([mt],BlockAPI.prototype,"select",1),u([mt],BlockAPI.prototype,"setSelected",1),u([ft],BlockAPI.prototype,"isSelected",1),u([ft],BlockAPI.prototype,"findAllSelected",1),u([ft],BlockAPI.prototype,"isGroupable",1),u([mt],BlockAPI.prototype,"group",1),u([mt],BlockAPI.prototype,"ungroup",1),u([mt],BlockAPI.prototype,"enterGroup",1),u([mt],BlockAPI.prototype,"exitGroup",1),u([ft],BlockAPI.prototype,"isCombinable",1),u([mt],BlockAPI.prototype,"combine",1),u([mt],BlockAPI.prototype,"setName",1),u([ft],BlockAPI.prototype,"getName",1),u([ft],BlockAPI.prototype,"getUUID",1),u([ft],BlockAPI.prototype,"findByName",1),u([ft],BlockAPI.prototype,"findByType",1),u([ft],BlockAPI.prototype,"findAll",1),u([ft],BlockAPI.prototype,"findAllPlaceholders",1),u([mt],BlockAPI.prototype,"createShape",1),u([ft],BlockAPI.prototype,"hasShape",1),u([ft],BlockAPI.prototype,"getShape",1),u([mt],BlockAPI.prototype,"setShape",1),u([ft],BlockAPI.prototype,"isVisible",1),u([mt],BlockAPI.prototype,"setVisible",1),u([ft],BlockAPI.prototype,"isClipped",1),u([mt],BlockAPI.prototype,"setClipped",1),u([ft],BlockAPI.prototype,"isTransformLocked",1),u([mt],BlockAPI.prototype,"setTransformLocked",1),u([ft],BlockAPI.prototype,"getPositionX",1),u([ft],BlockAPI.prototype,"getPositionXMode",1),u([ft],BlockAPI.prototype,"getPositionY",1),u([ft],BlockAPI.prototype,"getPositionYMode",1),u([mt],BlockAPI.prototype,"setPositionX",1),u([mt],BlockAPI.prototype,"setPositionXMode",1),u([mt],BlockAPI.prototype,"setPositionY",1),u([mt],BlockAPI.prototype,"setPositionYMode",1),u([mt],BlockAPI.prototype,"setAlwaysOnTop",1),u([mt],BlockAPI.prototype,"setAlwaysOnBottom",1),u([ft],BlockAPI.prototype,"isAlwaysOnTop",1),u([ft],BlockAPI.prototype,"isAlwaysOnBottom",1),u([mt],BlockAPI.prototype,"bringToFront",1),u([mt],BlockAPI.prototype,"sendToBack",1),u([mt],BlockAPI.prototype,"bringForward",1),u([mt],BlockAPI.prototype,"sendBackward",1),u([ft],BlockAPI.prototype,"getRotation",1),u([mt],BlockAPI.prototype,"setRotation",1),u([ft],BlockAPI.prototype,"getFlipHorizontal",1),u([ft],BlockAPI.prototype,"getFlipVertical",1),u([mt],BlockAPI.prototype,"setFlipHorizontal",1),u([mt],BlockAPI.prototype,"setFlipVertical",1),u([ft],BlockAPI.prototype,"hasContentFillMode",1),u([ft],BlockAPI.prototype,"getWidth",1),u([ft],BlockAPI.prototype,"getWidthMode",1),u([ft],BlockAPI.prototype,"getHeight",1),u([ft],BlockAPI.prototype,"getHeightMode",1),u([mt],BlockAPI.prototype,"setWidth",1),u([mt],BlockAPI.prototype,"setWidthMode",1),u([mt],BlockAPI.prototype,"setHeight",1),u([mt],BlockAPI.prototype,"setHeightMode",1),u([ft],BlockAPI.prototype,"getFrameX",1),u([ft],BlockAPI.prototype,"getFrameY",1),u([ft],BlockAPI.prototype,"getFrameWidth",1),u([ft],BlockAPI.prototype,"getFrameHeight",1),u([mt],BlockAPI.prototype,"setContentFillMode",1),u([ft],BlockAPI.prototype,"getContentFillMode",1),u([mt],BlockAPI.prototype,"duplicate",1),u([mt],BlockAPI.prototype,"destroy",1),u([ft],BlockAPI.prototype,"isValid",1),u([ft],BlockAPI.prototype,"getParent",1),u([ft],BlockAPI.prototype,"getChildren",1),u([mt],BlockAPI.prototype,"insertChild",1),u([mt],BlockAPI.prototype,"appendChild",1),u([ft],BlockAPI.prototype,"referencesAnyVariables",1),u([ft],BlockAPI.prototype,"getGlobalBoundingBoxX",1),u([ft],BlockAPI.prototype,"getGlobalBoundingBoxY",1),u([ft],BlockAPI.prototype,"getGlobalBoundingBoxWidth",1),u([ft],BlockAPI.prototype,"getGlobalBoundingBoxHeight",1),u([ft],BlockAPI.prototype,"getScreenSpaceBoundingBoxXYWH",1),u([mt],BlockAPI.prototype,"alignHorizontally",1),u([mt],BlockAPI.prototype,"alignVertically",1),u([ft],BlockAPI.prototype,"isAlignable",1),u([mt],BlockAPI.prototype,"distributeHorizontally",1),u([mt],BlockAPI.prototype,"distributeVertically",1),u([mt],BlockAPI.prototype,"isDistributable",1),u([mt],BlockAPI.prototype,"fillParent",1),u([mt],BlockAPI.prototype,"resizeContentAware",1),u([mt],BlockAPI.prototype,"scale",1),u([ft],BlockAPI.prototype,"findAllProperties",1),u([ft],BlockAPI.prototype,"isPropertyReadable",1),u([ft],BlockAPI.prototype,"isPropertyWritable",1),u([ft],BlockAPI.prototype,"getPropertyType",1),u([ft],BlockAPI.prototype,"getEnumValues",1),u([mt],BlockAPI.prototype,"setBool",1),u([ft],BlockAPI.prototype,"getBool",1),u([mt],BlockAPI.prototype,"setInt",1),u([ft],BlockAPI.prototype,"getInt",1),u([mt],BlockAPI.prototype,"setFloat",1),u([ft],BlockAPI.prototype,"getFloat",1),u([mt],BlockAPI.prototype,"setDouble",1),u([ft],BlockAPI.prototype,"getDouble",1),u([mt],BlockAPI.prototype,"setString",1),u([ft],BlockAPI.prototype,"getString",1),u([mt],BlockAPI.prototype,"setColor",1),u([ft],BlockAPI.prototype,"getColor",1),u([mt],BlockAPI.prototype,"setColorRGBA",1),u([ft],BlockAPI.prototype,"getColorRGBA",1),u([mt],BlockAPI.prototype,"setColorSpot",1),u([ft],BlockAPI.prototype,"getColorSpotName",1),u([ft],BlockAPI.prototype,"getColorSpotTint",1),u([mt],BlockAPI.prototype,"setGradientColorStops",1),u([ft],BlockAPI.prototype,"getGradientColorStops",1),u([ft],BlockAPI.prototype,"getSourceSet",1),u([mt],BlockAPI.prototype,"setSourceSet",1),u([mt],BlockAPI.prototype,"setEnum",1),u([ft],BlockAPI.prototype,"getEnum",1),u([ft],BlockAPI.prototype,"hasCrop",1),u([mt],BlockAPI.prototype,"setCropScaleX",1),u([mt],BlockAPI.prototype,"setCropScaleY",1),u([mt],BlockAPI.prototype,"setCropRotation",1),u([mt],BlockAPI.prototype,"setCropScaleRatio",1),u([mt],BlockAPI.prototype,"setCropTranslationX",1),u([mt],BlockAPI.prototype,"setCropTranslationY",1),u([mt],BlockAPI.prototype,"resetCrop",1),u([ft],BlockAPI.prototype,"getCropScaleX",1),u([ft],BlockAPI.prototype,"getCropScaleY",1),u([ft],BlockAPI.prototype,"getCropRotation",1),u([ft],BlockAPI.prototype,"getCropScaleRatio",1),u([ft],BlockAPI.prototype,"getCropTranslationX",1),u([ft],BlockAPI.prototype,"getCropTranslationY",1),u([mt],BlockAPI.prototype,"adjustCropToFillFrame",1),u([mt],BlockAPI.prototype,"flipCropHorizontal",1),u([mt],BlockAPI.prototype,"flipCropVertical",1),u([ft],BlockAPI.prototype,"hasOpacity",1),u([mt],BlockAPI.prototype,"setOpacity",1),u([ft],BlockAPI.prototype,"getOpacity",1),u([ft],BlockAPI.prototype,"hasBlendMode",1),u([mt],BlockAPI.prototype,"setBlendMode",1),u([ft],BlockAPI.prototype,"getBlendMode",1),u([ft],BlockAPI.prototype,"hasFillColor",1),u([ft],BlockAPI.prototype,"isIncludedInExport",1),u([mt],BlockAPI.prototype,"setIncludedInExport",1),u([mt],BlockAPI.prototype,"setFillColorRGBA",1),u([ft],BlockAPI.prototype,"getFillColorRGBA",1),u([mt],BlockAPI.prototype,"setFillColorEnabled",1),u([ft],BlockAPI.prototype,"isFillColorEnabled",1),u([mt],BlockAPI.prototype,"createEffect",1),u([ft],BlockAPI.prototype,"hasEffects",1),u([ft],BlockAPI.prototype,"getEffects",1),u([mt],BlockAPI.prototype,"insertEffect",1),u([mt],BlockAPI.prototype,"appendEffect",1),u([mt],BlockAPI.prototype,"removeEffect",1),u([ft],BlockAPI.prototype,"hasEffectEnabled",1),u([mt],BlockAPI.prototype,"setEffectEnabled",1),u([ft],BlockAPI.prototype,"isEffectEnabled",1),u([mt],BlockAPI.prototype,"createBlur",1),u([ft],BlockAPI.prototype,"hasBlur",1),u([mt],BlockAPI.prototype,"setBlur",1),u([ft],BlockAPI.prototype,"getBlur",1),u([mt],BlockAPI.prototype,"setBlurEnabled",1),u([ft],BlockAPI.prototype,"isBlurEnabled",1),u([ft],BlockAPI.prototype,"hasBackgroundColor",1),u([mt],BlockAPI.prototype,"setBackgroundColorRGBA",1),u([ft],BlockAPI.prototype,"getBackgroundColorRGBA",1),u([mt],BlockAPI.prototype,"setBackgroundColorEnabled",1),u([ft],BlockAPI.prototype,"isBackgroundColorEnabled",1),u([ft],BlockAPI.prototype,"hasStroke",1),u([mt],BlockAPI.prototype,"setStrokeEnabled",1),u([ft],BlockAPI.prototype,"isStrokeEnabled",1),u([mt],BlockAPI.prototype,"setStrokeColorRGBA",1),u([mt],BlockAPI.prototype,"setStrokeColor",1),u([ft],BlockAPI.prototype,"getStrokeColorRGBA",1),u([ft],BlockAPI.prototype,"getStrokeColor",1),u([mt],BlockAPI.prototype,"setStrokeWidth",1),u([ft],BlockAPI.prototype,"getStrokeWidth",1),u([mt],BlockAPI.prototype,"setStrokeStyle",1),u([ft],BlockAPI.prototype,"getStrokeStyle",1),u([mt],BlockAPI.prototype,"setStrokePosition",1),u([ft],BlockAPI.prototype,"getStrokePosition",1),u([mt],BlockAPI.prototype,"setStrokeCornerGeometry",1),u([ft],BlockAPI.prototype,"getStrokeCornerGeometry",1),u([ft],BlockAPI.prototype,"hasDropShadow",1),u([mt],BlockAPI.prototype,"setDropShadowEnabled",1),u([ft],BlockAPI.prototype,"isDropShadowEnabled",1),u([mt],BlockAPI.prototype,"setDropShadowColorRGBA",1),u([mt],BlockAPI.prototype,"setDropShadowColor",1),u([ft],BlockAPI.prototype,"getDropShadowColorRGBA",1),u([ft],BlockAPI.prototype,"getDropShadowColor",1),u([mt],BlockAPI.prototype,"setDropShadowOffsetX",1),u([ft],BlockAPI.prototype,"getDropShadowOffsetX",1),u([mt],BlockAPI.prototype,"setDropShadowOffsetY",1),u([ft],BlockAPI.prototype,"getDropShadowOffsetY",1),u([mt],BlockAPI.prototype,"setDropShadowBlurRadiusX",1),u([ft],BlockAPI.prototype,"getDropShadowBlurRadiusX",1),u([mt],BlockAPI.prototype,"setDropShadowBlurRadiusY",1),u([ft],BlockAPI.prototype,"getDropShadowBlurRadiusY",1),u([mt],BlockAPI.prototype,"setDropShadowClip",1),u([ft],BlockAPI.prototype,"getDropShadowClip",1),u([mt],BlockAPI.prototype,"createCutoutFromBlocks",1),u([mt],BlockAPI.prototype,"createCutoutFromPath",1),u([mt],BlockAPI.prototype,"createCutoutFromOperation",1),u([mt],BlockAPI.prototype,"replaceText",1),u([mt],BlockAPI.prototype,"removeText",1),u([mt],BlockAPI.prototype,"setTextColor",1),u([ft],BlockAPI.prototype,"getTextColors",1),u([ft],BlockAPI.prototype,"getTextFontWeights",1),u([ft],BlockAPI.prototype,"getTextFontStyles",1),u([ft],BlockAPI.prototype,"getTextCases",1),u([mt],BlockAPI.prototype,"setTextCase",1),u([ft],BlockAPI.prototype,"getTextCursorRange",1),u([ft],BlockAPI.prototype,"hasFill",1),u([ft],BlockAPI.prototype,"isFillEnabled",1),u([mt],BlockAPI.prototype,"setFillEnabled",1),u([ft],BlockAPI.prototype,"getFill",1),u([mt],BlockAPI.prototype,"setFill",1),u([mt],BlockAPI.prototype,"setFillSolidColor",1),u([ft],BlockAPI.prototype,"getFillSolidColor",1),u([mt],BlockAPI.prototype,"setPlaceholderEnabled",1),u([ft],BlockAPI.prototype,"isPlaceholderEnabled",1),u([ft],BlockAPI.prototype,"hasPlaceholderBehavior",1),u([mt],BlockAPI.prototype,"setPlaceholderBehaviorEnabled",1),u([ft],BlockAPI.prototype,"isPlaceholderBehaviorEnabled",1),u([ft],BlockAPI.prototype,"hasPlaceholderControls",1),u([mt],BlockAPI.prototype,"setPlaceholderControlsOverlayEnabled",1),u([ft],BlockAPI.prototype,"isPlaceholderControlsOverlayEnabled",1),u([mt],BlockAPI.prototype,"setPlaceholderControlsButtonEnabled",1),u([ft],BlockAPI.prototype,"isPlaceholderControlsButtonEnabled",1),u([mt],BlockAPI.prototype,"setMetadata",1),u([ft],BlockAPI.prototype,"getMetadata",1),u([ft],BlockAPI.prototype,"hasMetadata",1),u([ft],BlockAPI.prototype,"findAllMetadata",1),u([mt],BlockAPI.prototype,"removeMetadata",1),u([mt],BlockAPI.prototype,"setScopeEnabled",1),u([ft],BlockAPI.prototype,"isScopeEnabled",1),u([ft],BlockAPI.prototype,"isAllowedByScope",1),u([ft],BlockAPI.prototype,"hasDuration",1),u([mt],BlockAPI.prototype,"setDuration",1),u([ft],BlockAPI.prototype,"getDuration",1),u([ft],BlockAPI.prototype,"hasTimeOffset",1),u([mt],BlockAPI.prototype,"setTimeOffset",1),u([ft],BlockAPI.prototype,"getTimeOffset",1),u([ft],BlockAPI.prototype,"hasTrim",1),u([mt],BlockAPI.prototype,"setTrimOffset",1),u([ft],BlockAPI.prototype,"getTrimOffset",1),u([mt],BlockAPI.prototype,"setTrimLength",1),u([ft],BlockAPI.prototype,"getTrimLength",1),u([ft],BlockAPI.prototype,"getTotalSceneDuration",1),u([mt],BlockAPI.prototype,"setPlaying",1),u([ft],BlockAPI.prototype,"isPlaying",1),u([ft],BlockAPI.prototype,"hasPlaybackTime",1),u([mt],BlockAPI.prototype,"setPlaybackTime",1),u([ft],BlockAPI.prototype,"getPlaybackTime",1),u([ft],BlockAPI.prototype,"isVisibleAtCurrentPlaybackTime",1),u([mt],BlockAPI.prototype,"setSoloPlaybackEnabled",1),u([ft],BlockAPI.prototype,"isSoloPlaybackEnabled",1),u([ft],BlockAPI.prototype,"hasPlaybackControl",1),u([mt],BlockAPI.prototype,"setLooping",1),u([ft],BlockAPI.prototype,"isLooping",1),u([mt],BlockAPI.prototype,"setMuted",1),u([ft],BlockAPI.prototype,"isMuted",1),u([mt],BlockAPI.prototype,"setVolume",1),u([ft],BlockAPI.prototype,"getVolume",1),u([mt],BlockAPI.prototype,"forceLoadAVResource",1),u([ft],BlockAPI.prototype,"unstable_isAVResourceLoaded",1),u([ft],BlockAPI.prototype,"getAVResourceTotalDuration",1),u([ft],BlockAPI.prototype,"getVideoWidth",1),u([ft],BlockAPI.prototype,"getVideoHeight",1),u([ft],BlockAPI.prototype,"getVideoFillThumbnail",1),u([ft],BlockAPI.prototype,"getVideoFillThumbnailAtlas",1),u([ft],BlockAPI.prototype,"getPageThumbnailAtlas",1);var EditorAPI=class{#e;constructor(e){this.#e=e}unlockWithLicense(e){vt(this.#e.unlockWithLicense(e))}startTracking(e,t){this.#e.startTracking(e,t,"")}setTrackingMetadata(e){this.#e.setTrackingMetadata(e)}getTrackingMetadata(){return vt(this.#e.getTrackingMetadata())}getActiveLicense(){return vt(this.#e.getActiveLicense())}onStateChanged=e=>{const t=this.#e.subscribeToEditorState(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};setEditMode(e){Kt("keypath",e,zt()),this.#e.setEditMode(e)}getEditMode(){return this.#e.getEditMode()}getCursorType(){return this.#e.getCursorType()}getCursorRotation(){return this.#e.getCursorRotation()}getTextCursorPositionInScreenSpaceX(){return this.#e.getTextCursorPositionInScreenSpaceX()}getTextCursorPositionInScreenSpaceY(){return this.#e.getTextCursorPositionInScreenSpaceY()}createHistory(){return this.#e.createHistory()}destroyHistory(e){vt(this.#e.destroyHistory(e))}setActiveHistory(e){vt(this.#e.setActiveHistory(e))}getActiveHistory(){return this.#e.getActiveHistory()}addUndoStep(){vt(this.#e.addUndoStep())}undo(){vt(this.#e.undo())}redo(){vt(this.#e.redo())}canUndo(){return vt(this.#e.canUndo())}canRedo(){return vt(this.#e.canRedo())}onHistoryUpdated=e=>{const t=this.#e.subscribeToHistory(e);return()=>{this.#e.isDeleted()||this.#e.unsubscribe(t)}};onSettingsChanged=e=>{const t=this.#e.subscribeToSettings(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};setSettingBool(e,t){return Kt("keypath",e,zt()),Kt("value",t,Nt()),vt(this.#e.setSettingBool(e,t))}getSettingBool(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingBool(e))}setSettingInt(e,t){return Kt("keypath",e,zt()),Kt("value",t,Ht()),vt(this.#e.setSettingInt(e,t))}getSettingInt(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingInt(e))}setSettingFloat(e,t){return Kt("keypath",e,zt()),Kt("value",t,Vt()),vt(this.#e.setSettingFloat(e,t))}getSettingFloat(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingFloat(e))}setSettingString(e,t){return Kt("keypath",e,zt()),Kt("value",t,zt()),vt(this.#e.setSettingString(e,t))}getSettingString(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingString(e))}setSettingColor(e,t){return Kt("keypath",e,zt()),vt(this.#e.setSettingColor(e,gt.fromColor(t)))}getSettingColor(e){return Kt("keypath",e,zt()),gt.toColor(vt(this.#e.getSettingColor(e)))}setSettingColorRGBA(e,t,r,n,o=1){return Kt("keypath",e,zt()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setSettingColorRGBA(e,t,r,n,o))}getSettingColorRGBA(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingColorRGBA(e))}setSettingEnum(e,t){return Kt("keypath",e,zt()),Kt("value",t,zt()),vt(this.#e.setSettingEnum(e,t))}getSettingEnum(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingEnum(e))}getSettingEnumOptions(e){return Kt("keypath",e,zt()),At(vt(this.#e.getSettingEnumOptions(e)))}findAllSettings(){return At(this.#e.findAllSettings())}getSettingType(e){Kt("keypath",e,zt());return vt(this.#e.getSettingType(e))}getAvailableMemory(){return vt(this.#e.getAvailableMemory())}getUsedMemory(){return vt(this.#e.getUsedMemory())}getMaxExportSize(){return vt(this.#e.getMaxExportSize())}setURIResolver(e){return vt(this.#e.setURIResolver(e))}defaultURIResolver(e){return this.#e.defaultURIResolver(e)}getAbsoluteURI(e){return vt(this.#e.getAbsoluteURI(e))}setGlobalScope(e,t){Kt("key",e,zt()),Kt("value",t,zt()),vt(this.#e.setGlobalScope(e,t))}getGlobalScope(e){return Kt("key",e,zt()),vt(this.#e.getGlobalScope(e))}findAllSpotColors(){return At(this.#e.findAllSpotColors())}getSpotColorRGBA(e){return Kt("name",e,zt()),this.#e.getSpotColorRGB(e)}getSpotColorCMYK(e){return Kt("name",e,zt()),this.#e.getSpotColorCMYK(e)}setSpotColorRGB(e,t,r,n){return Kt("name",e,zt()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),this.#e.setSpotColorRGB(e,t,r,n)}setSpotColorCMYK(e,t,r,n,o){return Kt("name",e,zt()),Kt("c",t,Vt()),Kt("m",r,Vt()),Kt("y",n,Vt()),Kt("k",o,Vt()),this.#e.setSpotColorCMYK(e,t,r,n,o)}removeSpotColor(e){return Kt("name",e,zt()),vt(this.#e.removeSpotColor(e))}setSpotColorForCutoutType(e,t){return Kt("type",e,zt()),Kt("color",t,zt()),vt(this.#e.setSpotColorForCutoutType(e,t))}getSpotColorForCutoutType(e){return Kt("type",e,zt()),vt(this.#e.getSpotColorForCutoutType(e))}convertColorToColorSpace(e,t){return Kt("colorSpace",t,zt()),gt.toColor(vt(this.#e.convertColorToColorSpace(gt.fromColor(e),t)))}};u([mt],EditorAPI.prototype,"setEditMode",1),u([ft],EditorAPI.prototype,"getEditMode",1),u([ft],EditorAPI.prototype,"getCursorType",1),u([ft],EditorAPI.prototype,"getCursorRotation",1),u([ft],EditorAPI.prototype,"getTextCursorPositionInScreenSpaceX",1),u([ft],EditorAPI.prototype,"getTextCursorPositionInScreenSpaceY",1),u([mt],EditorAPI.prototype,"createHistory",1),u([mt],EditorAPI.prototype,"destroyHistory",1),u([mt],EditorAPI.prototype,"setActiveHistory",1),u([ft],EditorAPI.prototype,"getActiveHistory",1),u([mt],EditorAPI.prototype,"addUndoStep",1),u([mt],EditorAPI.prototype,"undo",1),u([mt],EditorAPI.prototype,"redo",1),u([ft],EditorAPI.prototype,"canUndo",1),u([ft],EditorAPI.prototype,"canRedo",1),u([mt],EditorAPI.prototype,"setSettingBool",1),u([ft],EditorAPI.prototype,"getSettingBool",1),u([mt],EditorAPI.prototype,"setSettingInt",1),u([ft],EditorAPI.prototype,"getSettingInt",1),u([mt],EditorAPI.prototype,"setSettingFloat",1),u([ft],EditorAPI.prototype,"getSettingFloat",1),u([mt],EditorAPI.prototype,"setSettingString",1),u([ft],EditorAPI.prototype,"getSettingString",1),u([mt],EditorAPI.prototype,"setSettingColor",1),u([ft],EditorAPI.prototype,"getSettingColor",1),u([mt],EditorAPI.prototype,"setSettingColorRGBA",1),u([ft],EditorAPI.prototype,"getSettingColorRGBA",1),u([mt],EditorAPI.prototype,"setSettingEnum",1),u([ft],EditorAPI.prototype,"getSettingEnum",1),u([ft],EditorAPI.prototype,"getAvailableMemory",1),u([ft],EditorAPI.prototype,"getUsedMemory",1),u([ft],EditorAPI.prototype,"getMaxExportSize",1),u([mt],EditorAPI.prototype,"setURIResolver",1),u([ft],EditorAPI.prototype,"defaultURIResolver",1),u([ft],EditorAPI.prototype,"getAbsoluteURI",1),u([mt],EditorAPI.prototype,"setGlobalScope",1),u([ft],EditorAPI.prototype,"getGlobalScope",1),u([ft],EditorAPI.prototype,"findAllSpotColors",1),u([ft],EditorAPI.prototype,"getSpotColorRGBA",1),u([ft],EditorAPI.prototype,"getSpotColorCMYK",1),u([mt],EditorAPI.prototype,"setSpotColorRGB",1),u([mt],EditorAPI.prototype,"setSpotColorCMYK",1),u([mt],EditorAPI.prototype,"removeSpotColor",1),u([mt],EditorAPI.prototype,"setSpotColorForCutoutType",1),u([mt],EditorAPI.prototype,"getSpotColorForCutoutType",1);var EventAPI=class{#e;constructor(e){this.#e=e}subscribe=(e,t)=>{Kt("blocks",e,$t());const r=this.#e.subscribe(e,(e=>{try{t(At(e,!0))}catch(e){console.error(e)}}));return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(r))}}},SceneAPI=class{#e;constructor(e){this.#e=e}async loadFromString(e){return Kt("sceneContent",e,zt()),wt((t=>this.#e.loadSceneFromString(e,t)))}async loadFromURL(e){return Kt("url",e,zt()),wt((t=>this.#e.loadSceneFromURL(e,t)))}async saveToString(){const e=this.get();if(null==e)throw new Error("No scene available.");return wt((t=>{this.#e.saveSceneToString(e,t)}))}async saveToArchive(){return new Promise(((e,t)=>{const r=this.get();null==r?t(new Error("No scene available.")):this.#e.saveSceneToArchive(r,(r=>{"error"in r?t(r.error):e(new rr([r],{type:tr.Zip}))}))}))}create(e="Free"){Kt("sceneLayout",e,Jt());return vt(this.#e.createScene(e))}createVideo(){return vt(this.#e.createVideoScene())}createFromImage(e,t=300,r=1,n="Free",o=0,i=!1){return Kt("url",e,zt()),Kt("dpi",t,Yt(Vt(),0)),Kt("pixelScaleFactor",r,Yt(Vt(),0)),Kt("sceneLayout",n,Jt()),wt((a=>this.#e.createSceneFromImage(e,t,r,n,o,i,a)))}createFromVideo(e){return Kt("url",e,zt()),wt((t=>this.#e.createSceneFromVideo(e,t)))}get(){const e=vt(this.#e.findByType("scene")),t=At(e);return t.length>0?t[0]:null}async applyTemplateFromString(e){return Kt("content",e,zt()),wt((t=>this.#e.applyTemplateFromString(e,t)))}async applyTemplateFromURL(e){return Kt("url",e,zt()),wt((t=>this.#e.applyTemplateFromURL(e,t)))}getMode(){const e=this.get();return vt(this.#e.getSceneMode(e))}setDesignUnit(e){Kt("designUnit",e,function(){const e=["Pixel","Millimeter","Inch"];return Ut("DesignUnit",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}());const t=this.get();vt(this.#e.setDesignUnit(t,e))}getDesignUnit(){const e=this.get();return vt(this.#e.getDesignUnit(e))}getPages(){return At(vt(this.#e.getPages()))}getCurrentPage(){const e=this.get();if(null==e)return null;const t=vt(this.#e.findNearestToViewPortCenterByKind(e,"page")),r=At(t);return r.length>0?r[0]:null}findNearestToViewPortCenterByType(e){Kt("type",e,zt());const t=this.get();if(null==t)return[];const r=vt(this.#e.findNearestToViewPortCenterByType(t,e));return At(r)}findNearestToViewPortCenterByKind(e){Kt("kind",e,zt());const t=this.get();if(null==t)return[];const r=vt(this.#e.findNearestToViewPortCenterByKind(t,e));return At(r)}setZoomLevel(e=1){const t=this.get();Kt("zoomLevel",e,Yt(Vt(),0)),this.#e.setZoomLevel(t,e)}getZoomLevel(){const e=this.get();return vt(this.#e.getZoomLevel(e))}async zoomToBlock(e,t=0,r=0,n=0,o=0){return Kt("id",e,Ht()),wt((i=>this.#e.zoomToBlock(e,t,r,n,o,i)))}enableZoomAutoFit(e,t,r=0,n=0,o=0,i=0){return Kt("id",e,Ht()),Kt("axis",t,function(){const e=["Horizontal","Vertical","Both"];return Ut("ZoomAutoFitAxis",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}()),"Horizontal"===t?(Kt("paddingBefore",r,Vt()),Kt("paddingAfter",n,Vt()),vt(this.#e.enableZoomAutoFit(e,t,r,0,n,0))):"Vertical"===t?(Kt("paddingBefore",r,Vt()),Kt("paddingAfter",n,Vt()),vt(this.#e.enableZoomAutoFit(e,t,0,r,0,n))):(Kt("paddingLeft",r,Vt()),Kt("paddingTop",n,Vt()),Kt("paddingRight",o,Vt()),Kt("paddingBottom",i,Vt()),vt(this.#e.enableZoomAutoFit(e,t,r,n,o,i)))}disableZoomAutoFit(e){return Kt("blockOrScene",e,Ht()),vt(this.#e.disableZoomAutoFit(e))}isZoomAutoFitEnabled(e){return Kt("blockOrScene",e,Ht()),vt(this.#e.isZoomAutoFitEnabled(e))}unstable_enableCameraPositionClamping(e,t=0,r=0,n=0,o=0,i=0,a=0,s=0,u=0){return Kt("ids",e,$t(Vt())),Kt("paddingLeft",t,Vt()),Kt("paddingTop",r,Vt()),Kt("paddingRight",n,Vt()),Kt("paddingBottom",o,Vt()),Kt("scaledPaddingLeft",t,Vt()),Kt("scaledPaddingTop",r,Vt()),Kt("scaledPaddingRight",n,Vt()),Kt("scaledPaddingBottom",o,Vt()),vt(this.#e.unstable_enableCameraPositionClamping(e,t,r,n,o,i,a,s,u))}unstable_disableCameraPositionClamping(e=this.get()){if(null==e)throw new Error("No scene available.");return vt(this.#e.unstable_disableCameraPositionClamping(e))}unstable_isCameraPositionClampingEnabled(e=this.get()){if(null==e)throw new Error("No scene available.");return vt(this.#e.unstable_isCameraPositionClampingEnabled(e))}unstable_enableCameraZoomClamping(e,t=-1,r=-1,n=0,o=0,i=0,a=0){return Kt("ids",e,$t(Vt())),Kt("minZoomLimit",t,Vt()),Kt("maxZoomLimit",r,Vt()),Kt("paddingLeft",n,Vt()),Kt("paddingTop",o,Vt()),Kt("paddingRight",i,Vt()),Kt("paddingBottom",a,Vt()),vt(this.#e.unstable_enableCameraZoomClamping(e,t,r,n,o,i,a))}unstable_disableCameraZoomClamping(e=this.get()){if(null==e)throw new Error("No scene available.");return vt(this.#e.unstable_disableCameraZoomClamping(e))}unstable_isCameraZoomClampingEnabled(e=this.get()){if(null==e)throw new Error("No scene available.");return vt(this.#e.unstable_isCameraZoomClampingEnabled(e))}onZoomLevelChanged=e=>{const t=this.#e.subscribeToZoomLevel(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};onActiveChanged=e=>{const t=this.#e.subscribeToActiveSceneChange(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}}};function nr(e,t){const r=new Set;function n(n){r.add(n);e?.(((e,...t)=>{n(e);for(const e of t)n(e)}));return()=>{r.delete(n),t?.()}}return n.emit=function(e,...t){for(const n of r){n(e);for(const e of t)n(e)}},n.handlers=r,n}u([mt],SceneAPI.prototype,"loadFromString",1),u([mt],SceneAPI.prototype,"loadFromURL",1),u([mt],SceneAPI.prototype,"create",1),u([mt],SceneAPI.prototype,"createVideo",1),u([mt],SceneAPI.prototype,"createFromImage",1),u([mt],SceneAPI.prototype,"createFromVideo",1),u([ft],SceneAPI.prototype,"get",1),u([mt],SceneAPI.prototype,"applyTemplateFromString",1),u([mt],SceneAPI.prototype,"applyTemplateFromURL",1),u([ft],SceneAPI.prototype,"getMode",1),u([mt],SceneAPI.prototype,"setDesignUnit",1),u([ft],SceneAPI.prototype,"getDesignUnit",1),u([ft],SceneAPI.prototype,"getPages",1),u([ft],SceneAPI.prototype,"getCurrentPage",1),u([ft],SceneAPI.prototype,"findNearestToViewPortCenterByType",1),u([ft],SceneAPI.prototype,"findNearestToViewPortCenterByKind",1),u([mt],SceneAPI.prototype,"setZoomLevel",1),u([ft],SceneAPI.prototype,"getZoomLevel",1),u([mt],SceneAPI.prototype,"zoomToBlock",1),u([mt],SceneAPI.prototype,"enableZoomAutoFit",1),u([mt],SceneAPI.prototype,"disableZoomAutoFit",1),u([ft],SceneAPI.prototype,"isZoomAutoFitEnabled",1);var or=e=>t=>function(r){return t((function(t){r(e(t))}))};function ir(e){return t=>function(r){let n=!1;const o=t((function(e){n=!0,r(e)}));return n||r(e instanceof Function?e():e),o}}var ar=(e=((e,t)=>e===t))=>t=>function(r){let n;return t((function(t){e(t,n)||(n=t,r(t))}))},sr=e=>{const t=new Set;let r=null;return function(n){return t.add(n),null===r&&(r=e((function(e){t.forEach((t=>t(e)))}))),function(){t.delete(n),0===t.size&&(r?.(),r=null)}}};function ur(e,...t){return t.reduce(((e,t)=>t(e)),e)}var cr=(...e)=>{const t=Array.from(e);return function(e){const r=t.map((function(t){return t(e)}));return function(){for(const e of r)e()}}};function lr(e){return function(t){let r=null;const n=e((function(e){r?.(),r=e?e(t):e}));return function(){n(),r?.(),r=null}}}function dr(...e){const t=Array.from(e);return function(e){const r=new Array(t.length),n=t.map(((t,n)=>t((function(t){r[n]=t,e(r)}))));return function(){n.forEach((e=>e())),r.length=0}}}var pr,hr,fr,mr,gr,yr,br,vr,wr,_r,Er,Sr=Symbol("NO_VALUE");function Cr(e){let t=Sr;const r=nr();return{subscribe:r,value:()=>(t===Sr&&(t=e()),t),update(e){t=e,r.emit(t)}}}var xr=class{constructor(e){p(this,mr),p(this,yr),p(this,vr),p(this,_r),p(this,pr,void 0),p(this,hr,null),p(this,fr,void 0),c(this,"singlePageMode",f(this,yr,br).call(this,"features/singlePageModeEnabled")),c(this,"role",f(this,vr,wr).call(this,"role")),c(this,"pageTitleShow",f(this,yr,br).call(this,"page/title/show")),c(this,"pageTitleshowPageTitleTemplate",f(this,yr,br).call(this,"page/title/showPageTitleTemplate")),c(this,"pageTitleAppendPageName",f(this,yr,br).call(this,"page/title/appendPageName")),c(this,"pageTitleShowOnSinglePage",f(this,yr,br).call(this,"page/title/showOnSinglePage")),c(this,"separator",f(this,_r,Er).call(this,"page/title/separator")),c(this,"pageTitleFont",f(this,_r,Er).call(this,"page/title/fontFileUri")),c(this,"dimOutOfPageAreas",f(this,yr,br).call(this,"page/dimOutOfPageAreas")),c(this,"singlePointPanning",f(this,yr,br).call(this,"touch/singlePointPanning")),c(this,"touchPinchAction",f(this,vr,wr).call(this,"touch/pinchAction")),c(this,"touchRotateAction",f(this,vr,wr).call(this,"touch/rotateAction")),c(this,"dragStartCanSelect",f(this,yr,br).call(this,"touch/dragStartCanSelect")),c(this,"featureHspSelectiveAdjustmentsEnabled",f(this,yr,br).call(this,"features/hspSelectiveAdjustmentsEnabled")),c(this,"featureLayerListEnabled",f(this,yr,br).call(this,"features/layerListEnabled")),c(this,"unstable_videoExportInactivityTimeout",Cr((()=>1e4))),h(this,pr,e);const t=nr((()=>{1===t.handlers.size&&f(this,mr,gr).call(this)}),(()=>{var e;0===t.handlers.size&&(null==(e=d(this,hr))||e.call(this))}));h(this,fr,t)}dispose(){var e;d(this,fr).handlers.clear(),null==(e=d(this,hr))||e.call(this)}};pr=new WeakMap,hr=new WeakMap,fr=new WeakMap,mr=new WeakSet,gr=function(){if(d(this,hr))throw new Error("Settings Changed Event callback is already registered.");const e=d(this,pr).onSettingsChanged((()=>{d(this,fr).emit()}));h(this,hr,(()=>{e(),h(this,hr,null)}))},yr=new WeakSet,br=function(e){const t=()=>d(this,pr).getSettingBool(e);return{subscribe:ur((e=>d(this,fr).call(this,e)),or(t),ar(),sr),update:t=>{d(this,pr).setSettingBool(e,t),d(this,fr).emit()},value:t}},vr=new WeakSet,wr=function(e){const t=()=>d(this,pr).getSettingEnum(e);return{subscribe:ur((e=>d(this,fr).call(this,e)),or(t),ar(),sr),update:t=>{d(this,pr).setSettingEnum(e,t),d(this,fr).emit()},value:t}},_r=new WeakSet,Er=function(e){const t=()=>d(this,pr).getSettingString(e);return{subscribe:ur((e=>d(this,fr).call(this,e)),or(t),ar(),sr),update:t=>{d(this,pr).setSettingString(e,t),d(this,fr).emit()},value:t}};var VariableAPI=class{#e;constructor(e){this.#e=e}findAll(){return At(this.#e.findAllVariables())}setString(e,t){return Kt("key",e,zt()),Kt("value",t,zt()),vt(this.#e.setVariableString(e,t))}getString(e){return Kt("key",e,zt()),vt(this.#e.getVariableString(e))}remove(e){return Kt("key",e,zt()),vt(this.#e.removeVariable(e))}},kr={Info:"Info",Warning:"Warning",Error:"Error"};function Tr(e,t){const r=`[UBQ] ${e}`;switch(t){case"Warning":console.warn(r);break;case"Error":console.error(r);break;case"Info":console.info(r);break;default:console.log(r)}}var Ar={baseURL:"/extensions/",entries:["ly.img.cesdk.fonts"]};function Pr(e,t=("undefined"==typeof window?"":window.location.href)){return new URL(e,""===t?void 0:t).href}function qr(e){return"/"!==e[e.length-1]?`${e}/`:e}var Fr=async function(e,t,r=fetch,n,o=new Set(n.findAllSources())){const i=e.map((async e=>{const i=function(e,t){const r=e.endsWith("/"),n=t.startsWith("/");return r&&n?`${e.substring(0,e.length-1)}${t}`:r||n?`${e}${t}`:`${e}/${t}`}(t,`/${e}/content.json`);return r(i).then((e=>{if(!e.ok)throw new Error(e.statusText);return e.json()})).then((r=>{if(void 0===r.assets)throw new Error(`Invalid content.json for assets: ${e}`);const i=r.assets;o.has(e)||n.addLocalSource(e),i.forEach((r=>{r.meta&&Object.entries(r.meta).forEach((([e,n])=>{const o=n.toString();if(o.includes("{{base_url}}")){const n=o.replace("{{base_url}}",t);r.meta&&(r.meta[e]=n)}})),r.payload?.sourceSet&&r.payload.sourceSet.forEach((e=>{e.uri.includes("{{base_url}}")&&(e.uri=e.uri.replace("{{base_url}}",t))})),n.addAssetToSource(e,r)}))}))}));await Promise.all(i)};var Lr=async function(e,t,r,n){const o=["ly.img.sticker","ly.img.vectorpath","ly.img.colors.defaultPalette","ly.img.filter.lut","ly.img.filter.duotone","ly.img.effect","ly.img.blur"].filter((e=>!r.includes(e)));await Fr(o,t,n,e)};var Dr=async function(e,t,r,n,o,i,a="https://cdn.img.ly/assets/demo/v2"){const s=new Set(e.findAllSources()),u="ly.img.image.upload";!o||r.includes(u)||s.has(u)||e.addLocalSource(u,["image/jpeg","image/png","image/webp","image/svg+xml","image/gif","image/bmp"]);const c="ly.img.video.upload";"Video"!==n||!o||r.includes(c)||s.has(c)||e.addLocalSource(c,["video/mp4","video/quicktime"]);const l="ly.img.audio.upload";"Video"!==n||!o||r.includes(l)||s.has(l)||e.addLocalSource(l,["audio/mpeg","audio/x-m4a","audio/m4a","audio/mp3"]);const d=["ly.img.image","ly.img.video","ly.img.audio"].filter((e=>!r.includes(e)));s.has("ly.img.template")||r.includes("ly.img.template")||(e.addLocalSource("ly.img.template",void 0,(async e=>{const r=e.meta?.uri;if(r)if(r.startsWith("UBQ1"))t.applyTemplateFromString(r);else{const e=new URL(r,window.location.href);t.applyTemplateFromURL(e.href)}})),d.push("ly.img.template")),"Video"!==n||s.has("ly.img.video.template")||r.includes("ly.img.video.template")||(e.addLocalSource("ly.img.video.template",void 0,(async e=>{const r=e.meta?.uri;if(r)if(r.startsWith("UBQ1"))t.applyTemplateFromString(r);else{const e=new URL(r,window.location.href);t.applyTemplateFromURL(e.href)}})),d.push("ly.img.video.template")),await Fr(d,a,i,e)};function Br(e,t){let r;const n=new Set;function o(){const n=window.devicePixelRatio,{width:i,height:a}=e.getBoundingClientRect();t(i*n,a*n,n),r=matchMedia(`(resolution: ${n}dppx)`),r.addEventListener("change",o,{once:!0})}o();const i=new ResizeObserver((function([e]){const{width:r,height:o}=e.target.getBoundingClientRect();if(r<=0||o<=0)return;const i=window.devicePixelRatio,a=setTimeout((function(){n.delete(a),t(r*i,o*i,i)}),0);n.add(a)}));return i.observe(e),()=>{r.removeEventListener("change",o),i.disconnect();for(const e of n)clearTimeout(e);n.clear(),e=null,t=null}}var Rr=s(tt()),Mr=(e=>(e.Scene="ubq/designblocks/SceneProps",e.Camera="ubq/designblocks/Camera",e.Common="ubq/designblocks/CommonDesignBlockProps",e.Page="ubq/designblocks/Page",e.Image="ubq/designblocks/Image",e.Video="ubq/designblocks/Video",e.Audio="ubq/designblocks/Audio",e.Sticker="ubq/designblocks/Sticker",e.Text="ubq/designblocks/Text",e.Crop="ubq/types/Crop",e.Scale="ubq/scene/Scale",e.Opacity="ubq/types/Opacity",e.FillColor="ubq/types/FillColor",e.Group="ubq/designblocks/Group",e.VectorPath="ubq/designblocks/VectorPath",e.PendingState="ubq/designblocks/PendingState",e.ErrorState="ubq/designblocks/ErrorState",e.DesignBlockFrame="ubq/designblocks/DesignBlockFrame",e.Size="ubq/layout/Size",e.Position="ubq/layout/Position",e.EulerRotation="ubq/scene/EulerRotation",e.Children="ubq/scene/Children",e))(Mr||{}),Ir=Mr,Or=s(ut());function jr(e,t){const{block:r,event:n}=t;return ur((t=>{const o=r.getType(e),i=(0,Or.default)(n.subscribe([e],(function(n){n.some((e=>"Destroyed"===e.type))&&!r.isValid(e)||r.getType(e)!==o?i():t(n)})));return i}),sr)}var Ur=function(e,t,r,n){const o=function(e,t){if(!t)return e;let r;return(...n)=>{const o=e(...n);return t(o,r)||(r=o),r}}(t,n?.equals),i=nr();return{subscribe:ur(cr(e,i),or(o),ar(),sr),update:r,value:o,flush:()=>i.emit()}};var $r=class{settings;clampCamera=!1;clampResult=Cr((()=>({sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}})));zoomLevel;#t;viewportPadding=Cr((()=>({x:40,y:48})));autoFit;scrollPercentage;sceneSize;scroll;constructor(e){const{block:t,scene:r,_ubq:n}=e,o=ur(r.onActiveChanged,ir(),or((()=>r.get()))),i=ur(o,or((r=>null!=r&&t.isValid(r)?ur(jr(r,e),ir([]),or((()=>t.getFloat(r,"scene/dpi")))):()=>()=>{})),lr),a=ur(o,or((()=>{const r=t.findByType("camera")[0];return null==r?()=>()=>{}:ur(jr(r,e),ir([]),or((()=>r)))})),lr);this.settings={subscribe:ur(a,or((e=>({width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}))),ar(Rr.default),sr),update({width:e,height:r,pixelRatio:n}){const o=t.findByType("camera")[0];null!=o&&(t.setFloat(o,"camera/resolution/width",e),t.setFloat(o,"camera/resolution/height",r),t.setFloat(o,"camera/pixelRatio",n))},value(){const e=t.findByType("camera")[0];return null==e?{width:0,height:0,pixelRatio:1}:{width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}}},this.zoomLevel=Ur(cr(r.onZoomLevelChanged,i),(()=>{const e=r.get();return null!=e&&t.isValid(e)?r.getZoomLevel():1}),(e=>{const n=r.get();null!=n&&t.isValid(n)&&r.setZoomLevel(e)})),this.#t={subscribe:ur(a,or((e=>new bt(n).getValue(e,Ir.Camera,"zoomLevel"))),ar()),value(){const e=t.findByType("camera")[0];return null==e?1:new bt(n).getValue(e,Ir.Camera,"zoomLevel")}},this.autoFit=Ur(r.onZoomLevelChanged,(()=>{const e=r.get();return null!=e&&r.isZoomAutoFitEnabled(e)})),this.scrollPercentage={subscribe:ur(this.clampResult.subscribe,or((e=>e.scrollPercentage)),ar(Rr.default)),value:()=>this.clampResult.value().scrollPercentage},this.sceneSize={subscribe:ur(dr(this.clampResult.subscribe,this.#t.subscribe,this.settings.subscribe),or((([e,t,r])=>{const n=e?.sceneSize??this.clampResult.value().sceneSize??{x:0,y:0},o=t??this.#t.value()??10,i=r?.pixelRatio??this.settings.value().pixelRatio??1;return{x:n.x*o/i,y:n.y*o/i}})),ar(Rr.default)),value:()=>{const e=this.clampResult.value().sceneSize??{x:0,y:0},t=this.#t.value()??10,r=this.settings.value().pixelRatio??1;return{x:e.x*t/r,y:e.y*t/r}}},this.scroll=e=>{const r=t.findByType("camera")[0];if(null==r)return;const n=this.#t.value(),o=this.settings.value().pixelRatio,i=e.x*o/n,a=e.y*o/n,s={x:t.getPositionX(r)+i,y:t.getPositionY(r)+a};t.setPositionX(r,s.x),t.setPositionY(r,s.y)}}};function Nr(e,t,r=void 0){const n=e=>{vt(t.setContext("")),e.preventDefault()},o=e=>{vt(t.setContext("!canvas")),r&&r(),e.preventDefault()};return e.addEventListener("webglcontextlost",n,!1),e.addEventListener("webglcontextrestored",o,!1),()=>{e.removeEventListener("webglcontextlost",n),e.removeEventListener("webglcontextrestored",o)}}var Hr=!1;var Vr="https://api.img.ly/activate";var Wr=s(lt()),zr="./cesdk-v1.23.0-rc.1-GD242ZBP.data",Gr="./cesdk-v1.23.0-rc.1-AAIIGL3C.wasm",Yr=Wr.default,Xr=!("undefined"==typeof window||!window.document||!window.document.createElement)&&navigator&&navigator.userAgent||"",Zr=-1!==Xr.indexOf("Edge"),Kr=!!Xr.match(/msie|trident/i),Qr=/\b(iPad|iPhone|iPod)\b/.test(Xr)&&/WebKit/.test(Xr)&&!/Edge/.test(Xr)&&("undefined"==typeof window||!("MSStream"in window)),Jr=(e,t)=>{if(null!=t){return[t,e.split("/").pop()].join("")}return new URL(e,window.location.origin)};function en(){try{return new WebAssembly.Memory({initial:tn(Qr?512:32),maximum:tn(2048)})}catch(e){return new WebAssembly.Memory({initial:tn(32),maximum:tn(2048)})}}function tn(e){return 1024*e*1024/65536}async function rn(e,t){const{core:r}=t,n=t.logger,o=Jr(Gr,r.baseURL).toString(),i=Jr(zr,r.baseURL).toString(),a=/electron/i.test(navigator.userAgent),s=function(e,t=fetch){if(!e.license)throw new Error("Missing license key in config");return e.license.length<128?t(Vr,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:e.license,userId:e.userId})}).then((e=>{if(e.ok)return e.json();throw new Error("Unfortunately we are experiencing a server down time and your License key cannot be validated. We're already working on a fix and will restore service soon. Should services not restore within the hour, kindly get in touch with our support team.")})).then((e=>{if("valid"===e.status)return e.license;throw"expired"===e.status?new Error("Thanks for using IMG.LY for creative editing. Please note that your license file or commercial use is expired. Please get in touch with our sales team to discuss extension of your commercial license."):new Error("The License Key (API Key) you are using to access the IMG.LY SDK is invalid. Please ensure that you are using the license key tied to your subscription and get in touch with our support team.")})):Promise.resolve(e.license)}(t),u=a?await fetch(i,{credentials:"same-origin"}).then((e=>e.arrayBuffer())).then((e=>function(t,r){if(t!==i)return null;if(r===e.byteLength)return e;throw new Error(`Attempt to get preloaded package of unknown name or size: ${t} ${r}`)})):void 0;return new Promise(((r,a)=>{const c={getPreloadedPackage:u,locateFile:(e,t)=>e.endsWith(".wasm")?o:e.endsWith(".data")?i:t+e,print:e=>{e&&"undefined"!==e&&n(e,"Info")},printErr:e=>{e&&"undefined"!==e&&n(e,"Error")},logReadFiles:!1,printWithColors:!0,wasmMemory:en()};Yr(c).then((async n=>{n.specialHTMLTargets["!canvas"]=e;n.emscripten_ubq_settings_forceWebGL1=!!t?.forceWebGL1;const o=vt(n.createEngine("!canvas",t.audioOutput??"auto"));!function(e,t){if(!t)throw new Error("Missing license key");vt(e.unlockWithLicense(t))}(o,await s),function(e,t){const r=new bt(e),n=new EditorAPI(e),o=new AssetAPI(e);n.setSettingEnum("role",t.role??"Creator"),"Adopter"===t.role&&n.setSettingEnum("doubleClickSelectionMode","Direct"),Hr&&(r.execute("cesdk/getVersionInfo").then((e=>console.debug(e))),r.execute("cesdk/getCapabilitiesInfo").then((e=>console.debug(e)))),n.setSettingString("basePath",t.baseURL),n.setSettingBool("showBuildVersion",Hr||!1),t.featureFlags?.preventScrolling&&(n.setSettingBool("touch/singlePointPanning",!1),n.setSettingBool("touch/dragStartCanSelect",!1)),o.addLocalSource("ly.img.text"),Object.entries(t.presets.typefaces||{}).forEach((([e,t])=>{(t.fonts||[]).forEach((n=>{const o=`${e}_${n.weight}_${n.style}`;r.execute("ubq/assets/registerFont",[o,n.fontURL,t.family,n.weight,n.style])}))})),function(){Hr&&(n.setSettingBool("features/hspSelectiveAdjustmentsEnabled",!1),n.setSettingBool("features/layerListEnabled",!1),n.setSettingBool("features/templatingEnabled",!0));const e=!!t.featureFlags?.singlePageMode;n.setSettingBool("features/singlePageModeEnabled",e),n.setSettingBool("features/effectsEnabled",!0)}(),function(){const e=t.extensions??[];e.entries.forEach((t=>{r.execute("ubq/extension/register",`${e.baseURL+t}`)}))}(),function(){const t=new VariableAPI(e);(Hr||"undefined"!=typeof window&&window.Cypress)&&(t.setString("company_name","img.ly"),t.setString("first_name","Charly"),t.setString("last_name","Williams"),t.setString("address","742 Evergreen Terrace"),t.setString("city","Springfield"))}(),t.license.length<128&&n.startTracking(t.license,t.userId??"")}(o,t),r(o)})).catch(a)}))}async function nn(e){const t=new Function("url","return import(url)"),r=await t(e);if(void 0!==r.initialize&&"function"!=typeof r.initialize)throw new Error(`Plugin ${e} exports an 'initialize' property, but is is not a function`);if(void 0!==r.update&&"function"!=typeof r.update)throw new Error(`Plugin ${e} exports an 'update' property, but it is not a function`);return r}var on=class{_reactor;_updateHandler=null;debugName;dirty=!0;readCalls=new Set;constructor(e,t){this.debugName=t,this._reactor=e}dispose(){this._updateHandler=null,this._reactor._unregisterReaction(this),this._reactor=null}track(e){return this._reactor._trackReaction(this,e)}subscribe(e){return this._reactor._registerReaction(this),this._updateHandler=e,()=>{this._updateHandler=null,this._reactor._unregisterReaction(this)}}update(){this._updateHandler?.()}},an=s(tt()),sn=Symbol("NO_VALUE"),un=class{callId;_value;_readCurrentValue;constructor(e,t){this.callId=e,this._value=t(),this._readCurrentValue=t}updateValueAndCheckDirty(){try{const e=this._readCurrentValue();return(0,an.default)(this._value,e)?(this._value=e,!1):(this._value=e,!0)}catch(e){return this._value=sn,!0}}update(e){this._readCurrentValue=e}},cn=class{readCalls=new Map;readCache=new Map;registeredReactions=new Set;activeReactions=new Set;updatingDirtyReactions=0;_getterCalled(e,t){if(this.activeReactions.size<=0)return;const r=this._readThroughCache.bind(this,e,t);if(this.readCalls.has(e)){this.readCalls.get(e).update(r)}else this.readCalls.set(e,new un(e,r));for(const t of this.activeReactions)t.readCalls.add(e)}_setterCalled(){this._clearReadCache()}_readThroughCache(e,t){if(this.updatingDirtyReactions&&this.readCache.has(e))return this.readCache.get(e);const r=t();return this.readCache.set(e,r),r}wrapUpdateReactor=function(e){if(this.#r>10)throw new Error("Too many nested engine updates");const t=this.#r++;t>1&&console.warn("wrapUpdateReactor: nested update detected",t);try{e(),this.updateDirtyReactions()}finally{if(--this.#r!==t)throw new Error("Unexpected engine update nesting")}}.bind(this);#r=0;createReaction(e){return new on(this,e)}_registerReaction(e){this.registeredReactions.add(e)}_unregisterReaction(e){this.registeredReactions.delete(e)}_clearReadCache(){this.readCache.clear()}_cleanupReadCalls(){const e=new Set;for(const t of this.registeredReactions)for(const r of t.readCalls)e.add(r);for(const[t]of this.readCalls)e.has(t)||this.readCalls.delete(t)}#n=new Set;updateDirtyReactions(){try{this.updatingDirtyReactions++,this._clearReadCache();const e=new Set;for(const[t,r]of this.readCalls)r.updateValueAndCheckDirty()&&e.add(t);if(e.size>0)for(const t of this.registeredReactions)for(const r of t.readCalls)if(e.has(r)){t.dirty=!0;break}for(const e of this.registeredReactions)if(!this.#n.has(e)&&e.dirty){this.#n.add(e);try{e.update()}finally{this.#n.delete(e)}e.dirty=!1}this._cleanupReadCalls()}finally{this.updatingDirtyReactions--}}_trackReaction(e,t){try{return this.activeReactions.add(e),e.readCalls.clear(),t()}finally{e.dirty=!1,this.activeReactions.delete(e)}}decorateFunction(e,t){return function(e,t,r=t.name){yt[r]??=0;const n=yt[r]++;return function(...o){const i=this,a=`${r}${n}-${JSON.stringify(o,null,0)}`;function s(){return Reflect.apply(t,i,o)}return e._getterCalled(a,s),e._readThroughCache(a,s)}}(this,e,t)}decorateObject(e){return function(e,t){const r=t.constructor?.name??crypto.randomUUID(),n=[];let o=!1;const i=Object.getOwnPropertyNames(t.constructor.prototype).concat(Object.getOwnPropertyNames(t));for(const s of i){const i=t[s];if("function"==typeof(a=i)&&ht in a)if("getter"===i[ht].type){let a=function(...t){if(o)throw new Error("Disposed @getter proxy called");const n=this,a=`${r}-${s.toString()}-${JSON.stringify(t,null,0)}`;function u(){return Reflect.apply(i,n,t)}return e._getterCalled(a,u),e._readThroughCache(a,u)};const u=Object.hasOwnProperty.call(t,"fnName")?()=>{t[s]=i}:()=>delete t[s];n.push(u),t[s]=a}else if("setter"===i[ht].type){let r=function(...t){if(o)throw new Error("Disposed @setter proxy called");const r=this;return e._setterCalled(),Reflect.apply(i,r,t)};const a=Object.hasOwnProperty.call(t,"fnName")?()=>{t[s]=i}:()=>delete t[s];n.push(a),t[s]=r}}var a;return function(){o=!0;for(const e of n)e();n.length=0}}(this,e)}dispose(){this.registeredReactions.forEach((e=>e.dispose())),this.registeredReactions.clear(),this.readCalls.clear(),this.activeReactions.clear(),this.readCache.clear()}},ln='url("data:image/svg+xml,%3Csvg width=%2722%27 height=%2725%27 viewBox=%270 0 22 25%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cg filter=%27url(%23filter0_d)%27%3E%3Cpath d=%27M18 11.1071C18 14.5637 15.5566 17.4515 12.3314 18.0846V20L7.20308 17.0145L12.3314 14.0289V15.7825C14.3292 15.1951 15.7946 13.3221 15.7946 11.107C15.7946 8.42285 13.6437 6.23908 11 6.23908C8.35629 6.23908 6.20542 8.42285 6.20542 11.107C6.20542 11.8299 6.35745 12.5252 6.65738 13.1736L4.66118 14.1255C4.22245 13.1771 4 12.1616 4 11.1071C4.00007 7.18825 7.1403 4 11.0001 4C14.8599 4 18 7.18825 18 11.1071Z%27 fill=%27black%27/%3E%3Cpath d=%27M12.8314 15.0559V14.0289V13.1593L12.0799 13.5968L6.95152 16.5824L6.20927 17.0145L6.95152 17.4466L12.0799 20.4321L12.8314 20.8696V20V18.4841C16.0889 17.6521 18.5 14.6573 18.5 11.1071C18.5 6.9193 15.1431 3.5 11.0001 3.5C6.85702 3.5 3.50008 6.91929 3.5 11.1071V11.1071C3.5 12.2334 3.73793 13.3206 4.20739 14.3354L4.41978 14.7946L4.8764 14.5768L6.8726 13.6249L7.31866 13.4122L7.11118 12.9637C6.84206 12.3819 6.70542 11.7584 6.70542 11.107C6.70542 8.69181 8.63956 6.73908 11 6.73908C13.3604 6.73908 15.2946 8.69181 15.2946 11.107C15.2946 12.8513 14.2837 14.3564 12.8314 15.0559Z%27 stroke=%27white%27/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id=%27filter0_d%27 x=%270.0599999%27 y=%270.0599999%27 width=%2721.88%27 height=%2724.6193%27 filterUnits=%27userSpaceOnUse%27 color-interpolation-filters=%27sRGB%27%3E%3CfeFlood flood-opacity=%270%27 result=%27BackgroundImageFix%27/%3E%3CfeColorMatrix in=%27SourceAlpha%27 type=%27matrix%27 values=%270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0%27/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation=%271.47%27/%3E%3CfeColorMatrix type=%27matrix%27 values=%270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0%27/%3E%3CfeBlend mode=%27normal%27 in2=%27BackgroundImageFix%27 result=%27effect1_dropShadow%27/%3E%3CfeBlend mode=%27normal%27 in=%27SourceGraphic%27 in2=%27effect1_dropShadow%27 result=%27shape%27/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 12 12, pointer';function dn(e,t){let r;return t.onStateChanged((()=>{const n=function(e,t){switch(e){case"Arrow":return"default";case"Move":return"move";case"MoveNotPermitted":return"auto";case"Resize":{const e=180*t/Math.PI+45;if(!Kr&&!Zr)return`url("data:image/svg+xml,%3Csvg style='transform: rotate(${e}deg)' width ='22' height ='22' viewBox ='0 0 22 22' fill ='none' xmlns ='http://www.w3.org/2000/svg'%3E%3Cg filter ='url(%23filter0_d)'%3E%3Cpath d ='M13.7 11.1L9.7 15.2L12.5 18H4V9.5L6.9 12.3L10.9 8.3L12.3 6.9L9.5 4H18V12.5L15.2 9.7L13.7 11.1Z' fill ='white'/%3E%3C/g%3E%3Cpath d ='M12.7 10.7L8.3 15.2L10.1 17H5V11.9L6.9 13.8L11.3 9.3L13.8 6.9L11.9 5H17V10.1L15.2 8.3L12.7 10.7Z' fill ='black'/%3E%3Cdefs%3E%3Cfilter id ='filter0_d' x ='0' y ='0' width ='22' height ='22' filterUnits ='userSpaceOnUse' color-interpolation-filters ='sRGB'%3E%3CfeFlood flood-opacity ='0' result ='BackgroundImageFix'/%3E%3CfeColorMatrix in ='SourceAlpha' type ='matrix' values ='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation ='2'/%3E%3CfeColorMatrix type ='matrix' values ='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0'/%3E%3CfeBlend mode ='normal' in2 ='BackgroundImageFix' result ='effect1_dropShadow'/%3E%3CfeBlend mode ='normal' in ='SourceGraphic' in2 ='effect1_dropShadow' result ='shape'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 12 12, pointer`;switch(e){case 90:case 270:return"nwse-resize";case 135:case 315:return"ns-resize";case 180:case 360:return"nesw-resize";case 225:return"ew-resize";default:return"move"}}case"Rotate":return ln;case"Text":return"text";default:return"auto"}}(t.getCursorType(),t.getCursorRotation());if(n!==r){r=n;const t=new CustomEvent("cesdk-cursor",{composed:!0,bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(t)&&e.style.setProperty("cursor",n)}}))}var pn=function(e,t,r,n){let o,i=null;const a=r.onStateChanged((()=>{o=r.getEditMode(),"Text"!==o||i?"Text"!==o&&i&&(i(),i=null):i=function(){const o=i();return()=>{o?.()};function i(){let o=!1,i="";if(null==e.parentElement)return console.warn('Could not attach hidden text input to the DOM: Canvas has no parentElement. This can happen if edit mode is switched to "Text", while the canvas is removed from the DOM.'),()=>{};const a=u();l();const s=d();return e.parentElement.appendChild(a),p(),()=>{s(),c()};function u(){const e=document.createElement("textarea");return e.id="ubq_internal-inline_text_editing_html_representation",e.setAttribute("data-cy","inline-text-editing-input"),e.autocapitalize="none",e.spellcheck=!1,e.cols=4096,e.style.contain="strict",e.style.opacity="0",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.position="fixed",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.margin="-1px",e.style.overflow="hidden",e.style.clip="rect(0, 0, 0, 0)",e.style.border="0",e}function c(){a.blur(),a.remove()}function l(){const t=r.getTextCursorPositionInScreenSpaceX(),n=r.getTextCursorPositionInScreenSpaceY(),{left:o,top:i}=e.getBoundingClientRect();a.style.left=`${o+t/window.devicePixelRatio}px`,a.style.top=`${i+n/window.devicePixelRatio}px`}function d(){const t=e.getRootNode();a.addEventListener("input",v),a.addEventListener("keydown",_),a.addEventListener("copy",g),a.addEventListener("cut",y),a.addEventListener("compositionstart",E),a.addEventListener("compositionend",S),a.addEventListener("beforeinput",T),a.addEventListener("focusout",A),t.addEventListener("touchend",k),t.addEventListener("mousedown",k),t.addEventListener("mouseup",x);const n=r.onStateChanged((()=>{l()}));return()=>{a.removeEventListener("input",v),a.removeEventListener("keydown",_),a.removeEventListener("copy",g),a.removeEventListener("cut",y),a.removeEventListener("compositionstart",E),a.removeEventListener("compositionend",S),a.removeEventListener("beforeinput",T),a.removeEventListener("focusout",A),t.removeEventListener("mousedown",k),t.removeEventListener("mouseup",x),t.removeEventListener("touchend",k),n()}}function p(){null!==a.parentElement&&(a.focus(),h()||setTimeout((()=>a.focus()),0))}function h(){return a.getRootNode().activeElement===a}function f(e){return[...e].length}function m(e){const t=e.selectionEnd??e.selectionStart??0;return f(e.value.substring(0,t))}function g(e){try{t.useInternalAPI((t=>{const r=vt(t.getSelectedText());""!==r&&e.clipboardData&&(e.clipboardData.setData("text/plain",r),e.preventDefault())}))}catch(e){console.error(e)}}function y(e){try{t.useInternalAPI((r=>{const n=vt(r.getSelectedText());if(""!==n&&e.clipboardData){e.clipboardData.setData("text/plain",n),e.preventDefault();const r={key:44,characters:"",shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",r)}}))}catch(e){console.error(e)}}async function b(){return!(!o||t.ubq.unstable_isTextCursorInCompositionRange())&&(await S(),!0)}function v(e){const r=e.target,{value:n}=r;if(o){const e=m(a);t.execute("ubq/text/compositionUpdate",{value:n,cursorPosition:e})}else n.length>0&&(r.value="")}function w(e){const r={key:255,characters:e,shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",r)}async function _(e){if(b(),1===e.key.length&&(i=e.key),"a"===e.key&&(e.metaKey||e.ctrlKey))return o&&S(),void await t.execute("ubq/text/selectAllText");if("Escape"===e.key)return void L();if("Backspace"!==e.key&&"Delete"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"Enter"!==e.key)return;const r=function(e){const t={key:255,characters:e.key,shiftIsHeld:e.shiftKey,commandIsHeld:e.metaKey||e.ctrlKey,optionIsHeld:e.altKey,timestamp:Date.now()};switch(e.key.toUpperCase()){case"0":t.key=0;break;case"1":t.key=1;break;case"2":t.key=2;break;case"3":t.key=3;break;case"4":t.key=4;break;case"5":t.key=5;break;case"6":t.key=6;break;case"7":t.key=7;break;case"8":t.key=8;break;case"9":t.key=9;break;case"A":t.key=10;break;case"B":t.key=11;break;case"C":t.key=12;break;case"D":t.key=13;break;case"E":t.key=14;break;case"F":t.key=15;break;case"G":t.key=16;break;case"H":t.key=17;break;case"I":t.key=18;break;case"J":t.key=19;break;case"K":t.key=20;break;case"L":t.key=21;break;case"M":t.key=22;break;case"N":t.key=23;break;case"O":t.key=24;break;case"P":t.key=25;break;case"Q":t.key=26;break;case"R":t.key=27;break;case"S":t.key=28;break;case"T":t.key=29;break;case"U":t.key=30;break;case"V":t.key=31;break;case"W":t.key=32;break;case"X":t.key=33;break;case"Y":t.key=34;break;case"Z":t.key=35;break;case" ":t.key=42;break;case"ESCAPE":t.key=43,t.characters="";break;case"BACKSPACE":t.key=40,t.characters="";break;case"DELETE":t.key=44,t.characters="";break;case"ENTER":t.key=41,t.characters=t.shiftIsHeld?"\u2028":"\n";break;case"CONTROL":t.key=45,t.characters="";break;case"ALT":t.key=46,t.characters="";break;case"SHIFT":t.key=47,t.characters="";break;case"ARROWLEFT":t.key=36,t.characters="";break;case"ARROWRIGHT":t.key=37,t.characters="";break;case"ARROWUP":t.key=38,t.characters="";break;case"ARROWDOWN":t.key=39,t.characters="";break;case"DEAD":t.key=255,t.characters=""}return t}(e);await t.execute("ubq/inputs/keyboardkey",r),e.currentTarget&&(a.value="")}async function E(){o=!0,await t.execute("ubq/text/compositionStart")}async function S(){o?(o=!1,a.value="",t.execute("ubq/text/compositionEnd")):a.value=""}async function C(){if(!o)return;n();if(await b())return;const e=t.ubq.unstable_getCursorPosition(),r=t.ubq.unstable_getCompositionRange(),i=e.end-r.start,s=m(a);e.start>=r.start&&e.start<=1+r.end&&i!==s&&S()}async function x(){C()}async function k(t){C(),t.target===e&&"Text"===r.getEditMode()&&(p(),t.preventDefault())}async function T(e){if(o&&!e.isComposing&&S(),null===e.data)return;const r=e.target,n=e.data;if(await b())w(i);else if(o){const e=f(n);t.execute("ubq/text/compositionUpdate",{value:n,cursorPosition:e})}else n.length>0&&("\n"!==n[0]&&w(n),r.value="")}function A(e){if(F(e.relatedTarget)&&P(e.relatedTarget));else{q(e)}}function P(t){const r=new CustomEvent("cesdk-blur",{composed:!0,bubbles:!0,cancelable:!0,detail:t});return e.dispatchEvent(r)}function q(t){const r=new CustomEvent("cesdk-refocus",{composed:!0,bubbles:!0,cancelable:!0,detail:t.relatedTarget}),n=e.dispatchEvent(r);return n&&p(),n}function F(e){return null!=e&&(e instanceof HTMLElement&&(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&e.type.match("^(text|number|url|email|search|tel)$")||e.isContentEditable))}async function L(){r.setEditMode("Transform")}}}()}));return()=>{i?.(),a()}};function hn(e,t,r){const n=[],o=r=>{if("touch"===r.pointerType)return;const n=fn(e,r);t.execute("ubq/inputs/mousemove",n)},i=o=>{if("touch"===o.pointerType)return;const i={...fn(e,o),button:mn(o.button),state:0,shiftIsHeld:!!o.shiftKey};n[o.button]=!1,o.currentTarget.releasePointerCapture(o.pointerId),t.execute("ubq/inputs/mousebutton",i),r()},a=r=>{if("touch"===r.pointerType)return;const o={...fn(e,r),button:mn(r.button),state:1,shiftIsHeld:!!r.shiftKey};n[r.button]=!0,r.currentTarget.setPointerCapture(r.pointerId),t.execute("ubq/inputs/mousebutton",o)},s=r=>{if("touch"===r.pointerType)return;const o={...fn(e,r),shiftIsHeld:!!r.shiftKey};n.forEach(((e,r)=>{if(e){const e={...o,button:r,state:0};t.execute("ubq/inputs/mousebutton",e)}})),n.length=0},u=e=>{e.cancelable&&e.preventDefault()};return e.addEventListener("pointerdown",a),e.addEventListener("pointerup",i),e.addEventListener("pointercancel",i),e.addEventListener("pointermove",o),e.addEventListener("lostpointercapture",s),e.addEventListener("touchmove",u,{passive:!1}),()=>{e.removeEventListener("pointerdown",a),e.removeEventListener("pointerup",i),e.removeEventListener("pointercancel",i),e.removeEventListener("pointermove",o),e.removeEventListener("lostpointercapture",s),e.removeEventListener("touchmove",u),e=null}}function fn(e,t){const r=e.getBoundingClientRect(),n=r?.top??0,o=r?.left??0;return{position:{x:(t.clientX-o)*window.devicePixelRatio,y:(t.clientY-n)*window.devicePixelRatio},isTouch:!1,timestamp:t.timeStamp}}function mn(e){switch(e){case 0:return 0;case 1:return 2;case 2:return 1;default:return 255}}var gn=class{ubq;enabled;initialTarget;target;dispose;constructor(e,t){this.ubq=t,this.enabled=Ur(e.editor.onSettingsChanged,(()=>{const t=e.editor.getSettingBool("mouse/enableZoom"),r=e.editor.getSettingBool("mouse/enableScroll");return t||r})),this.target=Cr((()=>{})),this.dispose=()=>{this.target.update(void 0),this.target=null,this.enabled=null,this.ubq=null,this.initialTarget=null,e=null,t=null}}initialize(e){let t;this.initialTarget=e;const r=cr(this.enabled.subscribe,this.target.subscribe)((()=>{t?.(),t=void 0;const e=this.target.value();this.enabled.value()&&e&&(t=this.addWheelListener(e))}));this.target.update(e);return()=>{r(),t?.()}}setTarget(e){this.target.update(e);return()=>{this.target.update(this.initialTarget)}}addWheelListener(e){const t=e=>{if(!this.initialTarget)throw new Error("initialTarget is not set");const t={...fn(this.initialTarget,e),deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode,shiftIsHeld:!!e.shiftKey,ctrlOrMetaIsHeld:!!e.ctrlKey||!!e.metaKey};this.ubq.mouseWheel(t)&&(e.stopPropagation(),e.preventDefault())};e.addEventListener("wheel",t,{passive:!1,capture:!0});return()=>{e.removeEventListener("wheel",t,{capture:!0}),e=null}}},yn=class{active=!1;enableDebug=!1;timestamp=0;baseTouches=[];touches=[];currentTransform;constructor(){this.currentTransform=this.emptyTransform()}touchAddRemove(e){const t=new Array(e.touches.length);for(let r=0;r<e.touches.length;r++){const n=e.touches.item(r);t[r]=bn(n)}this.touches=t}touchUpdate(e){for(let t=0;t<e.touches.length;t++){const r=e.touches.item(t),n=this.touches.find((e=>e.identifier===r.identifier));if(!n)return;n.x=r.clientX,n.y=r.clientY}}listen(e){return e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchcancel),e.addEventListener("touchmove",this.touchmove),()=>{e.removeEventListener("touchstart",this.touchstart),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.touchcancel),e.removeEventListener("touchmove",this.touchmove)}}touchstart=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchstart")};touchend=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchend")};touchcancel=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchcancel")};touchmove=e=>{this.touchUpdate(e),this.timestamp=e.timeStamp,this.process("touchmove")};debugState;debug(){if(!this.enableDebug)return;const e=JSON.stringify(this.currentTransform);function t(e,[t,r,n],o){const i=document.createElement("div");return i.style.position="fixed",i.style.top="-25px",i.style.left="-25px",i.style.width="50px",i.style.height="50px",i.style.border=`3px ${o} rgb(${t},${r},${n})`,i.style.borderRadius="50%",i.style.borderStyle=o,i.style.backgroundColor=`rgba(${t},${r},${n}, 0.5)`,i.style.transformOrigin="center",i.style.textAlign="center",i.innerHTML=e,i.style.display="none",document.body.appendChild(i),i}this.debugState||(this.debugState={touches:[t("T1",[218,212,104],"solid"),t("T2",[218,212,104],"solid")],value:this.debugValueDiv(void 0,e,this.touches,[218,212,104]),baseTouches:[t("B1",[128,128,128],"solid"),t("B2",[128,128,128],"solid")]}),this.debugState.touches[0].style.display=this.touches[0]?"block":"none",this.debugState.touches[1].style.display=this.touches[1]?"block":"none",this.debugState.baseTouches[0].style.display=this.baseTouches[0]?"block":"none",this.debugState.baseTouches[1].style.display=this.baseTouches[1]?"block":"none",this.touches[0]&&(this.debugState.touches[0].style.transform=`translate(${this.touches[0]?.x}px, ${this.touches[0]?.y}px)`),this.touches[1]&&(this.debugState.touches[1].style.transform=`translate(${this.touches[1]?.x}px, ${this.touches[1]?.y}px)`),this.baseTouches[0]&&(this.debugState.baseTouches[0].style.transform=`translate(${this.baseTouches[0]?.x}px, ${this.baseTouches[0]?.y}px)`),this.baseTouches[1]&&(this.debugState.baseTouches[1].style.transform=`translate(${this.baseTouches[1]?.x}px, ${this.baseTouches[1]?.y}px)`),this.debugState.value=this.debugValueDiv(this.debugState.value,e,this.touches)}debugValueDiv(e,t,r,n){if(!e){const[t,r,o]=n??[128,128,128];(e=document.createElement("div")).style.position="fixed",e.style.top="50px",e.style.left="50px",e.style.width="300px",e.style.height="100px",e.style.border=`3px solid rgb(${t},${r},${o})`,e.style.borderStyle="dashed",e.style.backgroundColor=`rgba(${t},${r},${o}, 0.5)`,e.style.transformOrigin="center",e.style.overflow="visible",e.style.textOverflow="visible",e.style.display="none",document.body.appendChild(e)}return this.active?e.style.borderStyle="solid":e.style.borderStyle="dashed",0===r.length?(e.style.display="none",e):(e.style.display="block",e.innerHTML=t,e)}resetBaseTouches(){this.baseTouches=this.touches.map(bn)}process(e){if("touchcancel"===e)return this.resetBaseTouches(),this.reset(),this.debug(),void this.emit(2);"touchstart"!==e&&"touchend"!==e||(this.resetBaseTouches(),this.debug()),!this.active&&this.shouldStart()&&(this.active=!0,this.emit(0)),"touchmove"===e&&(this.currentTransform=this.calculateTransform(),this.active&&this.emit(1)),this.debug(),this.active&&this.shouldStop()&&(this.active=!1,this.emit(2),this.reset())}shouldStart(){return 2===this.touches.length}shouldStop(){return 2!==this.touches.length}emit(e){const t={timestamp:this.timestamp,state:e,touchPoints:this.touches},r=this.makeEvent(t);for(const e of this.handlers)e(r)}handlers=new Set;addListener(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}reset(){this.active=!1,this.currentTransform=this.emptyTransform()}};function bn(e){if(null!=e)return e instanceof Touch?{identifier:e.identifier,x:e.clientX,y:e.clientY}:{identifier:e.identifier,x:e.x,y:e.y}}var vn=class _PanRecognizer extends yn{static PAN_THRESHOLD=10;makeEvent(e){const t=0===e.state?{x:0,y:0}:this.currentTransform;return{...e,panDistance:t}}calculateTransform(){const e=_n(this.touches),t=_n(this.baseTouches);return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return super.shouldStart()&&wn(this.calculateTransform())>_PanRecognizer.PAN_THRESHOLD}};function wn(e){return Math.sqrt(e.x**2+e.y**2)}function _n(e){let t=0,r=0;for(let n=0;n<e.length;n++){const o=e[n];t+=o.x,r+=o.y}return t/=e.length,r/=e.length,{x:t,y:r}}var En=class _PinchRecognizer extends yn{static PINCH_THRESHOLD=.2;makeEvent(e){return{...e,scale:this.currentTransform}}calculateTransform(){const e=this.baseTouches,t=this.touches;if(2!==e.length||2!==t.length)return 1;const r=Math.sqrt(Math.pow(e[0].x-e[1].x,2)+Math.pow(e[0].y-e[1].y,2));return Math.sqrt(Math.pow(t[0].x-t[1].x,2)+Math.pow(t[0].y-t[1].y,2))/r}emptyTransform(){return 1}shouldStart(){return super.shouldStart()&&Math.abs(this.calculateTransform()-1)>_PinchRecognizer.PINCH_THRESHOLD}},Sn=class _PointRecognizer extends yn{static DISTANCE_THRESHOLD=5;static TAP_MAX_TIME=250;lastPosition={x:0,y:0};makeEvent(e){const t=this.tapDetected?this.tapLocation:e.touchPoints[0];return 0===e.state?(this.lastPosition=t,{button:0,state:1,position:t,shiftIsHeld:!1,isTouch:!0,timestamp:e.timestamp}):2===e.state?{button:0,state:0,position:t??this.lastPosition,shiftIsHeld:!1,isTouch:!0,timestamp:e.timestamp}:(this.lastPosition=t,{position:t,isTouch:!0,timestamp:e.timestamp})}previousNumTouches=0;fingerDownTimestamp=0;tapDetected=!1;tapLocation={x:0,y:0};process(e){if("touchstart"===e||"touchend"===e){this.tapDetected=!1;const e=1===this.touches.length&&0===this.previousNumTouches,t=0===this.touches.length&&1===this.previousNumTouches;e&&(this.fingerDownTimestamp=performance.now(),this.tapLocation=this.touches[0]),t&&performance.now()-this.fingerDownTimestamp<_PointRecognizer.TAP_MAX_TIME&&(this.tapDetected=!0),this.previousNumTouches=this.touches.length}super.process(e)}calculateTransform(){if(0===this.touches.length||0===this.baseTouches.length)return{x:0,y:0};const e=this.touches[0],t=this.baseTouches[0];return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return this.tapDetected||1===this.touches.length&&wn(this.calculateTransform())>_PointRecognizer.DISTANCE_THRESHOLD}shouldStop(){return 1!==this.touches.length}},Cn=class _RotateRecognizer extends yn{static ROTATE_THRESHOLD=.1;makeEvent(e){return{...e,rotation:this.currentTransform}}calculateTransform(){const e=this.baseTouches,t=this.touches;if(e.length<2||t.length<2)return 0;const r=Math.atan2(e[1].y-e[0].y,e[1].x-e[0].x);return Math.atan2(t[1].y-t[0].y,t[1].x-t[0].x)-r}emptyTransform(){return 0}shouldStart(){return super.shouldStart()&&Math.abs(this.calculateTransform())>_RotateRecognizer.ROTATE_THRESHOLD}};function xn(e,t){const r=[],n=new Sn;r.push(n.listen(e)),r.push(n.addListener((r=>{"button"in r?t.execute("ubq/inputs/mousebutton",kn(e,r)):t.execute("ubq/inputs/mousemove",kn(e,r))})));const o=new vn;r.push(o.listen(e)),r.push(o.addListener((r=>{t.execute("ubq/inputs/touchpan",kn(e,r))})));const i=new En;r.push(i.listen(e)),r.push(i.addListener((r=>{t.execute("ubq/inputs/touchpinch",kn(e,r))})));const a=new Cn;return r.push(a.listen(e)),r.push(a.addListener((r=>{t.execute("ubq/inputs/touchrotate",kn(e,r))}))),()=>{r.forEach((e=>e()))}}function kn(e,t){const r=window.devicePixelRatio??1,{top:n,left:o}=e.getBoundingClientRect();if(1===r&&0===n&&0===o)return t;const i=e=>({x:(e.x-o)*r,y:(e.y-n)*r});if("position"in t)return{...t,position:i(t.position)};const a=t.touchPoints.map(i);return"panDistance"in t?{...t,touchPoints:a,panDistance:i(t.panDistance)}:{...t,touchPoints:a}}function Tn(e,t,r=Number.EPSILON){return Math.abs(e-t)<r}var An,Pn,qn="assets/core/worker-host-v1.23.0-rc.1-4CJ4F5AT.js",Fn="application/javascript";(Pn=An||(An={})).start=function(e){return{...e,msg:"exportVideo"}},Pn.abort=function(){return{msg:"exportVideoAbort"}},Pn.finished=function(e){return{...e,msg:"exportVideoFinished"}},Pn.error=function(e){return{...e,msg:"exportVideoError"}},Pn.progress=function(e){return{...e,msg:"exportVideoProgress"}},Pn.log=function(e){return{...e,msg:"exportLog"}};var Ln=class{configuration;constructor(e){this.configuration=e}async exportVideo(e,t,r,n,o,i){const{abortSignal:a,inactivityTimeout:s}=o??{},u=await async function(e){const t=qn.toString().split("/").pop(),r=await async function(e){if(!(e=e.toString()).includes("://")||e.includes(window.location.origin))return e;const t=`const _importScripts = importScripts;\n const _fixImports = (url) => new URL(url, '${new URL(e).href.split("/").slice(0,-1).join("/")}/').href;\n importScripts = (...urls) => _importScripts(...urls.map(_fixImports));`;return URL.createObjectURL(new Blob([`${t}importScripts("${e}")`],{type:Fn}))}(new URL(t,e.core.baseURL));return new Worker(r)}(this.configuration),c=function(e){return{baseURL:e.baseURL,license:e.license,core:e.core,presets:e.presets,featureFlags:e.featureFlags,forceWebGL1:e.forceWebGL1,audioOutput:e.audioOutput,extensions:e.extensions}}(this.configuration),l=new Promise(((e,t)=>{if(u.onmessage=({data:r})=>{if("exportVideoFinished"===r.msg){const t=new Blob([r.data],{type:r.mimeType});e(t)}else"exportVideoError"===r.msg?t(r.error):"exportVideoProgress"===r.msg?o?.onProgress?.(r.renderedFrames,r.encodedFrames,r.totalFrames):"exportLog"===r.msg?this.configuration.logger(r.message,r.logLevel):console.error("Unknown message received ",r)},a){let e=!1;const t=()=>{e||(e=!0,u.postMessage(An.abort()))};a.addEventListener("abort",t,{once:!0})}}));u.postMessage(An.start({sceneString:e,engineSettings:t,pluginURLs:r,config:c,exportOptions:n,workerOptions:i,inactivityTimeout:s}));const d=()=>{u.postMessage({msg:"setVisibility",visible:"visible"===document.visibilityState})};return document.addEventListener("visibilitychange",d),l.finally((()=>{u.terminate(),document.removeEventListener("visibilitychange",d)})),l}};var Dn=10,Bn=1e4;globalThis.ubq_browserTabHidden=!0;var Rn={value:()=>"undefined"==typeof document||"visible"===document.visibilityState,subscribe(e){if("undefined"==typeof document)return()=>{};{const t=()=>{e("visible"===document.visibilityState)};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}}};function Mn(e,t,r){return async(n,o,i,a)=>{const s=t.scene.get();if(null==s||!t.block.isValid(s))throw new Error("No valid scene available.");const u=await t.scene.saveToString(),c=function(e){const t=new Map,r=e.findAllSettings();for(const n of r)switch(e.getSettingType(n)){case"Bool":t.set(n,e.getSettingBool(n));break;case"Int":t.set(n,e.getSettingInt(n));break;case"Float":t.set(n,e.getSettingFloat(n));break;case"String":t.set(n,e.getSettingString(n));break;case"Color":t.set(n,e.getSettingColor(n));break;case"Enum":t.set(n,e.getSettingEnum(n))}return t}(t.editor),l=t.settings.unstable_videoExportInactivityTimeout.value(),d=t.editor.getActiveLicense(),p={};try{p.trackingMetadata=t.editor.getTrackingMetadata()}catch{p.trackingMetadata=void 0}const h={block:n,width:a.targetWidth,height:a.targetHeight,...a};if(e.featureFlags?.exportWorker??1){return new Ln({...e,license:d}).exportVideo(u,c,r,h,{abortSignal:a.abortSignal,inactivityTimeout:l,onProgress:i},p)}return async function(e,t,r,n,o={},i,a){let s,u,c=0,l=null;const d=a?.visibility??Rn;globalThis.ubq_exportVideoTimeout=a?.inactivityTimeout;const p=d.subscribe((()=>{null!==l&&(l=Date.now()),globalThis.ubq_browserTabHidden=!d.value()}));let h=null;function f(){clearTimeout(u),p(),h?.()}try{let p=function(){if(!0===d.value()&&null!==l&&Date.now()-l>Bn)s(new Error("Video export timed out due to inactivity."));else{if(c<Dn){for(const e of S)e.update?.(C);g.update()}u=setTimeout(p,1)}};const m=new OffscreenCanvas(64,64),g=await rn(m,{...e,audioOutput:"none"}),y=new AssetAPI(g),b=new SceneAPI(g),v=new BlockAPI(g),w=new EditorAPI(g),_=new EventAPI(g),E=new VariableAPI(g);h=()=>{g.delete()},function(e,t){for(const[r,n]of t)switch(e.getSettingType(r)){case"Bool":e.setSettingBool(r,n);break;case"Int":e.setSettingInt(r,n);break;case"Float":e.setSettingFloat(r,n);break;case"String":e.setSettingString(r,n);break;case"Color":e.setSettingColor(r,n);break;case"Enum":{const t=r,o=n;e.setSettingEnum(t,o)}}}(w,t),i?.trackingMetadata&&w.setTrackingMetadata(i.trackingMetadata);const S=await Promise.all(r.map((e=>nn(e)))),C={asset:y,block:v,scene:b,editor:w,event:_,variable:E};for(const e of S)e.initialize?.(C);const x=await b.loadFromString(n),k=o.block?v.getDuration(o.block):v.getTotalSceneDuration(b.get());p();const T=await new Promise(((t,r)=>{s=r,e.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),g.exportVideoToBuffer(o.block??x,o.timeOffset??0,o.duration??k,tr.Mp4,((e,t,r)=>{c=e-t,l=Date.now(),a?.onProgress?.(e,t,r)}),(e=>{"error"in e?r(e.error):t(e)}),{h264Profile:o.h264Profile??77,h264Level:o.h264Level??52,framerate:o.framerate??30,useTargetSize:void 0!==o.width&&void 0!==o.height,targetWidth:o.width??0,targetHeight:o.height??0})})),A=new Uint8Array(T.byteLength);return A.set(T),f(),A}catch(e){throw f(),e}}(a.abortSignal?{...e,abortSignal:a.abortSignal}:e,c,r,u,h,p,{onProgress:i,visibility:go,inactivityTimeout:l}).then((e=>new Blob([e],{type:tr.Mp4})))}}var In,On,jn,Un,$n,Nn,Hn,Vn,Wn,zn,Gn,Yn,Xn,Zn,Kn,Qn,Jn,eo,to,ro,no,oo,io,ao,so,uo,co,lo,po,ho,fo,mo,go={value:()=>"visible"===document.visibilityState,subscribe:ur((In=document,On="visibilitychange",function(e){return In.addEventListener(On,e),function(){In.removeEventListener(On,e)}}),or((()=>"visible"===document.visibilityState)))},CreativeEngine=class{constructor(e,t,r){p(this,Xn),p(this,Kn),p(this,to),p(this,no),p(this,io),p(this,co),p(this,po),p(this,fo),c(this,"asset"),c(this,"block"),c(this,"editor"),c(this,"event"),c(this,"scene"),c(this,"variable"),p(this,jn,void 0),c(this,"reactor"),p(this,Un,void 0),p(this,$n,void 0),p(this,Nn,void 0),p(this,Hn,void 0),p(this,Vn,void 0),p(this,Wn,[]),p(this,zn,[]),p(this,Gn,void 0),p(this,Yn,[]),p(this,Jn,[]),p(this,eo,void 0),p(this,so,(0,dt.default)(function(){f(this,po,ho).call(this)}.bind(this),100,{leading:!0,trailing:!1})),p(this,uo,void 0),h(this,Gn,e),h(this,$n,new bt(e)),this.asset=new AssetAPI(e),this.block=new BlockAPI(e),this.editor=new EditorAPI(e),this.event=new EventAPI(e),this.scene=new SceneAPI(e),this.variable=new VariableAPI(e),h(this,jn,new xr(this.editor)),h(this,Vn,new gn(this,e)),d(this,Yn).push(d(this,Vn).dispose);const n=new cn;this.reactor=n;const o=[this.reactor.decorateObject(d(this,$n)),this.reactor.decorateObject(this.block),this.reactor.decorateObject(this.editor),this.reactor.decorateObject(this.scene)],i=this.addPostUpdateCallback(n.updateDirtyReactions.bind(n));d(this,Yn).push((()=>{o.forEach((e=>e())),i(),this.reactor.dispose()})),this.block.exportVideo=Mn(r,{block:this.block,scene:this.scene,editor:this.editor,settings:d(this,jn)},d(this,Wn)),"getInternalCanvas"in t?(h(this,Nn,t.getInternalCanvas()),h(this,Hn,t)):h(this,Nn,t),h(this,Un,new $r(this)),f(this,to,ro).call(this),"undefined"!=typeof window&&window.Cypress&&(this.config=r,this.helper=d(this,$n))}async unstable_addPlugin(e){null!=e.url&&d(this,Wn).push(e.url);const t=e.url?await nn(e.url):e;if(t.initialize){const e={asset:this.asset,block:this.block,scene:this.scene,editor:this.editor,event:this.event,variable:this.variable};t.initialize(e)}d(this,zn).push(t)}unstable_setVideoExportInactivityTimeout(e){d(this,jn).unstable_videoExportInactivityTimeout.update(e)}addPostUpdateCallback(e){return d(this,Jn).push(e),()=>{const t=d(this,Jn).indexOf(e);-1!==t&&d(this,Jn).splice(t,1)}}setWheelEventTarget(e){return d(this,Vn).setTarget(e)}get element(){return d(this,Hn)}dispose(){d(this,Yn).forEach((e=>e())),f(this,co,lo).call(this),this.asset.dispose(),h(this,Nn,null),d(this,Hn)?.dispose(),h(this,Hn,void 0),h(this,$n,null),this.block=null,this.scene=null,this.variable=null,this.asset=null,this.editor=null,this.event=null,d(this,Jn).length=0,d(this,Gn).delete(),h(this,Gn,null)}static async init(e,t){let r=function(e,t){if(r(t?.canvas))return t?.canvas;if(r(e))return console.warn("Passing an existing HTMLCanvasElement as a second parameter to CreativeEngine.init() is deprecated. Use the element property on the CreativeEngine instance to access a fully managed canvas to append into the DOM instead. For more information, have a look into our documentation at https://img.ly/docs/cesdk/next/engine/quickstart/#initialization."),e;return;function r(e){return"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement}}(t,e);const n="12f402675b";let o;n&&console.log(`[CreativeEngine] Revision ${n}`),r||(o=function(){customElements.get("cesdk-canvas")||customElements.define("cesdk-canvas",class HTMLCreativeEngineCanvasElement extends HTMLElement{#o;constructor(){super(),this.#o=document.createElement("canvas");const e=document.createElement("style");e.textContent=":host {display: block; width: 100%; height: 100%; contain: content;} canvas {position: absolute; inset: 0; width: 100%; height:100%; display: block; touch-action: none;}",this.attachShadow({mode:"closed"}).append(e,this.#o)}getInternalCanvas(){if(!this.#o)throw new Error("Internal canvas element is undefined");return this.#o}dispose(){this.#o?.remove(),this.#o=void 0}clear(){if(!this.#o)return;const e=this.#o.width;this.#o.width=1,this.#o.width=e}});return document.createElement("cesdk-canvas")}(),r=o.getInternalCanvas());const i=function(e){return e&&"callbacks"in e&&e.callbacks?.log&&!e.logger?{...e,logger:e.callbacks.log}:e}(e),a=function(e={},t="https://cdn.img.ly/packages/imgly/cesdk-engine/1.23.0-rc.1/assets"){const r={...e,license:e.license??"",featureFlags:e.featureFlags??{},baseURL:e.baseURL??t,core:e.core??{baseURL:"core/"},extensions:e.extensions??{...Ar},logger:e.logger??Tr,presets:e.presets??{}};return r.extensions.baseURL??=Ar.baseURL,r.extensions.entries??={...Ar.entries},r.baseURL=Pr(r.baseURL),r.baseURL=qr(r.baseURL),r.core.baseURL=Pr(r.core.baseURL,r.baseURL),r.core.baseURL=qr(r.core.baseURL),r.extensions.baseURL=qr(r.extensions.baseURL),r.extensions.entries=r.extensions.entries.map((e=>qr(e))),r}(i);if(!function(e){return!0===e?._skipConfigWarnings}(e))for(const t of function(e){const t=[];return e?("callbacks"in e&&e.callbacks?.log&&t.push("config.callbacks.log has been moved to config.logger"),e.scene&&t.push("config.scene options have been removed. You can set a scene's dpi and pixelScaleFactor via the BlockApi's setInt(sceneId, 'scene/dpi', dpi) and setInt(sceneId, 'scene/pixelScaleFactor', factor)."),e.page&&t.push("config.page options have been moved to the EditorAPI"),e.variables&&t.push("config.variables has been removed. Please use the VariableAPI instead"),t):t}(e))a.logger(t,"Warning");const s=new this(await rn(r,a),o??r,a);return function(e,t){if(e)try{const r=t.editor;if(null!=e.page?.title?.show&&r.setSettingBool("page/title/show",e.page.title.show),null!=e.page?.title?.fontFileUri&&r.setSettingString("page/title/fontFileUri",e.page?.title?.fontFileUri),null!=e.page?.dimOutOfPageAreas&&r.setSettingBool("page/dimOutOfPageAreas",e.page?.dimOutOfPageAreas),e.variables)for(const r in e.variables)if(Object.prototype.hasOwnProperty.call(e.variables,r)){const n=e.variables[r];t.variable.setString(r,String(n.value))}}catch(e){console.error(e)}}(e,s),s}async addDefaultAssetSources({baseURL:e="https://cdn.img.ly/assets/v2",excludeAssetSourceIds:t=[]}={}){return Lr(this.asset,e,t)}async addDemoAssetSources({baseURL:e="https://cdn.img.ly/assets/demo/v2",excludeAssetSourceIds:t=[],sceneMode:r="Design",withUploadAssetSources:n=!1}={}){return Dr(this.asset,this.scene,t,r,n,void 0,e)}get _ubq(){return d(this,Gn)}get _camera(){return d(this,Un)}get _helper(){return d(this,$n)}};jn=new WeakMap,Un=new WeakMap,$n=new WeakMap,Nn=new WeakMap,Hn=new WeakMap,Vn=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Gn=new WeakMap,Yn=new WeakMap,Xn=new WeakSet,Zn=function(){if(!d(this,Hn))return;const e=d(this,Hn).getInternalCanvas(),t=e.getBoundingClientRect();if(0===t.width||0===t.height)return;const r="undefined"!=typeof window?window.devicePixelRatio:1,n=t.width*r,o=t.height*r;e.width!==n&&(e.width=n),e.height!==o&&(e.height=o)},Kn=new WeakSet,Qn=function(){const{width:e,height:t}=d(this,Nn),r="undefined"!=typeof window?window.devicePixelRatio:1,{height:n,width:o,pixelRatio:i}=d(this,Un).settings.value();Tn(o,e,1e-4)&&Tn(n,t,1e-4)&&Tn(i,r,1e-4)||d(this,Un).settings.update({height:t,width:e,pixelRatio:window.devicePixelRatio})},Jn=new WeakMap,eo=new WeakMap,to=new WeakSet,ro=function(e=!0){f(this,no,oo).call(this,e),f(this,io,ao).call(this)},no=new WeakSet,oo=function(e=!0){let t,r=!1,n=0;if(d(this,eo))return;const o=()=>{if(h(this,eo,requestAnimationFrame(o)),!r)try{f(this,po,ho).call(this,e),n=0}catch(e){throw n++,n>=10&&(console.error("Repeated exceptions in update loop. Stopping loop."),t?.(),f(this,co,lo).call(this)),e}};h(this,eo,requestAnimationFrame(o))},io=new WeakSet,ao=function(){if(e=d(this,Nn),!("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement))return;var e;const t=d(this,Hn)??d(this,Nn),r=f(this,po,ho).bind(this,!1),n=[hn(t,d(this,$n),r),d(this,Vn).initialize(t),pn(t,d(this,$n),this.editor,r),dn(t,this.editor),xn(t,d(this,$n)),Nr(d(this,Nn),d(this,Gn),(()=>{d(this,Nn).width=d(this,Nn).width})),Br(t,d(this,so))];h(this,uo,(()=>{n.reverse().forEach((e=>e()))}))},so=new WeakMap,uo=new WeakMap,co=new WeakSet,lo=function(){var e;null==(e=d(this,uo))||e.call(this),h(this,uo,void 0),d(this,eo)&&(cancelAnimationFrame(d(this,eo)),h(this,eo,0))},po=new WeakSet,ho=function(e=!0){for(const e of d(this,zn))e.update?.(this);if(e){1===this.block.findByType("scene").length&&f(this,fo,mo).call(this)}f(this,Xn,Zn).call(this),f(this,Kn,Qn).call(this),d(this,Gn).update();for(const e of d(this,Jn))e()},fo=new WeakSet,mo=function(){if(d(this,Un).clampCamera){const e={sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}};d(this,$n).execute("cesdk/clampCameraAndRender",{horizontalPaddingInPixels:this._camera.viewportPadding.value().x,verticalPaddingInPixels:this._camera.viewportPadding.value().y}).then((e=>{(0,pt.default)(d(this,Un).clampResult.value(),e)||d(this,Un).clampResult.update(e)}),(()=>{(0,pt.default)(d(this,Un).clampResult.value(),e)||d(this,Un).clampResult.update(e)}))}else d(this,$n).execute("ubq/render")};var yo=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){return console.error(e),!1}return!1},bo=1e4,vo=1e6;async function wo(){if("undefined"==typeof window)throw new Error("Window is undefined");if(!("VideoFrame"in window&&"VideoDecoder"in window&&"VideoEncoder"in window))throw new Error("Missing required web video APIs");const e={codec:"avc1.4D0034",width:1920,height:1080,avc:{format:"annexb"},framerate:30};if(!await VideoEncoder.isConfigSupported(e))throw new Error("Encoder config not supported");const t=new OffscreenCanvas(e.width,e.height),r=t.getContext("webgl2");if(!r)throw new Error("Could not create WebGL2 context");return r.clearColor(1,0,1,1),r.clear(r.COLOR_BUFFER_BIT),new Promise(((r,n)=>{setTimeout((()=>{n(new Error("Timed out during video export"))}),bo);const o=new VideoEncoder({output:()=>r(!0),error:e=>n(e)});o.configure(e);const i=new VideoFrame(t,{timestamp:0,duration:vo/e.framerate});o.encode(i,{keyFrame:!0}),i.close(),o.flush().then((()=>{"closed"!==o.state&&o.close()}))}))}async function _o(){if("undefined"==typeof window)throw new Error("Window is undefined");if(!("AudioDecoder"in window&&"AudioEncoder"in window))throw new Error("Missing required web audio APIs");const e={codec:"mp4a.40.02",sampleRate:48e3,numberOfChannels:2,bitrate:128e3};if(!await AudioEncoder.isConfigSupported(e))throw new Error("Encoder config not supported");return new Promise(((t,r)=>{setTimeout((()=>{r(new Error("Timed out during audio export"))}),bo);const n=new AudioEncoder({output:()=>t(!0),error:r});n.configure(e);const o=1024,i=new Float32Array(o*e.numberOfChannels);for(let e=0;e<o;++e){const t=e/o;i[2*e+0]=Math.sin(880*Math.PI*t),i[2*e+1]=Math.sin(888*Math.PI*t)}for(let t=0;t<10;++t){const r=new AudioData({format:"f32",sampleRate:e.sampleRate,numberOfFrames:o,numberOfChannels:e.numberOfChannels,timestamp:t*o/e.sampleRate*vo,data:i});n.encode(r),r.close()}n.flush().then((()=>{"closed"!==n.state&&n.close()}))}))}function Eo(){if("undefined"==typeof window)return!1;return"VideoFrame"in window&&"VideoDecoder"in window&&"VideoEncoder"in window&&"AudioDecoder"in window&&"AudioEncoder"in window}function So(){return Promise.all([wo(),_o()]).then((e=>e.every((e=>e))),(()=>!1))}var Co=function(){try{const e=!0,t=!0,r="globalThis"in window,n="BigInt"in window,o="allSettled"in Promise,i="matchAll"in String.prototype,a=CSS.supports("(display: flex) and (gap: 8px)"),s="MediaRecorder"in window&&"pause"in window.MediaRecorder.prototype,u=CSS.supports("selector(:not(a, .b))"),c=CSS.supports("selector(:is(a))");return yo()&&e&&t&&r&&n&&o&&i&&a&&s&&u&&c}catch{return!1}};export{kr as LogLevel,tr as MimeType,Ln as WorkerClient,CreativeEngine as default,Co as supportsBrowser,Eo as supportsVideo,So as supportsVideoExport,yo as supportsWasm};
1
+ var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,a=(e,t)=>function(){return t||(0,e[n(e)[0]])((t={exports:{}}).exports,t),t.exports},s=(a,s,u)=>(u=null!=a?e(o(a)):{},((e,o,a,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let u of n(o))i.call(e,u)||u===a||t(e,u,{get:()=>o[u],enumerable:!(s=r(o,u))||s.enumerable});return e})(!s&&a&&a.__esModule?u:t(u,"default",{value:a,enumerable:!0}),a)),u=(e,n,o,i)=>{for(var a,s=i>1?void 0:i?r(n,o):n,u=e.length-1;u>=0;u--)(a=e[u])&&(s=(i?a(n,o,s):a(s))||s);return i&&s&&t(n,o,s),s},c=(e,r,n)=>(((e,r,n)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n})(e,"symbol"!=typeof r?r+"":r,n),n),l=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},d=(e,t,r)=>(l(e,t,"read from private field"),r?r.call(e):t.get(e)),p=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},h=(e,t,r,n)=>(l(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),f=(e,t,r)=>(l(e,t,"access private method"),r),m=a({"../../../node_modules/lodash/isObject.js"(e,t){t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}}),g=a({"../../../node_modules/lodash/_freeGlobal.js"(e,t){var r="object"==typeof global&&global&&global.Object===Object&&global;t.exports=r}}),y=a({"../../../node_modules/lodash/_root.js"(e,t){var r=g(),n="object"==typeof self&&self&&self.Object===Object&&self,o=r||n||Function("return this")();t.exports=o}}),b=a({"../../../node_modules/lodash/now.js"(e,t){var r=y();t.exports=function(){return r.Date.now()}}}),v=a({"../../../node_modules/lodash/_trimmedEndIndex.js"(e,t){var r=/\s/;t.exports=function(e){for(var t=e.length;t--&&r.test(e.charAt(t)););return t}}}),w=a({"../../../node_modules/lodash/_baseTrim.js"(e,t){var r=v(),n=/^\s+/;t.exports=function(e){return e?e.slice(0,r(e)+1).replace(n,""):e}}}),_=a({"../../../node_modules/lodash/_Symbol.js"(e,t){var r=y().Symbol;t.exports=r}}),E=a({"../../../node_modules/lodash/_getRawTag.js"(e,t){var r=_(),n=Object.prototype,o=n.hasOwnProperty,i=n.toString,a=r?r.toStringTag:void 0;t.exports=function(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var n=!0}catch(e){}var s=i.call(e);return n&&(t?e[a]=r:delete e[a]),s}}}),S=a({"../../../node_modules/lodash/_objectToString.js"(e,t){var r=Object.prototype.toString;t.exports=function(e){return r.call(e)}}}),C=a({"../../../node_modules/lodash/_baseGetTag.js"(e,t){var r=_(),n=E(),o=S(),i=r?r.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":i&&i in Object(e)?n(e):o(e)}}}),x=a({"../../../node_modules/lodash/isObjectLike.js"(e,t){t.exports=function(e){return null!=e&&"object"==typeof e}}}),k=a({"../../../node_modules/lodash/isSymbol.js"(e,t){var r=C(),n=x();t.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==r(e)}}}),T=a({"../../../node_modules/lodash/toNumber.js"(e,t){var r=w(),n=m(),o=k(),i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,u=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=r(e);var c=a.test(e);return c||s.test(e)?u(e.slice(2),c?2:8):i.test(e)?NaN:+e}}}),A=a({"../../../node_modules/lodash/debounce.js"(e,t){var r=m(),n=b(),o=T(),i=Math.max,a=Math.min;t.exports=function(e,t,s){var u,c,l,d,p,h,f=0,m=!1,g=!1,y=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function b(t){var r=u,n=c;return u=c=void 0,f=t,d=e.apply(n,r)}function v(e){var r=e-h;return void 0===h||r>=t||r<0||g&&e-f>=l}function w(){var e=n();if(v(e))return _(e);p=setTimeout(w,function(e){var r=t-(e-h);return g?a(r,l-(e-f)):r}(e))}function _(e){return p=void 0,y&&u?b(e):(u=c=void 0,d)}function E(){var e=n(),r=v(e);if(u=arguments,c=this,h=e,r){if(void 0===p)return function(e){return f=e,p=setTimeout(w,t),m?b(e):d}(h);if(g)return clearTimeout(p),p=setTimeout(w,t),b(h)}return void 0===p&&(p=setTimeout(w,t)),d}return t=o(t)||0,r(s)&&(m=!!s.leading,l=(g="maxWait"in s)?i(o(s.maxWait)||0,t):l,y="trailing"in s?!!s.trailing:y),E.cancel=function(){void 0!==p&&clearTimeout(p),f=0,u=h=c=p=void 0},E.flush=function(){return void 0===p?d:_(n())},E}}}),P=a({"../../../node_modules/lodash/_listCacheClear.js"(e,t){t.exports=function(){this.__data__=[],this.size=0}}}),q=a({"../../../node_modules/lodash/eq.js"(e,t){t.exports=function(e,t){return e===t||e!=e&&t!=t}}}),F=a({"../../../node_modules/lodash/_assocIndexOf.js"(e,t){var r=q();t.exports=function(e,t){for(var n=e.length;n--;)if(r(e[n][0],t))return n;return-1}}}),L=a({"../../../node_modules/lodash/_listCacheDelete.js"(e,t){var r=F(),n=Array.prototype.splice;t.exports=function(e){var t=this.__data__,o=r(t,e);return!(o<0)&&(o==t.length-1?t.pop():n.call(t,o,1),--this.size,!0)}}}),D=a({"../../../node_modules/lodash/_listCacheGet.js"(e,t){var r=F();t.exports=function(e){var t=this.__data__,n=r(t,e);return n<0?void 0:t[n][1]}}}),B=a({"../../../node_modules/lodash/_listCacheHas.js"(e,t){var r=F();t.exports=function(e){return r(this.__data__,e)>-1}}}),R=a({"../../../node_modules/lodash/_listCacheSet.js"(e,t){var r=F();t.exports=function(e,t){var n=this.__data__,o=r(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this}}}),M=a({"../../../node_modules/lodash/_ListCache.js"(e,t){var r=P(),n=L(),o=D(),i=B(),a=R();function s(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}s.prototype.clear=r,s.prototype.delete=n,s.prototype.get=o,s.prototype.has=i,s.prototype.set=a,t.exports=s}}),O=a({"../../../node_modules/lodash/_stackClear.js"(e,t){var r=M();t.exports=function(){this.__data__=new r,this.size=0}}}),I=a({"../../../node_modules/lodash/_stackDelete.js"(e,t){t.exports=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}}}),j=a({"../../../node_modules/lodash/_stackGet.js"(e,t){t.exports=function(e){return this.__data__.get(e)}}}),U=a({"../../../node_modules/lodash/_stackHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),$=a({"../../../node_modules/lodash/isFunction.js"(e,t){var r=C(),n=m();t.exports=function(e){if(!n(e))return!1;var t=r(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}}}),N=a({"../../../node_modules/lodash/_coreJsData.js"(e,t){var r=y()["__core-js_shared__"];t.exports=r}}),H=a({"../../../node_modules/lodash/_isMasked.js"(e,t){var r,n=N(),o=(r=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(e){return!!o&&o in e}}}),V=a({"../../../node_modules/lodash/_toSource.js"(e,t){var r=Function.prototype.toString;t.exports=function(e){if(null!=e){try{return r.call(e)}catch(e){}try{return e+""}catch(e){}}return""}}}),W=a({"../../../node_modules/lodash/_baseIsNative.js"(e,t){var r=$(),n=H(),o=m(),i=V(),a=/^\[object .+?Constructor\]$/,s=Function.prototype,u=Object.prototype,c=s.toString,l=u.hasOwnProperty,d=RegExp("^"+c.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(e){return!(!o(e)||n(e))&&(r(e)?d:a).test(i(e))}}}),z=a({"../../../node_modules/lodash/_getValue.js"(e,t){t.exports=function(e,t){return null==e?void 0:e[t]}}}),G=a({"../../../node_modules/lodash/_getNative.js"(e,t){var r=W(),n=z();t.exports=function(e,t){var o=n(e,t);return r(o)?o:void 0}}}),Y=a({"../../../node_modules/lodash/_Map.js"(e,t){var r=G()(y(),"Map");t.exports=r}}),X=a({"../../../node_modules/lodash/_nativeCreate.js"(e,t){var r=G()(Object,"create");t.exports=r}}),Z=a({"../../../node_modules/lodash/_hashClear.js"(e,t){var r=X();t.exports=function(){this.__data__=r?r(null):{},this.size=0}}}),K=a({"../../../node_modules/lodash/_hashDelete.js"(e,t){t.exports=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}}}),Q=a({"../../../node_modules/lodash/_hashGet.js"(e,t){var r=X(),n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;if(r){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(t,e)?t[e]:void 0}}}),J=a({"../../../node_modules/lodash/_hashHas.js"(e,t){var r=X(),n=Object.prototype.hasOwnProperty;t.exports=function(e){var t=this.__data__;return r?void 0!==t[e]:n.call(t,e)}}}),ee=a({"../../../node_modules/lodash/_hashSet.js"(e,t){var r=X();t.exports=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=r&&void 0===t?"__lodash_hash_undefined__":t,this}}}),te=a({"../../../node_modules/lodash/_Hash.js"(e,t){var r=Z(),n=K(),o=Q(),i=J(),a=ee();function s(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}s.prototype.clear=r,s.prototype.delete=n,s.prototype.get=o,s.prototype.has=i,s.prototype.set=a,t.exports=s}}),re=a({"../../../node_modules/lodash/_mapCacheClear.js"(e,t){var r=te(),n=M(),o=Y();t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(o||n),string:new r}}}}),ne=a({"../../../node_modules/lodash/_isKeyable.js"(e,t){t.exports=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}}}),oe=a({"../../../node_modules/lodash/_getMapData.js"(e,t){var r=ne();t.exports=function(e,t){var n=e.__data__;return r(t)?n["string"==typeof t?"string":"hash"]:n.map}}}),ie=a({"../../../node_modules/lodash/_mapCacheDelete.js"(e,t){var r=oe();t.exports=function(e){var t=r(this,e).delete(e);return this.size-=t?1:0,t}}}),ae=a({"../../../node_modules/lodash/_mapCacheGet.js"(e,t){var r=oe();t.exports=function(e){return r(this,e).get(e)}}}),se=a({"../../../node_modules/lodash/_mapCacheHas.js"(e,t){var r=oe();t.exports=function(e){return r(this,e).has(e)}}}),ue=a({"../../../node_modules/lodash/_mapCacheSet.js"(e,t){var r=oe();t.exports=function(e,t){var n=r(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this}}}),ce=a({"../../../node_modules/lodash/_MapCache.js"(e,t){var r=re(),n=ie(),o=ae(),i=se(),a=ue();function s(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}s.prototype.clear=r,s.prototype.delete=n,s.prototype.get=o,s.prototype.has=i,s.prototype.set=a,t.exports=s}}),le=a({"../../../node_modules/lodash/_stackSet.js"(e,t){var r=M(),n=Y(),o=ce();t.exports=function(e,t){var i=this.__data__;if(i instanceof r){var a=i.__data__;if(!n||a.length<199)return a.push([e,t]),this.size=++i.size,this;i=this.__data__=new o(a)}return i.set(e,t),this.size=i.size,this}}}),de=a({"../../../node_modules/lodash/_Stack.js"(e,t){var r=M(),n=O(),o=I(),i=j(),a=U(),s=le();function u(e){var t=this.__data__=new r(e);this.size=t.size}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u}}),pe=a({"../../../node_modules/lodash/_setCacheAdd.js"(e,t){t.exports=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}}}),he=a({"../../../node_modules/lodash/_setCacheHas.js"(e,t){t.exports=function(e){return this.__data__.has(e)}}}),fe=a({"../../../node_modules/lodash/_SetCache.js"(e,t){var r=ce(),n=pe(),o=he();function i(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new r;++t<n;)this.add(e[t])}i.prototype.add=i.prototype.push=n,i.prototype.has=o,t.exports=i}}),me=a({"../../../node_modules/lodash/_arraySome.js"(e,t){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}}}),ge=a({"../../../node_modules/lodash/_cacheHas.js"(e,t){t.exports=function(e,t){return e.has(t)}}}),ye=a({"../../../node_modules/lodash/_equalArrays.js"(e,t){var r=fe(),n=me(),o=ge();t.exports=function(e,t,i,a,s,u){var c=1&i,l=e.length,d=t.length;if(l!=d&&!(c&&d>l))return!1;var p=u.get(e),h=u.get(t);if(p&&h)return p==t&&h==e;var f=-1,m=!0,g=2&i?new r:void 0;for(u.set(e,t),u.set(t,e);++f<l;){var y=e[f],b=t[f];if(a)var v=c?a(b,y,f,t,e,u):a(y,b,f,e,t,u);if(void 0!==v){if(v)continue;m=!1;break}if(g){if(!n(t,(function(e,t){if(!o(g,t)&&(y===e||s(y,e,i,a,u)))return g.push(t)}))){m=!1;break}}else if(y!==b&&!s(y,b,i,a,u)){m=!1;break}}return u.delete(e),u.delete(t),m}}}),be=a({"../../../node_modules/lodash/_Uint8Array.js"(e,t){var r=y().Uint8Array;t.exports=r}}),ve=a({"../../../node_modules/lodash/_mapToArray.js"(e,t){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}}}),we=a({"../../../node_modules/lodash/_setToArray.js"(e,t){t.exports=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}}}),_e=a({"../../../node_modules/lodash/_equalByTag.js"(e,t){var r=_(),n=be(),o=q(),i=ye(),a=ve(),s=we(),u=r?r.prototype:void 0,c=u?u.valueOf:void 0;t.exports=function(e,t,r,u,l,d,p){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!d(new n(e),new n(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return o(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var h=a;case"[object Set]":var f=1&u;if(h||(h=s),e.size!=t.size&&!f)return!1;var m=p.get(e);if(m)return m==t;u|=2,p.set(e,t);var g=i(h(e),h(t),u,l,d,p);return p.delete(e),g;case"[object Symbol]":if(c)return c.call(e)==c.call(t)}return!1}}}),Ee=a({"../../../node_modules/lodash/_arrayPush.js"(e,t){t.exports=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}}}),Se=a({"../../../node_modules/lodash/isArray.js"(e,t){var r=Array.isArray;t.exports=r}}),Ce=a({"../../../node_modules/lodash/_baseGetAllKeys.js"(e,t){var r=Ee(),n=Se();t.exports=function(e,t,o){var i=t(e);return n(e)?i:r(i,o(e))}}}),xe=a({"../../../node_modules/lodash/_arrayFilter.js"(e,t){t.exports=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,i=[];++r<n;){var a=e[r];t(a,r,e)&&(i[o++]=a)}return i}}}),ke=a({"../../../node_modules/lodash/stubArray.js"(e,t){t.exports=function(){return[]}}}),Te=a({"../../../node_modules/lodash/_getSymbols.js"(e,t){var r=xe(),n=ke(),o=Object.prototype.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(e){return null==e?[]:(e=Object(e),r(i(e),(function(t){return o.call(e,t)})))}:n;t.exports=a}}),Ae=a({"../../../node_modules/lodash/_baseTimes.js"(e,t){t.exports=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}}}),Pe=a({"../../../node_modules/lodash/_baseIsArguments.js"(e,t){var r=C(),n=x();t.exports=function(e){return n(e)&&"[object Arguments]"==r(e)}}}),qe=a({"../../../node_modules/lodash/isArguments.js"(e,t){var r=Pe(),n=x(),o=Object.prototype,i=o.hasOwnProperty,a=o.propertyIsEnumerable,s=r(function(){return arguments}())?r:function(e){return n(e)&&i.call(e,"callee")&&!a.call(e,"callee")};t.exports=s}}),Fe=a({"../../../node_modules/lodash/stubFalse.js"(e,t){t.exports=function(){return!1}}}),Le=a({"../../../node_modules/lodash/isBuffer.js"(e,t){var r=y(),n=Fe(),o="object"==typeof e&&e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o?r.Buffer:void 0,s=(a?a.isBuffer:void 0)||n;t.exports=s}}),De=a({"../../../node_modules/lodash/_isIndex.js"(e,t){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&r.test(e))&&e>-1&&e%1==0&&e<t}}}),Be=a({"../../../node_modules/lodash/isLength.js"(e,t){t.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}}),Re=a({"../../../node_modules/lodash/_baseIsTypedArray.js"(e,t){var r=C(),n=Be(),o=x(),i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i["[object Arguments]"]=i["[object Array]"]=i["[object ArrayBuffer]"]=i["[object Boolean]"]=i["[object DataView]"]=i["[object Date]"]=i["[object Error]"]=i["[object Function]"]=i["[object Map]"]=i["[object Number]"]=i["[object Object]"]=i["[object RegExp]"]=i["[object Set]"]=i["[object String]"]=i["[object WeakMap]"]=!1,t.exports=function(e){return o(e)&&n(e.length)&&!!i[r(e)]}}}),Me=a({"../../../node_modules/lodash/_baseUnary.js"(e,t){t.exports=function(e){return function(t){return e(t)}}}}),Oe=a({"../../../node_modules/lodash/_nodeUtil.js"(e,t){var r=g(),n="object"==typeof e&&e&&!e.nodeType&&e,o=n&&"object"==typeof t&&t&&!t.nodeType&&t,i=o&&o.exports===n&&r.process,a=function(){try{var e=o&&o.require&&o.require("util").types;return e||i&&i.binding&&i.binding("util")}catch(e){}}();t.exports=a}}),Ie=a({"../../../node_modules/lodash/isTypedArray.js"(e,t){var r=Re(),n=Me(),o=Oe(),i=o&&o.isTypedArray,a=i?n(i):r;t.exports=a}}),je=a({"../../../node_modules/lodash/_arrayLikeKeys.js"(e,t){var r=Ae(),n=qe(),o=Se(),i=Le(),a=De(),s=Ie(),u=Object.prototype.hasOwnProperty;t.exports=function(e,t){var c=o(e),l=!c&&n(e),d=!c&&!l&&i(e),p=!c&&!l&&!d&&s(e),h=c||l||d||p,f=h?r(e.length,String):[],m=f.length;for(var g in e)!t&&!u.call(e,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||a(g,m))||f.push(g);return f}}}),Ue=a({"../../../node_modules/lodash/_isPrototype.js"(e,t){var r=Object.prototype;t.exports=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||r)}}}),$e=a({"../../../node_modules/lodash/_overArg.js"(e,t){t.exports=function(e,t){return function(r){return e(t(r))}}}}),Ne=a({"../../../node_modules/lodash/_nativeKeys.js"(e,t){var r=$e()(Object.keys,Object);t.exports=r}}),He=a({"../../../node_modules/lodash/_baseKeys.js"(e,t){var r=Ue(),n=Ne(),o=Object.prototype.hasOwnProperty;t.exports=function(e){if(!r(e))return n(e);var t=[];for(var i in Object(e))o.call(e,i)&&"constructor"!=i&&t.push(i);return t}}}),Ve=a({"../../../node_modules/lodash/isArrayLike.js"(e,t){var r=$(),n=Be();t.exports=function(e){return null!=e&&n(e.length)&&!r(e)}}}),We=a({"../../../node_modules/lodash/keys.js"(e,t){var r=je(),n=He(),o=Ve();t.exports=function(e){return o(e)?r(e):n(e)}}}),ze=a({"../../../node_modules/lodash/_getAllKeys.js"(e,t){var r=Ce(),n=Te(),o=We();t.exports=function(e){return r(e,o,n)}}}),Ge=a({"../../../node_modules/lodash/_equalObjects.js"(e,t){var r=ze(),n=Object.prototype.hasOwnProperty;t.exports=function(e,t,o,i,a,s){var u=1&o,c=r(e),l=c.length;if(l!=r(t).length&&!u)return!1;for(var d=l;d--;){var p=c[d];if(!(u?p in t:n.call(t,p)))return!1}var h=s.get(e),f=s.get(t);if(h&&f)return h==t&&f==e;var m=!0;s.set(e,t),s.set(t,e);for(var g=u;++d<l;){var y=e[p=c[d]],b=t[p];if(i)var v=u?i(b,y,p,t,e,s):i(y,b,p,e,t,s);if(!(void 0===v?y===b||a(y,b,o,i,s):v)){m=!1;break}g||(g="constructor"==p)}if(m&&!g){var w=e.constructor,_=t.constructor;w==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof _&&_ instanceof _||(m=!1)}return s.delete(e),s.delete(t),m}}}),Ye=a({"../../../node_modules/lodash/_DataView.js"(e,t){var r=G()(y(),"DataView");t.exports=r}}),Xe=a({"../../../node_modules/lodash/_Promise.js"(e,t){var r=G()(y(),"Promise");t.exports=r}}),Ze=a({"../../../node_modules/lodash/_Set.js"(e,t){var r=G()(y(),"Set");t.exports=r}}),Ke=a({"../../../node_modules/lodash/_WeakMap.js"(e,t){var r=G()(y(),"WeakMap");t.exports=r}}),Qe=a({"../../../node_modules/lodash/_getTag.js"(e,t){var r=Ye(),n=Y(),o=Xe(),i=Ze(),a=Ke(),s=C(),u=V(),c="[object Map]",l="[object Promise]",d="[object Set]",p="[object WeakMap]",h="[object DataView]",f=u(r),m=u(n),g=u(o),y=u(i),b=u(a),v=s;(r&&v(new r(new ArrayBuffer(1)))!=h||n&&v(new n)!=c||o&&v(o.resolve())!=l||i&&v(new i)!=d||a&&v(new a)!=p)&&(v=function(e){var t=s(e),r="[object Object]"==t?e.constructor:void 0,n=r?u(r):"";if(n)switch(n){case f:return h;case m:return c;case g:return l;case y:return d;case b:return p}return t}),t.exports=v}}),Je=a({"../../../node_modules/lodash/_baseIsEqualDeep.js"(e,t){var r=de(),n=ye(),o=_e(),i=Ge(),a=Qe(),s=Se(),u=Le(),c=Ie(),l="[object Arguments]",d="[object Array]",p="[object Object]",h=Object.prototype.hasOwnProperty;t.exports=function(e,t,f,m,g,y){var b=s(e),v=s(t),w=b?d:a(e),_=v?d:a(t),E=(w=w==l?p:w)==p,S=(_=_==l?p:_)==p,C=w==_;if(C&&u(e)){if(!u(t))return!1;b=!0,E=!1}if(C&&!E)return y||(y=new r),b||c(e)?n(e,t,f,m,g,y):o(e,t,w,f,m,g,y);if(!(1&f)){var x=E&&h.call(e,"__wrapped__"),k=S&&h.call(t,"__wrapped__");if(x||k){var T=x?e.value():e,A=k?t.value():t;return y||(y=new r),g(T,A,f,m,y)}}return!!C&&(y||(y=new r),i(e,t,f,m,g,y))}}}),et=a({"../../../node_modules/lodash/_baseIsEqual.js"(e,t){var r=Je(),n=x();t.exports=function e(t,o,i,a,s){return t===o||(null==t||null==o||!n(t)&&!n(o)?t!=t&&o!=o:r(t,o,i,a,e,s))}}}),tt=a({"../../../node_modules/lodash/isEqual.js"(e,t){var r=et();t.exports=function(e,t){return r(e,t)}}}),rt=a({"../../../node_modules/base64-js/index.js"(e){e.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},e.toByteArray=function(e){var t,r,i=a(e),s=i[0],u=i[1],c=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,u)),l=0,d=u>0?s-4:s;for(r=0;r<d;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t);1===u&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},e.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=16383,u=0,c=n-o;u<c;u+=a)i.push(s(e,u,u+a>c?c:u+a));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};var t,r=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(t=0,64;t<64;++t)r[t]=i[t],n[i.charCodeAt(t)]=t;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function s(e,t,n){for(var o,i,a=[],s=t;s<n;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63}}),nt=a({"../../../node_modules/ieee754/index.js"(e){e.read=function(e,t,r,n,o){var i,a,s=8*o-n-1,u=(1<<s)-1,c=u>>1,l=-7,d=r?o-1:0,p=r?-1:1,h=e[t+d];for(d+=p,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=p,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+e[t+d],d+=p,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),i-=c}return(h?-1:1)*a*Math.pow(2,i-n)},e.write=function(e,t,r,n,o,i){var a,s,u,c=8*i-o-1,l=(1<<c)-1,d=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,f=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?p/u:p*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*u-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[r+h]=255&s,h+=f,s/=256,o-=8);for(a=a<<o|s,c+=o;c>0;e[r+h]=255&a,h+=f,a/=256,c-=8);e[r+h-f]|=128*m}}}),ot=a({"../../../node_modules/buffer/index.js"(e){var t=rt(),r=nt(),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=function(e){+e!=e&&(e=0);return a.alloc(+e)},e.INSPECT_MAX_BYTES=50;var o=2147483647;function i(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return s(e,t,r)}function s(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|h(e,t),n=i(r),o=n.write(e,t);o!==r&&(n=n.slice(0,o));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(j(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(j(e,SharedArrayBuffer)||e&&j(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);var o=function(e){if(a.isBuffer(e)){var t=0|p(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||U(e.length)?i(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),i(e<0?0:0|p(e))}function l(e){for(var t=e.length<0?0:0|p(e.length),r=i(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function d(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,a.prototype),n}function p(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function h(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return O(e).length;default:if(o)return n?-1:M(e).length;t=(""+t).toLowerCase(),o=!0}}function f(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return k(this,t,r);case"latin1":case"binary":return T(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),U(r=+r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:y(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):y(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function y(e,t,r,n,o){var i,a=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,r/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=r;i<s;i++)if(c(e,i)===c(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*a}else-1!==l&&(i-=i-l),l=-1}else for(r+u>s&&(r=s-u),i=r;i>=0;i--){for(var d=!0,p=0;p<u;p++)if(c(e,i+p)!==c(t,p)){d=!1;break}if(d)return i}return-1}function b(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(U(s))return a;e[r+a]=s}return a}function v(e,t,r,n){return I(M(t,e.length-r),e,r,n)}function w(e,t,r,n){return I(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function _(e,t,r,n){return I(O(t),e,r,n)}function E(e,t,r,n){return I(function(e,t){for(var r,n,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function S(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function C(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,a,s,u,c=e[o],l=null,d=c>239?4:c>223?3:c>191?2:1;if(o+d<=r)switch(d){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,d=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=d}return function(e){var t=e.length;if(t<=x)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=x));return r}(n)}e.kMaxLength=o,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return s(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return function(e,t,r){return u(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},a.allocUnsafe=function(e){return c(e)},a.allocUnsafeSlow=function(e){return c(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(j(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),j(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=a.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(j(i,Uint8Array))o+i.length>n.length?a.from(i).copy(n,o):Uint8Array.prototype.set.call(n,i,o);else{if(!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o)}o+=i.length}return n},a.byteLength=h,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):f.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,o){if(j(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),u=Math.min(i,s),c=this.slice(n,o),l=e.slice(t,r),d=0;d<u;++d)if(c[d]!==l[d]){i=c[d],s=l[d];break}return i<s?-1:s<i?1:0},a.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":case"latin1":case"binary":return w(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var x=4096;function k(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function T(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function A(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=$[e[i]];return o}function P(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function q(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,r,n,o,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function L(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,n,o,i){return t=+t,n>>>=0,i||L(e,0,n,4),r.write(e,t,n,o,23,4),n+4}function B(e,t,n,o,i){return t=+t,n>>>=0,i||L(e,0,n,8),r.write(e,t,n,o,52,8),n+8}a.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||q(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||q(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||q(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||q(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||q(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||q(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||q(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||q(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return e>>>=0,t||q(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||q(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||q(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||q(e,4,this.length),r.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||q(e,4,this.length),r.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||q(e,8,this.length),r.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||q(e,8,this.length),r.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||F(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||F(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,e,t,r,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var o=Math.pow(2,8*r-1);F(this,e,t,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),o},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var s=a.isBuffer(e)?e:a.from(e,n),u=s.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%u]}return this};var R=/[^+/0-9A-Za-z-_]/g;function M(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function O(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function I(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function j(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function U(e){return e!=e}var $=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()}}),it=a({"../../../node_modules/lodash/toFinite.js"(e,t){var r=T(),n=1/0;t.exports=function(e){return e?(e=r(e))===n||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}}}),at=a({"../../../node_modules/lodash/toInteger.js"(e,t){var r=it();t.exports=function(e){var t=r(e),n=t%1;return t==t?n?t-n:t:0}}}),st=a({"../../../node_modules/lodash/before.js"(e,t){var r=at();t.exports=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Expected a function");return e=r(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}}}),ut=a({"../../../node_modules/lodash/once.js"(e,t){var r=st();t.exports=function(e){return r(2,e)}}}),ct=a({"../../../esbuild/polyfill.noop.js"(){}}),lt=a({"../../../_builds/cesdk/wasm32-unknown-emscripten/Release/cesdk.js"(e,t){var r,n=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(r||=__filename),function(e={}){var t,n,o,i,a,s,u=e;if(void 0===globalThis.BigInt64Array){let e=function(e,t){return BigInt(e)|BigInt(t+2*(2147483648&t))<<32n},t=function(e,t){return BigInt(e)|BigInt(t)<<32n},r=function(e){return[0|Number(BigInt(e)&BigInt(4294967295)),0|Number(BigInt(e)>>32n)]},n=function(e){return function t(n){var o;"number"==typeof n&&(n=new Uint32Array(2*n)),ArrayBuffer.isView(n)||(n.constructor&&"ArrayBuffer"===n.constructor.name?n=new Uint32Array(n):(o=n,n=new Uint32Array(2*n.length)));var i=new Proxy({slice:(e,r)=>(r??=n.length,t(n.slice(2*e,2*r))),subarray:(e,r)=>t(n.subarray(2*e,2*r)),[Symbol.iterator]:function*(){for(var t=0;t<n.length/2;t++)yield e(n[2*t],n[2*t+1])},BYTES_PER_ELEMENT:2*n.BYTES_PER_ELEMENT,buffer:n.buffer,byteLength:n.byteLength,byteOffset:n.byteOffset,length:n.length/2,copyWithin:function(e,t,r){return n.copyWithin(2*e,2*t,2*r),i},set(e,t){if(t??=0,2*(e.length+t)>n.length)throw new RangeError("offset is out of bounds");for(var o=0;o<e.length;o++){var i=e[o],a=r(i);n.set(a,2*(t+o))}}},{get(t,r,o){if("string"!=typeof r||!/^\d+$/.test(r))return Reflect.get(t,r,o);var i=n[2*r],a=n[2*r+1];return e(i,a)},set(e,t,o,i){if("string"!=typeof t||!/^\d+$/.test(t))return Reflect.set(e,t,o,i);if("bigint"!=typeof o)throw new TypeError(`Cannot convert ${o} to a BigInt`);var a=r(o);return n.set(a,2*t),!0}});return o&&i.set(o),i}};globalThis.BigUint64Array=n(t),globalThis.BigInt64Array=n(e)}u.ready=new Promise(((e,r)=>{t=e,n=r})),u.expectedDataFileDownloads||(u.expectedDataFileDownloads=0),u.expectedDataFileDownloads++,u.ENVIRONMENT_IS_PTHREAD||u.$ww||function(e){"object"==typeof window?window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/"):"undefined"==typeof process&&"undefined"!=typeof location&&encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/");var t="cesdk.data";"function"!=typeof u.locateFilePackage||u.locateFile||(u.locateFile=u.locateFilePackage,x("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));var r=u.locateFile?u.locateFile(t,""):t,n=e.remote_package_size,o=null,i=u.getPreloadedPackage?u.getPreloadedPackage(r,n):null;function a(){function t(e,t){if(!e)throw t+(new Error).stack}function r(e,t,r){this.start=e,this.end=t,this.audio=r}u.FS_createPath("/","ly.img.cesdk",!0,!0),u.FS_createPath("/ly.img.cesdk","fonts",!0,!0),u.FS_createPath("/ly.img.cesdk","icons",!0,!0),u.FS_createPath("/ly.img.cesdk","icu",!0,!0),u.FS_createPath("/ly.img.cesdk","presets",!0,!0),u.FS_createPath("/ly.img.cesdk","shaders",!0,!0),u.FS_createPath("/ly.img.cesdk/shaders","common",!0,!0),r.prototype={requests:{},open:function(e,t){this.name=t,this.requests[t]=this,u.addRunDependency(`fp ${this.name}`)},send:function(){},onload:function(){var e=this.byteArray.subarray(this.start,this.end);this.finish(e)},finish:function(e){u.FS_createDataFile(this.name,null,e,!0,!0,!0),u.removeRunDependency(`fp ${this.name}`),this.requests[this.name]=null}};for(var n=e.files,a=0;a<n.length;++a)new r(n[a].start,n[a].end,n[a].audio||0).open("GET",n[a].filename);function s(n){t(n,"Loading data file failed."),t(n.constructor.name===ArrayBuffer.name,"bad input to processPackageData");var o=new Uint8Array(n);r.prototype.byteArray=o;for(var i=e.files,a=0;a<i.length;++a)r.prototype.requests[i[a].filename].onload();u.removeRunDependency("datafile_cesdk.data")}u.addRunDependency("datafile_cesdk.data"),u.preloadResults||(u.preloadResults={}),u.preloadResults["cesdk.data"]={fromCache:!1},i?(s(i),i=null):o=s}i||function(e,t,r,n){if("object"!=typeof process||"object"!=typeof process.versions||"string"!=typeof process.versions.node){var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="arraybuffer",o.onprogress=function(r){var n=e,i=t;if(r.total&&(i=r.total),r.loaded){o.addedTotal?u.dataFileDownloads[n].loaded=r.loaded:(o.addedTotal=!0,u.dataFileDownloads||(u.dataFileDownloads={}),u.dataFileDownloads[n]={loaded:r.loaded,total:i});var a=0,s=0,c=0;for(var l in u.dataFileDownloads){var d=u.dataFileDownloads[l];a+=d.total,s+=d.loaded,c++}a=Math.ceil(a*u.expectedDataFileDownloads/c),u.setStatus&&u.setStatus(`Downloading data... (${s}/${a})`)}else u.dataFileDownloads||u.setStatus&&u.setStatus("Downloading data...")},o.onerror=function(t){throw new Error("NetworkError for: "+e)},o.onload=function(e){if(!(200==o.status||304==o.status||206==o.status||0==o.status&&o.response))throw new Error(o.statusText+" : "+o.responseURL);var t=o.response;r(t)},o.send(null)}else ct().readFile(e,(function(e,t){e?n(e):r(t.buffer)}))}(r,n,(function(e){o?(o(e),o=null):i=e}),(function(e){console.error("package error:",e)})),u.calledRun?a():(u.preRun||(u.preRun=[]),u.preRun.push(a))}({files:[{filename:"/ly.img.cesdk/fonts/imgly_font_inter_semibold.otf",start:0,end:270760},{filename:"/ly.img.cesdk/icons/ErrorAudio.svg",start:270760,end:271672},{filename:"/ly.img.cesdk/icons/ErrorConnection.svg",start:271672,end:272620},{filename:"/ly.img.cesdk/icons/ErrorVideo.svg",start:272620,end:273473},{filename:"/ly.img.cesdk/icons/Move.svg",start:273473,end:274748},{filename:"/ly.img.cesdk/icons/RotateIndicator.svg",start:274748,end:275745},{filename:"/ly.img.cesdk/icu/icudt74l.dat",start:275745,end:810849},{filename:"/ly.img.cesdk/presets/.keep",start:810849,end:810849},{filename:"/ly.img.cesdk/shaders/adjustments.sksl",start:810849,end:814738},{filename:"/ly.img.cesdk/shaders/black_and_white_color_mixer.sksl",start:814738,end:821055},{filename:"/ly.img.cesdk/shaders/common/ubq_adjustments.sksl",start:821055,end:825646},{filename:"/ly.img.cesdk/shaders/common/ubq_color_conversions.sksl",start:825646,end:835631},{filename:"/ly.img.cesdk/shaders/common/ubq_constants.sksl",start:835631,end:836121},{filename:"/ly.img.cesdk/shaders/common/ubq_hue_constants.sksl",start:836121,end:839288},{filename:"/ly.img.cesdk/shaders/common/ubq_noise.sksl",start:839288,end:841926},{filename:"/ly.img.cesdk/shaders/cross_cut.sksl",start:841926,end:842873},{filename:"/ly.img.cesdk/shaders/dot_pattern.sksl",start:842873,end:843388},{filename:"/ly.img.cesdk/shaders/duotone_filter.sksl",start:843388,end:844352},{filename:"/ly.img.cesdk/shaders/extrude_blur.sksl",start:844352,end:846469},{filename:"/ly.img.cesdk/shaders/glow.sksl",start:846469,end:847436},{filename:"/ly.img.cesdk/shaders/half_tone.sksl",start:847436,end:847930},{filename:"/ly.img.cesdk/shaders/hsp_selective_adjustments.sksl",start:847930,end:861530},{filename:"/ly.img.cesdk/shaders/linocut.sksl",start:861530,end:862315},{filename:"/ly.img.cesdk/shaders/liquid.sksl",start:862315,end:862797},{filename:"/ly.img.cesdk/shaders/lut_filter.sksl",start:862797,end:865660},{filename:"/ly.img.cesdk/shaders/mask_color.sksl",start:865660,end:866165},{filename:"/ly.img.cesdk/shaders/mirror.sksl",start:866165,end:866619},{filename:"/ly.img.cesdk/shaders/outliner.sksl",start:866619,end:868256},{filename:"/ly.img.cesdk/shaders/pixelize.sksl",start:868256,end:868556},{filename:"/ly.img.cesdk/shaders/placeholder_overlay_lines.sksl",start:868556,end:869244},{filename:"/ly.img.cesdk/shaders/posterize.sksl",start:869244,end:869456},{filename:"/ly.img.cesdk/shaders/radial_pixel.sksl",start:869456,end:870019},{filename:"/ly.img.cesdk/shaders/recolor.sksl",start:870019,end:872220},{filename:"/ly.img.cesdk/shaders/sharpie.sksl",start:872220,end:874525},{filename:"/ly.img.cesdk/shaders/shifter.sksl",start:874525,end:875209},{filename:"/ly.img.cesdk/shaders/tiltshift.sksl",start:875209,end:875791},{filename:"/ly.img.cesdk/shaders/tv_glitch.sksl",start:875791,end:876509},{filename:"/ly.img.cesdk/shaders/vignette.sksl",start:876509,end:876881}],remote_package_size:876881}),"object"==typeof window&&"object"==typeof window.performance?u.performance=performance:"object"==typeof global&&"object"==typeof global.perf_hooks&&"object"==typeof global.perf_hooks.performance?u.performance=global.perf_hooks.performance:u.performance={mark:function(){},measure:function(){}},(i=o||(o={}))[i.PENDING=0]="PENDING",i[i.FINISHED=1]="FINISHED",i[i.ALLOCATED=2]="ALLOCATED",i[i.ERROR=3]="ERROR",(s=a||(a={}))[s.GET=0]="GET",s[s.POST=1]="POST";class FetchProcess{constructor(e,t){this.state=o.PENDING,this.totalBytes=0,this.receivedLength=0,this.handle=e,this.uri=t,this.abortController=new AbortController,this.abortSignal=this.abortController.signal}async readChunks(e){let t=0;const r=[],n=e=>{r.push(e),t+=e.length,this.receivedLength=t};if(null==e);else if("getReader"in e){const t=e.getReader();for(;;){const{done:e,value:r}=await t.read();if(e)break;if(this.abortSignal.aborted)throw await t.cancel(),t.releaseLock(),new Error(this.abortSignal.reason);n(r)}t.releaseLock()}else{const t=()=>e.destroy(new Error(this.abortSignal.reason));this.abortSignal.addEventListener("abort",t,{once:!0});try{await new Promise(((t,r)=>{e.on("data",n),e.on("end",(()=>t())),e.on("error",(e=>r(e)))}))}finally{this.abortSignal.removeEventListener("abort",t)}}const o=new Uint8Array(t);let i=0;for(const e of r)o.set(e,i),i+=e.length;return this.finish(o)}abort(){this.isPending()&&this.abortController.abort("Fetch aborted")}isPending(){return this.state===o.PENDING}isError(){return this.state===o.ERROR}isFinished(){return this.state===o.FINISHED}isAllocated(){return this.state===o.ALLOCATED}allocate(){if(this.isAllocated())return this;if(this.isFinished()){const e=this.result.length,t=u._malloc(e);u.HEAPU8.set(this.result,t);const r=Object.assign(Object.assign({},this),{state:o.ALLOCATED,resultAddress:t,resultLength:e});return Object.assign(this,r),r}return null}finish(e){const t=Object.assign(Object.assign({},this),{state:o.FINISHED,result:e,totalBytes:e.length});return Object.assign(this,t)}fail(e){const t=Object.assign(Object.assign({},this),{state:o.ERROR,error:e});return Object.assign(this,t)}}u.emscripten_ubq_asyncFetchManager=new class AsyncFetchManager{constructor(){this._nextHandle=0,this._nextHeaderHandle=0,this._processes=new Map,this._headers=new Map,this._fetchImpl=null}_fetch(e,t){return this._fetchImpl?this._fetchImpl(e,t):fetch(e,t)}setFetch(e){this._fetchImpl=e}getProcess(e){return this._processes.get(e)}deleteProcess(e){const t=this._processes.get(e);return(null==t?void 0:t.isPending())&&t.abort(),this._processes.delete(e)}clear(){for(const e of this._processes.values())e.isPending()&&e.abort();this._processes.clear(),this._headers.clear()}fetch(e,t,r,n,o,i,a,s,c){const l=u.UTF8ToString(t,r),d=this._nextHandle++,p=new FetchProcess(d,l);return this._processes.set(d,p),l.match(/^file:/)?this._fetchFile(p).catch((e=>{p.fail(e)})):this._fetchRemote(p,e,n,o,i,a,s,c).catch((e=>{p.fail(e)})),p}async _fetchFile(e){if("undefined"!=typeof window)throw new Error("File URLs supported only in Node.JS");const t=ct(),{fileURLToPath:r}=ct(),n=t.createReadStream(r(e.uri));return e.readChunks(n)}async _fetchRemote(e,t,r,n,o,i,s,c){const l=u.UTF8ToString(s,c),d=this.getHeaders(r,n),p=t===a.POST?new Uint8Array(u.HEAPU8.buffer,o,i):void 0,h=await this._fetch(e.uri,{method:a[t],headers:d,body:p,mode:"cors",credentials:l,signal:e.abortSignal});if(h.status>=200&&h.status<=209){let t=0;return h.headers.has("Content-Length")&&(t=+h.headers.get("Content-Length")),e.totalBytes=t,e.readChunks(h.body)}return e.fail(h.statusText)}getHeaders(e,t){const r={};for(let n=0;n<t;n++){const t=u.getValue(e+4*n,"i32"),o=this._headers.get(t);r[o.key]=o.value}return r}createHeader(e,t,r,n){const o=u.UTF8ToString(e,t),i=u.UTF8ToString(r,n),a=this._nextHeaderHandle++;return this._headers.set(a,{key:o,value:i}),a}deleteHeader(e){return this._headers.delete(e)}},u.emscripten_ubq_codec_videoDecoders=new Map,u.emscripten_ubq_codec_audioDecoders=new Map,u.emscripten_ubq_codec_videoEncoders=new Map,u.emscripten_ubq_codec_audioEncoders=new Map,u.emscripten_ubq_codec_videoDecoderNextHandle=1,u.emscripten_ubq_codec_audioDecoderNextHandle=1,u.emscripten_ubq_codec_videoEncoderNextHandle=1,u.emscripten_ubq_codec_audioEncoderNextHandle=1,u.emscripten_ubq_codec_createNativeResult=function(e){const t=u._malloc(8),r=u.HEAPU32.subarray(t/4,t/4+2);if(r[0]=e.handle?e.handle:e.code?e.code:0,e.error){const t=(new TextEncoder).encode(e.error),n=u._malloc(t.length+1),o=u.HEAPU8.subarray(n,n+t.length+1);for(let e=0;e<t.length;e++)o[e]=t[e];o[t.length]=0,r[1]=n}else r[1]=0;return t},u.emscripten_ubq_codec_createVideoDecoder=function(e,t){const r=new VideoDecoder({output:n=>{const o=r.textures;let i=!1;if((r.shouldDropFrames||r.decodedFrames<r.requestedFrame||r.decodeQueueSize>=o.length)&&(i=!0),!i){var a=u.ctx;const e=r.decodedFrames%o.length,t=a.getParameter(a.TEXTURE_BINDING_2D);a.bindTexture(a.TEXTURE_2D,o[e]),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,n),a.bindTexture(a.TEXTURE_2D,t)}n.close(),r.decodedFrames++,u.emscripten_ubq_codec_onOutputDecodedVideoFrame(e,r.decodedFrames,i,t)},error:e=>{r.unexpectedError=e,console.error(e)}});return r.decodedFrames=0,r.requestedFrame=0,r.shouldDropFrames=!1,r},u.emscripten_ubq_codec_createAudioDecoder=function(e,t,r){const n=new AudioDecoder({output:o=>{if(n.flushing)return void o.close();const i=u.HEAPF32.subarray(e/4,e/4+r),a=u.HEAPF32.subarray(t/4,t/4+r),s=1===o.numberOfChannels?0:1;if("f32-planar"===o.format){let e=n.writtenFrames%r;if(e+o.numberOfFrames<=r)o.copyTo(i.subarray(e),{planeIndex:0,frameCount:o.numberOfFrames}),o.copyTo(a.subarray(e),{planeIndex:s,frameCount:o.numberOfFrames});else{const t=r-e;o.copyTo(i.subarray(e),{planeIndex:0,frameCount:t}),o.copyTo(a.subarray(e),{planeIndex:s,frameCount:t}),o.copyTo(i,{planeIndex:0,frameOffset:t}),o.copyTo(a,{planeIndex:s,frameOffset:t})}n.writtenFrames+=o.numberOfFrames}else if("s16-planar"===o.format)if(1===o.numberOfChannels){const e=new Int16Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0});for(let t=0;t<o.numberOfFrames;t++){const o=e[t]/32768;let s=n.writtenFrames%r;i[s]=o,a[s]=o,n.writtenFrames++}}else{const e=new Int16Array(o.numberOfFrames),t=new Int16Array(o.numberOfFrames);o.copyTo(e,{planeIndex:0}),o.copyTo(t,{planeIndex:1});for(let s=0;s<o.numberOfFrames;s++){let o=n.writtenFrames%r;i[o]=e[s]/32768,a[o]=t[s]/32768,n.writtenFrames++}}else if("s16"===o.format){const e=new Int16Array(o.numberOfFrames*o.numberOfChannels);if(o.copyTo(e,{planeIndex:0}),1===o.numberOfChannels)for(let t=0;t<o.numberOfFrames;t++){const o=e[t]/32768;let s=n.writtenFrames%r;i[s]=o,a[s]=o,n.writtenFrames++}else for(let t=0;t<o.numberOfFrames;t++){let s=n.writtenFrames%r;i[s]=e[t*o.numberOfChannels+0]/32768,a[s]=e[t*o.numberOfChannels+1]/32768,n.writtenFrames++}}else console.error("Unsupported audio format:",o.format);o.close()},error:e=>{n.unexpectedError=e,console.error(e)}});return n.writtenFrames=0,n},u.emscripten_ubq_settings_forceWebGL1=!1;var c,l,d,p=Object.assign({},u),h=[],f="./this.program",m=(e,t)=>{throw t},g="object"==typeof window,y="function"==typeof importScripts,b="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,v="";if(b){var w=ct(),_=ct();v=y?_.dirname(v)+"/":__dirname+"/",c=(e,t)=>(e=ee(e)?new URL(e):_.normalize(e),w.readFileSync(e,t?void 0:"utf8")),d=e=>{var t=c(e,!0);return t.buffer||(t=new Uint8Array(t)),t},l=(e,t,r,n=!0)=>{e=ee(e)?new URL(e):_.normalize(e),w.readFile(e,n?void 0:"utf8",((e,o)=>{e?r(e):t(n?o.buffer:o)}))},!u.thisProgram&&process.argv.length>1&&(f=process.argv[1].replace(/\\/g,"/")),h=process.argv.slice(2),m=(e,t)=>{throw process.exitCode=e,t}}else(g||y)&&(y?v=self.location.href:"undefined"!=typeof document&&document.currentScript&&(v=document.currentScript.src),r&&(v=r),v=v.startsWith("blob:")?"":v.substr(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1),c=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},y&&(d=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),l=(e,t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var E,S,C=u.print||console.log.bind(console),x=u.printErr||console.error.bind(console);Object.assign(u,p),p=null,u.arguments&&(h=u.arguments),u.thisProgram&&(f=u.thisProgram),u.quit&&(m=u.quit),u.wasmBinary&&(E=u.wasmBinary),"object"!=typeof WebAssembly&&Z("no native wasm support detected");var k,T,A,P,q,F,L,D,B,R,M,O=!1;function I(e,t){e||Z(t)}function j(){var e=S.buffer;u.HEAP8=T=new Int8Array(e),u.HEAP16=P=new Int16Array(e),u.HEAPU8=A=new Uint8Array(e),u.HEAPU16=q=new Uint16Array(e),u.HEAP32=F=new Int32Array(e),u.HEAPU32=L=new Uint32Array(e),u.HEAPF32=D=new Float32Array(e),u.HEAPF64=M=new Float64Array(e),u.HEAP64=B=new BigInt64Array(e),u.HEAPU64=R=new BigUint64Array(e)}var U=u.INITIAL_MEMORY||16777216;S=u.wasmMemory?u.wasmMemory:new WebAssembly.Memory({initial:U/65536,maximum:32768}),j(),U=S.buffer.byteLength;var $=[],N=[],H=[],V=[],W=0,z=null,G=null;function Y(e){W++,u.monitorRunDependencies?.(W)}function X(e){if(W--,u.monitorRunDependencies?.(W),0==W&&(null!==z&&(clearInterval(z),z=null),G)){var t=G;G=null,t()}}function Z(e){u.onAbort?.(e),x(e="Aborted("+e+")"),O=!0,k=1,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}var K,Q,J=e=>e.startsWith("data:application/octet-stream;base64,"),ee=e=>e.startsWith("file://");function te(e){if(e==K&&E)return new Uint8Array(E);if(d)return d(e);throw"both async and sync fetching of the wasm failed"}function re(e,t,r){return function(e){return E||!g&&!y||"function"!=typeof fetch?Promise.resolve().then((()=>te(e))):fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw`failed to load wasm binary file at '${e}'`;return t.arrayBuffer()})).catch((()=>te(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{x(`failed to asynchronously prepare wasm: ${e}`),Z(e)}))}J(K="cesdk.wasm")||(Q=K,K=u.locateFile?u.locateFile(Q,v):v+Q);var ne={2400928:(e,t,r,n,o)=>"undefined"==typeof window||void 0===(window.AudioContext||window.webkitAudioContext)?0:(void 0===window.miniaudio&&(window.miniaudio={referenceCount:0},window.miniaudio.device_type={},window.miniaudio.device_type.playback=e,window.miniaudio.device_type.capture=t,window.miniaudio.device_type.duplex=r,window.miniaudio.device_state={},window.miniaudio.device_state.stopped=n,window.miniaudio.device_state.started=o,miniaudio.devices=[],miniaudio.track_device=function(e){for(var t=0;t<miniaudio.devices.length;++t)if(null==miniaudio.devices[t])return miniaudio.devices[t]=e,t;return miniaudio.devices.push(e),miniaudio.devices.length-1},miniaudio.untrack_device_by_index=function(e){for(miniaudio.devices[e]=null;miniaudio.devices.length>0&&null==miniaudio.devices[miniaudio.devices.length-1];)miniaudio.devices.pop()},miniaudio.untrack_device=function(e){for(var t=0;t<miniaudio.devices.length;++t)if(miniaudio.devices[t]==e)return miniaudio.untrack_device_by_index(t)},miniaudio.get_device_by_index=function(e){return miniaudio.devices[e]},miniaudio.unlock_event_types=function(){return["touchstart","touchend","click"]}(),miniaudio.unlock=function(){for(var e=0;e<miniaudio.devices.length;++e){var t=miniaudio.devices[e];null!=t&&null!=t.webaudio&&2===t.state&&t.webaudio.resume()}miniaudio.unlock_event_types.map((function(e){document.removeEventListener(e,miniaudio.unlock,!0)}))},miniaudio.unlock_event_types.map((function(e){document.addEventListener(e,miniaudio.unlock,!0)}))),window.miniaudio.referenceCount+=1,1),2402918:()=>{void 0!==window.miniaudio&&(window.miniaudio.referenceCount-=1,0===window.miniaudio.referenceCount&&delete window.miniaudio)},2403082:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,2403186:()=>{try{var e=new(window.AudioContext||window.webkitAudioContext),t=e.sampleRate;return e.close(),t}catch(e){return 0}},2403357:(e,t,r,n,o,i)=>{var a=e,s=t,c=r,l=n,d=o,p=i;if(void 0===window.miniaudio)return-1;var h={},f={};a==window.miniaudio.device_type.playback&&(f.sampleRate=c),h.webaudio=new(window.AudioContext||window.webkitAudioContext)(f),h.webaudio.suspend(),h.state=window.miniaudio.device_state.stopped;var m=0,g=s;return a!=window.miniaudio.device_type.playback&&(m=s),h.scriptNode=h.webaudio.createScriptProcessor(l,m,g),h.scriptNode.onaudioprocess=function(e){if(null!=h.intermediaryBufferView&&0!=h.intermediaryBufferView.length||(h.intermediaryBufferView=new Float32Array(u.HEAPF32.buffer,d,l*s)),a==miniaudio.device_type.capture||a==miniaudio.device_type.duplex){for(var t=0;t<s;t+=1)for(var r=e.inputBuffer.getChannelData(t),n=h.intermediaryBufferView,o=0;o<l;o+=1)n[o*s+t]=r[o];Du(p,l,d)}if(a==miniaudio.device_type.playback||a==miniaudio.device_type.duplex)for(Bu(p,l,d),t=0;t<e.outputBuffer.numberOfChannels;++t){var i=e.outputBuffer.getChannelData(t);for(n=h.intermediaryBufferView,o=0;o<l;o+=1)i[o]=n[o*s+t]}else for(t=0;t<e.outputBuffer.numberOfChannels;++t)e.outputBuffer.getChannelData(t).fill(0)},a!=miniaudio.device_type.capture&&a!=miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){h.streamNode=h.webaudio.createMediaStreamSource(e),h.streamNode.connect(h.scriptNode),h.scriptNode.connect(h.webaudio.destination)})).catch((function(e){console.log("Failed to get user media: "+e)})),a==miniaudio.device_type.playback&&h.scriptNode.connect(h.webaudio.destination),miniaudio.track_device(h)},2406140:e=>miniaudio.get_device_by_index(e).webaudio.sampleRate,2406206:e=>{var t=miniaudio.get_device_by_index(e);void 0!==t.scriptNode&&(t.scriptNode.onaudioprocess=function(e){},t.scriptNode.disconnect(),t.scriptNode=void 0),void 0!==t.streamNode&&(t.streamNode.disconnect(),t.streamNode=void 0),t.webaudio.close(),t.webaudio=void 0},2406571:e=>{miniaudio.untrack_device_by_index(e)},2406614:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.resume(),t.state=miniaudio.device_state.started},2406739:e=>{var t=miniaudio.get_device_by_index(e);t.webaudio.suspend(),t.state=miniaudio.device_state.stopped},2406865:()=>!!globalThis.ubq_browserTabHidden,2406911:()=>T.length};function oe(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var ie=e=>{for(;e.length>0;)e.shift()(u)},ae=u.noExitRuntime||!0,se=[],ue=0;class ExceptionInfo{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){L[this.ptr+4>>2]=e}get_type(){return L[this.ptr+4>>2]}set_destructor(e){L[this.ptr+8>>2]=e}get_destructor(){return L[this.ptr+8>>2]}set_caught(e){e=e?1:0,T[this.ptr+12>>0]=e}get_caught(){return 0!=T[this.ptr+12>>0]}set_rethrown(e){e=e?1:0,T[this.ptr+13>>0]=e}get_rethrown(){return 0!=T[this.ptr+13>>0]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){L[this.ptr+16>>2]=e}get_adjusted_ptr(){return L[this.ptr+16>>2]}get_exception_ptr(){if(Wu(this.get_type()))return L[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var ce=e=>{var t=ue;if(!t)return Ru(0),0;var r=new ExceptionInfo(t);r.set_adjusted_ptr(t);var n=r.get_type();if(!n)return Ru(0),t;for(var o in e){var i=e[o];if(0===i||i===n)break;var a=r.ptr+16;if(Vu(i,n,a))return Ru(i),t}return Ru(n),t},le={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=le.isAbs(e),r="/"===e.substr(-1);return(e=le.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=le.splitPath(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=le.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return le.normalize(e.join("/"))},join2:(e,t)=>le.normalize(e+"/"+t)},de=e=>(de=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(b)try{var e=ct();if(e.randomFillSync)return t=>e.randomFillSync(t);var t=e.randomBytes;return e=>(e.set(t(e.byteLength)),e)}catch(e){}Z("initRandomDevice")})())(e),pe={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:Ce.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,t=le.isAbs(n)}return(t?"/":"")+(e=le.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=pe.resolve(e).substr(1),t=pe.resolve(t).substr(1);for(var n=r(e.split("/")),o=r(t.split("/")),i=Math.min(n.length,o.length),a=i,s=0;s<i;s++)if(n[s]!==o[s]){a=s;break}var u=[];for(s=a;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(a))).join("/")}},he="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,fe=(e,t,r)=>{for(var n=t+r,o=t;e[o]&&!(o>=n);)++o;if(o-t>16&&e.buffer&&he)return he.decode(e.subarray(t,o));for(var i="";t<o;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var u=63&e[t++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&e[t++])<65536)i+=String.fromCharCode(a);else{var c=a-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i},me=[],ge=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},ye=(e,t,r,n)=>{if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(r>=i)break;t[r++]=s}else if(s<=2047){if(r+1>=i)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=i)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-o};function be(e,t,r){var n=r>0?r:ge(e)+1,o=new Array(n),i=ye(e,o,0,o.length);return t&&(o.length=i),o}var ve={ttys:[],init(){},shutdown(){},register(e,t){ve.ttys[e]={input:[],output:[],ops:t},Ce.registerDevice(e,ve.stream_ops)},stream_ops:{open(e){var t=ve.ttys[e.node.rdev];if(!t)throw new Ce.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,n,o){if(!e.tty||!e.tty.ops.get_char)throw new Ce.ErrnoError(60);for(var i=0,a=0;a<n;a++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new Ce.ErrnoError(29)}if(void 0===s&&0===i)throw new Ce.ErrnoError(6);if(null==s)break;i++,t[r+a]=s}return i&&(e.node.timestamp=Date.now()),i},write(e,t,r,n,o){if(!e.tty||!e.tty.ops.put_char)throw new Ce.ErrnoError(60);try{for(var i=0;i<n;i++)e.tty.ops.put_char(e.tty,t[r+i])}catch(e){throw new Ce.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:e=>(()=>{if(!me.length){var e=null;if(b){var t=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=w.readSync(n,t)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}e=r>0?t.slice(0,r).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;me=be(e,!0)}return me.shift()})(),put_char(e,t){null===t||10===t?(C(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(C(fe(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(x(fe(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(x(fe(e.output,0)),e.output=[])}}},we=e=>{e=((e,t)=>Math.ceil(e/t)*t)(e,65536);var t=Ou(65536,e);return t?((e,t)=>(A.fill(0,e,e+t),e))(t,e):0},_e={ops_table:null,mount:e=>_e.createNode(null,"/",16895,0),createNode(e,t,r,n){if(Ce.isBlkdev(r)||Ce.isFIFO(r))throw new Ce.ErrnoError(63);_e.ops_table||={dir:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr,lookup:_e.node_ops.lookup,mknod:_e.node_ops.mknod,rename:_e.node_ops.rename,unlink:_e.node_ops.unlink,rmdir:_e.node_ops.rmdir,readdir:_e.node_ops.readdir,symlink:_e.node_ops.symlink},stream:{llseek:_e.stream_ops.llseek}},file:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr},stream:{llseek:_e.stream_ops.llseek,read:_e.stream_ops.read,write:_e.stream_ops.write,allocate:_e.stream_ops.allocate,mmap:_e.stream_ops.mmap,msync:_e.stream_ops.msync}},link:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr,readlink:_e.node_ops.readlink},stream:{}},chrdev:{node:{getattr:_e.node_ops.getattr,setattr:_e.node_ops.setattr},stream:Ce.chrdev_stream_ops}};var o=Ce.createNode(e,t,r,n);return Ce.isDir(o.mode)?(o.node_ops=_e.ops_table.dir.node,o.stream_ops=_e.ops_table.dir.stream,o.contents={}):Ce.isFile(o.mode)?(o.node_ops=_e.ops_table.file.node,o.stream_ops=_e.ops_table.file.stream,o.usedBytes=0,o.contents=null):Ce.isLink(o.mode)?(o.node_ops=_e.ops_table.link.node,o.stream_ops=_e.ops_table.link.stream):Ce.isChrdev(o.mode)&&(o.node_ops=_e.ops_table.chrdev.node,o.stream_ops=_e.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[t]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var n=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Ce.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Ce.isDir(e.mode)?t.size=4096:Ce.isFile(e.mode)?t.size=e.usedBytes:Ce.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&_e.resizeFileStorage(e,t.size)},lookup(e,t){throw Ce.genericErrors[44]},mknod:(e,t,r,n)=>_e.createNode(e,t,r,n),rename(e,t,r){if(Ce.isDir(e.mode)){var n;try{n=Ce.lookupNode(t,r)}catch(e){}if(n)for(var o in n.contents)throw new Ce.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=Ce.lookupNode(e,t);for(var n in r.contents)throw new Ce.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r of Object.keys(e.contents))t.push(r);return t},symlink(e,t,r){var n=_e.createNode(e,t,41471,0);return n.link=r,n},readlink(e){if(!Ce.isLink(e.mode))throw new Ce.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,n,o){var i=e.node.contents;if(o>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-o,n);if(a>8&&i.subarray)t.set(i.subarray(o,o+a),r);else for(var s=0;s<a;s++)t[r+s]=i[o+s];return a},write(e,t,r,n,o,i){if(t.buffer===T.buffer&&(i=!1),!n)return 0;var a=e.node;if(a.timestamp=Date.now(),t.subarray&&(!a.contents||a.contents.subarray)){if(i)return a.contents=t.subarray(r,r+n),a.usedBytes=n,n;if(0===a.usedBytes&&0===o)return a.contents=t.slice(r,r+n),a.usedBytes=n,n;if(o+n<=a.usedBytes)return a.contents.set(t.subarray(r,r+n),o),n}if(_e.expandFileStorage(a,o+n),a.contents.subarray&&t.subarray)a.contents.set(t.subarray(r,r+n),o);else for(var s=0;s<n;s++)a.contents[o+s]=t[r+s];return a.usedBytes=Math.max(a.usedBytes,o+n),n},llseek(e,t,r){var n=t;if(1===r?n+=e.position:2===r&&Ce.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new Ce.ErrnoError(28);return n},allocate(e,t,r){_e.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap(e,t,r,n,o){if(!Ce.isFile(e.node.mode))throw new Ce.ErrnoError(43);var i,a,s=e.node.contents;if(2&o||s.buffer!==T.buffer){if((r>0||r+t<s.length)&&(s=s.subarray?s.subarray(r,r+t):Array.prototype.slice.call(s,r,r+t)),a=!0,!(i=we(t)))throw new Ce.ErrnoError(48);T.set(s,i)}else a=!1,i=s.byteOffset;return{ptr:i,allocated:a}},msync:(e,t,r,n,o)=>(_e.stream_ops.write(e,t,0,n,r,!1),0)}},Ee=u.preloadPlugins||[],Se=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Ce={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e,t={}){if(!(e=pe.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new Ce.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),n=Ce.root,o="/",i=0;i<r.length;i++){var a=i===r.length-1;if(a&&t.parent)break;if(n=Ce.lookupNode(n,r[i]),o=le.join2(o,r[i]),Ce.isMountpoint(n)&&(!a||a&&t.follow_mount)&&(n=n.mounted.root),!a||t.follow)for(var s=0;Ce.isLink(n.mode);){var u=Ce.readlink(o);if(o=pe.resolve(le.dirname(o),u),n=Ce.lookupPath(o,{recurse_count:t.recurse_count+1}).node,s++>40)throw new Ce.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var t;;){if(Ce.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%Ce.nameTable.length},hashAddNode(e){var t=Ce.hashName(e.parent.id,e.name);e.name_next=Ce.nameTable[t],Ce.nameTable[t]=e},hashRemoveNode(e){var t=Ce.hashName(e.parent.id,e.name);if(Ce.nameTable[t]===e)Ce.nameTable[t]=e.name_next;else for(var r=Ce.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Ce.mayLookup(e);if(r)throw new Ce.ErrnoError(r);for(var n=Ce.hashName(e.id,t),o=Ce.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===e.id&&i===t)return o}return Ce.lookup(e,t)},createNode(e,t,r,n){var o=new Ce.FSNode(e,t,r,n);return Ce.hashAddNode(o),o},destroyNode(e){Ce.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Ce.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){if(!Ce.isDir(e.mode))return 54;var t=Ce.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return Ce.lookupNode(e,t),20}catch(e){}return Ce.nodePermissions(e,"wx")},mayDelete(e,t,r){var n;try{n=Ce.lookupNode(e,t)}catch(e){return e.errno}var o=Ce.nodePermissions(e,"wx");if(o)return o;if(r){if(!Ce.isDir(n.mode))return 54;if(Ce.isRoot(n)||Ce.getPath(n)===Ce.cwd())return 10}else if(Ce.isDir(n.mode))return 31;return 0},mayOpen:(e,t)=>e?Ce.isLink(e.mode)?32:Ce.isDir(e.mode)&&("r"!==Ce.flagsToPermissionString(t)||512&t)?31:Ce.nodePermissions(e,Ce.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Ce.MAX_OPEN_FDS;e++)if(!Ce.streams[e])return e;throw new Ce.ErrnoError(33)},getStreamChecked(e){var t=Ce.getStream(e);if(!t)throw new Ce.ErrnoError(8);return t},getStream:e=>Ce.streams[e],createStream:(e,t=-1)=>(Ce.FSStream||(Ce.FSStream=function(){this.shared={}},Ce.FSStream.prototype={},Object.defineProperties(Ce.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new Ce.FSStream,e),-1==t&&(t=Ce.nextfd()),e.fd=t,Ce.streams[t]=e,e),closeStream(e){Ce.streams[e]=null},chrdev_stream_ops:{open(e){var t=Ce.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Ce.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Ce.devices[e]={stream_ops:t}},getDevice:e=>Ce.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push.apply(r,n.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Ce.syncFSRequests++,Ce.syncFSRequests>1&&x(`warning: ${Ce.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Ce.getMounts(Ce.root.mount),n=0;function o(e){return Ce.syncFSRequests--,t(e)}function i(e){if(e)return i.errored?void 0:(i.errored=!0,o(e));++n>=r.length&&o(null)}r.forEach((t=>{if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)}))},mount(e,t,r){var n,o="/"===r,i=!r;if(o&&Ce.root)throw new Ce.ErrnoError(10);if(!o&&!i){var a=Ce.lookupPath(r,{follow_mount:!1});if(r=a.path,n=a.node,Ce.isMountpoint(n))throw new Ce.ErrnoError(10);if(!Ce.isDir(n.mode))throw new Ce.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?Ce.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var t=Ce.lookupPath(e,{follow_mount:!1});if(!Ce.isMountpoint(t.node))throw new Ce.ErrnoError(28);var r=t.node,n=r.mounted,o=Ce.getMounts(n);Object.keys(Ce.nameTable).forEach((e=>{for(var t=Ce.nameTable[e];t;){var r=t.name_next;o.includes(t.mount)&&Ce.destroyNode(t),t=r}})),r.mounted=null;var i=r.mount.mounts.indexOf(n);r.mount.mounts.splice(i,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var n=Ce.lookupPath(e,{parent:!0}).node,o=le.basename(e);if(!o||"."===o||".."===o)throw new Ce.ErrnoError(28);var i=Ce.mayCreate(n,o);if(i)throw new Ce.ErrnoError(i);if(!n.node_ops.mknod)throw new Ce.ErrnoError(63);return n.node_ops.mknod(n,o,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,Ce.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,Ce.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),n="",o=0;o<r.length;++o)if(r[o]){n+="/"+r[o];try{Ce.mkdir(n,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>(void 0===r&&(r=t,t=438),t|=8192,Ce.mknod(e,t,r)),symlink(e,t){if(!pe.resolve(e))throw new Ce.ErrnoError(44);var r=Ce.lookupPath(t,{parent:!0}).node;if(!r)throw new Ce.ErrnoError(44);var n=le.basename(t),o=Ce.mayCreate(r,n);if(o)throw new Ce.ErrnoError(o);if(!r.node_ops.symlink)throw new Ce.ErrnoError(63);return r.node_ops.symlink(r,n,e)},rename(e,t){var r,n,o=le.dirname(e),i=le.dirname(t),a=le.basename(e),s=le.basename(t);if(r=Ce.lookupPath(e,{parent:!0}).node,n=Ce.lookupPath(t,{parent:!0}).node,!r||!n)throw new Ce.ErrnoError(44);if(r.mount!==n.mount)throw new Ce.ErrnoError(75);var u,c=Ce.lookupNode(r,a),l=pe.relative(e,i);if("."!==l.charAt(0))throw new Ce.ErrnoError(28);if("."!==(l=pe.relative(t,o)).charAt(0))throw new Ce.ErrnoError(55);try{u=Ce.lookupNode(n,s)}catch(e){}if(c!==u){var d=Ce.isDir(c.mode),p=Ce.mayDelete(r,a,d);if(p)throw new Ce.ErrnoError(p);if(p=u?Ce.mayDelete(n,s,d):Ce.mayCreate(n,s))throw new Ce.ErrnoError(p);if(!r.node_ops.rename)throw new Ce.ErrnoError(63);if(Ce.isMountpoint(c)||u&&Ce.isMountpoint(u))throw new Ce.ErrnoError(10);if(n!==r&&(p=Ce.nodePermissions(r,"w")))throw new Ce.ErrnoError(p);Ce.hashRemoveNode(c);try{r.node_ops.rename(c,n,s)}catch(e){throw e}finally{Ce.hashAddNode(c)}}},rmdir(e){var t=Ce.lookupPath(e,{parent:!0}).node,r=le.basename(e),n=Ce.lookupNode(t,r),o=Ce.mayDelete(t,r,!0);if(o)throw new Ce.ErrnoError(o);if(!t.node_ops.rmdir)throw new Ce.ErrnoError(63);if(Ce.isMountpoint(n))throw new Ce.ErrnoError(10);t.node_ops.rmdir(t,r),Ce.destroyNode(n)},readdir(e){var t=Ce.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new Ce.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=Ce.lookupPath(e,{parent:!0}).node;if(!t)throw new Ce.ErrnoError(44);var r=le.basename(e),n=Ce.lookupNode(t,r),o=Ce.mayDelete(t,r,!1);if(o)throw new Ce.ErrnoError(o);if(!t.node_ops.unlink)throw new Ce.ErrnoError(63);if(Ce.isMountpoint(n))throw new Ce.ErrnoError(10);t.node_ops.unlink(t,r),Ce.destroyNode(n)},readlink(e){var t=Ce.lookupPath(e).node;if(!t)throw new Ce.ErrnoError(44);if(!t.node_ops.readlink)throw new Ce.ErrnoError(28);return pe.resolve(Ce.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=Ce.lookupPath(e,{follow:!t}).node;if(!r)throw new Ce.ErrnoError(44);if(!r.node_ops.getattr)throw new Ce.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>Ce.stat(e,!0),chmod(e,t,r){var n;if(!(n="string"==typeof e?Ce.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new Ce.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&t|-4096&n.mode,timestamp:Date.now()})},lchmod(e,t){Ce.chmod(e,t,!0)},fchmod(e,t){var r=Ce.getStreamChecked(e);Ce.chmod(r.node,t)},chown(e,t,r,n){var o;if(!(o="string"==typeof e?Ce.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new Ce.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,t,r){Ce.chown(e,t,r,!0)},fchown(e,t,r){var n=Ce.getStreamChecked(e);Ce.chown(n.node,t,r)},truncate(e,t){if(t<0)throw new Ce.ErrnoError(28);var r;if(!(r="string"==typeof e?Ce.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new Ce.ErrnoError(63);if(Ce.isDir(r.mode))throw new Ce.ErrnoError(31);if(!Ce.isFile(r.mode))throw new Ce.ErrnoError(28);var n=Ce.nodePermissions(r,"w");if(n)throw new Ce.ErrnoError(n);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=Ce.getStreamChecked(e);if(0==(2097155&r.flags))throw new Ce.ErrnoError(28);Ce.truncate(r.node,t)},utime(e,t,r){var n=Ce.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new Ce.ErrnoError(44);var n;if(r=void 0===r?438:r,r=64&(t="string"==typeof t?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t})(t):t)?4095&r|32768:0,"object"==typeof e)n=e;else{e=le.normalize(e);try{n=Ce.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var o=!1;if(64&t)if(n){if(128&t)throw new Ce.ErrnoError(20)}else n=Ce.mknod(e,r,0),o=!0;if(!n)throw new Ce.ErrnoError(44);if(Ce.isChrdev(n.mode)&&(t&=-513),65536&t&&!Ce.isDir(n.mode))throw new Ce.ErrnoError(54);if(!o){var i=Ce.mayOpen(n,t);if(i)throw new Ce.ErrnoError(i)}512&t&&!o&&Ce.truncate(n,0),t&=-131713;var a=Ce.createStream({node:n,path:Ce.getPath(n),flags:t,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!u.logReadFiles||1&t||(Ce.readFiles||(Ce.readFiles={}),e in Ce.readFiles||(Ce.readFiles[e]=1)),a},close(e){if(Ce.isClosed(e))throw new Ce.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Ce.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Ce.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Ce.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,n,o){if(n<0||o<0)throw new Ce.ErrnoError(28);if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(1==(2097155&e.flags))throw new Ce.ErrnoError(8);if(Ce.isDir(e.node.mode))throw new Ce.ErrnoError(31);if(!e.stream_ops.read)throw new Ce.ErrnoError(28);var i=void 0!==o;if(i){if(!e.seekable)throw new Ce.ErrnoError(70)}else o=e.position;var a=e.stream_ops.read(e,t,r,n,o);return i||(e.position+=a),a},write(e,t,r,n,o,i){if(n<0||o<0)throw new Ce.ErrnoError(28);if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(0==(2097155&e.flags))throw new Ce.ErrnoError(8);if(Ce.isDir(e.node.mode))throw new Ce.ErrnoError(31);if(!e.stream_ops.write)throw new Ce.ErrnoError(28);e.seekable&&1024&e.flags&&Ce.llseek(e,0,2);var a=void 0!==o;if(a){if(!e.seekable)throw new Ce.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,t,r,n,o,i);return a||(e.position+=s),s},allocate(e,t,r){if(Ce.isClosed(e))throw new Ce.ErrnoError(8);if(t<0||r<=0)throw new Ce.ErrnoError(28);if(0==(2097155&e.flags))throw new Ce.ErrnoError(8);if(!Ce.isFile(e.node.mode)&&!Ce.isDir(e.node.mode))throw new Ce.ErrnoError(43);if(!e.stream_ops.allocate)throw new Ce.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&e.flags))throw new Ce.ErrnoError(2);if(1==(2097155&e.flags))throw new Ce.ErrnoError(2);if(!e.stream_ops.mmap)throw new Ce.ErrnoError(43);return e.stream_ops.mmap(e,t,r,n,o)},msync:(e,t,r,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,n,o):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Ce.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,n=Ce.open(e,t.flags),o=Ce.stat(e).size,i=new Uint8Array(o);return Ce.read(n,i,0,o,0),"utf8"===t.encoding?r=fe(i,0):"binary"===t.encoding&&(r=i),Ce.close(n),r},writeFile(e,t,r={}){r.flags=r.flags||577;var n=Ce.open(e,r.flags,r.mode);if("string"==typeof t){var o=new Uint8Array(ge(t)+1),i=ye(t,o,0,o.length);Ce.write(n,o,0,i,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Ce.write(n,t,0,t.byteLength,void 0,r.canOwn)}Ce.close(n)},cwd:()=>Ce.currentPath,chdir(e){var t=Ce.lookupPath(e,{follow:!0});if(null===t.node)throw new Ce.ErrnoError(44);if(!Ce.isDir(t.node.mode))throw new Ce.ErrnoError(54);var r=Ce.nodePermissions(t.node,"x");if(r)throw new Ce.ErrnoError(r);Ce.currentPath=t.path},createDefaultDirectories(){Ce.mkdir("/tmp"),Ce.mkdir("/home"),Ce.mkdir("/home/web_user")},createDefaultDevices(){Ce.mkdir("/dev"),Ce.registerDevice(Ce.makedev(1,3),{read:()=>0,write:(e,t,r,n,o)=>n}),Ce.mkdev("/dev/null",Ce.makedev(1,3)),ve.register(Ce.makedev(5,0),ve.default_tty_ops),ve.register(Ce.makedev(6,0),ve.default_tty1_ops),Ce.mkdev("/dev/tty",Ce.makedev(5,0)),Ce.mkdev("/dev/tty1",Ce.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=de(e).byteLength),e[--t]);Ce.createDevice("/dev","random",r),Ce.createDevice("/dev","urandom",r),Ce.mkdir("/dev/shm"),Ce.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Ce.mkdir("/proc");var e=Ce.mkdir("/proc/self");Ce.mkdir("/proc/self/fd"),Ce.mount({mount(){var t=Ce.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,n=Ce.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},t}},{},"/proc/self/fd")},createStandardStreams(){u.stdin?Ce.createDevice("/dev","stdin",u.stdin):Ce.symlink("/dev/tty","/dev/stdin"),u.stdout?Ce.createDevice("/dev","stdout",null,u.stdout):Ce.symlink("/dev/tty","/dev/stdout"),u.stderr?Ce.createDevice("/dev","stderr",null,u.stderr):Ce.symlink("/dev/tty1","/dev/stderr"),Ce.open("/dev/stdin",0),Ce.open("/dev/stdout",1),Ce.open("/dev/stderr",1)},staticInit(){[44].forEach((e=>{Ce.genericErrors[e]=new Ce.ErrnoError(e),Ce.genericErrors[e].stack="<generic error, no stack>"})),Ce.nameTable=new Array(4096),Ce.mount(_e,{},"/"),Ce.createDefaultDirectories(),Ce.createDefaultDevices(),Ce.createSpecialDirectories(),Ce.filesystems={MEMFS:_e}},init(e,t,r){Ce.init.initialized=!0,u.stdin=e||u.stdin,u.stdout=t||u.stdout,u.stderr=r||u.stderr,Ce.createStandardStreams()},quit(){Ce.init.initialized=!1;for(var e=0;e<Ce.streams.length;e++){var t=Ce.streams[e];t&&Ce.close(t)}},findObject(e,t){var r=Ce.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(n=Ce.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Ce.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=le.basename(e),n=Ce.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,n){e="string"==typeof e?e:Ce.getPath(e);for(var o=t.split("/").reverse();o.length;){var i=o.pop();if(i){var a=le.join2(e,i);try{Ce.mkdir(a)}catch(e){}e=a}}return a},createFile(e,t,r,n,o){var i=le.join2("string"==typeof e?e:Ce.getPath(e),t),a=Se(n,o);return Ce.create(i,a)},createDataFile(e,t,r,n,o,i){var a=t;e&&(e="string"==typeof e?e:Ce.getPath(e),a=t?le.join2(e,t):e);var s=Se(n,o),u=Ce.create(a,s);if(r){if("string"==typeof r){for(var c=new Array(r.length),l=0,d=r.length;l<d;++l)c[l]=r.charCodeAt(l);r=c}Ce.chmod(u,146|s);var p=Ce.open(u,577);Ce.write(p,r,0,r.length,0,i),Ce.close(p),Ce.chmod(u,s)}},createDevice(e,t,r,n){var o=le.join2("string"==typeof e?e:Ce.getPath(e),t),i=Se(!!r,!!n);Ce.createDevice.major||(Ce.createDevice.major=64);var a=Ce.makedev(Ce.createDevice.major++,0);return Ce.registerDevice(a,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,t,n,o,i){for(var a=0,s=0;s<o;s++){var u;try{u=r()}catch(e){throw new Ce.ErrnoError(29)}if(void 0===u&&0===a)throw new Ce.ErrnoError(6);if(null==u)break;a++,t[n+s]=u}return a&&(e.node.timestamp=Date.now()),a},write(e,t,r,o,i){for(var a=0;a<o;a++)try{n(t[r+a])}catch(e){throw new Ce.ErrnoError(29)}return o&&(e.node.timestamp=Date.now()),a}}),Ce.mkdev(o,i,a)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!c)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=be(c(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new Ce.ErrnoError(29)}},createLazyFile(e,t,r,n,o){function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},i.prototype.setDataGetter=function(e){this.getter=e},i.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,n=Number(e.getResponseHeader("Content-length")),o=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,i=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;o||(a=n);var s=this;s.setDataGetter((e=>{var t=e*a,o=(e+1)*a-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==a&&o.setRequestHeader("Range","bytes="+e+"-"+t),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):be(o.responseText||"",!0)})(t,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!i&&n||(a=n=1,n=this.getter(0).length,a=n,C("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!y)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new i;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:r};var u=Ce.createFile(e,t,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var c={};function l(e,t,r,n,o){var i=e.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var s=0;s<a;s++)t[r+s]=i[o+s];else for(s=0;s<a;s++)t[r+s]=i.get(o+s);return a}return Object.keys(u.stream_ops).forEach((e=>{var t=u.stream_ops[e];c[e]=function(){return Ce.forceLoadFile(u),t.apply(null,arguments)}})),c.read=(e,t,r,n,o)=>(Ce.forceLoadFile(u),l(e,t,r,n,o)),c.mmap=(e,t,r,n,o)=>{Ce.forceLoadFile(u);var i=we(t);if(!i)throw new Ce.ErrnoError(48);return l(e,T,i,t,r),{ptr:i,allocated:!0}},u.stream_ops=c,u}},xe=(e,t)=>e?fe(A,e,t):"",ke={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(le.isAbs(t))return t;var n;if(n=-100===e?Ce.cwd():ke.getStreamFromFD(e).path,0==t.length){if(!r)throw new Ce.ErrnoError(44);return n}return le.join2(n,t)},doStat(e,t,r){var n=e(t);F[r>>2]=n.dev,F[r+4>>2]=n.mode,L[r+8>>2]=n.nlink,F[r+12>>2]=n.uid,F[r+16>>2]=n.gid,F[r+20>>2]=n.rdev,B[r+24>>3]=BigInt(n.size),F[r+32>>2]=4096,F[r+36>>2]=n.blocks;var o=n.atime.getTime(),i=n.mtime.getTime(),a=n.ctime.getTime();return B[r+40>>3]=BigInt(Math.floor(o/1e3)),L[r+48>>2]=o%1e3*1e3,B[r+56>>3]=BigInt(Math.floor(i/1e3)),L[r+64>>2]=i%1e3*1e3,B[r+72>>3]=BigInt(Math.floor(a/1e3)),L[r+80>>2]=a%1e3*1e3,B[r+88>>3]=BigInt(n.ino),0},doMsync(e,t,r,n,o){if(!Ce.isFile(t.node.mode))throw new Ce.ErrnoError(43);if(2&n)return 0;var i=A.slice(e,e+r);Ce.msync(t,i,o,r,n)},varargs:void 0,get(){var e=F[+ke.varargs>>2];return ke.varargs+=4,e},getp:()=>ke.get(),getStr:e=>xe(e),getStreamFromFD:e=>Ce.getStreamChecked(e)},Te={},Ae=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Pe(e){return this.fromWireType(F[e>>2])}var qe,Fe,Le,De={},Be={},Re={},Me=e=>{throw new qe(e)},Oe=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&Me("Mismatched type converter count");for(var o=0;o<e.length;++o)Ne(e[o],n[o])}e.forEach((function(e){Re[e]=t}));var o=new Array(t.length),i=[],a=0;t.forEach(((e,t)=>{Be.hasOwnProperty(e)?o[t]=Be[e]:(i.push(e),De.hasOwnProperty(e)||(De[e]=[]),De[e].push((()=>{o[t]=Be[e],++a===i.length&&n(o)})))})),0===i.length&&n(o)},Ie={},je=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Ue=e=>{for(var t="",r=e;A[r];)t+=Fe[A[r++]];return t},$e=e=>{throw new Le(e)};function Ne(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||$e(`type "${n}" must have a positive integer typeid pointer`),Be.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;$e(`Cannot register type '${n}' twice`)}if(Be[e]=t,delete Re[e],De.hasOwnProperty(e)){var o=De[e];delete De[e],o.forEach((e=>e()))}}(e,t,r)}var He,Ve=(e,t,r)=>{switch(t){case 1:return r?e=>T[e>>0]:e=>A[e>>0];case 2:return r?e=>P[e>>1]:e=>q[e>>1];case 4:return r?e=>F[e>>2]:e=>L[e>>2];case 8:return r?e=>B[e>>3]:e=>R[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},We=8,ze=e=>{$e(e.$$.ptrType.registeredClass.name+" instance already deleted")},Ge=!1,Ye=e=>{},Xe=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},Ze=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=Ze(e,t,r.baseClass);return null===n?null:r.downcast(n)},Ke={},Qe=()=>Object.keys(nt).length,Je=()=>{var e=[];for(var t in nt)nt.hasOwnProperty(t)&&e.push(nt[t]);return e},et=[],tt=()=>{for(;et.length;){var e=et.pop();e.$$.deleteScheduled=!1,e.delete()}},rt=e=>{He=e,et.length&&He&&He(tt)},nt={},ot=(e,t)=>(t=((e,t)=>{for(void 0===t&&$e("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),nt[t]),it=(e,t)=>(t.ptrType&&t.ptr||Me("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Me("Both smartPtrType and smartPtr must be specified"),t.count={value:1},st(Object.create(e,{$$:{value:t,writable:!0}})));function at(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ot(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function o(){return this.isSmartPointer?it(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):it(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,a=this.registeredClass.getActualType(t),s=Ke[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=Ze(t,this.registeredClass,i.registeredClass);return null===u?o.call(this):this.isSmartPointer?it(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:e}):it(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})}var st=e=>"undefined"==typeof FinalizationRegistry?(st=e=>e,e):(Ge=new FinalizationRegistry((e=>{Xe(e.$$)})),Ye=e=>Ge.unregister(e),(st=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Ge.register(e,r,e)}return e})(e));function ut(){}var lt=(e,t)=>Object.defineProperty(t,"name",{value:e}),dt=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||$e(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},pt=(e,t,r)=>{u.hasOwnProperty(e)?((void 0===r||void 0!==u[e].overloadTable&&void 0!==u[e].overloadTable[r])&&$e(`Cannot register public name '${e}' twice`),dt(u,e,e),u.hasOwnProperty(r)&&$e(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),u[e].overloadTable[r]=t):(u[e]=t,void 0!==r&&(u[e].numArguments=r))};function ht(e,t,r,n,o,i,a,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}var ft=(e,t,r)=>{for(;t!==r;)t.upcast||$e(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function mt(e,t){if(null===t)return this.isReference&&$e(`null is not a valid ${this.name}`),0;t.$$||$e(`Cannot pass "${je(t)}" as a ${this.name}`),t.$$.ptr||$e(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ft(t.$$.ptr,r,this.registeredClass)}function gt(e,t){var r;if(null===t)return this.isReference&&$e(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t&&t.$$||$e(`Cannot pass "${je(t)}" as a ${this.name}`),t.$$.ptr||$e(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&$e(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;if(r=ft(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&$e("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:$e(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var o=t.clone();r=this.rawShare(r,Ot.toHandle((()=>o.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:$e("Unsupporting sharing policy")}return r}function yt(e,t){if(null===t)return this.isReference&&$e(`null is not a valid ${this.name}`),0;t.$$||$e(`Cannot pass "${je(t)}" as a ${this.name}`),t.$$.ptr||$e(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&$e(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return ft(t.$$.ptr,r,this.registeredClass)}function bt(e){return this.fromWireType(L[e>>2])}function vt(e,t,r,n,o,i,a,s,u,c,l){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=c,this.rawDestructor=l,o||void 0!==t.baseClass?this.toWireType=gt:n?(this.toWireType=mt,this.destructorFunction=null):(this.toWireType=yt,this.destructorFunction=null)}var wt,_t,Et=(e,t,r)=>{u.hasOwnProperty(e)||Me("Replacing nonexistant public symbol"),void 0!==u[e].overloadTable&&void 0!==r?u[e].overloadTable[r]=t:(u[e]=t,u[e].argCount=r)},St=[],Ct=e=>{var t=St[e];return t||(e>=St.length&&(St.length=e+1),St[e]=t=wt.get(e)),t},xt=(e,t)=>{e=Ue(e);var r=Ct(t);return"function"!=typeof r&&$e(`unknown function pointer with signature ${e}: ${t}`),r},kt=e=>{var t=Mu(e),r=Ue(t);return Lu(t),r},Tt=(e,t)=>{var r=[],n={};throw t.forEach((function e(t){n[t]||Be[t]||(Re[t]?Re[t].forEach(e):(r.push(t),n[t]=!0))})),new _t(`${e}: `+r.map(kt).join([", "]))},At=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(L[t+4*n>>2]);return r};function Pt(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}function qt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=lt(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,o=e.apply(n,t);return o instanceof Object?o:n}function Ft(e,t,r,n,o,i){var a=t.length;a<2&&$e("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,u=Pt(t),c="void"!==t[0].name,l=[e,$e,n,o,Ae,t[0],t[1]],d=0;d<a-2;++d)l.push(t[d+2]);if(!u)for(d=s?1:2;d<t.length;++d)null!==t[d].destructorFunction&&l.push(t[d].destructorFunction);let[p,h]=function(e,t,r,n){for(var o=Pt(e),i=e.length,a="",s="",u=0;u<i-2;++u)a+=(0!==u?", ":"")+"arg"+u,s+=(0!==u?", ":"")+"arg"+u+"Wired";var c=`\n return function (${a}) {\n if (arguments.length !== ${i-2}) {\n throwBindingError('function ' + humanName + ' called with ' + arguments.length + ' arguments, expected ${i-2}');\n }`;o&&(c+="var destructors = [];\n");var l=o?"destructors":"null",d=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];for(t&&(c+="var thisWired = classParam['toWireType']("+l+", this);\n"),u=0;u<i-2;++u)c+="var arg"+u+"Wired = argType"+u+"['toWireType']("+l+", arg"+u+");\n",d.push("argType"+u);if(t&&(s="thisWired"+(s.length>0?", ":"")+s),c+=(r||n?"var rv = ":"")+"invoker(fn"+(s.length>0?", ":"")+s+");\n",o)c+="runDestructors(destructors);\n";else for(u=t?1:2;u<e.length;++u){var p=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(c+=p+"_dtor("+p+");\n",d.push(p+"_dtor"))}return r&&(c+="var ret = retType['fromWireType'](rv);\nreturn ret;\n"),[d,c+="}\n"]}(t,s,c,i);p.push(h);var f=qt(Function,p).apply(null,l);return lt(e,f)}var Lt,Dt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Bt=new class HandleAllocator{constructor(){this.allocated=[void 0],this.freelist=[]}get(e){return this.allocated[e]}has(e){return void 0!==this.allocated[e]}allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t}free(e){this.allocated[e]=void 0,this.freelist.push(e)}},Rt=e=>{e>=Bt.reserved&&0==--Bt.get(e).refcount&&Bt.free(e)},Mt=()=>{for(var e=0,t=Bt.reserved;t<Bt.allocated.length;++t)void 0!==Bt.allocated[t]&&++e;return e},Ot={toValue:e=>(e||$e("Cannot use deleted val. handle = "+e),Bt.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return Bt.allocate({refcount:1,value:e})}}},It={name:"emscripten::val",fromWireType:e=>{var t=Ot.toValue(e);return Rt(e),t},toWireType:(e,t)=>Ot.toHandle(t),argPackAdvance:We,readValueFromPointer:Pe,destructorFunction:null},jt=(e,t,r)=>{switch(t){case 1:return r?function(e){return this.fromWireType(T[e>>0])}:function(e){return this.fromWireType(A[e>>0])};case 2:return r?function(e){return this.fromWireType(P[e>>1])}:function(e){return this.fromWireType(q[e>>1])};case 4:return r?function(e){return this.fromWireType(F[e>>2])}:function(e){return this.fromWireType(L[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Ut=(e,t)=>{var r=Be[e];return void 0===r&&$e(t+" has unknown type "+kt(e)),r},$t=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(D[e>>2])};case 8:return function(e){return this.fromWireType(M[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Nt=(e,t,r)=>ye(e,A,t,r),Ht="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Vt=(e,t)=>{for(var r=e,n=r>>1,o=n+t/2;!(n>=o)&&q[n];)++n;if((r=n<<1)-e>32&&Ht)return Ht.decode(A.subarray(e,r));for(var i="",a=0;!(a>=t/2);++a){var s=P[e+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i},Wt=(e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var n=t,o=(r-=2)<2*e.length?r/2:e.length,i=0;i<o;++i){var a=e.charCodeAt(i);P[t>>1]=a,t+=2}return P[t>>1]=0,t-n},zt=e=>2*e.length,Gt=(e,t)=>{for(var r=0,n="";!(r>=t/4);){var o=F[e+4*r>>2];if(0==o)break;if(++r,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n},Yt=(e,t,r)=>{if(r??=2147483647,r<4)return 0;for(var n=t,o=n+r-4,i=0;i<e.length;++i){var a=e.charCodeAt(i);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++i)),F[t>>2]=a,(t+=4)+4>o)break}return F[t>>2]=0,t-n},Xt=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},Zt=(e,t,r)=>{var n=[],o=e.toWireType(n,r);return n.length&&(L[t>>2]=Ot.toHandle(n)),o},Kt=[],Qt={},Jt=e=>{var t=Qt[e];return void 0===t?Ue(e):t},er=()=>"object"==typeof globalThis?globalThis:function(){return Function}()("return this")(),tr=(Reflect.construct,e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e)),rr=e=>e%4==0&&(e%100!=0||e%400==0),nr=[0,31,60,91,121,152,182,213,244,274,305,335],or=[0,31,59,90,120,151,181,212,243,273,304,334],ir=e=>(rr(e.getFullYear())?nr:or)[e.getMonth()]+e.getDate()-1,ar=e=>{var t=ge(e)+1,r=qu(t);return r&&Nt(e,r,t),r},sr=(e,t)=>{if(fr.mainLoop.timingMode=e,fr.mainLoop.timingValue=t,!fr.mainLoop.func)return 1;if(fr.mainLoop.running||(fr.mainLoop.running=!0),0==e)fr.mainLoop.scheduler=function(){var e=0|Math.max(0,fr.mainLoop.tickStartTime+t-Lt());setTimeout(fr.mainLoop.runner,e)},fr.mainLoop.method="timeout";else if(1==e)fr.mainLoop.scheduler=function(){fr.requestAnimationFrame(fr.mainLoop.runner)},fr.mainLoop.method="rAF";else if(2==e){if(void 0===fr.setImmediate)if("undefined"==typeof setImmediate){var r=[],n="setimmediate";addEventListener("message",(e=>{e.data!==n&&e.data.target!==n||(e.stopPropagation(),r.shift()())}),!0),fr.setImmediate=function(e){r.push(e),y?(void 0===u.setImmediates&&(u.setImmediates=[]),u.setImmediates.push(e),postMessage({target:n})):postMessage(n,"*")}}else fr.setImmediate=setImmediate;fr.mainLoop.scheduler=function(){fr.setImmediate(fr.mainLoop.runner)},fr.mainLoop.method="immediate"}return 0};Lt=()=>performance.now();var ur=e=>{if(e instanceof oe||"unwind"==e)return k;m(1,e)},cr=()=>ae||!1,lr=(e,t)=>{var r;k=e,k=r=e,cr()||(u.onExit?.(r),O=!0),m(r,new oe(r))},dr=lr,pr=e=>{if(!O)try{e(),(()=>{if(!cr())try{dr(k)}catch(e){ur(e)}})()}catch(e){ur(e)}},hr=(e,t)=>setTimeout((()=>{pr(e)}),t),fr={mainLoop:{running:!1,scheduler:null,method:"",currentlyRunningMainloop:0,func:null,arg:0,timingMode:0,timingValue:0,currentFrameNumber:0,queue:[],pause(){fr.mainLoop.scheduler=null,fr.mainLoop.currentlyRunningMainloop++},resume(){fr.mainLoop.currentlyRunningMainloop++;var e=fr.mainLoop.timingMode,t=fr.mainLoop.timingValue,r=fr.mainLoop.func;fr.mainLoop.func=null,((e,t,r,n,o)=>{I(!fr.mainLoop.func,"emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters."),fr.mainLoop.func=e,fr.mainLoop.arg=n;var i=fr.mainLoop.currentlyRunningMainloop;function a(){return!(i<fr.mainLoop.currentlyRunningMainloop)}if(fr.mainLoop.running=!1,fr.mainLoop.runner=function(){if(!O)if(fr.mainLoop.queue.length>0){Date.now();var t=fr.mainLoop.queue.shift();if(t.func(t.arg),fr.mainLoop.remainingBlockers){var r=fr.mainLoop.remainingBlockers,n=r%1==0?r-1:Math.floor(r);t.counted?fr.mainLoop.remainingBlockers=n:(n+=.5,fr.mainLoop.remainingBlockers=(8*r+n)/9)}if(fr.mainLoop.updateStatus(),!a())return;setTimeout(fr.mainLoop.runner,0)}else a()&&(fr.mainLoop.currentFrameNumber=fr.mainLoop.currentFrameNumber+1|0,1==fr.mainLoop.timingMode&&fr.mainLoop.timingValue>1&&fr.mainLoop.currentFrameNumber%fr.mainLoop.timingValue!=0?fr.mainLoop.scheduler():(0==fr.mainLoop.timingMode&&(fr.mainLoop.tickStartTime=Lt()),fr.mainLoop.runIter(e),a()&&("object"==typeof SDL&&SDL.audio?.queueNewAudioData?.(),fr.mainLoop.scheduler())))},o||(t&&t>0?sr(0,1e3/t):sr(1,1),fr.mainLoop.scheduler()),r)throw"unwind"})(r,0,!1,fr.mainLoop.arg,!0),sr(e,t),fr.mainLoop.scheduler()},updateStatus(){if(u.setStatus){var e=u.statusMessage||"Please wait...",t=fr.mainLoop.remainingBlockers,r=fr.mainLoop.expectedBlockers;t?t<r?u.setStatus(e+" ("+(r-t)+"/"+r+")"):u.setStatus(e):u.setStatus("")}},runIter(e){if(!O){if(u.preMainLoop&&!1===u.preMainLoop())return;pr(e),u.postMainLoop?.()}}},isFullscreen:!1,pointerLock:!1,moduleContextCreatedCallbacks:[],workers:[],init(){if(!fr.initted){fr.initted=!0;var e={canHandle:function(e){return!u.noImageDecoding&&/\.(jpg|jpeg|png|bmp)$/i.test(e)},handle:function(e,t,r,n){var o=new Blob([e],{type:fr.getMimetype(t)});o.size!==e.length&&(o=new Blob([new Uint8Array(e).buffer],{type:fr.getMimetype(t)}));var i=URL.createObjectURL(o),a=new Image;a.onload=()=>{I(a.complete,`Image ${t} could not be decoded`);var n=document.createElement("canvas");n.width=a.width,n.height=a.height,n.getContext("2d").drawImage(a,0,0),Eu[t]=n,URL.revokeObjectURL(i),r?.(e)},a.onerror=e=>{x(`Image ${i} could not be decoded`),n?.()},a.src=i}};Ee.push(e);var t={canHandle:function(e){return!u.noAudioDecoding&&e.substr(-4)in{".ogg":1,".wav":1,".mp3":1}},handle:function(e,t,r,n){var o=!1;function i(n){o||(o=!0,Su[t]=n,r?.(e))}var a=new Blob([e],{type:fr.getMimetype(t)}),s=URL.createObjectURL(a),u=new Audio;u.addEventListener("canplaythrough",(()=>i(u)),!1),u.onerror=function(r){o||(x(`warning: browser could not fully decode audio ${t}, trying slower base64 approach`),u.src="data:audio/x-"+t.substr(-3)+";base64,"+function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="",n=0,o=0,i=0;i<e.length;i++)for(n=n<<8|e[i],o+=8;o>=6;){var a=n>>o-6&63;o-=6,r+=t[a]}return 2==o?(r+=t[(3&n)<<4],r+="=="):4==o&&(r+=t[(15&n)<<2],r+="="),r}(e),i(u))},u.src=s,hr((()=>{i(u)}),1e4)}};Ee.push(t);var r=u.canvas;r&&(r.requestPointerLock=r.requestPointerLock||r.mozRequestPointerLock||r.webkitRequestPointerLock||r.msRequestPointerLock||(()=>{}),r.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock||document.msExitPointerLock||(()=>{}),r.exitPointerLock=r.exitPointerLock.bind(document),document.addEventListener("pointerlockchange",n,!1),document.addEventListener("mozpointerlockchange",n,!1),document.addEventListener("webkitpointerlockchange",n,!1),document.addEventListener("mspointerlockchange",n,!1),u.elementPointerLock&&r.addEventListener("click",(e=>{!fr.pointerLock&&u.canvas.requestPointerLock&&(u.canvas.requestPointerLock(),e.preventDefault())}),!1))}function n(){fr.pointerLock=document.pointerLockElement===u.canvas||document.mozPointerLockElement===u.canvas||document.webkitPointerLockElement===u.canvas||document.msPointerLockElement===u.canvas}},createContext(e,t,r,n){if(t&&u.ctx&&e==u.canvas)return u.ctx;var o,i;if(t){var a={antialias:!1,alpha:!1,majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1};if(n)for(var s in n)a[s]=n[s];void 0!==gr&&(i=gr.createContext(e,a))&&(o=gr.getContext(i).GLctx)}else o=e.getContext("2d");return o?(r&&(t||I(void 0===_u,"cannot set in module if GLctx is used, but we are a non-GL context that would replace it"),u.ctx=o,t&&gr.makeContextCurrent(i),u.useWebGL=t,fr.moduleContextCreatedCallbacks.forEach((e=>e())),fr.init()),o):null},destroyContext(e,t,r){},fullscreenHandlersInstalled:!1,lockPointer:void 0,resizeCanvas:void 0,requestFullscreen(e,t){fr.lockPointer=e,fr.resizeCanvas=t,void 0===fr.lockPointer&&(fr.lockPointer=!0),void 0===fr.resizeCanvas&&(fr.resizeCanvas=!1);var r=u.canvas;function n(){fr.isFullscreen=!1;var e=r.parentNode;(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e?(r.exitFullscreen=fr.exitFullscreen,fr.lockPointer&&r.requestPointerLock(),fr.isFullscreen=!0,fr.resizeCanvas?fr.setFullscreenCanvasSize():fr.updateCanvasDimensions(r)):(e.parentNode.insertBefore(r,e),e.parentNode.removeChild(e),fr.resizeCanvas?fr.setWindowedCanvasSize():fr.updateCanvasDimensions(r)),u.onFullScreen?.(fr.isFullscreen),u.onFullscreen?.(fr.isFullscreen)}fr.fullscreenHandlersInstalled||(fr.fullscreenHandlersInstalled=!0,document.addEventListener("fullscreenchange",n,!1),document.addEventListener("mozfullscreenchange",n,!1),document.addEventListener("webkitfullscreenchange",n,!1),document.addEventListener("MSFullscreenChange",n,!1));var o=document.createElement("div");r.parentNode.insertBefore(o,r),o.appendChild(r),o.requestFullscreen=o.requestFullscreen||o.mozRequestFullScreen||o.msRequestFullscreen||(o.webkitRequestFullscreen?()=>o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):null)||(o.webkitRequestFullScreen?()=>o.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):null),o.requestFullscreen()},exitFullscreen:()=>!!fr.isFullscreen&&((document.exitFullscreen||document.cancelFullScreen||document.mozCancelFullScreen||document.msExitFullscreen||document.webkitCancelFullScreen||(()=>{})).apply(document,[]),!0),nextRAF:0,fakeRequestAnimationFrame(e){var t=Date.now();if(0===fr.nextRAF)fr.nextRAF=t+1e3/60;else for(;t+2>=fr.nextRAF;)fr.nextRAF+=1e3/60;var r=Math.max(fr.nextRAF-t,0);setTimeout(e,r)},requestAnimationFrame(e){"function"!=typeof requestAnimationFrame?(0,fr.fakeRequestAnimationFrame)(e):requestAnimationFrame(e)},safeSetTimeout:(e,t)=>hr(e,t),safeRequestAnimationFrame:e=>fr.requestAnimationFrame((()=>{pr(e)})),getMimetype:e=>({jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",bmp:"image/bmp",ogg:"audio/ogg",wav:"audio/wav",mp3:"audio/mpeg"}[e.substr(e.lastIndexOf(".")+1)]),getUserMedia(e){window.getUserMedia||=navigator.getUserMedia||navigator.mozGetUserMedia,window.getUserMedia(e)},getMovementX:e=>e.movementX||e.mozMovementX||e.webkitMovementX||0,getMovementY:e=>e.movementY||e.mozMovementY||e.webkitMovementY||0,getMouseWheelDelta(e){var t=0;switch(e.type){case"DOMMouseScroll":t=e.detail/3;break;case"mousewheel":t=e.wheelDelta/120;break;case"wheel":switch(t=e.deltaY,e.deltaMode){case 0:t/=100;break;case 1:t/=3;break;case 2:t*=80;break;default:throw"unrecognized mouse wheel delta mode: "+e.deltaMode}break;default:throw"unrecognized mouse wheel event: "+e.type}return t},mouseX:0,mouseY:0,mouseMovementX:0,mouseMovementY:0,touches:{},lastTouches:{},calculateMouseCoords(e,t){var r=u.canvas.getBoundingClientRect(),n=u.canvas.width,o=u.canvas.height,i=void 0!==window.scrollX?window.scrollX:window.pageXOffset,a=void 0!==window.scrollY?window.scrollY:window.pageYOffset,s=e-(i+r.left),c=t-(a+r.top);return{x:s*=n/r.width,y:c*=o/r.height}},setMouseCoords(e,t){const{x:r,y:n}=fr.calculateMouseCoords(e,t);fr.mouseMovementX=r-fr.mouseX,fr.mouseMovementY=n-fr.mouseY,fr.mouseX=r,fr.mouseY=n},calculateMouseEvent(e){if(fr.pointerLock)"mousemove"!=e.type&&"mozMovementX"in e?fr.mouseMovementX=fr.mouseMovementY=0:(fr.mouseMovementX=fr.getMovementX(e),fr.mouseMovementY=fr.getMovementY(e)),"undefined"!=typeof SDL?(fr.mouseX=SDL.mouseX+fr.mouseMovementX,fr.mouseY=SDL.mouseY+fr.mouseMovementY):(fr.mouseX+=fr.mouseMovementX,fr.mouseY+=fr.mouseMovementY);else{if("touchstart"===e.type||"touchend"===e.type||"touchmove"===e.type){var t=e.touch;if(void 0===t)return;var r=fr.calculateMouseCoords(t.pageX,t.pageY);if("touchstart"===e.type)fr.lastTouches[t.identifier]=r,fr.touches[t.identifier]=r;else if("touchend"===e.type||"touchmove"===e.type){var n=fr.touches[t.identifier];n||=r,fr.lastTouches[t.identifier]=n,fr.touches[t.identifier]=r}return}fr.setMouseCoords(e.pageX,e.pageY)}},resizeListeners:[],updateResizeListeners(){var e=u.canvas;fr.resizeListeners.forEach((t=>t(e.width,e.height)))},setCanvasSize(e,t,r){var n=u.canvas;fr.updateCanvasDimensions(n,e,t),r||fr.updateResizeListeners()},windowedWidth:0,windowedHeight:0,setFullscreenCanvasSize(){if("undefined"!=typeof SDL){var e=L[SDL.screen>>2];e|=8388608,F[SDL.screen>>2]=e}fr.updateCanvasDimensions(u.canvas),fr.updateResizeListeners()},setWindowedCanvasSize(){if("undefined"!=typeof SDL){var e=L[SDL.screen>>2];e&=-8388609,F[SDL.screen>>2]=e}fr.updateCanvasDimensions(u.canvas),fr.updateResizeListeners()},updateCanvasDimensions(e,t,r){t&&r?(e.widthNative=t,e.heightNative=r):(t=e.widthNative,r=e.heightNative);var n=t,o=r;if(u.forcedAspectRatio&&u.forcedAspectRatio>0&&(n/o<u.forcedAspectRatio?n=Math.round(o*u.forcedAspectRatio):o=Math.round(n/u.forcedAspectRatio)),(document.fullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement||document.webkitCurrentFullScreenElement)===e.parentNode&&"undefined"!=typeof screen){var i=Math.min(screen.width/n,screen.height/o);n=Math.round(n*i),o=Math.round(o*i)}fr.resizeCanvas?(e.width!=n&&(e.width=n),e.height!=o&&(e.height=o),void 0!==e.style&&(e.style.removeProperty("width"),e.style.removeProperty("height"))):(e.width!=t&&(e.width=t),e.height!=r&&(e.height=r),void 0!==e.style&&(n!=t||o!=r?(e.style.setProperty("width",n+"px","important"),e.style.setProperty("height",o+"px","important")):(e.style.removeProperty("width"),e.style.removeProperty("height"))))}},mr={errorCode:12288,defaultDisplayInitialized:!1,currentContext:0,currentReadSurface:0,currentDrawSurface:0,contextAttributes:{alpha:!1,depth:!1,stencil:!1,antialias:!1},stringCache:{},setErrorCode(e){mr.errorCode=e},chooseConfig(e,t,r,n,o){if(62e3!=e)return mr.setErrorCode(12296),0;if(t)for(;;){var i=F[t>>2];if(12321==i){var a=F[t+4>>2];mr.contextAttributes.alpha=a>0}else if(12325==i){var s=F[t+4>>2];mr.contextAttributes.depth=s>0}else if(12326==i){var u=F[t+4>>2];mr.contextAttributes.stencil=u>0}else if(12337==i){var c=F[t+4>>2];mr.contextAttributes.antialias=c>0}else if(12338==i)c=F[t+4>>2],mr.contextAttributes.antialias=1==c;else if(12544==i){var l=F[t+4>>2];mr.contextAttributes.lowLatency=12547!=l}else if(12344==i)break;t+=8}return r&&n||o?(o&&(F[o>>2]=1),r&&n>0&&(L[r>>2]=62002),mr.setErrorCode(12288),1):(mr.setErrorCode(12300),0)}},gr={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function(e){gr.lastError||(gr.lastError=e)},getNewId:e=>{for(var t=gr.counter++,r=e.length;r<t;r++)e[r]=null;return t},getSource:(e,t,r,n)=>{for(var o="",i=0;i<t;++i){var a=n?L[n+4*i>>2]:void 0;o+=xe(L[r+4*i>>2],a)}return o},createContext:(e,t)=>{if(!e.getContextSafariWebGL2Fixed){let t=function(t,r){var n=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==n instanceof WebGLRenderingContext?n:null};e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=t}var r=t.majorVersion>1?e.getContext("webgl2",t):e.getContext("webgl",t);return r?gr.registerContext(r,t):0},registerContext:(e,t)=>{var r=gr.getNewId(gr.contexts),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=n),gr.contexts[r]=n,r},makeContextCurrent:e=>(gr.currentContext=gr.contexts[e],u.ctx=_u=gr.currentContext?.GLctx,!(e&&!_u)),getContext:e=>gr.contexts[e],deleteContext:e=>{gr.currentContext===gr.contexts[e]&&(gr.currentContext=null),"object"==typeof iu&&iu.removeAllHandlersOnTarget(gr.contexts[e].GLctx.canvas),gr.contexts[e]&&gr.contexts[e].GLctx.canvas&&(gr.contexts[e].GLctx.canvas.GLctxObject=void 0),gr.contexts[e]=null}},yr=[],br=(e,t,r)=>{var n=((e,t)=>{var r;for(yr.length=0;r=A[e++];){var n=105!=r;t+=(n&=112!=r)&&t%8?4:0,yr.push(112==r?L[t>>2]:106==r?B[t>>3]:105==r?F[t>>2]:M[t>>3]),t+=n?8:4}return yr})(t,r);return ne[e].apply(null,n)},vr=function(e){_u.activeTexture(e)},wr=(e,t)=>{_u.attachShader(gr.programs[e],gr.shaders[t])},_r=(e,t)=>{_u.beginQuery(e,gr.queries[t])},Er=(e,t)=>{_u.disjointTimerQueryExt.beginQueryEXT(e,gr.queries[t])},Sr=function(e){_u.beginTransformFeedback(e)},Cr=(e,t,r)=>{_u.bindAttribLocation(gr.programs[e],t,xe(r))},xr=(e,t)=>{35051==e?_u.currentPixelPackBufferBinding=t:35052==e&&(_u.currentPixelUnpackBufferBinding=t),_u.bindBuffer(e,gr.buffers[t])},kr=(e,t,r)=>{_u.bindBufferBase(e,t,gr.buffers[r])},Tr=(e,t,r,n,o)=>{_u.bindBufferRange(e,t,gr.buffers[r],n,o)},Ar=(e,t)=>{_u.bindFramebuffer(e,gr.framebuffers[t])},Pr=(e,t)=>{_u.bindRenderbuffer(e,gr.renderbuffers[t])},qr=(e,t)=>{_u.bindSampler(e,gr.samplers[t])},Fr=(e,t)=>{_u.bindTexture(e,gr.textures[t])},Lr=(e,t)=>{_u.bindTransformFeedback(e,gr.transformFeedbacks[t])},Dr=e=>{_u.bindVertexArray(gr.vaos[e])},Br=Dr,Rr=Dr,Mr=function(e,t,r,n){_u.blendColor(e,t,r,n)},Or=function(e){_u.blendEquation(e)},Ir=function(e,t){_u.blendEquationSeparate(e,t)},jr=function(e,t){_u.blendFunc(e,t)},Ur=function(e,t,r,n){_u.blendFuncSeparate(e,t,r,n)},$r=function(e,t,r,n,o,i,a,s,u,c){_u.blitFramebuffer(e,t,r,n,o,i,a,s,u,c)},Nr=(e,t,r,n)=>{gr.currentContext.version>=2?r&&t?_u.bufferData(e,A,n,r,t):_u.bufferData(e,t,n):_u.bufferData(e,r?A.subarray(r,r+t):t,n)},Hr=(e,t,r,n)=>{gr.currentContext.version>=2?r&&_u.bufferSubData(e,t,A,n,r):_u.bufferSubData(e,t,A.subarray(n,n+r))},Vr=function(e){return _u.checkFramebufferStatus(e)},Wr=function(e){_u.clear(e)},zr=function(e,t,r,n){_u.clearBufferfi(e,t,r,n)},Gr=(e,t,r)=>{_u.clearBufferfv(e,t,D,r>>2)},Yr=(e,t,r)=>{_u.clearBufferiv(e,t,F,r>>2)},Xr=(e,t,r)=>{_u.clearBufferuiv(e,t,L,r>>2)},Zr=function(e,t,r,n){_u.clearColor(e,t,r,n)},Kr=function(e){_u.clearDepth(e)},Qr=function(e){_u.clearStencil(e)},Jr=(e,t,r)=>(r=Number(r),_u.clientWaitSync(gr.syncs[e],t,r)),en=(e,t,r,n)=>{_u.colorMask(!!e,!!t,!!r,!!n)},tn=e=>{_u.compileShader(gr.shaders[e])},rn=(e,t,r,n,o,i,a,s)=>{gr.currentContext.version>=2?_u.currentPixelUnpackBufferBinding||!a?_u.compressedTexImage2D(e,t,r,n,o,i,a,s):_u.compressedTexImage2D(e,t,r,n,o,i,A,s,a):_u.compressedTexImage2D(e,t,r,n,o,i,s?A.subarray(s,s+a):null)},nn=(e,t,r,n,o,i,a,s,u)=>{_u.currentPixelUnpackBufferBinding?_u.compressedTexImage3D(e,t,r,n,o,i,a,s,u):_u.compressedTexImage3D(e,t,r,n,o,i,a,A,u,s)},on=(e,t,r,n,o,i,a,s,u)=>{gr.currentContext.version>=2?_u.currentPixelUnpackBufferBinding||!s?_u.compressedTexSubImage2D(e,t,r,n,o,i,a,s,u):_u.compressedTexSubImage2D(e,t,r,n,o,i,a,A,u,s):_u.compressedTexSubImage2D(e,t,r,n,o,i,a,u?A.subarray(u,u+s):null)},an=(e,t,r,n,o,i,a,s,u,c,l)=>{_u.currentPixelUnpackBufferBinding?_u.compressedTexSubImage3D(e,t,r,n,o,i,a,s,u,c,l):_u.compressedTexSubImage3D(e,t,r,n,o,i,a,s,u,A,l,c)},sn=function(e,t,r,n,o){_u.copyBufferSubData(e,t,r,n,o)},un=function(e,t,r,n,o,i,a,s){_u.copyTexImage2D(e,t,r,n,o,i,a,s)},cn=function(e,t,r,n,o,i,a,s){_u.copyTexSubImage2D(e,t,r,n,o,i,a,s)},ln=function(e,t,r,n,o,i,a,s,u){_u.copyTexSubImage3D(e,t,r,n,o,i,a,s,u)},dn=()=>{var e=gr.getNewId(gr.programs),t=_u.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,gr.programs[e]=t,e},pn=e=>{var t=gr.getNewId(gr.shaders);return gr.shaders[t]=_u.createShader(e),t},hn=function(e){_u.cullFace(e)},fn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.buffers[n];o&&(_u.deleteBuffer(o),o.name=0,gr.buffers[n]=null,n==_u.currentPixelPackBufferBinding&&(_u.currentPixelPackBufferBinding=0),n==_u.currentPixelUnpackBufferBinding&&(_u.currentPixelUnpackBufferBinding=0))}},mn=(e,t)=>{for(var r=0;r<e;++r){var n=F[t+4*r>>2],o=gr.framebuffers[n];o&&(_u.deleteFramebuffer(o),o.name=0,gr.framebuffers[n]=null)}},gn=e=>{if(e){var t=gr.programs[e];t?(_u.deleteProgram(t),t.name=0,gr.programs[e]=null):gr.recordError(1281)}},yn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.queries[n];o&&(_u.deleteQuery(o),gr.queries[n]=null)}},bn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.queries[n];o&&(_u.disjointTimerQueryExt.deleteQueryEXT(o),gr.queries[n]=null)}},vn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.renderbuffers[n];o&&(_u.deleteRenderbuffer(o),o.name=0,gr.renderbuffers[n]=null)}},wn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.samplers[n];o&&(_u.deleteSampler(o),o.name=0,gr.samplers[n]=null)}},_n=e=>{if(e){var t=gr.shaders[e];t?(_u.deleteShader(t),gr.shaders[e]=null):gr.recordError(1281)}},En=e=>{if(e){var t=gr.syncs[e];t?(_u.deleteSync(t),t.name=0,gr.syncs[e]=null):gr.recordError(1281)}},Sn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.textures[n];o&&(_u.deleteTexture(o),o.name=0,gr.textures[n]=null)}},Cn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2],o=gr.transformFeedbacks[n];o&&(_u.deleteTransformFeedback(o),o.name=0,gr.transformFeedbacks[n]=null)}},xn=(e,t)=>{for(var r=0;r<e;r++){var n=F[t+4*r>>2];_u.deleteVertexArray(gr.vaos[n]),gr.vaos[n]=null}},kn=xn,Tn=xn,An=function(e){_u.depthFunc(e)},Pn=e=>{_u.depthMask(!!e)},qn=function(e,t){_u.depthRange(e,t)},Fn=(e,t)=>{_u.detachShader(gr.programs[e],gr.shaders[t])},Ln=function(e){_u.disable(e)},Dn=e=>{_u.disableVertexAttribArray(e)},Bn=(e,t,r)=>{_u.drawArrays(e,t,r)},Rn=(e,t,r,n)=>{_u.drawArraysInstanced(e,t,r,n)},Mn=Rn,On=Rn,In=Rn,jn=(e,t,r,n,o)=>{_u.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,n,o)},Un=Rn,$n=Rn,Nn=[],Hn=(e,t)=>{for(var r=Nn[e],n=0;n<e;n++)r[n]=F[t+4*n>>2];_u.drawBuffers(r)},Vn=Hn,Wn=Hn,zn=Hn,Gn=(e,t,r,n)=>{_u.drawElements(e,t,r,n)},Yn=Gn,Xn=(e,t,r,n,o)=>{_u.drawElementsInstanced(e,t,r,n,o)},Zn=Xn,Kn=Xn,Qn=Xn,Jn=(e,t,r,n,o,i,a)=>{_u.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,n,o,i,a)},eo=Xn,to=Xn,ro=(e,t,r,n,o,i)=>{Gn(e,n,o,i)},no=function(e){_u.enable(e)},oo=e=>{_u.enableVertexAttribArray(e)},io=function(e){_u.endQuery(e)},ao=e=>{_u.disjointTimerQueryExt.endQueryEXT(e)},so=function(){_u.endTransformFeedback()},uo=(e,t)=>{var r=_u.fenceSync(e,t);if(r){var n=gr.getNewId(gr.syncs);return r.name=n,gr.syncs[n]=r,n}return 0},co=function(){_u.finish()},lo=function(){_u.flush()},po=(e,t,r,n)=>{_u.framebufferRenderbuffer(e,t,r,gr.renderbuffers[n])},ho=(e,t,r,n,o)=>{_u.framebufferTexture2D(e,t,r,gr.textures[n],o)},fo=(e,t,r,n,o)=>{_u.framebufferTextureLayer(e,t,gr.textures[r],n,o)},mo=function(e){_u.frontFace(e)},go=(e,t,r,n)=>{for(var o=0;o<e;o++){var i=_u[r](),a=i&&gr.getNewId(n);i?(i.name=a,n[a]=i):gr.recordError(1282),F[t+4*o>>2]=a}},yo=(e,t)=>{go(e,t,"createBuffer",gr.buffers)},bo=(e,t)=>{go(e,t,"createFramebuffer",gr.framebuffers)},vo=(e,t)=>{go(e,t,"createQuery",gr.queries)},wo=(e,t)=>{for(var r=0;r<e;r++){var n=_u.disjointTimerQueryExt.createQueryEXT();if(!n){for(gr.recordError(1282);r<e;)F[t+4*r++>>2]=0;return}var o=gr.getNewId(gr.queries);n.name=o,gr.queries[o]=n,F[t+4*r>>2]=o}},_o=(e,t)=>{go(e,t,"createRenderbuffer",gr.renderbuffers)},Eo=(e,t)=>{go(e,t,"createSampler",gr.samplers)},So=(e,t)=>{go(e,t,"createTexture",gr.textures)},Co=(e,t)=>{go(e,t,"createTransformFeedback",gr.transformFeedbacks)};function xo(e,t){go(e,t,"createVertexArray",gr.vaos)}var ko,To,Ao,Po=xo,qo=xo,Fo=function(e){_u.generateMipmap(e)},Lo=(e,t,r,n,o,i,a,s)=>{t=gr.programs[t];var u=_u[e](t,r);if(u){var c=s&&Nt(u.name,s,n);o&&(F[o>>2]=c),i&&(F[i>>2]=u.size),a&&(F[a>>2]=u.type)}},Do=(e,t,r,n,o,i,a)=>{Lo("getActiveAttrib",e,t,r,n,o,i,a)},Bo=(e,t,r,n,o,i,a)=>{Lo("getActiveUniform",e,t,r,n,o,i,a)},Ro=(e,t,r,n,o)=>{e=gr.programs[e];var i=_u.getActiveUniformBlockName(e,t);if(i)if(o&&r>0){var a=Nt(i,o,r);n&&(F[n>>2]=a)}else n&&(F[n>>2]=0)},Mo=(e,t,r,n)=>{if(n)if(e=gr.programs[e],35393!=r){var o=_u.getActiveUniformBlockParameter(e,t,r);if(null!==o)if(35395==r)for(var i=0;i<o.length;i++)F[n+4*i>>2]=o[i];else F[n>>2]=o}else{var a=_u.getActiveUniformBlockName(e,t);F[n>>2]=a.length+1}else gr.recordError(1281)},Oo=(e,t,r,n,o)=>{if(o)if(t>0&&0==r)gr.recordError(1281);else{e=gr.programs[e];for(var i=[],a=0;a<t;a++)i.push(F[r+4*a>>2]);var s=_u.getActiveUniforms(e,i,n);if(s){var u=s.length;for(a=0;a<u;a++)F[o+4*a>>2]=s[a]}}else gr.recordError(1281)},Io=(e,t,r,n)=>{var o=_u.getAttachedShaders(gr.programs[e]),i=o.length;i>t&&(i=t),F[r>>2]=i;for(var a=0;a<i;++a){var s=gr.shaders.indexOf(o[a]);F[n+4*a>>2]=s}},jo=(e,t)=>_u.getAttribLocation(gr.programs[e],xe(t)),Uo=(e,t)=>{L[e>>2]=t;var r=L[e>>2];L[e+4>>2]=(t-r)/4294967296},$o=function(){var e,t=(e=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_disjoint_timer_query","EXT_frag_depth","EXT_shader_texture_lod","EXT_sRGB","OES_element_index_uint","OES_fbo_render_mipmap","OES_standard_derivatives","OES_texture_float","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_depth_texture","WEBGL_draw_buffers","EXT_color_buffer_float","EXT_disjoint_timer_query_webgl2","EXT_texture_norm16","WEBGL_clip_cull_distance","EXT_color_buffer_half_float","EXT_float_blend","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw"],(_u.getSupportedExtensions()||[]).filter((t=>e.includes(t))));return t=t.concat(t.map((e=>"GL_"+e)))},No=(e,t,r)=>{if(t){var n=void 0;switch(e){case 36346:n=1;break;case 36344:return void(0!=r&&1!=r&&gr.recordError(1280));case 34814:case 36345:n=0;break;case 34466:var o=_u.getParameter(34467);n=o?o.length:0;break;case 33309:if(gr.currentContext.version<2)return void gr.recordError(1282);n=$o().length;break;case 33307:case 33308:if(gr.currentContext.version<2)return void gr.recordError(1280);n=33307==e?3:0}if(void 0===n){var i=_u.getParameter(e);switch(typeof i){case"number":n=i;break;case"boolean":n=i?1:0;break;case"string":return void gr.recordError(1280);case"object":if(null===i)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:n=0;break;default:return void gr.recordError(1280)}else{if(i instanceof Float32Array||i instanceof Uint32Array||i instanceof Int32Array||i instanceof Array){for(var a=0;a<i.length;++a)switch(r){case 0:F[t+4*a>>2]=i[a];break;case 2:D[t+4*a>>2]=i[a];break;case 4:T[t+a>>0]=i[a]?1:0}return}try{n=0|i.name}catch(t){return gr.recordError(1280),void x(`GL_INVALID_ENUM in glGet${r}v: Unknown object returned from WebGL getParameter(${e})! (error: ${t})`)}}break;default:return gr.recordError(1280),void x(`GL_INVALID_ENUM in glGet${r}v: Native code calling glGet${r}v(${e}) and it returns ${i} of type ${typeof i}!`)}}switch(r){case 1:Uo(t,n);break;case 0:F[t>>2]=n;break;case 2:D[t>>2]=n;break;case 4:T[t>>0]=n?1:0}}else gr.recordError(1281)},Ho=(e,t)=>No(e,t,4),Vo=(e,t,r)=>{r?Uo(r,_u.getBufferParameter(e,t)):gr.recordError(1281)},Wo=(e,t,r)=>{r?F[r>>2]=_u.getBufferParameter(e,t):gr.recordError(1281)},zo=()=>{var e=_u.getError()||gr.lastError;return gr.lastError=0,e},Go=(e,t)=>No(e,t,2),Yo=(e,t)=>_u.getFragDataLocation(gr.programs[e],xe(t)),Xo=(e,t,r,n)=>{var o=_u.getFramebufferAttachmentParameter(e,t,r);(o instanceof WebGLRenderbuffer||o instanceof WebGLTexture)&&(o=0|o.name),F[n>>2]=o},Zo=(e,t,r,n)=>{if(r){var o,i=_u.getIndexedParameter(e,t);switch(typeof i){case"boolean":o=i?1:0;break;case"number":o=i;break;case"object":if(null===i)switch(e){case 35983:case 35368:o=0;break;default:return void gr.recordError(1280)}else{if(!(i instanceof WebGLBuffer))return void gr.recordError(1280);o=0|i.name}break;default:return void gr.recordError(1280)}switch(n){case 1:Uo(r,o);break;case 0:F[r>>2]=o;break;case 2:D[r>>2]=o;break;case 4:T[r>>0]=o?1:0;break;default:throw"internal emscriptenWebGLGetIndexed() error, bad type: "+n}}else gr.recordError(1281)},Ko=(e,t,r)=>Zo(e,t,r,1),Qo=(e,t)=>{No(e,t,1)},Jo=(e,t,r)=>Zo(e,t,r,0),ei=(e,t)=>No(e,t,0),ti=(e,t,r,n,o)=>{if(n<0)gr.recordError(1281);else if(o){var i=_u.getInternalformatParameter(e,t,r);if(null!==i)for(var a=0;a<i.length&&a<n;++a)F[o+4*a>>2]=i[a]}else gr.recordError(1281)},ri=(e,t,r,n,o)=>{gr.recordError(1282)},ni=(e,t,r,n)=>{var o=_u.getProgramInfoLog(gr.programs[e]);null===o&&(o="(unknown error)");var i=t>0&&n?Nt(o,n,t):0;r&&(F[r>>2]=i)},oi=(e,t,r)=>{if(r)if(e>=gr.counter)gr.recordError(1281);else if(e=gr.programs[e],35716==t){var n=_u.getProgramInfoLog(e);null===n&&(n="(unknown error)"),F[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var o=0;o<_u.getProgramParameter(e,35718);++o)e.maxUniformLength=Math.max(e.maxUniformLength,_u.getActiveUniform(e,o).name.length+1);F[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength)for(o=0;o<_u.getProgramParameter(e,35721);++o)e.maxAttributeLength=Math.max(e.maxAttributeLength,_u.getActiveAttrib(e,o).name.length+1);F[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength)for(o=0;o<_u.getProgramParameter(e,35382);++o)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,_u.getActiveUniformBlockName(e,o).length+1);F[r>>2]=e.maxUniformBlockNameLength}else F[r>>2]=_u.getProgramParameter(e,t);else gr.recordError(1281)},ii=(e,t,r)=>{if(r){var n,o=gr.queries[e];n=gr.currentContext.version<2?_u.disjointTimerQueryExt.getQueryObjectEXT(o,t):_u.getQueryParameter(o,t),Uo(r,"boolean"==typeof n?n?1:0:n)}else gr.recordError(1281)},ai=ii,si=(e,t,r)=>{if(r){var n,o=gr.queries[e],i=_u.disjointTimerQueryExt.getQueryObjectEXT(o,t);n="boolean"==typeof i?i?1:0:i,F[r>>2]=n}else gr.recordError(1281)},ui=si,ci=ii,li=(e,t,r)=>{if(r){var n,o=gr.queries[e],i=_u.getQueryParameter(o,t);n="boolean"==typeof i?i?1:0:i,F[r>>2]=n}else gr.recordError(1281)},di=si,pi=(e,t,r)=>{r?F[r>>2]=_u.getQuery(e,t):gr.recordError(1281)},hi=(e,t,r)=>{r?F[r>>2]=_u.disjointTimerQueryExt.getQueryEXT(e,t):gr.recordError(1281)},fi=(e,t,r)=>{r?F[r>>2]=_u.getRenderbufferParameter(e,t):gr.recordError(1281)},mi=(e,t,r)=>{r?D[r>>2]=_u.getSamplerParameter(gr.samplers[e],t):gr.recordError(1281)},gi=(e,t,r)=>{r?F[r>>2]=_u.getSamplerParameter(gr.samplers[e],t):gr.recordError(1281)},yi=(e,t,r,n)=>{var o=_u.getShaderInfoLog(gr.shaders[e]);null===o&&(o="(unknown error)");var i=t>0&&n?Nt(o,n,t):0;r&&(F[r>>2]=i)},bi=(e,t,r,n)=>{var o=_u.getShaderPrecisionFormat(e,t);F[r>>2]=o.rangeMin,F[r+4>>2]=o.rangeMax,F[n>>2]=o.precision},vi=(e,t,r,n)=>{var o=_u.getShaderSource(gr.shaders[e]);if(o){var i=t>0&&n?Nt(o,n,t):0;r&&(F[r>>2]=i)}},wi=(e,t,r)=>{if(r)if(35716==t){var n=_u.getShaderInfoLog(gr.shaders[e]);null===n&&(n="(unknown error)");var o=n?n.length+1:0;F[r>>2]=o}else if(35720==t){var i=_u.getShaderSource(gr.shaders[e]),a=i?i.length+1:0;F[r>>2]=a}else F[r>>2]=_u.getShaderParameter(gr.shaders[e],t);else gr.recordError(1281)},_i=e=>{var t=gr.stringCache[e];if(!t){switch(e){case 7939:t=ar($o().join(" "));break;case 7936:case 7937:case 37445:case 37446:var r=_u.getParameter(e);r||gr.recordError(1280),t=r?ar(r):0;break;case 7938:var n=_u.getParameter(7938);n=gr.currentContext.version>=2?`OpenGL ES 3.0 (${n})`:`OpenGL ES 2.0 (${n})`,t=ar(n);break;case 35724:var o=_u.getParameter(35724),i=o.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==i&&(3==i[1].length&&(i[1]=i[1]+"0"),o=`OpenGL ES GLSL ES ${i[1]} (${o})`),t=ar(o);break;default:gr.recordError(1280)}gr.stringCache[e]=t}return t},Ei=(e,t)=>{if(gr.currentContext.version<2)return gr.recordError(1282),0;var r=gr.stringiCache[e];if(r)return t<0||t>=r.length?(gr.recordError(1281),0):r[t];if(7939===e){var n=$o().map(ar);return r=gr.stringiCache[e]=n,t<0||t>=r.length?(gr.recordError(1281),0):r[t]}return gr.recordError(1280),0},Si=(e,t,r,n,o)=>{if(r<0)gr.recordError(1281);else if(o){var i=_u.getSyncParameter(gr.syncs[e],t);null!==i&&(F[o>>2]=i,n&&(F[n>>2]=1))}else gr.recordError(1281)},Ci=(e,t,r)=>{r?D[r>>2]=_u.getTexParameter(e,t):gr.recordError(1281)},xi=(e,t,r)=>{r?F[r>>2]=_u.getTexParameter(e,t):gr.recordError(1281)},ki=(e,t,r,n,o,i,a)=>{e=gr.programs[e];var s=_u.getTransformFeedbackVarying(e,t);if(s){if(a&&r>0){var u=Nt(s.name,a,r);n&&(F[n>>2]=u)}else n&&(F[n>>2]=0);o&&(F[o>>2]=s.size),i&&(F[i>>2]=s.type)}},Ti=(e,t)=>_u.getUniformBlockIndex(gr.programs[e],xe(t)),Ai=(e,t,r,n)=>{if(n)if(t>0&&(0==r||0==n))gr.recordError(1281);else{e=gr.programs[e];for(var o=[],i=0;i<t;i++)o.push(xe(F[r+4*i>>2]));var a=_u.getUniformIndices(e,o);if(a){var s=a.length;for(i=0;i<s;i++)F[n+4*i>>2]=a[i]}}else gr.recordError(1281)},Pi=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),qi=e=>{var t,r,n=e.uniformLocsById,o=e.uniformSizeAndIdsByName;if(!n)for(e.uniformLocsById=n={},e.uniformArrayNamesById={},t=0;t<_u.getProgramParameter(e,35718);++t){var i=_u.getActiveUniform(e,t),a=i.name,s=i.size,u=Pi(a),c=u>0?a.slice(0,u):a,l=e.uniformIdCounter;for(e.uniformIdCounter+=s,o[c]=[s,l],r=0;r<s;++r)n[l]=r,e.uniformArrayNamesById[l++]=c}},Fi=(e,t)=>{if(t=xe(t),e=gr.programs[e]){qi(e);var r=e.uniformLocsById,n=0,o=t,i=Pi(t);i>0&&(s=t.slice(i+1),n=parseInt(s)>>>0,o=t.slice(0,i));var a=e.uniformSizeAndIdsByName[o];if(a&&n<a[0]&&(r[n+=a[1]]=r[n]||_u.getUniformLocation(e,t)))return n}else gr.recordError(1281);var s;return-1},Li=e=>{var t=_u.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=_u.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?`[${r}]`:""))),r}gr.recordError(1282)},Di=(e,t,r,n)=>{if(r){e=gr.programs[e],qi(e);var o=_u.getUniform(e,Li(t));if("number"==typeof o||"boolean"==typeof o)switch(n){case 0:F[r>>2]=o;break;case 2:D[r>>2]=o}else for(var i=0;i<o.length;i++)switch(n){case 0:F[r+4*i>>2]=o[i];break;case 2:D[r+4*i>>2]=o[i]}}else gr.recordError(1281)},Bi=(e,t,r)=>{Di(e,t,r,2)},Ri=(e,t,r)=>{Di(e,t,r,0)},Mi=(e,t,r)=>Di(e,t,r,0),Oi=(e,t,r,n)=>{if(r){var o=_u.getVertexAttrib(e,t);if(34975==t)F[r>>2]=o&&o.name;else if("number"==typeof o||"boolean"==typeof o)switch(n){case 0:F[r>>2]=o;break;case 2:D[r>>2]=o;break;case 5:F[r>>2]=Math.fround(o)}else for(var i=0;i<o.length;i++)switch(n){case 0:F[r+4*i>>2]=o[i];break;case 2:D[r+4*i>>2]=o[i];break;case 5:F[r+4*i>>2]=Math.fround(o[i])}}else gr.recordError(1281)},Ii=(e,t,r)=>{Oi(e,t,r,0)},ji=Ii,Ui=Ii,$i=(e,t,r)=>{r?F[r>>2]=_u.getVertexAttribOffset(e,t):gr.recordError(1281)},Ni=(e,t,r)=>{Oi(e,t,r,2)},Hi=(e,t,r)=>{Oi(e,t,r,5)},Vi=function(e,t){_u.hint(e,t)},Wi=(e,t,r)=>{for(var n=Nn[t],o=0;o<t;o++)n[o]=F[r+4*o>>2];_u.invalidateFramebuffer(e,n)},zi=(e,t,r,n,o,i,a)=>{for(var s=Nn[t],u=0;u<t;u++)s[u]=F[r+4*u>>2];_u.invalidateSubFramebuffer(e,s,n,o,i,a)},Gi=e=>{var t=gr.buffers[e];return t?_u.isBuffer(t):0},Yi=function(e){return _u.isEnabled(e)},Xi=e=>{var t=gr.framebuffers[e];return t?_u.isFramebuffer(t):0},Zi=e=>(e=gr.programs[e])?_u.isProgram(e):0,Ki=e=>{var t=gr.queries[e];return t?_u.isQuery(t):0},Qi=e=>{var t=gr.queries[e];return t?_u.disjointTimerQueryExt.isQueryEXT(t):0},Ji=e=>{var t=gr.renderbuffers[e];return t?_u.isRenderbuffer(t):0},ea=e=>{var t=gr.samplers[e];return t?_u.isSampler(t):0},ta=e=>{var t=gr.shaders[e];return t?_u.isShader(t):0},ra=e=>_u.isSync(gr.syncs[e]),na=e=>{var t=gr.textures[e];return t?_u.isTexture(t):0},oa=e=>_u.isTransformFeedback(gr.transformFeedbacks[e]),ia=e=>{var t=gr.vaos[e];return t?_u.isVertexArray(t):0},aa=ia,sa=ia,ua=function(e){_u.lineWidth(e)},ca=e=>{e=gr.programs[e],_u.linkProgram(e),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}},la=(e,t,r,n,o,i)=>{_u.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,F,t>>2,F,r>>2,F,n>>2,L,o>>2,i)},da=(e,t,r,n,o,i,a,s)=>{_u.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,F,t>>2,r,F,n>>2,F,o>>2,F,i>>2,L,a>>2,s)},pa=function(){_u.pauseTransformFeedback()},ha=(e,t)=>{3317==e&&(gr.unpackAlignment=t),_u.pixelStorei(e,t)},fa=function(e,t){_u.polygonOffset(e,t)},ma=(e,t,r,n)=>{gr.recordError(1280)},ga=(e,t,r)=>{gr.recordError(1280)},ya=(e,t)=>{_u.disjointTimerQueryExt.queryCounterEXT(gr.queries[e],t)},ba=function(e){_u.readBuffer(e)},va=e=>0==(e-=5120)?T:1==e?A:2==e?P:4==e?F:6==e?D:5==e||28922==e||28520==e||30779==e||30782==e?L:q,wa=e=>31-Math.clz32(e.BYTES_PER_ELEMENT),_a=(e,t,r,n,o,i)=>{var a=va(e),s=wa(a),u=1<<s,c=(e=>({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1))(t)*u,l=((e,t,r,n)=>{var o;return t*(e*r+(o=n)-1&-o)})(r,n,c,gr.unpackAlignment);return a.subarray(o>>s,o+l>>s)},Ea=(e,t,r,n,o,i,a)=>{if(gr.currentContext.version>=2)if(_u.currentPixelPackBufferBinding)_u.readPixels(e,t,r,n,o,i,a);else{var s=va(i);_u.readPixels(e,t,r,n,o,i,s,a>>wa(s))}else{var u=_a(i,o,r,n,a);u?_u.readPixels(e,t,r,n,o,i,u):gr.recordError(1280)}},Sa=()=>{},Ca=function(e,t,r,n){_u.renderbufferStorage(e,t,r,n)},xa=function(e,t,r,n,o){_u.renderbufferStorageMultisample(e,t,r,n,o)},ka=function(){_u.resumeTransformFeedback()},Ta=(e,t)=>{_u.sampleCoverage(e,!!t)},Aa=(e,t,r)=>{_u.samplerParameterf(gr.samplers[e],t,r)},Pa=(e,t,r)=>{var n=D[r>>2];_u.samplerParameterf(gr.samplers[e],t,n)},qa=(e,t,r)=>{_u.samplerParameteri(gr.samplers[e],t,r)},Fa=(e,t,r)=>{var n=F[r>>2];_u.samplerParameteri(gr.samplers[e],t,n)},La=function(e,t,r,n){_u.scissor(e,t,r,n)},Da=(e,t,r,n,o)=>{gr.recordError(1280)},Ba=(e,t,r,n)=>{var o=gr.getSource(e,t,r,n);if(gr.currentContext.version>=2&&o.includes("#version 100")){var i="";(o=(o=o.replace(/#extension GL_OES_standard_derivatives : enable/g,"")).replace(/#extension GL_EXT_shader_texture_lod : enable/g,"")).includes("gl_FragColor")&&(i+="out mediump vec4 GL_FragColor;\n",o=o.replace(/gl_FragColor/g,"GL_FragColor")),o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=(o=o.includes("attribute")?(o=o.replace(/attribute/g,"in")).replace(/varying/g,"out"):o.replace(/varying/g,"in")).replace(/textureCubeLodEXT/g,"textureCubeLod")).replace(/texture2DLodEXT/g,"texture2DLod")).replace(/texture2DProjLodEXT/g,"texture2DProjLod")).replace(/texture2DGradEXT/g,"texture2DGrad")).replace(/texture2DProjGradEXT/g,"texture2DProjGrad")).replace(/textureCubeGradEXT/g,"textureCubeGrad")).replace(/textureCube/g,"texture")).replace(/texture1D/g,"texture")).replace(/texture2D/g,"texture")).replace(/texture3D/g,"texture")).replace(/#version 100/g,"#version 300 es\n"+i)}_u.shaderSource(gr.shaders[e],o)},Ra=function(e,t,r){_u.stencilFunc(e,t,r)},Ma=function(e,t,r,n){_u.stencilFuncSeparate(e,t,r,n)},Oa=function(e){_u.stencilMask(e)},Ia=function(e,t){_u.stencilMaskSeparate(e,t)},ja=function(e,t,r){_u.stencilOp(e,t,r)},Ua=function(e,t,r,n){_u.stencilOpSeparate(e,t,r,n)},$a=(e,t,r,n,o,i,a,s,u)=>{if(gr.currentContext.version>=2&&(6402==a&&6402==r&&5125==s&&(r=33190),36193==s&&(s=5131,6408==a&&6408==r&&(r=34842)),34041==r&&(r=35056)),gr.currentContext.version>=2)if(_u.currentPixelUnpackBufferBinding)_u.texImage2D(e,t,r,n,o,i,a,s,u);else if(u){var c=va(s);_u.texImage2D(e,t,r,n,o,i,a,s,c,u>>wa(c))}else _u.texImage2D(e,t,r,n,o,i,a,s,null);else _u.texImage2D(e,t,r,n,o,i,a,s,u?_a(s,a,n,o,u):null)},Na=(e,t,r,n,o,i,a,s,u,c)=>{if(_u.currentPixelUnpackBufferBinding)_u.texImage3D(e,t,r,n,o,i,a,s,u,c);else if(c){var l=va(u);_u.texImage3D(e,t,r,n,o,i,a,s,u,l,c>>wa(l))}else _u.texImage3D(e,t,r,n,o,i,a,s,u,null)},Ha=function(e,t,r){_u.texParameterf(e,t,r)},Va=(e,t,r)=>{var n=D[r>>2];_u.texParameterf(e,t,n)},Wa=function(e,t,r){_u.texParameteri(e,t,r)},za=(e,t,r)=>{var n=F[r>>2];_u.texParameteri(e,t,n)},Ga=function(e,t,r,n,o){_u.texStorage2D(e,t,r,n,o)},Ya=function(e,t,r,n,o,i){_u.texStorage3D(e,t,r,n,o,i)},Xa=(e,t,r,n,o,i,a,s,u)=>{if(gr.currentContext.version>=2&&36193==s&&(s=5131),gr.currentContext.version>=2)if(_u.currentPixelUnpackBufferBinding)_u.texSubImage2D(e,t,r,n,o,i,a,s,u);else if(u){var c=va(s);_u.texSubImage2D(e,t,r,n,o,i,a,s,c,u>>wa(c))}else _u.texSubImage2D(e,t,r,n,o,i,a,s,null);else{var l=null;u&&(l=_a(s,a,o,i,u)),_u.texSubImage2D(e,t,r,n,o,i,a,s,l)}},Za=(e,t,r,n,o,i,a,s,u,c,l)=>{if(_u.currentPixelUnpackBufferBinding)_u.texSubImage3D(e,t,r,n,o,i,a,s,u,c,l);else if(l){var d=va(c);_u.texSubImage3D(e,t,r,n,o,i,a,s,u,c,d,l>>wa(d))}else _u.texSubImage3D(e,t,r,n,o,i,a,s,u,c,null)},Ka=(e,t,r,n)=>{e=gr.programs[e];for(var o=[],i=0;i<t;i++)o.push(xe(F[r+4*i>>2]));_u.transformFeedbackVaryings(e,o,n)},Qa=(e,t)=>{_u.uniform1f(Li(e),t)},Ja=[],es=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform1fv(Li(e),D,r>>2,t);else{if(t<=288)for(var n=Ja[t-1],o=0;o<t;++o)n[o]=D[r+4*o>>2];else n=D.subarray(r>>2,r+4*t>>2);_u.uniform1fv(Li(e),n)}},ts=(e,t)=>{_u.uniform1i(Li(e),t)},rs=[],ns=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform1iv(Li(e),F,r>>2,t);else{if(t<=288)for(var n=rs[t-1],o=0;o<t;++o)n[o]=F[r+4*o>>2];else n=F.subarray(r>>2,r+4*t>>2);_u.uniform1iv(Li(e),n)}},os=(e,t)=>{_u.uniform1ui(Li(e),t)},is=(e,t,r)=>{t&&_u.uniform1uiv(Li(e),L,r>>2,t)},as=(e,t,r)=>{_u.uniform2f(Li(e),t,r)},ss=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform2fv(Li(e),D,r>>2,2*t);else{if(t<=144)for(var n=Ja[2*t-1],o=0;o<2*t;o+=2)n[o]=D[r+4*o>>2],n[o+1]=D[r+(4*o+4)>>2];else n=D.subarray(r>>2,r+8*t>>2);_u.uniform2fv(Li(e),n)}},us=(e,t,r)=>{_u.uniform2i(Li(e),t,r)},cs=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform2iv(Li(e),F,r>>2,2*t);else{if(t<=144)for(var n=rs[2*t-1],o=0;o<2*t;o+=2)n[o]=F[r+4*o>>2],n[o+1]=F[r+(4*o+4)>>2];else n=F.subarray(r>>2,r+8*t>>2);_u.uniform2iv(Li(e),n)}},ls=(e,t,r)=>{_u.uniform2ui(Li(e),t,r)},ds=(e,t,r)=>{t&&_u.uniform2uiv(Li(e),L,r>>2,2*t)},ps=(e,t,r,n)=>{_u.uniform3f(Li(e),t,r,n)},hs=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform3fv(Li(e),D,r>>2,3*t);else{if(t<=96)for(var n=Ja[3*t-1],o=0;o<3*t;o+=3)n[o]=D[r+4*o>>2],n[o+1]=D[r+(4*o+4)>>2],n[o+2]=D[r+(4*o+8)>>2];else n=D.subarray(r>>2,r+12*t>>2);_u.uniform3fv(Li(e),n)}},fs=(e,t,r,n)=>{_u.uniform3i(Li(e),t,r,n)},ms=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform3iv(Li(e),F,r>>2,3*t);else{if(t<=96)for(var n=rs[3*t-1],o=0;o<3*t;o+=3)n[o]=F[r+4*o>>2],n[o+1]=F[r+(4*o+4)>>2],n[o+2]=F[r+(4*o+8)>>2];else n=F.subarray(r>>2,r+12*t>>2);_u.uniform3iv(Li(e),n)}},gs=(e,t,r,n)=>{_u.uniform3ui(Li(e),t,r,n)},ys=(e,t,r)=>{t&&_u.uniform3uiv(Li(e),L,r>>2,3*t)},bs=(e,t,r,n,o)=>{_u.uniform4f(Li(e),t,r,n,o)},vs=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform4fv(Li(e),D,r>>2,4*t);else{if(t<=72){var n=Ja[4*t-1],o=D;r>>=2;for(var i=0;i<4*t;i+=4){var a=r+i;n[i]=o[a],n[i+1]=o[a+1],n[i+2]=o[a+2],n[i+3]=o[a+3]}}else n=D.subarray(r>>2,r+16*t>>2);_u.uniform4fv(Li(e),n)}},ws=(e,t,r,n,o)=>{_u.uniform4i(Li(e),t,r,n,o)},_s=(e,t,r)=>{if(gr.currentContext.version>=2)t&&_u.uniform4iv(Li(e),F,r>>2,4*t);else{if(t<=72)for(var n=rs[4*t-1],o=0;o<4*t;o+=4)n[o]=F[r+4*o>>2],n[o+1]=F[r+(4*o+4)>>2],n[o+2]=F[r+(4*o+8)>>2],n[o+3]=F[r+(4*o+12)>>2];else n=F.subarray(r>>2,r+16*t>>2);_u.uniform4iv(Li(e),n)}},Es=(e,t,r,n,o)=>{_u.uniform4ui(Li(e),t,r,n,o)},Ss=(e,t,r)=>{t&&_u.uniform4uiv(Li(e),L,r>>2,4*t)},Cs=(e,t,r)=>{e=gr.programs[e],_u.uniformBlockBinding(e,t,r)},xs=(e,t,r,n)=>{if(gr.currentContext.version>=2)t&&_u.uniformMatrix2fv(Li(e),!!r,D,n>>2,4*t);else{if(t<=72)for(var o=Ja[4*t-1],i=0;i<4*t;i+=4)o[i]=D[n+4*i>>2],o[i+1]=D[n+(4*i+4)>>2],o[i+2]=D[n+(4*i+8)>>2],o[i+3]=D[n+(4*i+12)>>2];else o=D.subarray(n>>2,n+16*t>>2);_u.uniformMatrix2fv(Li(e),!!r,o)}},ks=(e,t,r,n)=>{t&&_u.uniformMatrix2x3fv(Li(e),!!r,D,n>>2,6*t)},Ts=(e,t,r,n)=>{t&&_u.uniformMatrix2x4fv(Li(e),!!r,D,n>>2,8*t)},As=(e,t,r,n)=>{if(gr.currentContext.version>=2)t&&_u.uniformMatrix3fv(Li(e),!!r,D,n>>2,9*t);else{if(t<=32)for(var o=Ja[9*t-1],i=0;i<9*t;i+=9)o[i]=D[n+4*i>>2],o[i+1]=D[n+(4*i+4)>>2],o[i+2]=D[n+(4*i+8)>>2],o[i+3]=D[n+(4*i+12)>>2],o[i+4]=D[n+(4*i+16)>>2],o[i+5]=D[n+(4*i+20)>>2],o[i+6]=D[n+(4*i+24)>>2],o[i+7]=D[n+(4*i+28)>>2],o[i+8]=D[n+(4*i+32)>>2];else o=D.subarray(n>>2,n+36*t>>2);_u.uniformMatrix3fv(Li(e),!!r,o)}},Ps=(e,t,r,n)=>{t&&_u.uniformMatrix3x2fv(Li(e),!!r,D,n>>2,6*t)},qs=(e,t,r,n)=>{t&&_u.uniformMatrix3x4fv(Li(e),!!r,D,n>>2,12*t)},Fs=(e,t,r,n)=>{if(gr.currentContext.version>=2)t&&_u.uniformMatrix4fv(Li(e),!!r,D,n>>2,16*t);else{if(t<=18){var o=Ja[16*t-1],i=D;n>>=2;for(var a=0;a<16*t;a+=16){var s=n+a;o[a]=i[s],o[a+1]=i[s+1],o[a+2]=i[s+2],o[a+3]=i[s+3],o[a+4]=i[s+4],o[a+5]=i[s+5],o[a+6]=i[s+6],o[a+7]=i[s+7],o[a+8]=i[s+8],o[a+9]=i[s+9],o[a+10]=i[s+10],o[a+11]=i[s+11],o[a+12]=i[s+12],o[a+13]=i[s+13],o[a+14]=i[s+14],o[a+15]=i[s+15]}}else o=D.subarray(n>>2,n+64*t>>2);_u.uniformMatrix4fv(Li(e),!!r,o)}},Ls=(e,t,r,n)=>{t&&_u.uniformMatrix4x2fv(Li(e),!!r,D,n>>2,8*t)},Ds=(e,t,r,n)=>{t&&_u.uniformMatrix4x3fv(Li(e),!!r,D,n>>2,12*t)},Bs=e=>{e=gr.programs[e],_u.useProgram(e),_u.currentProgram=e},Rs=e=>{_u.validateProgram(gr.programs[e])},Ms=function(e,t){_u.vertexAttrib1f(e,t)},Os=(e,t)=>{_u.vertexAttrib1f(e,D[t>>2])},Is=function(e,t,r){_u.vertexAttrib2f(e,t,r)},js=(e,t)=>{_u.vertexAttrib2f(e,D[t>>2],D[t+4>>2])},Us=function(e,t,r,n){_u.vertexAttrib3f(e,t,r,n)},$s=(e,t)=>{_u.vertexAttrib3f(e,D[t>>2],D[t+4>>2],D[t+8>>2])},Ns=function(e,t,r,n,o){_u.vertexAttrib4f(e,t,r,n,o)},Hs=(e,t)=>{_u.vertexAttrib4f(e,D[t>>2],D[t+4>>2],D[t+8>>2],D[t+12>>2])},Vs=(e,t)=>{_u.vertexAttribDivisor(e,t)},Ws=Vs,zs=Vs,Gs=Vs,Ys=Vs,Xs=Vs,Zs=function(e,t,r,n,o){_u.vertexAttribI4i(e,t,r,n,o)},Ks=(e,t)=>{_u.vertexAttribI4i(e,F[t>>2],F[t+4>>2],F[t+8>>2],F[t+12>>2])},Qs=function(e,t,r,n,o){_u.vertexAttribI4ui(e,t,r,n,o)},Js=(e,t)=>{_u.vertexAttribI4ui(e,L[t>>2],L[t+4>>2],L[t+8>>2],L[t+12>>2])},eu=(e,t,r,n,o)=>{_u.vertexAttribIPointer(e,t,r,n,o)},tu=(e,t,r,n,o,i)=>{_u.vertexAttribPointer(e,t,r,!!n,o,i)},ru=function(e,t,r,n){_u.viewport(e,t,r,n)},nu=(e,t,r)=>{r=Number(r),_u.waitSync(gr.syncs[e],t,r)},ou=e=>{var t=(e-S.buffer.byteLength+65535)/65536;try{return S.grow(t),j(),1}catch(e){}},iu={removeAllEventListeners(){for(;iu.eventHandlers.length;)iu._removeHandler(iu.eventHandlers.length-1);iu.deferredCalls=[]},inEventHandler:0,deferredCalls:[],deferCall(e,t,r){function n(e,t){if(e.length!=t.length)return!1;for(var r in e)if(e[r]!=t[r])return!1;return!0}for(var o in iu.deferredCalls){var i=iu.deferredCalls[o];if(i.targetFunction==e&&n(i.argsList,r))return}iu.deferredCalls.push({targetFunction:e,precedence:t,argsList:r}),iu.deferredCalls.sort(((e,t)=>e.precedence<t.precedence))},removeDeferredCalls(e){for(var t=0;t<iu.deferredCalls.length;++t)iu.deferredCalls[t].targetFunction==e&&(iu.deferredCalls.splice(t,1),--t)},canPerformEventHandlerRequests:()=>navigator.userActivation?navigator.userActivation.isActive:iu.inEventHandler&&iu.currentEventHandler.allowsDeferredCalls,runDeferredCalls(){if(iu.canPerformEventHandlerRequests())for(var e=0;e<iu.deferredCalls.length;++e){var t=iu.deferredCalls[e];iu.deferredCalls.splice(e,1),--e,t.targetFunction.apply(null,t.argsList)}},eventHandlers:[],removeAllHandlersOnTarget:(e,t)=>{for(var r=0;r<iu.eventHandlers.length;++r)iu.eventHandlers[r].target!=e||t&&t!=iu.eventHandlers[r].eventTypeString||iu._removeHandler(r--)},_removeHandler(e){var t=iu.eventHandlers[e];t.target.removeEventListener(t.eventTypeString,t.eventListenerFunc,t.useCapture),iu.eventHandlers.splice(e,1)},registerOrRemoveHandler(e){if(!e.target)return-4;if(e.callbackfunc)e.eventListenerFunc=function(t){++iu.inEventHandler,iu.currentEventHandler=e,iu.runDeferredCalls(),e.handlerFunc(t),iu.runDeferredCalls(),--iu.inEventHandler},e.target.addEventListener(e.eventTypeString,e.eventListenerFunc,e.useCapture),iu.eventHandlers.push(e);else for(var t=0;t<iu.eventHandlers.length;++t)iu.eventHandlers[t].target==e.target&&iu.eventHandlers[t].eventTypeString==e.eventTypeString&&iu._removeHandler(t--);return 0},getNodeNameForTarget:e=>e?e==window?"#window":e==screen?"#screen":e?.nodeName||"":"",fullscreenEnabled:()=>document.fullscreenEnabled||document.webkitFullscreenEnabled},au=["default","low-power","high-performance"],su=[0,"undefined"!=typeof document?document:0,"undefined"!=typeof window?window:0],uu=e=>{var t;return e=(t=e)>2?xe(t):t,su[e]||("undefined"!=typeof document?document.querySelector(e):void 0)},cu=(e,t)=>{var r=t>>2,n=F[r+6],o={alpha:!!F[r+0],depth:!!F[r+1],stencil:!!F[r+2],antialias:!!F[r+3],premultipliedAlpha:!!F[r+4],preserveDrawingBuffer:!!F[r+5],powerPreference:au[n],failIfMajorPerformanceCaveat:!!F[r+7],majorVersion:F[r+8],minorVersion:F[r+9],enableExtensionsByDefault:F[r+10],explicitSwapControl:F[r+11],proxyContextToMainThread:F[r+12],renderViaOffscreenBackBuffer:F[r+13]},i=uu(e);return i?o.explicitSwapControl?0:gr.createContext(i,o):0},lu={},du=()=>{if(!du.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:f||"./this.program"};for(var t in lu)void 0===lu[t]?delete e[t]:e[t]=lu[t];var r=[];for(var t in e)r.push(`${t}=${e[t]}`);du.strings=r}return du.strings},pu=(e,t,r,n)=>{for(var o=0,i=0;i<r;i++){var a=L[t>>2],s=L[t+4>>2];t+=8;var u=Ce.read(e,T,a,s,n);if(u<0)return-1;if(o+=u,u<s)break;void 0!==n&&(n+=u)}return o},hu=[31,29,31,30,31,30,31,31,30,31,30,31],fu=[31,28,31,30,31,30,31,31,30,31,30,31],mu=(e,t)=>{T.set(e,t)},gu=(e,t,r,n)=>{var o=L[n+40>>2],i={tm_sec:F[n>>2],tm_min:F[n+4>>2],tm_hour:F[n+8>>2],tm_mday:F[n+12>>2],tm_mon:F[n+16>>2],tm_year:F[n+20>>2],tm_wday:F[n+24>>2],tm_yday:F[n+28>>2],tm_isdst:F[n+32>>2],tm_gmtoff:F[n+36>>2],tm_zone:o?xe(o):""},a=xe(r),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in s)a=a.replace(new RegExp(u,"g"),s[u]);var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,t,r){for(var n="number"==typeof e?e.toString():e||"";n.length<t;)n=r[0]+n;return n}function p(e,t){return d(e,t,"0")}function h(e,t){function r(e){return e<0?-1:e>0?1:0}var n;return 0===(n=r(e.getFullYear()-t.getFullYear()))&&0===(n=r(e.getMonth()-t.getMonth()))&&(n=r(e.getDate()-t.getDate())),n}function f(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function m(e){var t=((e,t)=>{for(var r=new Date(e.getTime());t>0;){var n=rr(r.getFullYear()),o=r.getMonth(),i=(n?hu:fu)[o];if(!(t>i-r.getDate()))return r.setDate(r.getDate()+t),r;t-=i-r.getDate()+1,r.setDate(1),o<11?r.setMonth(o+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r})(new Date(e.tm_year+1900,0,1),e.tm_yday),r=new Date(t.getFullYear(),0,4),n=new Date(t.getFullYear()+1,0,4),o=f(r),i=f(n);return h(o,t)<=0?h(i,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var g={"%a":e=>c[e.tm_wday].substring(0,3),"%A":e=>c[e.tm_wday],"%b":e=>l[e.tm_mon].substring(0,3),"%B":e=>l[e.tm_mon],"%C":e=>p((e.tm_year+1900)/100|0,2),"%d":e=>p(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>m(e).toString().substring(2),"%G":m,"%H":e=>p(e.tm_hour,2),"%I":e=>{var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),p(t,2)},"%j":e=>p(e.tm_mday+((e,t)=>{for(var r=0,n=0;n<=t;r+=e[n++]);return r})(rr(e.tm_year+1900)?hu:fu,e.tm_mon-1),3),"%m":e=>p(e.tm_mon+1,2),"%M":e=>p(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>p(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var t=e.tm_yday+7-e.tm_wday;return p(Math.floor(t/7),2)},"%V":e=>{var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var r=(e.tm_wday+371-e.tm_yday)%7;4==r||3==r&&rr(e.tm_year)||(t=1)}}else{t=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&rr(e.tm_year%400-1))&&t++}return p(t,2)},"%w":e=>e.tm_wday,"%W":e=>{var t=e.tm_yday+7-(e.tm_wday+6)%7;return p(Math.floor(t/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var t=e.tm_gmtoff,r=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(r?"+":"-")+String("0000"+t).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in a=a.replace(/%%/g,"\0\0"),g)a.includes(u)&&(a=a.replace(new RegExp(u,"g"),g[u](i)));var y=be(a=a.replace(/\0\0/g,"%"),!1);return y.length>t?0:(mu(y,e),y.length-1)},yu=e=>{var t=ge(e)+1,r=$u(t);return Nt(e,r,t),r},bu=function(e,t,r,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=Ce.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=n},vu=365,wu=146;Object.defineProperties(bu.prototype,{read:{get:function(){return(this.mode&vu)===vu},set:function(e){e?this.mode|=vu:this.mode&=-366}},write:{get:function(){return(this.mode&wu)===wu},set:function(e){e?this.mode|=wu:this.mode&=-147}},isFolder:{get:function(){return Ce.isDir(this.mode)}},isDevice:{get:function(){return Ce.isChrdev(this.mode)}}}),Ce.FSNode=bu,Ce.createPreloadedFile=(e,t,r,n,o,i,a,s,u,c)=>{var d=t?pe.resolve(le.join2(e,t)):e;function p(r){function l(r){c?.(),s||((e,t,r,n,o,i)=>{Ce.createDataFile(e,t,r,n,o,i)})(e,t,r,n,o,u),i?.(),X()}((e,t,r,n)=>{void 0!==fr&&fr.init();var o=!1;return Ee.forEach((i=>{o||i.canHandle(t)&&(i.handle(e,t,r,n),o=!0)})),o})(r,d,l,(()=>{a?.(),X()}))||l(r)}Y(),"string"==typeof r?((e,t,r,n)=>{var o=n?"":`al ${e}`;l(e,(e=>{t(new Uint8Array(e)),o&&X()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),o&&Y()})(r,p,a):p(r)},Ce.staticInit(),u.FS_createPath=Ce.createPath,u.FS_createDataFile=Ce.createDataFile,u.FS_createPreloadedFile=Ce.createPreloadedFile,u.FS_unlink=Ce.unlink,u.FS_createLazyFile=Ce.createLazyFile,u.FS_createDevice=Ce.createDevice,qe=u.InternalError=class InternalError extends Error{constructor(e){super(e),this.name="InternalError"}},(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Fe=e})(),Le=u.BindingError=class BindingError extends Error{constructor(e){super(e),this.name="BindingError"}},Object.assign(ut.prototype,{isAliasOf(e){if(!(this instanceof ut))return!1;if(!(e instanceof ut))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,o=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return t===n&&r===o},clone(){if(this.$$.ptr||ze(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=st(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$e("Object already scheduled for deletion"),Ye(this),Xe(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ze(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$e("Object already scheduled for deletion"),et.push(this),1===et.length&&He&&He(tt),this.$$.deleteScheduled=!0,this}}),u.getInheritedInstanceCount=Qe,u.getLiveInheritedInstances=Je,u.flushPendingDeletes=tt,u.setDelayFunction=rt,Object.assign(vt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},argPackAdvance:We,readValueFromPointer:bt,fromWireType:at}),_t=u.UnboundTypeError=(ko=Error,(Ao=lt(To="UnboundTypeError",(function(e){this.name=To,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}))).prototype=Object.create(ko.prototype),Ao.prototype.constructor=Ao,Ao.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},Ao),Bt.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),Object.assign(Bt,{reserved:Bt.allocated.length}),u.count_emval_handles=Mt,u.requestFullscreen=fr.requestFullscreen,u.requestAnimationFrame=fr.requestAnimationFrame,u.setCanvasSize=fr.setCanvasSize,u.pauseMainLoop=fr.mainLoop.pause,u.resumeMainLoop=fr.mainLoop.resume,u.getUserMedia=fr.getUserMedia,u.createContext=fr.createContext;for(var _u,Eu={},Su={},Cu=0;Cu<32;++Cu)Nn.push(new Array(Cu));var xu=new Float32Array(288);for(Cu=0;Cu<288;++Cu)Ja[Cu]=xu.subarray(0,Cu+1);var ku=new Int32Array(288);for(Cu=0;Cu<288;++Cu)rs[Cu]=ku.subarray(0,Cu+1);var Tu,Au={Oa:e=>{var t=new ExceptionInfo(e);return t.get_caught()||t.set_caught(!0),t.set_rethrown(!1),se.push(t),Hu(t.excPtr),t.get_exception_ptr()},Na:()=>{Iu(0,0);var e=se.pop();Nu(e.excPtr),ue=0},o:()=>ce([]),ba:e=>ce([e]),k:(e,t,r)=>{throw new ExceptionInfo(e).init(t,r),ue=e},Q:e=>{throw ue||(ue=e),ue},fa:function(e,t,r){ke.varargs=r;try{var n=ke.getStreamFromFD(e);switch(t){case 0:if((o=ke.get())<0)return-28;for(;Ce.streams[o];)o++;return Ce.createStream(n,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return n.flags;case 4:var o=ke.get();return n.flags|=o,0;case 12:return o=ke.getp(),P[o+0>>1]=2,0}return-28}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},Ab:function(e,t){try{var r=ke.getStreamFromFD(e);return ke.doStat(Ce.stat,r.path,t)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},Fb:function(e,t,r){ke.varargs=r;try{var n=ke.getStreamFromFD(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),i=ke.getp();F[i>>2]=o.c_iflag||0,F[i+4>>2]=o.c_oflag||0,F[i+8>>2]=o.c_cflag||0,F[i+12>>2]=o.c_lflag||0;for(var a=0;a<32;a++)T[i+a+17>>0]=o.c_cc[a]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){i=ke.getp();var s=F[i>>2],u=F[i+4>>2],c=F[i+8>>2],l=F[i+12>>2],d=[];for(a=0;a<32;a++)d.push(T[i+a+17>>0]);return n.tty.ops.ioctl_tcsets(n.tty,t,{c_iflag:s,c_oflag:u,c_cflag:c,c_lflag:l,c_cc:d})}return 0;case 21519:return n.tty?(i=ke.getp(),F[i>>2]=0,0):-59;case 21520:return n.tty?-28:-59;case 21531:return i=ke.getp(),Ce.ioctl(n,t,i);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var p=n.tty.ops.ioctl_tiocgwinsz(n.tty);i=ke.getp(),P[i>>1]=p[0],P[i+2>>1]=p[1]}return 0;default:return-28}}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},yb:function(e,t){try{return e=ke.getStr(e),ke.doStat(Ce.lstat,e,t)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},xb:function(e,t,r,n){try{t=ke.getStr(t);var o=256&n,i=4096&n;return n&=-6401,t=ke.calculateAt(e,t,i),ke.doStat(o?Ce.lstat:Ce.stat,t,r)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},xa:function(e,t,r,n){ke.varargs=n;try{t=ke.getStr(t),t=ke.calculateAt(e,t);var o=n?ke.get():0;return Ce.open(t,r,o).fd}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},zb:function(e,t){try{return e=ke.getStr(e),ke.doStat(Ce.stat,e,t)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},Ca:e=>{var t=Te[e];delete Te[e];var r=t.elements,n=r.length,o=r.map((e=>e.getterReturnType)).concat(r.map((e=>e.setterArgumentType))),i=t.rawConstructor,a=t.rawDestructor;Oe([e],o,(function(e){return r.forEach(((t,r)=>{var o=e[r],i=t.getter,a=t.getterContext,s=e[r+n],u=t.setter,c=t.setterContext;t.read=e=>o.fromWireType(i(a,e)),t.write=(e,t)=>{var r=[];u(c,e,s.toWireType(r,t)),Ae(r)}})),[{name:t.name,fromWireType:e=>{for(var t=new Array(n),o=0;o<n;++o)t[o]=r[o].read(e);return a(e),t},toWireType:(e,o)=>{if(n!==o.length)throw new TypeError(`Incorrect number of tuple elements for ${t.name}: expected=${n}, actual=${o.length}`);for(var s=i(),u=0;u<n;++u)r[u].write(s,o[u]);return null!==e&&e.push(a,s),s},argPackAdvance:We,readValueFromPointer:Pe,destructorFunction:a}]}))},z:e=>{var t=Ie[e];delete Ie[e];var r=t.rawConstructor,n=t.rawDestructor,o=t.fields,i=o.map((e=>e.getterReturnType)).concat(o.map((e=>e.setterArgumentType)));Oe([e],i,(e=>{var i={};return o.forEach(((t,r)=>{var n=t.fieldName,a=e[r],s=t.getter,u=t.getterContext,c=e[r+o.length],l=t.setter,d=t.setterContext;i[n]={read:e=>a.fromWireType(s(u,e)),write:(e,t)=>{var r=[];l(d,e,c.toWireType(r,t)),Ae(r)}}})),[{name:t.name,fromWireType:e=>{var t={};for(var r in i)t[r]=i[r].read(e);return n(e),t},toWireType:(e,t)=>{for(var o in i)if(!(o in t))throw new TypeError(`Missing field: "${o}"`);var a=r();for(o in i)i[o].write(a,t[o]);return null!==e&&e.push(n,a),a},argPackAdvance:We,readValueFromPointer:Pe,destructorFunction:n}]}))},Fa:(e,t,r,n,o)=>{var i=-1!=(t=Ue(t)).indexOf("u");Ne(e,{name:t,fromWireType:e=>e,toWireType:function(e,t){if("bigint"!=typeof t&&"number"!=typeof t)throw new TypeError(`Cannot convert "${je(t)}" to ${this.name}`);return"number"==typeof t&&(t=BigInt(t)),t},argPackAdvance:We,readValueFromPointer:Ve(t,r,!i),destructorFunction:null})},me:(e,t,r,n)=>{Ne(e,{name:t=Ue(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:We,readValueFromPointer:function(e){return this.fromWireType(A[e])},destructorFunction:null})},v:(e,t,r,n,o,i,a,s,u,c,l,d,p)=>{l=Ue(l),i=xt(o,i),s&&=xt(a,s),c&&=xt(u,c),p=xt(d,p);var h=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(l);pt(h,(function(){Tt(`Cannot construct ${l} due to unbound types`,[n])})),Oe([e,t,r],n?[n]:[],(function(t){var r,o;t=t[0],o=n?(r=t.registeredClass).instancePrototype:ut.prototype;var a=lt(l,(function(){if(Object.getPrototypeOf(this)!==u)throw new Le("Use 'new' to construct "+l);if(void 0===d.constructor_body)throw new Le(l+" has no accessible constructor");var e=d.constructor_body[arguments.length];if(void 0===e)throw new Le(`Tried to invoke ctor of ${l} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),u=Object.create(o,{constructor:{value:a}});a.prototype=u;var d=new ht(l,a,u,p,r,i,s,c);d.baseClass&&(d.baseClass.__derivedClasses??=[],d.baseClass.__derivedClasses.push(d));var f=new vt(l,d,!0,!1,!1),m=new vt(l+"*",d,!1,!1,!1),g=new vt(l+" const*",d,!1,!0,!1);return Ke[e]={pointerType:m,constPointerType:g},Et(h,a),[f,m,g]}))},x:(e,t,r,n,o,i)=>{var a=At(t,r);o=xt(n,o),Oe([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new Le(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{Tt(`Cannot construct ${e.name} due to unbound types`,a)},Oe([],a,(n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Ft(r,n,null,o,i),[]))),[]}))},d:(e,t,r,n,o,i,a,s,u)=>{var c=At(r,n);t=Ue(t),t=Dt(t),i=xt(o,i),Oe([],[e],(function(e){var n=`${(e=e[0]).name}.${t}`;function o(){Tt(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,d=l[t];return void 0===d||void 0===d.overloadTable&&d.className!==e.name&&d.argCount===r-2?(o.argCount=r-2,o.className=e.name,l[t]=o):(dt(l,t,n),l[t].overloadTable[r-2]=o),Oe([],c,(function(o){var s=Ft(n,o,e,i,a,u);return void 0===l[t].overloadTable?(s.argCount=r-2,l[t]=s):l[t].overloadTable[r-2]=s,[]})),[]}))},le:e=>Ne(e,It),W:(e,t,r,n)=>{function o(){}t=Ue(t),o.values={},Ne(e,{name:t,constructor:o,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:We,readValueFromPointer:jt(t,r,n),destructorFunction:null}),pt(t,o)},H:(e,t,r)=>{var n=Ut(e,"enum");t=Ue(t);var o=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:lt(`${n.name}_${t}`,(function(){}))}});o.values[r]=i,o[t]=i},Ea:(e,t,r)=>{Ne(e,{name:t=Ue(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:We,readValueFromPointer:$t(t,r),destructorFunction:null})},J:(e,t,r,n,o,i,a)=>{var s=At(t,r);e=Ue(e),e=Dt(e),o=xt(n,o),pt(e,(function(){Tt(`Cannot call ${e} due to unbound types`,s)}),t-1),Oe([],s,(function(r){var n=[r[0],null].concat(r.slice(1));return Et(e,Ft(e,n,null,o,i,a),t-1),[]}))},O:(e,t,r,n,o)=>{t=Ue(t),-1===o&&(o=4294967295);var i=e=>e;if(0===n){var a=32-8*r;i=e=>e<<a>>>a}var s=t.includes("unsigned");Ne(e,{name:t,fromWireType:i,toWireType:s?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:We,readValueFromPointer:Ve(t,r,0!==n),destructorFunction:null})},E:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function o(e){var t=L[e>>2],r=L[e+4>>2];return new n(T.buffer,r,t)}Ne(e,{name:r=Ue(r),fromWireType:o,argPackAdvance:We,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},cf:(e,t,r,n,o,i,a,s,u,c,l,d)=>{r=Ue(r),i=xt(o,i),s=xt(a,s),c=xt(u,c),d=xt(l,d),Oe([e],[t],(function(e){return e=e[0],[new vt(r,e.registeredClass,!1,!1,!0,e,n,i,s,c,d)]}))},Ga:(e,t)=>{var r="std::string"===(t=Ue(t));Ne(e,{name:t,fromWireType(e){var t,n=L[e>>2],o=e+4;if(r)for(var i=o,a=0;a<=n;++a){var s=o+a;if(a==n||0==A[s]){var u=xe(i,s-i);void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),i=s+1}}else{var c=new Array(n);for(a=0;a<n;++a)c[a]=String.fromCharCode(A[o+a]);t=c.join("")}return Lu(e),t},toWireType(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var o="string"==typeof t;o||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||$e("Cannot pass non-string to std::string"),n=r&&o?ge(t):t.length;var i=qu(4+n+1),a=i+4;if(L[i>>2]=n,r&&o)Nt(t,a,n+1);else if(o)for(var s=0;s<n;++s){var u=t.charCodeAt(s);u>255&&(Lu(a),$e("String has UTF-16 code units that do not fit in 8 bits")),A[a+s]=u}else for(s=0;s<n;++s)A[a+s]=t[s];return null!==e&&e.push(Lu,i),i},argPackAdvance:We,readValueFromPointer:bt,destructorFunction(e){Lu(e)}})},ga:(e,t,r)=>{var n,o,i,a,s;r=Ue(r),2===t?(n=Vt,o=Wt,a=zt,i=()=>q,s=1):4===t&&(n=Gt,o=Yt,a=Xt,i=()=>L,s=2),Ne(e,{name:r,fromWireType:e=>{for(var r,o=L[e>>2],a=i(),u=e+4,c=0;c<=o;++c){var l=e+4+c*t;if(c==o||0==a[l>>s]){var d=n(u,l-u);void 0===r?r=d:(r+=String.fromCharCode(0),r+=d),u=l+t}}return Lu(e),r},toWireType:(e,n)=>{"string"!=typeof n&&$e(`Cannot pass non-string to C++ string type ${r}`);var i=a(n),u=qu(4+i+t);return L[u>>2]=i>>s,o(n,u+4,i+t),null!==e&&e.push(Lu,u),u},argPackAdvance:We,readValueFromPointer:Pe,destructorFunction(e){Lu(e)}})},Da:(e,t,r,n,o,i)=>{Te[e]={name:Ue(t),rawConstructor:xt(r,n),rawDestructor:xt(o,i),elements:[]}},N:(e,t,r,n,o,i,a,s,u)=>{Te[e].elements.push({getterReturnType:t,getter:xt(r,n),getterContext:o,setterArgumentType:i,setter:xt(a,s),setterContext:u})},A:(e,t,r,n,o,i)=>{Ie[e]={name:Ue(t),rawConstructor:xt(r,n),rawDestructor:xt(o,i),fields:[]}},m:(e,t,r,n,o,i,a,s,u,c)=>{Ie[e].fields.push({fieldName:Ue(t),getterReturnType:r,getter:xt(n,o),getterContext:i,setterArgumentType:a,setter:xt(s,u),setterContext:c})},ne:(e,t)=>{Ne(e,{isVoid:!0,name:t=Ue(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},Cb:()=>1,jb:()=>{throw 1/0},j:(e,t,r)=>(e=Ot.toValue(e),t=Ut(t,"emval::as"),Zt(t,r,e)),w:(e,t,r,n)=>(e=Kt[e])(null,t=Ot.toValue(t),r,n),R:(e,t,r,n,o)=>(e=Kt[e])(t=Ot.toValue(t),t[r=Jt(r)],n,o),c:Rt,ke:(e,t)=>(e=Ot.toValue(e))==(t=Ot.toValue(t)),M:e=>0===e?Ot.toHandle(er()):(e=Jt(e),Ot.toHandle(er()[e])),s:(e,t,r)=>{var n=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=Ut(L[t+4*n>>2],"parameter "+n);return r})(e,t),o=n.shift();e--;var i="return function (obj, func, destructorsRef, args) {\n",a=0,s=[];0===r&&s.push("obj");for(var u=["retType"],c=[o],l=0;l<e;++l)s.push("arg"+l),u.push("argType"+l),c.push(n[l]),i+=` var arg${l} = argType${l}.readValueFromPointer(args${a?"+"+a:""});\n`,a+=n[l].argPackAdvance;i+=` var rv = ${1===r?"new func":"func.call"}(${s.join(", ")});\n`,o.isVoid||(u.push("emval_returnValue"),c.push(Zt),i+=" return emval_returnValue(retType, destructorsRef, rv);\n"),i+="};\n",u.push(i);var d,p,h=qt(Function,u).apply(null,c),f=`methodCaller<(${n.map((e=>e.name)).join(", ")}) => ${o.name}>`;return d=lt(f,h),p=Kt.length,Kt.push(d),p},h:(e,t)=>(e=Ot.toValue(e),t=Ot.toValue(t),Ot.toHandle(e[t])),e:e=>{e>4&&(Bt.get(e).refcount+=1)},$:(e,t)=>(e=Ot.toValue(e))instanceof(t=Ot.toValue(t)),ia:e=>"number"==typeof(e=Ot.toValue(e)),K:e=>"string"==typeof(e=Ot.toValue(e)),Je:()=>Ot.toHandle([]),g:e=>Ot.toHandle(Jt(e)),C:()=>Ot.toHandle({}),i:e=>{var t=Ot.toValue(e);Ae(t),Rt(e)},n:(e,t,r)=>{e=Ot.toValue(e),t=Ot.toValue(t),r=Ot.toValue(r),e[t]=r},f:(e,t)=>{var r=(e=Ut(e,"_emval_take_value")).readValueFromPointer(t);return Ot.toHandle(r)},of:e=>{throw e=Ot.toValue(e)},od:e=>(e=Ot.toValue(e),Ot.toHandle(typeof e)),rb:function(e,t){e=tr(e);var r=new Date(1e3*e);F[t>>2]=r.getUTCSeconds(),F[t+4>>2]=r.getUTCMinutes(),F[t+8>>2]=r.getUTCHours(),F[t+12>>2]=r.getUTCDate(),F[t+16>>2]=r.getUTCMonth(),F[t+20>>2]=r.getUTCFullYear()-1900,F[t+24>>2]=r.getUTCDay();var n=Date.UTC(r.getUTCFullYear(),0,1,0,0,0,0),o=(r.getTime()-n)/864e5|0;F[t+28>>2]=o},sb:function(e,t){e=tr(e);var r=new Date(1e3*e);F[t>>2]=r.getSeconds(),F[t+4>>2]=r.getMinutes(),F[t+8>>2]=r.getHours(),F[t+12>>2]=r.getDate(),F[t+16>>2]=r.getMonth(),F[t+20>>2]=r.getFullYear()-1900,F[t+24>>2]=r.getDay();var n=0|ir(r);F[t+28>>2]=n,F[t+36>>2]=-60*r.getTimezoneOffset();var o=new Date(r.getFullYear(),0,1),i=new Date(r.getFullYear(),6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),s=0|(i!=a&&r.getTimezoneOffset()==Math.min(a,i));F[t+32>>2]=s},tb:function(e){var t=(()=>{var t=new Date(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),r=F[e+32>>2],n=t.getTimezoneOffset(),o=new Date(t.getFullYear(),0,1),i=new Date(t.getFullYear(),6,1).getTimezoneOffset(),a=o.getTimezoneOffset(),s=Math.min(a,i);if(r<0)F[e+32>>2]=Number(i!=a&&s==n);else if(r>0!=(s==n)){var u=Math.max(a,i),c=r>0?s:u;t.setTime(t.getTime()+6e4*(c-n))}F[e+24>>2]=t.getDay();var l=0|ir(t);F[e+28>>2]=l,F[e>>2]=t.getSeconds(),F[e+4>>2]=t.getMinutes(),F[e+8>>2]=t.getHours(),F[e+12>>2]=t.getDate(),F[e+16>>2]=t.getMonth(),F[e+20>>2]=t.getYear();var d=t.getTime();return isNaN(d)?-1:d/1e3})();return BigInt(t)},pb:function(e,t,r,n,o,i,a){o=tr(o);try{if(isNaN(o))return 61;var s=ke.getStreamFromFD(n),u=Ce.mmap(s,e,o,t,r),c=u.ptr;return F[i>>2]=u.allocated,L[a>>2]=c,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},qb:function(e,t,r,n,o,i){i=tr(i);try{if(isNaN(i))return 61;var a=ke.getStreamFromFD(o);2&r&&ke.doMsync(e,a,t,n,i),Ce.munmap(a)}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return-e.errno}},kb:(e,t,r)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),i=new Date(n,6,1),a=o.getTimezoneOffset(),s=i.getTimezoneOffset(),u=Math.max(a,s);function c(e){var t=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return t?t[1]:"GMT"}L[e>>2]=60*u,F[t>>2]=Number(a!=s);var l=c(o),d=c(i),p=ar(l),h=ar(d);s<a?(L[r>>2]=p,L[r+4>>2]=h):(L[r>>2]=h,L[r+4>>2]=p)},b:()=>{Z("")},qe:function(e){var t=xe(e);localStorage.removeItem(t)},va:(e,t,r,n,o)=>mr.chooseConfig(e,t,r,n,o),wa:(e,t,r,n)=>{if(62e3!=e)return mr.setErrorCode(12296),0;for(var o=1;;){var i=F[n>>2];if(12440!=i){if(12344==i)break;return mr.setErrorCode(12292),0}o=F[n+4>>2],n+=8}return o<2||o>3?(mr.setErrorCode(12293),0):(mr.contextAttributes.majorVersion=o-1,mr.contextAttributes.minorVersion=0,mr.context=gr.createContext(u.canvas,mr.contextAttributes),0!=mr.context?(mr.setErrorCode(12288),gr.makeContextCurrent(mr.context),u.useWebGL=!0,fr.moduleContextCreatedCallbacks.forEach((function(e){e()})),gr.makeContextCurrent(null),62004):(mr.setErrorCode(12297),0))},cb:(e,t,r,n)=>62e3!=e?(mr.setErrorCode(12296),0):62002!=t?(mr.setErrorCode(12293),0):(mr.setErrorCode(12288),62006),Lc:(e,t)=>62e3!=e?(mr.setErrorCode(12296),0):62004!=t?(mr.setErrorCode(12294),0):(gr.deleteContext(mr.context),mr.setErrorCode(12288),mr.currentContext==t&&(mr.currentContext=0),1),Ac:(e,t)=>62e3!=e?(mr.setErrorCode(12296),0):62006!=t?(mr.setErrorCode(12301),1):(mr.currentReadSurface==t&&(mr.currentReadSurface=0),mr.currentDrawSurface==t&&(mr.currentDrawSurface=0),mr.setErrorCode(12288),1),S:(e,t,r,n)=>{if(62e3!=e)return mr.setErrorCode(12296),0;if(62002!=t)return mr.setErrorCode(12293),0;if(!n)return mr.setErrorCode(12300),0;switch(mr.setErrorCode(12288),r){case 12320:return F[n>>2]=mr.contextAttributes.alpha?32:24,1;case 12321:return F[n>>2]=mr.contextAttributes.alpha?8:0,1;case 12322:case 12323:case 12324:return F[n>>2]=8,1;case 12325:return F[n>>2]=mr.contextAttributes.depth?24:0,1;case 12326:return F[n>>2]=mr.contextAttributes.stencil?8:0,1;case 12327:case 12335:case 12340:return F[n>>2]=12344,1;case 12328:return F[n>>2]=62002,1;case 12329:case 12333:case 12334:case 12345:case 12346:case 12347:case 12349:case 12350:case 12354:return F[n>>2]=0,1;case 12330:case 12332:return F[n>>2]=4096,1;case 12331:return F[n>>2]=16777216,1;case 12337:return F[n>>2]=mr.contextAttributes.antialias?4:0,1;case 12338:return F[n>>2]=mr.contextAttributes.antialias?1:0,1;case 12339:case 12352:return F[n>>2]=4,1;case 12341:case 12342:case 12343:return F[n>>2]=-1,1;case 12348:return F[n>>2]=1,1;case 12351:return F[n>>2]=12430,1;default:return mr.setErrorCode(12292),0}},Lb:e=>(mr.setErrorCode(12288),0!=e&&1!=e?0:62e3),Aa:()=>mr.errorCode,Eb:(e,t,r)=>62e3!=e?(mr.setErrorCode(12296),0):(t&&(F[t>>2]=1),r&&(F[r>>2]=4),mr.defaultDisplayInitialized=!0,mr.setErrorCode(12288),1),Wb:(e,t,r,n)=>62e3!=e?(mr.setErrorCode(12296),0):0!=n&&62004!=n?(mr.setErrorCode(12294),0):0!=r&&62006!=r||0!=t&&62006!=t?(mr.setErrorCode(12301),0):(gr.makeContextCurrent(n?mr.context:null),mr.currentContext=n,mr.currentDrawSurface=t,mr.currentReadSurface=r,mr.setErrorCode(12288),1),Ba:(e,t)=>{if(mr.defaultDisplayInitialized)if(u.ctx){if(!u.ctx.isContextLost())return mr.setErrorCode(12288),1;mr.setErrorCode(12302)}else mr.setErrorCode(12290);else mr.setErrorCode(12289);return 0},pc:e=>62e3!=e?(mr.setErrorCode(12296),0):(mr.currentContext=0,mr.currentReadSurface=0,mr.currentDrawSurface=0,mr.defaultDisplayInitialized=!1,mr.setErrorCode(12288),1),I:(e,t,r)=>br(e,t,r),ze:e=>{console.error(xe(e))},Ae:e=>{console.log(xe(e))},ma:e=>{console.warn(xe(e))},da:()=>Date.now(),pe:function(){},mb:()=>2147483648,Bb:Lt,_f:vr,$f:wr,Wc:_r,ge:Er,Ic:Sr,ag:Cr,bg:xr,Fc:kr,Gc:Tr,_e:Ar,$e:Pr,Ke:qr,cg:Fr,Tb:Lr,xf:Br,zf:Rr,dg:Mr,eg:Or,Vd:Ir,fg:jr,Ud:Ur,Ue:$r,gg:Nr,hg:Hr,af:Vr,ig:Wr,hc:zr,ic:Gr,kc:Yr,jc:Xr,jg:Zr,Td:Kr,kg:Qr,La:Jr,lg:en,mg:tn,ng:rn,$c:nn,og:on,_c:an,Se:sn,Sd:un,pg:cn,ad:ln,qg:dn,rg:pn,sg:hn,tg:fn,bf:mn,ug:gn,Yc:yn,ie:bn,df:vn,Le:wn,vg:_n,Te:En,wg:Sn,Sb:Cn,yf:kn,Af:Tn,Rd:An,xg:Pn,Qd:qn,Pd:Fn,yg:Ln,zg:Dn,Ag:Bn,vf:Mn,Yd:On,hd:In,sf:jn,id:Un,Gb:$n,qf:Vn,dd:Wn,Zd:zn,Bg:Yn,wf:Zn,Xd:Kn,ed:Qn,tf:Jn,fd:eo,gd:to,jf:ro,Cg:no,Dg:oo,Vc:io,fe:ao,Hc:so,Qe:uo,Eg:co,Fg:lo,ef:po,ff:ho,Mc:fo,Gg:mo,Hg:yo,gf:bo,Zc:vo,je:wo,hf:_o,Me:Eo,Ig:So,Rb:Co,uf:Po,Bf:qo,We:Fo,Od:Do,Nd:Bo,cc:Ro,dc:Mo,fc:Oo,Md:Io,Ld:jo,Kd:Ho,Zb:Vo,Jg:Wo,Kg:zo,Lg:Go,uc:Yo,Xe:Xo,_b:Ko,ac:Qo,Jc:Jo,kh:ei,Ib:ti,Nb:ri,Mg:ni,Ng:oi,ae:ai,ce:ui,$d:ci,Tc:li,be:di,Uc:pi,de:hi,Ye:fi,Ub:mi,Vb:gi,Og:yi,Ge:bi,Jd:vi,Pg:wi,Ka:_i,lh:Ei,$b:Si,Id:Ci,Hd:xi,Dc:ki,ec:Ti,gc:Ai,Qg:Fi,Gd:Bi,Fd:Ri,vc:Mi,Cc:ji,Bc:Ui,Cd:$i,Ed:Ni,Dd:Hi,Bd:Vi,He:Wi,Ie:zi,Ad:Gi,zd:Yi,yd:Xi,xd:Zi,Xc:Ki,he:Qi,wd:Ji,Yb:ea,vd:ta,Re:ra,Rg:na,Qb:oa,Kc:aa,_d:sa,Sg:ua,Tg:ca,nf:la,pf:da,Pb:pa,Ug:ha,ud:fa,Mb:ma,Kb:ga,ee:ya,rf:ba,Vg:Ea,td:Sa,Ze:Ca,Ve:xa,Ob:ka,sd:Ta,Ne:Aa,Xb:Pa,Oe:qa,Pe:Fa,Wg:La,rd:Da,Xg:Ba,Yg:Ra,Zg:Ma,_g:Oa,$g:Ia,ah:ja,bh:Ua,ch:$a,cd:Na,dh:Ha,eh:Va,fh:Wa,gh:za,kf:Ga,Jb:Ya,hh:Xa,bd:Za,Ec:Ka,ih:Qa,jh:es,Wf:ts,Xf:ns,tc:os,oc:is,Yf:as,Zf:ss,Vf:us,Uf:cs,sc:ls,nc:ds,Tf:ps,Sf:hs,Rf:fs,Qf:ms,rc:gs,mc:ys,Pf:bs,Of:vs,Cf:ws,Df:_s,qc:Es,lc:Ss,bc:Cs,Ef:xs,Sc:ks,Qc:Ts,Ff:As,Rc:Ps,Oc:qs,Gf:Fs,Pc:Ls,Nc:Ds,Hf:Bs,qd:Rs,If:Ms,pd:Os,nd:Is,Jf:js,md:Us,Kf:$s,ld:Ns,Lf:Hs,lf:Ws,Wd:zs,jd:Gs,kd:Ys,Hb:Xs,zc:Zs,xc:Ks,yc:Qs,wc:Js,mf:eu,Mf:tu,Nf:ru,Ma:nu,Db:(e,t,r)=>A.copyWithin(e,t,t+r),nb:e=>{var t=A.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n,o,i=1;i<=4;i*=2){var a=t*(1+.2/i);a=Math.min(a,e+100663296);var s=Math.min(r,(n=Math.max(e,a))+((o=65536)-n%o)%o);if(ou(s))return!0}return!1},_a:function(e,t,r,n,o,i,a,s,c){const l=u.UTF8ToString(e,e+t),d=u.HEAPU8.subarray(o,o+i),p=u.emscripten_ubq_codec_audioDecoderNextHandle++,h={codec:l,sampleRate:r,numberOfChannels:n,description:d};try{const e=u.emscripten_ubq_codec_createAudioDecoder(a,s,c);AudioDecoder.isConfigSupported(h).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(h),u.emscripten_ubq_codec_audioDecoders.set(p,{audioDecoder:e,decoderConfig:h,leftBufferPtr:a,rightBufferPtr:s,bufferLength:c})}catch(e){return u.emscripten_ubq_codec_createNativeResult({error:e})}return u.emscripten_ubq_codec_createNativeResult({handle:p})},Ua:function(e,t,r,n,o,i){const a=u.UTF8ToString(e,e+t),s=u.emscripten_ubq_codec_audioEncoderNextHandle++,c={codec:a,sampleRate:r,numberOfChannels:n,bitrate:o};try{const e=new AudioEncoder({output:e=>{const t=u._malloc(e.byteLength),r=u.HEAPU8.subarray(t,t+e.byteLength);e.copyTo(r),u.emscripten_ubq_codec_onOutputEncodedAudioChunk(s,t,e.byteLength,i),u._free(t)},error:e=>console.error(e)});e.configure(c),u.emscripten_ubq_codec_audioEncoders.set(s,{audioEncoder:e,audioEncoderConfig:c,frameIndex:0})}catch(e){return e+=' Requested codec: "'+a+'"',e+="; sample rate: "+r,e+="; channels: "+n,e+="; bit rate: "+o,u.emscripten_ubq_codec_createNativeResult({error:e})}return u.emscripten_ubq_codec_createNativeResult({handle:s})},bb:function(e,t,r,n,o,i,a){const s=u.UTF8ToString(e,e+t),c=u.HEAPU8.subarray(o,o+i),l=u.emscripten_ubq_codec_videoDecoderNextHandle++,d={codec:s,codedWidth:r,codedHeight:n,description:c,optimizeForLatency:!0};try{const e=u.emscripten_ubq_codec_createVideoDecoder(l,a);VideoDecoder.isConfigSupported(d).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(d),u.emscripten_ubq_codec_videoDecoders.set(l,{videoDecoder:e,decoderConfig:d,codecServicePtr:a})}catch(e){return u.emscripten_ubq_codec_createNativeResult({error:e})}return u.emscripten_ubq_codec_createNativeResult({handle:l})},Xa:function(e,t,r,n,o,i){const a=u.UTF8ToString(e,e+t),s=u.emscripten_ubq_codec_videoEncoderNextHandle++,c=u.specialHTMLTargets["!canvas"];c.width=r,c.height=n;const l={codec:a,width:r,height:n,avc:{format:"annexb"},framerate:o};try{const e=new VideoEncoder({output:e=>{const t=u._malloc(e.byteLength),r=u.HEAPU8.subarray(t,t+e.byteLength);e.copyTo(r),u.emscripten_ubq_codec_onOutputEncodedVideoChunk(s,t,e.byteLength,i),u._free(t)},error:e=>console.error(e)});VideoEncoder.isConfigSupported(l).then((t=>{e.configUnsupported=!t}),(()=>{e.configUnsupported=!0})),e.configure(l),u.emscripten_ubq_codec_videoEncoders.set(s,{videoEncoder:e,encoderConfig:l,groupOfPictures:150,frameIndex:0})}catch(e){return e+=' Requested codec: "'+a+'"',e+="; resolution: "+r+"x"+n,u.emscripten_ubq_codec_createNativeResult({error:e})}return u.emscripten_ubq_codec_createNativeResult({handle:s})},Pa:function(e,t,r,n,o,i){const a=u.emscripten_ubq_codec_audioDecoders.get(e);if(a.audioDecoder.unexpectedError)return u.emscripten_ubq_codec_createNativeResult({code:2,error:a.audioDecoder.unexpectedError});"closed"===a.audioDecoder.state&&(a.audioDecoder=u.emscripten_ubq_codec_createAudioDecoder(a.leftBufferPtr,a.rightBufferPtr,a.bufferLength),a.audioDecoder.configure(a.decoderConfig));const s=a.audioDecoder,c=u.HEAPU8.subarray(o,o+i),l=new EncodedAudioChunk({type:t?"key":"delta",timestamp:r,duration:n,data:c});try{s.decode(l)}catch(e){return s.configUnsupported?u.emscripten_ubq_codec_createNativeResult({code:2,error:e}):u.emscripten_ubq_codec_createNativeResult({code:1,error:e})}return u.emscripten_ubq_codec_createNativeResult({code:0})},Qa:function(e,t,r,n,o,i){const a=u.emscripten_ubq_codec_videoDecoders.get(e);if(a.videoDecoder.unexpectedError)return u.emscripten_ubq_codec_createNativeResult({code:2,error:a.videoDecoder.unexpectedError});if("closed"===a.videoDecoder.state){const t=a.videoDecoder.textures;return a.videoDecoder=u.emscripten_ubq_codec_createVideoDecoder(e,a.codecServicePtr),a.videoDecoder.textures=t,a.videoDecoder.configure(a.decoderConfig),u.emscripten_ubq_codec_createNativeResult({code:1,error:"VideoDecoder was closed"})}const s=a.videoDecoder,c=u.HEAPU8.subarray(o,o+i),l=new EncodedVideoChunk({type:t?"key":"delta",timestamp:r,duration:n,data:c});try{s.decode(l)}catch(e){return s.configUnsupported?u.emscripten_ubq_codec_createNativeResult({code:2,error:e}):u.emscripten_ubq_codec_createNativeResult({code:1,error:e})}return u.emscripten_ubq_codec_createNativeResult({code:0})},V:function(e){if(u.emscripten_ubq_codec_audioDecoders.has(e)){const t=u.emscripten_ubq_codec_audioDecoders.get(e);"closed"!==t.audioDecoder.state&&t.audioDecoder.close(),u.emscripten_ubq_codec_audioDecoders.delete(e)}},qa:function(e){const t=u.emscripten_ubq_codec_audioEncoders.get(e);"closed"!==t.audioEncoder.state&&t.audioEncoder.close(),u.emscripten_ubq_codec_audioEncoders.delete(e)},ta:function(e){if(u.emscripten_ubq_codec_videoDecoders.has(e)){const t=u.emscripten_ubq_codec_videoDecoders.get(e);"closed"!==t.videoDecoder.state&&t.videoDecoder.close(),u.emscripten_ubq_codec_videoDecoders.delete(e)}},ra:function(e){const t=u.emscripten_ubq_codec_videoEncoders.get(e);"closed"!==t.videoEncoder.state&&t.videoEncoder.close(),u.emscripten_ubq_codec_videoEncoders.delete(e)},Ta:function(e,t,r){const n=1e6,o=u.emscripten_ubq_codec_audioEncoders.get(e),i=o.audioEncoderConfig.sampleRate,a=o.audioEncoderConfig.numberOfChannels,s=r/a,c=Math.round(n*(o.frameIndex*s/i)),l=Math.round(n*(s/i)),d=u.HEAPF32.subarray(t/4,t/4+r),p=new AudioData({format:"f32",sampleRate:i,numberOfFrames:s,numberOfChannels:a,duration:l,timestamp:c,data:d});o.audioEncoder.encode(p),o.frameIndex++,p.close()},Wa:function(e,t,r){const n=1e6,o=u.emscripten_ubq_codec_videoEncoders.get(e),i=Math.round(n*(o.frameIndex/o.encoderConfig.framerate)),a=o.frameIndex%o.groupOfPictures==0,s=Math.round(n/o.encoderConfig.framerate),c=u.specialHTMLTargets["!canvas"],l=new VideoFrame(c,{timestamp:i,duration:s});o.videoEncoder.encode(l,{keyFrame:a}),l.close(),o.frameIndex++},Sa:async function(e,t){const r=u.emscripten_ubq_codec_audioEncoders.get(e);await r.audioEncoder.flush(),u.emscripten_ubq_codec_onFinalizedAudioEncoding(e,t)},Va:async function(e,t){const r=u.emscripten_ubq_codec_videoEncoders.get(e);await r.videoEncoder.flush(),u.emscripten_ubq_codec_onFinalizedVideoEncoding(e,t)},Za:async function(e,t){const r=u.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder;r.flushing=!0;try{await r.flush()}catch{}r.flushing=!1,r.writtenFrames=t},Y:async function(e,t,r){const n=u.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder;n.shouldDropFrames=r,n.flushing=!0;try{await n.flush()}catch{}n.flushing=!1,n.shouldDropFrames=!1,n.decodedFrames=t},pa:function(e){return u.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.decodeQueueSize},sa:function(e){return u.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.decodedFrames},X:function(e){return u.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.writtenFrames},Ya:function(e){return u.emscripten_ubq_codec_audioDecoders.get(e).audioDecoder.flushing},ab:function(e){return u.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.flushing},Z:function(){return"undefined"!=typeof VideoFrame&&"undefined"!=typeof VideoDecoder&&"undefined"!=typeof VideoEncoder&&"undefined"!=typeof AudioDecoder&&"undefined"!=typeof AudioEncoder},$a:function(e,t){u.emscripten_ubq_codec_videoDecoders.get(e).videoDecoder.requestedFrame=t},Ra:function(e,t,r){const n=u.emscripten_ubq_codec_videoDecoders.get(e),o=u.HEAPU32.subarray(t/4,t/4+r);n.videoDecoder.textures=[];for(let e=0;e<r;e++)n.videoDecoder.textures[e]=gr.textures[o[e]]},ue:function(e){const t=u.emscripten_ubq_asyncFetchManager.getProcess(e);return!!(null==t?void 0:t.allocate())},la:function(){u.emscripten_ubq_asyncFetchManager.clear()},ka:function(e,t,r,n){return u.emscripten_ubq_asyncFetchManager.createHeader(e,t,r,n)},xe:function(e){u.emscripten_ubq_asyncFetchManager.deleteHeader(e)},ye:function(e,t,r,n,o,i,a,s,c){return u.emscripten_ubq_asyncFetchManager.fetch(e,t,r,n,o,i,a,s,c).handle},aa:function(e){return u.emscripten_ubq_asyncFetchManager.deleteProcess(e)},we:function(e){var t,r;return null!==(r=null===(t=u.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.receivedLength)&&void 0!==r?r:0},te:function(e){const t=u.emscripten_ubq_asyncFetchManager.getProcess(e);return(null==t?void 0:t.isAllocated())?t.resultAddress:-1},se:function(e){const t=u.emscripten_ubq_asyncFetchManager.getProcess(e);return(null==t?void 0:t.isAllocated())?t.resultLength:-1},ja:function(e){var t,r;return null!==(r=null===(t=u.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.state)&&void 0!==r?r:-1},ve:function(e){var t,r;return null!==(r=null===(t=u.emscripten_ubq_asyncFetchManager.getProcess(e))||void 0===t?void 0:t.totalBytes)&&void 0!==r?r:0},db:function(){return!!u.emscripten_ubq_settings_forceWebGL1},ua:cu,_:e=>{gr.currentContext==e&&(gr.currentContext=0),gr.deleteContext(e)},gb:e=>(e=>{var t=e.getExtension("OES_vertex_array_object");if(t)return e.createVertexArray=()=>t.createVertexArrayOES(),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.isVertexArray=e=>t.isVertexArrayOES(e),1})(gr.contexts[e].GLctx),fb:e=>(e=>{var t=e.getExtension("WEBGL_draw_buffers");if(t)return e.drawBuffers=(e,r)=>t.drawBuffersWEBGL(e,r),1})(gr.contexts[e].GLctx),eb:e=>(e=>!!(e.multiDrawWebgl=e.getExtension("WEBGL_multi_draw")))(gr.contexts[e].GLctx),ca:(e,t)=>{var r=gr.getContext(e),n=xe(t);return n.startsWith("GL_")&&(n=n.substr(3)),!!r.GLctx.getExtension(n)},lb:e=>gr.makeContextCurrent(e)?0:-5,vb:(e,t)=>{var r=0;return du().forEach(((n,o)=>{var i=t+r;L[e+4*o>>2]=i,((e,t)=>{for(var r=0;r<e.length;++r)T[t++>>0]=e.charCodeAt(r);T[t>>0]=0})(n,i),r+=n.length+1})),0},wb:(e,t)=>{var r=du();L[e>>2]=r.length;var n=0;return r.forEach((e=>n+=e.length+1)),L[t>>2]=n,0},Be:dr,ea:function(e){try{var t=ke.getStreamFromFD(e);return Ce.close(t),0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},ob:function(e,t,r,n,o){n=tr(n);try{if(isNaN(n))return 61;var i=ke.getStreamFromFD(e),a=pu(i,t,r,n);return L[o>>2]=a,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},za:function(e,t,r,n){try{var o=ke.getStreamFromFD(e),i=pu(o,t,r);return L[n>>2]=i,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},ub:function(e,t,r,n){t=tr(t);try{if(isNaN(t))return 61;var o=ke.getStreamFromFD(e);return Ce.llseek(o,t,r),B[n>>3]=BigInt(o.position),o.getdents&&0===t&&0===r&&(o.getdents=null),0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},ya:function(e,t,r,n){try{var o=((e,t,r,n)=>{for(var o=0,i=0;i<r;i++){var a=L[t>>2],s=L[t+4>>2];t+=8;var u=Ce.write(e,T,a,s,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(ke.getStreamFromFD(e),t,r);return L[n>>2]=o,0}catch(e){if(void 0===Ce||"ErrnoError"!==e.name)throw e;return e.errno}},re:function(e){var t=xe(e),r=localStorage.getItem(t);return null==r?null:ar(r)},oe:function(){return"undefined"!=typeof window?ar(window.location.hostname):ar("")},hb:(e,t)=>(de(A.subarray(e,e+t)),0),y:function(e,t,r){var n=ju();try{return Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Iu(1,0)}},L:function(e,t){var r=ju();try{return Ct(e)(t)}catch(e){if(Uu(r),e!==e+0)throw e;Iu(1,0)}},G:function(e,t,r){var n=ju();try{return Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Iu(1,0)}},l:function(e,t,r,n){var o=ju();try{return Ct(e)(t,r,n)}catch(e){if(Uu(o),e!==e+0)throw e;Iu(1,0)}},nh:function(e){var t=ju();try{return Ct(e)()}catch(e){if(Uu(t),e!==e+0)throw e;Iu(1,0)}},na:function(e,t,r){var n=ju();try{return Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Iu(1,0)}},q:function(e,t){var r=ju();try{return Ct(e)(t)}catch(e){if(Uu(r),e!==e+0)throw e;Iu(1,0)}},U:function(e,t,r,n,o,i,a,s,u,c,l,d,p,h,f,m){var g=ju();try{return Ct(e)(t,r,n,o,i,a,s,u,c,l,d,p,h,f,m)}catch(e){if(Uu(g),e!==e+0)throw e;Iu(1,0)}},r:function(e,t,r){var n=ju();try{return Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Iu(1,0)}},t:function(e,t,r,n){var o=ju();try{return Ct(e)(t,r,n)}catch(e){if(Uu(o),e!==e+0)throw e;Iu(1,0)}},T:function(e,t,r,n,o){var i=ju();try{return Ct(e)(t,r,n,o)}catch(e){if(Uu(i),e!==e+0)throw e;Iu(1,0)}},Fe:function(e,t,r,n,o,i){var a=ju();try{return Ct(e)(t,r,n,o,i)}catch(e){if(Uu(a),e!==e+0)throw e;Iu(1,0)}},Ja:function(e,t,r,n,o,i,a){var s=ju();try{return Ct(e)(t,r,n,o,i,a)}catch(e){if(Uu(s),e!==e+0)throw e;Iu(1,0)}},Ia:function(e,t,r,n,o,i,a,s,u,c){var l=ju();try{return Ct(e)(t,r,n,o,i,a,s,u,c)}catch(e){if(Uu(l),e!==e+0)throw e;Iu(1,0)}},P:function(e){var t=ju();try{Ct(e)()}catch(e){if(Uu(t),e!==e+0)throw e;Iu(1,0)}},u:function(e,t){var r=ju();try{Ct(e)(t)}catch(e){if(Uu(r),e!==e+0)throw e;Iu(1,0)}},B:function(e,t,r,n){var o=ju();try{Ct(e)(t,r,n)}catch(e){if(Uu(o),e!==e+0)throw e;Iu(1,0)}},F:function(e,t,r){var n=ju();try{Ct(e)(t,r)}catch(e){if(Uu(n),e!==e+0)throw e;Iu(1,0)}},p:function(e,t,r,n){var o=ju();try{Ct(e)(t,r,n)}catch(e){if(Uu(o),e!==e+0)throw e;Iu(1,0)}},D:function(e,t,r,n,o){var i=ju();try{Ct(e)(t,r,n,o)}catch(e){if(Uu(i),e!==e+0)throw e;Iu(1,0)}},Ee:function(e,t,r,n,o,i){var a=ju();try{Ct(e)(t,r,n,o,i)}catch(e){if(Uu(a),e!==e+0)throw e;Iu(1,0)}},Ce:function(e,t,r,n,o,i,a){var s=ju();try{Ct(e)(t,r,n,o,i,a)}catch(e){if(Uu(s),e!==e+0)throw e;Iu(1,0)}},mh:function(e,t,r,n,o,i,a,s){var u=ju();try{Ct(e)(t,r,n,o,i,a,s)}catch(e){if(Uu(u),e!==e+0)throw e;Iu(1,0)}},De:function(e,t,r,n,o,i,a,s,u,c){var l=ju();try{Ct(e)(t,r,n,o,i,a,s,u,c)}catch(e){if(Uu(l),e!==e+0)throw e;Iu(1,0)}},ha:function(){return"undefined"!=typeof localStorage},oa:function(e,t){const r=Ot.toValue(t),n=u.ctx;n.bindTexture(n.TEXTURE_2D,gr.textures[e]),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r)},a:S,Ha:function(e,t){var r=xe(e),n=xe(t);localStorage.setItem(r,n)},ib:(e,t,r,n,o)=>gu(e,t,r,n)},Pu=function(){var e,t,r,o,i={a:Au};function a(e,t){var r;return Pu=e.exports,wt=Pu.sh,r=Pu.oh,N.unshift(r),X(),Pu}if(Y(),u.instantiateWasm)try{return u.instantiateWasm(i,a)}catch(e){x(`Module.instantiateWasm callback failed with error: ${e}`),n(e)}return(e=E,t=K,r=i,o=function(e){a(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||J(t)||b||"function"!=typeof fetch?re(t,r,o):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(o,(function(e){return x(`wasm streaming compile failed: ${e}`),x("falling back to ArrayBuffer instantiation"),re(t,r,o)}))))).catch(n),{}}(),qu=u._malloc=e=>(qu=u._malloc=Pu.ph)(e),Fu=u._main=(e,t)=>(Fu=u._main=Pu.qh)(e,t),Lu=u._free=e=>(Lu=u._free=Pu.rh)(e),Du=(u._ma_malloc_emscripten=(e,t)=>(u._ma_malloc_emscripten=Pu.th)(e,t),u._ma_free_emscripten=(e,t)=>(u._ma_free_emscripten=Pu.uh)(e,t),u._ma_device_process_pcm_frames_capture__webaudio=(e,t,r)=>(Du=u._ma_device_process_pcm_frames_capture__webaudio=Pu.vh)(e,t,r)),Bu=u._ma_device_process_pcm_frames_playback__webaudio=(e,t,r)=>(Bu=u._ma_device_process_pcm_frames_playback__webaudio=Pu.wh)(e,t,r),Ru=e=>(Ru=Pu.xh)(e),Mu=e=>(Mu=Pu.yh)(e),Ou=(e,t)=>(Ou=Pu.zh)(e,t),Iu=(e,t)=>(Iu=Pu.Ah)(e,t),ju=()=>(ju=Pu.Bh)(),Uu=e=>(Uu=Pu.Ch)(e),$u=e=>($u=Pu.Dh)(e),Nu=e=>(Nu=Pu.Eh)(e),Hu=e=>(Hu=Pu.Fh)(e),Vu=(e,t,r)=>(Vu=Pu.Gh)(e,t,r),Wu=e=>(Wu=Pu.Hh)(e);function zu(e=h){function r(){Tu||(Tu=!0,u.calledRun=!0,O||(u.noFSInit||Ce.init.initialized||Ce.init(),Ce.ignorePermissions=!1,ve.init(),ie(N),ie(H),t(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),Gu&&function(e=[]){var t=Fu;e.unshift(f);var r=e.length,n=$u(4*(r+1)),o=n;e.forEach((e=>{L[o>>2]=yu(e),o+=4})),L[o>>2]=0;try{var i=t(r,n);return lr(i,!0),i}catch(e){return ur(e)}}(e),function(){if(u.postRun)for("function"==typeof u.postRun&&(u.postRun=[u.postRun]);u.postRun.length;)e=u.postRun.shift(),V.unshift(e);var e;ie(V)}()))}W>0||(function(){if(u.preRun)for("function"==typeof u.preRun&&(u.preRun=[u.preRun]);u.preRun.length;)e=u.preRun.shift(),$.unshift(e);var e;ie($)}(),W>0||(u.setStatus?(u.setStatus("Running..."),setTimeout((function(){setTimeout((function(){u.setStatus("")}),1),r()}),1)):r()))}if(u.___start_em_js=2406931,u.___stop_em_js=2407766,u.addRunDependency=Y,u.removeRunDependency=X,u.FS_createPath=Ce.createPath,u.FS_createLazyFile=Ce.createLazyFile,u.FS_createDevice=Ce.createDevice,u.ccall=(e,t,r,n,o)=>{var i={string:e=>{var t=0;return null!=e&&0!==e&&(t=yu(e)),t},array:e=>{var t=$u(e.length);return mu(e,t),t}},a=(e=>u["_"+e])(e),s=[],c=0;if(n)for(var l=0;l<n.length;l++){var d=i[r[l]];d?(0===c&&(c=ju()),s[l]=d(n[l])):s[l]=n[l]}var p,h=a.apply(null,s);return p=h,0!==c&&Uu(c),h=function(e){return"string"===t?xe(e):"boolean"===t?Boolean(e):e}(p),h},u.getValue=function(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return T[e>>0];case"i16":return P[e>>1];case"i32":return F[e>>2];case"i64":return B[e>>3];case"float":return D[e>>2];case"double":return M[e>>3];case"*":return L[e>>2];default:Z(`invalid type for getValue: ${t}`)}},u.UTF8ToString=xe,u.specialHTMLTargets=su,u.FS_createPreloadedFile=Ce.createPreloadedFile,u.FS_createDataFile=Ce.createDataFile,u.FS_unlink=Ce.unlink,G=function e(){Tu||zu(),Tu||(G=e)},u.preInit)for("function"==typeof u.preInit&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();var Gu=!0;return u.noInitialRun&&(Gu=!1),zu(),e.ready});"object"==typeof e&&"object"==typeof t?t.exports=n:"function"==typeof define&&define.amd&&define([],(()=>n))}}),dt=s(A()),pt=s(tt()),ht=Symbol("PROXY");Symbol("RESTORE");function ft(e,t){Object.defineProperty(e[t],ht,{value:{type:"getter"},writable:!1})}function mt(e,t){Object.defineProperty(e[t],ht,{value:{type:"setter"},writable:!1})}var gt,yt={};(e=>{let t;var r;(r=t=e.ColorSpace||(e.ColorSpace={}))[r.sRGB=0]="sRGB",r[r.CMYK=1]="CMYK",r[r.SpotColor=2]="SpotColor",e.toColor=function(e){switch(e.colorSpace){case 0:return{r:e.components.x,g:e.components.y,b:e.components.z,a:e.components.w};case 2:return{name:e.spotColorName,tint:e.tint,externalReference:e.externalReference};case 1:return{c:e.components.x,m:e.components.y,y:e.components.z,k:e.components.w,tint:e.tint};default:throw new Error("Unknown color space!")}},e.fromColor=function(e){if(function(e){return"r"in e&&"a"in e&&void 0!==e.r&&void 0!==e.a}(e))return{colorSpace:0,components:{x:e.r,y:e.g,z:e.b,w:e.a},spotColorName:"",tint:1,externalReference:""};if(function(e){return"c"in e&&"m"in e&&"y"in e&&"k"in e&&void 0!==e.c&&void 0!==e.m&&void 0!==e.y&&void 0!==e.k}(e))return{colorSpace:1,components:{x:e.c,y:e.m,z:e.y,w:e.k},spotColorName:"",tint:e.tint,externalReference:""};if(function(e){return"name"in e&&void 0!==e.name}(e))return{colorSpace:2,components:{x:0,y:0,z:0,w:0},spotColorName:e.name,tint:e.tint,externalReference:e.externalReference};throw new Error("Unknown color space!")}})(gt||(gt={}));var bt=class{ubq;constructor(e){this.ubq=e}useInternalAPI(e){const t=this.ubq.getInternalAPI();try{return e(t)}finally{t.delete()}}setValue(e,t,r,n){return this.useInternalAPI((o=>vt(o.setValue(e,t,r,n))))}getValue(e,t,r){return this.useInternalAPI((n=>vt(n.getValue(e,t,r))))}async execute(e,t){return new Promise(((r,n)=>{this.useInternalAPI((o=>o.ubqExecute(e,t,(e=>{try{const t=vt(e);r(t)}catch(e){n(e)}})))).delete()}))}};function vt(e){if(e.isValid()){const t=e.value();return e.delete(),t}{const t=e.error(),r=t.publicMessage();throw t.delete(),e.delete(),new Error(r)}}function wt(e){return new Promise(((t,r)=>{e((e=>{try{const r=vt(e);t(r)}catch(e){r(e)}}))}))}u([mt],bt.prototype,"setValue",1),u([ft],bt.prototype,"getValue",1);var _t,Et,St,Ct,xt,kt,Tt,At=(e,t=!0)=>{const r=[];for(let t=0;t<e.size();t+=1)r.push(e.get(t));return t&&e.delete(),r},Pt=new WeakMap,qt={assets:[],total:0,currentPage:0,nextPage:void 0},AssetAPI=class{constructor(e){p(this,Et),p(this,Ct),p(this,kt),p(this,_t,void 0),c(this,"onAssetSourceAdded",(e=>{const t=d(this,_t).subscribeToAssetSourceAdded(e);return()=>{d(this,_t).isDeleted()||vt(d(this,_t).unsubscribe(t))}})),c(this,"onAssetSourceRemoved",(e=>{const t=d(this,_t).subscribeToAssetSourceRemoved(e);return()=>{d(this,_t).isDeleted()||vt(d(this,_t).unsubscribe(t))}})),h(this,_t,e)}addSource(e){const t=e.getSupportedMimeTypes?.bind(e),r=e.getGroups?.bind(e),n=e.applyAsset?.bind(e),o=e.applyAssetToBlock?.bind(e),i=e.addAsset?.bind(e),a=e.removeAsset?.bind(e),s=e.credits,u=e.license;vt(d(this,_t).addAssetSource(e.id,(async(t,r)=>{try{const n={...t,tags:At(t.tags),groups:At(t.groups),excludeGroups:At(t.excludeGroups)},o=await e.findAssets(n);if(o){const t={...o,assets:o.assets.map((t=>Ft(t,e.id)))};r.invoke(t)}else r.invoke(qt)}catch(e){r.invoke(e.message??"Unknown error in user-defined `findAssets`")}}),r?async e=>{try{const t=await r();e.invoke(t)}catch(t){e.invoke(t.message??"Unknown error in user-defined `getGroups`")}}:null,s?()=>({name:s.name,url:s.url??""}):null,u?()=>({name:u.name,url:u.url??""}):null,t?()=>t()??[]:null,n?async(e,t)=>{try{const r=await n(f(this,Et,St).call(this,e));t.invoke(r)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,o?async(e,t,r)=>{try{await o(f(this,Et,St).call(this,e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetToBlock`")}}:null,i?async e=>{i(e)}:null,a?async e=>{a(e)}:null)),f(this,Ct,xt).call(this,e.id,e)}addLocalSource(e,t,r,n){vt(d(this,_t).addLocalAssetSource(e,t??[],r?async(e,t)=>{try{const n=await r(f(this,Et,St).call(this,e));t.invoke(n)}catch(e){t.invoke(e.message??"Unknown error in user-defined `applyAsset`")}}:null,n?async(e,t,r)=>{try{await n(f(this,Et,St).call(this,e),t),r.invoke({})}catch(e){r.invoke(e.message??"Unknown error in user-defined `applyAssetToBlock`")}}:null))}removeSource(e){vt(d(this,_t).removeAssetSource(e)),f(this,kt,Tt).call(this,e)}findAllSources(){return At(d(this,_t).findAllAssetSources())}findAssets(e,t){return new Promise(((r,n)=>{let o=t?.tags??[];Array.isArray(o)||(o=[o]);const i={perPage:t?.perPage??0,page:t?.page??0,query:t?.query??"",tags:o,groups:t?.groups??[],excludeGroups:t?.excludeGroups??[],locale:t?.locale??""};d(this,_t).findAssetSourceAssets(e,i,(e=>{try{const t=vt(e);r({...t,nextPage:-1===t.nextPage?void 0:t.nextPage})}catch(e){n(e)}}))}))}async getGroups(e){return wt((t=>d(this,_t).getAssetSourceGroups(e,t))).then((e=>At(e)))}getSupportedMimeTypes(e){return At(vt(d(this,_t).getAssetSourceSupportedMimeTypes(e)))}getCredits(e){const t=vt(d(this,_t).getAssetSourceCredits(e));if(t.name||t.url)return t.url?t:{name:t.name,url:void 0}}getLicense(e){const t=vt(d(this,_t).getAssetSourceLicense(e));if(t.name||t.url)return t.url?t:{name:t.name,url:void 0}}canManageAssets(e){return!!Pt.get(d(this,_t))?.get(e)?.canManageAssets}addAssetToSource(e,t){vt(d(this,_t).addAssetToSource(e,t))}removeAssetFromSource(e,t){vt(d(this,_t).removeAssetFromSource(e,t))}async apply(e,t){return new Promise(((r,n)=>{d(this,_t).applyAssetSourceAsset(e,Ft(t,e),(e=>{try{const t=vt(e);d(this,_t).isValid(t)?r(t):r(void 0)}catch(e){n(e)}}))}))}async applyToBlock(e,t,r){return wt((n=>d(this,_t).applyAssetSourceAssetToBlock(e,Ft(t,e),r,n)))}async defaultApplyAsset(e){return new Promise(((t,r)=>{d(this,_t).defaultApplyAsset(Ft(e,""),(e=>{try{const r=vt(e);d(this,_t).isValid(r)?t(r):t(void 0)}catch(e){r(e)}}))}))}async defaultApplyAssetToBlock(e,t){return wt((r=>d(this,_t).defaultApplyAssetToBlock(Ft(e,""),t,r)))}dispose(){Pt.delete(d(this,_t))}};function Ft(e,t){return"context"in e&&e.context.sourceId===t?e:{...e,context:{sourceId:t}}}_t=new WeakMap,Et=new WeakSet,St=function(e){const t={...e};return 0===t.groups?.length&&delete t.groups,t.locale||delete t.locale,t.label||delete t.label,0===t.tags?.length&&delete t.tags,t.credits?.name||t.credits?.url?t.credits.url||delete t.credits.url:delete t.credits,t.license?.name||t.license?.url?t.license.url||delete t.license.url:delete t.license,t.utm?.source||t.utm?.medium?(t.utm.source||delete t.utm.source,t.utm.medium||delete t.utm.medium):delete t.utm,t},Ct=new WeakSet,xt=function(e,t){Pt.has(d(this,_t))||Pt.set(d(this,_t),new Map),t.canManageAssets&&console.warn(`\nDEPRECATION WARNING:\n\n'canManageAssets' flag was found for asset source with the id '${e}'.\n\nThis flag is deprecated and will be removed in the next version. If you have used it to control if an upload buttons is rendered in the asset library, use the 'canAdd' options on an asset library entry. See documentation here: https://img.ly/docs/cesdk/ui/guides/customize-asset-library/`),Pt.get(d(this,_t)).set(e,{canManageAssets:t.canManageAssets})},kt=new WeakSet,Tt=function(e){Pt.get(d(this,_t))?.delete(e)};var Lt=class extends TypeError{constructor(e,t){let r;const{message:n,...o}=e,{path:i}=e;super(0===i.length?n:"At path: "+i.join(".")+" -- "+n),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>{var n;return null!=(n=r)?n:r=[e,...t()]}}};function Dt(e){return"object"==typeof e&&null!=e}function Bt(e){return"string"==typeof e?JSON.stringify(e):""+e}function Rt(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:i}=t,{type:a}=r,{refinement:s,message:u="Expected a value of type `"+a+"`"+(s?" with refinement `"+s+"`":"")+", but received: `"+Bt(n)+"`"}=e;return{value:n,type:a,refinement:s,key:o[o.length-1],path:o,branch:i,...e,message:u}}function*Mt(e,t,r,n){var o;Dt(o=e)&&"function"==typeof o[Symbol.iterator]||(e=[e]);for(const o of e){const e=Rt(o,t,r,n);e&&(yield e)}}function*Ot(e,t,r={}){const{path:n=[],branch:o=[e],coerce:i=!1,mask:a=!1}=r,s={path:n,branch:o};if(i&&(e=t.coercer(e,s),a&&"type"!==t.type&&Dt(t.schema)&&Dt(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let u=!0;for(const r of t.validator(e,s))u=!1,yield[r,void 0];for(let[r,c,l]of t.entries(e,s)){const t=Ot(c,l,{path:void 0===r?n:[...n,r],branch:void 0===r?o:[...o,c],coerce:i,mask:a});for(const n of t)n[0]?(u=!1,yield[n[0],void 0]):i&&(c=n[1],void 0===r?e=c:e instanceof Map?e.set(r,c):e instanceof Set?e.add(c):Dt(e)&&(e[r]=c))}if(u)for(const r of t.refiner(e,s))u=!1,yield[r,void 0];u&&(yield[void 0,e])}var It=class{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:r,validator:n,refiner:o,coercer:i=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=r,this.entries=a,this.coercer=i,this.validator=n?(e,t)=>Mt(n(e,t),t,this,e):()=>[],this.refiner=o?(e,t)=>Mt(o(e,t),t,this,e):()=>[]}assert(e){return function(e,t){const r=jt(e,t);if(r[0])throw r[0]}(e,this)}create(e){return function(e,t){const r=jt(e,t,{coerce:!0});if(r[0])throw r[0];return r[1]}(e,this)}is(e){return function(e,t){const r=jt(e,t);return!r[0]}(e,this)}mask(e){return function(e,t){const r=jt(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}(e,this)}validate(e,t={}){return jt(e,this,t)}};function jt(e,t,r={}){const n=Ot(e,t,r),o=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(o[0]){return[new Lt(o[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function Ut(e,t){return new It({type:e,schema:null,validator:t})}function $t(e){return new It({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||"Expected an array value, but received: "+Bt(e)})}function Nt(){return Ut("boolean",(e=>"boolean"==typeof e))}function Ht(){return Ut("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||"Expected an integer, but received: "+Bt(e)))}function Vt(){return Ut("number",(e=>"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+Bt(e)))}function Wt(e){const t=e?Object.keys(e):[],r=Ut("never",(()=>!1));return new It({type:"object",schema:e||null,*entries(n){if(e&&Dt(n)){const o=new Set(Object.keys(n));for(const r of t)o.delete(r),yield[r,n[r],e[r]];for(const e of o)yield[e,n[e],r]}},validator:e=>Dt(e)||"Expected an object, but received: "+Bt(e),coercer:e=>Dt(e)?{...e}:e})}function zt(){return Ut("string",(e=>"string"==typeof e||"Expected a string, but received: "+Bt(e)))}function Gt(e,t,r={}){const{exclusive:n}=r;return Zt(e,"max",(r=>n?r<t:r<=t||"Expected a "+e.type+" less than "+(n?"":"or equal to ")+t+" but received `"+r+"`"))}function Yt(e,t,r={}){const{exclusive:n}=r;return Zt(e,"min",(r=>n?r>t:r>=t||"Expected a "+e.type+" greater than "+(n?"":"or equal to ")+t+" but received `"+r+"`"))}function Xt(e){return Zt(e,"nonempty",(t=>{const r=function(e){return e instanceof Map||e instanceof Set?e.size:e.length}(t);return r>0||"Expected a nonempty "+e.type+" but received an empty one"}))}function Zt(e,t,r){return new It({...e,*refiner(n,o){yield*e.refiner(n,o);const i=Mt(r(n,o),o,e,n);for(const e of i)yield{...e,refinement:t}}})}function Kt(e,t,r){const[n]=jt(t,r);if(n)throw n.message=`Error in argument '${e}': ${n.message}`,n}function Qt(){const e=/image\/(png|jpeg|webp|x-tga)|video\/(mp4|quicktime)|application\/octet-stream|application\/pdf/;return Ut("MimeType",(t=>!("string"!=typeof t||!e.test(t))||{message:`expected one of "image/png", "image/jpeg", "image/webp", "image/x-tga", "video/mp4", "video/quicktime", "application/pdf" or "application/octet-stream", but got "${t}"`}))}function Jt(){const e=["Free","VerticalStack","HorizontalStack","DepthStack"];return Ut("SceneLayout",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}var er=(e=>(e.Png="image/png",e.Jpeg="image/jpeg",e.WebP="image/webp",e.Tga="image/x-tga",e.Mp4="video/mp4",e.QuickTime="video/quicktime",e.Binary="application/octet-stream",e.Pdf="application/pdf",e.Zip="application/zip",e))(er||{}),tr=er,rr="undefined"!=typeof Blob?Blob:(()=>{try{return ot().Blob}catch(e){return function(){throw new Error("Could not find Blob constructor and failed to require('buffer').Blob")}}})(),BlockAPI=class{#e;constructor(e){this.#e=e}async export(e,t=tr.Png,r={}){Kt("handle",e,Vt()),Kt("mimeType",t,Qt()),Kt("options",r,Wt());const n=null!=r.targetWidth&&null!=r.targetHeight,o=r.jpegQuality??.9,i=r.webpQuality??1,a=r.pngCompressionLevel??5;return Kt("jpegQuality",o,Yt(Gt(Vt(),1),0,{exclusive:!0})),Kt("webpQuality",i,Yt(Gt(Vt(),1),0,{exclusive:!0})),Kt("pngCompressionLevel",a,Yt(Gt(Ht(),9),0)),null==r.targetWidth&&null==r.targetHeight||(Kt("targetWidth",r.targetWidth,Vt()),Kt("targetHeight",r.targetHeight,Vt())),new Promise(((s,u)=>{this.#e.exportToBuffer(e,t,(e=>{"error"in e?u(e.error):s(new rr([e],{type:t}))}),{pngCompressionLevel:a,jpegQuality:o,webpQuality:i,useTargetSize:n,targetWidth:r.targetWidth??0,targetHeight:r.targetHeight??0,exportPdfWithHighCompatibility:r.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:r.exportPdfWithUnderlayer??!1,underlayerSpotColorName:r.underlayerSpotColorName??"",underlayerOffset:r.underlayerOffset??0})}))}async exportWithColorMask(e,t=tr.Png,r,n,o,i={}){Kt("handle",e,Vt()),Kt("mimeType",t,Qt()),Kt("options",i,Wt());const a=null!=i.targetWidth&&null!=i.targetHeight,s=i.jpegQuality??.9,u=i.webpQuality??1,c=i.pngCompressionLevel??5;return Kt("jpegQuality",s,Yt(Gt(Vt(),1),0,{exclusive:!0})),Kt("webpQuality",u,Yt(Gt(Vt(),1),0,{exclusive:!0})),Kt("pngCompressionLevel",c,Yt(Gt(Ht(),9),0)),null==i.targetWidth&&null==i.targetHeight||(Kt("targetWidth",i.targetWidth,Vt()),Kt("targetHeight",i.targetHeight,Vt())),new Promise(((l,d)=>{this.#e.exportWithColorMaskToBuffer(e,t,r,n,o,((e,r)=>{if("error"in e)d(e.error);else if("error"in r)d(r.error);else{const n=new rr([e],{type:t}),o=new rr([r],{type:t});l([n,o])}}),{pngCompressionLevel:c,jpegQuality:s,webpQuality:u,useTargetSize:a,targetWidth:i.targetWidth??0,targetHeight:i.targetHeight??0,exportPdfWithHighCompatibility:i.exportPdfWithHighCompatibility??!0,exportPdfWithUnderlayer:i.exportPdfWithUnderlayer??!1,underlayerSpotColorName:i.underlayerSpotColorName??"",underlayerOffset:i.underlayerOffset??0})}))}async exportVideo(e,t=tr.Mp4,r,n){throw new Error("Method not implemented. An implementation is available on the BlockAPI at engine.block or cesdk.engine.block")}async loadFromString(e){return Kt("content",e,zt()),wt((t=>this.#e.loadBlocksFromString(e,t))).then((e=>At(e)))}async saveToString(e){return Kt("blocks",e,$t(Vt())),wt((t=>this.#e.saveBlocksToString(e,t)))}create(e){return Kt("type",e,zt()),vt(this.#e.create(e))}createFill(e){return Kt("type",e,zt()),vt(this.#e.createFill(e))}getType(e){return Kt("id",e,Ht()),vt(this.#e.getType(e))}getKind(e){return Kt("id",e,Ht()),vt(this.#e.getKind(e))}setKind(e,t){Kt("id",e,Ht()),vt(this.#e.setKind(e,t))}select(e){return Kt("id",e,Ht()),vt(this.#e.select(e))}setSelected(e,t){return Kt("id",e,Ht()),Kt("selected",t,Nt()),vt(this.#e.setSelected(e,t))}isSelected(e){return Kt("id",e,Ht()),vt(this.#e.isSelected(e))}findAllSelected(){return At(this.#e.findAllSelected())}onSelectionChanged=e=>{const t=this.#e.subscribeToSelectionChange(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};onClicked=e=>{const t=this.#e.subscribeToBlockClicked(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};isGroupable(e){return Kt("ids",e,$t(Vt())),vt(this.#e.isGroupable(e))}group(e){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.group(e))}ungroup(e){return Kt("id",e,Vt()),vt(this.#e.ungroup(e))}enterGroup(e){return Kt("id",e,Vt()),vt(this.#e.enterGroup(e))}exitGroup(e){return Kt("id",e,Vt()),vt(this.#e.exitGroup(e))}isCombinable(e){return Kt("ids",e,$t(Vt())),vt(this.#e.isCombinable(e))}combine(e,t){return Kt("ids",e,$t(Vt())),Kt("op",t,zt()),vt(this.#e.combine(e,t))}setName(e,t){return Kt("id",e,Ht()),Kt("name",t,zt()),vt(this.#e.setName(e,t))}getName(e){return Kt("id",e,Ht()),vt(this.#e.getName(e))}getUUID(e){return Kt("id",e,Ht()),vt(this.#e.getUUID(e))}findByName(e){Kt("name",e,zt());const t=this.#e.findByName(e);return At(t)}findByType(e){Kt("type",e,zt());const t=vt(this.#e.findByType(e));return At(t)}findByKind(e){Kt("kind",e,zt());const t=vt(this.#e.findByKind(e));return At(t)}findAll(){return At(this.#e.findAll())}findAllPlaceholders(){return At(this.#e.findAllPlaceholders())}createShape(e){return Kt("type",e,zt()),vt(this.#e.createShape(e))}hasShape(e){return Kt("id",e,Ht()),vt(this.#e.hasShape(e))}getShape(e){return Kt("id",e,Ht()),vt(this.#e.getShape(e))}setShape(e,t){return Kt("id",e,Ht()),Kt("shape",t,Ht()),vt(this.#e.setShape(e,t))}isVisible(e){return Kt("id",e,Ht()),vt(this.#e.isVisible(e))}setVisible(e,t){return Kt("id",e,Ht()),Kt("visible",t,Nt()),vt(this.#e.setVisible(e,t))}isClipped(e){return Kt("id",e,Ht()),vt(this.#e.isClipped(e))}setClipped(e,t){return Kt("id",e,Ht()),Kt("clipped",t,Nt()),vt(this.#e.setClipped(e,t))}isTransformLocked(e){return Kt("id",e,Ht()),vt(this.#e.isTransformLocked(e))}setTransformLocked(e,t){return Kt("id",e,Ht()),Kt("locked",t,Nt()),vt(this.#e.setTransformLocked(e,t))}getPositionX(e){return Kt("id",e,Ht()),vt(this.#e.getPositionX(e))}getPositionXMode(e){return Kt("id",e,Ht()),vt(this.#e.getPositionXMode(e))}getPositionY(e){return Kt("id",e,Ht()),vt(this.#e.getPositionY(e))}getPositionYMode(e){return Kt("id",e,Ht()),vt(this.#e.getPositionYMode(e))}setPositionX(e,t){return Kt("id",e,Ht()),Kt("value",t,Vt()),vt(this.#e.setPositionX(e,t))}setPositionXMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setPositionXMode(e,t))}setPositionY(e,t){return Kt("id",e,Ht()),Kt("value",t,Vt()),vt(this.#e.setPositionY(e,t))}setPositionYMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setPositionYMode(e,t))}setAlwaysOnTop(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setAlwaysOnTop(e,t))}setAlwaysOnBottom(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setAlwaysOnBottom(e,t))}isAlwaysOnTop(e){return Kt("id",e,Ht()),vt(this.#e.isAlwaysOnTop(e))}isAlwaysOnBottom(e){return Kt("id",e,Ht()),vt(this.#e.isAlwaysOnBottom(e))}bringToFront(e){return Kt("id",e,Vt()),vt(this.#e.bringToFront(e))}sendToBack(e){return Kt("id",e,Vt()),vt(this.#e.sendToBack(e))}bringForward(e){return Kt("id",e,Vt()),vt(this.#e.bringForward(e))}sendBackward(e){return Kt("id",e,Vt()),vt(this.#e.sendBackward(e))}getRotation(e){return Kt("id",e,Ht()),vt(this.#e.getRotation(e))}setRotation(e,t){return Kt("id",e,Ht()),Kt("radians",t,Vt()),vt(this.#e.setRotation(e,t))}getFlipHorizontal(e){return Kt("id",e,Ht()),vt(this.#e.getFlip(e)).horizontal}getFlipVertical(e){return Kt("id",e,Ht()),vt(this.#e.getFlip(e)).vertical}setFlipHorizontal(e,t){return Kt("id",e,Ht()),Kt("flip",t,Nt()),vt(this.#e.setFlipHorizontal(e,t))}setFlipVertical(e,t){return Kt("id",e,Ht()),Kt("flip",t,Nt()),vt(this.#e.setFlipVertical(e,t))}hasContentFillMode(e){return Kt("id",e,Ht()),vt(this.#e.hasContentFillMode(e))}getWidth(e){return Kt("id",e,Ht()),vt(this.#e.getWidth(e))}getWidthMode(e){return Kt("id",e,Ht()),vt(this.#e.getWidthMode(e))}getHeight(e){return Kt("id",e,Ht()),vt(this.#e.getHeight(e))}getHeightMode(e){return Kt("id",e,Ht()),vt(this.#e.getHeightMode(e))}setWidth(e,t){return Kt("id",e,Ht()),Kt("value",t,Vt()),vt(this.#e.setWidth(e,t))}setWidthMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setWidthMode(e,t))}setHeight(e,t){return Kt("id",e,Ht()),Kt("value",t,Vt()),vt(this.#e.setHeight(e,t))}setHeightMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setHeightMode(e,t))}getFrameX(e){return Kt("id",e,Ht()),vt(this.#e.getLastFrameX(e))}getFrameY(e){return Kt("id",e,Ht()),vt(this.#e.getLastFrameY(e))}getFrameWidth(e){return Kt("id",e,Ht()),vt(this.#e.getLastFrameWidth(e))}getFrameHeight(e){return Kt("id",e,Ht()),vt(this.#e.getLastFrameHeight(e))}setContentFillMode(e,t){return Kt("id",e,Ht()),vt(this.#e.setContentFillMode(e,t))}getContentFillMode(e){return Kt("id",e,Ht()),vt(this.#e.getContentFillMode(e))}duplicate(e){return Kt("id",e,Ht()),vt(this.#e.duplicate(e))}destroy(e){return Kt("id",e,Ht()),vt(this.#e.destroy(e))}isValid(e){return Kt("id",e,Ht()),this.#e.isValid(e)}getParent(e){return Kt("id",e,Ht()),vt(this.#e.hasParent(e))?vt(this.#e.getParent(e)):null}getChildren(e){Kt("id",e,Ht());const t=vt(this.#e.getChildren(e));return At(t)}insertChild(e,t,r){return Kt("parent",e,Vt()),Kt("child",t,Vt()),Kt("index",r,Yt(Vt(),0)),vt(this.#e.insertChild(e,t,r))}appendChild(e,t){return Kt("parent",e,Vt()),Kt("child",t,Vt()),vt(this.#e.appendChild(e,t))}referencesAnyVariables(e){return Kt("id",e,Ht()),vt(this.#e.referencesAnyVariables(e))}getGlobalBoundingBoxX(e){return Kt("id",e,Ht()),vt(this.#e.getGlobalBoundingBoxX(e))}getGlobalBoundingBoxY(e){return Kt("id",e,Ht()),vt(this.#e.getGlobalBoundingBoxY(e))}getGlobalBoundingBoxWidth(e){return Kt("id",e,Ht()),vt(this.#e.getGlobalBoundingBoxWidth(e))}getGlobalBoundingBoxHeight(e){return Kt("id",e,Ht()),vt(this.#e.getGlobalBoundingBoxHeight(e))}getScreenSpaceBoundingBoxXYWH(e){return Kt("ids",e,$t(Vt())),vt(this.#e.getScreenSpaceBoundingBoxXYWH(e))}alignHorizontally(e,t){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.alignHorizontally(e,t))}alignVertically(e,t){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.alignVertically(e,t))}isAlignable(e){return Kt("ids",e,$t(Vt())),vt(this.#e.isAlignable(e))}distributeHorizontally(e){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.distributeHorizontally(e))}distributeVertically(e){return Kt("ids",e,Xt($t(Vt()))),vt(this.#e.distributeVertically(e))}isDistributable(e){return Kt("ids",e,$t(Vt())),vt(this.#e.isDistributable(e))}fillParent(e){return Kt("id",e,Ht()),vt(this.#e.fillParent(e))}resizeContentAware(e,t,r){return Kt("ids",e,$t(Vt())),Kt("width",t,Vt()),Kt("height",r,Vt()),vt(this.#e.resizeContentAware(e,t,r))}scale(e,t,r=0,n=0){return Kt("id",e,Ht()),vt(this.#e.scale(e,t,r,n))}findAllProperties(e){return Kt("id",e,Ht()),At(vt(this.#e.findAllProperties(e)))}isPropertyReadable(e){return Kt("property",e,zt()),this.#e.isPropertyReadable(e)}isPropertyWritable(e){return Kt("property",e,zt()),this.#e.isPropertyWritable(e)}getPropertyType(e){Kt("property",e,zt());return vt(this.#e.getPropertyType(e))}getEnumValues(e){return Kt("enumProperty",e,zt()),At(vt(this.#e.getEnumValues(e)))}setBool(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,Nt()),vt(this.#e.setBool(e,t,r))}getBool(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getBool(e,t))}setInt(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,Ht()),vt(this.#e.setInt(e,t,r))}getInt(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getInt(e,t))}setFloat(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,Vt()),vt(this.#e.setFloat(e,t,r))}getFloat(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getFloat(e,t))}setDouble(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,Vt()),vt(this.#e.setDouble(e,t,r))}getDouble(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getDouble(e,t))}setString(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,zt()),vt(this.#e.setString(e,t,r))}getString(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getString(e,t))}setColor(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.setColor(e,t,gt.fromColor(r)))}getColor(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),gt.toColor(vt(this.#e.getColor(e,t)))}setColorRGBA(e,t,r,n,o,i=1){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("r",r,Vt()),Kt("g",n,Vt()),Kt("b",o,Vt()),Kt("a",i,Vt()),vt(this.#e.setColorRGBA(e,t,r,n,o,i))}getColorRGBA(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getColorRGBA(e,t))}setColorSpot(e,t,r,n=1){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("name",r,zt()),Kt("tint",n,Vt()),vt(this.#e.setColorSpot(e,t,r,n))}getColorSpotName(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getColorSpotName(e,t))}getColorSpotTint(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getColorSpotTint(e,t))}setGradientColorStops(e,t,r){Kt("id",e,Ht()),Kt("property",t,zt());const n=r.map((e=>({color:gt.fromColor(e.color),stop:e.stop})));return vt(this.#e.setGradientColorStops(e,t,n))}getGradientColorStops(e,t){Kt("id",e,Ht()),Kt("property",t,zt());const r=vt(this.#e.getGradientColorStops(e,t));return At(r).map((e=>({color:gt.toColor(e.color),stop:e.stop})))}getSourceSet(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),At(vt(this.#e.getSourceSet(e,t)))}setSourceSet(e,t,r){Kt("id",e,Ht()),Kt("property",t,zt()),Kt("sourceSet",r,$t(Wt({uri:zt(),width:Vt(),height:Vt()}))),vt(this.#e.setSourceSet(e,t,r))}setEnum(e,t,r){return Kt("id",e,Ht()),Kt("property",t,zt()),Kt("value",r,zt()),vt(this.#e.setEnum(e,t,r))}getEnum(e,t){return Kt("id",e,Ht()),Kt("property",t,zt()),vt(this.#e.getEnum(e,t))}hasCrop(e){return Kt("id",e,Ht()),vt(this.#e.hasCrop(e))}setCropScaleX(e,t){return Kt("id",e,Ht()),Kt("scaleX",t,Vt()),vt(this.#e.setCropScaleX(e,t))}setCropScaleY(e,t){return Kt("id",e,Ht()),Kt("scaleY",t,Vt()),vt(this.#e.setCropScaleY(e,t))}setCropRotation(e,t){return Kt("id",e,Ht()),Kt("rotation",t,Vt()),vt(this.#e.setCropRotation(e,t))}setCropScaleRatio(e,t){return Kt("id",e,Ht()),Kt("scaleRatio",t,Vt()),vt(this.#e.setCropScaleRatio(e,t))}setCropTranslationX(e,t){return Kt("id",e,Ht()),Kt("translationX",t,Vt()),vt(this.#e.setCropTranslationX(e,t))}setCropTranslationY(e,t){return Kt("id",e,Ht()),Kt("translationY",t,Vt()),vt(this.#e.setCropTranslationY(e,t))}resetCrop(e){return Kt("id",e,Ht()),vt(this.#e.resetCrop(e))}getCropScaleX(e){return Kt("id",e,Ht()),vt(this.#e.getCropScaleX(e))}getCropScaleY(e){return Kt("id",e,Ht()),vt(this.#e.getCropScaleY(e))}getCropRotation(e){return Kt("id",e,Ht()),vt(this.#e.getCropRotation(e))}getCropScaleRatio(e){return Kt("id",e,Ht()),vt(this.#e.getCropScaleRatio(e))}getCropTranslationX(e){return Kt("id",e,Ht()),vt(this.#e.getCropTranslationX(e))}getCropTranslationY(e){return Kt("id",e,Ht()),vt(this.#e.getCropTranslationY(e))}adjustCropToFillFrame(e,t){return Kt("id",e,Ht()),Kt("minScaleRatio",t,Vt()),vt(this.#e.adjustCropToFillFrame(e,t))}flipCropHorizontal(e){return Kt("id",e,Ht()),vt(this.#e.flipCropHorizontal(e))}flipCropVertical(e){return Kt("id",e,Ht()),vt(this.#e.flipCropVertical(e))}hasOpacity(e){return Kt("id",e,Ht()),vt(this.#e.hasOpacity(e))}setOpacity(e,t){return Kt("id",e,Ht()),Kt("opacity",t,Vt()),vt(this.#e.setOpacity(e,t))}getOpacity(e){return Kt("id",e,Ht()),vt(this.#e.getOpacity(e))}hasBlendMode(e){return Kt("id",e,Ht()),vt(this.#e.hasBlendMode(e))}setBlendMode(e,t){return Kt("id",e,Ht()),Kt("blendMode",t,zt()),vt(this.#e.setBlendMode(e,t))}getBlendMode(e){return Kt("id",e,Ht()),vt(this.#e.getBlendMode(e))}hasFillColor(e){return Kt("id",e,Ht()),vt(this.#e.hasFillColor(e))}isIncludedInExport(e){return Kt("id",e,Ht()),vt(this.#e.isIncludedInExport(e))}setIncludedInExport(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setIncludedInExport(e,t))}setFillColorRGBA(e,t,r,n,o=1){return Kt("id",e,Ht()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setFillColorRGBA(e,t,r,n,o))}getFillColorRGBA(e){return Kt("id",e,Ht()),vt(this.#e.getFillColorRGBA(e))}setFillColorEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setFillColorEnabled(e,t))}isFillColorEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isFillColorEnabled(e))}createEffect(e){return Kt("type",e,zt()),vt(this.#e.createEffect(e))}hasEffects(e){return Kt("id",e,Ht()),vt(this.#e.hasEffects(e))}getEffects(e){Kt("id",e,Ht());const t=vt(this.#e.getEffects(e));return At(t)}insertEffect(e,t,r){Kt("id",e,Ht()),Kt("effectId",t,Ht()),Kt("index",r,Yt(Ht(),0)),vt(this.#e.insertEffect(e,t,r))}appendEffect(e,t){Kt("id",e,Ht()),Kt("effectId",t,Ht()),vt(this.#e.appendEffect(e,t))}removeEffect(e,t){Kt("id",e,Ht()),Kt("index",t,Yt(Ht(),0)),vt(this.#e.removeEffect(e,t))}hasEffectEnabled(e){return Kt("effectId",e,Ht()),vt(this.#e.hasEffectEnabled(e))}setEffectEnabled(e,t){Kt("effectId",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setEffectEnabled(e,t))}isEffectEnabled(e){return Kt("effectId",e,Ht()),vt(this.#e.isEffectEnabled(e))}createBlur(e){return Kt("type",e,zt()),vt(this.#e.createBlur(e))}hasBlur(e){return Kt("id",e,Ht()),vt(this.#e.hasBlur(e))}setBlur(e,t){Kt("id",e,Ht()),Kt("blurId",t,Ht()),vt(this.#e.setBlur(e,t))}getBlur(e){return Kt("id",e,Ht()),vt(this.#e.getBlur(e))}setBlurEnabled(e,t){Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setBlurEnabled(e,t))}isBlurEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isBlurEnabled(e))}hasBackgroundColor(e){return Kt("id",e,Ht()),vt(this.#e.hasBackgroundColor(e))}setBackgroundColorRGBA(e,t,r,n,o=1){return Kt("id",e,Ht()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setBackgroundColorRGBA(e,t,r,n,o))}getBackgroundColorRGBA(e){return Kt("id",e,Ht()),vt(this.#e.getBackgroundColorRGBA(e))}setBackgroundColorEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setBackgroundColorEnabled(e,t))}isBackgroundColorEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isBackgroundColorEnabled(e))}hasStroke(e){return Kt("id",e,Ht()),vt(this.#e.hasStroke(e))}setStrokeEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setStrokeEnabled(e,t))}isStrokeEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isStrokeEnabled(e))}setStrokeColorRGBA(e,t,r,n,o=1){return Kt("id",e,Ht()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setStrokeColorRGBA(e,t,r,n,o))}setStrokeColor(e,t){return Kt("id",e,Ht()),vt(this.#e.setStrokeColor(e,gt.fromColor(t)))}getStrokeColorRGBA(e){return Kt("id",e,Ht()),vt(this.#e.getStrokeColorRGBA(e))}getStrokeColor(e){return Kt("id",e,Ht()),gt.toColor(vt(this.#e.getStrokeColor(e)))}setStrokeWidth(e,t){return Kt("id",e,Ht()),Kt("width",t,Vt()),vt(this.#e.setStrokeWidth(e,t))}getStrokeWidth(e){return Kt("id",e,Ht()),vt(this.#e.getStrokeWidth(e))}setStrokeStyle(e,t){return Kt("id",e,Ht()),vt(this.#e.setStrokeStyle(e,t))}getStrokeStyle(e){Kt("id",e,Ht());return vt(this.#e.getStrokeStyle(e))}setStrokePosition(e,t){return Kt("id",e,Ht()),vt(this.#e.setStrokePosition(e,t))}getStrokePosition(e){Kt("id",e,Ht());return vt(this.#e.getStrokePosition(e))}setStrokeCornerGeometry(e,t){return Kt("id",e,Ht()),vt(this.#e.setStrokeCornerGeometry(e,t))}getStrokeCornerGeometry(e){Kt("id",e,Ht());return vt(this.#e.getStrokeCornerGeometry(e))}hasDropShadow(e){return Kt("id",e,Ht()),vt(this.#e.hasDropShadow(e))}setDropShadowEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setDropShadowEnabled(e,t))}isDropShadowEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isDropShadowEnabled(e))}setDropShadowColorRGBA(e,t,r,n,o=1){return Kt("id",e,Ht()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setDropShadowColorRGBA(e,t,r,n,o))}setDropShadowColor(e,t){return Kt("id",e,Ht()),vt(this.#e.setDropShadowColor(e,gt.fromColor(t)))}getDropShadowColorRGBA(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowColorRGBA(e))}getDropShadowColor(e){return Kt("id",e,Ht()),gt.toColor(vt(this.#e.getDropShadowColor(e)))}setDropShadowOffsetX(e,t){return Kt("id",e,Ht()),Kt("offsetX",t,Vt()),vt(this.#e.setDropShadowOffsetX(e,t))}getDropShadowOffsetX(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowOffsetX(e))}setDropShadowOffsetY(e,t){return Kt("id",e,Ht()),Kt("offsetY",t,Vt()),vt(this.#e.setDropShadowOffsetY(e,t))}getDropShadowOffsetY(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowOffsetY(e))}setDropShadowBlurRadiusX(e,t){return Kt("id",e,Ht()),Kt("blurRadiusX",t,Vt()),vt(this.#e.setDropShadowBlurRadiusX(e,t))}getDropShadowBlurRadiusX(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowBlurRadiusX(e))}setDropShadowBlurRadiusY(e,t){return Kt("id",e,Ht()),Kt("blurRadiusY",t,Vt()),vt(this.#e.setDropShadowBlurRadiusY(e,t))}getDropShadowBlurRadiusY(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowBlurRadiusY(e))}setDropShadowClip(e,t){return Kt("id",e,Ht()),vt(this.#e.setDropShadowClip(e,t))}getDropShadowClip(e){return Kt("id",e,Ht()),vt(this.#e.getDropShadowClip(e))}createCutoutFromBlocks(e,t=2,r=4){return Kt("ids",e,$t(Ht())),Kt("vectorizeDistanceThreshold",t,Vt()),Kt("maxSmoothingDistance",r,Vt()),vt(this.#e.createCutoutFromBlocks(e,t,r))}createCutoutFromPath(e){return Kt("path",e,zt()),vt(this.#e.createCutoutFromPath(e))}createCutoutFromOperation(e,t){return Kt("ids",e,$t(Ht())),Kt("op",t,function(){const e=["Difference","Intersection","Union","XOR"];return Ut("CutoutOperation",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}()),vt(this.#e.createCutoutFromOperation(e,t))}replaceText(e,t,r=-1,n=-1){Kt("id",e,Ht()),Kt("text",t,zt()),Kt("from",r,Ht()),Kt("to",n,Ht()),vt(this.#e.replaceText(e,t,r,n))}removeText(e,t=-1,r=-1){Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht()),vt(this.#e.removeText(e,t,r))}setTextColor(e,t,r=-1,n=-1){Kt("id",e,Ht()),Kt("from",r,Ht()),Kt("to",n,Ht()),vt(this.#e.setTextColor(e,gt.fromColor(t),r,n))}getTextColors(e,t=-1,r=-1){Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht());const n=this.#e.getTextColors(e,t,r);return At(vt(n)).map((e=>gt.toColor(e)))}getTextFontWeights(e,t=-1,r=-1){return Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht()),At(vt(this.#e.getTextFontWeights(e,t,r)))}getTextFontStyles(e,t=-1,r=-1){return Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht()),At(vt(this.#e.getTextFontStyles(e,t,r)))}getTextCases(e,t=-1,r=-1){return Kt("id",e,Ht()),Kt("from",t,Ht()),Kt("to",r,Ht()),At(vt(this.#e.getTextCases(e,t,r)))}setTextCase(e,t,r=-1,n=-1){Kt("id",e,Ht()),Kt("textCase",t,zt()),Kt("from",r,Ht()),Kt("to",n,Ht()),vt(this.#e.setTextCase(e,t,r,n))}getTextCursorRange(){return vt(this.#e.getTextCursorRange())}hasFill(e){return Kt("id",e,Ht()),vt(this.#e.hasFill(e))}isFillEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isFillEnabled(e))}setFillEnabled(e,t){return Kt("id",e,Ht()),vt(this.#e.setFillEnabled(e,t))}getFill(e){return Kt("id",e,Ht()),vt(this.#e.getFill(e))}setFill(e,t){return Kt("id",e,Ht()),Kt("fill",t,Ht()),vt(this.#e.setFill(e,t))}setFillSolidColor(e,t,r,n,o=1){Kt("id",e,Ht()),vt(this.#e.setFillSolidColor(e,t,r,n,o))}getFillSolidColor(e){return Kt("id",e,Ht()),vt(this.#e.getFillSolidColor(e))}setPlaceholderEnabled(e,t){Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setPlaceholderEnabled(e,t))}isPlaceholderEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isPlaceholderEnabled(e))}hasPlaceholderBehavior(e){return Kt("id",e,Ht()),vt(this.#e.hasPlaceholderBehavior(e))}setPlaceholderBehaviorEnabled(e,t){Kt("id",e,Ht()),vt(this.#e.setPlaceholderBehaviorEnabled(e,t))}isPlaceholderBehaviorEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isPlaceholderBehaviorEnabled(e))}hasPlaceholderControls(e){return Kt("id",e,Ht()),vt(this.#e.hasPlaceholderControls(e))}setPlaceholderControlsOverlayEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setPlaceholderControlsOverlayEnabled(e,t))}isPlaceholderControlsOverlayEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isPlaceholderControlsOverlayEnabled(e))}setPlaceholderControlsButtonEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setPlaceholderControlsButtonEnabled(e,t))}isPlaceholderControlsButtonEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isPlaceholderControlsButtonEnabled(e))}setMetadata(e,t,r){Kt("id",e,Ht()),Kt("key",t,zt()),Kt("value",r,zt()),vt(this.#e.setMetadata(e,t,r))}getMetadata(e,t){return Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.getMetadata(e,t))}hasMetadata(e,t){return Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.hasMetadata(e,t))}findAllMetadata(e){return Kt("id",e,Ht()),At(vt(this.#e.findAllMetadata(e)))}removeMetadata(e,t){Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.removeMetadata(e,t))}setScopeEnabled(e,t,r){Kt("id",e,Ht()),Kt("key",t,zt()),Kt("enabled",r,Nt()),vt(this.#e.setScopeEnabled(e,t,r))}isScopeEnabled(e,t){return Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.isScopeEnabled(e,t))}isAllowedByScope(e,t){return Kt("id",e,Ht()),Kt("key",t,zt()),vt(this.#e.isAllowedByScope(e,t))}hasDuration(e){return Kt("id",e,Ht()),vt(this.#e.hasDuration(e))}setDuration(e,t){return Kt("id",e,Ht()),Kt("duration",t,Vt()),vt(this.#e.setDuration(e,t))}getDuration(e){return Kt("id",e,Ht()),vt(this.#e.getDuration(e))}hasTimeOffset(e){return Kt("id",e,Ht()),vt(this.#e.hasTimeOffset(e))}setTimeOffset(e,t){return Kt("id",e,Ht()),Kt("offset",t,Vt()),vt(this.#e.setTimeOffset(e,t))}getTimeOffset(e){return Kt("id",e,Ht()),vt(this.#e.getTimeOffset(e))}hasTrim(e){return Kt("id",e,Ht()),vt(this.#e.hasTrim(e))}setTrimOffset(e,t){return Kt("id",e,Ht()),Kt("offset",t,Vt()),vt(this.#e.setTrimOffset(e,t))}getTrimOffset(e){return Kt("id",e,Ht()),vt(this.#e.getTrimOffset(e))}setTrimLength(e,t){return Kt("id",e,Ht()),Kt("length",t,Vt()),vt(this.#e.setTrimLength(e,t))}getTrimLength(e){return Kt("id",e,Ht()),vt(this.#e.getTrimLength(e))}getTotalSceneDuration(e){return Kt("scene",e,Ht()),vt(this.#e.getTotalSceneDuration(e))}setPlaying(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setPlaying(e,t))}isPlaying(e){return Kt("id",e,Ht()),vt(this.#e.isPlaying(e))}hasPlaybackTime(e){return Kt("id",e,Ht()),vt(this.#e.hasPlaybackTime(e))}setPlaybackTime(e,t){return Kt("id",e,Ht()),Kt("time",t,Vt()),vt(this.#e.setPlaybackTime(e,t))}getPlaybackTime(e){return Kt("id",e,Ht()),vt(this.#e.getPlaybackTime(e))}isVisibleAtCurrentPlaybackTime(e){return Kt("id",e,Ht()),vt(this.#e.isVisibleAtCurrentPlaybackTime(e))}setSoloPlaybackEnabled(e,t){return Kt("id",e,Ht()),Kt("enabled",t,Nt()),vt(this.#e.setSoloPlaybackEnabled(e,t))}isSoloPlaybackEnabled(e){return Kt("id",e,Ht()),vt(this.#e.isSoloPlaybackEnabled(e))}hasPlaybackControl(e){return Kt("id",e,Ht()),vt(this.#e.hasPlaybackControl(e))}setLooping(e,t){Kt("id",e,Ht()),Kt("looping",t,Nt()),vt(this.#e.setLooping(e,t))}isLooping(e){return Kt("id",e,Ht()),vt(this.#e.isLooping(e))}setMuted(e,t){Kt("id",e,Ht()),Kt("muted",t,Nt()),vt(this.#e.setMuted(e,t))}isMuted(e){return Kt("id",e,Ht()),vt(this.#e.isMuted(e))}setVolume(e,t){Kt("id",e,Ht()),Kt("volume",t,Vt()),vt(this.#e.setVolume(e,t))}getVolume(e){return Kt("id",e,Ht()),vt(this.#e.getVolume(e))}async forceLoadAVResource(e){return Kt("id",e,Ht()),wt((t=>this.#e.forceLoadAVResource(e,t)))}unstable_isAVResourceLoaded(e){return Kt("id",e,Ht()),vt(this.#e.unstable_isAVResourceLoaded(e))}getAVResourceTotalDuration(e){return Kt("id",e,Ht()),vt(this.#e.getAVResourceTotalDuration(e))}getVideoWidth(e){return Kt("id",e,Ht()),vt(this.#e.getVideoWidth(e))}getVideoHeight(e){return Kt("id",e,Ht()),vt(this.#e.getVideoHeight(e))}generateVideoThumbnailSequence(e,t,r,n,o,i){return Kt("id",e,Ht()),Kt("thumbnailHeight",t,Ht()),Kt("timeBegin",r,Vt()),Kt("timeEnd",n,Vt()),Kt("numberOfFrames",o,Ht()),this.#e.generateVideoThumbnailSequence(e,t,r,n,o,(e=>{"error"in e?i(0,new Error(e.error)):i(e.frameIndex,new ImageData(new Uint8ClampedArray(e.imageData),e.width,e.height))})),()=>{this.#e.cancelVideoThumbnailSequenceGeneration(e)}}generateAudioThumbnailSequence(e,t,r,n,o,i,a){return Kt("id",e,Ht()),Kt("samplesPerChunk",t,Ht()),Kt("timeBegin",r,Vt()),Kt("timeEnd",n,Vt()),Kt("numberOfSamples",o,Ht()),Kt("numberOfChannels",i,Ht()),this.#e.generateAudioThumbnailSequence(e,t,r,n,o,i,(e=>{"error"in e?a(0,new Error(e.error)):a(e.chunkIndex,e.sampleData)})),()=>{this.#e.cancelAudioThumbnailSequenceGeneration(e)}}async getVideoFillThumbnail(e,t){return Kt("id",e,Ht()),Kt("thumbnailHeight",t,Ht()),new Promise(((r,n)=>{this.#e.getVideoFillThumbnail(e,t,(e=>{"error"in e?n(e.error):r(new rr([e],{type:"image/jpeg"}))}))}))}async getVideoFillThumbnailAtlas(e,t,r,n){return Kt("id",e,Ht()),Kt("numberOfColumns",t,Ht()),Kt("numberOfRows",r,Ht()),Kt("thumbnailHeight",n,Ht()),new Promise(((o,i)=>{this.#e.getVideoFillThumbnailAtlas(e,t,r,n,(e=>{"error"in e?i(e.error):o(new rr([e],{type:"image/jpeg"}))}))}))}async getPageThumbnailAtlas(e,t,r,n){return Kt("id",e,Ht()),Kt("numberOfColumns",t,Ht()),Kt("numberOfRows",r,Ht()),new Promise(((o,i)=>{this.#e.getPageThumbnailAtlas(e,t,r,n,(e=>{"error"in e?i(e.error):o(new rr([e],{type:"image/jpeg"}))}))}))}setNativePixelBuffer(e,t){t instanceof HTMLVideoElement&&(t.width=t.videoWidth,t.height=t.videoHeight),vt(this.#e.setNativePixelBuffer(e,t))}};u([mt],BlockAPI.prototype,"loadFromString",1),u([mt],BlockAPI.prototype,"create",1),u([mt],BlockAPI.prototype,"createFill",1),u([ft],BlockAPI.prototype,"getType",1),u([mt],BlockAPI.prototype,"select",1),u([mt],BlockAPI.prototype,"setSelected",1),u([ft],BlockAPI.prototype,"isSelected",1),u([ft],BlockAPI.prototype,"findAllSelected",1),u([ft],BlockAPI.prototype,"isGroupable",1),u([mt],BlockAPI.prototype,"group",1),u([mt],BlockAPI.prototype,"ungroup",1),u([mt],BlockAPI.prototype,"enterGroup",1),u([mt],BlockAPI.prototype,"exitGroup",1),u([ft],BlockAPI.prototype,"isCombinable",1),u([mt],BlockAPI.prototype,"combine",1),u([mt],BlockAPI.prototype,"setName",1),u([ft],BlockAPI.prototype,"getName",1),u([ft],BlockAPI.prototype,"getUUID",1),u([ft],BlockAPI.prototype,"findByName",1),u([ft],BlockAPI.prototype,"findByType",1),u([ft],BlockAPI.prototype,"findAll",1),u([ft],BlockAPI.prototype,"findAllPlaceholders",1),u([mt],BlockAPI.prototype,"createShape",1),u([ft],BlockAPI.prototype,"hasShape",1),u([ft],BlockAPI.prototype,"getShape",1),u([mt],BlockAPI.prototype,"setShape",1),u([ft],BlockAPI.prototype,"isVisible",1),u([mt],BlockAPI.prototype,"setVisible",1),u([ft],BlockAPI.prototype,"isClipped",1),u([mt],BlockAPI.prototype,"setClipped",1),u([ft],BlockAPI.prototype,"isTransformLocked",1),u([mt],BlockAPI.prototype,"setTransformLocked",1),u([ft],BlockAPI.prototype,"getPositionX",1),u([ft],BlockAPI.prototype,"getPositionXMode",1),u([ft],BlockAPI.prototype,"getPositionY",1),u([ft],BlockAPI.prototype,"getPositionYMode",1),u([mt],BlockAPI.prototype,"setPositionX",1),u([mt],BlockAPI.prototype,"setPositionXMode",1),u([mt],BlockAPI.prototype,"setPositionY",1),u([mt],BlockAPI.prototype,"setPositionYMode",1),u([mt],BlockAPI.prototype,"setAlwaysOnTop",1),u([mt],BlockAPI.prototype,"setAlwaysOnBottom",1),u([ft],BlockAPI.prototype,"isAlwaysOnTop",1),u([ft],BlockAPI.prototype,"isAlwaysOnBottom",1),u([mt],BlockAPI.prototype,"bringToFront",1),u([mt],BlockAPI.prototype,"sendToBack",1),u([mt],BlockAPI.prototype,"bringForward",1),u([mt],BlockAPI.prototype,"sendBackward",1),u([ft],BlockAPI.prototype,"getRotation",1),u([mt],BlockAPI.prototype,"setRotation",1),u([ft],BlockAPI.prototype,"getFlipHorizontal",1),u([ft],BlockAPI.prototype,"getFlipVertical",1),u([mt],BlockAPI.prototype,"setFlipHorizontal",1),u([mt],BlockAPI.prototype,"setFlipVertical",1),u([ft],BlockAPI.prototype,"hasContentFillMode",1),u([ft],BlockAPI.prototype,"getWidth",1),u([ft],BlockAPI.prototype,"getWidthMode",1),u([ft],BlockAPI.prototype,"getHeight",1),u([ft],BlockAPI.prototype,"getHeightMode",1),u([mt],BlockAPI.prototype,"setWidth",1),u([mt],BlockAPI.prototype,"setWidthMode",1),u([mt],BlockAPI.prototype,"setHeight",1),u([mt],BlockAPI.prototype,"setHeightMode",1),u([ft],BlockAPI.prototype,"getFrameX",1),u([ft],BlockAPI.prototype,"getFrameY",1),u([ft],BlockAPI.prototype,"getFrameWidth",1),u([ft],BlockAPI.prototype,"getFrameHeight",1),u([mt],BlockAPI.prototype,"setContentFillMode",1),u([ft],BlockAPI.prototype,"getContentFillMode",1),u([mt],BlockAPI.prototype,"duplicate",1),u([mt],BlockAPI.prototype,"destroy",1),u([ft],BlockAPI.prototype,"isValid",1),u([ft],BlockAPI.prototype,"getParent",1),u([ft],BlockAPI.prototype,"getChildren",1),u([mt],BlockAPI.prototype,"insertChild",1),u([mt],BlockAPI.prototype,"appendChild",1),u([ft],BlockAPI.prototype,"referencesAnyVariables",1),u([ft],BlockAPI.prototype,"getGlobalBoundingBoxX",1),u([ft],BlockAPI.prototype,"getGlobalBoundingBoxY",1),u([ft],BlockAPI.prototype,"getGlobalBoundingBoxWidth",1),u([ft],BlockAPI.prototype,"getGlobalBoundingBoxHeight",1),u([ft],BlockAPI.prototype,"getScreenSpaceBoundingBoxXYWH",1),u([mt],BlockAPI.prototype,"alignHorizontally",1),u([mt],BlockAPI.prototype,"alignVertically",1),u([ft],BlockAPI.prototype,"isAlignable",1),u([mt],BlockAPI.prototype,"distributeHorizontally",1),u([mt],BlockAPI.prototype,"distributeVertically",1),u([mt],BlockAPI.prototype,"isDistributable",1),u([mt],BlockAPI.prototype,"fillParent",1),u([mt],BlockAPI.prototype,"resizeContentAware",1),u([mt],BlockAPI.prototype,"scale",1),u([ft],BlockAPI.prototype,"findAllProperties",1),u([ft],BlockAPI.prototype,"isPropertyReadable",1),u([ft],BlockAPI.prototype,"isPropertyWritable",1),u([ft],BlockAPI.prototype,"getPropertyType",1),u([ft],BlockAPI.prototype,"getEnumValues",1),u([mt],BlockAPI.prototype,"setBool",1),u([ft],BlockAPI.prototype,"getBool",1),u([mt],BlockAPI.prototype,"setInt",1),u([ft],BlockAPI.prototype,"getInt",1),u([mt],BlockAPI.prototype,"setFloat",1),u([ft],BlockAPI.prototype,"getFloat",1),u([mt],BlockAPI.prototype,"setDouble",1),u([ft],BlockAPI.prototype,"getDouble",1),u([mt],BlockAPI.prototype,"setString",1),u([ft],BlockAPI.prototype,"getString",1),u([mt],BlockAPI.prototype,"setColor",1),u([ft],BlockAPI.prototype,"getColor",1),u([mt],BlockAPI.prototype,"setColorRGBA",1),u([ft],BlockAPI.prototype,"getColorRGBA",1),u([mt],BlockAPI.prototype,"setColorSpot",1),u([ft],BlockAPI.prototype,"getColorSpotName",1),u([ft],BlockAPI.prototype,"getColorSpotTint",1),u([mt],BlockAPI.prototype,"setGradientColorStops",1),u([ft],BlockAPI.prototype,"getGradientColorStops",1),u([ft],BlockAPI.prototype,"getSourceSet",1),u([mt],BlockAPI.prototype,"setSourceSet",1),u([mt],BlockAPI.prototype,"setEnum",1),u([ft],BlockAPI.prototype,"getEnum",1),u([ft],BlockAPI.prototype,"hasCrop",1),u([mt],BlockAPI.prototype,"setCropScaleX",1),u([mt],BlockAPI.prototype,"setCropScaleY",1),u([mt],BlockAPI.prototype,"setCropRotation",1),u([mt],BlockAPI.prototype,"setCropScaleRatio",1),u([mt],BlockAPI.prototype,"setCropTranslationX",1),u([mt],BlockAPI.prototype,"setCropTranslationY",1),u([mt],BlockAPI.prototype,"resetCrop",1),u([ft],BlockAPI.prototype,"getCropScaleX",1),u([ft],BlockAPI.prototype,"getCropScaleY",1),u([ft],BlockAPI.prototype,"getCropRotation",1),u([ft],BlockAPI.prototype,"getCropScaleRatio",1),u([ft],BlockAPI.prototype,"getCropTranslationX",1),u([ft],BlockAPI.prototype,"getCropTranslationY",1),u([mt],BlockAPI.prototype,"adjustCropToFillFrame",1),u([mt],BlockAPI.prototype,"flipCropHorizontal",1),u([mt],BlockAPI.prototype,"flipCropVertical",1),u([ft],BlockAPI.prototype,"hasOpacity",1),u([mt],BlockAPI.prototype,"setOpacity",1),u([ft],BlockAPI.prototype,"getOpacity",1),u([ft],BlockAPI.prototype,"hasBlendMode",1),u([mt],BlockAPI.prototype,"setBlendMode",1),u([ft],BlockAPI.prototype,"getBlendMode",1),u([ft],BlockAPI.prototype,"hasFillColor",1),u([ft],BlockAPI.prototype,"isIncludedInExport",1),u([mt],BlockAPI.prototype,"setIncludedInExport",1),u([mt],BlockAPI.prototype,"setFillColorRGBA",1),u([ft],BlockAPI.prototype,"getFillColorRGBA",1),u([mt],BlockAPI.prototype,"setFillColorEnabled",1),u([ft],BlockAPI.prototype,"isFillColorEnabled",1),u([mt],BlockAPI.prototype,"createEffect",1),u([ft],BlockAPI.prototype,"hasEffects",1),u([ft],BlockAPI.prototype,"getEffects",1),u([mt],BlockAPI.prototype,"insertEffect",1),u([mt],BlockAPI.prototype,"appendEffect",1),u([mt],BlockAPI.prototype,"removeEffect",1),u([ft],BlockAPI.prototype,"hasEffectEnabled",1),u([mt],BlockAPI.prototype,"setEffectEnabled",1),u([ft],BlockAPI.prototype,"isEffectEnabled",1),u([mt],BlockAPI.prototype,"createBlur",1),u([ft],BlockAPI.prototype,"hasBlur",1),u([mt],BlockAPI.prototype,"setBlur",1),u([ft],BlockAPI.prototype,"getBlur",1),u([mt],BlockAPI.prototype,"setBlurEnabled",1),u([ft],BlockAPI.prototype,"isBlurEnabled",1),u([ft],BlockAPI.prototype,"hasBackgroundColor",1),u([mt],BlockAPI.prototype,"setBackgroundColorRGBA",1),u([ft],BlockAPI.prototype,"getBackgroundColorRGBA",1),u([mt],BlockAPI.prototype,"setBackgroundColorEnabled",1),u([ft],BlockAPI.prototype,"isBackgroundColorEnabled",1),u([ft],BlockAPI.prototype,"hasStroke",1),u([mt],BlockAPI.prototype,"setStrokeEnabled",1),u([ft],BlockAPI.prototype,"isStrokeEnabled",1),u([mt],BlockAPI.prototype,"setStrokeColorRGBA",1),u([mt],BlockAPI.prototype,"setStrokeColor",1),u([ft],BlockAPI.prototype,"getStrokeColorRGBA",1),u([ft],BlockAPI.prototype,"getStrokeColor",1),u([mt],BlockAPI.prototype,"setStrokeWidth",1),u([ft],BlockAPI.prototype,"getStrokeWidth",1),u([mt],BlockAPI.prototype,"setStrokeStyle",1),u([ft],BlockAPI.prototype,"getStrokeStyle",1),u([mt],BlockAPI.prototype,"setStrokePosition",1),u([ft],BlockAPI.prototype,"getStrokePosition",1),u([mt],BlockAPI.prototype,"setStrokeCornerGeometry",1),u([ft],BlockAPI.prototype,"getStrokeCornerGeometry",1),u([ft],BlockAPI.prototype,"hasDropShadow",1),u([mt],BlockAPI.prototype,"setDropShadowEnabled",1),u([ft],BlockAPI.prototype,"isDropShadowEnabled",1),u([mt],BlockAPI.prototype,"setDropShadowColorRGBA",1),u([mt],BlockAPI.prototype,"setDropShadowColor",1),u([ft],BlockAPI.prototype,"getDropShadowColorRGBA",1),u([ft],BlockAPI.prototype,"getDropShadowColor",1),u([mt],BlockAPI.prototype,"setDropShadowOffsetX",1),u([ft],BlockAPI.prototype,"getDropShadowOffsetX",1),u([mt],BlockAPI.prototype,"setDropShadowOffsetY",1),u([ft],BlockAPI.prototype,"getDropShadowOffsetY",1),u([mt],BlockAPI.prototype,"setDropShadowBlurRadiusX",1),u([ft],BlockAPI.prototype,"getDropShadowBlurRadiusX",1),u([mt],BlockAPI.prototype,"setDropShadowBlurRadiusY",1),u([ft],BlockAPI.prototype,"getDropShadowBlurRadiusY",1),u([mt],BlockAPI.prototype,"setDropShadowClip",1),u([ft],BlockAPI.prototype,"getDropShadowClip",1),u([mt],BlockAPI.prototype,"createCutoutFromBlocks",1),u([mt],BlockAPI.prototype,"createCutoutFromPath",1),u([mt],BlockAPI.prototype,"createCutoutFromOperation",1),u([mt],BlockAPI.prototype,"replaceText",1),u([mt],BlockAPI.prototype,"removeText",1),u([mt],BlockAPI.prototype,"setTextColor",1),u([ft],BlockAPI.prototype,"getTextColors",1),u([ft],BlockAPI.prototype,"getTextFontWeights",1),u([ft],BlockAPI.prototype,"getTextFontStyles",1),u([ft],BlockAPI.prototype,"getTextCases",1),u([mt],BlockAPI.prototype,"setTextCase",1),u([ft],BlockAPI.prototype,"getTextCursorRange",1),u([ft],BlockAPI.prototype,"hasFill",1),u([ft],BlockAPI.prototype,"isFillEnabled",1),u([mt],BlockAPI.prototype,"setFillEnabled",1),u([ft],BlockAPI.prototype,"getFill",1),u([mt],BlockAPI.prototype,"setFill",1),u([mt],BlockAPI.prototype,"setFillSolidColor",1),u([ft],BlockAPI.prototype,"getFillSolidColor",1),u([mt],BlockAPI.prototype,"setPlaceholderEnabled",1),u([ft],BlockAPI.prototype,"isPlaceholderEnabled",1),u([ft],BlockAPI.prototype,"hasPlaceholderBehavior",1),u([mt],BlockAPI.prototype,"setPlaceholderBehaviorEnabled",1),u([ft],BlockAPI.prototype,"isPlaceholderBehaviorEnabled",1),u([ft],BlockAPI.prototype,"hasPlaceholderControls",1),u([mt],BlockAPI.prototype,"setPlaceholderControlsOverlayEnabled",1),u([ft],BlockAPI.prototype,"isPlaceholderControlsOverlayEnabled",1),u([mt],BlockAPI.prototype,"setPlaceholderControlsButtonEnabled",1),u([ft],BlockAPI.prototype,"isPlaceholderControlsButtonEnabled",1),u([mt],BlockAPI.prototype,"setMetadata",1),u([ft],BlockAPI.prototype,"getMetadata",1),u([ft],BlockAPI.prototype,"hasMetadata",1),u([ft],BlockAPI.prototype,"findAllMetadata",1),u([mt],BlockAPI.prototype,"removeMetadata",1),u([mt],BlockAPI.prototype,"setScopeEnabled",1),u([ft],BlockAPI.prototype,"isScopeEnabled",1),u([ft],BlockAPI.prototype,"isAllowedByScope",1),u([ft],BlockAPI.prototype,"hasDuration",1),u([mt],BlockAPI.prototype,"setDuration",1),u([ft],BlockAPI.prototype,"getDuration",1),u([ft],BlockAPI.prototype,"hasTimeOffset",1),u([mt],BlockAPI.prototype,"setTimeOffset",1),u([ft],BlockAPI.prototype,"getTimeOffset",1),u([ft],BlockAPI.prototype,"hasTrim",1),u([mt],BlockAPI.prototype,"setTrimOffset",1),u([ft],BlockAPI.prototype,"getTrimOffset",1),u([mt],BlockAPI.prototype,"setTrimLength",1),u([ft],BlockAPI.prototype,"getTrimLength",1),u([ft],BlockAPI.prototype,"getTotalSceneDuration",1),u([mt],BlockAPI.prototype,"setPlaying",1),u([ft],BlockAPI.prototype,"isPlaying",1),u([ft],BlockAPI.prototype,"hasPlaybackTime",1),u([mt],BlockAPI.prototype,"setPlaybackTime",1),u([ft],BlockAPI.prototype,"getPlaybackTime",1),u([ft],BlockAPI.prototype,"isVisibleAtCurrentPlaybackTime",1),u([mt],BlockAPI.prototype,"setSoloPlaybackEnabled",1),u([ft],BlockAPI.prototype,"isSoloPlaybackEnabled",1),u([ft],BlockAPI.prototype,"hasPlaybackControl",1),u([mt],BlockAPI.prototype,"setLooping",1),u([ft],BlockAPI.prototype,"isLooping",1),u([mt],BlockAPI.prototype,"setMuted",1),u([ft],BlockAPI.prototype,"isMuted",1),u([mt],BlockAPI.prototype,"setVolume",1),u([ft],BlockAPI.prototype,"getVolume",1),u([mt],BlockAPI.prototype,"forceLoadAVResource",1),u([ft],BlockAPI.prototype,"unstable_isAVResourceLoaded",1),u([ft],BlockAPI.prototype,"getAVResourceTotalDuration",1),u([ft],BlockAPI.prototype,"getVideoWidth",1),u([ft],BlockAPI.prototype,"getVideoHeight",1),u([ft],BlockAPI.prototype,"getVideoFillThumbnail",1),u([ft],BlockAPI.prototype,"getVideoFillThumbnailAtlas",1),u([ft],BlockAPI.prototype,"getPageThumbnailAtlas",1);var EditorAPI=class{#e;constructor(e){this.#e=e}unlockWithLicense(e){vt(this.#e.unlockWithLicense(e))}startTracking(e,t){this.#e.startTracking(e,t,"")}setTrackingMetadata(e){this.#e.setTrackingMetadata(e)}getTrackingMetadata(){return vt(this.#e.getTrackingMetadata())}getActiveLicense(){return vt(this.#e.getActiveLicense())}onStateChanged=e=>{const t=this.#e.subscribeToEditorState(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};setEditMode(e){Kt("keypath",e,zt()),this.#e.setEditMode(e)}getEditMode(){return this.#e.getEditMode()}getCursorType(){return this.#e.getCursorType()}getCursorRotation(){return this.#e.getCursorRotation()}getTextCursorPositionInScreenSpaceX(){return this.#e.getTextCursorPositionInScreenSpaceX()}getTextCursorPositionInScreenSpaceY(){return this.#e.getTextCursorPositionInScreenSpaceY()}createHistory(){return this.#e.createHistory()}destroyHistory(e){vt(this.#e.destroyHistory(e))}setActiveHistory(e){vt(this.#e.setActiveHistory(e))}getActiveHistory(){return this.#e.getActiveHistory()}addUndoStep(){vt(this.#e.addUndoStep())}undo(){vt(this.#e.undo())}redo(){vt(this.#e.redo())}canUndo(){return vt(this.#e.canUndo())}canRedo(){return vt(this.#e.canRedo())}onHistoryUpdated=e=>{const t=this.#e.subscribeToHistory(e);return()=>{this.#e.isDeleted()||this.#e.unsubscribe(t)}};onSettingsChanged=e=>{const t=this.#e.subscribeToSettings(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};setSettingBool(e,t){return Kt("keypath",e,zt()),Kt("value",t,Nt()),vt(this.#e.setSettingBool(e,t))}getSettingBool(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingBool(e))}setSettingInt(e,t){return Kt("keypath",e,zt()),Kt("value",t,Ht()),vt(this.#e.setSettingInt(e,t))}getSettingInt(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingInt(e))}setSettingFloat(e,t){return Kt("keypath",e,zt()),Kt("value",t,Vt()),vt(this.#e.setSettingFloat(e,t))}getSettingFloat(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingFloat(e))}setSettingString(e,t){return Kt("keypath",e,zt()),Kt("value",t,zt()),vt(this.#e.setSettingString(e,t))}getSettingString(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingString(e))}setSettingColor(e,t){return Kt("keypath",e,zt()),vt(this.#e.setSettingColor(e,gt.fromColor(t)))}getSettingColor(e){return Kt("keypath",e,zt()),gt.toColor(vt(this.#e.getSettingColor(e)))}setSettingColorRGBA(e,t,r,n,o=1){return Kt("keypath",e,zt()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),Kt("a",o,Vt()),vt(this.#e.setSettingColorRGBA(e,t,r,n,o))}getSettingColorRGBA(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingColorRGBA(e))}setSettingEnum(e,t){return Kt("keypath",e,zt()),Kt("value",t,zt()),vt(this.#e.setSettingEnum(e,t))}getSettingEnum(e){return Kt("keypath",e,zt()),vt(this.#e.getSettingEnum(e))}getSettingEnumOptions(e){return Kt("keypath",e,zt()),At(vt(this.#e.getSettingEnumOptions(e)))}findAllSettings(){return At(this.#e.findAllSettings())}getSettingType(e){Kt("keypath",e,zt());return vt(this.#e.getSettingType(e))}getAvailableMemory(){return vt(this.#e.getAvailableMemory())}getUsedMemory(){return vt(this.#e.getUsedMemory())}getMaxExportSize(){return vt(this.#e.getMaxExportSize())}setURIResolver(e){return vt(this.#e.setURIResolver(e))}defaultURIResolver(e){return this.#e.defaultURIResolver(e)}getAbsoluteURI(e){return vt(this.#e.getAbsoluteURI(e))}setGlobalScope(e,t){Kt("key",e,zt()),Kt("value",t,zt()),vt(this.#e.setGlobalScope(e,t))}getGlobalScope(e){return Kt("key",e,zt()),vt(this.#e.getGlobalScope(e))}findAllSpotColors(){return At(this.#e.findAllSpotColors())}getSpotColorRGBA(e){return Kt("name",e,zt()),this.#e.getSpotColorRGB(e)}getSpotColorCMYK(e){return Kt("name",e,zt()),this.#e.getSpotColorCMYK(e)}setSpotColorRGB(e,t,r,n){return Kt("name",e,zt()),Kt("r",t,Vt()),Kt("g",r,Vt()),Kt("b",n,Vt()),this.#e.setSpotColorRGB(e,t,r,n)}setSpotColorCMYK(e,t,r,n,o){return Kt("name",e,zt()),Kt("c",t,Vt()),Kt("m",r,Vt()),Kt("y",n,Vt()),Kt("k",o,Vt()),this.#e.setSpotColorCMYK(e,t,r,n,o)}removeSpotColor(e){return Kt("name",e,zt()),vt(this.#e.removeSpotColor(e))}setSpotColorForCutoutType(e,t){return Kt("type",e,zt()),Kt("color",t,zt()),vt(this.#e.setSpotColorForCutoutType(e,t))}getSpotColorForCutoutType(e){return Kt("type",e,zt()),vt(this.#e.getSpotColorForCutoutType(e))}convertColorToColorSpace(e,t){return Kt("colorSpace",t,zt()),gt.toColor(vt(this.#e.convertColorToColorSpace(gt.fromColor(e),t)))}};u([mt],EditorAPI.prototype,"setEditMode",1),u([ft],EditorAPI.prototype,"getEditMode",1),u([ft],EditorAPI.prototype,"getCursorType",1),u([ft],EditorAPI.prototype,"getCursorRotation",1),u([ft],EditorAPI.prototype,"getTextCursorPositionInScreenSpaceX",1),u([ft],EditorAPI.prototype,"getTextCursorPositionInScreenSpaceY",1),u([mt],EditorAPI.prototype,"createHistory",1),u([mt],EditorAPI.prototype,"destroyHistory",1),u([mt],EditorAPI.prototype,"setActiveHistory",1),u([ft],EditorAPI.prototype,"getActiveHistory",1),u([mt],EditorAPI.prototype,"addUndoStep",1),u([mt],EditorAPI.prototype,"undo",1),u([mt],EditorAPI.prototype,"redo",1),u([ft],EditorAPI.prototype,"canUndo",1),u([ft],EditorAPI.prototype,"canRedo",1),u([mt],EditorAPI.prototype,"setSettingBool",1),u([ft],EditorAPI.prototype,"getSettingBool",1),u([mt],EditorAPI.prototype,"setSettingInt",1),u([ft],EditorAPI.prototype,"getSettingInt",1),u([mt],EditorAPI.prototype,"setSettingFloat",1),u([ft],EditorAPI.prototype,"getSettingFloat",1),u([mt],EditorAPI.prototype,"setSettingString",1),u([ft],EditorAPI.prototype,"getSettingString",1),u([mt],EditorAPI.prototype,"setSettingColor",1),u([ft],EditorAPI.prototype,"getSettingColor",1),u([mt],EditorAPI.prototype,"setSettingColorRGBA",1),u([ft],EditorAPI.prototype,"getSettingColorRGBA",1),u([mt],EditorAPI.prototype,"setSettingEnum",1),u([ft],EditorAPI.prototype,"getSettingEnum",1),u([ft],EditorAPI.prototype,"getAvailableMemory",1),u([ft],EditorAPI.prototype,"getUsedMemory",1),u([ft],EditorAPI.prototype,"getMaxExportSize",1),u([mt],EditorAPI.prototype,"setURIResolver",1),u([ft],EditorAPI.prototype,"defaultURIResolver",1),u([ft],EditorAPI.prototype,"getAbsoluteURI",1),u([mt],EditorAPI.prototype,"setGlobalScope",1),u([ft],EditorAPI.prototype,"getGlobalScope",1),u([ft],EditorAPI.prototype,"findAllSpotColors",1),u([ft],EditorAPI.prototype,"getSpotColorRGBA",1),u([ft],EditorAPI.prototype,"getSpotColorCMYK",1),u([mt],EditorAPI.prototype,"setSpotColorRGB",1),u([mt],EditorAPI.prototype,"setSpotColorCMYK",1),u([mt],EditorAPI.prototype,"removeSpotColor",1),u([mt],EditorAPI.prototype,"setSpotColorForCutoutType",1),u([mt],EditorAPI.prototype,"getSpotColorForCutoutType",1);var EventAPI=class{#e;constructor(e){this.#e=e}subscribe=(e,t)=>{Kt("blocks",e,$t());const r=this.#e.subscribe(e,(e=>{try{t(At(e,!0))}catch(e){console.error(e)}}));return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(r))}}},SceneAPI=class{#e;constructor(e){this.#e=e}async loadFromString(e){return Kt("sceneContent",e,zt()),wt((t=>this.#e.loadSceneFromString(e,t)))}async loadFromURL(e){return Kt("url",e,zt()),wt((t=>this.#e.loadSceneFromURL(e,t)))}async saveToString(){const e=this.get();if(null==e)throw new Error("No scene available.");return wt((t=>{this.#e.saveSceneToString(e,t)}))}async saveToArchive(){return new Promise(((e,t)=>{const r=this.get();null==r?t(new Error("No scene available.")):this.#e.saveSceneToArchive(r,(r=>{"error"in r?t(r.error):e(new rr([r],{type:tr.Zip}))}))}))}create(e="Free"){Kt("sceneLayout",e,Jt());return vt(this.#e.createScene(e))}createVideo(){return vt(this.#e.createVideoScene())}createFromImage(e,t=300,r=1,n="Free",o=0,i=!1){return Kt("url",e,zt()),Kt("dpi",t,Yt(Vt(),0)),Kt("pixelScaleFactor",r,Yt(Vt(),0)),Kt("sceneLayout",n,Jt()),wt((a=>this.#e.createSceneFromImage(e,t,r,n,o,i,a)))}createFromVideo(e){return Kt("url",e,zt()),wt((t=>this.#e.createSceneFromVideo(e,t)))}get(){const e=vt(this.#e.findByType("scene")),t=At(e);return t.length>0?t[0]:null}async applyTemplateFromString(e){return Kt("content",e,zt()),wt((t=>this.#e.applyTemplateFromString(e,t)))}async applyTemplateFromURL(e){return Kt("url",e,zt()),wt((t=>this.#e.applyTemplateFromURL(e,t)))}getMode(){const e=this.get();return vt(this.#e.getSceneMode(e))}setDesignUnit(e){Kt("designUnit",e,function(){const e=["Pixel","Millimeter","Inch"];return Ut("DesignUnit",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}());const t=this.get();vt(this.#e.setDesignUnit(t,e))}getDesignUnit(){const e=this.get();return vt(this.#e.getDesignUnit(e))}getPages(){return At(vt(this.#e.getPages()))}getCurrentPage(){const e=this.get();if(null==e)return null;const t=vt(this.#e.findNearestToViewPortCenterByKind(e,"page")),r=At(t);return r.length>0?r[0]:null}findNearestToViewPortCenterByType(e){Kt("type",e,zt());const t=this.get();if(null==t)return[];const r=vt(this.#e.findNearestToViewPortCenterByType(t,e));return At(r)}findNearestToViewPortCenterByKind(e){Kt("kind",e,zt());const t=this.get();if(null==t)return[];const r=vt(this.#e.findNearestToViewPortCenterByKind(t,e));return At(r)}setZoomLevel(e=1){const t=this.get();Kt("zoomLevel",e,Yt(Vt(),0)),this.#e.setZoomLevel(t,e)}getZoomLevel(){const e=this.get();return vt(this.#e.getZoomLevel(e))}async zoomToBlock(e,t=0,r=0,n=0,o=0){return Kt("id",e,Ht()),wt((i=>this.#e.zoomToBlock(e,t,r,n,o,i)))}enableZoomAutoFit(e,t,r=0,n=0,o=0,i=0){return Kt("id",e,Ht()),Kt("axis",t,function(){const e=["Horizontal","Vertical","Both"];return Ut("ZoomAutoFitAxis",(t=>!("string"!=typeof t||!e.includes(t))||{message:`expected one of ${e.map((e=>`"${e}"`)).join(", ")}, but got "${t}"`}))}()),"Horizontal"===t?(Kt("paddingBefore",r,Vt()),Kt("paddingAfter",n,Vt()),vt(this.#e.enableZoomAutoFit(e,t,r,0,n,0))):"Vertical"===t?(Kt("paddingBefore",r,Vt()),Kt("paddingAfter",n,Vt()),vt(this.#e.enableZoomAutoFit(e,t,0,r,0,n))):(Kt("paddingLeft",r,Vt()),Kt("paddingTop",n,Vt()),Kt("paddingRight",o,Vt()),Kt("paddingBottom",i,Vt()),vt(this.#e.enableZoomAutoFit(e,t,r,n,o,i)))}disableZoomAutoFit(e){return Kt("blockOrScene",e,Ht()),vt(this.#e.disableZoomAutoFit(e))}isZoomAutoFitEnabled(e){return Kt("blockOrScene",e,Ht()),vt(this.#e.isZoomAutoFitEnabled(e))}unstable_enableCameraPositionClamping(e,t=0,r=0,n=0,o=0,i=0,a=0,s=0,u=0){return Kt("ids",e,$t(Vt())),Kt("paddingLeft",t,Vt()),Kt("paddingTop",r,Vt()),Kt("paddingRight",n,Vt()),Kt("paddingBottom",o,Vt()),Kt("scaledPaddingLeft",t,Vt()),Kt("scaledPaddingTop",r,Vt()),Kt("scaledPaddingRight",n,Vt()),Kt("scaledPaddingBottom",o,Vt()),vt(this.#e.unstable_enableCameraPositionClamping(e,t,r,n,o,i,a,s,u))}unstable_disableCameraPositionClamping(e=this.get()){if(null==e)throw new Error("No scene available.");return vt(this.#e.unstable_disableCameraPositionClamping(e))}unstable_isCameraPositionClampingEnabled(e=this.get()){if(null==e)throw new Error("No scene available.");return vt(this.#e.unstable_isCameraPositionClampingEnabled(e))}unstable_enableCameraZoomClamping(e,t=-1,r=-1,n=0,o=0,i=0,a=0){return Kt("ids",e,$t(Vt())),Kt("minZoomLimit",t,Vt()),Kt("maxZoomLimit",r,Vt()),Kt("paddingLeft",n,Vt()),Kt("paddingTop",o,Vt()),Kt("paddingRight",i,Vt()),Kt("paddingBottom",a,Vt()),vt(this.#e.unstable_enableCameraZoomClamping(e,t,r,n,o,i,a))}unstable_disableCameraZoomClamping(e=this.get()){if(null==e)throw new Error("No scene available.");return vt(this.#e.unstable_disableCameraZoomClamping(e))}unstable_isCameraZoomClampingEnabled(e=this.get()){if(null==e)throw new Error("No scene available.");return vt(this.#e.unstable_isCameraZoomClampingEnabled(e))}onZoomLevelChanged=e=>{const t=this.#e.subscribeToZoomLevel(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}};onActiveChanged=e=>{const t=this.#e.subscribeToActiveSceneChange(e);return()=>{this.#e.isDeleted()||vt(this.#e.unsubscribe(t))}}};function nr(e,t){const r=new Set;function n(n){r.add(n);e?.(((e,...t)=>{n(e);for(const e of t)n(e)}));return()=>{r.delete(n),t?.()}}return n.emit=function(e,...t){for(const n of r){n(e);for(const e of t)n(e)}},n.handlers=r,n}u([mt],SceneAPI.prototype,"loadFromString",1),u([mt],SceneAPI.prototype,"loadFromURL",1),u([mt],SceneAPI.prototype,"create",1),u([mt],SceneAPI.prototype,"createVideo",1),u([mt],SceneAPI.prototype,"createFromImage",1),u([mt],SceneAPI.prototype,"createFromVideo",1),u([ft],SceneAPI.prototype,"get",1),u([mt],SceneAPI.prototype,"applyTemplateFromString",1),u([mt],SceneAPI.prototype,"applyTemplateFromURL",1),u([ft],SceneAPI.prototype,"getMode",1),u([mt],SceneAPI.prototype,"setDesignUnit",1),u([ft],SceneAPI.prototype,"getDesignUnit",1),u([ft],SceneAPI.prototype,"getPages",1),u([ft],SceneAPI.prototype,"getCurrentPage",1),u([ft],SceneAPI.prototype,"findNearestToViewPortCenterByType",1),u([ft],SceneAPI.prototype,"findNearestToViewPortCenterByKind",1),u([mt],SceneAPI.prototype,"setZoomLevel",1),u([ft],SceneAPI.prototype,"getZoomLevel",1),u([mt],SceneAPI.prototype,"zoomToBlock",1),u([mt],SceneAPI.prototype,"enableZoomAutoFit",1),u([mt],SceneAPI.prototype,"disableZoomAutoFit",1),u([ft],SceneAPI.prototype,"isZoomAutoFitEnabled",1);var or=e=>t=>function(r){return t((function(t){r(e(t))}))};function ir(e){return t=>function(r){let n=!1;const o=t((function(e){n=!0,r(e)}));return n||r(e instanceof Function?e():e),o}}var ar=(e=((e,t)=>e===t))=>t=>function(r){let n;return t((function(t){e(t,n)||(n=t,r(t))}))},sr=e=>{const t=new Set;let r=null;return function(n){return t.add(n),null===r&&(r=e((function(e){t.forEach((t=>t(e)))}))),function(){t.delete(n),0===t.size&&(r?.(),r=null)}}};function ur(e,...t){return t.reduce(((e,t)=>t(e)),e)}var cr=(...e)=>{const t=Array.from(e);return function(e){const r=t.map((function(t){return t(e)}));return function(){for(const e of r)e()}}};function lr(e){return function(t){let r=null;const n=e((function(e){r?.(),r=e?e(t):e}));return function(){n(),r?.(),r=null}}}function dr(...e){const t=Array.from(e);return function(e){const r=new Array(t.length),n=t.map(((t,n)=>t((function(t){r[n]=t,e(r)}))));return function(){n.forEach((e=>e())),r.length=0}}}var pr,hr,fr,mr,gr,yr,br,vr,wr,_r,Er,Sr=Symbol("NO_VALUE");function Cr(e){let t=Sr;const r=nr();return{subscribe:r,value:()=>(t===Sr&&(t=e()),t),update(e){t=e,r.emit(t)}}}var xr=class{constructor(e){p(this,mr),p(this,yr),p(this,vr),p(this,_r),p(this,pr,void 0),p(this,hr,null),p(this,fr,void 0),c(this,"singlePageMode",f(this,yr,br).call(this,"features/singlePageModeEnabled")),c(this,"role",f(this,vr,wr).call(this,"role")),c(this,"pageTitleShow",f(this,yr,br).call(this,"page/title/show")),c(this,"pageTitleshowPageTitleTemplate",f(this,yr,br).call(this,"page/title/showPageTitleTemplate")),c(this,"pageTitleAppendPageName",f(this,yr,br).call(this,"page/title/appendPageName")),c(this,"pageTitleShowOnSinglePage",f(this,yr,br).call(this,"page/title/showOnSinglePage")),c(this,"separator",f(this,_r,Er).call(this,"page/title/separator")),c(this,"pageTitleFont",f(this,_r,Er).call(this,"page/title/fontFileUri")),c(this,"dimOutOfPageAreas",f(this,yr,br).call(this,"page/dimOutOfPageAreas")),c(this,"singlePointPanning",f(this,yr,br).call(this,"touch/singlePointPanning")),c(this,"touchPinchAction",f(this,vr,wr).call(this,"touch/pinchAction")),c(this,"touchRotateAction",f(this,vr,wr).call(this,"touch/rotateAction")),c(this,"dragStartCanSelect",f(this,yr,br).call(this,"touch/dragStartCanSelect")),c(this,"featureHspSelectiveAdjustmentsEnabled",f(this,yr,br).call(this,"features/hspSelectiveAdjustmentsEnabled")),c(this,"featureLayerListEnabled",f(this,yr,br).call(this,"features/layerListEnabled")),c(this,"unstable_videoExportInactivityTimeout",Cr((()=>1e4))),h(this,pr,e);const t=nr((()=>{1===t.handlers.size&&f(this,mr,gr).call(this)}),(()=>{var e;0===t.handlers.size&&(null==(e=d(this,hr))||e.call(this))}));h(this,fr,t)}dispose(){var e;d(this,fr).handlers.clear(),null==(e=d(this,hr))||e.call(this)}};pr=new WeakMap,hr=new WeakMap,fr=new WeakMap,mr=new WeakSet,gr=function(){if(d(this,hr))throw new Error("Settings Changed Event callback is already registered.");const e=d(this,pr).onSettingsChanged((()=>{d(this,fr).emit()}));h(this,hr,(()=>{e(),h(this,hr,null)}))},yr=new WeakSet,br=function(e){const t=()=>d(this,pr).getSettingBool(e);return{subscribe:ur((e=>d(this,fr).call(this,e)),or(t),ar(),sr),update:t=>{d(this,pr).setSettingBool(e,t),d(this,fr).emit()},value:t}},vr=new WeakSet,wr=function(e){const t=()=>d(this,pr).getSettingEnum(e);return{subscribe:ur((e=>d(this,fr).call(this,e)),or(t),ar(),sr),update:t=>{d(this,pr).setSettingEnum(e,t),d(this,fr).emit()},value:t}},_r=new WeakSet,Er=function(e){const t=()=>d(this,pr).getSettingString(e);return{subscribe:ur((e=>d(this,fr).call(this,e)),or(t),ar(),sr),update:t=>{d(this,pr).setSettingString(e,t),d(this,fr).emit()},value:t}};var VariableAPI=class{#e;constructor(e){this.#e=e}findAll(){return At(this.#e.findAllVariables())}setString(e,t){return Kt("key",e,zt()),Kt("value",t,zt()),vt(this.#e.setVariableString(e,t))}getString(e){return Kt("key",e,zt()),vt(this.#e.getVariableString(e))}remove(e){return Kt("key",e,zt()),vt(this.#e.removeVariable(e))}},kr={Info:"Info",Warning:"Warning",Error:"Error"};function Tr(e,t){const r=`[UBQ] ${e}`;switch(t){case"Warning":console.warn(r);break;case"Error":console.error(r);break;case"Info":console.info(r);break;default:console.log(r)}}var Ar={baseURL:"/extensions/",entries:["ly.img.cesdk.fonts"]};function Pr(e,t=("undefined"==typeof window?"":window.location.href)){return new URL(e,""===t?void 0:t).href}function qr(e){return"/"!==e[e.length-1]?`${e}/`:e}var Fr=async function(e,t,r=fetch,n,o=new Set(n.findAllSources())){const i=e.map((async e=>{const i=function(e,t){const r=e.endsWith("/"),n=t.startsWith("/");return r&&n?`${e.substring(0,e.length-1)}${t}`:r||n?`${e}${t}`:`${e}/${t}`}(t,`/${e}/content.json`);return r(i).then((e=>{if(!e.ok)throw new Error(e.statusText);return e.json()})).then((r=>{if(void 0===r.assets)throw new Error(`Invalid content.json for assets: ${e}`);const i=r.assets;o.has(e)||n.addLocalSource(e),i.forEach((r=>{r.meta&&Object.entries(r.meta).forEach((([e,n])=>{const o=n.toString();if(o.includes("{{base_url}}")){const n=o.replace("{{base_url}}",t);r.meta&&(r.meta[e]=n)}})),r.payload?.sourceSet&&r.payload.sourceSet.forEach((e=>{e.uri.includes("{{base_url}}")&&(e.uri=e.uri.replace("{{base_url}}",t))})),n.addAssetToSource(e,r)}))}))}));await Promise.all(i)};var Lr=async function(e,t,r,n){const o=["ly.img.sticker","ly.img.vectorpath","ly.img.colors.defaultPalette","ly.img.filter.lut","ly.img.filter.duotone","ly.img.effect","ly.img.blur"].filter((e=>!r.includes(e)));await Fr(o,t,n,e)};var Dr=async function(e,t,r,n,o,i,a="https://cdn.img.ly/assets/demo/v2"){const s=new Set(e.findAllSources()),u="ly.img.image.upload";!o||r.includes(u)||s.has(u)||e.addLocalSource(u,["image/jpeg","image/png","image/webp","image/svg+xml","image/gif","image/bmp"]);const c="ly.img.video.upload";"Video"!==n||!o||r.includes(c)||s.has(c)||e.addLocalSource(c,["video/mp4","video/quicktime"]);const l="ly.img.audio.upload";"Video"!==n||!o||r.includes(l)||s.has(l)||e.addLocalSource(l,["audio/mpeg","audio/x-m4a","audio/m4a","audio/mp3"]);const d=["ly.img.image","ly.img.video","ly.img.audio"].filter((e=>!r.includes(e)));s.has("ly.img.template")||r.includes("ly.img.template")||(e.addLocalSource("ly.img.template",void 0,(async e=>{const r=e.meta?.uri;if(r)if(r.startsWith("UBQ1"))t.applyTemplateFromString(r);else{const e=new URL(r,window.location.href);t.applyTemplateFromURL(e.href)}})),d.push("ly.img.template")),"Video"!==n||s.has("ly.img.video.template")||r.includes("ly.img.video.template")||(e.addLocalSource("ly.img.video.template",void 0,(async e=>{const r=e.meta?.uri;if(r)if(r.startsWith("UBQ1"))t.applyTemplateFromString(r);else{const e=new URL(r,window.location.href);t.applyTemplateFromURL(e.href)}})),d.push("ly.img.video.template")),await Fr(d,a,i,e)};function Br(e,t){let r;const n=new Set;function o(){const n=window.devicePixelRatio,{width:i,height:a}=e.getBoundingClientRect();t(i*n,a*n,n),r=matchMedia(`(resolution: ${n}dppx)`),r.addEventListener("change",o,{once:!0})}o();const i=new ResizeObserver((function([e]){const{width:r,height:o}=e.target.getBoundingClientRect();if(r<=0||o<=0)return;const i=window.devicePixelRatio,a=setTimeout((function(){n.delete(a),t(r*i,o*i,i)}),0);n.add(a)}));return i.observe(e),()=>{r.removeEventListener("change",o),i.disconnect();for(const e of n)clearTimeout(e);n.clear(),e=null,t=null}}var Rr=s(tt()),Mr=(e=>(e.Scene="ubq/designblocks/SceneProps",e.Camera="ubq/designblocks/Camera",e.Common="ubq/designblocks/CommonDesignBlockProps",e.Page="ubq/designblocks/Page",e.Image="ubq/designblocks/Image",e.Video="ubq/designblocks/Video",e.Audio="ubq/designblocks/Audio",e.Sticker="ubq/designblocks/Sticker",e.Text="ubq/designblocks/Text",e.Crop="ubq/types/Crop",e.Scale="ubq/scene/Scale",e.Opacity="ubq/types/Opacity",e.FillColor="ubq/types/FillColor",e.Group="ubq/designblocks/Group",e.VectorPath="ubq/designblocks/VectorPath",e.PendingState="ubq/designblocks/PendingState",e.ErrorState="ubq/designblocks/ErrorState",e.DesignBlockFrame="ubq/designblocks/DesignBlockFrame",e.Size="ubq/layout/Size",e.Position="ubq/layout/Position",e.EulerRotation="ubq/scene/EulerRotation",e.Children="ubq/scene/Children",e))(Mr||{}),Or=Mr,Ir=s(ut());function jr(e,t){const{block:r,event:n}=t;return ur((t=>{const o=r.getType(e),i=(0,Ir.default)(n.subscribe([e],(function(n){n.some((e=>"Destroyed"===e.type))&&!r.isValid(e)||r.getType(e)!==o?i():t(n)})));return i}),sr)}var Ur=function(e,t,r,n){const o=function(e,t){if(!t)return e;let r;return(...n)=>{const o=e(...n);return t(o,r)||(r=o),r}}(t,n?.equals),i=nr();return{subscribe:ur(cr(e,i),or(o),ar(),sr),update:r,value:o,flush:()=>i.emit()}};var $r=class{settings;clampCamera=!1;clampResult=Cr((()=>({sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}})));zoomLevel;#t;viewportPadding=Cr((()=>({x:40,y:48})));autoFit;scrollPercentage;sceneSize;scroll;constructor(e){const{block:t,scene:r,_ubq:n}=e,o=ur(r.onActiveChanged,ir(),or((()=>r.get()))),i=ur(o,or((r=>null!=r&&t.isValid(r)?ur(jr(r,e),ir([]),or((()=>t.getFloat(r,"scene/dpi")))):()=>()=>{})),lr),a=ur(o,or((()=>{const r=t.findByType("camera")[0];return null==r?()=>()=>{}:ur(jr(r,e),ir([]),or((()=>r)))})),lr);this.settings={subscribe:ur(a,or((e=>({width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}))),ar(Rr.default),sr),update({width:e,height:r,pixelRatio:n}){const o=t.findByType("camera")[0];null!=o&&(t.setFloat(o,"camera/resolution/width",e),t.setFloat(o,"camera/resolution/height",r),t.setFloat(o,"camera/pixelRatio",n))},value(){const e=t.findByType("camera")[0];return null==e?{width:0,height:0,pixelRatio:1}:{width:t.getFloat(e,"camera/resolution/width"),height:t.getFloat(e,"camera/resolution/height"),pixelRatio:t.getFloat(e,"camera/pixelRatio")}}},this.zoomLevel=Ur(cr(r.onZoomLevelChanged,i),(()=>{const e=r.get();return null!=e&&t.isValid(e)?r.getZoomLevel():1}),(e=>{const n=r.get();null!=n&&t.isValid(n)&&r.setZoomLevel(e)})),this.#t={subscribe:ur(a,or((e=>new bt(n).getValue(e,Or.Camera,"zoomLevel"))),ar()),value(){const e=t.findByType("camera")[0];return null==e?1:new bt(n).getValue(e,Or.Camera,"zoomLevel")}},this.autoFit=Ur(r.onZoomLevelChanged,(()=>{const e=r.get();return null!=e&&r.isZoomAutoFitEnabled(e)})),this.scrollPercentage={subscribe:ur(this.clampResult.subscribe,or((e=>e.scrollPercentage)),ar(Rr.default)),value:()=>this.clampResult.value().scrollPercentage},this.sceneSize={subscribe:ur(dr(this.clampResult.subscribe,this.#t.subscribe,this.settings.subscribe),or((([e,t,r])=>{const n=e?.sceneSize??this.clampResult.value().sceneSize??{x:0,y:0},o=t??this.#t.value()??10,i=r?.pixelRatio??this.settings.value().pixelRatio??1;return{x:n.x*o/i,y:n.y*o/i}})),ar(Rr.default)),value:()=>{const e=this.clampResult.value().sceneSize??{x:0,y:0},t=this.#t.value()??10,r=this.settings.value().pixelRatio??1;return{x:e.x*t/r,y:e.y*t/r}}},this.scroll=e=>{const r=t.findByType("camera")[0];if(null==r)return;const n=this.#t.value(),o=this.settings.value().pixelRatio,i=e.x*o/n,a=e.y*o/n,s={x:t.getPositionX(r)+i,y:t.getPositionY(r)+a};t.setPositionX(r,s.x),t.setPositionY(r,s.y)}}};function Nr(e,t,r=void 0){const n=e=>{vt(t.setContext("")),e.preventDefault()},o=e=>{vt(t.setContext("!canvas")),r&&r(),e.preventDefault()};return e.addEventListener("webglcontextlost",n,!1),e.addEventListener("webglcontextrestored",o,!1),()=>{e.removeEventListener("webglcontextlost",n),e.removeEventListener("webglcontextrestored",o)}}var Hr=!1;var Vr="https://api.img.ly/activate";var Wr=s(lt()),zr="./cesdk-v1.23.0-rc.2-GD242ZBP.data",Gr="./cesdk-v1.23.0-rc.2-WC3FZVES.wasm",Yr=Wr.default,Xr=!("undefined"==typeof window||!window.document||!window.document.createElement)&&navigator&&navigator.userAgent||"",Zr=-1!==Xr.indexOf("Edge"),Kr=!!Xr.match(/msie|trident/i),Qr=/\b(iPad|iPhone|iPod)\b/.test(Xr)&&/WebKit/.test(Xr)&&!/Edge/.test(Xr)&&("undefined"==typeof window||!("MSStream"in window)),Jr=(e,t)=>{if(null!=t){return[t,e.split("/").pop()].join("")}return new URL(e,window.location.origin)};function en(){try{return new WebAssembly.Memory({initial:tn(Qr?512:32),maximum:tn(2048)})}catch(e){return new WebAssembly.Memory({initial:tn(32),maximum:tn(2048)})}}function tn(e){return 1024*e*1024/65536}async function rn(e,t){const{core:r}=t,n=t.logger,o=Jr(Gr,r.baseURL).toString(),i=Jr(zr,r.baseURL).toString(),a=/electron/i.test(navigator.userAgent),s=function(e,t=fetch){if(!e.license)throw new Error("Missing license key in config");return e.license.length<128?t(Vr,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:e.license,userId:e.userId})}).then((e=>{if(e.ok)return e.json();throw new Error("Unfortunately we are experiencing a server down time and your License key cannot be validated. We're already working on a fix and will restore service soon. Should services not restore within the hour, kindly get in touch with our support team.")})).then((e=>{if("valid"===e.status)return e.license;throw"expired"===e.status?new Error("Thanks for using IMG.LY for creative editing. Please note that your license file or commercial use is expired. Please get in touch with our sales team to discuss extension of your commercial license."):new Error("The License Key (API Key) you are using to access the IMG.LY SDK is invalid. Please ensure that you are using the license key tied to your subscription and get in touch with our support team.")})):Promise.resolve(e.license)}(t),u=a?await fetch(i,{credentials:"same-origin"}).then((e=>e.arrayBuffer())).then((e=>function(t,r){if(t!==i)return null;if(r===e.byteLength)return e;throw new Error(`Attempt to get preloaded package of unknown name or size: ${t} ${r}`)})):void 0;return new Promise(((r,a)=>{const c={getPreloadedPackage:u,locateFile:(e,t)=>e.endsWith(".wasm")?o:e.endsWith(".data")?i:t+e,print:e=>{e&&"undefined"!==e&&n(e,"Info")},printErr:e=>{e&&"undefined"!==e&&n(e,"Error")},logReadFiles:!1,printWithColors:!0,wasmMemory:en()};Yr(c).then((async n=>{n.specialHTMLTargets["!canvas"]=e;n.emscripten_ubq_settings_forceWebGL1=!!t?.forceWebGL1;const o=vt(n.createEngine("!canvas",t.audioOutput??"auto"));!function(e,t){if(!t)throw new Error("Missing license key");vt(e.unlockWithLicense(t))}(o,await s),function(e,t){const r=new bt(e),n=new EditorAPI(e),o=new AssetAPI(e);n.setSettingEnum("role",t.role??"Creator"),"Adopter"===t.role&&n.setSettingEnum("doubleClickSelectionMode","Direct"),Hr&&(r.execute("cesdk/getVersionInfo").then((e=>console.debug(e))),r.execute("cesdk/getCapabilitiesInfo").then((e=>console.debug(e)))),n.setSettingString("basePath",t.baseURL),n.setSettingBool("showBuildVersion",Hr||!1),t.featureFlags?.preventScrolling&&(n.setSettingBool("touch/singlePointPanning",!1),n.setSettingBool("touch/dragStartCanSelect",!1)),o.addLocalSource("ly.img.text"),Object.entries(t.presets.typefaces||{}).forEach((([e,t])=>{(t.fonts||[]).forEach((n=>{const o=`${e}_${n.weight}_${n.style}`;r.execute("ubq/assets/registerFont",[o,n.fontURL,t.family,n.weight,n.style])}))})),function(){Hr&&(n.setSettingBool("features/hspSelectiveAdjustmentsEnabled",!1),n.setSettingBool("features/layerListEnabled",!1),n.setSettingBool("features/templatingEnabled",!0));const e=!!t.featureFlags?.singlePageMode;n.setSettingBool("features/singlePageModeEnabled",e),n.setSettingBool("features/effectsEnabled",!0)}(),function(){const e=t.extensions??[];e.entries.forEach((t=>{r.execute("ubq/extension/register",`${e.baseURL+t}`)}))}(),function(){const t=new VariableAPI(e);(Hr||"undefined"!=typeof window&&window.Cypress)&&(t.setString("company_name","img.ly"),t.setString("first_name","Charly"),t.setString("last_name","Williams"),t.setString("address","742 Evergreen Terrace"),t.setString("city","Springfield"))}(),t.license.length<128&&n.startTracking(t.license,t.userId??"")}(o,t),r(o)})).catch(a)}))}async function nn(e){const t=new Function("url","return import(url)"),r=await t(e);if(void 0!==r.initialize&&"function"!=typeof r.initialize)throw new Error(`Plugin ${e} exports an 'initialize' property, but is is not a function`);if(void 0!==r.update&&"function"!=typeof r.update)throw new Error(`Plugin ${e} exports an 'update' property, but it is not a function`);return r}var on=class{_reactor;_updateHandler=null;debugName;dirty=!0;readCalls=new Set;constructor(e,t){this.debugName=t,this._reactor=e}dispose(){this._updateHandler=null,this._reactor._unregisterReaction(this),this._reactor=null}track(e){return this._reactor._trackReaction(this,e)}subscribe(e){return this._reactor._registerReaction(this),this._updateHandler=e,()=>{this._updateHandler=null,this._reactor._unregisterReaction(this)}}update(){this._updateHandler?.()}},an=s(tt()),sn=Symbol("NO_VALUE"),un=class{callId;_value;_readCurrentValue;constructor(e,t){this.callId=e,this._value=t(),this._readCurrentValue=t}updateValueAndCheckDirty(){try{const e=this._readCurrentValue();return(0,an.default)(this._value,e)?(this._value=e,!1):(this._value=e,!0)}catch(e){return this._value=sn,!0}}update(e){this._readCurrentValue=e}},cn=class{readCalls=new Map;readCache=new Map;registeredReactions=new Set;activeReactions=new Set;updatingDirtyReactions=0;_getterCalled(e,t){if(this.activeReactions.size<=0)return;const r=this._readThroughCache.bind(this,e,t);if(this.readCalls.has(e)){this.readCalls.get(e).update(r)}else this.readCalls.set(e,new un(e,r));for(const t of this.activeReactions)t.readCalls.add(e)}_setterCalled(){this._clearReadCache()}_readThroughCache(e,t){if(this.updatingDirtyReactions&&this.readCache.has(e))return this.readCache.get(e);const r=t();return this.readCache.set(e,r),r}wrapUpdateReactor=function(e){if(this.#r>10)throw new Error("Too many nested engine updates");const t=this.#r++;t>1&&console.warn("wrapUpdateReactor: nested update detected",t);try{e(),this.updateDirtyReactions()}finally{if(--this.#r!==t)throw new Error("Unexpected engine update nesting")}}.bind(this);#r=0;createReaction(e){return new on(this,e)}_registerReaction(e){this.registeredReactions.add(e)}_unregisterReaction(e){this.registeredReactions.delete(e)}_clearReadCache(){this.readCache.clear()}_cleanupReadCalls(){const e=new Set;for(const t of this.registeredReactions)for(const r of t.readCalls)e.add(r);for(const[t]of this.readCalls)e.has(t)||this.readCalls.delete(t)}#n=new Set;updateDirtyReactions(){try{this.updatingDirtyReactions++,this._clearReadCache();const e=new Set;for(const[t,r]of this.readCalls)r.updateValueAndCheckDirty()&&e.add(t);if(e.size>0)for(const t of this.registeredReactions)for(const r of t.readCalls)if(e.has(r)){t.dirty=!0;break}for(const e of this.registeredReactions)if(!this.#n.has(e)&&e.dirty){this.#n.add(e);try{e.update()}finally{this.#n.delete(e)}e.dirty=!1}this._cleanupReadCalls()}finally{this.updatingDirtyReactions--}}_trackReaction(e,t){try{return this.activeReactions.add(e),e.readCalls.clear(),t()}finally{e.dirty=!1,this.activeReactions.delete(e)}}decorateFunction(e,t){return function(e,t,r=t.name){yt[r]??=0;const n=yt[r]++;return function(...o){const i=this,a=`${r}${n}-${JSON.stringify(o,null,0)}`;function s(){return Reflect.apply(t,i,o)}return e._getterCalled(a,s),e._readThroughCache(a,s)}}(this,e,t)}decorateObject(e){return function(e,t){const r=t.constructor?.name??crypto.randomUUID(),n=[];let o=!1;const i=Object.getOwnPropertyNames(t.constructor.prototype).concat(Object.getOwnPropertyNames(t));for(const s of i){const i=t[s];if("function"==typeof(a=i)&&ht in a)if("getter"===i[ht].type){let a=function(...t){if(o)throw new Error("Disposed @getter proxy called");const n=this,a=`${r}-${s.toString()}-${JSON.stringify(t,null,0)}`;function u(){return Reflect.apply(i,n,t)}return e._getterCalled(a,u),e._readThroughCache(a,u)};const u=Object.hasOwnProperty.call(t,"fnName")?()=>{t[s]=i}:()=>delete t[s];n.push(u),t[s]=a}else if("setter"===i[ht].type){let r=function(...t){if(o)throw new Error("Disposed @setter proxy called");const r=this;return e._setterCalled(),Reflect.apply(i,r,t)};const a=Object.hasOwnProperty.call(t,"fnName")?()=>{t[s]=i}:()=>delete t[s];n.push(a),t[s]=r}}var a;return function(){o=!0;for(const e of n)e();n.length=0}}(this,e)}dispose(){this.registeredReactions.forEach((e=>e.dispose())),this.registeredReactions.clear(),this.readCalls.clear(),this.activeReactions.clear(),this.readCache.clear()}},ln='url("data:image/svg+xml,%3Csvg width=%2722%27 height=%2725%27 viewBox=%270 0 22 25%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cg filter=%27url(%23filter0_d)%27%3E%3Cpath d=%27M18 11.1071C18 14.5637 15.5566 17.4515 12.3314 18.0846V20L7.20308 17.0145L12.3314 14.0289V15.7825C14.3292 15.1951 15.7946 13.3221 15.7946 11.107C15.7946 8.42285 13.6437 6.23908 11 6.23908C8.35629 6.23908 6.20542 8.42285 6.20542 11.107C6.20542 11.8299 6.35745 12.5252 6.65738 13.1736L4.66118 14.1255C4.22245 13.1771 4 12.1616 4 11.1071C4.00007 7.18825 7.1403 4 11.0001 4C14.8599 4 18 7.18825 18 11.1071Z%27 fill=%27black%27/%3E%3Cpath d=%27M12.8314 15.0559V14.0289V13.1593L12.0799 13.5968L6.95152 16.5824L6.20927 17.0145L6.95152 17.4466L12.0799 20.4321L12.8314 20.8696V20V18.4841C16.0889 17.6521 18.5 14.6573 18.5 11.1071C18.5 6.9193 15.1431 3.5 11.0001 3.5C6.85702 3.5 3.50008 6.91929 3.5 11.1071V11.1071C3.5 12.2334 3.73793 13.3206 4.20739 14.3354L4.41978 14.7946L4.8764 14.5768L6.8726 13.6249L7.31866 13.4122L7.11118 12.9637C6.84206 12.3819 6.70542 11.7584 6.70542 11.107C6.70542 8.69181 8.63956 6.73908 11 6.73908C13.3604 6.73908 15.2946 8.69181 15.2946 11.107C15.2946 12.8513 14.2837 14.3564 12.8314 15.0559Z%27 stroke=%27white%27/%3E%3C/g%3E%3Cdefs%3E%3Cfilter id=%27filter0_d%27 x=%270.0599999%27 y=%270.0599999%27 width=%2721.88%27 height=%2724.6193%27 filterUnits=%27userSpaceOnUse%27 color-interpolation-filters=%27sRGB%27%3E%3CfeFlood flood-opacity=%270%27 result=%27BackgroundImageFix%27/%3E%3CfeColorMatrix in=%27SourceAlpha%27 type=%27matrix%27 values=%270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0%27/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation=%271.47%27/%3E%3CfeColorMatrix type=%27matrix%27 values=%270 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0%27/%3E%3CfeBlend mode=%27normal%27 in2=%27BackgroundImageFix%27 result=%27effect1_dropShadow%27/%3E%3CfeBlend mode=%27normal%27 in=%27SourceGraphic%27 in2=%27effect1_dropShadow%27 result=%27shape%27/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 12 12, pointer';function dn(e,t){let r;return t.onStateChanged((()=>{const n=function(e,t){switch(e){case"Arrow":return"default";case"Move":return"move";case"MoveNotPermitted":return"auto";case"Resize":{const e=180*t/Math.PI+45;if(!Kr&&!Zr)return`url("data:image/svg+xml,%3Csvg style='transform: rotate(${e}deg)' width ='22' height ='22' viewBox ='0 0 22 22' fill ='none' xmlns ='http://www.w3.org/2000/svg'%3E%3Cg filter ='url(%23filter0_d)'%3E%3Cpath d ='M13.7 11.1L9.7 15.2L12.5 18H4V9.5L6.9 12.3L10.9 8.3L12.3 6.9L9.5 4H18V12.5L15.2 9.7L13.7 11.1Z' fill ='white'/%3E%3C/g%3E%3Cpath d ='M12.7 10.7L8.3 15.2L10.1 17H5V11.9L6.9 13.8L11.3 9.3L13.8 6.9L11.9 5H17V10.1L15.2 8.3L12.7 10.7Z' fill ='black'/%3E%3Cdefs%3E%3Cfilter id ='filter0_d' x ='0' y ='0' width ='22' height ='22' filterUnits ='userSpaceOnUse' color-interpolation-filters ='sRGB'%3E%3CfeFlood flood-opacity ='0' result ='BackgroundImageFix'/%3E%3CfeColorMatrix in ='SourceAlpha' type ='matrix' values ='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0'/%3E%3CfeOffset/%3E%3CfeGaussianBlur stdDeviation ='2'/%3E%3CfeColorMatrix type ='matrix' values ='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0'/%3E%3CfeBlend mode ='normal' in2 ='BackgroundImageFix' result ='effect1_dropShadow'/%3E%3CfeBlend mode ='normal' in ='SourceGraphic' in2 ='effect1_dropShadow' result ='shape'/%3E%3C/filter%3E%3C/defs%3E%3C/svg%3E") 12 12, pointer`;switch(e){case 90:case 270:return"nwse-resize";case 135:case 315:return"ns-resize";case 180:case 360:return"nesw-resize";case 225:return"ew-resize";default:return"move"}}case"Rotate":return ln;case"Text":return"text";default:return"auto"}}(t.getCursorType(),t.getCursorRotation());if(n!==r){r=n;const t=new CustomEvent("cesdk-cursor",{composed:!0,bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(t)&&e.style.setProperty("cursor",n)}}))}var pn=function(e,t,r,n){let o,i=null;const a=r.onStateChanged((()=>{o=r.getEditMode(),"Text"!==o||i?"Text"!==o&&i&&(i(),i=null):i=function(){const o=i();return()=>{o?.()};function i(){let o=!1,i="";if(null==e.parentElement)return console.warn('Could not attach hidden text input to the DOM: Canvas has no parentElement. This can happen if edit mode is switched to "Text", while the canvas is removed from the DOM.'),()=>{};const a=u();l();const s=d();return e.parentElement.appendChild(a),p(),()=>{s(),c()};function u(){const e=document.createElement("textarea");return e.id="ubq_internal-inline_text_editing_html_representation",e.setAttribute("data-cy","inline-text-editing-input"),e.autocapitalize="none",e.spellcheck=!1,e.cols=4096,e.style.contain="strict",e.style.opacity="0",e.style.pointerEvents="none",e.style.zIndex="-1",e.style.position="fixed",e.style.width="1px",e.style.height="1px",e.style.padding="0",e.style.margin="-1px",e.style.overflow="hidden",e.style.clip="rect(0, 0, 0, 0)",e.style.border="0",e}function c(){a.blur(),a.remove()}function l(){const t=r.getTextCursorPositionInScreenSpaceX(),n=r.getTextCursorPositionInScreenSpaceY(),{left:o,top:i}=e.getBoundingClientRect();a.style.left=`${o+t/window.devicePixelRatio}px`,a.style.top=`${i+n/window.devicePixelRatio}px`}function d(){const t=e.getRootNode();a.addEventListener("input",v),a.addEventListener("keydown",_),a.addEventListener("copy",g),a.addEventListener("cut",y),a.addEventListener("compositionstart",E),a.addEventListener("compositionend",S),a.addEventListener("beforeinput",T),a.addEventListener("focusout",A),t.addEventListener("touchend",k),t.addEventListener("mousedown",k),t.addEventListener("mouseup",x);const n=r.onStateChanged((()=>{l()}));return()=>{a.removeEventListener("input",v),a.removeEventListener("keydown",_),a.removeEventListener("copy",g),a.removeEventListener("cut",y),a.removeEventListener("compositionstart",E),a.removeEventListener("compositionend",S),a.removeEventListener("beforeinput",T),a.removeEventListener("focusout",A),t.removeEventListener("mousedown",k),t.removeEventListener("mouseup",x),t.removeEventListener("touchend",k),n()}}function p(){null!==a.parentElement&&(a.focus(),h()||setTimeout((()=>a.focus()),0))}function h(){return a.getRootNode().activeElement===a}function f(e){return[...e].length}function m(e){const t=e.selectionEnd??e.selectionStart??0;return f(e.value.substring(0,t))}function g(e){try{t.useInternalAPI((t=>{const r=vt(t.getSelectedText());""!==r&&e.clipboardData&&(e.clipboardData.setData("text/plain",r),e.preventDefault())}))}catch(e){console.error(e)}}function y(e){try{t.useInternalAPI((r=>{const n=vt(r.getSelectedText());if(""!==n&&e.clipboardData){e.clipboardData.setData("text/plain",n),e.preventDefault();const r={key:44,characters:"",shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",r)}}))}catch(e){console.error(e)}}async function b(){return!(!o||t.ubq.unstable_isTextCursorInCompositionRange())&&(await S(),!0)}function v(e){const r=e.target,{value:n}=r;if(o){const e=m(a);t.execute("ubq/text/compositionUpdate",{value:n,cursorPosition:e})}else n.length>0&&(r.value="")}function w(e){const r={key:255,characters:e,shiftIsHeld:!1,commandIsHeld:!1,optionIsHeld:!1,timestamp:Date.now()};t.execute("ubq/inputs/keyboardkey",r)}async function _(e){if(b(),1===e.key.length&&(i=e.key),"a"===e.key&&(e.metaKey||e.ctrlKey))return o&&S(),void await t.execute("ubq/text/selectAllText");if("Escape"===e.key)return void L();if("Backspace"!==e.key&&"Delete"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key&&"ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"Enter"!==e.key)return;const r=function(e){const t={key:255,characters:e.key,shiftIsHeld:e.shiftKey,commandIsHeld:e.metaKey||e.ctrlKey,optionIsHeld:e.altKey,timestamp:Date.now()};switch(e.key.toUpperCase()){case"0":t.key=0;break;case"1":t.key=1;break;case"2":t.key=2;break;case"3":t.key=3;break;case"4":t.key=4;break;case"5":t.key=5;break;case"6":t.key=6;break;case"7":t.key=7;break;case"8":t.key=8;break;case"9":t.key=9;break;case"A":t.key=10;break;case"B":t.key=11;break;case"C":t.key=12;break;case"D":t.key=13;break;case"E":t.key=14;break;case"F":t.key=15;break;case"G":t.key=16;break;case"H":t.key=17;break;case"I":t.key=18;break;case"J":t.key=19;break;case"K":t.key=20;break;case"L":t.key=21;break;case"M":t.key=22;break;case"N":t.key=23;break;case"O":t.key=24;break;case"P":t.key=25;break;case"Q":t.key=26;break;case"R":t.key=27;break;case"S":t.key=28;break;case"T":t.key=29;break;case"U":t.key=30;break;case"V":t.key=31;break;case"W":t.key=32;break;case"X":t.key=33;break;case"Y":t.key=34;break;case"Z":t.key=35;break;case" ":t.key=42;break;case"ESCAPE":t.key=43,t.characters="";break;case"BACKSPACE":t.key=40,t.characters="";break;case"DELETE":t.key=44,t.characters="";break;case"ENTER":t.key=41,t.characters=t.shiftIsHeld?"\u2028":"\n";break;case"CONTROL":t.key=45,t.characters="";break;case"ALT":t.key=46,t.characters="";break;case"SHIFT":t.key=47,t.characters="";break;case"ARROWLEFT":t.key=36,t.characters="";break;case"ARROWRIGHT":t.key=37,t.characters="";break;case"ARROWUP":t.key=38,t.characters="";break;case"ARROWDOWN":t.key=39,t.characters="";break;case"DEAD":t.key=255,t.characters=""}return t}(e);await t.execute("ubq/inputs/keyboardkey",r),e.currentTarget&&(a.value="")}async function E(){o=!0,await t.execute("ubq/text/compositionStart")}async function S(){o?(o=!1,a.value="",t.execute("ubq/text/compositionEnd")):a.value=""}async function C(){if(!o)return;n();if(await b())return;const e=t.ubq.unstable_getCursorPosition(),r=t.ubq.unstable_getCompositionRange(),i=e.end-r.start,s=m(a);e.start>=r.start&&e.start<=1+r.end&&i!==s&&S()}async function x(){C()}async function k(t){C(),t.target===e&&"Text"===r.getEditMode()&&(p(),t.preventDefault())}async function T(e){if(o&&!e.isComposing&&S(),null===e.data)return;const r=e.target,n=e.data;if(await b())w(i);else if(o){const e=f(n);t.execute("ubq/text/compositionUpdate",{value:n,cursorPosition:e})}else n.length>0&&("\n"!==n[0]&&w(n),r.value="")}function A(e){if(F(e.relatedTarget)&&P(e.relatedTarget));else{q(e)}}function P(t){const r=new CustomEvent("cesdk-blur",{composed:!0,bubbles:!0,cancelable:!0,detail:t});return e.dispatchEvent(r)}function q(t){const r=new CustomEvent("cesdk-refocus",{composed:!0,bubbles:!0,cancelable:!0,detail:t.relatedTarget}),n=e.dispatchEvent(r);return n&&p(),n}function F(e){return null!=e&&(e instanceof HTMLElement&&(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&e.type.match("^(text|number|url|email|search|tel)$")||e.isContentEditable))}async function L(){r.setEditMode("Transform")}}}()}));return()=>{i?.(),a()}};function hn(e,t,r){const n=[],o=r=>{if("touch"===r.pointerType)return;const n=fn(e,r);t.execute("ubq/inputs/mousemove",n)},i=o=>{if("touch"===o.pointerType)return;const i={...fn(e,o),button:mn(o.button),state:0,shiftIsHeld:!!o.shiftKey};n[o.button]=!1,o.currentTarget.releasePointerCapture(o.pointerId),t.execute("ubq/inputs/mousebutton",i),r()},a=r=>{if("touch"===r.pointerType)return;const o={...fn(e,r),button:mn(r.button),state:1,shiftIsHeld:!!r.shiftKey};n[r.button]=!0,r.currentTarget.setPointerCapture(r.pointerId),t.execute("ubq/inputs/mousebutton",o)},s=r=>{if("touch"===r.pointerType)return;const o={...fn(e,r),shiftIsHeld:!!r.shiftKey};n.forEach(((e,r)=>{if(e){const e={...o,button:r,state:0};t.execute("ubq/inputs/mousebutton",e)}})),n.length=0},u=e=>{e.cancelable&&e.preventDefault()};return e.addEventListener("pointerdown",a),e.addEventListener("pointerup",i),e.addEventListener("pointercancel",i),e.addEventListener("pointermove",o),e.addEventListener("lostpointercapture",s),e.addEventListener("touchmove",u,{passive:!1}),()=>{e.removeEventListener("pointerdown",a),e.removeEventListener("pointerup",i),e.removeEventListener("pointercancel",i),e.removeEventListener("pointermove",o),e.removeEventListener("lostpointercapture",s),e.removeEventListener("touchmove",u),e=null}}function fn(e,t){const r=e.getBoundingClientRect(),n=r?.top??0,o=r?.left??0;return{position:{x:(t.clientX-o)*window.devicePixelRatio,y:(t.clientY-n)*window.devicePixelRatio},isTouch:!1,timestamp:t.timeStamp}}function mn(e){switch(e){case 0:return 0;case 1:return 2;case 2:return 1;default:return 255}}var gn=class{ubq;enabled;initialTarget;target;dispose;constructor(e,t){this.ubq=t,this.enabled=Ur(e.editor.onSettingsChanged,(()=>{const t=e.editor.getSettingBool("mouse/enableZoom"),r=e.editor.getSettingBool("mouse/enableScroll");return t||r})),this.target=Cr((()=>{})),this.dispose=()=>{this.target.update(void 0),this.target=null,this.enabled=null,this.ubq=null,this.initialTarget=null,e=null,t=null}}initialize(e){let t;this.initialTarget=e;const r=cr(this.enabled.subscribe,this.target.subscribe)((()=>{t?.(),t=void 0;const e=this.target.value();this.enabled.value()&&e&&(t=this.addWheelListener(e))}));this.target.update(e);return()=>{r(),t?.()}}setTarget(e){this.target.update(e);return()=>{this.target.update(this.initialTarget)}}addWheelListener(e){const t=e=>{if(!this.initialTarget)throw new Error("initialTarget is not set");const t={...fn(this.initialTarget,e),deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode,shiftIsHeld:!!e.shiftKey,ctrlOrMetaIsHeld:!!e.ctrlKey||!!e.metaKey};this.ubq.mouseWheel(t)&&(e.stopPropagation(),e.preventDefault())};e.addEventListener("wheel",t,{passive:!1,capture:!0});return()=>{e.removeEventListener("wheel",t,{capture:!0}),e=null}}},yn=class{active=!1;enableDebug=!1;timestamp=0;baseTouches=[];touches=[];currentTransform;constructor(){this.currentTransform=this.emptyTransform()}touchAddRemove(e){const t=new Array(e.touches.length);for(let r=0;r<e.touches.length;r++){const n=e.touches.item(r);t[r]=bn(n)}this.touches=t}touchUpdate(e){for(let t=0;t<e.touches.length;t++){const r=e.touches.item(t),n=this.touches.find((e=>e.identifier===r.identifier));if(!n)return;n.x=r.clientX,n.y=r.clientY}}listen(e){return e.addEventListener("touchstart",this.touchstart),e.addEventListener("touchend",this.touchend),e.addEventListener("touchcancel",this.touchcancel),e.addEventListener("touchmove",this.touchmove),()=>{e.removeEventListener("touchstart",this.touchstart),e.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.touchcancel),e.removeEventListener("touchmove",this.touchmove)}}touchstart=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchstart")};touchend=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchend")};touchcancel=e=>{this.touchAddRemove(e),this.timestamp=e.timeStamp,this.process("touchcancel")};touchmove=e=>{this.touchUpdate(e),this.timestamp=e.timeStamp,this.process("touchmove")};debugState;debug(){if(!this.enableDebug)return;const e=JSON.stringify(this.currentTransform);function t(e,[t,r,n],o){const i=document.createElement("div");return i.style.position="fixed",i.style.top="-25px",i.style.left="-25px",i.style.width="50px",i.style.height="50px",i.style.border=`3px ${o} rgb(${t},${r},${n})`,i.style.borderRadius="50%",i.style.borderStyle=o,i.style.backgroundColor=`rgba(${t},${r},${n}, 0.5)`,i.style.transformOrigin="center",i.style.textAlign="center",i.innerHTML=e,i.style.display="none",document.body.appendChild(i),i}this.debugState||(this.debugState={touches:[t("T1",[218,212,104],"solid"),t("T2",[218,212,104],"solid")],value:this.debugValueDiv(void 0,e,this.touches,[218,212,104]),baseTouches:[t("B1",[128,128,128],"solid"),t("B2",[128,128,128],"solid")]}),this.debugState.touches[0].style.display=this.touches[0]?"block":"none",this.debugState.touches[1].style.display=this.touches[1]?"block":"none",this.debugState.baseTouches[0].style.display=this.baseTouches[0]?"block":"none",this.debugState.baseTouches[1].style.display=this.baseTouches[1]?"block":"none",this.touches[0]&&(this.debugState.touches[0].style.transform=`translate(${this.touches[0]?.x}px, ${this.touches[0]?.y}px)`),this.touches[1]&&(this.debugState.touches[1].style.transform=`translate(${this.touches[1]?.x}px, ${this.touches[1]?.y}px)`),this.baseTouches[0]&&(this.debugState.baseTouches[0].style.transform=`translate(${this.baseTouches[0]?.x}px, ${this.baseTouches[0]?.y}px)`),this.baseTouches[1]&&(this.debugState.baseTouches[1].style.transform=`translate(${this.baseTouches[1]?.x}px, ${this.baseTouches[1]?.y}px)`),this.debugState.value=this.debugValueDiv(this.debugState.value,e,this.touches)}debugValueDiv(e,t,r,n){if(!e){const[t,r,o]=n??[128,128,128];(e=document.createElement("div")).style.position="fixed",e.style.top="50px",e.style.left="50px",e.style.width="300px",e.style.height="100px",e.style.border=`3px solid rgb(${t},${r},${o})`,e.style.borderStyle="dashed",e.style.backgroundColor=`rgba(${t},${r},${o}, 0.5)`,e.style.transformOrigin="center",e.style.overflow="visible",e.style.textOverflow="visible",e.style.display="none",document.body.appendChild(e)}return this.active?e.style.borderStyle="solid":e.style.borderStyle="dashed",0===r.length?(e.style.display="none",e):(e.style.display="block",e.innerHTML=t,e)}resetBaseTouches(){this.baseTouches=this.touches.map(bn)}process(e){if("touchcancel"===e)return this.resetBaseTouches(),this.reset(),this.debug(),void this.emit(2);"touchstart"!==e&&"touchend"!==e||(this.resetBaseTouches(),this.debug()),!this.active&&this.shouldStart()&&(this.active=!0,this.emit(0)),"touchmove"===e&&(this.currentTransform=this.calculateTransform(),this.active&&this.emit(1)),this.debug(),this.active&&this.shouldStop()&&(this.active=!1,this.emit(2),this.reset())}shouldStart(){return 2===this.touches.length}shouldStop(){return 2!==this.touches.length}emit(e){const t={timestamp:this.timestamp,state:e,touchPoints:this.touches},r=this.makeEvent(t);for(const e of this.handlers)e(r)}handlers=new Set;addListener(e){return this.handlers.add(e),()=>{this.handlers.delete(e)}}reset(){this.active=!1,this.currentTransform=this.emptyTransform()}};function bn(e){if(null!=e)return e instanceof Touch?{identifier:e.identifier,x:e.clientX,y:e.clientY}:{identifier:e.identifier,x:e.x,y:e.y}}var vn=class _PanRecognizer extends yn{static PAN_THRESHOLD=10;makeEvent(e){const t=0===e.state?{x:0,y:0}:this.currentTransform;return{...e,panDistance:t}}calculateTransform(){const e=_n(this.touches),t=_n(this.baseTouches);return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return super.shouldStart()&&wn(this.calculateTransform())>_PanRecognizer.PAN_THRESHOLD}};function wn(e){return Math.sqrt(e.x**2+e.y**2)}function _n(e){let t=0,r=0;for(let n=0;n<e.length;n++){const o=e[n];t+=o.x,r+=o.y}return t/=e.length,r/=e.length,{x:t,y:r}}var En=class _PinchRecognizer extends yn{static PINCH_THRESHOLD=.2;makeEvent(e){return{...e,scale:this.currentTransform}}calculateTransform(){const e=this.baseTouches,t=this.touches;if(2!==e.length||2!==t.length)return 1;const r=Math.sqrt(Math.pow(e[0].x-e[1].x,2)+Math.pow(e[0].y-e[1].y,2));return Math.sqrt(Math.pow(t[0].x-t[1].x,2)+Math.pow(t[0].y-t[1].y,2))/r}emptyTransform(){return 1}shouldStart(){return super.shouldStart()&&Math.abs(this.calculateTransform()-1)>_PinchRecognizer.PINCH_THRESHOLD}},Sn=class _PointRecognizer extends yn{static DISTANCE_THRESHOLD=5;static TAP_MAX_TIME=250;lastPosition={x:0,y:0};makeEvent(e){const t=this.tapDetected?this.tapLocation:e.touchPoints[0];return 0===e.state?(this.lastPosition=t,{button:0,state:1,position:t,shiftIsHeld:!1,isTouch:!0,timestamp:e.timestamp}):2===e.state?{button:0,state:0,position:t??this.lastPosition,shiftIsHeld:!1,isTouch:!0,timestamp:e.timestamp}:(this.lastPosition=t,{position:t,isTouch:!0,timestamp:e.timestamp})}previousNumTouches=0;fingerDownTimestamp=0;tapDetected=!1;tapLocation={x:0,y:0};process(e){if("touchstart"===e||"touchend"===e){this.tapDetected=!1;const e=1===this.touches.length&&0===this.previousNumTouches,t=0===this.touches.length&&1===this.previousNumTouches;e&&(this.fingerDownTimestamp=performance.now(),this.tapLocation=this.touches[0]),t&&performance.now()-this.fingerDownTimestamp<_PointRecognizer.TAP_MAX_TIME&&(this.tapDetected=!0),this.previousNumTouches=this.touches.length}super.process(e)}calculateTransform(){if(0===this.touches.length||0===this.baseTouches.length)return{x:0,y:0};const e=this.touches[0],t=this.baseTouches[0];return{x:e.x-t.x,y:e.y-t.y}}emptyTransform(){return{x:0,y:0}}shouldStart(){return this.tapDetected||1===this.touches.length&&wn(this.calculateTransform())>_PointRecognizer.DISTANCE_THRESHOLD}shouldStop(){return 1!==this.touches.length}},Cn=class _RotateRecognizer extends yn{static ROTATE_THRESHOLD=.1;makeEvent(e){return{...e,rotation:this.currentTransform}}calculateTransform(){const e=this.baseTouches,t=this.touches;if(e.length<2||t.length<2)return 0;const r=Math.atan2(e[1].y-e[0].y,e[1].x-e[0].x);return Math.atan2(t[1].y-t[0].y,t[1].x-t[0].x)-r}emptyTransform(){return 0}shouldStart(){return super.shouldStart()&&Math.abs(this.calculateTransform())>_RotateRecognizer.ROTATE_THRESHOLD}};function xn(e,t){const r=[],n=new Sn;r.push(n.listen(e)),r.push(n.addListener((r=>{"button"in r?t.execute("ubq/inputs/mousebutton",kn(e,r)):t.execute("ubq/inputs/mousemove",kn(e,r))})));const o=new vn;r.push(o.listen(e)),r.push(o.addListener((r=>{t.execute("ubq/inputs/touchpan",kn(e,r))})));const i=new En;r.push(i.listen(e)),r.push(i.addListener((r=>{t.execute("ubq/inputs/touchpinch",kn(e,r))})));const a=new Cn;return r.push(a.listen(e)),r.push(a.addListener((r=>{t.execute("ubq/inputs/touchrotate",kn(e,r))}))),()=>{r.forEach((e=>e()))}}function kn(e,t){const r=window.devicePixelRatio??1,{top:n,left:o}=e.getBoundingClientRect();if(1===r&&0===n&&0===o)return t;const i=e=>({x:(e.x-o)*r,y:(e.y-n)*r});if("position"in t)return{...t,position:i(t.position)};const a=t.touchPoints.map(i);return"panDistance"in t?{...t,touchPoints:a,panDistance:i(t.panDistance)}:{...t,touchPoints:a}}function Tn(e,t,r=Number.EPSILON){return Math.abs(e-t)<r}var An,Pn,qn="assets/core/worker-host-v1.23.0-rc.2-YDNQ4BKA.js",Fn="application/javascript";(Pn=An||(An={})).start=function(e){return{...e,msg:"exportVideo"}},Pn.abort=function(){return{msg:"exportVideoAbort"}},Pn.finished=function(e){return{...e,msg:"exportVideoFinished"}},Pn.error=function(e){return{...e,msg:"exportVideoError"}},Pn.progress=function(e){return{...e,msg:"exportVideoProgress"}},Pn.log=function(e){return{...e,msg:"exportLog"}};var Ln=class{configuration;constructor(e){this.configuration=e}async exportVideo(e,t,r,n,o,i){const{abortSignal:a,inactivityTimeout:s}=o??{},u=await async function(e){const t=qn.toString().split("/").pop(),r=await async function(e){if(!(e=e.toString()).includes("://")||e.includes(window.location.origin))return e;const t=`const _importScripts = importScripts;\n const _fixImports = (url) => new URL(url, '${new URL(e).href.split("/").slice(0,-1).join("/")}/').href;\n importScripts = (...urls) => _importScripts(...urls.map(_fixImports));`;return URL.createObjectURL(new Blob([`${t}importScripts("${e}")`],{type:Fn}))}(new URL(t,e.core.baseURL));return new Worker(r)}(this.configuration),c=function(e){return{baseURL:e.baseURL,license:e.license,core:e.core,presets:e.presets,featureFlags:e.featureFlags,forceWebGL1:e.forceWebGL1,audioOutput:e.audioOutput,extensions:e.extensions}}(this.configuration),l=new Promise(((e,t)=>{if(u.onmessage=({data:r})=>{if("exportVideoFinished"===r.msg){const t=new Blob([r.data],{type:r.mimeType});e(t)}else"exportVideoError"===r.msg?t(r.error):"exportVideoProgress"===r.msg?o?.onProgress?.(r.renderedFrames,r.encodedFrames,r.totalFrames):"exportLog"===r.msg?this.configuration.logger(r.message,r.logLevel):console.error("Unknown message received ",r)},a){let e=!1;const t=()=>{e||(e=!0,u.postMessage(An.abort()))};a.addEventListener("abort",t,{once:!0})}}));u.postMessage(An.start({sceneString:e,engineSettings:t,pluginURLs:r,config:c,exportOptions:n,workerOptions:i,inactivityTimeout:s}));const d=()=>{u.postMessage({msg:"setVisibility",visible:"visible"===document.visibilityState})};return document.addEventListener("visibilitychange",d),l.finally((()=>{u.terminate(),document.removeEventListener("visibilitychange",d)})),l}};var Dn=10,Bn=1e4;globalThis.ubq_browserTabHidden=!0;var Rn={value:()=>"undefined"==typeof document||"visible"===document.visibilityState,subscribe(e){if("undefined"==typeof document)return()=>{};{const t=()=>{e("visible"===document.visibilityState)};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}}}};function Mn(e,t,r){return async(n,o,i,a)=>{const s=t.scene.get();if(null==s||!t.block.isValid(s))throw new Error("No valid scene available.");const u=await t.scene.saveToString(),c=function(e){const t=new Map,r=e.findAllSettings();for(const n of r)switch(e.getSettingType(n)){case"Bool":t.set(n,e.getSettingBool(n));break;case"Int":t.set(n,e.getSettingInt(n));break;case"Float":t.set(n,e.getSettingFloat(n));break;case"String":t.set(n,e.getSettingString(n));break;case"Color":t.set(n,e.getSettingColor(n));break;case"Enum":t.set(n,e.getSettingEnum(n))}return t}(t.editor),l=t.settings.unstable_videoExportInactivityTimeout.value(),d=t.editor.getActiveLicense(),p={};try{p.trackingMetadata=t.editor.getTrackingMetadata()}catch{p.trackingMetadata=void 0}const h={block:n,width:a.targetWidth,height:a.targetHeight,...a};if(e.featureFlags?.exportWorker??1){return new Ln({...e,license:d}).exportVideo(u,c,r,h,{abortSignal:a.abortSignal,inactivityTimeout:l,onProgress:i},p)}return async function(e,t,r,n,o={},i,a){let s,u,c=0,l=null;const d=a?.visibility??Rn;globalThis.ubq_exportVideoTimeout=a?.inactivityTimeout;const p=d.subscribe((()=>{null!==l&&(l=Date.now()),globalThis.ubq_browserTabHidden=!d.value()}));let h=null;function f(){clearTimeout(u),p(),h?.()}try{let p=function(){if(!0===d.value()&&null!==l&&Date.now()-l>Bn)s(new Error("Video export timed out due to inactivity."));else{if(c<Dn){for(const e of S)e.update?.(C);g.update()}u=setTimeout(p,1)}};const m=new OffscreenCanvas(64,64),g=await rn(m,{...e,audioOutput:"none"}),y=new AssetAPI(g),b=new SceneAPI(g),v=new BlockAPI(g),w=new EditorAPI(g),_=new EventAPI(g),E=new VariableAPI(g);h=()=>{g.delete()},function(e,t){for(const[r,n]of t)switch(e.getSettingType(r)){case"Bool":e.setSettingBool(r,n);break;case"Int":e.setSettingInt(r,n);break;case"Float":e.setSettingFloat(r,n);break;case"String":e.setSettingString(r,n);break;case"Color":e.setSettingColor(r,n);break;case"Enum":{const t=r,o=n;e.setSettingEnum(t,o)}}}(w,t),i?.trackingMetadata&&w.setTrackingMetadata(i.trackingMetadata);const S=await Promise.all(r.map((e=>nn(e)))),C={asset:y,block:v,scene:b,editor:w,event:_,variable:E};for(const e of S)e.initialize?.(C);const x=await b.loadFromString(n),k=o.block?v.getDuration(o.block):v.getTotalSceneDuration(b.get());p();const T=await new Promise(((t,r)=>{s=r,e.abortSignal?.addEventListener("abort",(()=>{r(new Error("AbortSignal received"))})),g.exportVideoToBuffer(o.block??x,o.timeOffset??0,o.duration??k,tr.Mp4,((e,t,r)=>{c=e-t,l=Date.now(),a?.onProgress?.(e,t,r)}),(e=>{"error"in e?r(e.error):t(e)}),{h264Profile:o.h264Profile??77,h264Level:o.h264Level??52,framerate:o.framerate??30,useTargetSize:void 0!==o.width&&void 0!==o.height,targetWidth:o.width??0,targetHeight:o.height??0})})),A=new Uint8Array(T.byteLength);return A.set(T),f(),A}catch(e){throw f(),e}}(a.abortSignal?{...e,abortSignal:a.abortSignal}:e,c,r,u,h,p,{onProgress:i,visibility:go,inactivityTimeout:l}).then((e=>new Blob([e],{type:tr.Mp4})))}}var On,In,jn,Un,$n,Nn,Hn,Vn,Wn,zn,Gn,Yn,Xn,Zn,Kn,Qn,Jn,eo,to,ro,no,oo,io,ao,so,uo,co,lo,po,ho,fo,mo,go={value:()=>"visible"===document.visibilityState,subscribe:ur((On=document,In="visibilitychange",function(e){return On.addEventListener(In,e),function(){On.removeEventListener(In,e)}}),or((()=>"visible"===document.visibilityState)))},CreativeEngine=class{constructor(e,t,r){p(this,Xn),p(this,Kn),p(this,to),p(this,no),p(this,io),p(this,co),p(this,po),p(this,fo),c(this,"asset"),c(this,"block"),c(this,"editor"),c(this,"event"),c(this,"scene"),c(this,"variable"),p(this,jn,void 0),c(this,"reactor"),p(this,Un,void 0),p(this,$n,void 0),p(this,Nn,void 0),p(this,Hn,void 0),p(this,Vn,void 0),p(this,Wn,[]),p(this,zn,[]),p(this,Gn,void 0),p(this,Yn,[]),p(this,Jn,[]),p(this,eo,void 0),p(this,so,(0,dt.default)(function(){f(this,po,ho).call(this)}.bind(this),100,{leading:!0,trailing:!1})),p(this,uo,void 0),h(this,Gn,e),h(this,$n,new bt(e)),this.asset=new AssetAPI(e),this.block=new BlockAPI(e),this.editor=new EditorAPI(e),this.event=new EventAPI(e),this.scene=new SceneAPI(e),this.variable=new VariableAPI(e),h(this,jn,new xr(this.editor)),h(this,Vn,new gn(this,e)),d(this,Yn).push(d(this,Vn).dispose);const n=new cn;this.reactor=n;const o=[this.reactor.decorateObject(d(this,$n)),this.reactor.decorateObject(this.block),this.reactor.decorateObject(this.editor),this.reactor.decorateObject(this.scene)],i=this.addPostUpdateCallback(n.updateDirtyReactions.bind(n));d(this,Yn).push((()=>{o.forEach((e=>e())),i(),this.reactor.dispose()})),this.block.exportVideo=Mn(r,{block:this.block,scene:this.scene,editor:this.editor,settings:d(this,jn)},d(this,Wn)),"getInternalCanvas"in t?(h(this,Nn,t.getInternalCanvas()),h(this,Hn,t)):h(this,Nn,t),h(this,Un,new $r(this)),f(this,to,ro).call(this),"undefined"!=typeof window&&window.Cypress&&(this.config=r,this.helper=d(this,$n))}async unstable_addPlugin(e){null!=e.url&&d(this,Wn).push(e.url);const t=e.url?await nn(e.url):e;if(t.initialize){const e={asset:this.asset,block:this.block,scene:this.scene,editor:this.editor,event:this.event,variable:this.variable};t.initialize(e)}d(this,zn).push(t)}unstable_setVideoExportInactivityTimeout(e){d(this,jn).unstable_videoExportInactivityTimeout.update(e)}addPostUpdateCallback(e){return d(this,Jn).push(e),()=>{const t=d(this,Jn).indexOf(e);-1!==t&&d(this,Jn).splice(t,1)}}setWheelEventTarget(e){return d(this,Vn).setTarget(e)}get element(){return d(this,Hn)}dispose(){d(this,Yn).forEach((e=>e())),f(this,co,lo).call(this),this.asset.dispose(),h(this,Nn,null),d(this,Hn)?.dispose(),h(this,Hn,void 0),h(this,$n,null),this.block=null,this.scene=null,this.variable=null,this.asset=null,this.editor=null,this.event=null,d(this,Jn).length=0,d(this,Gn).delete(),h(this,Gn,null)}static async init(e,t){let r=function(e,t){if(r(t?.canvas))return t?.canvas;if(r(e))return console.warn("Passing an existing HTMLCanvasElement as a second parameter to CreativeEngine.init() is deprecated. Use the element property on the CreativeEngine instance to access a fully managed canvas to append into the DOM instead. For more information, have a look into our documentation at https://img.ly/docs/cesdk/next/engine/quickstart/#initialization."),e;return;function r(e){return"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement}}(t,e);const n="8b94f206a31";let o;n&&console.log(`[CreativeEngine] Revision ${n}`),r||(o=function(){customElements.get("cesdk-canvas")||customElements.define("cesdk-canvas",class HTMLCreativeEngineCanvasElement extends HTMLElement{#o;constructor(){super(),this.#o=document.createElement("canvas");const e=document.createElement("style");e.textContent=":host {display: block; width: 100%; height: 100%; contain: content;} canvas {position: absolute; inset: 0; width: 100%; height:100%; display: block; touch-action: none;}",this.attachShadow({mode:"closed"}).append(e,this.#o)}getInternalCanvas(){if(!this.#o)throw new Error("Internal canvas element is undefined");return this.#o}dispose(){this.#o?.remove(),this.#o=void 0}clear(){if(!this.#o)return;const e=this.#o.width;this.#o.width=1,this.#o.width=e}});return document.createElement("cesdk-canvas")}(),r=o.getInternalCanvas());const i=function(e){return e&&"callbacks"in e&&e.callbacks?.log&&!e.logger?{...e,logger:e.callbacks.log}:e}(e),a=function(e={},t="https://cdn.img.ly/packages/imgly/cesdk-engine/1.23.0-rc.2/assets"){const r={...e,license:e.license??"",featureFlags:e.featureFlags??{},baseURL:e.baseURL??t,core:e.core??{baseURL:"core/"},extensions:e.extensions??{...Ar},logger:e.logger??Tr,presets:e.presets??{}};return r.extensions.baseURL??=Ar.baseURL,r.extensions.entries??={...Ar.entries},r.baseURL=Pr(r.baseURL),r.baseURL=qr(r.baseURL),r.core.baseURL=Pr(r.core.baseURL,r.baseURL),r.core.baseURL=qr(r.core.baseURL),r.extensions.baseURL=qr(r.extensions.baseURL),r.extensions.entries=r.extensions.entries.map((e=>qr(e))),r}(i);if(!function(e){return!0===e?._skipConfigWarnings}(e))for(const t of function(e){const t=[];return e?("callbacks"in e&&e.callbacks?.log&&t.push("config.callbacks.log has been moved to config.logger"),e.scene&&t.push("config.scene options have been removed. You can set a scene's dpi and pixelScaleFactor via the BlockApi's setInt(sceneId, 'scene/dpi', dpi) and setInt(sceneId, 'scene/pixelScaleFactor', factor)."),e.page&&t.push("config.page options have been moved to the EditorAPI"),e.variables&&t.push("config.variables has been removed. Please use the VariableAPI instead"),t):t}(e))a.logger(t,"Warning");const s=new this(await rn(r,a),o??r,a);return function(e,t){if(e)try{const r=t.editor;if(null!=e.page?.title?.show&&r.setSettingBool("page/title/show",e.page.title.show),null!=e.page?.title?.fontFileUri&&r.setSettingString("page/title/fontFileUri",e.page?.title?.fontFileUri),null!=e.page?.dimOutOfPageAreas&&r.setSettingBool("page/dimOutOfPageAreas",e.page?.dimOutOfPageAreas),e.variables)for(const r in e.variables)if(Object.prototype.hasOwnProperty.call(e.variables,r)){const n=e.variables[r];t.variable.setString(r,String(n.value))}}catch(e){console.error(e)}}(e,s),s}async addDefaultAssetSources({baseURL:e="https://cdn.img.ly/assets/v2",excludeAssetSourceIds:t=[]}={}){return Lr(this.asset,e,t)}async addDemoAssetSources({baseURL:e="https://cdn.img.ly/assets/demo/v2",excludeAssetSourceIds:t=[],sceneMode:r="Design",withUploadAssetSources:n=!1}={}){return Dr(this.asset,this.scene,t,r,n,void 0,e)}get _ubq(){return d(this,Gn)}get _camera(){return d(this,Un)}get _helper(){return d(this,$n)}};jn=new WeakMap,Un=new WeakMap,$n=new WeakMap,Nn=new WeakMap,Hn=new WeakMap,Vn=new WeakMap,Wn=new WeakMap,zn=new WeakMap,Gn=new WeakMap,Yn=new WeakMap,Xn=new WeakSet,Zn=function(){if(!d(this,Hn))return;const e=d(this,Hn).getInternalCanvas(),t=e.getBoundingClientRect();if(0===t.width||0===t.height)return;const r="undefined"!=typeof window?window.devicePixelRatio:1,n=t.width*r,o=t.height*r;e.width!==n&&(e.width=n),e.height!==o&&(e.height=o)},Kn=new WeakSet,Qn=function(){const{width:e,height:t}=d(this,Nn),r="undefined"!=typeof window?window.devicePixelRatio:1,{height:n,width:o,pixelRatio:i}=d(this,Un).settings.value();Tn(o,e,1e-4)&&Tn(n,t,1e-4)&&Tn(i,r,1e-4)||d(this,Un).settings.update({height:t,width:e,pixelRatio:window.devicePixelRatio})},Jn=new WeakMap,eo=new WeakMap,to=new WeakSet,ro=function(e=!0){f(this,no,oo).call(this,e),f(this,io,ao).call(this)},no=new WeakSet,oo=function(e=!0){let t,r=!1,n=0;if(d(this,eo))return;const o=()=>{if(h(this,eo,requestAnimationFrame(o)),!r)try{f(this,po,ho).call(this,e),n=0}catch(e){throw n++,n>=10&&(console.error("Repeated exceptions in update loop. Stopping loop."),t?.(),f(this,co,lo).call(this)),e}};h(this,eo,requestAnimationFrame(o))},io=new WeakSet,ao=function(){if(e=d(this,Nn),!("undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement))return;var e;const t=d(this,Hn)??d(this,Nn),r=f(this,po,ho).bind(this,!1),n=[hn(t,d(this,$n),r),d(this,Vn).initialize(t),pn(t,d(this,$n),this.editor,r),dn(t,this.editor),xn(t,d(this,$n)),Nr(d(this,Nn),d(this,Gn),(()=>{d(this,Nn).width=d(this,Nn).width})),Br(t,d(this,so))];h(this,uo,(()=>{n.reverse().forEach((e=>e()))}))},so=new WeakMap,uo=new WeakMap,co=new WeakSet,lo=function(){var e;null==(e=d(this,uo))||e.call(this),h(this,uo,void 0),d(this,eo)&&(cancelAnimationFrame(d(this,eo)),h(this,eo,0))},po=new WeakSet,ho=function(e=!0){for(const e of d(this,zn))e.update?.(this);if(e){1===this.block.findByType("scene").length&&f(this,fo,mo).call(this)}f(this,Xn,Zn).call(this),f(this,Kn,Qn).call(this),d(this,Gn).update();for(const e of d(this,Jn))e()},fo=new WeakSet,mo=function(){if(d(this,Un).clampCamera){const e={sceneSize:{x:0,y:0},scrollPercentage:{x:NaN,y:NaN}};d(this,$n).execute("cesdk/clampCameraAndRender",{horizontalPaddingInPixels:this._camera.viewportPadding.value().x,verticalPaddingInPixels:this._camera.viewportPadding.value().y}).then((e=>{(0,pt.default)(d(this,Un).clampResult.value(),e)||d(this,Un).clampResult.update(e)}),(()=>{(0,pt.default)(d(this,Un).clampResult.value(),e)||d(this,Un).clampResult.update(e)}))}else d(this,$n).execute("ubq/render")};var yo=function(){try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){return console.error(e),!1}return!1},bo=1e4,vo=1e6;async function wo(){if("undefined"==typeof window)throw new Error("Window is undefined");if(!("VideoFrame"in window&&"VideoDecoder"in window&&"VideoEncoder"in window))throw new Error("Missing required web video APIs");const e={codec:"avc1.4D0034",width:1920,height:1080,avc:{format:"annexb"},framerate:30};if(!await VideoEncoder.isConfigSupported(e))throw new Error("Encoder config not supported");const t=new OffscreenCanvas(e.width,e.height),r=t.getContext("webgl2");if(!r)throw new Error("Could not create WebGL2 context");return r.clearColor(1,0,1,1),r.clear(r.COLOR_BUFFER_BIT),new Promise(((r,n)=>{setTimeout((()=>{n(new Error("Timed out during video export"))}),bo);const o=new VideoEncoder({output:()=>r(!0),error:e=>n(e)});o.configure(e);const i=new VideoFrame(t,{timestamp:0,duration:vo/e.framerate});o.encode(i,{keyFrame:!0}),i.close(),o.flush().then((()=>{"closed"!==o.state&&o.close()}))}))}async function _o(){if("undefined"==typeof window)throw new Error("Window is undefined");if(!("AudioDecoder"in window&&"AudioEncoder"in window))throw new Error("Missing required web audio APIs");const e={codec:"mp4a.40.02",sampleRate:48e3,numberOfChannels:2,bitrate:128e3};if(!await AudioEncoder.isConfigSupported(e))throw new Error("Encoder config not supported");return new Promise(((t,r)=>{setTimeout((()=>{r(new Error("Timed out during audio export"))}),bo);const n=new AudioEncoder({output:()=>t(!0),error:r});n.configure(e);const o=1024,i=new Float32Array(o*e.numberOfChannels);for(let e=0;e<o;++e){const t=e/o;i[2*e+0]=Math.sin(880*Math.PI*t),i[2*e+1]=Math.sin(888*Math.PI*t)}for(let t=0;t<10;++t){const r=new AudioData({format:"f32",sampleRate:e.sampleRate,numberOfFrames:o,numberOfChannels:e.numberOfChannels,timestamp:t*o/e.sampleRate*vo,data:i});n.encode(r),r.close()}n.flush().then((()=>{"closed"!==n.state&&n.close()}))}))}function Eo(){if("undefined"==typeof window)return!1;return"VideoFrame"in window&&"VideoDecoder"in window&&"VideoEncoder"in window&&"AudioDecoder"in window&&"AudioEncoder"in window}function So(){return Promise.all([wo(),_o()]).then((e=>e.every((e=>e))),(()=>!1))}var Co=function(){try{const e=!0,t=!0,r="globalThis"in window,n="BigInt"in window,o="allSettled"in Promise,i="matchAll"in String.prototype,a=CSS.supports("(display: flex) and (gap: 8px)"),s="MediaRecorder"in window&&"pause"in window.MediaRecorder.prototype,u=CSS.supports("selector(:not(a, .b))"),c=CSS.supports("selector(:is(a))");return yo()&&e&&t&&r&&n&&o&&i&&a&&s&&u&&c}catch{return!1}};export{kr as LogLevel,tr as MimeType,Ln as WorkerClient,CreativeEngine as default,Co as supportsBrowser,Eo as supportsVideo,So as supportsVideoExport,yo as supportsWasm};
2
2
  /*! Bundled license information:
3
3
 
4
4
  ieee754/index.js: