UNPKG

leafer-ui

Version:

一款革新、好用的 Canvas 引擎, 革新的开发体验。适用于图形编辑、小游戏、互动应用、组态软件、生成图片与短视频等场景。

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