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