UNPKG

@leafer-game/worker

Version:
1 lines 242 kB
var LeaferUI=function(t){"use strict";var e,i;function s(t,e,i,s){var r,n=arguments.length,a=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(a=(n<3?r(a):n>3?r(e,i,a):r(e,i))||a);return n>3&&a&&Object.defineProperty(e,i,a),a}function r(t,e,i,s){return new(i||(i=Promise))(function(r,n){function a(t){try{h(s.next(t))}catch(t){n(t)}}function o(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?r(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(a,o)}h((s=s.apply(t,e||[])).next())})}t.PathNodeHandleType=void 0,(e=t.PathNodeHandleType||(t.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror","function"==typeof SuppressedError&&SuppressedError,t.Answer=void 0,(i=t.Answer||(t.Answer={}))[i.No=0]="No",i[i.Yes=1]="Yes",i[i.NoAndSkip=2]="NoAndSkip",i[i.YesAndSkip=3]="YesAndSkip";const n={};function a(t){return void 0===t}function o(t){return null==t}function h(t){return"string"==typeof t}const{isFinite:l}=Number;function d(t){return"number"==typeof t}const c=/^-?\d+(?:\.\d+)?$/;const{isArray:u}=Array;function _(t){return t&&"object"==typeof t}function p(t){return"{}"===JSON.stringify(t)}const g={default:(t,e)=>(f(e,t),f(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(r=>{var n,a;if(s=e[r],(null==s?void 0:s.constructor)===Object&&(null===(n=t[r])||void 0===n?void 0:n.constructor)===Object)return f(t[r],e[r],i&&i[r]);i&&r in i?(null===(a=i[r])||void 0===a?void 0:a.constructor)===Object&&f(t[r]={},e[r],i[r]):t[r]=e[r]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{a(e[i])||(t[i]=e[i])}),t),clone:t=>JSON.parse(JSON.stringify(t)),toMap(t){const e={};for(let i=0,s=t.length;i<s;i++)e[t[i]]=!0;return e},stintSet(t,e,i){i||(i=void 0),t[e]!==i&&(t[e]=i)}},{assign:f}=g;class y{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}get __usePathBox(){return this.__pathInputed}get __blendMode(){if(this.eraser&&"path"!==this.eraser)return"destination-out";const{blendMode:t}=this;return"pass-through"===t?null:t}constructor(t){this.__leaf=t}__get(t){if(this.__input){const e=this.__input[t];if(!a(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let s in this)"_"!==s[0]&&(i=e?e[s]:void 0,t[s]=a(i)?this[s]:i);return t}__setInput(t,e){this.__input||(this.__input={}),this.__input[t]=e}__getInput(t){if(this.__input){const e=this.__input[t];if(!a(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!a(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(u(t))for(let e of t)i[e]=this.__getInput(e);else for(let e in t)i[e]=this.__getInput(e);else{let t,e,{__input:s}=this;i.tag=this.__leaf.tag;for(let r in this)if("_"!==r[0]&&(t=this["_"+r],!a(t))){if("path"===r&&!this.__pathInputed)continue;e=s?s[r]:void 0,i[r]=a(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:r,e:n,f:a}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:r,e:n,f:a}}return i}__setMiddle(t,e){this.__middle||(this.__middle={}),this.__middle[t]=e}__getMiddle(t){return this.__middle&&this.__middle[t]}__checkSingle(){const t=this;if("pass-through"===t.blendMode){const e=this.__leaf;t.opacity<1&&(e.isBranch||t.__hasMultiPaint)||e.__hasEraser||t.eraser||t.filter?t.__single=!0:t.__single&&(t.__single=!1)}else t.__single=!0}__removeNaturalSize(){this.__naturalWidth=this.__naturalHeight=void 0}destroy(){this.__input=this.__middle=null,this.__complexData&&this.__complexData.destroy()}}const m={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=v;return e[t]?e[t]++:(e[t]=1,0)}},v=m;let x,w,b;const{max:E}=Math,S=[0,0,0,0],P={zero:[...S],tempFour:S,set:(t,e,i,s,r)=>(void 0===i&&(i=s=r=e),t[0]=e,t[1]=i,t[2]=s,t[3]=r,t),setTemp:(t,e,i,s)=>k(S,t,e,i,s),toTempAB(t,e,i){b=i?d(t)?e:t:[],d(t)?(x=T(t),w=e):d(e)?(x=t,w=T(e)):(x=t,w=e),4!==x.length&&(x=B(x)),4!==w.length&&(w=B(w))},get(t,e){let i;if(!d(t))switch(t.length){case 4:i=a(e)?t:[...t];break;case 2:i=[t[0],t[1],t[0],t[1]];break;case 3:i=[t[0],t[1],t[2],t[1]];break;case 1:t=t[0];break;default:t=0}if(i||(i=[t,t,t,t]),!a(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>d(t)&&d(e)?E(t,e):(R(t,e,i),k(b,E(x[0],w[0]),E(x[1],w[1]),E(x[2],w[2]),E(x[3],w[3]))),add:(t,e,i)=>d(t)&&d(e)?t+e:(R(t,e,i),k(b,x[0]+w[0],x[1]+w[1],x[2]+w[2],x[3]+w[3])),swapAndScale(t,e,i,s){if(d(t))return e===i?t*e:[t*i,t*e];const r=s?t:[],[n,a,o,h]=4===t.length?t:B(t);return k(r,o*i,h*e,n*i,a*e)}},{set:k,get:B,setTemp:T,toTempAB:R}=P,{round:C,pow:L,max:A,floor:D,PI:O}=Math,I={},F={within:(t,e,i)=>(_(e)&&(i=e.max,e=e.min),!a(e)&&t<e&&(t=e),!a(i)&&t>i&&(t=i),t),fourNumber:P.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),F.float(t)),getGapRotation(t,e,i=0){let s=t+i;if(e>1){const t=Math.abs(s%e);(t<1||t>e-1)&&(s=Math.round(s/e)*e)}return s-i},float(t,e){const i=a(e)?1e12:L(10,e);return-0===(t=C(t*i)/i)?0:t},sign:t=>t<0?-1:1,getScaleData(t,e,i,s){if(s||(s={}),e){const t=(d(e)?e:e.width||0)/i.width,r=(d(e)?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&F.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,r){let{scaleX:n,scaleY:a}=t;if((s||e)&&(n<0&&(n=-n),a<0&&(a=-a)),e)if(!0===e)n=a=i?1:1/n;else{let t;d(e)?t=e:"zoom-in"===e&&(t=1),t&&(n=a=n>t||a>t?i?1:1/n:i?1:1/t)}return I.scaleX=n,I.scaleY=a,I},assignScale(t,e){d(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>A(D(t),e)/t,randInt:M,randColor:t=>`rgba(${M(255)},${M(255)},${M(255)},${t||1})`};function M(t){return Math.round(Math.random()*t)}const W=O/180,U=2*O,N=O/2;function z(){return{x:0,y:0}}function Y(){return{x:0,y:0,width:0,height:0}}function H(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:X,cos:j,acos:q,sqrt:V}=Math,{float:G}=F,K={};function Z(){return Object.assign(Object.assign(Object.assign({},{a:1,b:0,c:0,d:1,e:0,f:0}),{x:0,y:0,width:0,height:0}),{scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0})}const J={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:Z(),tempMatrix:{},set(t,e=1,i=0,s=0,r=1,n=0,a=0){t.a=e,t.b=i,t.c=s,t.d=r,t.e=n,t.f=a},get:H,getWorld:Z,copy(t,e){t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t.e=e.e,t.f=e.f},translate(t,e,i){t.e+=e,t.f+=i},translateInner(t,e,i,s){t.e+=t.a*e+t.c*i,t.f+=t.b*e+t.d*i,s&&(t.e-=e,t.f-=i)},scale(t,e,i=e){t.a*=e,t.b*=e,t.c*=i,t.d*=i},pixelScale(t,e,i){i||(i=t),i.a=t.a*e,i.b=t.b*e,i.c=t.c*e,i.d=t.d*e,i.e=t.e*e,i.f=t.f*e},scaleOfOuter(t,e,i,s){Q.toInnerPoint(t,e,K),Q.scaleOfInner(t,K,i,s)},scaleOfInner(t,e,i,s=i){Q.translateInner(t,e.x,e.y),Q.scale(t,i,s),Q.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,a=j(e*=W),o=X(e);t.a=i*a-s*o,t.b=i*o+s*a,t.c=r*a-n*o,t.d=r*o+n*a},rotateOfOuter(t,e,i){Q.toInnerPoint(t,e,K),Q.rotateOfInner(t,K,i)},rotateOfInner(t,e,i){Q.translateInner(t,e.x,e.y),Q.rotate(t,i),Q.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:a}=t;i&&(i*=W,t.a=s+n*i,t.b=r+a*i),e&&(e*=W,t.c=n+s*e,t.d=a+r*e)},skewOfOuter(t,e,i,s){Q.toInnerPoint(t,e,K),Q.skewOfInner(t,K,i,s)},skewOfInner(t,e,i,s=0){Q.translateInner(t,e.x,e.y),Q.skew(t,i,s),Q.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:r,d:n,e:a,f:o}=t;t.a=e.a*i+e.b*r,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*r,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*r+a,t.f=e.e*s+e.f*n+o},multiplyParent(t,e,i,s,r){const{e:n,f:o}=t;if(i||(i=t),a(s)&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:a,d:o}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=a*e.a+o*e.c,i.d=a*e.b+o*e.d,r&&(i.scaleX=e.scaleX*r.scaleX,i.scaleY=e.scaleY*r.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,r&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=n*e.a+o*e.c+e.e,i.f=n*e.b+o*e.d+e.f},divide(t,e){Q.multiply(t,Q.tempInvert(e))},divideParent(t,e){Q.multiplyParent(t,Q.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=Q;return Q.copy(e,t),Q.invert(e),e},invert(t){const{a:e,b:i,c:s,d:r,e:n,f:a}=t;if(i||s){const o=1/(e*r-i*s);t.a=r*o,t.b=-i*o,t.c=-s*o,t.d=e*o,t.e=-(n*r-a*s)*o,t.f=-(a*e-n*i)*o}else if(1===e&&1===r)t.e=-n,t.f=-a;else{const i=1/(e*r);t.a=r*i,t.d=e*i,t.e=-n*r*i,t.f=-a*e*i}},toOuterPoint(t,e,i,s){const{x:r,y:n}=e;i||(i=e),i.x=r*t.a+n*t.c,i.y=r*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:r,b:n,c:a,d:o}=t,h=1/(r*o-n*a),{x:l,y:d}=e;if(i||(i=e),i.x=(l*o-d*a)*h,i.y=(d*r-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*o-s*a)*h,i.y-=(s*r-e*n)*h}},setLayout(t,e,i,s,r){const{x:n,y:o,scaleX:h,scaleY:l}=e;if(a(r)&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:r}=e,n=i*W,a=j(n),o=X(n);if(s||r){const e=s*W,i=r*W;t.a=(a+i*-o)*h,t.b=(o+i*a)*h,t.c=(e*a-o)*l,t.d=(a+e*o)*l}else t.a=a*h,t.b=o*h,t.c=-o*l,t.d=a*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=n,t.f=o,(i=i||s)&&Q.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:n,c:a,d:o,e:h,f:l}=t;let d,c,u,_,p,g=h,f=l;if(n||a){const t=r*o-n*a;if(a&&!s){d=V(r*r+n*n),c=t/d;const e=r/d;u=n>0?q(e):-q(e)}else{c=V(a*a+o*o),d=t/c;const e=a/c;u=N-(o>0?q(-e):-q(e))}const e=G(j(u)),i=X(u);d=G(d),c=G(c),_=e?G((a/c+i)/e/W,9):0,p=e?G((n/d-i)/e/W,9):0,u=G(u/W)}else d=r,c=o,u=_=p=0;return(e=i||e)&&(g+=e.x*r+e.y*a,f+=e.x*n+e.y*o,i||(g-=e.x,f-=e.y)),{x:g,y:f,scaleX:d,scaleY:c,rotation:u,skewX:_,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:r,c:n,d:a}=t;r||n?i=(s*a-r*n)/(e=V(s*s+r*r)):(e=s,i=a)}return s.scaleX=e,s.scaleY=i,s},reset(t){Q.set(t)}},Q=J,{float:$}=F,{toInnerPoint:tt,toOuterPoint:et}=J,{sin:it,cos:st,abs:rt,sqrt:nt,atan2:at,min:ot,round:ht}=Math,lt={defaultPoint:{x:0,y:0},tempPoint:{},tempRadiusPoint:{},set(t,e=0,i=0){t.x=e,t.y=i},setRadius(t,e,i){t.radiusX=e,t.radiusY=a(i)?e:i},copy(t,e){t.x=e.x,t.y=e.y},copyFrom(t,e,i){t.x=e,t.y=i},round(t,e){t.x=e?ht(t.x-.5)+.5:ht(t.x),t.y=e?ht(t.y-.5)+.5:ht(t.y)},move(t,e,i){_(e)?(t.x+=e.x,t.y+=e.y):(t.x+=e,t.y+=i)},scale(t,e,i=e){t.x&&(t.x*=e),t.y&&(t.y*=i)},scaleOf(t,e,i,s=i){t.x+=(t.x-e.x)*(i-1),t.y+=(t.y-e.y)*(s-1)},rotate(t,e,i){i||(i=dt.defaultPoint);const s=st(e*=W),r=it(e),n=t.x-i.x,a=t.y-i.y;t.x=i.x+n*s-a*r,t.y=i.y+n*r+a*s},tempToInnerOf(t,e){const{tempPoint:i}=dt;return ut(i,t),tt(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=dt;return ut(i,t),et(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=dt;return ut(i,t),dt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ut(t,e),_t(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),tt(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){tt(e,t,i)},toOuterOf(t,e,i){et(e,t,i)},getCenter:(t,e)=>({x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}),getCenterX:(t,e)=>t+(e-t)/2,getCenterY:(t,e)=>t+(e-t)/2,getDistance:(t,e)=>ct(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=rt(i-t),n=rt(s-e);return nt(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>ot(ct(t,e,i,s),ct(i,s,r,n)),getAngle:(t,e)=>pt(t,e)/W,getRotation:(t,e,i,s)=>(s||(s=e),dt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/W),getRadianFrom(t,e,i,s,r,n,o,h){a(o)&&(o=i,h=s);const l=t-i,d=e-s,c=r-o,u=n-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>at(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,r){const n=pt(t,e);return r&&(t=e),s||(e={}),e.x=t.x+st(n)*i,e.y=t.y+it(n)*i,e},toNumberPoints(t){let e=t;return _(t[0])&&(e=[],t.forEach(t=>e.push(t.x,t.y))),e},isSame:(t,e,i)=>i?t.x===e.x&&t.y===e.y:$(t.x)===$(e.x)&&$(t.y)===$(e.y),reset(t){dt.reset(t)}},dt=lt,{getDistanceFrom:ct,copy:ut,setRadius:_t,getAtan2:pt}=dt;class gt{constructor(t,e){this.set(t,e)}set(t,e){return _(t)?lt.copy(this,t):lt.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new gt(this)}move(t,e){return lt.move(this,t,e),this}scale(t,e){return lt.scale(this,t,e),this}scaleOf(t,e,i){return lt.scaleOf(this,t,e,i),this}rotate(t,e){return lt.rotate(this,t,e),this}rotateOf(t,e){return lt.rotate(this,e,t),this}getRotation(t,e,i){return lt.getRotation(this,t,e,i)}toInnerOf(t,e){return lt.toInnerOf(this,t,e),this}toOuterOf(t,e){return lt.toOuterOf(this,t,e),this}getCenter(t){return new gt(lt.getCenter(this,t))}getDistance(t){return lt.getDistance(this,t)}getDistancePoint(t,e,i,s){return new gt(lt.getDistancePoint(this,t,e,i,s))}getAngle(t){return lt.getAngle(this,t)}getAtan2(t){return lt.getAtan2(this,t)}isSame(t,e){return lt.isSame(this,t,e)}reset(){return lt.reset(this),this}}const ft=new gt;class yt{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return _(t)?J.copy(this,t):J.set(this,t,e,i,s,r,n),this}setWith(t){return J.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:r,f:n}=this;return{a:t,b:e,c:i,d:s,e:r,f:n}}clone(){return new yt(this)}translate(t,e){return J.translate(this,t,e),this}translateInner(t,e){return J.translateInner(this,t,e),this}scale(t,e){return J.scale(this,t,e),this}scaleWith(t,e){return J.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}pixelScale(t){return J.pixelScale(this,t),this}scaleOfOuter(t,e,i){return J.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return J.scaleOfInner(this,t,e,i),this}rotate(t){return J.rotate(this,t),this}rotateOfOuter(t,e){return J.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return J.rotateOfInner(this,t,e),this}skew(t,e){return J.skew(this,t,e),this}skewOfOuter(t,e,i){return J.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return J.skewOfInner(this,t,e,i),this}multiply(t){return J.multiply(this,t),this}multiplyParent(t){return J.multiplyParent(this,t),this}divide(t){return J.divide(this,t),this}divideParent(t){return J.divideParent(this,t),this}invert(){return J.invert(this),this}invertWith(){return J.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){J.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){J.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return J.setLayout(this,t,e,i),this}getLayout(t,e,i){return J.getLayout(this,t,e,i)}withScale(t,e){return J.withScale(this,t,e)}reset(){J.reset(this)}}const mt=new yt,vt={tempPointBounds:{},setPoint(t,e,i){t.minX=t.maxX=e,t.minY=t.maxY=i},addPoint(t,e,i){t.minX=e<t.minX?e:t.minX,t.minY=i<t.minY?i:t.minY,t.maxX=e>t.maxX?e:t.maxX,t.maxY=i>t.maxY?i:t.maxY},addBounds(t,e,i,s,r){xt(t,e,i),xt(t,e+s,i+r)},copy(t,e){t.minX=e.minX,t.minY=e.minY,t.maxX=e.maxX,t.maxY=e.maxY},addPointBounds(t,e){t.minX=e.minX<t.minX?e.minX:t.minX,t.minY=e.minY<t.minY?e.minY:t.minY,t.maxX=e.maxX>t.maxX?e.maxX:t.maxX,t.maxY=e.maxY>t.maxY?e.maxY:t.maxY},toBounds(t,e){e.x=t.minX,e.y=t.minY,e.width=t.maxX-t.minX,e.height=t.maxY-t.minY}},{addPoint:xt}=vt;var wt,bt;t.Direction4=void 0,(wt=t.Direction4||(t.Direction4={}))[wt.top=0]="top",wt[wt.right=1]="right",wt[wt.bottom=2]="bottom",wt[wt.left=3]="left",t.Direction9=void 0,(bt=t.Direction9||(t.Direction9={}))[bt.topLeft=0]="topLeft",bt[bt.top=1]="top",bt[bt.topRight=2]="topRight",bt[bt.right=3]="right",bt[bt.bottomRight=4]="bottomRight",bt[bt.bottom=5]="bottom",bt[bt.bottomLeft=6]="bottomLeft",bt[bt.left=7]="left",bt[bt.center=8]="center",bt[bt["top-left"]=0]="top-left",bt[bt["top-right"]=2]="top-right",bt[bt["bottom-right"]=4]="bottom-right",bt[bt["bottom-left"]=6]="bottom-left";const Et=[{x:0,y:0},{x:.5,y:0},{x:1,y:0},{x:1,y:.5},{x:1,y:1},{x:.5,y:1},{x:0,y:1},{x:0,y:.5},{x:.5,y:.5}];Et.forEach(t=>t.type="percent");const St={directionData:Et,tempPoint:{},get:Pt,toPoint(t,e,i,s,r,n){const a=Pt(t);i.x=a.x,i.y=a.y,"percent"===a.type&&(i.x*=e.width,i.y*=e.height,r&&(n||(i.x-=r.x,i.y-=r.y),a.x&&(i.x-=1===a.x?r.width:.5===a.x?a.x*r.width:0),a.y&&(i.y-=1===a.y?r.height:.5===a.y?a.y*r.height:0))),s||(i.x+=e.x,i.y+=e.y)},getPoint:(t,e,i,s=!0)=>(i||(i={}),St.toPoint(t,e,i,s),i)};function Pt(e){return h(e)?Et[t.Direction9[e]]:e}const{toPoint:kt}=St,Bt={toPoint(t,e,i,s,r,n){kt(t,i,s,r,e,n)}},{tempPointBounds:Tt,setPoint:Rt,addPoint:Ct,toBounds:Lt}=vt,{toOuterPoint:At}=J,{float:Dt,fourNumber:Ot}=F,{floor:It,ceil:Ft}=Math;let Mt,Wt,Ut,Nt;const zt={},Yt={},Ht={},Xt={tempBounds:Ht,set(t,e=0,i=0,s=0,r=0){t.x=e,t.y=i,t.width=s,t.height=r},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,r){const{x:n,y:a,width:o,height:h}=e;if(u(i)){const e=Ot(i);s?jt.set(t,n+e[3],a+e[0],o-e[1]-e[3],h-e[2]-e[0]):jt.set(t,n-e[3],a-e[0],o+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),jt.set(t,n-i,a-i,o+2*i,h+2*i);r&&("width"===r?(t.y=a,t.height=h):(t.x=n,t.width=o))},minX:t=>t.width>0?t.x:t.x+t.width,minY:t=>t.height>0?t.y:t.y+t.height,maxX:t=>t.width>0?t.x+t.width:t.x,maxY:t=>t.height>0?t.y+t.height:t.y,move(t,e,i){t.x+=e,t.y+=i},scroll(t,e){t.x+=e.scrollX,t.y+=e.scrollY},getByMove:(t,e,i)=>(t=Object.assign({},t),jt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Vt(e,t):e=t,i||(i=t),e.offsetX=jt.maxX(i),e.offsetY=jt.maxY(i),jt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||lt.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){lt.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(jt.copy(Ht,t),jt.toOuterOf(Ht,e),Ht),getOuterOf:(t,e)=>(t=Object.assign({},t),jt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r,e:n,f:a}=e;s>0?(i.width=t.width*s,i.x=n+t.x*s):(i.width=t.width*-s,i.x=n+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=a+t.y*r):(i.height=t.height*-r,i.y=a+t.y*r-i.height)}else zt.x=t.x,zt.y=t.y,At(e,zt,Yt),Rt(Tt,Yt.x,Yt.y),zt.x=t.x+t.width,At(e,zt,Yt),Ct(Tt,Yt.x,Yt.y),zt.y=t.y+t.height,At(e,zt,Yt),Ct(Tt,Yt.x,Yt.y),zt.x=t.x,At(e,zt,Yt),Ct(Tt,Yt.x,Yt.y),Lt(Tt,i)},toInnerOf(t,e,i){i||(i=t),jt.move(i,-e.e,-e.f),jt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,jt.getFitScale(t,e));return new yt(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,r=t.height/e.height;return i?Math.max(s,r):Math.min(s,r)},put(t,e,i="center",s=1,r=!0,n){n||(n=e),h(s)&&(s=jt.getFitScale(t,e,"cover"===s)),Ht.width=r?e.width*=s:e.width*s,Ht.height=r?e.height*=s:e.height*s,Bt.toPoint(i,Ht,t,n,!0,!0)},getSpread(t,e,i){const s={};return jt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){jt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){jt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=It(t.x),t.y=It(t.y),t.width=e>t.x?Ft(t.width+e-t.x):Ft(t.width),t.height=i>t.y?Ft(t.height+i-t.y):Ft(t.height)},unsign(t){t.width<0&&(t.x+=t.width,t.width=-t.width),t.height<0&&(t.y+=t.height,t.height=-t.height)},float(t,e){t.x=Dt(t.x,e),t.y=Dt(t.y,e),t.width=Dt(t.width,e),t.height=Dt(t.height,e)},add(t,e,i){Mt=t.x+t.width,Wt=t.y+t.height,Ut=e.x,Nt=e.y,i||(Ut+=e.width,Nt+=e.height),Mt=Mt>Ut?Mt:Ut,Wt=Wt>Nt?Wt:Nt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=Mt-t.x,t.height=Wt-t.y},addList(t,e){jt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){jt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){jt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let r,n=!0;for(let a=0,o=e.length;a<o;a++)r=i?i(e[a],a):e[a],r&&(r.width||r.height)&&(n?(n=!1,s||Vt(t,r)):qt(t,r));n&&jt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Tt,t.x,t.y):Ct(Tt,t.x,t.y)),Lt(Tt,t)},setPoint(t,e){jt.set(t,e.x,e.y)},addPoint(t,e){qt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:r}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+r},{x:e,y:i+r}]},getPoint:(t,e,i=!1,s)=>St.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=lt.tempToInnerRadiusPointOf(e,i)),e.x>=t.x-e.radiusX&&e.x<=t.x+t.width+e.radiusX&&e.y>=t.y-e.radiusY&&e.y<=t.y+t.height+e.radiusY),hitPoint:(t,e,i)=>(i&&(e=lt.tempToInnerOf(e,i)),e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height),hit:(t,e,i)=>(i&&(e=jt.tempToOuterOf(e,i)),!(t.y+t.height<e.y||e.y+e.height<t.y||t.x+t.width<e.x||e.x+e.width<t.x)),includes:(t,e,i)=>(i&&(e=jt.tempToOuterOf(e,i)),t.x<=e.x&&t.y<=e.y&&t.x+t.width>=e.x+e.width&&t.y+t.height>=e.y+e.height),getIntersectData(t,e,i){if(i&&(e=jt.tempToOuterOf(e,i)),!jt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:a}=e;return Mt=s+n,Wt=r+a,Ut=t.x+t.width,Nt=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,Mt=Mt<Ut?Mt:Ut,Wt=Wt<Nt?Wt:Nt,n=Mt-s,a=Wt-r,{x:s,y:r,width:n,height:a}},intersect(t,e,i){jt.copy(t,jt.getIntersectData(t,e,i))},isSame:(t,e)=>t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height,isEmpty:t=>0===t.x&&0===t.y&&0===t.width&&0===t.height,hasSize:t=>t.width&&t.height,reset(t){jt.set(t)}},jt=Xt,{add:qt,copy:Vt}=jt;class Gt{get minX(){return Xt.minX(this)}get minY(){return Xt.minY(this)}get maxX(){return Xt.maxX(this)}get maxY(){return Xt.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return _(t)?Xt.copy(this,t):Xt.set(this,t,e,i,s),this}get(){const{x:t,y:e,width:i,height:s}=this;return{x:t,y:e,width:i,height:s}}clone(){return new Gt(this)}move(t,e){return Xt.move(this,t,e),this}scale(t,e,i){return Xt.scale(this,t,e,i),this}scaleOf(t,e,i){return Xt.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Xt.toOuterOf(this,t,e),this}toInnerOf(t,e){return Xt.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Xt.getFitMatrix(this,t,e)}put(t,e,i){Xt.put(this,t,e,i)}spread(t,e){return Xt.spread(this,t,e),this}shrink(t,e){return Xt.shrink(this,t,e),this}ceil(){return Xt.ceil(this),this}unsign(){return Xt.unsign(this),this}float(t){return Xt.float(this,t),this}add(t){return Xt.add(this,t),this}addList(t){return Xt.setList(this,t,!0),this}setList(t){return Xt.setList(this,t),this}addListWithFn(t,e){return Xt.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Xt.setListWithFn(this,t,e),this}setPoint(t){return Xt.setPoint(this,t),this}setPoints(t){return Xt.setPoints(this,t),this}addPoint(t){return Xt.addPoint(this,t),this}getPoints(){return Xt.getPoints(this)}getPoint(t,e,i){return Xt.getPoint(this,t,e,i)}hitPoint(t,e){return Xt.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Xt.hitRadiusPoint(this,t,e)}hit(t,e){return Xt.hit(this,t,e)}includes(t,e){return Xt.includes(this,t,e)}intersect(t,e){return Xt.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Xt.getIntersectData(this,t,e))}isSame(t){return Xt.isSame(this,t)}isEmpty(){return Xt.isEmpty(this)}reset(){Xt.reset(this)}}const Kt=new Gt;class Zt{constructor(t,e,i,s,r,n){_(t)?this.copy(t):this.set(t,e,i,s,r,n)}set(t=0,e=0,i=0,s=0,r=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=r,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=t;this.set(e,i,s,r,n,a)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:r,width:n,height:a}=this;return new Gt(r,e,n||t.width-r-i,a||t.height-e-s)}}const Jt={number:(t,e)=>_(t)?"percent"===t.type?t.value*e:t.value:t},Qt={0:1,1:1,2:1,3:1,4:1,5:1,6:1,7:1,8:1,9:1,".":1,e:1,E:1},{floor:$t,max:te}=Math,ee={toURL(t,e){let i=encodeURIComponent(t);return"text"===e?i="data:text/plain;charset=utf-8,"+i:"svg"===e&&(i="data:image/svg+xml,"+i),i},image:{hitCanvasSize:100,maxCacheSize:4096e3,maxPatternSize:8847360,crossOrigin:"anonymous",isLarge:(t,e,i,s)=>t.width*t.height*(e?e*i:1)>(s||ie.maxCacheSize),isSuperLarge:(t,e,i)=>ie.isLarge(t,e,i,ie.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ie;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,r,n,a,o,h,l){const d=te($t(e+(s||0)),1),c=te($t(i+(r||0)),1);let u,_,p;l&&(p=Jt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:_=!0);const g=ee.origin.createCanvas(_?2*d:d,u?2*c:c),f=g.getContext("2d");if(o&&(f.globalAlpha=o),f.imageSmoothingEnabled=!1!==a,ie.canUse(t)){if(n){const s=e/n.width,r=i/n.height;f.setTransform(s,0,0,r,-n.x*s,-n.y*r),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(g,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(g,0,0,d,c,u?p:d,u?c:p,d,c))}return g},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&g.stintSet(i,"transform",e)}}},{image:ie}=ee,{randColor:se}=F;class re{constructor(t){this.repeatMap={},this.name=t}static get(t){return new re(t)}static set filter(t){this.filterList=ne(t)}static set exclude(t){this.excludeList=ne(t)}static drawRepaint(t,e){const i=se();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===re.showBounds,r=t.__nowWorld,n=se();s&&(e.setWorld(r),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(r,n)}log(...t){if(ae.enable){if(ae.filterList.length&&ae.filterList.every(t=>t!==this.name))return;if(ae.excludeList.length&&ae.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ae.enable&&this.warn(...t)}warn(...t){ae.showWarn&&console.warn(this.name,...t)}repeat(t,...e){this.repeatMap[t]||(this.warn("repeat:"+t,...e),this.repeatMap[t]=!0)}error(...t){try{throw new Error}catch(e){console.error(this.name,...t,e)}}}function ne(t){return t?h(t)&&(t=[t]):t=[],t}re.filterList=[],re.excludeList=[],re.showWarn=!0;const ae=re,oe=re.get("RunTime"),he={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=m.create(m.RUNTIME);return le.currentId=le.idMap[i]=e?performance.now():Date.now(),le.currentName=le.nameMap[i]=t,le.nameToIdMap[t]=i,i},end(t,e){const i=le.idMap[t],s=le.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;le.idMap[t]=le.nameMap[t]=le.nameToIdMap[s]=void 0,oe.log(s,r,"ms")},endOfName(t,e){const i=le.nameToIdMap[t];a(i)||le.end(i,e)}},le=he,de=[],ce={list:{},add(t,...e){this.list[t]=!0,de.push(...e)},has(t,e){const i=this.list[t];return!i&&e&&this.need(t),i},need(t){console.error("please install and import plugin: "+(t.includes("-x")?"":"@leafer-in/")+t)}};setTimeout(()=>de.forEach(t=>ce.has(t,!0)));const ue={editor:t=>ce.need("editor")},_e=re.get("UICreator"),pe={list:{},register(t){const{__tag:e}=t.prototype;ge[e]&&_e.repeat(e),ge[e]=t},get(t,e,i,s,r,n){if(!ge[t])return void _e.warn("not register "+t);const o=new ge[t](e);return a(i)||(o.x=i,s&&(o.y=s),r&&(o.width=r),n&&(o.height=n)),o}},{list:ge}=pe,fe=re.get("EventCreator"),ye={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],h(e)&&(me[e]&&fe.repeat(e),me[e]=t)})},changeName(t,e){const i=me[t];if(i){const s=Object.keys(i).find(e=>i[e]===t);s&&(i[s]=e,me[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new me[t](...e)},{nameList:me}=ye;class ve{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,r=i.length;s<r;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ue.canvas(t);return this.add(s),s}recycle(t){t.recycled=!0}clearRecycled(){let t;const e=[];for(let i=0,s=this.list.length;i<s;i++)t=this.list[i],t.recycled?t.destroy():e.push(t);this.list=e}clear(){this.list.forEach(t=>{t.destroy()}),this.list.length=0}destroy(){this.clear()}}function xe(t){return(e,i)=>{t||(t=i);const s={get(){return this.context[t]},set(e){this.context[t]=e}};"strokeCap"===i&&(s.set=function(e){this.context[t]="none"===e?"butt":e}),Object.defineProperty(e,i,s)}}const we=[];function be(){return(t,e)=>{we.push(e)}}const Ee=[];class Se{set blendMode(t){"normal"===t&&(t="source-over"),this.context.globalCompositeOperation=t}get blendMode(){return this.context.globalCompositeOperation}set dashPattern(t){this.context.setLineDash(t||Ee)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;we.forEach(e=>{t=this.context[e],t&&(this[e]=t.bind(this.context))}),this.textBaseline="alphabetic"}setTransform(t,e,i,s,r,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,r,n){_(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,r,n)}translate(t,e){}scale(t,e){}rotate(t){}fill(t,e){}stroke(t){}clip(t,e){}fillRect(t,e,i,s){}strokeRect(t,e,i,s){}clearRect(t,e,i,s){}drawImage(t,e,i,s,r,n,a,o,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*o;s+=e,e=0,n+=t,o-=t}if(i<0){const t=-i/r*h;r+=i,i=0,a+=t,h-=t}this.context.drawImage(t,e,i,s,r,n,a,o,h);break;case 5:this.context.drawImage(t,e,i,s,r);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,r,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,r,n){}arcTo(t,e,i,s,r){}ellipse(t,e,i,s,r,n,a,o){}rect(t,e,i,s){}roundRect(t,e,i,s,r){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,r,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}}s([xe("imageSmoothingEnabled")],Se.prototype,"smooth",void 0),s([xe("imageSmoothingQuality")],Se.prototype,"smoothLevel",void 0),s([xe("globalAlpha")],Se.prototype,"opacity",void 0),s([xe()],Se.prototype,"fillStyle",void 0),s([xe()],Se.prototype,"strokeStyle",void 0),s([xe("lineWidth")],Se.prototype,"strokeWidth",void 0),s([xe("lineCap")],Se.prototype,"strokeCap",void 0),s([xe("lineJoin")],Se.prototype,"strokeJoin",void 0),s([xe("lineDashOffset")],Se.prototype,"dashOffset",void 0),s([xe()],Se.prototype,"miterLimit",void 0),s([xe()],Se.prototype,"shadowBlur",void 0),s([xe()],Se.prototype,"shadowColor",void 0),s([xe()],Se.prototype,"shadowOffsetX",void 0),s([xe()],Se.prototype,"shadowOffsetY",void 0),s([xe()],Se.prototype,"filter",void 0),s([xe()],Se.prototype,"font",void 0),s([xe()],Se.prototype,"fontKerning",void 0),s([xe()],Se.prototype,"fontStretch",void 0),s([xe()],Se.prototype,"fontVariantCaps",void 0),s([xe()],Se.prototype,"textAlign",void 0),s([xe()],Se.prototype,"textBaseline",void 0),s([xe()],Se.prototype,"textRendering",void 0),s([xe()],Se.prototype,"wordSpacing",void 0),s([xe()],Se.prototype,"letterSpacing",void 0),s([xe()],Se.prototype,"direction",void 0),s([be()],Se.prototype,"setTransform",null),s([be()],Se.prototype,"resetTransform",null),s([be()],Se.prototype,"getTransform",null),s([be()],Se.prototype,"save",null),s([be()],Se.prototype,"restore",null),s([be()],Se.prototype,"translate",null),s([be()],Se.prototype,"scale",null),s([be()],Se.prototype,"rotate",null),s([be()],Se.prototype,"fill",null),s([be()],Se.prototype,"stroke",null),s([be()],Se.prototype,"clip",null),s([be()],Se.prototype,"fillRect",null),s([be()],Se.prototype,"strokeRect",null),s([be()],Se.prototype,"clearRect",null),s([be()],Se.prototype,"beginPath",null),s([be()],Se.prototype,"moveTo",null),s([be()],Se.prototype,"lineTo",null),s([be()],Se.prototype,"bezierCurveTo",null),s([be()],Se.prototype,"quadraticCurveTo",null),s([be()],Se.prototype,"closePath",null),s([be()],Se.prototype,"arc",null),s([be()],Se.prototype,"arcTo",null),s([be()],Se.prototype,"ellipse",null),s([be()],Se.prototype,"rect",null),s([be()],Se.prototype,"roundRect",null),s([be()],Se.prototype,"createConicGradient",null),s([be()],Se.prototype,"createLinearGradient",null),s([be()],Se.prototype,"createPattern",null),s([be()],Se.prototype,"createRadialGradient",null),s([be()],Se.prototype,"fillText",null),s([be()],Se.prototype,"measureText",null),s([be()],Se.prototype,"strokeText",null);const{copy:Pe,multiplyParent:ke,pixelScale:Be}=J,{round:Te}=Math,Re=new Gt,Ce=new Gt,Le={width:1,height:1,pixelRatio:1},Ae=["width","height","pixelRatio"];class De extends Se{get width(){return this.size.width}get height(){return this.size.height}get pixelRatio(){return this.size.pixelRatio}get pixelWidth(){return this.width*this.pixelRatio||0}get pixelHeight(){return this.height*this.pixelRatio||0}get pixelSnap(){return this.config.pixelSnap}set pixelSnap(t){this.config.pixelSnap=t}get allowBackgroundColor(){return this.view&&this.parentView}constructor(t,e){super(),this.size={},this.worldTransform={},t||(t=Le),this.manager=e,this.innerId=m.create(m.CNAVAS);const{width:i,height:s,pixelRatio:r}=t;this.autoLayout=!i||!s,this.size.pixelRatio=r||ee.devicePixelRatio,this.config=t,this.init()}init(){}__createContext(){const{view:t}=this,{contextSettings:e}=this.config;this.context=e?t.getContext("2d",e):t.getContext("2d"),this.__bindContext()}export(t,e){}toBlob(t,e){}toDataURL(t,e){}saveAs(t,e){}resize(t,e=!0){if(this.isSameSize(t))return;let i;this.context&&!this.unreal&&e&&this.width&&(i=this.getSameCanvas(),i.copyWorld(this));const s=this.size;g.copyAttrs(s,t,Ae),Ae.forEach(t=>s[t]||(s[t]=1)),this.bounds=new Gt(0,0,this.width,this.height),this.updateViewSize(),this.updateClientBounds(),this.context&&(this.smooth=this.config.smooth,!this.unreal&&i&&(this.clearWorld(i.bounds),this.copyWorld(i),i.recycle()))}updateViewSize(){}updateClientBounds(){}getClientBounds(t){return t&&this.updateClientBounds(),this.clientBounds||this.bounds}startAutoLayout(t,e){}stopAutoLayout(){}setCursor(t){}setWorld(t,e){const{pixelRatio:i,pixelSnap:s}=this,r=this.worldTransform;e&&ke(t,e,r),Be(t,i,r),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(r.e=Te(r.e-.5)+.5,r.f=Te(r.f-.5)+.5):(r.e=Te(r.e),r.f=Te(r.f))),this.setTransform(r.a,r.b,r.c,r.d,r.e,r.f)}useWorldTransform(t){t&&(this.worldTransform=t);const e=this.worldTransform;e&&this.setTransform(e.a,e.b,e.c,e.d,e.e,e.f)}setStroke(t,e,i,s){e&&(this.strokeWidth=e),t&&(this.strokeStyle=t),i&&this.setStrokeOptions(i,s)}setStrokeOptions(t,e){let{strokeCap:i,strokeJoin:s,dashPattern:r,dashOffset:n,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),a(e.dashPattern)||(r=e.dashPattern),a(e.dashOffset)||(n=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=r,this.dashOffset=n,this.miterLimit=o}saveBlendMode(t){this.savedBlendMode=this.blendMode,this.blendMode=t}restoreBlendMode(){this.blendMode=this.savedBlendMode}hitFill(t,e){return!0}hitStroke(t,e){return!0}hitPixel(t,e,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:r}=this;this.shadowOffsetX=t*r,this.shadowOffsetY=e*r,this.shadowBlur=i*r,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,r){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,r),i?(this.setTempPixelBounds2(i,r),i=Ce):i=Re,this.drawImage(t.view,Re.x,Re.y,Re.width,Re.height,i.x,i.y,i.width,i.height)):this.drawImage(t.view,0,0),s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s,r){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Xt.tempToOuterOf(i,e),s,r),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,r),this.drawImage(t.view,Re.x,Re.y,Re.width,Re.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,r,n){this.resetTransform(),this.copyWorld(t,e,i,s,n),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(Re.x,Re.y,Re.width,Re.height),{data:n}=r;for(let t=0,s=n.length;t<s;t+=4)i=.299*n[t]+.587*n[t+1]+.114*n[t+2],(e=n[t+3])&&(n[t+3]=255===e?i:e*(i/255));s.putImageData(r,Re.x,Re.y)}useMask(t,e,i){this.copyWorld(t,e,i,"destination-in")}useEraser(t,e,i){this.copyWorld(t,e,i,"destination-out")}fillWorld(t,e,i,s){i&&(this.blendMode=i),this.fillStyle=e,this.setTempPixelBounds(t,s),this.fillRect(Re.x,Re.y,Re.width,Re.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Re.x,Re.y,Re.width,Re.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Re.x,Re.y,Re.width,Re.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Re.x,Re.y,Re.width,Re.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Re,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Ce,t,e,i)}copyToPixelBounds(t,e,i,s){t.set(e),s&&t.intersect(this.bounds),t.scale(this.pixelRatio),i&&t.ceil()}isSameSize(t){return this.width===t.width&&this.height===t.height&&(!t.pixelRatio||this.pixelRatio===t.pixelRatio)}getSameCanvas(t,e){const{size:i,pixelSnap:s}=this,r=this.manager?this.manager.get(i):ue.canvas(Object.assign({},i));return r.save(),t&&(Pe(r.worldTransform,this.worldTransform),r.useWorldTransform()),e&&(r.smooth=this.smooth),r.pixelSnap!==s&&(r.pixelSnap=s),r}recycle(t){this.recycled||(this.restore(),t?this.clearWorld(t):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const Oe={creator:{},parse(t,e){},convertToCanvasData(t,e){}},Ie={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Fe=Object.assign({M:1,m:10,L:2,l:20,H:3,h:30,V:4,v:40,C:5,c:50,S:6,s:60,Q:7,q:70,T:8,t:80,A:9,a:90,Z:11,z:11,R:12},Ie),Me={M:3,m:3,L:3,l:3,H:2,h:2,V:2,v:2,C:7,c:7,S:5,s:5,Q:5,q:5,T:3,t:3,A:8,a:8,Z:1,z:1,N:5,D:9,X:6,G:9,F:5,O:7,P:4,U:6},We={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},Ue=Object.assign(Object.assign({},We),Ie),Ne=Fe,ze={};for(let t in Ne)ze[Ne[t]]=t;const Ye={};for(let t in Ne)Ye[Ne[t]]=Me[t];const He={drawRoundRect(t,e,i,s,r,n){const a=F.fourNumber(n,Math.min(s/2,r/2)),o=e+s,h=i+r;a[0]?t.moveTo(e+a[0],i):t.moveTo(e,i),a[1]?t.arcTo(o,i,o,h,a[1]):t.lineTo(o,i),a[2]?t.arcTo(o,h,e,h,a[2]):t.lineTo(o,h),a[3]?t.arcTo(e,h,e,i,a[3]):t.lineTo(e,h),a[0]?t.arcTo(e,i,o,i,a[0]):t.lineTo(e,i)}},{sin:Xe,cos:je,hypot:qe,atan2:Ve,ceil:Ge,abs:Ke,PI:Ze,sqrt:Je,pow:Qe}=Math,{setPoint:$e,addPoint:ti}=vt,{set:ei,toNumberPoints:ii}=lt,{M:si,L:ri,C:ni,Q:ai,Z:oi}=Fe,hi={},li={points(t,e,i,s){let r=ii(e);if(t.push(si,r[0],r[1]),i&&r.length>5){let e,n,a,o,h,l,d,c,u,_,p,g,f,y,m,v=r.length;const x=!0===i?.5:i;s&&(r=[r[v-2],r[v-1],...r,r[0],r[1],r[2],r[3]],v=r.length);for(let i=2;i<v-2;i+=2)e=r[i-2],n=r[i-1],a=r[i],o=r[i+1],h=r[i+2],l=r[i+3],p=a-e,g=o-n,f=Je(Qe(p,2)+Qe(g,2)),y=Je(Qe(h-a,2)+Qe(l-o,2)),(f||y)&&(m=f+y,f=x*f/m,y=x*y/m,h-=e,l-=n,d=a-f*h,c=o-f*l,2===i?s||t.push(ai,d,c,a,o):(p||g)&&t.push(ni,u,_,d,c,a,o),u=a+y*h,_=o+y*l);s||t.push(ai,u,_,r[v-2],r[v-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ri,r[e],r[e+1]);s&&t.push(oi)},rect(t,e,i,s,r){Oe.creator.path=t,Oe.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+r).lineTo(e,i+r).lineTo(e,i)},roundRect(t,e,i,s,r,n){Oe.creator.path=[],He.drawRoundRect(Oe.creator,e,i,s,r,n),t.push(...Oe.convertToCanvasData(Oe.creator.path,!0))},arcTo(t,e,i,s,r,n,a,o,h,l,d){const c=s-e,u=r-i,_=n-s,p=a-r;let g=Ve(u,c),f=Ve(p,_);const y=qe(c,u),m=qe(_,p);let v=f-g;if(v<0&&(v+=U),y<1e-12||m<1e-12||v<1e-12||Ke(v-Ze)<1e-12)return t&&t.push(ri,s,r),h&&($e(h,e,i),ti(h,s,r)),d&&ei(d,e,i),void(l&&ei(l,s,r));const x=c*p-_*u<0,w=x?-1:1,b=o/je(v/2),E=s+b*je(g+v/2+N*w),S=r+b*Xe(g+v/2+N*w);return g-=N*w,f-=N*w,ui(t,E,S,o,o,0,g/W,f/W,x,h,l,d)},arc:(t,e,i,s,r,n,a,o,h,l)=>ui(t,e,i,s,s,0,r,n,a,o,h,l),ellipse(t,e,i,s,r,n,a,o,h,l,d,c){const u=n*W,_=Xe(u),p=je(u);let g=a*W,f=o*W;g>Ze&&(g-=U),f<0&&(f+=U);let y=f-g;y<0?y+=U:y>U&&(y-=U),h&&(y-=U);const m=Ge(Ke(y/N)),v=y/m,x=Xe(v/4),w=8/3*x*x/Xe(v/2);f=g+v;let b,E,S,P,k,B,T,R,C=je(g),L=Xe(g),A=S=p*s*C-_*r*L,D=P=_*s*C+p*r*L,O=e+S,I=i+P;t&&t.push(t.length?ri:si,O,I),l&&$e(l,O,I),c&&ei(c,O,I);for(let n=0;n<m;n++)b=je(f),E=Xe(f),S=p*s*b-_*r*E,P=_*s*b+p*r*E,k=e+A-w*(p*s*L+_*r*C),B=i+D-w*(_*s*L-p*r*C),T=e+S+w*(p*s*E+_*r*b),R=i+P+w*(_*s*E-p*r*b),t&&t.push(ni,k,B,T,R,e+S,i+P),l&&ci(e+A,i+D,k,B,T,R,e+S,i+P,l,!0),A=S,D=P,C=b,L=E,g=f,f+=v;d&&ei(d,e+S,i+P)},quadraticCurveTo(t,e,i,s,r,n,a){t.push(ni,(e+2*s)/3,(i+2*r)/3,(n+2*s)/3,(a+2*r)/3,n,a)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,r,n,a,o){ci(t,e,(t+2*i)/3,(e+2*s)/3,(r+2*i)/3,(n+2*s)/3,r,n,a,o)},toTwoPointBounds(t,e,i,s,r,n,a,o,h,l){const d=[];let c,u,_,p,g,f,y,m,v=t,x=i,w=r,b=a;for(let t=0;t<2;++t)if(1==t&&(v=e,x=s,w=n,b=o),c=-3*v+9*x-9*w+3*b,u=6*v-12*x+6*w,_=3*x-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-_/u,0<p&&p<1&&d.push(p)}else y=u*u-4*_*c,m=Math.sqrt(y),y<0||(g=(-u+m)/(2*c),0<g&&g<1&&d.push(g),f=(-u-m)/(2*c),0<f&&f<1&&d.push(f));l?ti(h,t,e):$e(h,t,e),ti(h,a,o);for(let l=0,c=d.length;l<c;l++)di(d[l],t,e,i,s,r,n,a,o,hi),ti(h,hi.x,hi.y)},getPointAndSet(t,e,i,s,r,n,a,o,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,_=3*d*t*t,p=t*t*t;l.x=c*e+u*s+_*n+p*o,l.y=c*i+u*r+_*a+p*h},getPoint(t,e,i,s,r,n,a,o,h){const l={};return di(t,e,i,s,r,n,a,o,h,l),l},getDerivative(t,e,i,s,r){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(r-s)},cut(t,e,i,s,r,n,a,o,h){if(t<=0)return{left:null,right:[s,r,n,a,o,h]};if(t>=1)return{left:[s,r,n,a,o,h],right:null};const l=1-t,d=e*l+s*t,c=i*l+r*t,u=s*l+n*t,_=r*l+a*t,p=n*l+o*t,g=a*l+h*t,f=d*l+u*t,y=c*l+_*t,m=u*l+p*t,v=_*l+g*t;return{left:[d,c,f,y,f*l+m*t,y*l+v*t],right:[m,v,p,g,o,h]}}},{getPointAndSet:di,toTwoPointBounds:ci,ellipse:ui}=li,{sin:_i,cos:pi,sqrt:gi,atan2:fi}=Math,{ellipse:yi}=li,mi={ellipticalArc(t,e,i,s,r,n,a,o,h,l,d){const c=(h-e)/2,u=(l-i)/2,_=n*W,p=_i(_),g=pi(_),f=-g*c-p*u,y=-g*u+p*c,m=s*s,v=r*r,x=y*y,w=f*f,b=m*v-m*x-v*w;let E=0;if(b<0){const t=gi(1-b/(m*v));s*=t,r*=t}else E=(a===o?-1:1)*gi(b/(m*x+v*w));const S=E*s*y/r,P=-E*r*f/s,k=fi((y-P)/r,(f-S)/s),B=fi((-y-P)/r,(-f-S)/s);let T=B-k;0===o&&T>0?T-=U:1===o&&T<0&&(T+=U);const R=e+c+g*S-p*P,C=i+u+p*S+g*P,L=T<0?1:0;d||ee.ellipseToCurve?yi(t,R,C,s,r,n,k/W,B/W,L):s!==r||n?t.push(Fe.G,R,C,s,r,n,k/W,B/W,L):t.push(Fe.O,R,C,s,k/W,B/W,L)}},vi={toCommand:t=>[],toNode:t=>[]},{M:xi,m:wi,L:bi,l:Ei,H:Si,h:Pi,V:ki,v:Bi,C:Ti,c:Ri,S:Ci,s:Li,Q:Ai,q:Di,T:Oi,t:Ii,A:Fi,a:Mi,Z:Wi,z:Ui,N:Ni,D:zi,X:Yi,G:Hi,F:Xi,O:ji,P:qi,U:Vi}=Fe,{rect:Gi,roundRect:Ki,arcTo:Zi,arc:Ji,ellipse:Qi,quadraticCurveTo:$i}=li,{ellipticalArc:ts}=mi,es=re.get("PathConvert"),is={},ss={current:{dot:0},stringify(t,e){let i,s,r,n=0,a=t.length,o="";for(;n<a;){s=t[n],i=Ye[s],o+=s===r?" ":ze[s];for(let s=1;s<i;s++)o+=F.float(t[n+s],e),s===i-1||(o+=" ");r=s,n+=i}return o},parse(t,e){let i,s,r,n="";const a=[],o=e?Ue:We;for(let e=0,h=t.length;e<h;e++)s=t[e],Qt[s]?("."===s&&(rs.dot&&(ns(a,n),n=""),rs.dot++),"0"===n&&"."!==s&&(ns(a,n),n=""),n+=s):Fe[s]?(n&&(ns(a,n),n=""),rs.name=Fe[s],rs.length=Me[s],rs.index=0,ns(a,rs.name),!i&&o[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ns(a,n),n=s):n&&(ns(a,n),n=""),r=s;return n&&ns(a,n),i?ss.toCanvasData(a,e):a},toCanvasData(t,e){let i,s,r,n,a,o=0,h=0,l=0,d=0,c=0,u=0,_=0,p=t.length;const g=[];for(;_<p;){switch(r=t[_],r){case wi:t[_+1]+=o,t[_+2]+=h;case xi:o=t[_+1],h=t[_+2],n===r?g.push(bi,o,h):(g.push(xi,o,h),c=o,u=h),_+=3;break;case Pi:t[_+1]+=o;case Si:o=t[_+1],g.push(bi,o,h),_+=2;break;case Bi:t[_+1]+=h;case ki:h=t[_+1],g.push(bi,o,h),_+=2;break;case Ei:t[_+1]+=o,t[_+2]+=h;case bi:o=t[_+1],h=t[_+2],g.push(bi,o,h),_+=3;break;case Li:t[_+1]+=o,t[_+2]+=h,t[_+3]+=o,t[_+4]+=h,r=Ci;case Ci:a=n===Ti||n===Ci,l=a?2*o-i:t[_+1],d=a?2*h-s:t[_+2],i=t[_+1],s=t[_+2],o=t[_+3],h=t[_+4],g.push(Ti,l,d,i,s,o,h),_+=5;break;case Ri:t[_+1]+=o,t[_+2]+=h,t[_+3]+=o,t[_+4]+=h,t[_+5]+=o,t[_+6]+=h,r=Ti;case Ti:i=t[_+3],s=t[_+4],o=t[_+5],h=t[_+6],g.push(Ti,t[_+1],t[_+2],i,s,o,h),_+=7;break;case Ii:t[_+1]+=o,t[_+2]+=h,r=Oi;case Oi:a=n===Ai||n===Oi,i=a?2*o-i:t[_+1],s=a?2*h-s:t[_+2],e?$i(g,o,h,i,s,t[_+1],t[_+2]):g.push(Ai,i,s,t[_+1],t[_+2]),o=t[_+1],h=t[_+2],_+=3;break;case Di:t[_+1]+=o,t[_+2]+=h,t[_+3]+=o,t[_+4]+=h,r=Ai;case Ai:i=t[_+1],s=t[_+2],e?$i(g,o,h,i,s,t[_+3],t[_+4]):g.push(Ai,i,s,t[_+3],t[_+4]),o=t[_+3],h=t[_+4],_+=5;break;case Mi:t[_+6]+=o,t[_+7]+=h;case Fi:ts(g,o,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],e),o=t[_+6],h=t[_+7],_+=8;break;case Ui:case Wi:g.push(Wi),o=c,h=u,_++;break;case Ni:o=t[_+1],h=t[_+2],e?Gi(g,o,h,t[_+3],t[_+4]):as(g,t,_,5),_+=5;break;case zi:o=t[_+1],h=t[_+2],e?Ki(g,o,h,t[_+3],t[_+4],[t[_+5],t[_+6],t[_+7],t[_+8]]):as(g,t,_,9),_+=9;break;case Yi:o=t[_+1],h=t[_+2],e?Ki(g,o,h,t[_+3],t[_+4],t[_+5]):as(g,t,_,6),_+=6;break;case Hi:Qi(e?g:as(g,t,_,9),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],t[_+7],t[_+8],null,is),o=is.x,h=is.y,_+=9;break;case Xi:e?Qi(g,t[_+1],t[_+2],t[_+3],t[_+4],0,0,360,!1):as(g,t,_,5),o=t[_+1]+t[_+3],h=t[_+2],_+=5;break;case ji:Ji(e?g:as(g,t,_,7),t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],t[_+6],null,is),o=is.x,h=is.y,_+=7;break;case qi:e?Ji(g,t[_+1],t[_+2],t[_+3],0,360,!1):as(g,t,_,4),o=t[_+1]+t[_+3],h=t[_+2],_+=4;break;case Vi:Zi(e?g:as(g,t,_,6),o,h,t[_+1],t[_+2],t[_+3],t[_+4],t[_+5],null,is),o=is.x,h=is.y,_+=6;break;default:return es.error(`command: ${r} [index:${_}]`,t),g}n=r}return g},objectToCanvasData(t){if(t[0].name.length>1)return vi.toCommand(t);{const e=[];return t.forEach(t=>{switch(t.name){case"M":e.push(xi,t.x,t.y);break;case"L":e.push(bi,t.x,t.y);break;case"C":e.push(Ti,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Ai,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(Wi)}}),e}},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){rs.index===rs.length&&(rs.index=1,t.push(rs.name)),t.push(Number(e)),rs.index++,rs.dot=0}},{current:rs,pushData:ns,copyData:as}=ss,{M:os,L:hs,C:ls,Q:ds,Z:cs,N:us,D:_s,X:ps,G:gs,F:fs,O:ys,P:ms,U:vs}=Fe,{getMinDistanceFrom:xs,getRadianFrom:ws}=lt,{tan:bs,min:Es,abs:Ss}=Math,Ps={},ks={beginPath(t){t.length=0},moveTo(t,e,i){t.push(os,e,i)},lineTo(t,e,i){t.push(hs,e,i)},bezierCurveTo(t,e,i,s,r,n,a){t.push(ls,e,i,s,r,n,a)},quadraticCurveTo(t,e,i,s,r){t.push(ds,e,i,s,r)},closePath(t){t.push(cs)},rect(t,e,i,s,r){t.push(us,e,i,s,r)},roundRect(t,e,i,s,r,n){if(d(n))t.push(ps,e,i,s,r,n);else{const a=F.fourNumber(n);a?t.push(_s,e,i,s,r,...a):t.push(us,e,i,s,r)}},ellipse(t,e,i,s,r,n,a,h,l){if(s===r)return Ts(t,e,i,s,a,h,l);o(n)?t.push(fs,e,i,s,r):(o(a)&&(a=0),o(h)&&(h=360),t.push(gs,e,i,s,r,n,a,h,l?1:0))},arc(t,e,i,s,r,n,a){o(r)?t.push(ms,e,i,s):(o(r)&&(r=0),o(n)&&(n=360),t.push(ys,e,i,s,r,n,a?1:0))},arcTo(t,e,i,s,r,n,o,h,l){if(!a(o)){const t=xs(o,h,e,i,s,r)/(l?1:2);n=Es(n,Es(t,t*Ss(bs(ws(o,h,e,i,s,r)/2))))}t.push(vs,e,i,s,r,n)},drawEllipse(t,e,i,s,r,n,a,h,l){li.ellipse(null,e,i,s,r,o(n)?0:n,o(a)?0:a,o(h)?360:h,l,null,null,Ps),t.push(os,Ps.x,Ps.y),Bs(t,e,i,s,r,n,a,h,l)},drawArc(t,e,i,s,r,n,a){li.arc(null,e,i,s,o(r)?0:r,o(n)?360:n,a,null,null,Ps),t.push(os,Ps.x,Ps.y),Ts(t,e,i,s,r,n,a)},drawPoints(t,e,i,s){li.points(t,e,i,s)}},{ellipse:Bs,arc:Ts}=ks,{moveTo:Rs,lineTo:Cs,quadraticCurveTo:Ls,bezierCurveTo:As,closePath:Ds,beginPath:Os,rect:Is,roundRect:Fs,ellipse:Ms,arc:Ws,arcTo:Us,drawEllipse:Ns,drawArc:zs,drawPoints:Ys}=ks;class Hs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?h(t)?Oe.parse(t):t:[],this}beginPath(){return Os(this.__path),this.paint(),this}moveTo(t,e){return Rs(this.__path,t,e),this.paint(),this}lineTo(t,e){return Cs(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return As(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Ls(this.__path,t,e,i,s),this.paint(),this}closePath(){return Ds(this.__path),this.paint(),this}rect(t,e,i,s){return Is(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return Fs(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,a,o){return Ms(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}arc(t,e,i,s,r,n){return Ws(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return Us(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,a,o){return Ns(this.__path,t,e,i,s,r,n,a,o),this.paint(),this}drawArc(t,e,i,s,r,n){return zs(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return Ys(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:Xs,L:js,C:qs,Q:Vs,Z:Gs,N:Ks,D:Zs,X:Js,G:Qs,F:$s,O:tr,P:er,U:ir}=Fe,sr=re.get("PathDrawer"),rr={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case Xs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case js:t.lineTo(e[s+1],e[s+2]),s+=3;break;case qs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case Vs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Gs:t.closePath(),s+=1;break;case Ks:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Zs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],[e[s+5],e[s+6],e[s+7],e[s+8]]),s+=9;break;case Js:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case Qs:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*W,e[s+6]*W,e[s+7]*W,e[s+8]),s+=9;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,U,!1),s+=5;break;case tr:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*W,e[s+5]*W,e[s+6]),s+=7;break;case er:t.arc(e[s+1],e[s+2],e[s+3],0,U,!1),s+=4;break;case ir:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void sr.error(`command: ${i} [index:${s}]`,e)}}},{M:nr,L:ar,C:or,Q:hr,Z:lr,N:dr,D:cr,X:ur,G:_r,F:pr,O:gr,P:fr,U:yr}=Fe,{toTwoPointBounds:mr,toTwoPointBoundsByQuadraticCurve:vr,arcTo:xr,arc:wr,ellipse:br}=li,{addPointBounds:Er,copy:Sr,addPoint:Pr,setPoint:kr,addBounds:Br,toBounds:Tr}=vt,Rr=re.get("PathBounds");let Cr,Lr,Ar;const Dr={},Or={},Ir={},Fr={toBounds(t,e){Fr.toTwoPointBounds(t,Or),Tr(Or,e)},toTwoPointBounds(t,e){if(!t||!t.length)return kr(e,0,0);let i,s,r,n,a,o=0,h=0,l=0;const d=t.length;for(;o<d;)switch(a=t[o],0===o&&(a===lr||a===or||a===hr?kr(e,h,l):kr(e,t[o+1],t[o+2])),a){case nr:case ar:h=t[o+1],l=t[o+2],Pr(e,h,l),o+=3;break;case or:r=t[o+5],n=t[o+6],mr(h,l,t[o+1],t[o+2],t[o+3],t[o+4],r,n,Dr),Er(e,Dr),h=r,l=n,o+=7;break;case hr:i=t[o+1],s=t[o+2],r=t[o+3],n=t[o+4],vr(h,l,i,s,r,n,Dr),Er(e,Dr),h=r,l=n,o+=5;break;case lr:o+=1;break;case dr:h=t[o+1],l=t[o+2],Br(e,h,l,t[o+3],t[o+4]),o+=5;break;case cr:case ur:h=t[o+1],l=t[o+2],Br(e,h,l,t[o+3],t[o+4]),o+=a===cr?9:6;break;case _r:br(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],t[o+7],t[o+8],Dr,Ir),0===o?Sr(e,Dr):Er(e,Dr),h=Ir.x,l=Ir.y,o+=9;break;case pr:h=t[o+1],l=t[o+2],Lr=t[o+3],Ar=t[o+4],Br(e,h-Lr,l-Ar,2*Lr,2*Ar),h+=Lr,o+=5;break;case gr:wr(null,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],t[o+6],Dr,Ir),0===o?Sr(e,Dr):Er(e,Dr),h=Ir.x,l=Ir.y,o+=7;break;case fr:h=t[o+1],l=t[o+2],Cr=t[o+3],Br(e,h-Cr,l-Cr,2*Cr,2*Cr),h+=Cr,o+=4;break;case yr:xr(null,h,l,t[o+1],t[o+2],t[o+3],t[o+4],t[o+5],Dr,Ir),0===o?Sr(e,Dr):Er(e,Dr),h=Ir.x,l=Ir.y,o+=6;break;default:return void Rr.error(`command: ${a} [index:${o}]`,t)}}},{M:Mr,L:Wr,Z:Ur}=Fe,{getCenterX:Nr,getCenterY:zr}=lt,{arcTo:Yr}=ks,Hr={smooth(t,e,i){let s,r,n,a=0,o=0,h=0,l=0,d=0,c=0,_=0,p=0,g=0;u(e)&&(e=e[0]||0);const f=t.length,y=9===f,m=[];for(;a<f;){switch(s=t[a],s){case Mr:l=p=t[a+1],d=g=t[a+2],a+=3,t[a]===Wr?(c=t[a+1],_=t[a+2],y?m.push(Mr,l,d):m.push(Mr,Nr(l,c),zr(d,_))):m.push(Mr,l,d);break;case Wr:switch(o=t[a+1],h=t[a+2],a+=3,t[a]){case Wr:Yr(m,o,h,t[a+1],t[a+2],e,p,g,y);break;case Ur:Yr(m,o,h,l,d,e,p,g,y);break;default:m.push(Wr,o,h)}p=o,g=h;break;case Ur: