UNPKG

leafer-ui

Version:

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

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