UNPKG

@fcanvas/worker

Version:

The plugin provides support for using fCanvas in WebWorker

4 lines (3 loc) 77.6 kB
var fWorker = (function (exports) { 'use strict'; var xn=Object.create;var Oe=Object.defineProperty,Tn=Object.defineProperties,Mn=Object.getOwnPropertyDescriptor,kn=Object.getOwnPropertyDescriptors,On=Object.getOwnPropertyNames,mi=Object.getOwnPropertySymbols,Pn=Object.getPrototypeOf,yi=Object.prototype.hasOwnProperty,Rn=Object.prototype.propertyIsEnumerable;var vi=(t,e,i)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Pe=(t,e)=>{for(var i in e||(e={}))yi.call(e,i)&&vi(t,i,e[i]);if(mi)for(var i of mi(e))Rn.call(e,i)&&vi(t,i,e[i]);return t},Re=(t,e)=>Tn(t,kn(e));var Cn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Nn=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of On(e))!yi.call(t,n)&&n!==i&&Oe(t,n,{get:()=>e[n],enumerable:!(s=Mn(e,n))||s.enumerable});return t};var In=(t,e,i)=>(i=t!=null?xn(Pn(t)):{},Nn(e||!t||!t.__esModule?Oe(i,"default",{value:t,enumerable:!0}):i,t));var Xt=(t,e,i)=>new Promise((s,n)=>{var r=h=>{try{o(i.next(h));}catch(l){n(l);}},a=h=>{try{o(i.throw(h));}catch(l){n(l);}},o=h=>h.done?s(h.value):Promise.resolve(h.value).then(r,a);o((i=i.apply(t,e)).next());});var Gi=Cn((zt,Xi)=>{Object.defineProperty(zt,"__esModule",{value:!0});zt.default=void 0;function Ke(t){return Ke=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ke(t)}var At=47,Ge=46,Tr=function(e){var i=Ke(e);if(i!=="string")throw new TypeError("Expected a string, got a ".concat(i))},Mr=function(e,i){for(var s="",n=0,r=-1,a=0,o,h=0;h<=e.length;++h){if(h<e.length)o=e.charCodeAt(h);else {if(o===At)break;o=At;}if(o===At){if(!(r===h-1||a===1))if(r!==h-1&&a===2){if(s.length<2||n!==2||s.charCodeAt(s.length-1)!==Ge||s.charCodeAt(s.length-2)!==Ge){if(s.length>2){var l=s.lastIndexOf("/");if(l!==s.length-1){l===-1?(s="",n=0):(s=s.slice(0,l),n=s.length-1-s.lastIndexOf("/")),r=h,a=0;continue}}else if(s.length===2||s.length===1){s="",n=0,r=h,a=0;continue}}i&&(s.length>0?s+="/..":s="..",n=2);}else s.length>0?s+="/"+e.slice(r+1,h):s=e.slice(r+1,h),n=h-r-1;r=h,a=0;}else o===Ge&&a!==-1?++a:a=-1;}return s},kr=function(e){try{return decodeURIComponent(e)}catch(i){return e}},Or=function(e){Tr(e);var i=e;if(i.length===0)return ".";var s=i.charCodeAt(0)===At,n=i.charCodeAt(i.length-1)===At;return i=kr(i),i=Mr(i,!s),i.length===0&&!s&&(i="."),i.length>0&&n&&(i+="/"),s?"/"+i:i},Pr=Or;zt.default=Pr;Xi.exports=zt.default;});var Dn=Object.defineProperty,_i=Object.getOwnPropertySymbols,An=Object.prototype.hasOwnProperty,zn=Object.prototype.propertyIsEnumerable,wi=(t,e,i)=>e in t?Dn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ln=(t,e)=>{for(var i in e||(e={}))An.call(e,i)&&wi(t,i,e[i]);if(_i)for(var i of _i(e))zn.call(e,i)&&wi(t,i,e[i]);return t},Fn=(t,e,i)=>new Promise((s,n)=>{var r=h=>{try{o(i.next(h));}catch(l){n(l);}},a=h=>{try{o(i.throw(h));}catch(l){n(l);}},o=h=>h.done?s(h.value):Promise.resolve(h.value).then(r,a);o((i=i.apply(t,e)).next());}),Ce=typeof crypto!="undefined"&&crypto.randomUUID?crypto.randomUUID.bind(crypto):()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let e=Math.random()*16|0;return (t==="x"?e:e&3|8).toString(16)}),{toString:Wn}=Object.prototype;function Vn(t){return Wn.call(t)==="[object Error]"}var jn=t=>{try{return JSON.stringify(t)}catch(e){return JSON.stringify(t+"")}},Gt=new WeakMap;function et(t,e,i,s){function n(o){return Fn(this,null,function*(){let{data:h}=o;if(typeof h=="object"&&h.type==="call_fn"&&h.name===e){if(s!=null&&s.once&&a(),h.ping){i(...h.args);return}let l,u;try{let p=yield i(...h.args);p&&typeof p=="object"&&"return"in p?l=p:l={return:p};}catch(p){s!=null&&s.debug&&console.warn(p),u=p;}let c=Ln({id:h.id,type:"return_fn",name:h.name},l?{retu:l.return,isOk:!0}:{retu:Vn(u)?{isError:!0,data:u.message}:{isError:!1,data:jn(u)},isOk:!1});t.postMessage(c,l);}})}let r=Gt.get(t);if(r)r.cbs.add(n);else if(s!=null&&s.unique)t.addEventListener("message",n);else {let o=new Set;o.add(n),Gt.set(t,r={handle(h){o.forEach(l=>l(h));},cbs:o}),t.addEventListener("message",r.handle);}function a(){if(s!=null&&s.unique){t.removeEventListener("message",n);return}let o=Gt.get(t);o&&(o.cbs.delete(n),o.cbs.size===0&&(t.removeEventListener("message",o.handle),Gt.delete(t)));}return a}function qt(t,e,...i){let s;typeof e=="object"?s=e.name:s=e;let n={id:"0",type:"call_fn",name:s,args:i,ping:!0};t.postMessage(n,typeof e=="object"?e:void 0);}var Kt=new WeakMap;function gt(t,e,...i){return new Promise((s,n)=>{var r;let a=Ce(),o,h=3e4,l;if(typeof e=="object"?(o=e.name,h=(r=e.timeout)!=null?r:3e4,l=e.signal):o=e,l!=null&&l.aborted){n(new Error("aborted"));return}function u(y){let{data:b}=y;typeof b=="object"&&b.type==="return_fn"&&b.id===a&&b.name===o&&(b.isOk?s(b.retu):b.retu.isError?n(new Error(b.retu.data)):n(JSON.parse(b.retu.data)),m());}let c=h>0?setTimeout(()=>{m(),n(new Error("timeout"));},h):null;function p(){m(),n(new Error("aborted"));}let f=Kt.get(t);if(f)f.cbs.add(u);else {let y=new Set;y.add(u),Kt.set(t,f={handle(b){y.forEach(v=>v(b));},cbs:y}),t.addEventListener("message",f.handle);}l==null||l.addEventListener("abort",p);function m(){c&&clearTimeout(c),l==null||l.removeEventListener("abort",p);let y=Kt.get(t);y&&(y.cbs.delete(u),y.cbs.size===0&&(t.removeEventListener("message",y.handle),Kt.delete(t)));}let g={id:a,type:"call_fn",name:o,args:i};t.postMessage(g,typeof e=="object"?e:void 0);})}function Ne(t,e){let i=Object.create(null),s=t.split(",");for(let n=0;n<s.length;n++)i[s[n]]=!0;return e?n=>!!i[n.toLowerCase()]:n=>!!i[n]}var Bn="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly";Ne(Bn+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected");var Ei=Object.freeze({}),st=()=>{};var Jt=Object.assign;var Hn=Object.prototype.hasOwnProperty,kt=(t,e)=>Hn.call(t,e),j=Array.isArray,at=t=>Zt(t)==="[object Map]",bi=t=>Zt(t)==="[object Set]";var it=t=>typeof t=="function",Yn=t=>typeof t=="string",Qt=t=>typeof t=="symbol",ot=t=>t!==null&&typeof t=="object",Si=t=>ot(t)&&it(t.then)&&it(t.catch),Un=Object.prototype.toString,Zt=t=>Un.call(t),Ie=t=>Zt(t).slice(8,-1),$i=t=>Zt(t)==="[object Object]",te=t=>Yn(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t;var ee=t=>{let e=Object.create(null);return i=>e[i]||(e[i]=t(i))},De=ee(t=>t.charAt(0).toUpperCase()+t.slice(1)),mt=(t,e)=>!Object.is(t,e);function Ae(t,...e){console.warn(`[Vue warn] ${t}`,...e);}var G,oe=class{constructor(e=!1){this.detached=e,this._active=!0,this.effects=[],this.cleanups=[],this.parent=G,!e&&G&&(this.index=(G.scopes||(G.scopes=[])).push(this)-1);}get active(){return this._active}run(e){if(this._active){let i=G;try{return G=this,e()}finally{G=i;}}else Ae("cannot run an inactive effect scope.");}on(){G=this;}off(){G=this.parent;}stop(e){if(this._active){let i,s;for(i=0,s=this.effects.length;i<s;i++)this.effects[i].stop();for(i=0,s=this.cleanups.length;i<s;i++)this.cleanups[i]();if(this.scopes)for(i=0,s=this.scopes.length;i<s;i++)this.scopes[i].stop(!0);if(!this.detached&&this.parent&&!e){let n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index);}this.parent=void 0,this._active=!1;}}};function Kn(t,e=G){e&&e.active&&e.effects.push(t);}function Ci(){return G}var Pt=t=>{let e=new Set(t);return e.w=0,e.n=0,e},Ni=t=>(t.w&ct)>0,Ii=t=>(t.n&ct)>0,qn=({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=ct;},Jn=t=>{let{deps:e}=t;if(e.length){let i=0;for(let s=0;s<e.length;s++){let n=e[s];Ni(n)&&!Ii(n)?n.delete(t):e[i++]=n,n.w&=~ct,n.n&=~ct;}e.length=i;}},ze=new WeakMap,Ot=0,ct=1,Le=30,F,vt=Symbol("iterate"),Fe=Symbol("Map key iterate"),Rt=class{constructor(e,i=null,s){this.fn=e,this.scheduler=i,this.active=!0,this.deps=[],this.parent=void 0,Kn(this,s);}run(){if(!this.active)return this.fn();let e=F,i=lt;for(;e;){if(e===this)return;e=e.parent;}try{return this.parent=F,F=this,lt=!0,ct=1<<++Ot,Ot<=Le?qn(this):xi(this),this.fn()}finally{Ot<=Le&&Jn(this),ct=1<<--Ot,F=this.parent,lt=i,this.parent=void 0,this.deferStop&&this.stop();}}stop(){F===this?this.deferStop=!0:this.active&&(xi(this),this.onStop&&this.onStop(),this.active=!1);}};function xi(t){let{deps:e}=t;if(e.length){for(let i=0;i<e.length;i++)e[i].delete(t);e.length=0;}}var lt=!0,Di=[];function Qn(){Di.push(lt),lt=!1;}function Zn(){let t=Di.pop();lt=t===void 0?!0:t;}function H(t,e,i){if(lt&&F){let s=ze.get(t);s||ze.set(t,s=new Map);let n=s.get(i);n||s.set(i,n=Pt()),We(n,{effect:F,target:t,type:e,key:i});}}function We(t,e){let i=!1;Ot<=Le?Ii(t)||(t.n|=ct,i=!Ni(t)):i=!t.has(F),i&&(t.add(F),F.deps.push(t),F.onTrack&&F.onTrack(Object.assign({effect:F},e)));}function ut(t,e,i,s,n,r){let a=ze.get(t);if(!a)return;let o=[];if(e==="clear")o=[...a.values()];else if(i==="length"&&j(t)){let l=Number(s);a.forEach((u,c)=>{(c==="length"||c>=l)&&o.push(u);});}else switch(i!==void 0&&o.push(a.get(i)),e){case"add":j(t)?te(i)&&o.push(a.get("length")):(o.push(a.get(vt)),at(t)&&o.push(a.get(Fe)));break;case"delete":j(t)||(o.push(a.get(vt)),at(t)&&o.push(a.get(Fe)));break;case"set":at(t)&&o.push(a.get(vt));break}let h={target:t,type:e,key:i,newValue:s,oldValue:n,oldTarget:r};if(o.length===1)o[0]&&(bt(o[0],h));else {let l=[];for(let u of o)u&&l.push(...u);bt(Pt(l),h);}}function bt(t,e){let i=j(t)?t:[...t];for(let s of i)s.computed&&Ti(s,e);for(let s of i)s.computed||Ti(s,e);}function Ti(t,e){(t!==F||t.allowRecurse)&&(t.onTrigger&&t.onTrigger(Jt({effect:t},e)),t.scheduler?t.scheduler():t.run());}var tr=Ne("__proto__,__v_isRef,__isVue"),Ai=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Qt)),er=Be(),ir=Be(!1,!0),sr=Be(!0);var Mi=nr();function nr(){let t={};return ["includes","indexOf","lastIndexOf"].forEach(e=>{t[e]=function(...i){let s=$(this);for(let r=0,a=this.length;r<a;r++)H(s,"get",r+"");let n=s[e](...i);return n===-1||n===!1?s[e](...i.map($)):n};}),["push","pop","shift","unshift","splice"].forEach(e=>{t[e]=function(...i){Qn();let s=$(this)[e].apply(this,i);return Zn(),s};}),t}function rr(t){let e=$(this);return H(e,"has",t),e.hasOwnProperty(t)}function Be(t=!1,e=!1){return function(s,n,r){if(n==="__v_isReactive")return !t;if(n==="__v_isReadonly")return t;if(n==="__v_isShallow")return e;if(n==="__v_raw"&&r===(t?e?Er:ji:e?Vi:Wi).get(s))return s;let a=j(s);if(!t){if(a&&kt(Mi,n))return Reflect.get(Mi,n,r);if(n==="hasOwnProperty")return rr}let o=Reflect.get(s,n,r);return (Qt(n)?Ai.has(n):tr(n))||(t||H(s,"get",n),e)?o:K(o)?a&&te(n)?o:o.value:ot(o)?t?Bi(o):Q(o):o}}var ar=zi(),or=zi(!0);function zi(t=!1){return function(i,s,n,r){let a=i[s];if(Ct(a)&&K(a)&&!K(n))return !1;if(!t&&(!Dt(n)&&!Ct(n)&&(a=$(a),n=$(n)),!j(i)&&K(a)&&!K(n)))return a.value=n,!0;let o=j(i)&&te(s)?Number(s)<i.length:kt(i,s),h=Reflect.set(i,s,n,r);return i===$(r)&&(o?mt(n,a)&&ut(i,"set",s,n,a):ut(i,"add",s,n)),h}}function hr(t,e){let i=kt(t,e),s=t[e],n=Reflect.deleteProperty(t,e);return n&&i&&ut(t,"delete",e,void 0,s),n}function lr(t,e){let i=Reflect.has(t,e);return (!Qt(e)||!Ai.has(e))&&H(t,"has",e),i}function cr(t){return H(t,"iterate",j(t)?"length":vt),Reflect.ownKeys(t)}var Li={get:er,set:ar,deleteProperty:hr,has:lr,ownKeys:cr},ur={get:sr,set(t,e){return Ae(`Set operation on key "${String(e)}" failed: target is readonly.`,t),!0},deleteProperty(t,e){return Ae(`Delete operation on key "${String(e)}" failed: target is readonly.`,t),!0}},fr=Jt({},Li,{get:ir,set:or});var He=t=>t,he=t=>Reflect.getPrototypeOf(t);function ie(t,e,i=!1,s=!1){t=t.__v_raw;let n=$(t),r=$(e);i||(e!==r&&H(n,"get",e),H(n,"get",r));let{has:a}=he(n),o=s?He:i?Xe:Nt;if(a.call(n,e))return o(t.get(e));if(a.call(n,r))return o(t.get(r));t!==n&&t.get(e);}function se(t,e=!1){let i=this.__v_raw,s=$(i),n=$(t);return e||(t!==n&&H(s,"has",t),H(s,"has",n)),t===n?i.has(t):i.has(t)||i.has(n)}function ne(t,e=!1){return t=t.__v_raw,!e&&H($(t),"iterate",vt),Reflect.get(t,"size",t)}function ki(t){t=$(t);let e=$(this);return he(e).has.call(e,t)||(e.add(t),ut(e,"add",t,t)),this}function Oi(t,e){e=$(e);let i=$(this),{has:s,get:n}=he(i),r=s.call(i,t);r?Fi(i,s,t):(t=$(t),r=s.call(i,t));let a=n.call(i,t);return i.set(t,e),r?mt(e,a)&&ut(i,"set",t,e,a):ut(i,"add",t,e),this}function Pi(t){let e=$(this),{has:i,get:s}=he(e),n=i.call(e,t);n?Fi(e,i,t):(t=$(t),n=i.call(e,t));let r=s?s.call(e,t):void 0,a=e.delete(t);return n&&ut(e,"delete",t,void 0,r),a}function Ri(){let t=$(this),e=t.size!==0,i=at(t)?new Map(t):new Set(t),s=t.clear();return e&&ut(t,"clear",void 0,void 0,i),s}function re(t,e){return function(s,n){let r=this,a=r.__v_raw,o=$(a),h=e?He:t?Xe:Nt;return !t&&H(o,"iterate",vt),a.forEach((l,u)=>s.call(n,h(l),h(u),r))}}function ae(t,e,i){return function(...s){let n=this.__v_raw,r=$(n),a=at(r),o=t==="entries"||t===Symbol.iterator&&a,h=t==="keys"&&a,l=n[t](...s),u=i?He:e?Xe:Nt;return !e&&H(r,"iterate",h?Fe:vt),{next(){let{value:c,done:p}=l.next();return p?{value:c,done:p}:{value:o?[u(c[0]),u(c[1])]:u(c),done:p}},[Symbol.iterator](){return this}}}}function ht(t){return function(...e){{let i=e[0]?`on key "${e[0]}" `:"";console.warn(`${De(t)} operation ${i}failed: target is readonly.`,$(this));}return t==="delete"?!1:this}}function dr(){let t={get(r){return ie(this,r)},get size(){return ne(this)},has:se,add:ki,set:Oi,delete:Pi,clear:Ri,forEach:re(!1,!1)},e={get(r){return ie(this,r,!1,!0)},get size(){return ne(this)},has:se,add:ki,set:Oi,delete:Pi,clear:Ri,forEach:re(!1,!0)},i={get(r){return ie(this,r,!0)},get size(){return ne(this,!0)},has(r){return se.call(this,r,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:re(!0,!1)},s={get(r){return ie(this,r,!0,!0)},get size(){return ne(this,!0)},has(r){return se.call(this,r,!0)},add:ht("add"),set:ht("set"),delete:ht("delete"),clear:ht("clear"),forEach:re(!0,!0)};return ["keys","values","entries",Symbol.iterator].forEach(r=>{t[r]=ae(r,!1,!1),i[r]=ae(r,!0,!1),e[r]=ae(r,!1,!0),s[r]=ae(r,!0,!0);}),[t,i,e,s]}var[pr,gr,mr,vr]=dr();function Ye(t,e){let i=e?t?vr:mr:t?gr:pr;return (s,n,r)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?s:Reflect.get(kt(i,n)&&n in s?i:s,n,r)}var yr={get:Ye(!1,!1)},_r={get:Ye(!1,!0)},wr={get:Ye(!0,!1)};function Fi(t,e,i){let s=$(i);if(s!==i&&e.call(t,s)){let n=Ie(t);console.warn(`Reactive ${n} contains both the raw and reactive versions of the same object${n==="Map"?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);}}var Wi=new WeakMap,Vi=new WeakMap,ji=new WeakMap,Er=new WeakMap;function br(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Sr(t){return t.__v_skip||!Object.isExtensible(t)?0:br(Ie(t))}function Q(t){return Ct(t)?t:Ue(t,!1,Li,yr,Wi)}function le(t){return Ue(t,!1,fr,_r,Vi)}function Bi(t){return Ue(t,!0,ur,wr,ji)}function Ue(t,e,i,s,n){if(!ot(t))return console.warn(`value cannot be made reactive: ${String(t)}`),t;if(t.__v_raw&&!(e&&t.__v_isReactive))return t;let r=n.get(t);if(r)return r;let a=Sr(t);if(a===0)return t;let o=new Proxy(t,a===2?s:i);return n.set(t,o),o}function It(t){return Ct(t)?It(t.__v_raw):!!(t&&t.__v_isReactive)}function Ct(t){return !!(t&&t.__v_isReadonly)}function Dt(t){return !!(t&&t.__v_isShallow)}function $(t){let e=t&&t.__v_raw;return e?$(e):t}var Nt=t=>ot(t)?Q(t):t,Xe=t=>ot(t)?Bi(t):t;function Hi(t){lt&&F&&(t=$(t),We(t.dep||(t.dep=Pt()),{target:t,type:"get",key:"value"}));}function Yi(t,e){t=$(t);let i=t.dep;i&&(bt(i,{target:t,type:"set",key:"value",newValue:e}));}function K(t){return !!(t&&t.__v_isRef===!0)}function St(t){return $r(t,!1)}function $r(t,e){return K(t)?t:new Ve(t,e)}var Ve=class{constructor(e,i){this.__v_isShallow=i,this.dep=void 0,this.__v_isRef=!0,this._rawValue=i?e:$(e),this._value=i?e:Nt(e);}get value(){return Hi(this),this._value}set value(e){let i=this.__v_isShallow||Dt(e)||Ct(e);e=i?e:$(e),mt(e,this._rawValue)&&(this._rawValue=e,this._value=i?e:Nt(e),Yi(this,e));}};function ce(t){return K(t)?t.value:t}var Ui,je=class{constructor(e,i,s,n){this._setter=i,this.dep=void 0,this.__v_isRef=!0,this[Ui]=!1,this._dirty=!0,this.effect=new Rt(e,()=>{this._dirty||(this._dirty=!0,Yi(this));}),this.effect.computed=this,this.effect.active=this._cacheable=!n,this.__v_isReadonly=s;}get value(){let e=$(this);return Hi(e),(e._dirty||!e._cacheable)&&(e._dirty=!1,e._value=e.effect.run()),e._value}set value(e){this._setter(e);}};Ui="__v_isReadonly";function O(t,e,i=!1){let s,n,r=it(t);r?(s=t,n=()=>{console.warn("Write operation failed: computed value is readonly");}):(s=t.get,n=t.set);let a=new je(s,n,r||!n,i);return e&&!i&&(a.effect.onTrack=e.onTrack,a.effect.onTrigger=e.onTrigger),a}var ve=In(Gi(),1),Rr=Object.defineProperty;var Ki=Object.getOwnPropertySymbols,Cr=Object.prototype.hasOwnProperty,Nr=Object.prototype.propertyIsEnumerable,Y=Math.pow,Qe=(t,e,i)=>e in t?Rr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ir=(t,e)=>{for(var i in e||(e={}))Cr.call(e,i)&&Qe(t,i,e[i]);if(Ki)for(var i of Ki(e))Nr.call(e,i)&&Qe(t,i,e[i]);return t};var d=(t,e,i)=>(Qe(t,typeof e!="symbol"?e+"":e,i),i);function Vt(t,e,i){let s;try{s=i?t(...i):t();}catch(n){Vs(n,e);}return s}function Ze(t,e,i){if(it(t)){let n=Vt(t,e,i);return n&&Si(n)&&n.catch(r=>{Vs(r,e);}),n}let s=[];for(let n=0;n<t.length;n++)s.push(Ze(t[n],e,i));return s}function Vs(t,e){console.error(new Error(`[src/fns/watch]: ${e}`)),console.error(t);}function pe(t){console.warn(Dr(t));}function Dr(t){return new Error(`[reactivue]: ${t}`)}var ye=!1,ti=!1,J=[],pt=0,Tt=[],Z=null,ft=0,Ar=Promise.resolve(),zr=100;function Lr(t){let e=pt+1,i=J.length;for(;e<i;){let s=e+i>>>1;Ht(J[s])<t?e=s+1:i=s;}return e}function Fr(t){(!J.length||!J.includes(t,ye&&t.allowRecurse?pt+1:pt))&&(t.id==null?J.push(t):J.splice(Lr(t.id),0,t),Bs());}function Bs(){!ye&&!ti&&(ti=!0,Ar.then(Hs));}function qi(t){j(t)?Tt.push(...t):(!Z||!Z.includes(t,t.allowRecurse?ft+1:ft))&&Tt.push(t),Bs();}function Wr(t){if(Tt.length){let e=[...new Set(Tt)];if(Tt.length=0,Z){Z.push(...e);return}for(Z=e,(t=t||new Map),Z.sort((i,s)=>Ht(i)-Ht(s)),ft=0;ft<Z.length;ft++)Ys(t,Z[ft])||Z[ft]();Z=null,ft=0;}}var Ht=t=>t.id==null?1/0:t.id,Vr=(t,e)=>{let i=Ht(t)-Ht(e);if(i===0){if(t.pre&&!e.pre)return -1;if(e.pre&&!t.pre)return 1}return i};function Hs(t){ti=!1,ye=!0,(t=t||new Map),J.sort(Vr);let e=i=>Ys(t,i);try{for(pt=0;pt<J.length;pt++){let i=J[pt];if(i&&i.active!==!1){if(!1!=="production"&&e(i))continue;Vt(i,"scheduler");}}}finally{pt=0,J.length=0,Wr(t),ye=!1,(J.length||Tt.length)&&Hs(t);}}function Ys(t,e){if(!t.has(e))t.set(e,1);else {let i=t.get(e);if(i>zr)return !0;t.set(e,i+1);}}function z(t,e){return Us(t,null,e)}var ue={};function Yt(t,e,i){return !it(e)&&pe("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),Us(t,e,i)}function Us(t,e,{immediate:i,deep:s,flush:n,onTrack:r,onTrigger:a}=Ei){!e&&(i!==void 0&&pe('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),s!==void 0&&pe('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'));let o=v=>{pe("Invalid watch source: "+v+"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.");},h,l=!1,u=!1;if(K(t)?(h=()=>t.value,l=Dt(t)):It(t)?(h=()=>t,s=!0):j(t)?(u=!0,l=t.some(v=>It(v)||Dt(v)),h=()=>t.map(v=>{if(K(v))return v.value;if(It(v))return $t(v);if(it(v))return Vt(v,"watch_getter");o(v);})):it(t)?e?h=()=>Vt(t,"watch_getter"):h=()=>(c&&c(),Ze(t,"watch_callback",[p])):(h=st,o(t)),e&&s){let v=h;h=()=>$t(v());}let c,p=v=>{c=y.onStop=()=>{Vt(v,"watch_cleanup");};},f=u?new Array(t.length).fill(ue):ue,m=()=>{if(y.active)if(e){let v=y.run();(s||l||(u?v.some((w,_)=>mt(w,f[_])):mt(v,f)))&&(c&&c(),Ze(e,"watch_callback",[v,f===ue?void 0:u&&f[0]===ue?[]:f,p]),f=v);}else y.run();};m.allowRecurse=!!e;let g;n==="sync"?g=m:n==="post"?g=()=>qi(m):(m.pre=!0,g=()=>Fr(m));let y=new Rt(h,g);return (y.onTrack=r,y.onTrigger=a),e?i?m():f=y.run():n==="post"?qi(y.run.bind(y)):y.run(),()=>{y.stop();}}function $t(t,e){if(!ot(t)||t.__v_skip||(e=e||new Set,e.has(t)))return t;if(e.add(t),K(t))$t(t.value,e);else if(j(t))for(let i=0;i<t.length;i++)$t(t[i],e);else if(bi(t)||at(t))t.forEach(i=>{$t(i,e);});else if($i(t))for(let i in t)$t(t[i],e);return t}var W=Symbol("context cache"),tt=Symbol("computed cache"),wt=Symbol("draw context on sandbox"),L=Symbol("bounce client rect"),B=Symbol("bounding client rect"),Mt=Symbol("context size"),I=Symbol("child node"),P=Symbol("canvas element"),T=Symbol("scope"),yt=Symbol("div container"),nt=Symbol("listeners"),rt=Symbol("store events"),_e=Symbol("add event"),we=Symbol("remove event"),Ee=Symbol("raw map listeners"),U=Symbol("ref mark change");function jr(t,e){let i=0,s=0,n=0,r=0;return t.forEach(a=>{let o=e?a.getClientRect(e):a[L].value,{x:h=0,y:l=0}=a.$,u=o.x+h,c=o.y+l,p=o.width+Math.abs(h),f=o.height+Math.abs(l);u<i&&(i=u),c<s&&(s=c),p>n&&(n=p),f>r&&(r=f);}),{x:i,y:s,width:n,height:r}}var Xs,Gs=class{constructor(){d(this,Xs,le(new Map));}on(t,e){this[nt].has(t)||this[nt].set(t,new Set),this[nt].get(t).add(e);}off(t,e){var i;e?(i=this[nt].get(t))==null||i.delete(e):this[nt].delete(t);}emit(t,e){var i;(i=this[nt].get(t))==null||i.forEach(s=>s(e));}destroy(){this.emit("destroy"),this[nt].clear();}};Xs=nt;var Ks,qs=class extends Gs{constructor(){super(...arguments),d(this,Ks,le(new Set));}get children(){return this[I]}add(t){return this[I].add(t)}delete(t){return this[I].delete(t)}destroy(){super.destroy(),this[I].clear();}};Ks=I;var Js=class extends qs{getClientRect(t){return jr(this[I],t)}childEach(t){if(t.length>=4){let e=new Set,i=s=>e.add(s);this[I].forEach(s=>{t(s,s,this[I],i);}),e.forEach(s=>this.add(s));}else this[I].forEach(t);}},ai=typeof UIEvent!="undefined"?UIEvent:class{constructor(e){this.type=e,d(this,"isTrusted",!1),d(this,"bubbles",!1),d(this,"cancelBubble",!1),d(this,"cancelable",!1),d(this,"composed",!1),d(this,"currentTarget",null),d(this,"defaultPrevented",!1),d(this,"detail",0),d(this,"eventPhase",0),d(this,"returnValue",!0),d(this,"sourceCapabilities",null),d(this,"srcElement",null),d(this,"target",null),d(this,"timeStamp",Date.now()),d(this,"view",null),d(this,"which",0);}};function Te(t){let e=new oe(t),i;return e.fOn=()=>{e.active&&(i=Ci(),e.on());},e.fOff=()=>{let{parent:s}=e;e.parent=i,e.off(),e.parent=s;},e}var Br=typeof OffscreenCanvas!="undefined"?OffscreenCanvas:class{constructor(e,i){let s=document.createElement("canvas");return [s.width,s.height]=[e,i],s}},X={createCanvas(){return document.createElement("canvas")},createOffscreenCanvas(t=300,e=150){return new Br(t,e)}},Me=typeof document!="undefined";function oi(t){return (t?X.createOffscreenCanvas():X.createCanvas()).getContext("2d")}function be(t){}var xt={angleMode:"degrees",defaultWidth:300,defaultHeight:150};function Se(t){return t}function Qs(t){var e,i,s;if(t==="none")return "none";let n="";return t.url!==void 0&&(n+=` url(${JSON.stringify(t.url)})`),t.blur!==void 0&&(n+=` blur(${t.blur}px)`),t.brightness!==void 0&&(n+=` brightness(${t.brightness}%)`),t.contrast!==void 0&&(n+=` contrast(${t.contrast})`),t.dropShadow!==void 0&&(n+=` drop-shadow(${(e=t.dropShadow.x)!=null?e:0}px ${(i=t.dropShadow.y)!=null?i:0}px ${(s=t.dropShadow.blur)!=null?s:0}px ${t.dropShadow.color})`),t.greyscale!==void 0&&(n+=` greyscale(${t.greyscale}%)`),t.hueRotate!==void 0&&(n+=` hue-rotate(${Se(t.hueRotate)}deg)`),t.invert!==void 0&&(n+=` invert(${t.invert}%)`),t.opacity!==void 0&&(n+=` opacity(${t.opacity}%)`),t.saturate!==void 0&&(n+=` saturate(${t.saturate}%)`),t.sepia!==void 0&&(n+=` sepia(${t.sepia}%)`),n===""&&(n="none"),n.trim()}function hi(t,e=!1){var i,s,n,r,a,o;if(t.scale!==void 0&&t.rotation!==void 0&&t.offset!==void 0&&e!==void 0&&t.skewX!==void 0&&t.skewY!==void 0)return null;let h=new DOMMatrix;return t.scale&&h.scaleSelf(t.scale.x,t.scale.y),t.rotation&&h.rotateSelf(Se(t.rotation)),(t.offset!==void 0||e)&&h.translateSelf(((s=(i=t.offset)==null?void 0:i.x)!=null?s:0)+((n=t.x)!=null?n:0),((a=(r=t.offset)==null?void 0:r.y)!=null?a:0)+((o=t.y)!=null?o:0)),t.skewX!==void 0&&h.skewXSelf(t.skewX),t.skewY!==void 0&&h.skewYSelf(t.skewY),h}function ge(t,e=!1){var i,s,n,r;return !!(e&&(t.x!==void 0||t.y!==void 0)||((i=t.scale)==null?void 0:i.x)!==void 0||((s=t.scale)==null?void 0:s.y)!==void 0||t.rotation!==void 0||((n=t.offset)==null?void 0:n.x)!==void 0||((r=t.offset)==null?void 0:r.y)!==void 0||t.skewX!==void 0||t.skewY!==void 0)}function li(t,e,i,s){let n=e.clip!==void 0;if(n)if(t.save(),typeof e.clip=="function"){let c=new Path2D;e.clip.call(s,c),t.clip(c);}else t.rect(e.clip.x,e.clip.y,e.clip.width,e.clip.height);let r=ge(e)||!t,a=e.opacity!==void 0,o=e.filter!==void 0,h,l,u;if(a&&(l=t.globalAlpha,t.globalAlpha=e.opacity),r){h=t.getTransform();let c=hi(e,!t);c&&t.setTransform(c);}o&&(u=t.filter,t.filter=Qs(e.filter)),i.forEach(c=>{c.draw(t);}),o&&(t.filter=u),r&&t.setTransform(h),a&&(t.globalAlpha=l),n&&t.restore();}function ci(t,e){return Object.defineProperty(t,"target",{writable:!1,value:e}),t}var Ji,Qi,Zi,ts,es,is,ss,Ur=class extends Js{constructor(t={}){super(),d(this,"_parents",0),d(this,"$"),d(this,Ji),d(this,Qi),d(this,Zi),d(this,ts),d(this,es),d(this,is),d(this,ss,Te()),this[T].fOn(),typeof t=="function"?(this.$=Q(t(this)),be()):this.$=Q(t),this[W]=oi(!Me||ce(this.$.offscreen)!==!1),this[L]=O(()=>this.getClientRect()),this[B]=O(()=>{let{x:e=0,y:i=0}=this.$,{width:s,height:n}=this[L].value;return {x:e,y:i,width:s,height:n}}),this[U]=St(0),this[tt]=O(()=>{this[U].value;let e=this[W];return e.clearRect(0,0,e.canvas.width,e.canvas.height),this[wt](e),!1}),this[Mt]=O(()=>{if(this.$.width!==void 0&&this.$.height!==void 0)return {width:this.$.width,height:this.$.height};let{width:i,height:s}=this[L].value;return {width:i,height:s}}),Yt(this[Mt],({width:e,height:i})=>{let s=this[W];s.canvas.width===e&&s.canvas.height===i||([s.canvas.width,s.canvas.height]=[e,i],this.markChange(),this.emit("resize",ci(new ai("resize"),s.canvas)));},{immediate:!0,flush:this.$.sync?"sync":void 0}),this[T].fOff();}get attrs(){return this.$}[(Ji=L,Qi=B,Zi=W,ts=tt,es=Mt,is=U,ss=T,wt)](t){let e=this[L].value,i=e.x!==0||e.y!==0;i&&t.translate(-e.x,-e.y),li(t,this.$,this[I],this),i&&t.translate(e.x,e.y);}markChange(){this[U].value++;}draw(t){var e,i;if(this.$.visible===!1)return;let{x:s,y:n}=this[L].value;this[tt].value,t.drawImage(this[W].canvas,((e=this.$.x)!=null?e:0)+s,((i=this.$.y)!=null?i:0)+n);}getBoundingClientRect(){return this[B].value}isPressedPoint(t,e){for(let i of this[I].values())if(i.isPressedPoint(t,e))return !0;return !1}add(t){let e;return this[I].size<(e=super.add(t)).size&&t._parents++,e}delete(t){return super.delete(t)?(t._parents--,t._parents<=0&&t.destroy(),!0):!1}addTo(t){return t.add(this),this}destroy(){super.destroy(),this[T].stop();}};d(Ur,"type","Group");function ui(t,e,i,s,n,r){let a=Math.min(i,i+n),o=Math.max(i,i+n),h=Math.min(s,s+r),l=Math.max(s,s+r);return a<=t&&t<=o&&h<=e&&e<=l}function ei(t){return (t==null?void 0:t.style)!==void 0}var _t=Symbol("wait drawing"),fe=Symbol("ID_REQUEST_FRAME"),Xr=0,ns,rs,as,os,hs,ls,cs,us,fi=class extends Js{constructor(t={}){super(),d(this,"uid",++Xr+""),d(this,"$"),d(this,ns),d(this,rs),d(this,as),d(this,os),d(this,hs),d(this,ls,Te()),d(this,cs,!1),d(this,us,null),d(this,"_context2d",null),d(this,"lastIdDraw",0),d(this,"_resolveTick"),d(this,"_rejectTick"),d(this,"_promiseTick"),d(this,"stopWaitDraw"),this[T].fOn(),this[P]=!Me||ce(t.offscreen)?X.createOffscreenCanvas():X.createCanvas(),this.$=Q(t);let e=this[P];if(ei(e)){e.style.cssText="position: absolute; margin: 0; padding: 0",z(()=>{var n,r;e.style.left=((n=this.$.x)!=null?n:0)+"px",e.style.top=((r=this.$.y)!=null?r:0)+"px";});let s="";z(()=>{s=e.style.display;let n=getComputedStyle(e).getPropertyValue("display");if(this.$.visible!==!1){n==="none"?e.style.display="block":e.style.display=s==="none"?"":s;return}n!=="none"&&(e.style.display="none");});}this[L]=O(()=>this.getClientRect()),this[B]=O(()=>{let{x:s=0,y:n=0}=this.$,{width:r,height:a}=this[L].value;return {x:s,y:n,width:r,height:a}}),this[U]=St(0);let i=0;this[tt]=O(()=>{let s=this[W];return this[U].value,this.$.clearBeforeDraw!==!1&&s.clearRect(0,0,s.canvas.width,s.canvas.height),this[wt](s),++i}),z(()=>{let{width:s,height:n}=this.$;if(!(s!==void 0&&n!==void 0))return;let a=this[P];[a.width,a.height]=[s,n],this.markChange(),this.emit("resize",ci(new ai("resize"),a));}),this[T].fOff();}get attrs(){return this.$}get[(ns=L,rs=B,as=P,os=tt,hs=U,ls=T,cs=_t,us=fe,W)](){var t;return ((t=this._context2d)==null?void 0:t.canvas)===this[P]?this._context2d:this._context2d=this[P].getContext("2d")}toCanvas(){return this[P]}markChange(){this[U].value++;}[wt](t){li(t,this.$,this[I],this);}getBoundingClientRect(){return this[B].value}draw(){if(this.$.visible===!1)return;let t=this[tt].value,e=t!==this.lastIdDraw;return this.lastIdDraw=t,e}nextTick(){return this._promiseTick?this._promiseTick:this._promiseTick=new Promise((t,e)=>{[this._resolveTick,this._rejectTick]=[t,e];}).finally(()=>{[this._resolveTick,this._rejectTick]=[void 0,void 0];})}batchDraw(){this[_t]||this.stopWaitDraw||(this[_t]=!0,this[fe]=requestAnimationFrame(()=>{var t;if(!this[_t])return;let e=this.draw();if(this[_t]=!1,(t=this._resolveTick)==null||t.call(this),!e){this.stopWaitDraw||(this.stopWaitDraw=Yt(()=>this[tt].value,()=>this.batchDraw()));return}this.batchDraw();}));}stopDraw(){var t,e;if(this.stopWaitDraw&&(this.stopWaitDraw(),this.stopWaitDraw=void 0),!this[fe])return;let i=!this[_t];this[_t]=!1,cancelAnimationFrame(this[fe]),i?(t=this._resolveTick)==null||t.call(this):(e=this._rejectTick)==null||e.call(this);}add(t){let e;return this[I].size<(e=super.add(t)).size&&t._parents++,e}delete(t){return super.delete(t)?(t._parents--,t._parents<=0&&t.destroy(),!0):!1}isPressedPoint(t,e){let{x:i=0,y:s=0}=this.$,{width:n,height:r}=this[P];return ui(t,e,i,s,n,r)}addTo(t){return t.add(this),this}destroy(){super.destroy(),this.stopDraw(),this[T].stop();let t=this[P];ei(t)&&t.remove();}};d(fi,"type","Layer");var jt=new Map;function Zs(t,e=!1){if(e)return Et(t);let i=(0, ve.default)(t),s=jt.get(i);if(s)return Promise.resolve(s);if(X.loadImage)return X.loadImage(t).then(r=>(jt.set(i,r),r));let n=new Image;return new Promise((r,a)=>{function o(){jt.set(i,n),r(n),n.removeEventListener("load",o),n.removeEventListener("error",h);}function h(l){a(l),n.removeEventListener("load",o),n.removeEventListener("error",h);}n.addEventListener("load",o),n.addEventListener("error",h),n.src=t;})}function Et(t){if(!jt.has((0, ve.default)(t)))throw new Error(`Cannot find image ${t}. First run await loadImage().`);return jt.get((0, ve.default)(t))}function Gr(t,e){let i=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],s,n,r,a;return i.forEach(o=>{let h=e.transformPoint(o);s===void 0&&(s=r=h.x,n=a=h.y),s=Math.min(s,h.x),n=Math.min(n,h.y),r=Math.max(r,h.x),a=Math.max(a,h.y);}),{x:s,y:n,width:r-s,height:a-n}}function Kr(t){return t.fillPriority?t.fillPriority:t.fillPattern?"pattern":t.fillLinearGradient!==void 0?"linear-gradient":t.fillRadialGradient!==void 0?"radial-gradient":"color"}function qr(t,e){var i,s,n;e.strokeEnabled!==!1&&(e.strokeWidth!==void 0&&(t.lineWidth=e.strokeWidth),t.lineJoin=(i=e.lineJoin)!=null?i:"miter",t.lineCap=(s=e.lineCap)!=null?s:"butt",(n=e.dashEnabled)==null||n?e.dash&&t.setLineDash($(e.dash)):t.getLineDash().length&&t.setLineDash([]));}function qe(t,e){var i,s,n,r,a;e.shadowEnabled!==!1&&e.shadow!==void 0?(t.shadowColor=e.shadow.color,t.shadowOffsetX=(s=(i=e.shadow)==null?void 0:i.x)!=null?s:0,t.shadowOffsetY=(r=(n=e.shadow)==null?void 0:n.y)!=null?r:0,t.shadowBlur=(a=e.shadow.blur)!=null?a:0):t.shadowColor!=="transparent"&&(t.shadowColor="transparent");}function Je(t){return t.constructor._centroid}var fs,ds,ps,gs,ms,vs,ys,D=class extends Gs{constructor(t,e="post"){super(),d(this,"$"),d(this,"_parents",0),d(this,fs),d(this,ds),d(this,ps),d(this,gs),d(this,ms),d(this,vs),d(this,ys,Te()),this[T].fOn(),typeof t=="function"?(this.$=Q(t(this)),be()):this.$=Q(t),this[W]=oi(!Me||ce(this.$.offscreen)!==!1),this[L]=O(()=>this.getClientRect()),this[B]=O(()=>{let{x:i,y:s}=this.$,{x:n,y:r,width:a,height:o}=this[L].value;return {x:i+n,y:s+r,width:a,height:o}}),this[U]=St(0),this[tt]=O(()=>{if(this[U].value,this.$.perfectDrawEnabled!==!1){let i=this[W];i.clearRect(0,0,i.canvas.width,i.canvas.height),this[wt](i);}return !1}),this[Mt]=O(()=>{var i;let{width:s,height:n}=this[L].value,r=((i=this.$.strokeWidth)!=null?i:1)*2;return {width:s+r,height:n+r}}),z(()=>{if(this.$.perfectDrawEnabled!==!1){let i=this[W],{width:s,height:n}=this[Mt].value;[i.canvas.width,i.canvas.height]=[s,n],this.markChange(),this.emit("resize",ci(new ai("resize"),i.canvas));}},{flush:e}),this[T].fOff();}get attrs(){return this.$}get type(){return this.constructor.type}getFill(t){var e,i;let s;switch(this.$.fillEnabled!==!1&&Kr(this.$)){case"color":s=this.$.fill;break;case"pattern":if(this.$.fillPattern){let{image:n}=this.$.fillPattern;if(s=t.createPattern(typeof n=="string"?Et(n):n,(i=(e=this.$.fillPattern)==null?void 0:e.repeat)!=null?i:null),ge(this.$.fillPattern,!0)){let r=hi(this.$.fillPattern,!0);r&&s.setTransform(r);}}break;case"linear-gradient":if(this.$.fillLinearGradient!==void 0){let{fillLinearGradient:n}=this.$;s=t.createLinearGradient(n.start.x,n.start.y,n.end.x,n.end.y),n.colorStops.forEach(([r,a])=>{s.addColorStop(r,a);});}break;case"radial-gradient":if(this.$.fillRadialGradient!==void 0){let{fillRadialGradient:n}=this.$;s=t.createRadialGradient(n.start.x,n.start.y,n.startRadius,n.end.x,n.end.y,n.endRadius),n.colorStops.forEach(([r,a])=>{s.addColorStop(r,a);});}break}return s}fillScene(t,e){let i=this.getFill(t);t.fillStyle=i!=null?i:"transparent",i&&t.fill(e);}getStroke(t){return this.$.strokeEnabled!==!1?this.$.stroke:void 0}strokeScene(t){let e=this.getStroke(t);t.strokeStyle=e!=null?e:"transparent",e&&t.stroke();}fillStrokeScene(t){var e;let i=(e=this.$.shadowForStrokeEnabled)!=null?e:!0;this.$.fillAfterStrokeEnabled?(i?(qe(t,this.$),this.strokeScene(t)):(this.strokeScene(t),qe(t,this.$)),this.fillScene(t)):(qe(t,this.$),this.fillScene(t),i||(t.shadowBlur=0,t.shadowColor="transparent"),this.strokeScene(t));}getSize(){return {width:this.$.width,height:this.$.height}}markChange(){this[U].value++;}getRect(){let t=this.getSize(),e=Je(this);return {x:e?-t.width/2:0,y:e?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){var e,i,s,n,r,a,o,h,l,u;let c=this.getRect(),f=!t.skipStroke&&((e=this.$.strokeEnabled)!=null?e:!0)&&this.$.stroke!==void 0&&((i=this.$.strokeWidth)!=null?i:1)||0,m=c.width+f,g=c.height+f,y=!t.skipShadow&&this.$.shadowEnabled!==!1&&this.$.shadow!==void 0,b=y&&(n=(s=this.$.shadow)==null?void 0:s.x)!=null?n:0,v=y&&(a=(r=this.$.shadow)==null?void 0:r.y)!=null?a:0,w=m+Math.abs(b),_=g+Math.abs(v),E=y&&((h=(o=this.$.shadow)==null?void 0:o.blur)!=null?h:0)||0,S=w+E*2,R=_+E*2,C={width:S,height:R,x:-(f/2+E)+Math.min(b,0)+c.x,y:-(f/2+E)+Math.min(v,0)+c.y};if(!t.skipTransform&&ge(this.$,!1)){let x=!!this[W],M=new DOMMatrix;if(this.$.scale&&M.scaleSelf(this.$.scale.x,this.$.scale.y),this.$.rotation){let k=Je(this),A,V;k||(A=S/2,V=R/2),k||M.translateSelf(A,V),M.rotateSelf(Se(this.$.rotation)),k||M.translateSelf(-A,-V);}return this.$.offset&&M.translateSelf(((l=this.$.offset.x)!=null?l:0)+(x?0:this.$.x),((u=this.$.offset.y)!=null?u:0)+(x?0:this.$.y)),this.$.skewX!==void 0&&M.skewXSelf(this.$.skewX),this.$.skewY!==void 0&&M.skewYSelf(this.$.skewY),Gr(C,M)}return C}get clientRect(){return this[L].value}get bounding(){return this[B].value}getBoundingClientRect(){return this[B].value}to(t){throw new Error('You need to install the "@fcanvas/animate" plugin to use this function.')}[(fs=L,ds=B,ps=W,gs=tt,ms=Mt,vs=U,ys=T,wt)](t){var e,i,s;let n=!!this[W],r=this.$.sceneFunc||this._sceneFunc;if(!r)return;let a=this[L].value,o=n?(e=this.$.strokeWidth)!=null?e:1:0,[h,l]=[a.x-o,a.y-o];t.translate(-h,-l);let u=ge(this.$,!n),c=this.$.opacity!==void 0,p=this.$.filter!==void 0,f,m,g;if(c&&(m=t.globalAlpha,t.globalAlpha=this.$.opacity),u){f=t.getTransform();let{width:y,height:b}=this.getRect(),v=new DOMMatrix(f.toString());if(this.$.scale&&v.scaleSelf(this.$.scale.x,this.$.scale.y),this.$.rotation){let w=Je(this),_,E;w||(_=y/2,E=b/2),w||v.translateSelf(_,E),v.rotateSelf(Se(this.$.rotation)),w||v.translateSelf(-_,-E);}this.$.offset&&v.translateSelf(((i=this.$.offset.x)!=null?i:0)+(n?0:this.$.x),((s=this.$.offset.y)!=null?s:0)+(n?0:this.$.y)),this.$.skewX!==void 0&&v.skewXSelf(this.$.skewX),this.$.skewY!==void 0&&v.skewYSelf(this.$.skewY),t.setTransform(v);}p&&(g=t.filter,t.filter=Qs(this.$.filter)),t.beginPath(),qr(t,this.$),r.call(this,t),t.closePath(),p&&(t.filter=g),u&&t.setTransform(f),c&&(t.globalAlpha=m),t.translate(h,l);}draw(t){var e;if(this.$.visible!==!1)if(this.$.perfectDrawEnabled!==!1){this[tt].value;let{x:i,y:s}=this[L].value,n=(e=this.$.strokeWidth)!=null?e:1;t.drawImage(this[W].canvas,this.$.x-n+i,this.$.y-n+s);}else this[wt](t);}getHitStroke(){var t,e;return ((e=this.$.strokeHitEnabled!==!1?(t=this.$.hitStrokeWidth)!=null?t:this.$.strokeWidth:this.$.strokeWidth)!=null?e:1)-1}isPressedPoint(t,e){let{x:i,y:s,width:n,height:r}=this.getBoundingClientRect();return ui(t,e,i,s,n,r)}addTo(t){return t.add(this),this}destroy(){super.destroy(),this[T].stop();}};d(D,"type","Shape");d(D,"_centroid",!1);function Jr(t){return typeof(t==null?void 0:t.getBoundingClientRect)=="function"}function _s(t){return t.width&&t.scrollWidth/t.width||1}function ws(t){return t.height&&t.scrollHeight/t.height||1}function tn(t,e,i,s=1,n=!1){var r;let a=Jr(e),o=a?void 0:i?t.info[i]:void 0,h=a?e.getBoundingClientRect():o!=null?o:{left:0,top:0},l=a?_s(e):o?_s(o):1,u=a?ws(e):o?ws(o):1,c=t[t.type==="touchend"&&!n?"changedTouches":"touches"]||[t],p=[],f=c.length,m=0,g;for(;m<f&&(g=c[m++],p.push({x:(g.clientX-h.left)/l,y:(g.clientY-h.top)/u,winX:g.clientX,winY:g.clientY,id:(r=g.identifier)!=null?r:Math.random()}),s!==m););return p}function en(t,e,i,s){return !t.isPressedPoint||i.some(n=>t.isPressedPoint(n.x,n.y))?!0:s.type==="touchend"&&(s.touches.length===0||tn(s,e,t.uid,1/0,!0).every(n=>!t.isPressedPoint(n.x,n.y)))}var Ut=new Map;function sn(t){return (e,i,s,n)=>{var r;let a=!0;(r=e.get(i))==null||r.forEach((o,h)=>{h===n&&a&&(a=!1);let l=h[P],u=tn(s,l,h.uid);o.forEach((c,p)=>{t(p,l,u,s,c);});}),a&&s.preventDefault();}}var Qr=sn((t,e,i,s,n)=>{en(t,e,i,s)&&n.forEach(r=>r(s));});function nn(t){return sn((e,i,s,n,r)=>{en(e,i,s,n)?t&&e.__isOutside&&(e.__isOutside=!1,r.forEach(a=>a(n))):t||e.__isOutside||(e.__isOutside=!0,r.forEach(a=>a(n)));})}var rn={name:["mousemove"],handle:nn(!0)},an={name:["mousemove"],handle:nn(!1)};Ut.set("mouseover",rn);Ut.set("mouseenter",rn);Ut.set("mouseout",an);Ut.set("mouseleave",an);function on(t,e,i,s){var n,r;let a=i?t:s;return (n=t[nt])==null||n.forEach((o,h)=>{let l=e.get(h);l||e.set(h,l=new Map);let u=l.get(a);u||l.set(a,u=new Map),u.set(t,o);}),(r=t[I])==null||r.forEach(o=>{on(o,e,!1,i?o:t);}),e}var Es,bs,Ss,$s,xs,Zr=class extends qs{constructor(t={}){super(),d(this,"$"),d(this,"size"),d(this,Es),d(this,bs),d(this,Ss),d(this,$s),d(this,xs,Te()),this[yt]=Me&&t.offscreen!==!0?document.createElement("div"):void 0,this[rt]=le(new Map),this[T].fOn(),this.$=Q(t),this.size=Q({width:xt.defaultWidth,height:xt.defaultHeight}),z(()=>{var i,s;this.size.width=(i=this.$.width)!=null?i:xt.defaultWidth,this.size.height=(s=this.$.height)!=null?s:xt.defaultHeight;}),this[B]=O(()=>{let{x:i=0,y:s=0}=this.$,{width:n,height:r}=this.size;return {x:i,y:s,width:n,height:r}});let e=this[yt];if(e){e.style.cssText="position: relative;",z(()=>{let s=hi(this.$);s&&(e.style.transform=s.toString());}),z(()=>{let{width:s,height:n}=this.size;e.style.width=`${s}px`,e.style.height=`${n}px`;});let i="";z(()=>{i=e.style.display;let s=getComputedStyle(e).getPropertyValue("display");if(this.$.visible!==!1){s==="none"?e.style.display="block":e.style.display=i==="none"?"":i;return}s!=="none"&&(e.style.display="none");}),z(()=>{var s;e.style.opacity=((s=this.$.opacity)!=null?s:1)+"";});}z(()=>{let{width:i,height:s}=this.size;this[I].forEach(n=>{let{width:r,height:a}=n[P];r!==i&&(n[P].width=i),a!==s&&(n[P].height=s);});}),z(()=>{var i;let{container:s,offscreen:n}=this.$;if(n)return console.warn("[fcanvas/Stage]: disabled by 'offscreen'");if(s){if(!e)return console.warn("[fcanvas/Stage]: Can't handle options 'container' in a DOM-free environment");let r=typeof s=="string"?(i=document.getElementById(s))!=null?i:document.querySelector(s):s;r?r.appendChild(e):console.warn(`#${s} not exists.`);}});{let i=new Map,s=new Map;this[Ee]=s;let n=O(()=>(s.clear(),on(this,s,!0)));z(()=>{let r=n.value;i.forEach((a,o)=>{r.has(o)||(a.name.forEach(h=>this[we](h,a.handle)),i.delete(o));}),r.forEach((a,o)=>{var h;if(i.get(o))return;let u=(h=Ut.get(o))!=null?h:{name:[o],handle:Qr},c=p=>{u.handle(r,o,p,this);};i.set(o,{name:u.name,handle:c}),u.name.forEach(p=>this[_e](p,c,p));});});}this[T].fOff();}get attrs(){return this.$}mount(t){return this.$.container=t,this}[(Es=B,bs=Ee,Ss=rt,$s=yt,xs=T,_e)](t,e,i){var s;let n=this[rt].get(t);if(!n){let r=a=>{n.cbs.forEach(o=>o(a));};this[rt].set(t,n={deps:new Set,cbs:[],handle:r}),(s=this[yt])==null||s.addEventListener(t,r);}n.cbs.push(e),i&&n.deps.add(i);}[we](t,e){var i;let s=this[rt].get(t);s&&(s.cbs.splice(s.cbs.indexOf(e)>>>0,1),s.cbs.length===0?((i=this[yt])==null||i.removeEventListener(t,s.handle),this[rt].delete(t)):s.deps.delete(t));}getBoundingClientRect(){return this[B].value}add(t){var e;let i=super.add(t),{width:s,height:n}=this.size;ei(t[P])&&((e=this[yt])==null||e.appendChild(t[P]));let{width:r,height:a}=t[P];return r!==s&&(t[P].width=s),a!==n&&(t[P].height=n),this.$.autoDraw!==!1&&t.$.autoDraw!==!1&&t.batchDraw(),i}destroy(){var t;super.destroy(),this[T].stop(),(t=this[yt])==null||t.remove();}};d(Zr,"type","Stage");function ta(t,e,i){let s=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),n=Math.abs(t*Math.sin(i))+Math.abs(e*Math.cos(i));return [s,n]}function ea(t,e=0,i=0,s=t.width,n=t.height,r=0){let a=X.createOffscreenCanvas().getContext("2d"),o=r*Math.PI/180,[h,l]=ta(s,n,o);return a.canvas.width=s,a.canvas.height=n,r!==0&&(a.save(),a.translate(s/2,n/2),a.rotate(o)),a.drawImage(t,e,i,h,l,r?-h/2:0,r?-l/2:0,h,l),r!==0&&a.restore(),a.canvas}function ia(t){return t*Math.PI/180}function di(t){return ia(t)}function $e(t,e,i,s,n){return Y(t-i,2)+Y(e-s,2)<=Y(n,2)}var pi=class extends D{_sceneFunc(t){var e;let i=di((e=this.$.angle)!=null?e:360);t.arc(0,0,this.$.outerRadius,0,i,this.$.clockwise),t.arc(0,0,this.$.innerRadius,i,0,!this.$.clockwise),t.closePath(),this.fillStrokeScene(t);}constructor(t){super(t);}getSize(){return {width:this.$.outerRadius*2,height:this.$.outerRadius*2}}isPressedPoint(t,e){return !$e(t,e,this.$.x,this.$.y,this.$.innerRadius)&&$e(t,e,this.$.x,this.$.y,this.$.outerRadius+this.getHitStroke())}};d(pi,"type","Arc");d(pi,"_centroid",!0);function q(t,e,i,s){return Math.hypot(i-t,s-e)}function Ts(t){return Y(t,3)}function Ms(t){return 3*Y(t,2)*(1-t)}function ks(t){return 3*t*Y(1-t,2)}function Os(t){return (1-t)*Y(1-t,2)}function ii(t,e,i,s,n,r,a,o,h){let l=o*Ts(t)+r*Ms(t)+s*ks(t)+e*Os(t),u=h*Ts(t)+a*Ms(t)+n*ks(t)+i*Os(t);return {x:l,y:u}}function Lt(t,e,i,s,n,r){let a=Math.cos(r),o=Math.sin(r),h={x:i*Math.cos(n),y:s*Math.sin(n)};return {x:t+(h.x*a-h.y*o),y:e+(h.x*o+h.y*a)}}function Ps(t){return t*t}function Rs(t){return 2*t*(1-t)}function Cs(t){return Y(1-t,2)}function xe(t,e,i,s,n,r,a){let o=r*Ps(t)+s*Rs(t)+e*Cs(t),h=a*Ps(t)+n*Rs(t)+i*Cs(t);return {x:o,y:h}}function ln(t,e,i,s){let n,r,a,o;switch(i){case"L":return q(t,e,s[0],s[1]);case"C":for(n=0,r=ii(0,t,e,s[0],s[1],s[2],s[3],s[4],s[5]),o=.01;o<=1;o+=.01)a=ii(o,t,e,s[0],s[1],s[2],s[3],s[4],s[5]),n+=q(r.x,r.y,a.x,a.y),r=a;return n;case"Q":for(n=0,r=xe(0,t,e,s[0],s[1],s[2],s[3]),o=.01;o<=1;o+=.01)a=xe(o,t,e,s[0],s[1],s[2],s[3]),n+=q(r.x,r.y,a.x,a.y),r=a;return n;case"A":n=0;let h=s[4],l=s[5],u=s[4]+l,c=Math.PI/180;if(Math.abs(h-u)<c&&(c=Math.abs(h-u)),r=Lt(s[0],s[1],s[2],s[3],h,0),l<0)for(o=h-c;o>u;o-=c)a=Lt(s[0],s[1],s[2],s[3],o,0),n+=q(r.x,r.y,a.x,a.y),r=a;else for(o=h+c;o<u;o+=c)a=Lt(s[0],s[1],s[2],s[3],o,0),n+=q(r.x,r.y,a.x,a.y),r=a;return a=Lt(s[0],s[1],s[2],s[3],u,0),n+=q(r.x,r.y,a.x,a.y),n}return 0}function si(t,e,i,s,n,r,a){let o=Math.hypot(i-t+(s-e)),h=Math.hypot(n-i+(r-s)),l=a*o/(o+h),u=a*h/(o+h),c=i-l*(n-t),p=s-l*(r-e),f=i+u*(n-t),m=s+u*(r-e);return [c,p,f,m]}function Ns(t,e){let i=t.length,s=[],n,r;for(n=2;n<i-2;n+=2)r=si(t[n-2],t[n-1],t[n],t[n+1],t[n+2],t[n+3],e),!isNaN(r[0])&&(s.push(r[0]),s.push(r[1]),s.push(t[n]),s.push(t[n+1]),s.push(r[2]),s.push(r[3]));return s}var cn=class extends D{constructor(t,e){var i,n;super(t),this.noClose=e,((i=this.$).x)!=null||(i.x=0),((n=this.$).y)!=null||(n.y=0);}_sceneFunc(t){var e;let i=this.$.points,s=i.length,n=(e=this.$.tension)!=null?e:0,r=this.$.closed,a=this.$.bezier,o,h,l;if(s){if(t.moveTo(i[0],i[1]),n!==0&&s>4){for(o=this.getTensionPoints(),h=o.length,l=r?0:4,r||t.quadraticCurveTo(o[0],o[1],o[2],o[3]);l<h-2;)t.bezierCurveTo(o[l++],o[l++],o[l++],o[l++],o[l++],o[l++]);r||t.quadraticCurveTo(o[h-2],o[h-1],i[s-2],i[s-1]);}else if(a)for(l=2;l<s;)t.bezierCurveTo(i[l++],i[l++],i[l++],i[l++],i[l++],i[l++]);else for(l=2;l<s;l+=2)t.lineTo(i[l],i[l+1]);this.noClose||t.closePath(),r?this.fillStrokeScene(t):this.strokeScene(t);}}getTensionPoints(){var t;return this.$.closed?this.getTensionPointsClosed():Ns(this.$.points,(t=this.$.tension)!=null?t:0)}getTensionPointsClosed(){var t;let e=this.$.points,i=e.length,s=(t=this.$.tension)!=null?t:0,n=si(e[i-2],e[i-1],e[0],e[1],e[2],e[3],s),r=si(e[i-4],e[i-3],e[i-2],e[i-1],e[0],e[1],s),a=Ns(e,s);return [n[2],n[3],...a,r[0],r[1],e[i-2],e[i-1],r[2],r[3],n[0],n[1],e[0],e[1]]}getRect(){var t;let e=this.$.points;if(e.length<4)return {x:e[0]||0,y:e[1]||0,width:0,height:0};((t=this.$.tension)!=null?t:0)!==0&&(e=[e[0],e[1],...this.getTensionPoints(),e[e.length-2],e[e.length-1]]);let i=e[0],s=e[0],n=e[1],r=e[1],a,o;for(let h=0;h<e.length/2;h++)a=e[h*2],o=e[h*2+1],i=Math.min(i,a),s=Math.max(s,a),n=Math.min(n,o),r=Math.max(r,o);return {x:i,y:n,width:s-i,height:r-n}}};d(cn,"type","Line");var sa=class extends cn{_sceneFunc(t){var e,i,s;super._sceneFunc(t),t.setLineDash([]);let n=Math.PI*2,r=this.$.points,a=r,o=((e=this.$.tension)!=null?e:0)!==0&&r.length>4;o&&(a=this.getTensionPoints());let h=(i=this.$.pointerLength)!=null?i:10,l=r.length,u,c;if(o){let m=[a[a.length-4],a[a.length-3],a[a.length-2],a[a.length-1],r[l-2],r[l-1]],g=ln(a[a.length-4],a[a.length-3],"C",m),y=xe(Math.min(1,1-h/g),m[0],m[1],m[2],m[3],m[4],m[5]);u=r[l-2]-y.x,c=r[l-1]-y.y;}else u=r[l-2]-r[l-4],c=r[l-1]-r[l-3];let p=(Math.atan2(c,u)+n)%n,f=(s=this.$.pointerWidth)!=null?s:10;this.$.pointerAtEnding!==!1&&(t.save(),t.beginPath(),t.translate(r[l-2],r[l-1]),t.rotate(p),t.moveTo(0,0),t.lineTo(-h,f/2),t.lineTo(-h,-f/2),t.closePath(),this.fillStrokeScene(t),t.restore()),this.$.pointerAtBeginning&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(u=(a[0]+a[2])/2-r[0],c=(a[1]+a[3])/2-r[1]):(u=r[2]-r[0],c=r[3]-r[1]),t.rotate((Math.atan2(-c,-u)+n)%n),t.moveTo(0,0),t.lineTo(-h,f/2),t.lineTo(-h,-f/2),t.closePath(),this.fillStrokeScene(t),t.restore());}constructor(t){super(t,!0);}getRect(){var t;let e=super.getRect(),i=((t=this.$.pointerWidth)!=null?t:10)/2;return {x:e.x-i,y:e.y-i,width:e.width+i*2,height:e.height+i*2}}};d(sa,"type","Arrow");var un=class extends D{_sceneFunc(t){t.arc(0,0,this.$.radius,0,Math.PI*2),this.fillStrokeScene(t);}constructor(t){super(t);}getSize(){return {width:this.$.radius*2,height:this.$.radius*2}}isPressedPoint(t,e){return $e(t,e,this.$.x,this.$.y,this.$.radius)}};d(un,"type","Circle");d(un,"_centroid",!0);function na(t,e,i,s,n,r){return parseInt(Y(t-i,2)+"")/parseInt(Y(n,2)+"")+parseInt(Y(e-s,2)+"")/parseInt(Y(r,2)+"")<=1}var fn=class extends D{_sceneFunc(t){var e;t.ellipse(0,0,this.$.radiusX,this.$.radiusY,di((e=this.$.rotate)!=null?e:0),0,Math.PI*2),this.fillStrokeScene(t);}constructor(t){super(t);}getSize(){return {width:this.$.radiusX*2,height:this.$.radiusY*2}}isPressedPoint(t,e){return na(t,e,this.$.x,this.$.y,this.$.radiusX+this.getHitStroke(),this.$.radiusY+this.getHitStroke())}};d(fn,"type","Ellipse");d(fn,"_centroid",!0);function Is(t,e,i){return e?t/i:t*i}function dt(t){return typeof t=="number"?t:t.baseVal.value}function ni(t,e,i){let s=t===void 0,n=e===void 0;return s&&n?{width:dt(i.width),height:dt(i.height)}:!s&&!n?{width:t,height:e}:n?{width:t,height:Is(t,!0,dt(i.width)/dt(i.height))}:{width:Is(e,!1,dt(i.width)/dt(i.height)),height:e}}var dn=class extends D{constructor(t){super(t),d(this,"_image"),this[T].fOn(),this._image=O(()=>{let{image:e}=this.$;return typeof e=="string"?Et(e):e}),this[T].fOff();}_sceneFunc(t){let{crop:e}=this.$,{width:i,height:s}=this.getSize();e?t.drawImage(this._image.value,e.x,e.y,e.width,e.height,0,0,i,s):i!==void 0||s!==void 0?t.drawImage(this._image.value,0,0,i,s):t.drawImage(this._image.value,0,0),this.fillStrokeScene(t);}getSize(){let{image:t,width:e,height:i,crop:s}=this.$;return ni(e!=null?e:s==null?void 0:s.width,i!=null?i:s==null?void 0:s.height,typeof t=="string"?Et(t):t)}};d(dn,"type","Image");d(dn,"fromURL",Zs);var pn=class extends D{constructor(t){super(t),d(this,"_image"),d(this,"_cacheImageRepeat",new Map),this[T].fOn(),this._image=O(()=>{let{image:e}=this.$;typeof e=="string"&&(e=Et(e));let{crop:i,width:s,height:n}=this.$,r;if(i)r=X.createOffscreenCanvas(s!=null?s:i.width,n!=null?n:i.height),r.getContext("2d").drawImage(e,i.x,i.y,i.width,i.height,0,0,s!=null?s:i.width,n!=null?n:i.height);else if(s!==void 0||n!==void 0){let{width:a,height:o}=ni(s,n,e);r=X.createOf