UNPKG

@leafer-draw/worker

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