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