rive-canvas
Version:
Rive JS WASM runtime.
1 lines • 39.7 kB
JavaScript
var Rive=function(){var t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0;return"undefined"!=typeof __filename&&(t=t||__filename),function(e){var r,n,o=void 0!==(e=e||{})?e:{};o.ready=new Promise((function(t,e){r=t,n=e}));var i,a={};for(i in o)o.hasOwnProperty(i)&&(a[i]=o[i]);var s=[],u=!1,c=!1,f=!1,l=!1;u="object"==typeof window,c="function"==typeof importScripts,f="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,l=!u&&!f&&!c;var p,d,h,v,y,m="";function g(t){return o.locateFile?o.locateFile(t,m):m+t}f?(m=c?require("path").dirname(m)+"/":__dirname+"/",p=function(t,e){return v||(v=require("fs")),y||(y=require("path")),t=y.normalize(t),v.readFileSync(t,e?null:"utf8")},h=function(t){var e=p(t,!0);return e.buffer||(e=new Uint8Array(e)),$(e.buffer),e},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),s=process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof en))throw t})),process.on("unhandledRejection",dt),function(t){process.exit(t)},o.inspect=function(){return"[Emscripten Module object]"}):l?("undefined"!=typeof read&&(p=function(t){return read(t)}),h=function(t){var e;return"function"==typeof readbuffer?new Uint8Array(readbuffer(t)):($("object"==typeof(e=read(t,"binary"))),e)},"undefined"!=typeof scriptArgs?s=scriptArgs:void 0!==arguments&&(s=arguments),"function"==typeof quit&&function(t){quit(t)},"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)):(u||c)&&(c?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),t&&(m=t),m=0!==m.indexOf("blob:")?m.substr(0,m.lastIndexOf("/")+1):"",p=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},c&&(h=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),d=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var b=o.print||console.log.bind(console),w=o.printErr||console.warn.bind(console);for(i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);a=null,o.arguments&&(s=o.arguments),o.thisProgram&&o.thisProgram,o.quit&&o.quit;var T,_=function(t){t};o.wasmBinary&&(T=o.wasmBinary);var C;o.noExitRuntime;"object"!=typeof WebAssembly&&dt("no native wasm support detected");var P=!1;function $(t,e){t||dt("Assertion failed: "+e)}var A="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(t,e,r){for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.subarray&&A)return A.decode(t.subarray(e,o));for(var i="";e<o;){var a=t[e++];if(128&a){var s=63&t[e++];if(192!=(224&a)){var u=63&t[e++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&t[e++])<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}function O(t,e){return t?k(j,t,e):""}function x(t,e,r,n){if(!(n>0))return 0;for(var o=r,i=r+n-1,a=0;a<t.length;++a){var s=t.charCodeAt(a);if(s>=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&t.charCodeAt(++a);if(s<=127){if(r>=i)break;e[r++]=s}else if(s<=2047){if(r+1>=i)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=i)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=i)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-o}function W(t,e,r){return x(t,j,e,r)}function R(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&t.charCodeAt(++r)),n<=127?++e:e+=n<=2047?2:n<=65535?3:4}return e}var E,S,j,F,D,I,U,M,V,q="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function z(t,e){for(var r=t,n=r>>1,o=n+e/2;!(n>=o)&&D[n];)++n;if((r=n<<1)-t>32&&q)return q.decode(j.subarray(t,r));for(var i="",a=0;!(a>=e/2);++a){var s=F[t+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i}function B(t,e,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=e,o=(r-=2)<2*t.length?r/2:t.length,i=0;i<o;++i){var a=t.charCodeAt(i);F[e>>1]=a,e+=2}return F[e>>1]=0,e-n}function G(t){return 2*t.length}function H(t,e){for(var r=0,n="";!(r>=e/4);){var o=I[t+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}function L(t,e,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=e,o=n+r-4,i=0;i<t.length;++i){var a=t.charCodeAt(i);if(a>=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&t.charCodeAt(++i);if(I[e>>2]=a,(e+=4)+4>o)break}return I[e>>2]=0,e-n}function N(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n>=55296&&n<=57343&&++r,e+=4}return e}function J(t,e){return t%e>0&&(t+=e-t%e),t}function X(t){E=t,o.HEAP8=S=new Int8Array(t),o.HEAP16=F=new Int16Array(t),o.HEAP32=I=new Int32Array(t),o.HEAPU8=j=new Uint8Array(t),o.HEAPU16=D=new Uint16Array(t),o.HEAPU32=U=new Uint32Array(t),o.HEAPF32=M=new Float32Array(t),o.HEAPF64=V=new Float64Array(t)}o.INITIAL_MEMORY;var Z,K=[],Q=[],Y=[],tt=[];function et(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)it(o.preRun.shift());Ct(K)}function rt(){!0,Ct(Q)}function nt(){Ct(Y)}function ot(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)st(o.postRun.shift());Ct(tt)}function it(t){K.unshift(t)}function at(t){Q.unshift(t)}function st(t){tt.unshift(t)}var ut=0,ct=null,ft=null;function lt(t){ut++,o.monitorRunDependencies&&o.monitorRunDependencies(ut)}function pt(t){if(ut--,o.monitorRunDependencies&&o.monitorRunDependencies(ut),0==ut&&(null!==ct&&(clearInterval(ct),ct=null),ft)){var e=ft;ft=null,e()}}function dt(t){o.onAbort&&o.onAbort(t),w(t+=""),P=!0,1,t="abort("+t+"). Build with -s ASSERTIONS=1 for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}function ht(t,e){return String.prototype.startsWith?t.startsWith(e):0===t.indexOf(e)}o.preloadedImages={},o.preloadedAudios={};var vt="data:application/octet-stream;base64,";function yt(t){return ht(t,vt)}var mt="file://";function gt(t){return ht(t,mt)}var bt="rive.lean.wasm";function wt(t){try{if(t==bt&&T)return new Uint8Array(T);if(h)return h(t);throw"both async and sync fetching of the wasm failed"}catch(t){dt(t)}}function Tt(){if(!T&&(u||c)){if("function"==typeof fetch&&!gt(bt))return fetch(bt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+bt+"'";return t.arrayBuffer()})).catch((function(){return wt(bt)}));if(d)return new Promise((function(t,e){d(bt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return wt(bt)}))}function _t(){var t={a:Kr};function e(t,e){var r=t.exports;o.asm=r,X((C=o.asm.M).buffer),Z=o.asm.O,at(o.asm.N),pt()}function r(t){e(t.instance)}function i(e){return Tt().then((function(e){return WebAssembly.instantiate(e,t)})).then(e,(function(t){w("failed to asynchronously prepare wasm: "+t),dt(t)}))}if(lt(),o.instantiateWasm)try{return o.instantiateWasm(t,e)}catch(t){return w("Module.instantiateWasm callback failed with error: "+t),!1}return(T||"function"!=typeof WebAssembly.instantiateStreaming||yt(bt)||gt(bt)||"function"!=typeof fetch?i(r):fetch(bt,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(r,(function(t){return w("wasm streaming compile failed: "+t),w("falling back to ArrayBuffer instantiation"),i(r)}))}))).catch(n),{}}function Ct(t){for(;t.length>0;){var e=t.shift();if("function"!=typeof e){var r=e.func;"number"==typeof r?void 0===e.arg?Z.get(r)():Z.get(r)(e.arg):r(void 0===e.arg?null:e.arg)}else e(o)}}yt(bt)||(bt=g(bt));var Pt=48,$t=57;function At(t){if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return e>=Pt&&e<=$t?"_"+t:t}function kt(t,e){return t=At(t),new Function("body","return function "+t+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(e)}var Ot=[],xt=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Wt(){for(var t=0,e=5;e<xt.length;++e)void 0!==xt[e]&&++t;return t}function Rt(){for(var t=5;t<xt.length;++t)if(void 0!==xt[t])return xt[t];return null}function Et(){o.count_emval_handles=Wt,o.get_first_emval=Rt}function St(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=Ot.length?Ot.pop():xt.length;return xt[e]={refcount:1,value:t},e}}function jt(t,e){var r=kt(e,(function(t){this.name=e,this.message=t;var r=new Error(t).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var Ft=void 0;function Dt(){for(var t=new Array(256),e=0;e<256;++e)t[e]=String.fromCharCode(e);It=t}var It=void 0;function Ut(t){for(var e="",r=t;j[r];)e+=It[j[r++]];return e}function Mt(){return Object.keys(Lt).length}function Vt(){var t=[];for(var e in Lt)Lt.hasOwnProperty(e)&&t.push(Lt[e]);return t}var qt=[];function zt(){for(;qt.length;){var t=qt.pop();t.$$.deleteScheduled=!1,t.delete()}}var Bt=void 0;function Gt(t){Bt=t,qt.length&&Bt&&Bt(zt)}function Ht(){o.getInheritedInstanceCount=Mt,o.getLiveInheritedInstances=Vt,o.flushPendingDeletes=zt,o.setDelayFunction=Gt}var Lt={},Nt=void 0;function Jt(t){throw new Nt(t)}function Xt(t,e){for(void 0===e&&Jt("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e}function Zt(t,e,r){e=Xt(t,e),Lt.hasOwnProperty(e)?Jt("Tried to register registered instance: "+e):Lt[e]=r}function Kt(t){return t||Jt("Cannot use deleted val. handle = "+t),xt[t].value}var Qt={};function Yt(t){var e=Yr(t),r=Ut(e);return tn(e),r}function te(t,e){var r=Qt[t];return void 0===r&&Jt(e+" has unknown type "+Yt(t)),r}function ee(t,e){e=Xt(t,e),Lt.hasOwnProperty(e)?delete Lt[e]:Jt("Tried to unregister unregistered instance: "+e)}function re(t){}var ne=!1;function oe(t){t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)}function ie(t){t.count.value-=1,0===t.count.value&&oe(t)}function ae(t){return"undefined"==typeof FinalizationGroup?(ae=function(t){return t},t):(ne=new FinalizationGroup((function(t){for(var e=t.next();!e.done;e=t.next()){var r=e.value;r.ptr?ie(r):console.warn("object already deleted: "+r.ptr)}})),re=function(t){ne.unregister(t.$$)},(ae=function(t){return ne.register(t,t.$$,t.$$),t})(t))}function se(t,e,r){t=Ut(t),e=te(e,"wrapper"),r=Kt(r);var n=[].slice,o=e.registeredClass,i=o.instancePrototype,a=o.baseClass.instancePrototype,s=o.baseClass.constructor,u=kt(t,(function(){o.baseClass.pureVirtualFunctions.forEach(function(t){if(this[t]===a[t])throw new Ft("Pure virtual function "+t+" must be implemented in JavaScript")}.bind(this)),Object.defineProperty(this,"__parent",{value:i}),this.__construct.apply(this,n.call(arguments))}));for(var c in i.__construct=function(){this===i&&Jt("Pass correct 'this' to __construct");var t=s.implement.apply(void 0,[this].concat(n.call(arguments)));re(t);var e=t.$$;t.notifyOnDestruction(),e.preservePointerOnDelete=!0,Object.defineProperties(this,{$$:{value:e}}),ae(this),Zt(o,e.ptr,this)},i.__destruct=function(){this===i&&Jt("Pass correct 'this' to __destruct"),re(this),ee(o,this.$$.ptr)},u.prototype=Object.create(i),r)u.prototype[c]=r[c];return St(u)}var ue={};function ce(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function fe(t){return this.fromWireType(U[t>>2])}var le={},pe={},de=void 0;function he(t){throw new de(t)}function ve(t,e,r){function n(e){var n=r(e);n.length!==t.length&&he("Mismatched type converter count");for(var o=0;o<t.length;++o)ge(t[o],n[o])}t.forEach((function(t){pe[t]=e}));var o=new Array(e.length),i=[],a=0;e.forEach((function(t,e){Qt.hasOwnProperty(t)?o[e]=Qt[t]:(i.push(t),le.hasOwnProperty(t)||(le[t]=[]),le[t].push((function(){o[e]=Qt[t],++a===i.length&&n(o)})))})),0===i.length&&n(o)}function ye(t){var e=ue[t];delete ue[t];var r=e.rawConstructor,n=e.rawDestructor,o=e.fields;ve([t],o.map((function(t){return t.getterReturnType})).concat(o.map((function(t){return t.setterArgumentType}))),(function(t){var i={};return o.forEach((function(e,r){var n=e.fieldName,a=t[r],s=e.getter,u=e.getterContext,c=t[r+o.length],f=e.setter,l=e.setterContext;i[n]={read:function(t){return a.fromWireType(s(u,t))},write:function(t,e){var r=[];f(l,t,c.toWireType(r,e)),ce(r)}}})),[{name:e.name,fromWireType:function(t){var e={};for(var r in i)e[r]=i[r].read(t);return n(t),e},toWireType:function(t,e){for(var o in i)if(!(o in e))throw new TypeError('Missing field: "'+o+'"');var a=r();for(o in i)i[o].write(a,e[o]);return null!==t&&t.push(n,a),a},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:n}]}))}function me(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}function ge(t,e,r){if(r=r||{},!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=e.name;if(t||Jt('type "'+n+'" must have a positive integer typeid pointer'),Qt.hasOwnProperty(t)){if(r.ignoreDuplicateRegistrations)return;Jt("Cannot register type '"+n+"' twice")}if(Qt[t]=e,delete pe[t],le.hasOwnProperty(t)){var o=le[t];delete le[t],o.forEach((function(t){t()}))}}function be(t,e,r,n,o){var i=me(r);ge(t,{name:e=Ut(e),fromWireType:function(t){return!!t},toWireType:function(t,e){return e?n:o},argPackAdvance:8,readValueFromPointer:function(t){var n;if(1===r)n=S;else if(2===r)n=F;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+e);n=I}return this.fromWireType(n[t>>i])},destructorFunction:null})}function we(t){if(!(this instanceof Oe))return!1;if(!(t instanceof Oe))return!1;for(var e=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=t.$$.ptrType.registeredClass,o=t.$$.ptr;e.baseClass;)r=e.upcast(r),e=e.baseClass;for(;n.baseClass;)o=n.upcast(o),n=n.baseClass;return e===n&&r===o}function Te(t){return{count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}}function _e(t){Jt(t.$$.ptrType.registeredClass.name+" instance already deleted")}function Ce(){if(this.$$.ptr||_e(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=ae(Object.create(Object.getPrototypeOf(this),{$$:{value:Te(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function Pe(){this.$$.ptr||_e(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Jt("Object already scheduled for deletion"),re(this),ie(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function $e(){return!this.$$.ptr}function Ae(){return this.$$.ptr||_e(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Jt("Object already scheduled for deletion"),qt.push(this),1===qt.length&&Bt&&Bt(zt),this.$$.deleteScheduled=!0,this}function ke(){Oe.prototype.isAliasOf=we,Oe.prototype.clone=Ce,Oe.prototype.delete=Pe,Oe.prototype.isDeleted=$e,Oe.prototype.deleteLater=Ae}function Oe(){}var xe={};function We(t,e,r){if(void 0===t[e].overloadTable){var n=t[e];t[e]=function(){return t[e].overloadTable.hasOwnProperty(arguments.length)||Jt("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+t[e].overloadTable+")!"),t[e].overloadTable[arguments.length].apply(this,arguments)},t[e].overloadTable=[],t[e].overloadTable[n.argCount]=n}}function Re(t,e,r){o.hasOwnProperty(t)?((void 0===r||void 0!==o[t].overloadTable&&void 0!==o[t].overloadTable[r])&&Jt("Cannot register public name '"+t+"' twice"),We(o,t,t),o.hasOwnProperty(r)&&Jt("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),o[t].overloadTable[r]=e):(o[t]=e,void 0!==r&&(o[t].numArguments=r))}function Ee(t,e,r,n,o,i,a,s){this.name=t,this.constructor=e,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function Se(t,e,r){for(;e!==r;)e.upcast||Jt("Expected null or instance of "+r.name+", got an instance of "+e.name),t=e.upcast(t),e=e.baseClass;return t}function je(t,e){if(null===e)return this.isReference&&Jt("null is not a valid "+this.name),0;e.$$||Jt('Cannot pass "'+hr(e)+'" as a '+this.name),e.$$.ptr||Jt("Cannot pass deleted object as a pointer of type "+this.name);var r=e.$$.ptrType.registeredClass;return Se(e.$$.ptr,r,this.registeredClass)}function Fe(t,e){var r;if(null===e)return this.isReference&&Jt("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==t&&t.push(this.rawDestructor,r),r):0;e.$$||Jt('Cannot pass "'+hr(e)+'" as a '+this.name),e.$$.ptr||Jt("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&e.$$.ptrType.isConst&&Jt("Cannot convert argument of type "+(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name)+" to parameter type "+this.name);var n=e.$$.ptrType.registeredClass;if(r=Se(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===e.$$.smartPtr&&Jt("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?r=e.$$.smartPtr:Jt("Cannot convert argument of type "+(e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)r=e.$$.smartPtr;else{var o=e.clone();r=this.rawShare(r,St((function(){o.delete()}))),null!==t&&t.push(this.rawDestructor,r)}break;default:Jt("Unsupporting sharing policy")}return r}function De(t,e){if(null===e)return this.isReference&&Jt("null is not a valid "+this.name),0;e.$$||Jt('Cannot pass "'+hr(e)+'" as a '+this.name),e.$$.ptr||Jt("Cannot pass deleted object as a pointer of type "+this.name),e.$$.ptrType.isConst&&Jt("Cannot convert argument of type "+e.$$.ptrType.name+" to parameter type "+this.name);var r=e.$$.ptrType.registeredClass;return Se(e.$$.ptr,r,this.registeredClass)}function Ie(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t}function Ue(t){this.rawDestructor&&this.rawDestructor(t)}function Me(t){null!==t&&t.delete()}function Ve(t,e,r){if(e===r)return t;if(void 0===r.baseClass)return null;var n=Ve(t,e,r.baseClass);return null===n?null:r.downcast(n)}function qe(t,e){return e=Xt(t,e),Lt[e]}function ze(t,e){return e.ptrType&&e.ptr||he("makeClassHandle requires ptr and ptrType"),!!e.smartPtrType!==!!e.smartPtr&&he("Both smartPtrType and smartPtr must be specified"),e.count={value:1},ae(Object.create(t,{$$:{value:e}}))}function Be(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var r=qe(this.registeredClass,e);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=e,r.$$.smartPtr=t,r.clone();var n=r.clone();return this.destructor(t),n}function o(){return this.isSmartPointer?ze(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):ze(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var i,a=this.registeredClass.getActualType(e),s=xe[a];if(!s)return o.call(this);i=this.isConst?s.constPointerType:s.pointerType;var u=Ve(e,this.registeredClass,i.registeredClass);return null===u?o.call(this):this.isSmartPointer?ze(i.registeredClass.instancePrototype,{ptrType:i,ptr:u,smartPtrType:this,smartPtr:t}):ze(i.registeredClass.instancePrototype,{ptrType:i,ptr:u})}function Ge(){He.prototype.getPointee=Ie,He.prototype.destructor=Ue,He.prototype.argPackAdvance=8,He.prototype.readValueFromPointer=fe,He.prototype.deleteObject=Me,He.prototype.fromWireType=Be}function He(t,e,r,n,o,i,a,s,u,c,f){this.name=t,this.registeredClass=e,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=f,o||void 0!==e.baseClass?this.toWireType=Fe:n?(this.toWireType=je,this.destructorFunction=null):(this.toWireType=De,this.destructorFunction=null)}function Le(t,e,r){o.hasOwnProperty(t)||he("Replacing nonexistant public symbol"),void 0!==o[t].overloadTable&&void 0!==r?o[t].overloadTable[r]=e:(o[t]=e,o[t].argCount=r)}function Ne(t,e,r){var n=o["dynCall_"+t];return r&&r.length?n.apply(null,[e].concat(r)):n.call(null,e)}function Je(t,e,r){return-1!=t.indexOf("j")?Ne(t,e,r):Z.get(e).apply(null,r)}function Xe(t,e){var r=[];return function(){r.length=arguments.length;for(var n=0;n<arguments.length;n++)r[n]=arguments[n];return Je(t,e,r)}}function Ze(t,e){var r=-1!=(t=Ut(t)).indexOf("j")?Xe(t,e):Z.get(e);return"function"!=typeof r&&Jt("unknown function pointer with signature "+t+": "+e),r}var Ke=void 0;function Qe(t,e){var r=[],n={};throw e.forEach((function t(e){n[e]||Qt[e]||(pe[e]?pe[e].forEach(t):(r.push(e),n[e]=!0))})),new Ke(t+": "+r.map(Yt).join([", "]))}function Ye(t,e,r,n,o,i,a,s,u,c,f,l,p){f=Ut(f),i=Ze(o,i),s&&(s=Ze(a,s)),c&&(c=Ze(u,c)),p=Ze(l,p);var d=At(f);Re(d,(function(){Qe("Cannot construct "+f+" due to unbound types",[n])})),ve([t,e,r],n?[n]:[],(function(e){var r,o;e=e[0],o=n?(r=e.registeredClass).instancePrototype:Oe.prototype;var a=kt(d,(function(){if(Object.getPrototypeOf(this)!==u)throw new Nt("Use 'new' to construct "+f);if(void 0===l.constructor_body)throw new Nt(f+" has no accessible constructor");var t=l.constructor_body[arguments.length];if(void 0===t)throw new Nt("Tried to invoke ctor of "+f+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(l.constructor_body).toString()+") parameters instead!");return t.apply(this,arguments)})),u=Object.create(o,{constructor:{value:a}});a.prototype=u;var l=new Ee(f,a,u,p,r,i,s,c),h=new He(f,l,!0,!1,!1),v=new He(f+"*",l,!1,!1,!1),y=new He(f+" const*",l,!1,!0,!1);return xe[t]={pointerType:v,constPointerType:y},Le(d,a),[h,v,y]}))}function tr(t,e){if(!(t instanceof Function))throw new TypeError("new_ called with constructor type "+typeof t+" which is not a function");var r=kt(t.name||"unknownFunctionName",(function(){}));r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return o instanceof Object?o:n}function er(t,e,r,n,o){var i=e.length;i<2&&Jt("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==e[1]&&null!==r,s=!1,u=1;u<e.length;++u)if(null!==e[u]&&void 0===e[u].destructorFunction){s=!0;break}var c="void"!==e[0].name,f="",l="";for(u=0;u<i-2;++u)f+=(0!==u?", ":"")+"arg"+u,l+=(0!==u?", ":"")+"arg"+u+"Wired";var p="return function "+At(t)+"("+f+") {\nif (arguments.length !== "+(i-2)+") {\nthrowBindingError('function "+t+" called with ' + arguments.length + ' arguments, expected "+(i-2)+" args!');\n}\n";s&&(p+="var destructors = [];\n");var d=s?"destructors":"null",h=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],v=[Jt,n,o,ce,e[0],e[1]];a&&(p+="var thisWired = classParam.toWireType("+d+", this);\n");for(u=0;u<i-2;++u)p+="var arg"+u+"Wired = argType"+u+".toWireType("+d+", arg"+u+"); // "+e[u+2].name+"\n",h.push("argType"+u),v.push(e[u+2]);if(a&&(l="thisWired"+(l.length>0?", ":"")+l),p+=(c?"var rv = ":"")+"invoker(fn"+(l.length>0?", ":"")+l+");\n",s)p+="runDestructors(destructors);\n";else for(u=a?1:2;u<e.length;++u){var y=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(p+=y+"_dtor("+y+"); // "+e[u].name+"\n",h.push(y+"_dtor"),v.push(e[u].destructorFunction))}return c&&(p+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),p+="}\n",h.push(p),tr(Function,h).apply(null,v)}function rr(t,e){for(var r=[],n=0;n<t;n++)r.push(I[(e>>2)+n]);return r}function nr(t,e,r,n,o,i,a){var s=rr(r,n);e=Ut(e),i=Ze(o,i),ve([],[t],(function(t){var n=(t=t[0]).name+"."+e;function o(){Qe("Cannot call "+n+" due to unbound types",s)}var u=t.registeredClass.constructor;return void 0===u[e]?(o.argCount=r-1,u[e]=o):(We(u,e,n),u[e].overloadTable[r-1]=o),ve([],s,(function(t){var o=[t[0],null].concat(t.slice(1)),s=er(n,o,null,i,a);return void 0===u[e].overloadTable?(s.argCount=r-1,u[e]=s):u[e].overloadTable[r-1]=s,[]})),[]}))}function or(t,e,r){return t instanceof Object||Jt(r+' with invalid "this": '+t),t instanceof e.registeredClass.constructor||Jt(r+' incompatible with "this" of type '+t.constructor.name),t.$$.ptr||Jt("cannot call emscripten binding method "+r+" on deleted object"),Se(t.$$.ptr,t.$$.ptrType.registeredClass,e.registeredClass)}function ir(t,e,r,n,o,i,a,s){e=Ut(e),i=Ze(o,i),ve([],[t],(function(t){var o=(t=t[0]).name+"."+e,u={get:function(){Qe("Cannot access "+o+" due to unbound types",[r])},enumerable:!0,configurable:!0};return u.set=s?function(){Qe("Cannot access "+o+" due to unbound types",[r])}:function(t){Jt(o+" is a read-only property")},Object.defineProperty(t.registeredClass.constructor,e,u),ve([],[r],(function(r){r=r[0];var o={get:function(){return r.fromWireType(i(n))},enumerable:!0};return s&&(s=Ze(a,s),o.set=function(t){var e=[];s(n,r.toWireType(e,t)),ce(e)}),Object.defineProperty(t.registeredClass.constructor,e,o),[]})),[]}))}function ar(t,e,r,n,o,i){$(e>0);var a=rr(e,r);o=Ze(n,o);var s=[i],u=[];ve([],[t],(function(t){var r="constructor "+(t=t[0]).name;if(void 0===t.registeredClass.constructor_body&&(t.registeredClass.constructor_body=[]),void 0!==t.registeredClass.constructor_body[e-1])throw new Nt("Cannot register multiple constructors with identical number of parameters ("+(e-1)+") for class '"+t.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return t.registeredClass.constructor_body[e-1]=function(){Qe("Cannot construct "+t.name+" due to unbound types",a)},ve([],a,(function(n){return t.registeredClass.constructor_body[e-1]=function(){arguments.length!==e-1&&Jt(r+" called with "+arguments.length+" arguments, expected "+(e-1)),u.length=0,s.length=e;for(var t=1;t<e;++t)s[t]=n[t].toWireType(u,arguments[t-1]);var i=o.apply(null,s);return ce(u),n[0].fromWireType(i)},[]})),[]}))}function sr(t,e,r,n,o,i,a,s){var u=rr(r,n);e=Ut(e),i=Ze(o,i),ve([],[t],(function(t){var n=(t=t[0]).name+"."+e;function o(){Qe("Cannot call "+n+" due to unbound types",u)}s&&t.registeredClass.pureVirtualFunctions.push(e);var c=t.registeredClass.instancePrototype,f=c[e];return void 0===f||void 0===f.overloadTable&&f.className!==t.name&&f.argCount===r-2?(o.argCount=r-2,o.className=t.name,c[e]=o):(We(c,e,n),c[e].overloadTable[r-2]=o),ve([],u,(function(o){var s=er(n,o,t,i,a);return void 0===c[e].overloadTable?(s.argCount=r-2,c[e]=s):c[e].overloadTable[r-2]=s,[]})),[]}))}function ur(t,e,r,n,o,i,a,s,u,c){e=Ut(e),o=Ze(n,o),ve([],[t],(function(t){var n=(t=t[0]).name+"."+e,f={get:function(){Qe("Cannot access "+n+" due to unbound types",[r,a])},enumerable:!0,configurable:!0};return f.set=u?function(){Qe("Cannot access "+n+" due to unbound types",[r,a])}:function(t){Jt(n+" is a read-only property")},Object.defineProperty(t.registeredClass.instancePrototype,e,f),ve([],u?[r,a]:[r],(function(r){var a=r[0],f={get:function(){var e=or(this,t,n+" getter");return a.fromWireType(o(i,e))},enumerable:!0};if(u){u=Ze(s,u);var l=r[1];f.set=function(e){var r=or(this,t,n+" setter"),o=[];u(c,r,l.toWireType(o,e)),ce(o)}}return Object.defineProperty(t.registeredClass.instancePrototype,e,f),[]})),[]}))}function cr(t){t>4&&0==--xt[t].refcount&&(xt[t]=void 0,Ot.push(t))}function fr(t,e){ge(t,{name:e=Ut(e),fromWireType:function(t){var e=xt[t].value;return cr(t),e},toWireType:function(t,e){return St(e)},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:null})}function lr(t,e,r){switch(e){case 0:return function(t){var e=r?S:j;return this.fromWireType(e[t])};case 1:return function(t){var e=r?F:D;return this.fromWireType(e[t>>1])};case 2:return function(t){var e=r?I:U;return this.fromWireType(e[t>>2])};default:throw new TypeError("Unknown integer type: "+t)}}function pr(t,e,r,n){var o=me(r);function i(){}e=Ut(e),i.values={},ge(t,{name:e,constructor:i,fromWireType:function(t){return this.constructor.values[t]},toWireType:function(t,e){return e.value},argPackAdvance:8,readValueFromPointer:lr(e,o,n),destructorFunction:null}),Re(e,i)}function dr(t,e,r){var n=te(t,"enum");e=Ut(e);var o=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:kt(n.name+"_"+e,(function(){}))}});o.values[r]=i,o[e]=i}function hr(t){if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t}function vr(t,e){switch(e){case 2:return function(t){return this.fromWireType(M[t>>2])};case 3:return function(t){return this.fromWireType(V[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function yr(t,e,r){var n=me(r);ge(t,{name:e=Ut(e),fromWireType:function(t){return t},toWireType:function(t,e){if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError('Cannot convert "'+hr(e)+'" to '+this.name);return e},argPackAdvance:8,readValueFromPointer:vr(e,n),destructorFunction:null})}function mr(t,e,r,n,o,i){var a=rr(e,r);t=Ut(t),o=Ze(n,o),Re(t,(function(){Qe("Cannot call "+t+" due to unbound types",a)}),e-1),ve([],a,(function(r){var n=[r[0],null].concat(r.slice(1));return Le(t,er(t,n,null,o,i),e-1),[]}))}function gr(t,e,r){switch(e){case 0:return r?function(t){return S[t]}:function(t){return j[t]};case 1:return r?function(t){return F[t>>1]}:function(t){return D[t>>1]};case 2:return r?function(t){return I[t>>2]}:function(t){return U[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}function br(t,e,r,n,o){e=Ut(e),-1===o&&(o=4294967295);var i=me(r),a=function(t){return t};if(0===n){var s=32-8*r;a=function(t){return t<<s>>>s}}var u=-1!=e.indexOf("unsigned");ge(t,{name:e,fromWireType:a,toWireType:function(t,r){if("number"!=typeof r&&"boolean"!=typeof r)throw new TypeError('Cannot convert "'+hr(r)+'" to '+this.name);if(r<n||r>o)throw new TypeError('Passing a number "'+hr(r)+'" from JS side to C/C++ side to an argument of type "'+e+'", which is outside the valid range ['+n+", "+o+"]!");return u?r>>>0:0|r},argPackAdvance:8,readValueFromPointer:gr(e,i,0!==n),destructorFunction:null})}function wr(t,e,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(t){var e=U,r=e[t>>=2],o=e[t+1];return new n(E,o,r)}ge(t,{name:r=Ut(r),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function Tr(t,e){var r="std::string"===(e=Ut(e));ge(t,{name:e,fromWireType:function(t){var e,n=U[t>>2];if(r)for(var o=t+4,i=0;i<=n;++i){var a=t+4+i;if(i==n||0==j[a]){var s=O(o,a-o);void 0===e?e=s:(e+=String.fromCharCode(0),e+=s),o=a+1}}else{var u=new Array(n);for(i=0;i<n;++i)u[i]=String.fromCharCode(j[t+4+i]);e=u.join("")}return tn(t),e},toWireType:function(t,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n="string"==typeof e;n||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||Jt("Cannot pass non-string to std::string");var o=(r&&n?function(){return R(e)}:function(){return e.length})(),i=Qr(4+o+1);if(U[i>>2]=o,r&&n)W(e,i+4,o+1);else if(n)for(var a=0;a<o;++a){var s=e.charCodeAt(a);s>255&&(tn(i),Jt("String has UTF-16 code units that do not fit in 8 bits")),j[i+4+a]=s}else for(a=0;a<o;++a)j[i+4+a]=e[a];return null!==t&&t.push(tn,i),i},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:function(t){tn(t)}})}function _r(t,e,r){var n,o,i,a,s;r=Ut(r),2===e?(n=z,o=B,a=G,i=function(){return D},s=1):4===e&&(n=H,o=L,a=N,i=function(){return U},s=2),ge(t,{name:r,fromWireType:function(t){for(var r,o=U[t>>2],a=i(),u=t+4,c=0;c<=o;++c){var f=t+4+c*e;if(c==o||0==a[f>>s]){var l=n(u,f-u);void 0===r?r=l:(r+=String.fromCharCode(0),r+=l),u=f+e}}return tn(t),r},toWireType:function(t,n){"string"!=typeof n&&Jt("Cannot pass non-string to C++ string type "+r);var i=a(n),u=Qr(4+i+e);return U[u>>2]=i>>s,o(n,u+4,i+e),null!==t&&t.push(tn,u),u},argPackAdvance:8,readValueFromPointer:fe,destructorFunction:function(t){tn(t)}})}function Cr(t,e,r,n,o,i){ue[t]={name:Ut(e),rawConstructor:Ze(r,n),rawDestructor:Ze(o,i),fields:[]}}function Pr(t,e,r,n,o,i,a,s,u,c){ue[t].fields.push({fieldName:Ut(e),getterReturnType:r,getter:Ze(n,o),getterContext:i,setterArgumentType:a,setter:Ze(s,u),setterContext:c})}function $r(t,e){ge(t,{isVoid:!0,name:e=Ut(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(t,e){}})}function Ar(t,e,r){t=Kt(t),e=te(e,"emval::as");var n=[],o=St(n);return I[r>>2]=o,e.toWireType(n,t)}function kr(t){var e=[];return I[t>>2]=St(e),e}var Or={};function xr(t){var e=Or[t];return void 0===e?Ut(t):e}var Wr=[];function Rr(t,e,r,n,o){return(t=Wr[t])(e=Kt(e),r=xr(r),kr(n),o)}function Er(t,e,r,n){(t=Wr[t])(e=Kt(e),r=xr(r),null,n)}function Sr(t){var e=Wr.length;return Wr.push(t),e}function jr(t,e){for(var r=new Array(t),n=0;n<t;++n)r[n]=te(I[(e>>2)+n],"parameter "+n);return r}function Fr(t,e){for(var r=jr(t,e),n=r[0],o=n.name+"_$"+r.slice(1).map((function(t){return t.name})).join("_")+"$",i=["retType"],a=[n],s="",u=0;u<t-1;++u)s+=(0!==u?", ":"")+"arg"+u,i.push("argType"+u),a.push(r[1+u]);var c="return function "+At("methodCaller_"+o)+"(handle, name, destructors, args) {\n",f=0;for(u=0;u<t-1;++u)c+=" var arg"+u+" = argType"+u+".readValueFromPointer(args"+(f?"+"+f:"")+");\n",f+=r[u+1].argPackAdvance;c+=" var rv = handle[name]("+s+");\n";for(u=0;u<t-1;++u)r[u+1].deleteObject&&(c+=" argType"+u+".deleteObject(arg"+u+");\n");return n.isVoid||(c+=" return retType.toWireType(destructors, rv);\n"),c+="};\n",i.push(c),Sr(tr(Function,i).apply(null,a))}function Dr(t){return t=xr(t),St(o[t])}function Ir(t,e){return St((t=Kt(t))[e=Kt(e)])}function Ur(t){t>4&&(xt[t].refcount+=1)}function Mr(t){return St(xr(t))}function Vr(t){ce(xt[t].value),cr(t)}function qr(t,e){return St((t=te(t,"_emval_take_value")).readValueFromPointer(e))}function zr(){dt()}function Br(t){try{return C.grow(t-E.byteLength+65535>>>16),X(C.buffer),1}catch(t){}}function Gr(t){var e=j.length,r=2147483648;if((t>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var o=e*(1+.2/n);if(o=Math.min(o,t+100663296),Br(Math.min(r,J(Math.max(t,o),65536))))return!0}return!1}var Hr={mappings:{},buffers:[null,[],[]],printChar:function(t,e){var r=Hr.buffers[t];0===e||10===e?((1===t?b:w)(k(r,0)),r.length=0):r.push(e)},varargs:void 0,get:function(){return Hr.varargs+=4,I[Hr.varargs-4>>2]},getStr:function(t){return O(t)},get64:function(t,e){return t}};function Lr(t){return 0}function Nr(t,e,r,n,o){}function Jr(t,e,r,n){for(var o=0,i=0;i<r;i++){for(var a=I[e+8*i>>2],s=I[e+(8*i+4)>>2],u=0;u<s;u++)Hr.printChar(t,j[a+u]);o+=s}return I[n>>2]=o,0}function Xr(t){_(0|t)}Et(),Ft=o.PureVirtualError=jt(Error,"PureVirtualError"),Dt(),Ht(),Nt=o.BindingError=jt(Error,"BindingError"),de=o.InternalError=jt(Error,"InternalError"),ke(),Ge(),Ke=o.UnboundTypeError=jt(Error,"UnboundTypeError");var Zr,Kr={n:se,H:ye,A:be,c:Ye,i:nr,f:ir,r:ar,a:sr,b:ur,z:fr,k:pr,j:dr,p:yr,K:mr,h:br,g:wr,q:Tr,m:_r,J:Cr,I:Pr,B:$r,l:Ar,G:Rr,e:Er,D:cr,d:Fr,L:Dr,u:Ir,C:Ur,E:Mr,F:Vr,t:qr,s:zr,x:Gr,y:Lr,v:Nr,o:Jr,w:Xr},Qr=(_t(),o.___wasm_call_ctors=function(){return(o.___wasm_call_ctors=o.asm.N).apply(null,arguments)},o._malloc=function(){return(Qr=o._malloc=o.asm.P).apply(null,arguments)}),Yr=o.___getTypeName=function(){return(Yr=o.___getTypeName=o.asm.Q).apply(null,arguments)},tn=(o.___embind_register_native_and_builtin_types=function(){return(o.___embind_register_native_and_builtin_types=o.asm.R).apply(null,arguments)},o._free=function(){return(tn=o._free=o.asm.S).apply(null,arguments)});o.dynCall_jiji=function(){return(o.dynCall_jiji=o.asm.T).apply(null,arguments)};function en(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function rn(t){function e(){Zr||(Zr=!0,o.calledRun=!0,P||(rt(),nt(),r(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),ot()))}t=t||s,ut>0||(et(),ut>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),e()}),1)):e()))}if(ft=function t(){Zr||rn(),Zr||(ft=t)},o.run=rn,o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();function nn(t){const e=new DOMMatrix;return e.a=t.xx,e.b=t.xy,e.c=t.yx,e.d=t.yy,e.e=t.tx,e.f=t.ty,e}return rn(),o.onRuntimeInitialized=function(){const{RenderPaintStyle:t,FillRule:e,RenderPath:r,RenderPaint:n,Renderer:i,StrokeCap:a,StrokeJoin:s,BlendMode:u}=o,{fill:c,stroke:f}=t,{evenOdd:l,nonZero:p}=e;var d=r.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this),this._path2D=new Path2D},reset:function(){this._path2D=new Path2D},addPath:function(t,e){this._path2D.addPath(t._path2D,nn(e))},fillRule:function(t){this._fillRule=t},moveTo:function(t,e){this._path2D.moveTo(t,e)},lineTo:function(t,e){this._path2D.lineTo(t,e)},cubicTo:function(t,e,r,n,o,i){this._path2D.bezierCurveTo(t,e,r,n,o,i)},close:function(){this._path2D.closePath()}});function h(t){return"rgba("+((16711680&t)>>>16)+","+((65280&t)>>>8)+","+((255&t)>>>0)+","+((4278190080&t)>>>24)/255+")"}var v=n.extend("CanvasRenderPaint",{color:function(t){this._value=h(t)},thickness:function(t){this._thickness=t},join:function(t){switch(t){case s.miter:this._join="miter";break;case s.round:this._join="round";break;case s.bevel:this._join="bevel"}},cap:function(t){switch(t){case a.butt:this._cap="butt";break;case a.round:this._cap="round";break;case a.square:this._cap="square"}},style:function(t){this._style=t},blendMode:function(t){switch(t){case u.srcOver:this._blend="source-over";break;case u.screen:this._blend="screen";break;case u.overlay:this._blend="overlay";break;case u.darken:this._blend="darken";break;case u.lighten:this._blend="lighten";break;case u.colorDodge:this._blend="color-dodge";break;case u.colorBurn:this._blend="color-burn";break;case u.hardLight:this._blend="hard-light";break;case u.softLight:this._blend="soft-light";break;case u.difference:this._blend="difference";break;case u.exclusion:this._blend="exclusion";break;case u.multiply:this._blend="multiply";break;case u.hue:this._blend="hue";break;case u.saturation:this._blend="saturation";break;case u.color:this._blend="color";break;case u.luminosity:this._blend="luminosity"}},linearGradient:function(t,e,r,n){this._gradient={sx:t,sy:e,ex:r,ey:n,stops:[]}},radialGradient:function(t,e,r,n){this._gradient={sx:t,sy:e,ex:r,ey:n,stops:[],isRadial:!0}},addStop:function(t,e){this._gradient.stops.push({color:t,stop:e})},completeGradient:function(){},draw:function(t,e){let{_style:r,_value:n,_gradient:o,_blend:i}=this;if(t.globalCompositeOperation=i,null!=o){const{sx:e,sy:r,ex:i,ey:c,stops:f,isRadial:l}=o;if(l){var a=i-e,s=c-r,u=Math.sqrt(a*a+s*s);n=t.createRadialGradient(e,r,0,e,r,u)}else n=t.createLinearGradient(e,r,i,c);for(const{stop:t,color:e}of f)n.addColorStop(t,h(e));this._value=n,this._gradient=null}switch(r){case f:t.strokeStyle=n,t.lineWidth=this._thickness,t.lineCap=this._cap,t.lineJoin=this._join,t.stroke(e._path2D);break;case c:t.fillStyle=n,t.fill(e._path2D,e._fillRule===l?"evenodd":"nonzero")}}});o.CanvasRenderer=i.extend("Renderer",{__construct:function(t){this.__parent.__construct.call(this),this._ctx=t},save:function(){this._ctx.save()},restore:function(){this._ctx.restore()},transform:function(t){this._ctx.transform(t.xx,t.xy,t.yx,t.yy,t.tx,t.ty)},drawPath:function(t,e){e.draw(this._ctx,t)},clipPath:function(t){this._ctx.clip(t._path2D,t._fillRule===l?"evenodd":"nonzero")}}),o.renderFactory={makeRenderPaint:function(){return new v},makeRenderPath:function(){return new d}}},e.ready}}();export default Rive;