UNPKG

leafer-editor

Version:

**leafer-editor** 在 [leafer-ui](https://github.com/leaferjs/leafer-ui) 的基础上,集成了 图形编辑器、视图控制 、滚动条、箭头、HTML 插件,适用于在线图形编辑的场景。

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