UNPKG

leafer-ui

Version:

一款革新、好用的 Canvas 引擎, 轻松实现专业图形编辑。适用于图形编辑、小游戏、互动应用、组态软件、生成图片与短视频等场景。

1 lines 204 kB
var LeaferUI=function(t){"use strict";const e={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",getRealURL(t){const{prefix:i,suffix:s}=e.image;return!s||t.startsWith("data:")||t.startsWith("blob:")||(t+=(t.includes("?")?"&":"?")+s),i&&"/"===t[0]&&(t=i+t),t}}},i={RUNTIME:"runtime",LEAF:"leaf",TASK:"task",CNAVAS:"canvas",IMAGE:"image",types:{},create(t){const{types:e}=s;return e[t]?e[t]++:(e[t]=1,0)}},s=i,{round:r,pow:n,PI:o}=Math,a={within:(t,e,i)=>("object"==typeof e&&(i=e.max,e=e.min),void 0!==e&&t<e&&(t=e),void 0!==i&&t>i&&(t=i),t),fourNumber(t,e){let i;if(t instanceof Array)switch(t.length){case 4:i=void 0===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]),e)for(let t=0;t<4;t++)i[t]>e&&(i[t]=e);return i},formatRotation:(t,e)=>(t%=360,e?t<0&&(t+=360):(t>180&&(t-=360),t<-180&&(t+=360)),a.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=void 0!==e?n(10,e):1e12;return-0===(t=r(t*i)/i)?0:t},getScaleData(t,e,i,s){if(s||(s={}),e){const t=("number"==typeof e?e:e.width||0)/i.width,r=("number"==typeof e?e:e.height||0)/i.height;s.scaleX=t||r||1,s.scaleY=r||t||1}else t&&a.assignScale(s,t);return s},assignScale(t,e){"number"==typeof e?t.scaleX=t.scaleY=e:(t.scaleX=e.x,t.scaleY=e.y)},randInt:h,randColor:t=>`rgba(${h(255)},${h(255)},${h(255)},${t||1})`};function h(t){return Math.round(Math.random()*t)}const l=o/180,d=2*o,c=o/2;function u(){return{x:0,y:0}}function _(){return{x:0,y:0,width:0,height:0}}function p(){return{a:1,b:0,c:0,d:1,e:0,f:0}}const{sin:g,cos:f,acos:y,sqrt:v}=Math,{float:m}=a,w={};function x(){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 b={defaultMatrix:{a:1,b:0,c:0,d:1,e:0,f:0},defaultWorld:x(),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:p,getWorld:x,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},scaleOfOuter(t,e,i,s){E.toInnerPoint(t,e,w),E.scaleOfInner(t,w,i,s)},scaleOfInner(t,e,i,s=i){E.translateInner(t,e.x,e.y),E.scale(t,i,s),E.translateInner(t,-e.x,-e.y)},rotate(t,e){const{a:i,b:s,c:r,d:n}=t,o=f(e*=l),a=g(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){E.toInnerPoint(t,e,w),E.rotateOfInner(t,w,i)},rotateOfInner(t,e,i){E.translateInner(t,e.x,e.y),E.rotate(t,i),E.translateInner(t,-e.x,-e.y)},skew(t,e,i){const{a:s,b:r,c:n,d:o}=t;i&&(i*=l,t.a=s+n*i,t.b=r+o*i),e&&(e*=l,t.c=n+s*e,t.d=o+r*e)},skewOfOuter(t,e,i,s){E.toInnerPoint(t,e,w),E.skewOfInner(t,w,i,s)},skewOfInner(t,e,i,s=0){E.translateInner(t,e.x,e.y),E.skew(t,i,s),E.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,r,n){let{e:o,f:a}=t;if(n&&(o+=n.scrollX,a+=n.scrollY),i||(i=t),void 0===s&&(s=1!==t.a||t.b||t.c||1!==t.d),s){const{a:s,b:n,c:o,d:a}=t;i.a=s*e.a+n*e.c,i.b=s*e.b+n*e.d,i.c=o*e.a+a*e.c,i.d=o*e.b+a*e.d,r&&(i.scaleX=e.scaleX*r.scaleX,i.scaleY=e.scaleY*r.scaleY)}else i.a=e.a,i.b=e.b,i.c=e.c,i.d=e.d,r&&(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){E.multiply(t,E.tempInvert(e))},divideParent(t,e){E.multiplyParent(t,E.tempInvert(e))},tempInvert(t){const{tempMatrix:e}=E;return E.copy(e,t),E.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,r){const{x:n,y:o,scaleX:a,scaleY:h}=e;if(void 0===r&&(r=e.rotation||e.skewX||e.skewY),r){const{rotation:i,skewX:s,skewY:r}=e,n=i*l,o=f(n),d=g(n);if(s||r){const e=s*l,i=r*l;t.a=(o+i*-d)*a,t.b=(d+i*o)*a,t.c=(e*o-d)*h,t.d=(o+e*d)*h}else t.a=o*a,t.b=d*a,t.c=-d*h,t.d=o*h}else t.a=a,t.b=0,t.c=0,t.d=h;t.e=n,t.f=o,(i=i||s)&&E.translateInner(t,-i.x,-i.y,!s)},getLayout(t,e,i,s){const{a:r,b:n,c:o,d:a,e:h,f:d}=t;let u,_,p,w,x,b=h,E=d;if(n||o){const t=r*a-n*o;if(o&&!s){u=v(r*r+n*n),_=t/u;const e=r/u;p=n>0?y(e):-y(e)}else{_=v(o*o+a*a),u=t/_;const e=o/_;p=c-(a>0?y(-e):-y(e))}const e=m(f(p)),i=g(p);u=m(u),_=m(_),w=e?m((o/_+i)/e/l,9):0,x=e?m((n/u-i)/e/l,9):0,p=m(p/l)}else u=r,_=a,p=w=x=0;return(e=i||e)&&(b+=e.x*r+e.y*o,E+=e.x*n+e.y*a,i||(b-=e.x,E-=e.y)),{x:b,y:E,scaleX:u,scaleY:_,rotation:p,skewX:w,skewY:x}},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=v(s*s+r*r)):(e=s,i=o)}return s.scaleX=e,s.scaleY=i,s},reset(t){E.set(t)}},E=b,{toInnerPoint:B,toOuterPoint:P}=b,{sin:k,cos:C,abs:R,sqrt:T,atan2:S,min:L,round:O}=Math,D={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=void 0===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?O(t.x-.5)+.5:O(t.x),t.y=e?O(t.y-.5)+.5:O(t.y)},move(t,e,i){"object"==typeof 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=I.defaultPoint);const s=C(e*=l),r=k(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}=I;return M(i,t),B(e,i,i),i},tempToOuterOf(t,e){const{tempPoint:i}=I;return M(i,t),P(e,i,i),i},tempToInnerRadiusPointOf(t,e){const{tempRadiusPoint:i}=I;return M(i,t),I.toInnerRadiusPointOf(t,e,i),i},toInnerRadiusPointOf(t,e,i){i||(i=t),B(e,t,i),i.radiusX=Math.abs(t.radiusX/e.scaleX),i.radiusY=Math.abs(t.radiusY/e.scaleY)},toInnerOf(t,e,i){B(e,t,i)},toOuterOf(t,e,i){P(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)=>A(t.x,t.y,e.x,e.y),getDistanceFrom(t,e,i,s){const r=R(i-t),n=R(s-e);return T(r*r+n*n)},getMinDistanceFrom:(t,e,i,s,r,n)=>L(A(t,e,i,s),A(i,s,r,n)),getAngle:(t,e)=>W(t,e)/l,getRotation:(t,e,i,s)=>(s||(s=e),I.getRadianFrom(t.x,t.y,e.x,e.y,i.x,i.y,s.x,s.y)/l),getRadianFrom(t,e,i,s,r,n,o,a){void 0===o&&(o=i,a=s);const h=t-i,l=e-s,d=r-o,c=n-a;return Math.atan2(h*c-l*d,h*d+l*c)},getAtan2:(t,e)=>S(e.y-t.y,e.x-t.x),getDistancePoint(t,e,i,s){const r=W(t,e);return(e=s?e:{}).x=t.x+C(r)*i,e.y=t.y+k(r)*i,e},toNumberPoints(t){let e=t;return"object"==typeof t[0]&&(e=[],t.forEach((t=>e.push(t.x,t.y)))),e},reset(t){I.reset(t)}},I=D,{getDistanceFrom:A,copy:M,getAtan2:W}=I;class F{constructor(t,e){this.set(t,e)}set(t,e){return"object"==typeof t?D.copy(this,t):D.set(this,t,e),this}get(){const{x:t,y:e}=this;return{x:t,y:e}}clone(){return new F(this)}move(t,e){return D.move(this,t,e),this}scale(t,e){return D.scale(this,t,e),this}scaleOf(t,e,i){return D.scaleOf(this,t,e,i),this}rotate(t,e){return D.rotate(this,t,e),this}rotateOf(t,e){return D.rotate(this,e,t),this}getRotation(t,e,i){return D.getRotation(this,t,e,i)}toInnerOf(t,e){return D.toInnerOf(this,t,e),this}toOuterOf(t,e){return D.toOuterOf(this,t,e),this}getCenter(t){return new F(D.getCenter(this,t))}getDistance(t){return D.getDistance(this,t)}getDistancePoint(t,e,i){return new F(D.getDistancePoint(this,t,e,i))}getAngle(t){return D.getAngle(this,t)}getAtan2(t){return D.getAtan2(this,t)}reset(){return D.reset(this),this}}const U=new F;class z{constructor(t,e,i,s,r,n){this.set(t,e,i,s,r,n)}set(t,e,i,s,r,n){return"object"==typeof t?b.copy(this,t):b.set(this,t,e,i,s,r,n),this}setWith(t){return b.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 z(this)}translate(t,e){return b.translate(this,t,e),this}translateInner(t,e){return b.translateInner(this,t,e),this}scale(t,e){return b.scale(this,t,e),this}scaleWith(t,e){return b.scale(this,t,e),this.scaleX*=t,this.scaleY*=e||t,this}scaleOfOuter(t,e,i){return b.scaleOfOuter(this,t,e,i),this}scaleOfInner(t,e,i){return b.scaleOfInner(this,t,e,i),this}rotate(t){return b.rotate(this,t),this}rotateOfOuter(t,e){return b.rotateOfOuter(this,t,e),this}rotateOfInner(t,e){return b.rotateOfInner(this,t,e),this}skew(t,e){return b.skew(this,t,e),this}skewOfOuter(t,e,i){return b.skewOfOuter(this,t,e,i),this}skewOfInner(t,e,i){return b.skewOfInner(this,t,e,i),this}multiply(t){return b.multiply(this,t),this}multiplyParent(t){return b.multiplyParent(this,t),this}divide(t){return b.divide(this,t),this}divideParent(t){return b.divideParent(this,t),this}invert(){return b.invert(this),this}invertWith(){return b.invert(this),this.scaleX=1/this.scaleX,this.scaleY=1/this.scaleY,this}toOuterPoint(t,e,i){b.toOuterPoint(this,t,e,i)}toInnerPoint(t,e,i){b.toInnerPoint(this,t,e,i)}setLayout(t,e,i){return b.setLayout(this,t,e,i),this}getLayout(t,e,i){return b.getLayout(this,t,e,i)}withScale(t,e){return b.withScale(this,t,e)}reset(){b.reset(this)}}const N=new z,Y={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){X(t,e,i),X(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:X}=Y;var H,j;t.Direction4=void 0,(H=t.Direction4||(t.Direction4={}))[H.top=0]="top",H[H.right=1]="right",H[H.bottom=2]="bottom",H[H.left=3]="left",t.Direction9=void 0,(j=t.Direction9||(t.Direction9={}))[j.topLeft=0]="topLeft",j[j.top=1]="top",j[j.topRight=2]="topRight",j[j.right=3]="right",j[j.bottomRight=4]="bottomRight",j[j.bottom=5]="bottom",j[j.bottomLeft=6]="bottomLeft",j[j.left=7]="left",j[j.center=8]="center",j[j["top-left"]=0]="top-left",j[j["top-right"]=2]="top-right",j[j["bottom-right"]=4]="bottom-right",j[j["bottom-left"]=6]="bottom-left";const G=[{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}];G.forEach((t=>t.type="percent"));const V={directionData:G,tempPoint:{},get:K,toPoint(t,e,i,s,r,n){const o=K(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={}),V.toPoint(t,e,i,!0),i)};function K(e){return"string"==typeof e?G[t.Direction9[e]]:e}const{toPoint:q}=V,Z={toPoint(t,e,i,s,r,n){q(t,i,s,r,e,n)}},{tempPointBounds:$,setPoint:Q,addPoint:J,toBounds:tt}=Y,{toOuterPoint:et}=b,{float:it,fourNumber:st}=a,{floor:rt,ceil:nt}=Math;let ot,at,ht,lt;const dt={},ct={},ut={},_t={tempBounds:ut,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(i instanceof Array){const e=st(i);s?pt.set(t,n+e[3],o+e[0],a-e[1]-e[3],h-e[2]-e[0]):pt.set(t,n-e[3],o-e[0],a+e[1]+e[3],h+e[2]+e[0])}else s&&(i=-i),pt.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},getByMove:(t,e,i)=>(t=Object.assign({},t),pt.move(t,e,i),t),toOffsetOutBounds(t,e,i){e?ft(e,t):e=t,i?(e.offsetX=-(pt.maxX(i)-t.x),e.offsetY=-(pt.maxY(i)-t.y)):(e.offsetX=t.x+t.width,e.offsetY=t.y+t.height),pt.move(e,-e.offsetX,-e.offsetY)},scale(t,e,i=e,s){s||D.scale(t,e,i),t.width*=e,t.height*=i},scaleOf(t,e,i,s=i){D.scaleOf(t,e,i,s),t.width*=i,t.height*=s},tempToOuterOf:(t,e)=>(pt.copy(ut,t),pt.toOuterOf(ut,e),ut),getOuterOf:(t,e)=>(t=Object.assign({},t),pt.toOuterOf(t,e),t),toOuterOf(t,e,i){if(i||(i=t),0===e.b&&0===e.c){const{a:s,d:r}=e;s>0?(i.width=t.width*s,i.x=e.e+t.x*s):(i.width=t.width*-s,i.x=e.e+t.x*s-i.width),r>0?(i.height=t.height*r,i.y=e.f+t.y*r):(i.height=t.height*-r,i.y=e.f+t.y*r-i.height)}else dt.x=t.x,dt.y=t.y,et(e,dt,ct),Q($,ct.x,ct.y),dt.x=t.x+t.width,et(e,dt,ct),J($,ct.x,ct.y),dt.y=t.y+t.height,et(e,dt,ct),J($,ct.x,ct.y),dt.x=t.x,et(e,dt,ct),J($,ct.x,ct.y),tt($,i)},toInnerOf(t,e,i){i||(i=t),pt.move(i,-e.e,-e.f),pt.scale(i,1/e.a,1/e.d)},getFitMatrix(t,e,i=1){const s=Math.min(i,pt.getFitScale(t,e));return new z(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),"string"==typeof s&&(s=pt.getFitScale(t,e,"cover"===s)),ut.width=r?e.width*=s:e.width*s,ut.height=r?e.height*=s:e.height*s,Z.toPoint(i,ut,t,n,!0,!0)},getSpread(t,e,i){const s={};return pt.copyAndSpread(s,t,e,!1,i),s},spread(t,e,i){pt.copyAndSpread(t,t,e,!1,i)},shrink(t,e,i){pt.copyAndSpread(t,t,e,!0,i)},ceil(t){const{x:e,y:i}=t;t.x=rt(t.x),t.y=rt(t.y),t.width=e>t.x?nt(t.width+e-t.x):nt(t.width),t.height=i>t.y?nt(t.height+i-t.y):nt(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){ot=t.x+t.width,at=t.y+t.height,ht=e.x,lt=e.y,i||(ht+=e.width,lt+=e.height),ot=ot>ht?ot:ht,at=at>lt?at:lt,t.x=t.x<e.x?t.x:e.x,t.y=t.y<e.y?t.y:e.y,t.width=ot-t.x,t.height=at-t.y},addList(t,e){pt.setListWithFn(t,e,void 0,!0)},setList(t,e,i=!1){pt.setListWithFn(t,e,void 0,i)},addListWithFn(t,e,i){pt.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]):e[o],r&&(r.width||r.height)&&(n?(n=!1,s||ft(t,r)):gt(t,r));n&&pt.reset(t)},setPoints(t,e){e.forEach(((t,e)=>0===e?Q($,t.x,t.y):J($,t.x,t.y))),tt($,t)},setPoint(t,e){pt.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=D.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=D.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=pt.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=pt.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=pt.tempToOuterOf(e,i)),!pt.hit(t,e))return{x:0,y:0,width:0,height:0};let{x:s,y:r,width:n,height:o}=e;return ot=s+n,at=r+o,ht=t.x+t.width,lt=t.y+t.height,s=s>t.x?s:t.x,r=r>t.y?r:t.y,ot=ot<ht?ot:ht,at=at<lt?at:lt,n=ot-s,o=at-r,{x:s,y:r,width:n,height:o}},intersect(t,e,i){pt.copy(t,pt.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){pt.set(t)}},pt=_t,{add:gt,copy:ft}=pt;class yt{get minX(){return _t.minX(this)}get minY(){return _t.minY(this)}get maxX(){return _t.maxX(this)}get maxY(){return _t.maxY(this)}constructor(t,e,i,s){this.set(t,e,i,s)}set(t,e,i,s){return"object"==typeof t?_t.copy(this,t):_t.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 yt(this)}move(t,e){return _t.move(this,t,e),this}scale(t,e,i){return _t.scale(this,t,e,i),this}scaleOf(t,e,i){return _t.scaleOf(this,t,e,i),this}toOuterOf(t,e){return _t.toOuterOf(this,t,e),this}toInnerOf(t,e){return _t.toInnerOf(this,t,e),this}getFitMatrix(t,e){return _t.getFitMatrix(this,t,e)}put(t,e,i){_t.put(this,t,e,i)}spread(t,e){return _t.spread(this,t,e),this}shrink(t,e){return _t.shrink(this,t,e),this}ceil(){return _t.ceil(this),this}unsign(){return _t.unsign(this),this}float(t){return _t.float(this,t),this}add(t){return _t.add(this,t),this}addList(t){return _t.setList(this,t,!0),this}setList(t){return _t.setList(this,t),this}addListWithFn(t,e){return _t.setListWithFn(this,t,e,!0),this}setListWithFn(t,e){return _t.setListWithFn(this,t,e),this}setPoint(t){return _t.setPoint(this,t),this}setPoints(t){return _t.setPoints(this,t),this}addPoint(t){return _t.addPoint(this,t),this}getPoints(){return _t.getPoints(this)}hitPoint(t,e){return _t.hitPoint(this,t,e)}hitRadiusPoint(t,e){return _t.hitRadiusPoint(this,t,e)}hit(t,e){return _t.hit(this,t,e)}includes(t,e){return _t.includes(this,t,e)}intersect(t,e){return _t.intersect(this,t,e),this}getIntersect(t,e){return new yt(_t.getIntersectData(this,t,e))}isSame(t){return _t.isSame(this,t)}isEmpty(){return _t.isEmpty(this)}reset(){_t.reset(this)}}const vt=new yt;class mt{constructor(t,e,i,s,r,n){"object"==typeof 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 yt(r,e,n||t.width-r-i,o||t.height-e-s)}}const wt={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:xt}=a;class bt{constructor(t){this.repeatMap={},this.name=t}static get(t){return new bt(t)}static set filter(t){this.filterList=Et(t)}static set exclude(t){this.excludeList=Et(t)}static drawRepaint(t,e){const i=xt();t.fillWorld(e,i.replace("1)",".1)")),t.strokeWorld(e,i)}static drawBounds(t,e,i){const s="hit"===bt.showBounds,r=t.__nowWorld,n=xt();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(Bt.enable){if(Bt.filterList.length&&Bt.filterList.every((t=>t!==this.name)))return;if(Bt.excludeList.length&&Bt.excludeList.some((t=>t===this.name)))return;console.log("%c"+this.name,"color:#21ae62",...t)}}tip(...t){Bt.enable&&this.warn(...t)}warn(...t){Bt.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 Et(t){return t?"string"==typeof t&&(t=[t]):t=[],t}bt.filterList=[],bt.excludeList=[],bt.showWarn=!0;const Bt=bt,Pt=bt.get("RunTime"),kt={currentId:0,currentName:"",idMap:{},nameMap:{},nameToIdMap:{},start(t,e){const s=i.create(i.RUNTIME);return Ct.currentId=Ct.idMap[s]=e?performance.now():Date.now(),Ct.currentName=Ct.nameMap[s]=t,Ct.nameToIdMap[t]=s,s},end(t,e){const i=Ct.idMap[t],s=Ct.nameMap[t],r=e?(performance.now()-i)/1e3:Date.now()-i;Ct.idMap[t]=Ct.nameMap[t]=Ct.nameToIdMap[s]=void 0,Pt.log(s,r,"ms")},endOfName(t,e){const i=Ct.nameToIdMap[t];void 0!==i&&Ct.end(i,e)}},Ct=kt,Rt=[],Tt={list:{},add(t,...e){this.list[t]=!0,Rt.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((()=>Rt.forEach((t=>Tt.has(t,!0)))));const St={editor:t=>Tt.need("editor")},Lt=bt.get("UICreator"),Ot={list:{},register(t){const{__tag:e}=t.prototype;Dt[e]&&Lt.repeat(e),Dt[e]=t},get(t,e,i,s,r,n){Dt[t]||Lt.error("not register "+t);const o=new Dt[t](e);return void 0!==i&&(o.x=i,s&&(o.y=s),r&&(o.width=r),n&&(o.height=n)),o}},{list:Dt}=Ot,It=bt.get("EventCreator"),At={nameList:{},register(t){let e;Object.keys(t).forEach((i=>{e=t[i],"string"==typeof e&&(Mt[e]&&It.repeat(e),Mt[e]=t)}))},changeName(t,e){const i=Mt[t];if(i){const s=Object.keys(i).find((e=>i[e]===t));s&&(i[s]=e,Mt[e]=i)}},has(t){return!!this.nameList[t]},get:(t,...e)=>new Mt[t](...e)},{nameList:Mt}=At;class Wt{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=St.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()}}const Ft={default:(t,e)=>(Ut(e,t),Ut(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 Ut(t[r],e[r],i&&i[r]);i&&r in i?(null===(o=i[r])||void 0===o?void 0:o.constructor)===Object&&Ut(t[r]={},e[r],i[r]):t[r]=e[r]}))},copyAttrs:(t,e,i)=>(i.forEach((i=>{void 0!==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:Ut}=Ft;class zt{get __useNaturalRatio(){return!0}get __isLinePath(){const{path:t}=this;return t&&6===t.length&&1===t[0]}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(void 0!==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]=void 0===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(void 0!==e)return e}if("path"!==t||this.__pathInputed)return this["_"+t]}__removeInput(t){this.__input&&void 0!==this.__input[t]&&(this.__input[t]=void 0)}__getInputData(t,e){const i={};if(t)if(t instanceof Array)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 r in this)if("_"!==r[0]&&(t=this["_"+r],void 0!==t)){if("path"===r&&!this.__pathInputed)continue;e=s?s[r]:void 0,i[r]=void 0===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}}var Nt;t.Answer=void 0,(Nt=t.Answer||(t.Answer={}))[Nt.No=0]="No",Nt[Nt.Yes=1]="Yes",Nt[Nt.NoAndSkip=2]="NoAndSkip",Nt[Nt.YesAndSkip=3]="YesAndSkip";const Yt={};function Xt(t){return"{}"===JSON.stringify(t)}function Ht(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 jt(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 Gt(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 Vt=[];function Kt(){return(t,e)=>{Vt.push(e)}}const qt=[];class Zt{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||qt)}get dashPattern(){return this.context.getLineDash()}__bindContext(){let t;Vt.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){"object"==typeof 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}}Ht([Gt("imageSmoothingEnabled")],Zt.prototype,"smooth",void 0),Ht([Gt("imageSmoothingQuality")],Zt.prototype,"smoothLevel",void 0),Ht([Gt("globalAlpha")],Zt.prototype,"opacity",void 0),Ht([Gt()],Zt.prototype,"fillStyle",void 0),Ht([Gt()],Zt.prototype,"strokeStyle",void 0),Ht([Gt("lineWidth")],Zt.prototype,"strokeWidth",void 0),Ht([Gt("lineCap")],Zt.prototype,"strokeCap",void 0),Ht([Gt("lineJoin")],Zt.prototype,"strokeJoin",void 0),Ht([Gt("lineDashOffset")],Zt.prototype,"dashOffset",void 0),Ht([Gt()],Zt.prototype,"miterLimit",void 0),Ht([Gt()],Zt.prototype,"shadowBlur",void 0),Ht([Gt()],Zt.prototype,"shadowColor",void 0),Ht([Gt()],Zt.prototype,"shadowOffsetX",void 0),Ht([Gt()],Zt.prototype,"shadowOffsetY",void 0),Ht([Gt()],Zt.prototype,"filter",void 0),Ht([Gt()],Zt.prototype,"font",void 0),Ht([Gt()],Zt.prototype,"fontKerning",void 0),Ht([Gt()],Zt.prototype,"fontStretch",void 0),Ht([Gt()],Zt.prototype,"fontVariantCaps",void 0),Ht([Gt()],Zt.prototype,"textAlign",void 0),Ht([Gt()],Zt.prototype,"textBaseline",void 0),Ht([Gt()],Zt.prototype,"textRendering",void 0),Ht([Gt()],Zt.prototype,"wordSpacing",void 0),Ht([Gt()],Zt.prototype,"letterSpacing",void 0),Ht([Gt()],Zt.prototype,"direction",void 0),Ht([Kt()],Zt.prototype,"setTransform",null),Ht([Kt()],Zt.prototype,"resetTransform",null),Ht([Kt()],Zt.prototype,"getTransform",null),Ht([Kt()],Zt.prototype,"save",null),Ht([Kt()],Zt.prototype,"restore",null),Ht([Kt()],Zt.prototype,"translate",null),Ht([Kt()],Zt.prototype,"scale",null),Ht([Kt()],Zt.prototype,"rotate",null),Ht([Kt()],Zt.prototype,"fill",null),Ht([Kt()],Zt.prototype,"stroke",null),Ht([Kt()],Zt.prototype,"clip",null),Ht([Kt()],Zt.prototype,"fillRect",null),Ht([Kt()],Zt.prototype,"strokeRect",null),Ht([Kt()],Zt.prototype,"clearRect",null),Ht([Kt()],Zt.prototype,"beginPath",null),Ht([Kt()],Zt.prototype,"moveTo",null),Ht([Kt()],Zt.prototype,"lineTo",null),Ht([Kt()],Zt.prototype,"bezierCurveTo",null),Ht([Kt()],Zt.prototype,"quadraticCurveTo",null),Ht([Kt()],Zt.prototype,"closePath",null),Ht([Kt()],Zt.prototype,"arc",null),Ht([Kt()],Zt.prototype,"arcTo",null),Ht([Kt()],Zt.prototype,"ellipse",null),Ht([Kt()],Zt.prototype,"rect",null),Ht([Kt()],Zt.prototype,"roundRect",null),Ht([Kt()],Zt.prototype,"createConicGradient",null),Ht([Kt()],Zt.prototype,"createLinearGradient",null),Ht([Kt()],Zt.prototype,"createPattern",null),Ht([Kt()],Zt.prototype,"createRadialGradient",null),Ht([Kt()],Zt.prototype,"fillText",null),Ht([Kt()],Zt.prototype,"measureText",null),Ht([Kt()],Zt.prototype,"strokeText",null);const{copy:$t,multiplyParent:Qt}=b,{round:Jt}=Math,te={width:1,height:1,pixelRatio:1},ee=["width","height","pixelRatio"];class ie extends Zt{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,s){super(),this.size={},this.worldTransform={},t||(t=te),this.manager=s,this.innerId=i.create(i.CNAVAS);const{width:r,height:n,pixelRatio:o}=t;this.autoLayout=!r||!n,this.size.pixelRatio=o|e.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;Ft.copyAttrs(s,t,ee),ee.forEach((t=>s[t]||(s[t]=1))),this.bounds=new yt(0,0,this.width,this.height),this.context&&!this.unreal&&(this.updateViewSize(),this.smooth=this.config.smooth),this.updateClientBounds(),this.context&&!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&&Qt(t,e,r),r.a=t.a*i,r.b=t.b*i,r.c=t.c*i,r.d=t.d*i,r.e=t.e*i,r.f=t.f*i,s&&(t.half&&t.half*i%2?(r.e=Jt(r.e-.5)+.5,r.f=Jt(r.f-.5)+.5):(r.e=Jt(r.e),r.f=Jt(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:r,dashOffset:n,miterLimit:o}=t;e&&(e.strokeCap&&(i=e.strokeCap),e.strokeJoin&&(s=e.strokeJoin),void 0!==e.dashPattern&&(r=e.dashPattern),void 0!==e.dashOffset&&(n=e.dashOffset),e.miterLimit&&(o=e.miterLimit)),this.strokeCap=i,this.strokeJoin=s,this.dashPattern=r,this.dashOffset=n,this.miterLimit=o}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){if(s&&(this.blendMode=s),e){const{pixelRatio:s}=this;i||(i=e),this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x*s,i.y*s,i.width*s,i.height*s)}else this.drawImage(t.view,0,0);s&&(this.blendMode="source-over")}copyWorldToInner(t,e,i,s){if(s&&(this.blendMode=s),e.b||e.c)this.save(),this.resetTransform(),this.copyWorld(t,e,_t.tempToOuterOf(i,e)),this.restore();else{const{pixelRatio:s}=this;this.drawImage(t.view,e.x*s,e.y*s,e.width*s,e.height*s,i.x,i.y,i.width,i.height)}s&&(this.blendMode="source-over")}copyWorldByReset(t,e,i,s,r){this.resetTransform(),this.copyWorld(t,e,i,s),r||this.useWorldTransform()}useGrayscaleAlpha(t){let e,i;this.setTempBounds(t,!0,!0);const{context:s}=this,r=s.getImageData(vt.x,vt.y,vt.width,vt.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,vt.x,vt.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){i&&(this.blendMode=i),this.fillStyle=e,this.setTempBounds(t),this.fillRect(vt.x,vt.y,vt.width,vt.height),i&&(this.blendMode="source-over")}strokeWorld(t,e,i){i&&(this.blendMode=i),this.strokeStyle=e,this.setTempBounds(t),this.strokeRect(vt.x,vt.y,vt.width,vt.height),i&&(this.blendMode="source-over")}clipWorld(t,e){this.beginPath(),this.setTempBounds(t,e),this.rect(vt.x,vt.y,vt.width,vt.height),this.clip()}clipUI(t){t.windingRule?this.clip(t.windingRule):this.clip()}clearWorld(t,e){this.setTempBounds(t,e),this.clearRect(vt.x,vt.y,vt.width,vt.height)}clear(){const{pixelRatio:t}=this;this.clearRect(0,0,this.width*t+2,this.height*t+2)}setTempBounds(t,e,i){vt.set(t),i&&vt.intersect(this.bounds),vt.scale(this.pixelRatio),e&&vt.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):St.canvas(Object.assign({},i));return r.save(),t&&($t(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,!0):this.clear(),this.manager?this.manager.recycle(this):this.destroy())}updateRender(t){}unrealCanvas(){}destroy(){this.manager=this.view=this.parentView=null}}const se={creator:{},parse(t,e){},convertToCanvasData(t,e){}},re={N:21,D:22,X:23,G:24,F:25,O:26,P:27,U:28},ne=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},re),oe={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},ae={m:10,l:20,H:3,h:30,V:4,v:40,c:50,S:6,s:60,q:70,T:8,t:80,A:9,a:90},he=Object.assign(Object.assign({},ae),re),le=ne,de={};for(let t in le)de[le[t]]=t;const ce={};for(let t in le)ce[le[t]]=oe[t];const ue={drawRoundRect(t,e,i,s,r,n){const o=a.fourNumber(n,Math.min(s/2,r/2)),h=e+s,l=i+r;o[0]?t.moveTo(e+o[0],i):t.moveTo(e,i),o[1]?t.arcTo(h,i,h,l,o[1]):t.lineTo(h,i),o[2]?t.arcTo(h,l,e,l,o[2]):t.lineTo(h,l),o[3]?t.arcTo(e,l,e,i,o[3]):t.lineTo(e,l),o[0]?t.arcTo(e,i,h,i,o[0]):t.lineTo(e,i)}},{sin:_e,cos:pe,atan2:ge,ceil:fe,abs:ye,PI:ve,sqrt:me,pow:we}=Math,{setPoint:xe,addPoint:be}=Y,{set:Ee,toNumberPoints:Be}=D,{M:Pe,L:ke,C:Ce,Q:Re,Z:Te}=ne,Se={},Le={points(t,e,i,s){let r=Be(e);if(t.push(Pe,r[0],r[1]),i&&r.length>5){let e,n,o,a,h,l,d,c,u,_,p,g,f,y=r.length;const v=!0===i?.5:i;s&&(r=[r[y-2],r[y-1],...r,r[0],r[1],r[2],r[3]],y=r.length);for(let i=2;i<y-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=me(we(o-e,2)+we(a-n,2)),g=me(we(h-o,2)+we(l-a,2)),(p||g)&&(f=p+g,p=v*p/f,g=v*g/f,h-=e,l-=n,d=o-p*h,c=a-p*l,2===i?s||t.push(Re,d,c,o,a):t.push(Ce,u,_,d,c,o,a),u=o+g*h,_=a+g*l);s||t.push(Re,u,_,r[y-2],r[y-1])}else for(let e=2,i=r.length;e<i;e+=2)t.push(ke,r[e],r[e+1]);s&&t.push(Te)},rect(t,e,i,s,r){se.creator.path=t,se.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){se.creator.path=[],ue.drawRoundRect(se.creator,e,i,s,r,n),t.push(...se.convertToCanvasData(se.creator.path,!0))},arcTo(t,e,i,s,r,n,o,a,h,u,_){const p=s-e,g=r-i,f=n-s,y=o-r;let v=ge(g,p),m=ge(y,f),w=m-v;if(w<0&&(w+=d),w===ve||ye(p+g)<1e-12||ye(f+y)<1e-12)return t&&t.push(ke,s,r),h&&(xe(h,e,i),be(h,s,r)),_&&Ee(_,e,i),void(u&&Ee(u,s,r));const x=p*y-f*g<0,b=x?-1:1,E=a/pe(w/2),B=s+E*pe(v+w/2+c*b),P=r+E*_e(v+w/2+c*b);return v-=c*b,m-=c*b,Ie(t,B,P,a,a,0,v/l,m/l,x,h,u,_)},arc:(t,e,i,s,r,n,o,a,h,l)=>Ie(t,e,i,s,s,0,r,n,o,a,h,l),ellipse(t,e,i,s,r,n,o,a,h,u,_,p){const g=n*l,f=_e(g),y=pe(g);let v=o*l,m=a*l;v>ve&&(v-=d),m<0&&(m+=d);let w=m-v;w<0?w+=d:w>d&&(w-=d),h&&(w-=d);const x=fe(ye(w/c)),b=w/x,E=_e(b/4),B=8/3*E*E/_e(b/2);m=v+b;let P,k,C,R,T,S,L,O,D=pe(v),I=_e(v),A=C=y*s*D-f*r*I,M=R=f*s*D+y*r*I,W=e+C,F=i+R;t&&t.push(t.length?ke:Pe,W,F),u&&xe(u,W,F),p&&Ee(p,W,F);for(let n=0;n<x;n++)P=pe(m),k=_e(m),C=y*s*P-f*r*k,R=f*s*P+y*r*k,T=e+A-B*(y*s*I+f*r*D),S=i+M-B*(f*s*I-y*r*D),L=e+C+B*(y*s*k+f*r*P),O=i+R+B*(f*s*k-y*r*P),t&&t.push(Ce,T,S,L,O,e+C,i+R),u&&De(e+A,i+M,T,S,L,O,e+C,i+R,u,!0),A=C,M=R,D=P,I=k,v=m,m+=b;_&&Ee(_,e+C,i+R)},quadraticCurveTo(t,e,i,s,r,n,o){t.push(Ce,(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){De(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,v,m=t,w=i,x=r,b=o;for(let t=0;t<2;++t)if(1==t&&(m=e,w=s,x=n,b=a),c=-3*m+9*w-9*x+3*b,u=6*m-12*w+6*x,_=3*w-3*m,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,v=Math.sqrt(y),y<0||(g=(-u+v)/(2*c),0<g&&g<1&&d.push(g),f=(-u-v)/(2*c),0<f&&f<1&&d.push(f));l?be(h,t,e):xe(h,t,e),be(h,o,a);for(let l=0,c=d.length;l<c;l++)Oe(d[l],t,e,i,s,r,n,o,a,Se),be(h,Se.x,Se.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 Oe(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:Oe,toTwoPointBounds:De,ellipse:Ie}=Le,{sin:Ae,cos:Me,sqrt:We,atan2:Fe}=Math,{ellipse:Ue}=Le,ze={ellipticalArc(t,i,s,r,n,o,a,h,c,u,_){const p=(c-i)/2,g=(u-s)/2,f=o*l,y=Ae(f),v=Me(f),m=-v*p-y*g,w=-v*g+y*p,x=r*r,b=n*n,E=w*w,B=m*m,P=x*b-x*E-b*B;let k=0;if(P<0){const t=We(1-P/(x*b));r*=t,n*=t}else k=(a===h?-1:1)*We(P/(x*E+b*B));const C=k*r*w/n,R=-k*n*m/r,T=Fe((w-R)/n,(m-C)/r),S=Fe((-w-R)/n,(-m-C)/r);let L=S-T;0===h&&L>0?L-=d:1===h&&L<0&&(L+=d);const O=i+p+v*C-y*R,D=s+g+y*C+v*R,I=L<0?1:0;_||e.ellipseToCurve?Ue(t,O,D,r,n,o,T/l,S/l,I):r!==n||o?t.push(ne.G,O,D,r,n,o,T/l,S/l,I):t.push(ne.O,O,D,r,T/l,S/l,I)}},{M:Ne,m:Ye,L:Xe,l:He,H:je,h:Ge,V:Ve,v:Ke,C:qe,c:Ze,S:$e,s:Qe,Q:Je,q:ti,T:ei,t:ii,A:si,a:ri,Z:ni,z:oi,N:ai,D:hi,X:li,G:di,F:ci,O:ui,P:_i,U:pi}=ne,{rect:gi,roundRect:fi,arcTo:yi,arc:vi,ellipse:mi,quadraticCurveTo:wi}=Le,{ellipticalArc:xi}=ze,bi=bt.get("PathConvert"),Ei={},Bi={current:{dot:0},stringify(t,e){let i,s,r,n=0,o=t.length,h="";for(;n<o;){s=t[n],i=ce[s],h+=s===r?" ":de[s];for(let s=1;s<i;s++)h+=a.float(t[n+s],e),s===i-1||(h+=" ");r=s,n+=i}return h},parse(t,e){let i,s,r,n="";const o=[],a=e?he:ae;for(let e=0,h=t.length;e<h;e++)s=t[e],wt[s]?("."===s&&(Pi.dot&&(ki(o,n),n=""),Pi.dot++),"0"===n&&"."!==s&&(ki(o,n),n=""),n+=s):ne[s]?(n&&(ki(o,n),n=""),Pi.name=ne[s],Pi.length=oe[s],Pi.index=0,ki(o,Pi.name),!i&&a[s]&&(i=!0)):"-"===s||"+"===s?"e"===r||"E"===r?n+=s:(n&&ki(o,n),n=s):n&&(ki(o,n),n=""),r=s;return n&&ki(o,n),i?Bi.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 Ye:t[c+1]+=a,t[c+2]+=h;case Ne:a=t[c+1],h=t[c+2],_.push(Ne,a,h),c+=3;break;case Ge:t[c+1]+=a;case je:a=t[c+1],_.push(Xe,a,h),c+=2;break;case Ke:t[c+1]+=h;case Ve:h=t[c+1],_.push(Xe,a,h),c+=2;break;case He:t[c+1]+=a,t[c+2]+=h;case Xe:a=t[c+1],h=t[c+2],_.push(Xe,a,h),c+=3;break;case Qe:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=$e;case $e:o=n===qe||n===$e,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(qe,l,d,i,s,a,h),c+=5;break;case Ze: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=qe;case qe:i=t[c+3],s=t[c+4],a=t[c+5],h=t[c+6],_.push(qe,t[c+1],t[c+2],i,s,a,h),c+=7;break;case ii:t[c+1]+=a,t[c+2]+=h,r=ei;case ei:o=n===Je||n===ei,i=o?2*a-i:t[c+1],s=o?2*h-s:t[c+2],e?wi(_,a,h,i,s,t[c+1],t[c+2]):_.push(Je,i,s,t[c+1],t[c+2]),a=t[c+1],h=t[c+2],c+=3;break;case ti:t[c+1]+=a,t[c+2]+=h,t[c+3]+=a,t[c+4]+=h,r=Je;case Je:i=t[c+1],s=t[c+2],e?wi(_,a,h,i,s,t[c+3],t[c+4]):_.push(Je,i,s,t[c+3],t[c+4]),a=t[c+3],h=t[c+4],c+=5;break;case ri:t[c+6]+=a,t[c+7]+=h;case si:xi(_,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 oi:case ni:_.push(ni),c++;break;case ai:a=t[c+1],h=t[c+2],e?gi(_,a,h,t[c+3],t[c+4]):Ci(_,t,c,5),c+=5;break;case hi:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4],[t[c+5],t[c+6],t[c+7],t[c+8]]):Ci(_,t,c,9),c+=9;break;case li:a=t[c+1],h=t[c+2],e?fi(_,a,h,t[c+3],t[c+4],t[c+5]):Ci(_,t,c,6),c+=6;break;case di:mi(e?_:Ci(_,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,Ei),a=Ei.x,h=Ei.y,c+=9;break;case ci:e?mi(_,t[c+1],t[c+2],t[c+3],t[c+4],0,0,360,!1):Ci(_,t,c,5),a=t[c+1]+t[c+3],h=t[c+2],c+=5;break;case ui:vi(e?_:Ci(_,t,c,7),t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],t[c+6],null,Ei),a=Ei.x,h=Ei.y,c+=7;break;case _i:e?vi(_,t[c+1],t[c+2],t[c+3],0,360,!1):Ci(_,t,c,4),a=t[c+1]+t[c+3],h=t[c+2],c+=4;break;case pi:yi(e?_:Ci(_,t,c,6),a,h,t[c+1],t[c+2],t[c+3],t[c+4],t[c+5],null,Ei),a=Ei.x,h=Ei.y,c+=6;break;default:return bi.error(`command: ${r} [index:${c}]`,t),_}n=r}return _},objectToCanvasData(t){const e=[];return t.forEach((t=>{switch(t.name){case"M":e.push(Ne,t.x,t.y);break;case"L":e.push(Xe,t.x,t.y);break;case"C":e.push(qe,t.x1,t.y1,t.x2,t.y2,t.x,t.y);break;case"Q":e.push(Je,t.x1,t.y1,t.x,t.y);break;case"Z":e.push(ni)}})),e},copyData(t,e,i,s){for(let r=i,n=i+s;r<n;r++)t.push(e[r])},pushData(t,e){Pi.index===Pi.length&&(Pi.index=1,t.push(Pi.name)),t.push(Number(e)),Pi.index++,Pi.dot=0}},{current:Pi,pushData:ki,copyData:Ci}=Bi,{M:Ri,L:Ti,C:Si,Q:Li,Z:Oi,N:Di,D:Ii,X:Ai,G:Mi,F:Wi,O:Fi,P:Ui,U:zi}=ne,{getMinDistanceFrom:Ni,getRadianFrom:Yi}=D,{tan:Xi,min:Hi,abs:ji}=Math,Gi={},Vi={beginPath(t){t.length=0},moveTo(t,e,i){t.push(Ri,e,i)},lineTo(t,e,i){t.push(Ti,e,i)},bezierCurveTo(t,e,i,s,r,n,o){t.push(Si,e,i,s,r,n,o)},quadraticCurveTo(t,e,i,s,r){t.push(Li,e,i,s,r)},closePath(t){t.push(Oi)},rect(t,e,i,s,r){t.push(Di,e,i,s,r)},roundRect(t,e,i,s,r,n){if("number"==typeof n)t.push(Ai,e,i,s,r,n);else{const o=a.fourNumber(n);o?t.push(Ii,e,i,s,r,...o):t.push(Di,e,i,s,r)}},ellipse(t,e,i,s,r,n,o,a,h){void 0===n?t.push(Wi,e,i,s,r):(void 0===o&&(o=0),void 0===a&&(a=360),t.push(Mi,e,i,s,r,n,o,a,h?1:0))},arc(t,e,i,s,r,n,o){void 0===r?t.push(Ui,e,i,s):(void 0===n&&(n=360),t.push(Fi,e,i,s,r,n,o?1:0))},arcTo(t,e,i,s,r,n,o,a){if(void 0!==o){const t=Ni(o,a,e,i,s,r);n=Hi(n,Hi(t/2,t/2*ji(Xi(Yi(o,a,e,i,s,r)/2))))}t.push(zi,e,i,s,r,n)},drawEllipse(t,e,i,s,r,n,o,a,h){Le.ellipse(null,e,i,s,r,void 0===n?0:n,void 0===o?0:o,void 0===a?360:a,h,null,null,Gi),t.push(Ri,Gi.x,Gi.y),Ki(t,e,i,s,r,n,o,a,h)},drawArc(t,e,i,s,r,n,o){Le.arc(null,e,i,s,void 0===r?0:r,void 0===n?360:n,o,null,null,Gi),t.push(Ri,Gi.x,Gi.y),qi(t,e,i,s,r,n,o)},drawPoints(t,e,i,s){Le.points(t,e,i,s)}},{ellipse:Ki,arc:qi}=Vi,{moveTo:Zi,lineTo:$i,quadraticCurveTo:Qi,bezierCurveTo:Ji,closePath:ts,beginPath:es,rect:is,roundRect:ss,ellipse:rs,arc:ns,arcTo:os,drawEllipse:as,drawArc:hs,drawPoints:ls}=Vi;class ds{set path(t){this.__path=t}get path(){return this.__path}constructor(t){this.set(t)}set(t){return this.__path=t?"string"==typeof t?se.parse(t):t:[],this}beginPath(){return es(this.__path),this.paint(),this}moveTo(t,e){return Zi(this.__path,t,e),this.paint(),this}lineTo(t,e){return $i(this.__path,t,e),this.paint(),this}bezierCurveTo(t,e,i,s,r,n){return Ji(this.__path,t,e,i,s,r,n),this.paint(),this}quadraticCurveTo(t,e,i,s){return Qi(this.__path,t,e,i,s),this.paint(),this}closePath(){return ts(this.__path),this.paint(),this}rect(t,e,i,s){return is(this.__path,t,e,i,s),this.paint(),this}roundRect(t,e,i,s,r){return ss(this.__path,t,e,i,s,r),this.paint(),this}ellipse(t,e,i,s,r,n,o,a){return rs(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}arc(t,e,i,s,r,n){return ns(this.__path,t,e,i,s,r,n),this.paint(),this}arcTo(t,e,i,s,r){return os(this.__path,t,e,i,s,r),this.paint(),this}drawEllipse(t,e,i,s,r,n,o,a){return as(this.__path,t,e,i,s,r,n,o,a),this.paint(),this}drawArc(t,e,i,s,r,n){return hs(this.__path,t,e,i,s,r,n),this.paint(),this}drawPoints(t,e,i){return ls(this.__path,t,e,i),this.paint(),this}clearPath(){return this.beginPath()}paint(){}}const{M:cs,L:us,C:_s,Q:ps,Z:gs,N:fs,D:ys,X:vs,G:ms,F:ws,O:xs,P:bs,U:Es}=ne,Bs=bt.get("PathDrawer"),Ps={drawPathByData(t,e){if(!e)return;let i,s=0,r=e.length;for(;s<r;)switch(i=e[s],i){case cs:t.moveTo(e[s+1],e[s+2]),s+=3;break;case us:t.lineTo(e[s+1],e[s+2]),s+=3;break;case _s:t.bezierCurveTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5],e[s+6]),s+=7;break;case ps: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 fs:t.rect(e[s+1],e[s+2],e[s+3],e[s+4]),s+=5;break;case ys: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 vs:t.roundRect(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;case ms:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]*l,e[s+6]*l,e[s+7]*l,e[s+8]),s+=9;break;case ws:t.ellipse(e[s+1],e[s+2],e[s+3],e[s+4],0,0,d,!1),s+=5;break;case xs:t.arc(e[s+1],e[s+2],e[s+3],e[s+4]*l,e[s+5]*l,e[s+6]),s+=7;break;case bs:t.arc(e[s+1],e[s+2],e[s+3],0,d,!1),s+=4;break;case Es:t.arcTo(e[s+1],e[s+2],e[s+3],e[s+4],e[s+5]),s+=6;break;default:return void Bs.error(`command: ${i} [index:${s}]`,e)}}},{M:ks,L:Cs,C:Rs,Q:Ts,Z:Ss,N:Ls,D:Os,X:Ds,G:Is,F:As,O:Ms,P:Ws,U:Fs}=ne,{toTwoPointBounds:Us,toTwoPointBoundsByQuadraticCurve:zs,arcTo:Ns,arc:Ys,ellipse:Xs}=Le,{addPointBounds:Hs,copy:js,addPoint:Gs,setPoint:Vs,addBounds:Ks,toBounds:qs}=Y,Zs=bt.get("PathBounds");let $s,Qs,Js;const tr={},er={},ir={},sr={toBounds(t,e){sr.toTwoPointBounds(t,er),qs(er,e)},toTwoPointBounds(t,e){if(!t||!t.length)return Vs(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===Ss||o===Rs||o===Ts?Vs(e,h,l):Vs(e,t[a+1],t[a+2])),o){case ks:case Cs:h=t[a+1],l=t[a+2],Gs(e,h,l),a+=3;break;case Rs:r=t[a+5],n=t[a+6],Us(h,l,t[a+1],t[a+2],t[a+3],t[a+4],r,n,tr),Hs(e,tr),h=r,l=n,a+=7;break;case Ts:i=t[a+1],s=t[a+2],r=t[a+3],n=t[a+4],zs(h,l,i,s,r,n,tr),Hs(e,tr),h=r,l=n,a+=5;break;case Ss:a+=1;break;case Ls:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=5;break;case Os:case Ds:h=t[a+1],l=t[a+2],Ks(e,h,l,t[a+3],t[a+4]),a+=o===Os?9:6;break;case Is:Xs(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],tr,ir),0===a?js(e,tr):Hs(e,tr),h=ir.x,l=ir.y,a+=9;break;case As:h=t[a+1],l=t[a+2],Qs=t[a+3],Js=t[a+4],Ks(e,h-Qs,l-Js,2*Qs,2*Js),h+=Qs,a+=5;break;case Ms:Ys(null,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],t[a+6],tr,ir),0===a?js(e,tr):Hs(e,tr),h=ir.x,l=ir.y,a+=7;break;case Ws:h=t[a+1],l=t[a+2],$s=t[a+3],Ks(e,h-$s,l-$s,2*$s,2*$s),h+=$s,a+=4;break;case Fs:Ns(null,h,l,t[a+1],t[a+2],t[a+3],t[a+4],t[a+5],tr,ir),0===a?js(e,tr):Hs(e,tr),h=ir.x,l=ir.y,a+=6;break;default:return void Zs.error(`command: ${o} [index:${a}]`,t)}}},{M:rr,L:nr,Z:or}=ne,{getCenterX:ar,getCenterY:hr}=D,{arcTo:lr}=Vi,dr={smooth(t,e,i){let s,r,n,o=0,a=0,h=0,l=0,d=0,c=0,u=0,_=0,p=0;const g=t.length,f=[];for(;o<g;){switch(s=t[o],s){case rr:l=_=t[o+1],d=p=t[o+2],o+=3,t[o]===nr?(c=t[o+1],u=t[o+2],f.push(rr,ar(l,c),hr(d,u))):f.push(rr,l,d);break;case nr:switch(a=t[o+1],h=t[o+2],o+=3,t[o]){case nr:lr(f,a,h,t[o+1],t[o+2],e,_,p);break;case or:lr(f,a,h,l,d,e,_,p);break;default:f.push(nr,a,h)}_=a,p=h;break;case or:r!==or&&(lr(f,l,d,c,u,e,_,p),f.push(or)),o+=1;break;default:n=ce[s];for(let e=0;e<n;e++)f.push(t[o+e]);o+=n}r=s}return s!==or&&(f[1]=l,f[2]=d),f}};se.creator=new ds,se.parse=Bi.parse,se.convertToCanvasData=Bi.toCanvasData;const cr=new ds,{drawRoundRect:ur}=ue;function _r(t){!function(t){t&&!t.roundRect&&(t.roundRect=function(t,e,i,s,r){ur(this,t,e,i,s,r)})}(t)}const pr={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=pr;gr.alphaPixelTypes.forEach((t=>gr.upperCaseTypeMap[t]=t.toUpperCase()));const fr=bt.get("TaskProcessor");class yr{constructor(t){this.parallel=!0,this.time=1,this.id=i.create(i.TASK),this.task=t}run(){return jt(this,void 0,void 0,(function*(){try{this.task&&!this.isComplete&&this.parent.running&&(yield this.task())}catch(t){fr.error(t)}}))}complete(){this.isComplete=!0,this.parent=null,this.task=null}cancel(){this.isCancel=!0,this.complete()}}class vr{get total(){return this.list.length+this.delayNumber}get finishedIndex(){return this.isComplete?0:this.index+this.parallelSuccessNumber}get remain(){return this.isComplete?this.total:this.total-this.finishedIndex}get percent(){const{total:t}=this;let e=0,i=0;for(let s=0;s<t;s++)s<=this.finishedIndex?(i+=this.list[s].time,s===this.finishedIndex&&(e=i)):e+=this.list[s].time;return this.isComplete?1:i/e}constructor(t){this.config={parallel:6},this.list=[],this.running=!1,this.isComplete=!0,this.index=0,this.delayNumber=0,t&&Ft.assign(this.config,t),this.empty()}add(t,e){let i,s,r,n;const o=new yr(t);return o.parent=this,"number"==typeof e?n=e:e&&(s=e.parallel,i=e.start,r=e.time,n=e.delay),r&&(o.time=r),!1===s&&(o.parallel=!1),void 0===n?this.push(o,i):(this.delayNumber++,setTimeout((()=>{this.delayNumber&&(this.delayNumber--,this.push(o,i))}),n)),this.isComplete=!1,o}push(t,e){this.list.push(t),!1===e||this.timer||(this.timer=setTimeout((()=>this.start())))}empty(){this.index=0,this.parallelSuccessNumber=0,this.list=[],this.parallelList=[],this.delayNumber=0}start(){this.running||(this.running=!0,this.isComplete=!1,this.run())}pause(){clearTimeout(this.timer),this.timer=null,this.running=!1}resume(){this.start()}skip(){this.index++,this.resume()}stop(){this.isComplete=!0,this.list.forEach((t=>{t.isComplete||t.cancel()})),this.pause(),this.empty()}run(){this.running&&(this.setParallelList(),this.parallelList.length>1?this.runParallelTasks():this.remain?this.runTask():this.onComplete())}runTask(){const t=this.list[this.index];t?t.run().then((()=>{this.onTask(t),this.index++,this.nextTask()})).catch((t=>{this.onError(t)})):this.nextTask()}runParallelTasks(){this.parallelList.forEach((t=>this.runParallelTask(t)))}runParallelTask(t){t.run().then((()=>{this.onTask(t),this.fillParallelTask()})).catch((t=>{this.onParallelError(t)}))}nextTask(){this.total===this.finishedIndex?this.onComplete():this.timer=set