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