@leafer/miniapp
Version:
1 lines • 335 kB
JavaScript
var t,e;!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(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(e||(e={}));const i={};function s(t){return void 0===t}function o(t){return null==t}function n(t){return"string"==typeof t}const{isFinite:r}=Number;function a(t){return"number"==typeof t}const h=/^-?\d+(?:\.\d+)?$/;function l(t){return"string"==typeof t&&h.test(t)?+t:t}const{isArray:d}=Array;function c(t){return t&&"object"==typeof t}function u(t){return c(t)&&!d(t)}function g(t){return"{}"===JSON.stringify(t)}const p={default:(t,e)=>(_(e,t),_(t,e),t),assign(t,e,i){let s;Object.keys(e).forEach(o=>{var n,r;if(s=e[o],(null==s?void 0:s.constructor)===Object&&(null===(n=t[o])||void 0===n?void 0:n.constructor)===Object)return _(t[o],e[o],i&&i[o]);i&&o in i?(null===(r=i[o])||void 0===r?void 0:r.constructor)===Object&&_(t[o]={},e[o],i[o]):t[o]=e[o]})},copyAttrs:(t,e,i)=>(i.forEach(i=>{s(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:_}=p;class f{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(!s(e))return e}return this[t]}__getData(){const t={tag:this.__leaf.tag},{__input:e}=this;let i;for(let o in this)"_"!==o[0]&&(i=e?e[o]:void 0,t[o]=s(i)?this[o]: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(!s(e))return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&!s(this.__input[t])&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(d(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:o}=this;i.tag=this.__leaf.tag;for(let n in this)if("_"!==n[0]&&(t=this["_"+n],!s(t))){if("path"===n&&!this.__pathInputed)continue;e=o?o[n]:void 0,i[n]=s(e)?t:e}}if(e&&e.matrix){const{a:t,b:e,c:s,d:o,e:n,f:r}=this.__leaf.__localMatrix;i.matrix={a:t,b:e,c:s,d:o,e:n,f:r}}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}=y;return e[t]?e[t]++:(e[t]=1,0)}},y=m;let v,w,x;const{max:b}=Math,S=[0,0,0,0],k={zero:[...S],tempFour:S,set:(t,e,i,s,o)=>(void 0===i&&(i=s=o=e),t[0]=e,t[1]=i,t[2]=s,t[3]=o,t),setTemp:(t,e,i,s)=>E(S,t,e,i,s),toTempAB(t,e,i){x=i?a(t)?e:t:[],a(t)?(v=T(t),w=e):a(e)?(v=t,w=T(e)):(v=t,w=e),4!==v.length&&(v=B(v)),4!==w.length&&(w=B(w))},get(t,e){let i;if(!a(t))switch(t.length){case 4:i=s(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]),!s(e))for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},max:(t,e,i)=>a(t)&&a(e)?b(t,e):(R(t,e,i),E(x,b(v[0],w[0]),b(v[1],w[1]),b(v[2],w[2]),b(v[3],w[3]))),add:(t,e,i)=>a(t)&&a(e)?t+e:(R(t,e,i),E(x,v[0]+w[0],v[1]+w[1],v[2]+w[2],v[3]+w[3])),swapAndScale(t,e,i,s){if(a(t))return e===i?t*e:[t*i,t*e];const o=s?t:[],[n,r,h,l]=4===t.length?t:B(t);return E(o,h*i,l*e,n*i,r*e)}},{set:E,get:B,setTemp:T,toTempAB:R}=k,{round:C,pow:P,max:O,floor:L,PI:A}=Math,D={},M={within:(t,e,i)=>(c(e)&&(i=e.max,e=e.min),!s(e)&&t<e&&(t=e),!s(i)&&t>i&&(t=i),t),fourNumber:k.get,formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),M.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=s(e)?1e12:P(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=(a(e)?e:e.width||0)/i.width,o=(a(e)?e:e.height||0)/i.height;s.scaleX=t||o||1,s.scaleY=o||t||1}else t&&M.assignScale(s,t);return s},getScaleFixedData(t,e,i,s,o){let{scaleX:n,scaleY:r}=t;if((s||e)&&(n<0&&(n=-n),r<0&&(r=-r)),e)if(!0===e)n=r=i?1:1/n;else{let t;a(e)?t=e:"zoom-in"===e&&(t=1),t&&(n=r=n>t||r>t?i?1:1/n:i?1:1/t)}return D.scaleX=n,D.scaleY=r,D},assignScale(t,e){a(e)?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},getFloorScale:(t,e=1)=>O(L(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 I=A/180,W=2*A,z=A/2;function Y(){return{x:0,y:0}}function X(){return{x:0,y:0,width:0,height:0}}function N(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:H,cos:V,acos:j,sqrt:U}=Math,{float:G}=M,q={};function K(){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:K(),tempMatrix:{},set(t,e=1,i=0,s=0,o=1,n=0,r=0){t.a=e,t.b=i,t.c=s,t.d=o,t.e=n,t.f=r},get:N,getWorld:K,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){J.toInnerPoint(t,e,q),J.scaleOfInner(t,q,i,s)},scaleOfInner(t,e,i,s=i){J.translateInner(t,e.x,e.y),J.scale(t,i,s),J.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:o,d:n}=t,r=V(e*=I),a=H(e);t.a=i*r-s*a,t.b=i*a+s*r,t.c=o*r-n*a,t.d=o*a+n*r},rotateOfOuter(t,e,i){J.toInnerPoint(t,e,q),J.rotateOfInner(t,q,i)},rotateOfInner(t,e,i){J.translateInner(t,e.x,e.y),J.rotate(t,i),J.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:o,c:n,d:r}=t;i&&(i*=I,t.a=s+n*i,t.b=o+r*i),e&&(e*=I,t.c=n+s*e,t.d=r+o*e)},skewOfOuter(t,e,i,s){J.toInnerPoint(t,e,q),J.skewOfInner(t,q,i,s)},skewOfInner(t,e,i,s=0){J.translateInner(t,e.x,e.y),J.skew(t,i,s),J.translateInner(t,-e.x,-e.y)},multiply(t,e){const{a:i,b:s,c:o,d:n,e:r,f:a}=t;t.a=e.a*i+e.b*o,t.b=e.a*s+e.b*n,t.c=e.c*i+e.d*o,t.d=e.c*s+e.d*n,t.e=e.e*i+e.f*o+r,t.f=e.e*s+e.f*n+a},multiplyParent(t,e,i,o,n){const{e:r,f:a}=t;if(i||(i=t),s(o)&&(o=1!==t.a||t.b||t.c||1!==t.d),o){const{a:s,b:o,c:r,d:a}=t;i.a=s*e.a+o*e.c,i.b=s*e.b+o*e.d,i.c=r*e.a+a*e.c,i.d=r*e.b+a*e.d,n&&(i.scaleX=e.scaleX*n.scaleX,i.scaleY=e.scaleY*n.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,n&&(i.scaleX=e.scaleX,i.scaleY=e.scaleY);i.e=r*e.a+a*e.c+e.e,i.f=r*e.b+a*e.d+e.f},divide(t,e){J.multiply(t,J.tempInvert(e))},divideParent(t,e){J.multiplyParent(t,J.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=J;return J.copy(e,t),J.invert(e),e},invert(t){const{a:e,b:i,c:s,d:o,e:n,f:r}=t;if(i||s){const a=1/(e*o-i*s);t.a=o*a,t.b=-i*a,t.c=-s*a,t.d=e*a,t.e=-(n*o-r*s)*a,t.f=-(r*e-n*i)*a}else if(1===e&&1===o)t.e=-n,t.f=-r;else{const i=1/(e*o);t.a=o*i,t.d=e*i,t.e=-n*o*i,t.f=-r*e*i}},toOuterPoint(t,e,i,s){const{x:o,y:n}=e;i||(i=e),i.x=o*t.a+n*t.c,i.y=o*t.b+n*t.d,s||(i.x+=t.e,i.y+=t.f)},toInnerPoint(t,e,i,s){const{a:o,b:n,c:r,d:a}=t,h=1/(o*a-n*r),{x:l,y:d}=e;if(i||(i=e),i.x=(l*a-d*r)*h,i.y=(d*o-l*n)*h,!s){const{e:e,f:s}=t;i.x-=(e*a-s*r)*h,i.y-=(s*o-e*n)*h}},setLayout(t,e,i,o,n){const{x:r,y:a,scaleX:h,scaleY:l}=e;if(s(n)&&(n=e.rotation||e.skewX||e.skewY),n){const{rotation:i,skewX:s,skewY:o}=e,n=i*I,r=V(n),a=H(n);if(s||o){const e=s*I,i=o*I;t.a=(r+i*-a)*h,t.b=(a+i*r)*h,t.c=(e*r-a)*l,t.d=(r+e*a)*l}else t.a=r*h,t.b=a*h,t.c=-a*l,t.d=r*l}else t.a=h,t.b=0,t.c=0,t.d=l;t.e=r,t.f=a,(i=i||o)&&J.translateInner(t,-i.x,-i.y,!o)},getLayout(t,e,i,s){const{a:o,b:n,c:r,d:a,e:h,f:l}=t;let d,c,u,g,p,_=h,f=l;if(n||r){const t=o*a-n*r;if(r&&!s){d=U(o*o+n*n),c=t/d;const e=o/d;u=n>0?j(e):-j(e)}else{c=U(r*r+a*a),d=t/c;const e=r/c;u=z-(a>0?j(-e):-j(e))}const e=G(V(u)),i=H(u);d=G(d),c=G(c),g=e?G((r/c+i)/e/I,9):0,p=e?G((n/d-i)/e/I,9):0,u=G(u/I)}else d=o,c=a,u=g=p=0;return(e=i||e)&&(_+=e.x*o+e.y*r,f+=e.x*n+e.y*a,i||(_-=e.x,f-=e.y)),{x:_,y:f,scaleX:d,scaleY:c,rotation:u,skewX:g,skewY:p}},withScale(t,e,i=e){const s=t;if(!e||!i){const{a:s,b:o,c:n,d:r}=t;o||n?i=(s*r-o*n)/(e=U(s*s+o*o)):(e=s,i=r)}return s.scaleX=e,s.scaleY=i,s},reset(t){J.set(t)}},J=Z,{float:Q}=M,{toInnerPoint:$,toOuterPoint:tt}=Z,{sin:et,cos:it,abs:st,sqrt:ot,atan2:nt,min:rt,round:at}=Math,ht={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=s(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?at(t.x-.5)+.5:at(t.x),t.y=e?at(t.y-.5)+.5:at(t.y)},move(t,e,i){c(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=lt.defaultPoint);const s=it(e*=I),o=et(e),n=t.x-i.x,r=t.y-i.y;t.x=i.x+n*s-r*o,t.y=i.y+n*o+r*s},tempToInnerOf(t,e){const{tempPoint:i}=lt;return ct(i,t),$(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=lt;return ct(i,t),tt(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=lt;return ct(i,t),lt.toInnerRadiusPointOf(t,e,i),i},copyRadiusPoint:(t,e,i,s)=>(ct(t,e),ut(t,i,s),t),toInnerRadiusPointOf(t,e,i){i||(i=t),$(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){$(e,t,i)},toOuterOf(t,e,i){tt(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)=>dt(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const o=st(i-t),n=st(s-e);return ot(o*o+n*n)},getMinDistanceFrom:(t,e,i,s,o,n)=>rt(dt(t,e,i,s),dt(i,s,o,n)),getAngle:(t,e)=>gt(t,e)/I,getRotation:(t,e,i,s)=>(s||(s=e),lt.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/I),getRadianFrom(t,e,i,o,n,r,a,h){s(a)&&(a=i,h=o);const l=t-i,d=e-o,c=n-a,u=r-h;return Math.atan2(l*u-d*c,l*c+d*u)},getAtan2:(t,e)=>nt(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s,o){const n=gt(t,e);return o&&(t=e),s||(e={}),e.x=t.x+it(n)*i,e.y=t.y+et(n)*i,e},toNumberPoints(t){let e=t;return c(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:Q(t.x)===Q(e.x)&&Q(t.y)===Q(e.y),reset(t){lt.reset(t)}},lt=ht,{getDistanceFrom:dt,copy:ct,setRadius:ut,getAtan2:gt}=lt;class pt{constructor(t,e){this.set(t,e)}set(t,e){return c(t)?ht.copy(this,t):ht.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new pt(this)}move(t,e){return ht.move(this,t,e),this}scale(t,e){return ht.scale(this,t,e),this}scaleOf(t,e,i){return ht.scaleOf(this,t,e,i),this}rotate(t,e){return ht.rotate(this,t,e),this}rotateOf(t,e){return ht.rotate(this,e,t),this}getRotation(t,e,i){return ht.getRotation(this,t,e,i)}toInnerOf(t,e){return ht.toInnerOf(this,t,e),this}toOuterOf(t,e){return ht.toOuterOf(this,t,e),this}getCenter(t){return new pt(ht.getCenter(this,t))}getDistance(t){return ht.getDistance(this,t)}getDistancePoint(t,e,i,s){return new pt(ht.getDistancePoint(this,t,e,i,s))}getAngle(t){return ht.getAngle(this,t)}getAtan2(t){return ht.getAtan2(this,t)}isSame(t,e){return ht.isSame(this,t,e)}reset(){return ht.reset(this),this}}const _t=new pt;class ft{constructor(t,e,i,s,o,n){this.set(t,e,i,s,o,n)}set(t,e,i,s,o,n){return c(t)?Z.copy(this,t):Z.set(this,t,e,i,s,o,n),this}setWith(t){return Z.copy(this,t),this.scaleX=t.scaleX,this.scaleY=t.scaleY,this}get(){const{a:t,b:e,c:i,d:s,e:o,f:n}=this;return{a:t,b:e,c:i,d:s,e:o,f:n}}clone(){return new ft(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,i){return Z.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return Z.scaleOfInner(this,t,e,i),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,i){return Z.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return Z.skewOfInner(this,t,e,i),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,i){Z.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){Z.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return Z.setLayout(this,t,e,i),this}getLayout(t,e,i){return Z.getLayout(this,t,e,i)}withScale(t,e){return Z.withScale(this,t,e)}reset(){Z.reset(this)}}const mt=new ft,yt={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,o){vt(t,e,i),vt(t,e+s,i+o)},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}=yt;var wt,xt;!function(t){t[t.top=0]="top",t[t.right=1]="right",t[t.bottom=2]="bottom",t[t.left=3]="left"}(wt||(wt={})),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"}(xt||(xt={}));const bt=[{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}];bt.forEach(t=>t.type="percent");const St={directionData:bt,tempPoint:{},get:kt,toPoint(t,e,i,s,o,n){const r=kt(t);i.x=r.x,i.y=r.y,"percent"===r.type&&(i.x*=e.width,i.y*=e.height,o&&(n||(i.x-=o.x,i.y-=o.y),r.x&&(i.x-=1===r.x?o.width:.5===r.x?r.x*o.width:0),r.y&&(i.y-=1===r.y?o.height:.5===r.y?r.y*o.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 kt(t){return n(t)?bt[xt[t]]:t}const{toPoint:Et}=St,Bt={toPoint(t,e,i,s,o,n){Et(t,i,s,o,e,n)}},{tempPointBounds:Tt,setPoint:Rt,addPoint:Ct,toBounds:Pt}=yt,{toOuterPoint:Ot}=Z,{float:Lt,fourNumber:At}=M,{floor:Dt,ceil:Mt}=Math;let Ft,It,Wt,zt;const Yt={},Xt={},Nt={},Ht={tempBounds:Nt,set(t,e=0,i=0,s=0,o=0){t.x=e,t.y=i,t.width=s,t.height=o},copy(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},copyAndSpread(t,e,i,s,o){const{x:n,y:r,width:a,height:h}=e;if(d(i)){const e=At(i);s?Vt.set(t,n+e[3],r+e[0],a-e[1]-e[3],h-e[2]-e[0]):Vt.set(t,n-e[3],r-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),Vt.set(t,n-i,r-i,a+2*i,h+2*i);o&&("width"===o?(t.y=r,t.height=h):(t.x=n,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,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),Vt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?Ut(e,t):e=t,i||(i=t),e.offsetX=Vt.maxX(i),e.offsetY=Vt.maxY(i),Vt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||ht.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){ht.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(Vt.copy(Nt,t),Vt.toOuterOf(Nt,e),Nt),getOuterOf:(t,e)=>(t=Object.assign({},t),Vt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:o,e:n,f:r}=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),o>0?(i.height=t.height*o,i.y=r+t.y*o):(i.height=t.height*-o,i.y=r+t.y*o-i.height)}else Yt.x=t.x,Yt.y=t.y,Ot(e,Yt,Xt),Rt(Tt,Xt.x,Xt.y),Yt.x=t.x+t.width,Ot(e,Yt,Xt),Ct(Tt,Xt.x,Xt.y),Yt.y=t.y+t.height,Ot(e,Yt,Xt),Ct(Tt,Xt.x,Xt.y),Yt.x=t.x,Ot(e,Yt,Xt),Ct(Tt,Xt.x,Xt.y),Pt(Tt,i)},toInnerOf(t,e,i){i||(i=t),Vt.move(i,-e.e,-e.f),Vt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,Vt.getFitScale(t,e));return new ft(s,0,0,s,-e.x*s,-e.y*s)},getFitScale(t,e,i){const s=t.width/e.width,o=t.height/e.height;return i?Math.max(s,o):Math.min(s,o)},put(t,e,i="center",s=1,o=!0,r){r||(r=e),n(s)&&(s=Vt.getFitScale(t,e,"cover"===s)),Nt.width=o?e.width*=s:e.width*s,Nt.height=o?e.height*=s:e.height*s,Bt.toPoint(i,Nt,t,r,!0,!0)},getSpread(t,e,i){const s={};return Vt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){Vt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){Vt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=Dt(t.x),t.y=Dt(t.y),t.width=e>t.x?Mt(t.width+e-t.x):Mt(t.width),t.height=i>t.y?Mt(t.height+i-t.y):Mt(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=Lt(t.x,e),t.y=Lt(t.y,e),t.width=Lt(t.width,e),t.height=Lt(t.height,e)},add(t,e,i){Ft=t.x+t.width,It=t.y+t.height,Wt=e.x,zt=e.y,i||(Wt+=e.width,zt+=e.height),Ft=Ft>Wt?Ft:Wt,It=It>zt?It:zt,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=It-t.y},addList(t,e){Vt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){Vt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){Vt.setListWithFn(t,e,i,!0)},setListWithFn(t,e,i,s=!1){let o,n=!0;for(let r=0,a=e.length;r<a;r++)o=i?i(e[r],r):e[r],o&&(o.width||o.height)&&(n?(n=!1,s||Ut(t,o)):jt(t,o));n&&Vt.reset(t)},setPoints(t,e){e.forEach((t,e)=>0===e?Rt(Tt,t.x,t.y):Ct(Tt,t.x,t.y)),Pt(Tt,t)},setPoint(t,e){Vt.set(t,e.x,e.y)},addPoint(t,e){jt(t,e,!0)},getPoints(t){const{x:e,y:i,width:s,height:o}=t;return[{x:e,y:i},{x:e+s,y:i},{x:e+s,y:i+o},{x:e,y:i+o}]},getPoint:(t,e,i=!1,s)=>St.getPoint(e,t,s,i),hitRadiusPoint:(t,e,i)=>(i&&(e=ht.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=ht.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=Vt.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=Vt.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=Vt.tempToOuterOf(e,i)),!Vt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:o,width:n,height:r}=e;return Ft=s+n,It=o+r,Wt=t.x+t.width,zt=t.y+t.height,s=s>t.x?s:t.x,o=o>t.y?o:t.y,Ft=Ft<Wt?Ft:Wt,It=It<zt?It:zt,n=Ft-s,r=It-o,{x:s,y:o,width:n,height:r}},intersect(t,e,i){Vt.copy(t,Vt.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){Vt.set(t)}},Vt=Ht,{add:jt,copy:Ut}=Vt;class Gt{get minX(){return Ht.minX(this)}get minY(){return Ht.minY(this)}get maxX(){return Ht.maxX(this)}get maxY(){return Ht.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return c(t)?Ht.copy(this,t):Ht.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 Ht.move(this,t,e),this}scale(t,e,i){return Ht.scale(this,t,e,i),this}scaleOf(t,e,i){return Ht.scaleOf(this,t,e,i),this}toOuterOf(t,e){return Ht.toOuterOf(this,t,e),this}toInnerOf(t,e){return Ht.toInnerOf(this,t,e),this}getFitMatrix(t,e){return Ht.getFitMatrix(this,t,e)}put(t,e,i){Ht.put(this,t,e,i)}spread(t,e){return Ht.spread(this,t,e),this}shrink(t,e){return Ht.shrink(this,t,e),this}ceil(){return Ht.ceil(this),this}unsign(){return Ht.unsign(this),this}float(t){return Ht.float(this,t),this}add(t){return Ht.add(this,t),this}addList(t){return Ht.setList(this,t,!0),this}setList(t){return Ht.setList(this,t),this}addListWithFn(t,e){return Ht.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return Ht.setListWithFn(this,t,e),this}setPoint(t){return Ht.setPoint(this,t),this}setPoints(t){return Ht.setPoints(this,t),this}addPoint(t){return Ht.addPoint(this,t),this}getPoints(){return Ht.getPoints(this)}getPoint(t,e,i){return Ht.getPoint(this,t,e,i)}hitPoint(t,e){return Ht.hitPoint(this,t,e)}hitRadiusPoint(t,e){return Ht.hitRadiusPoint(this,t,e)}hit(t,e){return Ht.hit(this,t,e)}includes(t,e){return Ht.includes(this,t,e)}intersect(t,e){return Ht.intersect(this,t,e),this}getIntersect(t,e){return new Gt(Ht.getIntersectData(this,t,e))}isSame(t){return Ht.isSame(this,t)}isEmpty(){return Ht.isEmpty(this)}reset(){Ht.reset(this)}}const qt=new Gt;class Kt{constructor(t,e,i,s,o,n){c(t)?this.copy(t):this.set(t,e,i,s,o,n)}set(t=0,e=0,i=0,s=0,o=0,n=0){this.top=t,this.right=e,this.bottom=i,this.left=s,this.width=o,this.height=n}copy(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=t;this.set(e,i,s,o,n,r)}getBoundsFrom(t){const{top:e,right:i,bottom:s,left:o,width:n,height:r}=this;return new Gt(o,e,n||t.width-o-i,r||t.height-e-s)}}const Zt={number:(t,e)=>c(t)?"percent"===t.type?t.value*e:t.value:t},Jt={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:Qt,max:$t}=Math,te={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||ee.maxCacheSize),isSuperLarge:(t,e,i)=>ee.isLarge(t,e,i,ee.maxPatternSize),getRealURL(t){const{prefix:e,suffix:i}=ee;return!i||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+i),e&&"/"===t[0]&&(t=e+t),t},resize(t,e,i,s,o,n,r,a,h,l){const d=$t(Qt(e+(s||0)),1),c=$t(Qt(i+(o||0)),1);let u,g,p;l&&(p=Zt.number(l.offset,"x"===l.type?e:i))&&("x"===l.type?u=!0:g=!0);const _=te.origin.createCanvas(g?2*d:d,u?2*c:c),f=_.getContext("2d");if(a&&(f.globalAlpha=a),f.imageSmoothingEnabled=!1!==r,ee.canUse(t)){if(n){const s=e/n.width,o=i/n.height;f.setTransform(s,0,0,o,-n.x*s,-n.y*o),f.drawImage(t,0,0,t.width,t.height)}else f.drawImage(t,0,0,e,i);p&&(f.drawImage(_,0,0,d,c,u?p-d:d,u?c:p-c,d,c),f.drawImage(_,0,0,d,c,u?p:d,u?c:p,d,c))}return _},canUse:t=>t&&t.width&&!t.__closed,setPatternTransform(t,e,i){try{e&&t.setTransform&&(t.setTransform(e),e=void 0)}catch(t){}i&&p.stintSet(i,"transform",e)}}},{image:ee}=te,{randColor:ie}=M;class se{constructor(t){this.repeatMap={},this.name=t}static get(t){return new se(t)}static set filter(t){this.filterList=oe(t)}static set exclude(t){this.excludeList=oe(t)}static drawRepaint(t,e){const i=ie();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===se.showBounds,o=t.__nowWorld,n=ie();s&&(e.setWorld(o),t.__drawHitPath(e),e.fillStyle=n.replace("1)",".2)"),e.fill()),e.resetTransform(),e.setStroke(n,2),s?e.stroke():e.strokeWorld(o,n)}log(...t){if(ne.enable){if(ne.filterList.length&&ne.filterList.every(t=>t!==this.name))return;if(ne.excludeList.length&&ne.excludeList.some(t=>t===this.name))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){ne.enable&&this.warn(...t)}warn(...t){ne.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 oe(t){return t?n(t)&&(t=[t]):t=[],t}se.filterList=[],se.excludeList=[],se.showWarn=!0;const ne=se,re=se.get("RunTime"),ae={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const i=m.create(m.RUNTIME);return he.currentId=he.idMap[i]=e?performance.now():Date.now(),he.currentName=he.nameMap[i]=t,he.nameToIdMap[t]=i,i},end(t,e){const i=he.idMap[t],s=he.nameMap[t],o=e?(performance.now()-i)/1e3:Date.now()-i;he.idMap[t]=he.nameMap[t]=he.nameToIdMap[s]=void 0,re.log(s,o,"ms")},endOfName(t,e){const i=he.nameToIdMap[t];s(i)||he.end(i,e)}},he=ae,le=[],de={list:{},add(t,...e){this.list[t]=!0,le.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(()=>le.forEach(t=>de.has(t,!0)));const ce={editor:t=>de.need("editor")},ue=se.get("UICreator"),ge={list:{},register(t){const{__tag:e}=t.prototype;pe[e]&&ue.repeat(e),pe[e]=t},get(t,e,i,o,n,r){if(!pe[t])return void ue.warn("not register "+t);const a=new pe[t](e);return s(i)||(a.x=i,o&&(a.y=o),n&&(a.width=n),r&&(a.height=r)),a}},{list:pe}=ge,_e=se.get("EventCreator"),fe={nameList:{},register(t){let e;Object.keys(t).forEach(i=>{e=t[i],n(e)&&(me[e]&&_e.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}=fe;class ye{constructor(){this.list=[]}add(t){t.manager=this,this.list.push(t)}get(t){let e;const{list:i}=this;for(let s=0,o=i.length;s<o;s++)if(e=i[s],e.recycled&&e.isSameSize(t))return e.recycled=!1,e.manager||(e.manager=this),e;const s=ce.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 ve(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function we(t,e,i,s){return new(i||(i=Promise))(function(o,n){function r(t){try{h(s.next(t))}catch(t){n(t)}}function a(t){try{h(s.throw(t))}catch(t){n(t)}}function h(t){t.done?o(t.value):function(t){return t instanceof i?t:new i(function(e){e(t)})}(t.value).then(r,a)}h((s=s.apply(t,e||[])).next())})}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)}}"function"==typeof SuppressedError&&SuppressedError;const be=[];function Se(){return(t,e)=>{be.push(e)}}const ke=[];let Ee=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||ke)}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,i,s,o,n){}resetTransform(){}getTransform(){}save(){}restore(){}transform(t,e,i,s,o,n){c(t)?this.context.transform(t.a,t.b,t.c,t.d,t.e,t.f):this.context.transform(t,e,i,s,o,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,o,n,r,a,h){switch(arguments.length){case 9:if(e<0){const t=-e/s*a;s+=e,e=0,n+=t,a-=t}if(i<0){const t=-i/o*h;o+=i,i=0,r+=t,h-=t}this.context.drawImage(t,e,i,s,o,n,r,a,h);break;case 5:this.context.drawImage(t,e,i,s,o);break;case 3:this.context.drawImage(t,e,i)}}beginPath(){}moveTo(t,e){}lineTo(t,e){}bezierCurveTo(t,e,i,s,o,n){}quadraticCurveTo(t,e,i,s){}closePath(){}arc(t,e,i,s,o,n){}arcTo(t,e,i,s,o){}ellipse(t,e,i,s,o,n,r,a){}rect(t,e,i,s){}roundRect(t,e,i,s,o){}createConicGradient(t,e,i){}createLinearGradient(t,e,i,s){}createPattern(t,e){}createRadialGradient(t,e,i,s,o,n){}fillText(t,e,i,s){}measureText(t){}strokeText(t,e,i,s){}destroy(){this.context=null}};ve([xe("imageSmoothingEnabled")],Ee.prototype,"smooth",void 0),ve([xe("imageSmoothingQuality")],Ee.prototype,"smoothLevel",void 0),ve([xe("globalAlpha")],Ee.prototype,"opacity",void 0),ve([xe()],Ee.prototype,"fillStyle",void 0),ve([xe()],Ee.prototype,"strokeStyle",void 0),ve([xe("lineWidth")],Ee.prototype,"strokeWidth",void 0),ve([xe("lineCap")],Ee.prototype,"strokeCap",void 0),ve([xe("lineJoin")],Ee.prototype,"strokeJoin",void 0),ve([xe("lineDashOffset")],Ee.prototype,"dashOffset",void 0),ve([xe()],Ee.prototype,"miterLimit",void 0),ve([xe()],Ee.prototype,"shadowBlur",void 0),ve([xe()],Ee.prototype,"shadowColor",void 0),ve([xe()],Ee.prototype,"shadowOffsetX",void 0),ve([xe()],Ee.prototype,"shadowOffsetY",void 0),ve([xe()],Ee.prototype,"filter",void 0),ve([xe()],Ee.prototype,"font",void 0),ve([xe()],Ee.prototype,"fontKerning",void 0),ve([xe()],Ee.prototype,"fontStretch",void 0),ve([xe()],Ee.prototype,"fontVariantCaps",void 0),ve([xe()],Ee.prototype,"textAlign",void 0),ve([xe()],Ee.prototype,"textBaseline",void 0),ve([xe()],Ee.prototype,"textRendering",void 0),ve([xe()],Ee.prototype,"wordSpacing",void 0),ve([xe()],Ee.prototype,"letterSpacing",void 0),ve([xe()],Ee.prototype,"direction",void 0),ve([Se()],Ee.prototype,"setTransform",null),ve([Se()],Ee.prototype,"resetTransform",null),ve([Se()],Ee.prototype,"getTransform",null),ve([Se()],Ee.prototype,"save",null),ve([Se()],Ee.prototype,"restore",null),ve([Se()],Ee.prototype,"translate",null),ve([Se()],Ee.prototype,"scale",null),ve([Se()],Ee.prototype,"rotate",null),ve([Se()],Ee.prototype,"fill",null),ve([Se()],Ee.prototype,"stroke",null),ve([Se()],Ee.prototype,"clip",null),ve([Se()],Ee.prototype,"fillRect",null),ve([Se()],Ee.prototype,"strokeRect",null),ve([Se()],Ee.prototype,"clearRect",null),ve([Se()],Ee.prototype,"beginPath",null),ve([Se()],Ee.prototype,"moveTo",null),ve([Se()],Ee.prototype,"lineTo",null),ve([Se()],Ee.prototype,"bezierCurveTo",null),ve([Se()],Ee.prototype,"quadraticCurveTo",null),ve([Se()],Ee.prototype,"closePath",null),ve([Se()],Ee.prototype,"arc",null),ve([Se()],Ee.prototype,"arcTo",null),ve([Se()],Ee.prototype,"ellipse",null),ve([Se()],Ee.prototype,"rect",null),ve([Se()],Ee.prototype,"roundRect",null),ve([Se()],Ee.prototype,"createConicGradient",null),ve([Se()],Ee.prototype,"createLinearGradient",null),ve([Se()],Ee.prototype,"createPattern",null),ve([Se()],Ee.prototype,"createRadialGradient",null),ve([Se()],Ee.prototype,"fillText",null),ve([Se()],Ee.prototype,"measureText",null),ve([Se()],Ee.prototype,"strokeText",null);const{copy:Be,multiplyParent:Te,pixelScale:Re}=Z,{round:Ce}=Math,Pe=new Gt,Oe=new Gt,Le={width:1,height:1,pixelRatio:1},Ae=["width","height","pixelRatio"];class De extends Ee{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:o}=t;this.autoLayout=!i||!s,this.size.pixelRatio=o||te.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;p.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,o=this.worldTransform;e&&Te(t,e,o),Re(t,i,o),s&&!t.ignorePixelSnap&&(t.half&&t.half*i%2?(o.e=Ce(o.e-.5)+.5,o.f=Ce(o.f-.5)+.5):(o.e=Ce(o.e),o.f=Ce(o.f))),this.setTransform(o.a,o.b,o.c,o.d,o.e,o.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:o,dashPattern:n,dashOffset:r,miterLimit:a}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(o=e.strokeJoin),s(e.dashPattern)||(n=e.dashPattern),s(e.dashOffset)||(r=e.dashOffset),e.miterLimit&&(a=e.miterLimit)),this.strokeCap=i,this.strokeJoin=o,this.dashPattern=n,this.dashOffset=r,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,i=1){return!0}setWorldShadow(t,e,i,s){const{pixelRatio:o}=this;this.shadowOffsetX=t*o,this.shadowOffsetY=e*o,this.shadowBlur=i*o,this.shadowColor=s||"black"}setWorldBlur(t){const{pixelRatio:e}=this;this.filter=`blur(${t*e}px)`}copyWorld(t,e,i,s,o){s&&(this.blendMode=s),e?(this.setTempPixelBounds(e,o),i?(this.setTempPixelBounds2(i,o),i=Oe):i=Pe,this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.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,o){e.b||e.c?(this.save(),this.resetTransform(),this.copyWorld(t,e,Ht.tempToOuterOf(i,e),s,o),this.restore()):(s&&(this.blendMode=s),this.setTempPixelBounds(e,o),this.drawImage(t.view,Pe.x,Pe.y,Pe.width,Pe.height,i.x,i.y,i.width,i.height),s&&(this.blendMode="source-over"))}copyWorldByReset(t,e,i,s,o,n){this.resetTransform(),this.copyWorld(t,e,i,s,n),o||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempPixelBounds(t,!0,!0);const{context:s}=this,o=s.getImageData(Pe.x,Pe.y,Pe.width,Pe.height),{data:n}=o;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(o,Pe.x,Pe.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(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i,s){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempPixelBounds(t,s),this.strokeRect(Pe.x,Pe.y,Pe.width,Pe.height),i&&(this.blendMode="source-over")}clipWorld(t,e=!0){this.beginPath(),this.setTempPixelBounds(t,e),this.rect(Pe.x,Pe.y,Pe.width,Pe.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e=!0){this.setTempPixelBounds(t,e),this.clearRect(Pe.x,Pe.y,Pe.width,Pe.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempPixelBounds(t,e,i){this.copyToPixelBounds(Pe,t,e,i)}setTempPixelBounds2(t,e,i){this.copyToPixelBounds(Oe,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,o=this.manager?this.manager.get(i):ce.canvas(Object.assign({},i));return o.save(),t&&(Be(o.worldTransform,this.worldTransform),o.useWorldTransform()),e&&(o.smooth=this.smooth),o.pixelSnap!==s&&(o.pixelSnap=s),o}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){}},Fe={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},Ie=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},Fe),We={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},Ye=Object.assign(Object.assign({},ze),Fe),Xe=Ie,Ne={};for(let t in Xe)Ne[Xe[t]]=t;const He={};for(let t in Xe)He[Xe[t]]=We[t];const Ve={drawRoundRect(t,e,i,s,o,n){const r=M.fourNumber(n,Math.min(s/2,o/2)),a=e+s,h=i+o;r[0]?t.moveTo(e+r[0],i):t.moveTo(e,i),r[1]?t.arcTo(a,i,a,h,r[1]):t.lineTo(a,i),r[2]?t.arcTo(a,h,e,h,r[2]):t.lineTo(a,h),r[3]?t.arcTo(e,h,e,i,r[3]):t.lineTo(e,h),r[0]?t.arcTo(e,i,a,i,r[0]):t.lineTo(e,i)}},{sin:je,cos:Ue,hypot:Ge,atan2:qe,ceil:Ke,abs:Ze,PI:Je,sqrt:Qe,pow:$e}=Math,{setPoint:ti,addPoint:ei}=yt,{set:ii,toNumberPoints:si}=ht,{M:oi,L:ni,C:ri,Q:ai,Z:hi}=Ie,li={},di={points(t,e,i,s){let o=si(e);if(t.push(oi,o[0],o[1]),i&&o.length>5){let e,n,r,a,h,l,d,c,u,g,p,_,f,m,y,v=o.length;const w=!0===i?.5:i;s&&(o=[o[v-2],o[v-1],...o,o[0],o[1],o[2],o[3]],v=o.length);for(let i=2;i<v-2;i+=2)e=o[i-2],n=o[i-1],r=o[i],a=o[i+1],h=o[i+2],l=o[i+3],p=r-e,_=a-n,f=Qe($e(p,2)+$e(_,2)),m=Qe($e(h-r,2)+$e(l-a,2)),(f||m)&&(y=f+m,f=w*f/y,m=w*m/y,h-=e,l-=n,d=r-f*h,c=a-f*l,2===i?s||t.push(ai,d,c,r,a):(p||_)&&t.push(ri,u,g,d,c,r,a),u=r+m*h,g=a+m*l);s||t.push(ai,u,g,o[v-2],o[v-1])}else for(let e=2,i=o.length;e<i;e+=2)t.push(ni,o[e],o[e+1]);s&&t.push(hi)},rect(t,e,i,s,o){Me.creator.path=t,Me.creator.moveTo(e,i).lineTo(e+s,i).lineTo(e+s,i+o).lineTo(e,i+o).lineTo(e,i)},roundRect(t,e,i,s,o,n){Me.creator.path=[],Ve.drawRoundRect(Me.creator,e,i,s,o,n),t.push(...Me.convertToCanvasData(Me.creator.path,!0))},arcTo(t,e,i,s,o,n,r,a,h,l,d){const c=s-e,u=o-i,g=n-s,p=r-o;let _=qe(u,c),f=qe(p,g);const m=Ge(c,u),y=Ge(g,p);let v=f-_;if(v<0&&(v+=W),m<1e-12||y<1e-12||v<1e-12||Ze(v-Je)<1e-12)return t&&t.push(ni,s,o),h&&(ti(h,e,i),ei(h,s,o)),d&&ii(d,e,i),void(l&&ii(l,s,o));const w=c*p-g*u<0,x=w?-1:1,b=a/Ue(v/2),S=s+b*Ue(_+v/2+z*x),k=o+b*je(_+v/2+z*x);return _-=z*x,f-=z*x,gi(t,S,k,a,a,0,_/I,f/I,w,h,l,d)},arc:(t,e,i,s,o,n,r,a,h,l)=>gi(t,e,i,s,s,0,o,n,r,a,h,l),ellipse(t,e,i,s,o,n,r,a,h,l,d,c){const u=n*I,g=je(u),p=Ue(u);let _=r*I,f=a*I;_>Je&&(_-=W),f<0&&(f+=W);let m=f-_;m<0?m+=W:m>W&&(m-=W),h&&(m-=W);const y=Ke(Ze(m/z)),v=m/y,w=je(v/4),x=8/3*w*w/je(v/2);f=_+v;let b,S,k,E,B,T,R,C,P=Ue(_),O=je(_),L=k=p*s*P-g*o*O,A=E=g*s*P+p*o*O,D=e+k,M=i+E;t&&t.push(t.length?ni:oi,D,M),l&&ti(l,D,M),c&&ii(c,D,M);for(let n=0;n<y;n++)b=Ue(f),S=je(f),k=p*s*b-g*o*S,E=g*s*b+p*o*S,B=e+L-x*(p*s*O+g*o*P),T=i+A-x*(g*s*O-p*o*P),R=e+k+x*(p*s*S+g*o*b),C=i+E+x*(g*s*S-p*o*b),t&&t.push(ri,B,T,R,C,e+k,i+E),l&&ui(e+L,i+A,B,T,R,C,e+k,i+E,l,!0),L=k,A=E,P=b,O=S,_=f,f+=v;d&&ii(d,e+k,i+E)},quadraticCurveTo(t,e,i,s,o,n,r){t.push(ri,(e+2*s)/3,(i+2*o)/3,(n+2*s)/3,(r+2*o)/3,n,r)},toTwoPointBoundsByQuadraticCurve(t,e,i,s,o,n,r,a){ui(t,e,(t+2*i)/3,(e+2*s)/3,(o+2*i)/3,(n+2*s)/3,o,n,r,a)},toTwoPointBounds(t,e,i,s,o,n,r,a,h,l){const d=[];let c,u,g,p,_,f,m,y,v=t,w=i,x=o,b=r;for(let t=0;t<2;++t)if(1==t&&(v=e,w=s,x=n,b=a),c=-3*v+9*w-9*x+3*b,u=6*v-12*w+6*x,g=3*w-3*v,Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;p=-g/u,0<p&&p<1&&d.push(p)}else m=u*u-4*g*c,y=Math.sqrt(m),m<0||(_=(-u+y)/(2*c),0<_&&_<1&&d.push(_),f=(-u-y)/(2*c),0<f&&f<1&&d.push(f));l?ei(h,t,e):ti(h,t,e),ei(h,r,a);for(let l=0,c=d.length;l<c;l++)ci(d[l],t,e,i,s,o,n,r,a,li),ei(h,li.x,li.y)},getPointAndSet(t,e,i,s,o,n,r,a,h,l){const d=1-t,c=d*d*d,u=3*d*d*t,g=3*d*t*t,p=t*t*t;l.x=c*e+u*s+g*n+p*a,l.y=c*i+u*o+g*r+p*h},getPoint(t,e,i,s,o,n,r,a,h){const l={};return ci(t,e,i,s,o,n,r,a,h,l),l},getDerivative(t,e,i,s,o){const n=1-t;return 3*n*n*(i-e)+6*n*t*(s-i)+3*t*t*(o-s)},cut(t,e,i,s,o,n,r,a,h){if(t<=0)return{left:null,right:[s,o,n,r,a,h]};if(t>=1)return{left:[s,o,n,r,a,h],right:null};const l=1-t,d=e*l+s*t,c=i*l+o*t,u=s*l+n*t,g=o*l+r*t,p=n*l+a*t,_=r*l+h*t,f=d*l+u*t,m=c*l+g*t,y=u*l+p*t,v=g*l+_*t;return{left:[d,c,f,m,f*l+y*t,m*l+v*t],right:[y,v,p,_,a,h]}}},{getPointAndSet:ci,toTwoPointBounds:ui,ellipse:gi}=di,{sin:pi,cos:_i,sqrt:fi,atan2:mi}=Math,{ellipse:yi}=di,vi={ellipticalArc(t,e,i,s,o,n,r,a,h,l,d){const c=(h-e)/2,u=(l-i)/2,g=n*I,p=pi(g),_=_i(g),f=-_*c-p*u,m=-_*u+p*c,y=s*s,v=o*o,w=m*m,x=f*f,b=y*v-y*w-v*x;let S=0;if(b<0){const t=fi(1-b/(y*v));s*=t,o*=t}else S=(r===a?-1:1)*fi(b/(y*w+v*x));const k=S*s*m/o,E=-S*o*f/s,B=mi((m-E)/o,(f-k)/s),T=mi((-m-E)/o,(-f-k)/s);let R=T-B;0===a&&R>0?R-=W:1===a&&R<0&&(R+=W);const C=e+c+_*k-p*E,P=i+u+p*k+_*E,O=R<0?1:0;d||te.ellipseToCurve?yi(t,C,P,s,o,n,B/I,T/I,O):s!==o||n?t.push(Ie.G,C,P,s,o,n,B/I,T/I,O):t.push(Ie.O,C,P,s,B/I,T/I,O)}},wi={toCommand:t=>[],toNode:t=>[]},{M:xi,m:bi,L:Si,l:ki,H:Ei,h:Bi,V:Ti,v:Ri,C:Ci,c:Pi,S:Oi,s:Li,Q:Ai,q:Di,T:Mi,t:Fi,A:Ii,a:Wi,Z:zi,z:Yi,N:Xi,D:Ni,X:Hi,G:Vi,F:ji,O:Ui,P:Gi,U:qi}=Ie,{rect:Ki,roundRect:Zi,arcTo:Ji,arc:Qi,ellipse:$i,quadraticCurveTo:ts}=di,{ellipticalArc:es}=vi,is=se.get("PathConvert"),ss={},os={current:{dot:0},stringify(t,e){let i,s,o,n=0,r=t.length,a="";for(;n<r;){s=t[n],i=He[s],a+=s===o?" ":Ne[s];for(let s=1;s<i;s++)a+=M.float(t[n+s],e),s===i-1||(a+=" ");o=s,n+=i}return a},parse(t,e){let i,s,o,n="";const r=[],a=e?Ye:ze;for(let e=0,h=t.length;e<h;e++)s=t[e],Jt[s]?("."===s&&(ns.dot&&(rs(r,n),n=""),ns.dot++),"0"===n&&"."!==s&&(rs(r,n),n=""),n+=s):Ie[s]?(n&&(rs(r,n),n=""),ns.name=Ie[s],ns.length=We[s],ns.index=0,rs(r,ns.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===o||"E"===o?n+=s:(n&&rs(r,n),n=s):n&&(rs(r,n),n=""),o=s;return n&&rs(r,n),i?os.toCanvasData(r,e):r},toCanvasData(t,e){let i,s,o,n,r,a=0,h=0,l=0,d=0,c=0,u=0,g=0,p=t.length;const _=[];for(;g<p;){switch(o=t[g],o){case bi:t[g+1]+=a,t[g+2]+=h;case xi:a=t[g+1],h=t[g+2],n===o?_.push(Si,a,h):(_.push(xi,a,h),c=a,u=h),g+=3;break;case Bi:t[g+1]+=a;case Ei:a=t[g+1],_.push(Si,a,h),g+=2;break;case Ri:t[g+1]+=h;case Ti:h=t[g+1],_.push(Si,a,h),g+=2;break;case ki:t[g+1]+=a,t[g+2]+=h;case Si:a=t[g+1],h=t[g+2],_.push(Si,a,h),g+=3;break;case Li:t[g+1]+=a,t[g+2]+=h,t[g+3]+=a,t[g+4]+=h,o=Oi;case Oi:r=n===Ci||n===Oi,l=r?2*a-i:t[g+1],d=r?2*h-s:t[g+2],i=t[g+1],s=t[g+2],a=t[g+3],h=t[g+4],_.push(Ci,l,d,i,s,a,h),g+=5;break;case Pi:t[g+1]+=a,t[g+2]+=h,t[g+3]+=a,t[g+4]+=h,t[g+5]+=a,t[g+6]+=h,o=Ci;case Ci:i=t[g+3],s=t[g+4],a=t[g+5],h=t[g+6],_.push(Ci,t[g+1],t[g+2],i,s,a,h),g+=7;break;case Fi:t[g+1]+=a,t[g+2]+=h,o=Mi;case Mi:r=n===Ai||n===Mi,i=r?2*a-i:t[g+1],s=r?2*h-s:t[g+2],e?ts(_,a,h,i,s,t[g+1],t[g+2]):_.push(Ai,i,s,t[g+1],t[g+2]),a=t[g+1],h=t[g+2],g+=3;break;case Di:t[g+1]+=a,t[g+2]+=h,t[g+3]+=a,t[g+4]+=h,o=Ai;case Ai:i=t[g+1],s=t[g+2],e?ts(_,a,h,i,s,t[g+3],t[g+4]):_.push(Ai,i,s,t[g+3],t[g+4]),a=t[g+3],h=t[g+4],g+=5;break;case Wi:t[g+6]+=a,t[g+7]+=h;case Ii:es(_,a,h,t[g+1],t[g+2],t[g+3],t[g+4],t[g+5],t[g+6],t[g+7],e),a=t[g+6],h=t[g+7],g+=8;break;case Yi:case zi:_.push(zi),a=c,h=u,g++;break;case Xi:a=t[g+1],h=t[g+2],e?Ki(_,a,h,t[g+3],t[g+4]):as(_,t,g,5),g+=5;break;case Ni:a=t[g+1],h=t[g+2],e?Zi(_,a,h,t[g+3],t[g+4],[t[g+5],t[g+6],t[g+7],t[g+8]]):as(_,t,g,9),g+=9;break;case Hi:a=t[g+1],h=t[g+2],e?Zi(_,a,h,t[g+3],t[g+4],t[g+5]):as(_,t,g,6),g+=6;break;case Vi:$i(e?_:as(_,t,g,9),t[g+1],t[g+2],t[g+3],t[g+4],t[g+5],t[g+6],t[g+7],t[g+8],null,ss),a=ss.x,h=ss.y,g+=9;break;case ji:e?$i(_,t[g+1],t[g+2],t[g+3],t[g+4],0,0,360,!1):as(_,t,g,5),a=t[g+1]+t[g+3],h=t[g+2],g+=5;break;case Ui:Qi(e?_:as(_,t,g,7),t[g+1],t[g+2],t[g+3],t[g+4],t[g+5],t[g+6],null,ss),a=ss.x,h=ss.y,g+=7;break;case Gi:e?Qi(_,t[g+1],t[g+2],t[g+3],0,360,!1):as(_,t,g,4),a=t[g+1]+t[g+3],h=t[g+2],g+=4;break;case qi:Ji(e?_:as(_,t,g,6),a,h,t[g+1],t[g+2],t[g+3],t[g+4],t[g+5],null,ss),a=ss.x,h=ss.y,g+=6;break;default:return is.error(`command: ${o} [index:${g}]`,t),_}n=o}return _},objectToCanvasData(t){if(t[0].name.length>1)return wi.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(Si,t.x,t.y);break;case"C":e.push(Ci,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(zi)}}),e}},copyData(t,e,i,s){for(let o=i,n=i+s;o<n;o++)t.push(e[o])},pushData(t,e){ns.index===ns.length&&(ns.index=1,t.push(ns.name)),t.push(Number(e)),ns.index++,ns.dot=0}},{current:ns,pushData:rs,copyData:as}=os,{M:hs,L:ls,C:ds,Q:cs,Z:us,N:gs,D:ps,X:_s,G:fs,F:ms,O:ys,P:vs,U:ws}=Ie,{getMinDistanceFrom:xs,getRadianFrom:bs}=ht,{tan:Ss,min:ks,abs:Es}=Math,Bs={},Ts={beginPath(t){t.length=0},moveTo(t,e,i){t.push(hs,e,i)},lineTo(t,e,i){t.push(ls,e,i)},bezierCurveTo(t,e,i,s,o,n,r){t.push(ds,e,i,s,o,n,r)},quadraticCurveTo(t,e,i,s,o){t.push(cs,e,i,s,o)},closePath(t){t.push(us)},rect(t,e,i,s,o){t.push(gs,e,i,s,o)},roundRect(t,e,i,s,o,n){if(a(n))t.push(_s,e,i,s,o,n);else{const r=M.fourNumber(n);r?t.push(ps,e,i,s,o,...r):t.push(gs,e,i,s,o)}},ellipse(t,e,i,s,n,r,a,h,l){if(s===n)return Cs(t,e,i,s,a,h,l);o(r)?t.push(ms,e,i,s,n):(o(a)&&(a=0),o(h)&&(h=360),t.push(fs,e,i,s,n,r,a,h,l?1:0))},arc(t,e,i,s,n,r,a){o(n)?t.push(vs,e,i,s):(o(n)&&(n=0),o(r)&&(r=360),t.push(ys,e,i,s,n,r,a?1:0))},arcTo(t,e,i,o,n,r,a,h,l){if(!s(a)){const t=xs(a,h,e,i,o,n)/(l?1:2);r=ks(r,ks(t,t*Es(Ss(bs(a,h,e,i,o,n)/2))))}t.push(ws,e,i,o,n,r)},drawEllipse(t,e,i,s,n,r,a,h,l){di.ellipse(null,e,i,s,n,o(r)?0:r,o(a)?0:a,o(h)?360:h,l,null,null,Bs),t.push(hs,Bs.x,Bs.y),Rs(t,e,i,s,n,r,a,h,l)},drawArc(t,e,i,s,n,r,a){di.arc(null,e,i,s,o(n)?0:n,o(r)?360:r,a,null,null,Bs),t.push(hs,Bs.x,Bs.y),Cs(t,e,i,s,n,r,a)},drawPoints(t,e,i,s){di.points(t,e,i,s)}},{ellipse:Rs,arc:Cs}=Ts,{moveTo:Ps,lineTo:Os,quadraticCurveTo:Ls,bezierCurveTo:As,closePath:Ds,beginPath:Ms,rect:Fs,roundRect:Is,ellipse:Ws,arc:zs,arcTo:Ys,drawEllipse:Xs,drawArc:Ns,drawPoints:Hs}=Ts;class Vs{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?n(t)?Me.parse(t):t:[],this}beginPath(){return Ms(this.__path),this.paint(),this}moveTo(t,e){return Ps(this.__path,t,e),this.paint(),this}lineTo(t,e){return Os(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,o,n){return As(this.__path,t,e,i,s,o,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 Fs(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,o){return Is(this.__path,t,e,i,s,o),this.paint(),this}ellipse(t,e,i,s,o,n,r,a){return Ws(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}arc(t,e,i,s,o,n){return zs(this.__path,t,e,i,s,o,n),this.paint(),this}arcTo(t,e,i,s,o){return Ys(this.__path,t,e,i,s,o),this.paint(),this}drawEllipse(t,e,i,s,o,n,r,a){return Xs(this.__path,t,e,i,s,o,n,r,a),this.paint(),this}drawArc(t,e,i,s,o,n){return Ns(this.__path,t,e,i,s,o,n),this.paint(),this}drawPoints(t,e,i){return Hs(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:js,L:Us,C:Gs,Q:qs,Z:Ks,N:Zs,D:Js,X:Qs,G:$s,F:to,O:eo,P:io,U:so}=Ie,oo=se.get("PathDrawer"),no={drawPathByData(t,e){if(!e)return;let i,s=0,o=e.length;for(;s<o;)switch(i=e[s],i){case js:t.moveTo(e[s+1],e[s+2]),s+=3;break;case Us:t.lineTo(e[s+1],e[s+2]),s+=3;break;case Gs:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case qs:t.quadraticCurveTo(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Ks:t.closePath(),s+=1;break;case Zs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case Js: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 Qs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case $s:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*I,e[s+6]*I,e[s+7]*I,e[s+8]),s+=9;break;case to:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,W,!1),s+=5;break;case eo:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*I,e[s+5]*I,e[s+6]),s+=7;break;case io:t.arc(e[s+1],e[s+2],e[s+3],0,W,!1),s+=4;break;case so:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void oo.error(`command: ${i} [index:${s}]`,e)}}},{M:ro,L:ao,C:ho,Q:lo,Z:co,N:uo,D:go,X:po,G:_o,F:fo,O:mo,P:yo,U:vo}=Ie,{toTwoPointBounds:wo,toTwoPointBoundsByQuadraticCurve:xo,arcTo:bo,arc:So,ellipse:ko}=di,{addPointBounds:Eo,copy:Bo,addPoint:To,setPoint:Ro,addBounds:Co,toBounds:Po}=yt,Oo=se.get("PathBounds");let Lo,Ao,Do;const Mo={},Fo={},Io={},Wo={toBounds(t,e){Wo.toTwoPointBounds(t,Fo),Po(Fo,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Ro(e,0,0);let i,s,o,n,r,a=0,h=0,l=0;const d=t.length;for(;a<d;)switch(r=t[a],0===a&&(r===co||r===ho||r===lo?Ro(e,h,l):Ro(e,t[a+1],t[a+2])),r){case ro:case ao:h=t[a+1],l=t[a+2],To(e,h,l),a+=3;break;case ho:o=t[a+5],n=t[a+6],wo(h,l,t[a+1],t[a+2],t[a+3],t[a+4],o,n,Mo),Eo(e,Mo),h=o,l=n,a+=7;break;case lo:i=t[a+1],s=t[a+2],o=t[a+3],n=t[a+4],xo(h,l,i,s,o,n,Mo),Eo(e,Mo),h=o,l=n,a+=5;break;case co:a+=1;break;case uo:h=t[a+1],l=t[a+2],Co(e,h,l,t[a+3],t[a+4]),a+=5;break;case go:case po:h=t[a+1],l=t[a+2],Co(e,h,l,t[a+3],t[a+4]),a+=r===go?9:6;break;case _o:ko(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],Mo,Io),0===a?Bo(e,Mo):Eo(e,Mo),h=Io.x,l=Io.y,a+=9;break;case fo:h=t[a+1],l=t[a+2],Ao=t[a+3],Do=t[a+4],Co(e,h-Ao,l-Do,2*Ao,2*Do),h+=Ao,a+=5;break;case mo:So(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],Mo,Io),0===a?Bo(e,Mo):Eo(e,Mo),h=Io.x,l=Io.y,a+=7;break;case yo:h=t[a+1],l=t[a+2],Lo=t[a+3],Co(e,h-Lo,l-Lo,2*Lo,2*Lo),h+=Lo,a+=4;break;case vo:bo(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],Mo,Io),0===a?Bo(e,Mo):Eo(e,Mo),h=Io.x,l=Io.y,a+=6;break;default:return void Oo.error(`command: ${r} [index:${a}]`,t)}}},{M:zo,L:Yo,Z:Xo}=Ie,{getCenterX:No,getCenterY:Ho}=ht,{arcTo:Vo}=Ts,jo={smooth(t,e,i){let s,o,n,r=0,a=0,h=0,l=0,c=0,u=0,g=0,p=0,_=0;d(e)&&(e=e[0]||0);const f=t.length,m=9===f,y=[];for(;r<f;){switch(s=t[r],s){case zo:l=p=t[r+1],c=_=t[r+2],r+=3,t[r]===Yo?(u=t[r+1],g=t[r+2],m?y.push(zo,l,c):y.push(zo,No(l,u),Ho(c,g))):y.push(zo,l,c);break;case Yo:switch(a=t[r+1],h=t[r+2],r+=3,t[r]){case Yo:Vo(y,a,h,t[r+1],t[r+2],e,p,_,m);break;case Xo:Vo(y,a,h,l,c,e,p,_,m);break;default:y.push(Yo,a,h)}p=a,_=h;break;case Xo:o!==Xo&&(Vo(y,l,c,u,g,e,p,_,m),y.push(Xo)),r+=1;break;defaul